mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-02 20:10:32 +00:00
Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy
This commit is contained in:
parent
8780f83262
commit
25686ed4be
294 changed files with 3894 additions and 2813 deletions
|
|
@ -88,8 +88,8 @@ void GuiEaseViewCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// Draw axis.
|
||||
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + 0.0f, zeroX, zeroY + plotH, mAxisColor );
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + plotH, zeroX + plotW, zeroY + plotH, mAxisColor );
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + 0.0f, zeroX, zeroY + plotH, mAxisColor.toColorI());
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + plotH, zeroX + plotW, zeroY + plotH, mAxisColor.toColorI());
|
||||
|
||||
F32 numPoints = W;
|
||||
F32 lastX = zeroX;
|
||||
|
|
@ -105,7 +105,7 @@ void GuiEaseViewCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
x = zeroX + x * plotW;
|
||||
y = zeroY + plotH - y * plotH;
|
||||
|
||||
GFX->getDrawUtil()->drawLine( lastX, lastY, x, y, mEaseColor );
|
||||
GFX->getDrawUtil()->drawLine( lastX, lastY, x, y, mEaseColor.toColorI());
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ class GuiEaseViewCtrl : public GuiControl
|
|||
protected:
|
||||
|
||||
EaseF mEase; // ease we are visualizing
|
||||
ColorF mAxisColor; // color to draw axis in
|
||||
ColorF mEaseColor; // color to draw ease in
|
||||
LinearColorF mAxisColor; // color to draw axis in
|
||||
LinearColorF mEaseColor; // color to draw ease in
|
||||
F32 mEaseWidth; // width of lines
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
if( mSnapTargets[ axis ] )
|
||||
{
|
||||
RectI bounds = mSnapTargets[ axis ]->getGlobalBounds();
|
||||
drawer->drawRect( bounds, ColorF( .5, .5, .5, .5 ) );
|
||||
drawer->drawRect( bounds, ColorI( 128, 128, 128, 128 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -868,8 +868,8 @@ void GuiEditCtrl::drawNuts(RectI &box, ColorI &outlineColor, ColorI &nutColor)
|
|||
|
||||
if( mDrawBorderLines )
|
||||
{
|
||||
ColorF lineColor( 0.7f, 0.7f, 0.7f, 0.25f );
|
||||
ColorF lightLineColor( 0.5f, 0.5f, 0.5f, 0.1f );
|
||||
ColorI lineColor( 179, 179, 179, 64 );
|
||||
ColorI lightLineColor( 128, 128, 128, 26);
|
||||
|
||||
if(lx > 0 && ty > 0)
|
||||
{
|
||||
|
|
@ -2860,7 +2860,7 @@ class GuiEditorRuler : public GuiControl
|
|||
|
||||
void onRender(Point2I offset, const RectI &updateRect)
|
||||
{
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, ColorF(1,1,1,1));
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, ColorI::WHITE);
|
||||
|
||||
Point2I choffset(0,0);
|
||||
if( mRefCtrl != NULL )
|
||||
|
|
@ -2880,7 +2880,7 @@ class GuiEditorRuler : public GuiControl
|
|||
start = 4;
|
||||
if(!(pos % 100))
|
||||
start = 1;
|
||||
GFX->getDrawUtil()->drawLine(x, offset.y + start, x, offset.y + 10, ColorF(0,0,0,1));
|
||||
GFX->getDrawUtil()->drawLine(x, offset.y + start, x, offset.y + 10, ColorI::BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2898,7 +2898,7 @@ class GuiEditorRuler : public GuiControl
|
|||
start = 4;
|
||||
if(!(pos % 100))
|
||||
start = 1;
|
||||
GFX->getDrawUtil()->drawLine(offset.x + start, y, offset.x + 10, y, ColorF(0,0,0,1));
|
||||
GFX->getDrawUtil()->drawLine(offset.x + start, y, offset.x + 10, y, ColorI::BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
{
|
||||
GFX->getDrawUtil()->drawLine( pos.x, pos.y + ( ext.y * ( 1.0f - mIdentity.x ) ),
|
||||
pos.x + ext.x, pos.y + ( ext.y * ( 1.0f - mIdentity.y ) ),
|
||||
ColorF( 0.9f, 0.9f, 0.9f ) );
|
||||
ColorI( 230, 230, 230 ) );
|
||||
}
|
||||
|
||||
// draw the curv
|
||||
|
|
@ -207,7 +207,7 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
S32 y = (S32)(ext.y*(1.0f-mFilter.getValue(index)));
|
||||
|
||||
verts[i].point.set( (F32)(pos.x + i), (F32)(pos.y + y), 0.0f );
|
||||
verts[i].color = GFXVertexColor( ColorF( 0.4f, 0.4f, 0.4f ) );
|
||||
verts[i].color = ColorI( 103, 103, 103 );
|
||||
}
|
||||
|
||||
verts.unlock();
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ GuiGraphCtrl::GuiGraphCtrl()
|
|||
|
||||
AssertWarn( MaxPlots == 6, "Only 6 plot colors initialized. Update following code if you change MaxPlots." );
|
||||
|
||||
mGraphColor[ 0 ] = ColorF( 1.0, 1.0, 1.0 );
|
||||
mGraphColor[ 1 ] = ColorF( 1.0, 0.0, 0.0 );
|
||||
mGraphColor[ 2 ] = ColorF( 0.0, 1.0, 0.0 );
|
||||
mGraphColor[ 3 ] = ColorF( 0.0, 0.0, 1.0 );
|
||||
mGraphColor[ 4 ] = ColorF( 0.0, 1.0, 1.0 );
|
||||
mGraphColor[ 5 ] = ColorF( 0.0, 0.0, 0.0 );
|
||||
mGraphColor[ 0 ] = LinearColorF( 1.0, 1.0, 1.0 );
|
||||
mGraphColor[ 1 ] = LinearColorF( 1.0, 0.0, 0.0 );
|
||||
mGraphColor[ 2 ] = LinearColorF( 0.0, 1.0, 0.0 );
|
||||
mGraphColor[ 3 ] = LinearColorF( 0.0, 0.0, 1.0 );
|
||||
mGraphColor[ 4 ] = LinearColorF( 0.0, 1.0, 1.0 );
|
||||
mGraphColor[ 5 ] = LinearColorF( 0.0, 0.0, 0.0 );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class GuiGraphCtrl : public GuiControl
|
|||
StringTableEntry mAutoPlot[ MaxPlots ];
|
||||
U32 mAutoPlotDelay[ MaxPlots ];
|
||||
SimTime mAutoPlotLastDisplay[ MaxPlots ];
|
||||
ColorF mGraphColor[ MaxPlots ];
|
||||
LinearColorF mGraphColor[ MaxPlots ];
|
||||
Vector< F32 > mGraphData[ MaxPlots ];
|
||||
F32 mGraphMax[ MaxPlots ];
|
||||
GraphType mGraphType[ MaxPlots ];
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ bool GuiInspectorTypeImageFileName::renderTooltip( const Point2I &hoverPos, cons
|
|||
if ( !filename || !filename[0] )
|
||||
return false;
|
||||
|
||||
GFXTexHandle texture( filename, &GFXDefaultStaticDiffuseProfile, avar("%s() - tooltip texture (line %d)", __FUNCTION__, __LINE__) );
|
||||
GFXTexHandle texture( filename, &GFXStaticTextureSRGBProfile, avar("%s() - tooltip texture (line %d)", __FUNCTION__, __LINE__) );
|
||||
if ( texture.isNull() )
|
||||
return false;
|
||||
|
||||
|
|
@ -1058,7 +1058,7 @@ bool GuiInspectorTypeEaseF::updateRects()
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// GuiInspectorTypeColor (Base for ColorI/ColorF)
|
||||
// GuiInspectorTypeColor (Base for ColorI/LinearColorF)
|
||||
//-----------------------------------------------------------------------------
|
||||
GuiInspectorTypeColor::GuiInspectorTypeColor()
|
||||
: mBrowseButton( NULL )
|
||||
|
|
@ -1209,7 +1209,7 @@ void GuiInspectorTypeColorI::setValue( StringTableEntry newValue )
|
|||
IMPLEMENT_CONOBJECT(GuiInspectorTypeColorF);
|
||||
|
||||
ConsoleDocClass( GuiInspectorTypeColorF,
|
||||
"@brief Inspector field type for ColorF\n\n"
|
||||
"@brief Inspector field type for LinearColorF\n\n"
|
||||
"Editor use only.\n\n"
|
||||
"@internal"
|
||||
);
|
||||
|
|
@ -1234,7 +1234,7 @@ void GuiInspectorTypeColorF::setValue( StringTableEntry newValue )
|
|||
// Now we also set our color swatch button to the new color value.
|
||||
if ( mBrowseButton )
|
||||
{
|
||||
ColorF color(1,0,1,1);
|
||||
LinearColorF color(1,0,1,1);
|
||||
dSscanf( newValue, "%f %f %f %f", &color.red, &color.green, &color.blue, &color.alpha );
|
||||
mBrowseButton->setColor( color );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ public:
|
|||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypeColor GuiInspectorField Class (Base for ColorI/ColorF)
|
||||
// TypeColor GuiInspectorField Class (Base for ColorI/LinearColorF)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class GuiSwatchButtonCtrl;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ GuiParticleGraphCtrl::GuiParticleGraphCtrl()
|
|||
|
||||
for(S32 i = 0; i < MaxPlots; i++)
|
||||
{
|
||||
mPlots[i].mGraphColor = ColorF(1.0, 1.0, 1.0);
|
||||
mPlots[i].mGraphColor = LinearColorF(1.0, 1.0, 1.0);
|
||||
VECTOR_SET_ASSOCIATION(mPlots[i].mGraphData);
|
||||
mPlots[i].mGraphMax.x = 1;
|
||||
mPlots[i].mGraphMax.y = 50;
|
||||
|
|
@ -55,38 +55,38 @@ GuiParticleGraphCtrl::GuiParticleGraphCtrl()
|
|||
mPlots[i].mGraphScale = 0.05f;
|
||||
}
|
||||
|
||||
mPlots[0].mGraphColor = ColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[1].mGraphColor = ColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[2].mGraphColor = ColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[3].mGraphColor = ColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[4].mGraphColor = ColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[5].mGraphColor = ColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[6].mGraphColor = ColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[7].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[8].mGraphColor = ColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[9].mGraphColor = ColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[10].mGraphColor = ColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[11].mGraphColor = ColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[12].mGraphColor = ColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[13].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[14].mGraphColor = ColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[15].mGraphColor = ColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[16].mGraphColor = ColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[17].mGraphColor = ColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[18].mGraphColor = ColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[19].mGraphColor = ColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[20].mGraphColor = ColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[21].mGraphColor = ColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[22].mGraphColor = ColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[23].mGraphColor = ColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[24].mGraphColor = ColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[25].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[26].mGraphColor = ColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[27].mGraphColor = ColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[28].mGraphColor = ColorF(1.0f, 0.0f, 0.0f);
|
||||
mPlots[29].mGraphColor = ColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[30].mGraphColor = ColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[31].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[0].mGraphColor = LinearColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[1].mGraphColor = LinearColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[2].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[3].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[4].mGraphColor = LinearColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[5].mGraphColor = LinearColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[6].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[7].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[8].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[9].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[10].mGraphColor = LinearColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[11].mGraphColor = LinearColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[12].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[13].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[14].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[15].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[16].mGraphColor = LinearColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[17].mGraphColor = LinearColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[18].mGraphColor = LinearColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[19].mGraphColor = LinearColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[20].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[21].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[22].mGraphColor = LinearColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[23].mGraphColor = LinearColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[24].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[25].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[26].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[27].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[28].mGraphColor = LinearColorF(1.0f, 0.0f, 0.0f);
|
||||
mPlots[29].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[30].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[31].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
|
||||
mVertexClickSize = 6;
|
||||
mSelectedPlot = 0;
|
||||
|
|
@ -134,11 +134,11 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
pDrawUtil->drawRect(rect, mProfile->mBorderColor);
|
||||
}
|
||||
|
||||
GuiControlProfile* profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile"));
|
||||
Resource<GFont> font = profile->mFont;
|
||||
GuiControlProfile* profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile"));
|
||||
Resource<GFont> font = profile->mFont;
|
||||
GFXVideoMode videoMode = GFXInit::getDesktopResolution();
|
||||
|
||||
ColorF color(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
ColorI color(255, 255, 255, 128);
|
||||
pDrawUtil->drawRectFill(updateRect, color);
|
||||
|
||||
for (S32 k = 0; k < MaxPlots; k++)
|
||||
|
|
@ -184,7 +184,7 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
// check if this isn't our first loop through, if it is we won't have starting points
|
||||
if(sample > 0)
|
||||
{
|
||||
pDrawUtil->drawLine( lastPosX, lastPosY , posX, posY , mPlots[k].mGraphColor );
|
||||
pDrawUtil->drawLine( lastPosX, lastPosY , posX, posY , mPlots[k].mGraphColor.toColorI() );
|
||||
} else
|
||||
{
|
||||
mPlots[k].mNutList.clear();
|
||||
|
|
@ -205,7 +205,7 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
mLastSelectedPoint = mSelectedPoint;
|
||||
}
|
||||
|
||||
ColorI nutColor (mPlots[k].mGraphColor);
|
||||
ColorI nutColor (mPlots[k].mGraphColor.toColorI());
|
||||
|
||||
if(k == mSelectedPlot && sample == mLastSelectedPoint)
|
||||
{
|
||||
|
|
@ -220,7 +220,7 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
blue = 1.0 - blue;
|
||||
// nut color
|
||||
|
||||
nutColor = ColorI(ColorF(red, green, blue));
|
||||
nutColor = LinearColorF(red, green, blue).toColorI();
|
||||
}
|
||||
|
||||
// draw the seleciton nut
|
||||
|
|
@ -660,7 +660,7 @@ Point2F GuiParticleGraphCtrl::getGraphExtent(S32 plotID)
|
|||
return resultV;
|
||||
}
|
||||
|
||||
ColorF GuiParticleGraphCtrl::getGraphColor(S32 plotID)
|
||||
LinearColorF GuiParticleGraphCtrl::getGraphColor(S32 plotID)
|
||||
{
|
||||
return mPlots[plotID].mGraphColor;
|
||||
}
|
||||
|
|
@ -1151,7 +1151,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x,
|
|||
return object->getPlotIndex(plotID, x, y);
|
||||
}
|
||||
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, ColorF, (S32 plotID), , "(int plotID)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, LinearColorF, (S32 plotID), , "(int plotID)"
|
||||
"Get the color of the graph passed."
|
||||
"@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
struct PlotInfo
|
||||
{
|
||||
ColorF mGraphColor;
|
||||
LinearColorF mGraphColor;
|
||||
Vector<Point2F> mGraphData;
|
||||
Vector<Point2F> mNutList;
|
||||
Point2F mGraphMax;
|
||||
|
|
@ -136,7 +136,7 @@ public:
|
|||
|
||||
// Get Functions
|
||||
Point2F getGraphExtent(S32 plotID);
|
||||
ColorF getGraphColor(S32 plotID);
|
||||
LinearColorF getGraphColor(S32 plotID);
|
||||
S32 getSelectedPlot();
|
||||
S32 getSelectedPoint();
|
||||
Point2F getPlotPoint(S32 plotID, S32 samples);
|
||||
|
|
|
|||
|
|
@ -1433,7 +1433,7 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect)
|
|||
|
||||
GFXStateBlockDesc desc;
|
||||
desc.fillMode = GFXFillWireframe;
|
||||
GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->center, ColorF::WHITE );
|
||||
GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->center, ColorI::WHITE );
|
||||
}
|
||||
|
||||
// Render the selected object bounding box
|
||||
|
|
@ -1450,7 +1450,7 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect)
|
|||
const Box3F& bounds = mesh->getBounds();
|
||||
GFXStateBlockDesc desc;
|
||||
desc.fillMode = GFXFillWireframe;
|
||||
GFX->getDrawUtil()->drawCube( desc, bounds.getExtents(), bounds.getCenter(), ColorF::RED );
|
||||
GFX->getDrawUtil()->drawCube( desc, bounds.getExtents(), bounds.getCenter(), ColorI::RED );
|
||||
|
||||
GFX->popWorldMatrix();
|
||||
}
|
||||
|
|
@ -1490,9 +1490,9 @@ void GuiShapeEdPreview::renderGui(Point2I offset, const RectI& updateRect)
|
|||
if ( mModel )
|
||||
{
|
||||
if ( mRenderNodes && mHoverNode != -1 )
|
||||
renderNodeName( mHoverNode, ColorF::WHITE );
|
||||
renderNodeName( mHoverNode, LinearColorF::WHITE );
|
||||
if ( mSelectedNode != -1 )
|
||||
renderNodeName( mSelectedNode, ColorF::WHITE );
|
||||
renderNodeName( mSelectedNode, LinearColorF::WHITE );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1530,7 +1530,7 @@ void GuiShapeEdPreview::renderSunDirection() const
|
|||
if ( mEditingSun )
|
||||
{
|
||||
// Render four arrows aiming in the direction of the sun's light
|
||||
ColorI color( mFakeSun->getColor() );
|
||||
ColorI color = LinearColorF( mFakeSun->getColor()).toColorI();
|
||||
F32 length = mModel->getShape()->bounds.len() * 0.8f;
|
||||
|
||||
// Get the sun's vectors
|
||||
|
|
@ -1587,18 +1587,18 @@ void GuiShapeEdPreview::renderNodes() const
|
|||
if ( ( i == mSelectedNode ) || ( i == mHoverNode ) )
|
||||
continue;
|
||||
|
||||
renderNodeAxes( i, ColorF::WHITE );
|
||||
renderNodeAxes( i, LinearColorF::WHITE );
|
||||
}
|
||||
|
||||
// Render the hovered node
|
||||
if ( mHoverNode != -1 )
|
||||
renderNodeAxes( mHoverNode, ColorF::GREEN );
|
||||
renderNodeAxes( mHoverNode, LinearColorF::GREEN );
|
||||
}
|
||||
|
||||
// Render the selected node (even if mRenderNodes is false)
|
||||
if ( mSelectedNode != -1 )
|
||||
{
|
||||
renderNodeAxes( mSelectedNode, ColorF::GREEN );
|
||||
renderNodeAxes( mSelectedNode, LinearColorF::GREEN );
|
||||
|
||||
const MatrixF& nodeMat = mModel->mNodeTransforms[mSelectedNode];
|
||||
mGizmo->set( nodeMat, nodeMat.getPosition(), Point3F::One);
|
||||
|
|
@ -1606,7 +1606,7 @@ void GuiShapeEdPreview::renderNodes() const
|
|||
}
|
||||
}
|
||||
|
||||
void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
|
||||
void GuiShapeEdPreview::renderNodeAxes(S32 index, const LinearColorF& nodeColor) const
|
||||
{
|
||||
if(mModel->mNodeTransforms.size() <= index || index < 0)
|
||||
return;
|
||||
|
|
@ -1623,15 +1623,15 @@ void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
|
|||
|
||||
GFX->pushWorldMatrix();
|
||||
GFX->multWorld( mModel->mNodeTransforms[index] );
|
||||
|
||||
GFX->getDrawUtil()->drawCube( desc, xAxis * scale, Point3F::Zero, nodeColor );
|
||||
GFX->getDrawUtil()->drawCube( desc, yAxis * scale, Point3F::Zero, nodeColor );
|
||||
GFX->getDrawUtil()->drawCube( desc, zAxis * scale, Point3F::Zero, nodeColor );
|
||||
const ColorI color = LinearColorF(nodeColor).toColorI();
|
||||
GFX->getDrawUtil()->drawCube( desc, xAxis * scale, Point3F::Zero, color );
|
||||
GFX->getDrawUtil()->drawCube( desc, yAxis * scale, Point3F::Zero, color );
|
||||
GFX->getDrawUtil()->drawCube( desc, zAxis * scale, Point3F::Zero, color );
|
||||
|
||||
GFX->popWorldMatrix();
|
||||
}
|
||||
|
||||
void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
|
||||
void GuiShapeEdPreview::renderNodeName(S32 index, const LinearColorF& textColor) const
|
||||
{
|
||||
if(index < 0 || index >= mModel->getShape()->nodes.size() || index >= mProjectedNodes.size())
|
||||
return;
|
||||
|
|
@ -1640,7 +1640,7 @@ void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
|
|||
|
||||
Point2I pos( mProjectedNodes[index].x, mProjectedNodes[index].y + sNodeRectSize + 6 );
|
||||
|
||||
GFX->getDrawUtil()->setBitmapModulation( textColor );
|
||||
GFX->getDrawUtil()->setBitmapModulation( LinearColorF(textColor).toColorI());
|
||||
GFX->getDrawUtil()->drawText( mProfile->mFont, pos, nodeName.c_str() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,8 +164,8 @@ protected:
|
|||
// Rendering
|
||||
void renderGrid();
|
||||
void renderNodes() const;
|
||||
void renderNodeAxes(S32 index, const ColorF& nodeColor) const;
|
||||
void renderNodeName(S32 index, const ColorF& textColor) const;
|
||||
void renderNodeAxes(S32 index, const LinearColorF& nodeColor) const;
|
||||
void renderNodeName(S32 index, const LinearColorF& textColor) const;
|
||||
void renderSunDirection() const;
|
||||
void renderCollisionMeshes() const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue