mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +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
8943c673fb
commit
0801a3cca8
294 changed files with 3894 additions and 2813 deletions
|
|
@ -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() );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue