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:
Areloch 2017-06-23 11:36:20 -05:00
parent 8780f83262
commit 25686ed4be
294 changed files with 3894 additions and 2813 deletions

View file

@ -58,7 +58,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite )
String defaultIconFile = path + "default";
mDefaultIcon.set( defaultIconFile,
&GFXDefaultPersistentProfile,
&GFXTexturePersistentSRGBProfile,
avar("%s() - mIcons[] (line %d)",
__FUNCTION__, __LINE__) );
}
@ -66,7 +66,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite )
void EditorIconRegistry::add( const String &className, const String &imageFile, bool overwrite )
{
// First see if we can load the image.
GFXTexHandle icon( imageFile, &GFXDefaultPersistentProfile,
GFXTexHandle icon( imageFile, &GFXTexturePersistentSRGBProfile,
avar("%s() - mIcons[] (line %d)", __FUNCTION__, __LINE__) );
if ( icon.isNull() )
return;

View file

@ -1035,7 +1035,7 @@ void GuiConvexEditorCtrl::drawFacePlane( ConvexShape *shape, S32 faceId )
GFX->setVertexBuffer( vb );
GFXTexHandle tex( "core/art/grids/512_transp", &GFXDefaultStaticDiffuseProfile, "ConvexEditor_grid" );
GFXTexHandle tex( "core/art/grids/512_transp", &GFXStaticTextureSRGBProfile, "ConvexEditor_grid" );
GFX->setTexture( 0, tex );
GFX->setupGenericShaders();
GFX->drawPrimitive( GFXTriangleList, 0, points.size() / 3 );

View file

@ -116,7 +116,7 @@ bool GuiMissionAreaCtrl::onAdd()
if (*mHandleBitmap)
{
mHandleTexture = GFXTexHandle( mHandleBitmap, &GFXDefaultPersistentProfile, avar("%s() - mHandleTexture (line %d)", __FUNCTION__, __LINE__) );
mHandleTexture = GFXTexHandle( mHandleBitmap, &GFXTexturePersistentSRGBProfile, avar("%s() - mHandleTexture (line %d)", __FUNCTION__, __LINE__) );
mHandleTextureSize = Point2I( mHandleTexture->getWidth(), mHandleTexture->getHeight() );
mHandleTextureHalfSize = Point2F(mHandleTextureSize.x, mHandleTextureSize.y) * 0.5f;
}

View file

@ -658,7 +658,7 @@ void SelectionBrush::rebuild()
//... move the selection
}
void SelectionBrush::render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const
void SelectionBrush::render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone) const
{
//... render the selection
}
@ -1296,10 +1296,10 @@ void TerrainEditor::renderScene(const RectI &)
return;
if(!mSelectionHidden)
renderSelection(mDefaultSel, ColorF::RED, ColorF::GREEN, ColorF::BLUE, ColorF::BLUE, true, false);
renderSelection(mDefaultSel, LinearColorF::RED, LinearColorF::GREEN, LinearColorF::BLUE, LinearColorF::BLUE, true, false);
if(mRenderBrush && mMouseBrush->size())
renderBrush(*mMouseBrush, ColorF::GREEN, ColorF::RED, ColorF::BLUE, ColorF::BLUE, false, true);
renderBrush(*mMouseBrush, LinearColorF::GREEN, LinearColorF::RED, LinearColorF::BLUE, LinearColorF::BLUE, false, true);
if(mRenderBorder)
renderBorder();
@ -1386,7 +1386,7 @@ void TerrainEditor::renderPoints( const Vector<GFXVertexPCT> &pointList )
//------------------------------------------------------------------------------
void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame )
void TerrainEditor::renderSelection( const Selection & sel, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame )
{
PROFILE_SCOPE( TerrainEditor_RenderSelection );
@ -1395,7 +1395,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
return;
Vector<GFXVertexPCT> vertexBuffer;
ColorF color;
LinearColorF color;
ColorI iColor;
vertexBuffer.setSize(sel.size() * 5);
@ -1428,7 +1428,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
color.interpolate( outColorFull, outColorNone, weight );
}
//
iColor = color;
iColor = color.toColorI();
GFXVertexPCT *verts = &(vertexBuffer[i * 5]);
@ -1479,17 +1479,17 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
color.interpolate(outColorFull, outColorNone, weight );
}
iColor = color;
iColor = color.toColorI();
}
else
{
if ( center )
{
iColor = inColorNone;
iColor = LinearColorF(inColorNone).toColorI();
}
else
{
iColor = outColorFull;
iColor = LinearColorF(outColorFull).toColorI();
}
}
@ -1525,7 +1525,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
GFX->drawPrimitive( GFXLineStrip , i*5, 4);
}
void TerrainEditor::renderBrush( const Brush & brush, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame )
void TerrainEditor::renderBrush( const Brush & brush, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame )
{
}

View file

@ -173,7 +173,7 @@ public:
const char *getType() const { return "selection"; }
void rebuild();
void render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const;
void render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone) const;
void setSize(const Point2I &){}
protected:
@ -416,8 +416,8 @@ class TerrainEditor : public EditTSCtrl
void updateBrush(Brush & brush, const Point2I & gPos);
//
void renderSelection(const Selection & sel, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame);
void renderBrush(const Brush & brush, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame);
void renderSelection(const Selection & sel, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame);
void renderBrush(const Brush & brush, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame);
void renderBorder();
public:

View file

@ -1839,9 +1839,9 @@ bool WorldEditor::onAdd()
// create the default class entry
mDefaultClassEntry.mName = 0;
mDefaultClassEntry.mIgnoreCollision = false;
mDefaultClassEntry.mDefaultHandle = GFXTexHandle(mDefaultHandle, &GFXDefaultStaticDiffuseProfile, avar("%s() - mDefaultClassEntry.mDefaultHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mSelectHandle = GFXTexHandle(mSelectHandle, &GFXDefaultStaticDiffuseProfile, avar("%s() - mDefaultClassEntry.mSelectHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mLockedHandle = GFXTexHandle(mLockedHandle, &GFXDefaultStaticDiffuseProfile, avar("%s() - mDefaultClassEntry.mLockedHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mDefaultHandle = GFXTexHandle(mDefaultHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mDefaultHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mSelectHandle = GFXTexHandle(mSelectHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mSelectHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mLockedHandle = GFXTexHandle(mLockedHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mLockedHandle (line %d)", __FUNCTION__, __LINE__));
if(!(mDefaultClassEntry.mDefaultHandle && mDefaultClassEntry.mSelectHandle && mDefaultClassEntry.mLockedHandle))
return false;