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

@ -89,13 +89,13 @@ void GuiOffscreenCanvas::_setupTargets()
// Update color
if (!mTargetTexture.isValid() || mTargetSize != mTargetTexture.getWidthHeight())
{
mTargetTexture.set( mTargetSize.x, mTargetSize.y, mTargetFormat, &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
mTargetTexture.set( mTargetSize.x, mTargetSize.y, mTargetFormat, &GFXRenderTargetSRGBProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
}
// Update depth if needed
if (mUseDepth && (!mTargetDepth.isValid() || mTargetSize != mTargetDepth.getWidthHeight()))
{
mTargetDepth.set( mTargetSize.x, mTargetSize.y, GFXFormatD24S8, &GFXDefaultZTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
mTargetDepth.set( mTargetSize.x, mTargetSize.y, GFXFormatD24S8, &GFXRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
mTarget->attachTexture( GFXTextureTarget::RenderSlot(GFXTextureTarget::DepthStencil), mTargetDepth );
}
@ -178,7 +178,7 @@ void GuiOffscreenCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = tr
// Clear the current viewport area
GFX->setViewport( screenRect );
GFX->clear( GFXClearTarget, ColorF(0,0,0,0), 1.0f, 0 );
GFX->clear( GFXClearTarget, LinearColorF(0,0,0,0), 1.0f, 0 );
resetUpdateRegions();
@ -204,7 +204,7 @@ void GuiOffscreenCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = tr
// Fill Blue if no Dialogs
if(this->size() == 0)
GFX->clear( GFXClearTarget, ColorF(0,0,0,1), 1.0f, 0 );
GFX->clear( GFXClearTarget, LinearColorF(0,0,0,1), 1.0f, 0 );
GFX->setClipRect( contentRect );

View file

@ -63,12 +63,12 @@ ConsoleDocClass( GuiCursor,
GFX_ImplementTextureProfile(GFXGuiCursorProfile,
GFXTextureProfile::DiffuseMap,
GFXTextureProfile::PreserveSize |
GFXTextureProfile::Static,
GFXTextureProfile::Static | GFXTextureProfile::SRGB,
GFXTextureProfile::NONE);
GFX_ImplementTextureProfile(GFXDefaultGUIProfile,
GFXTextureProfile::DiffuseMap,
GFXTextureProfile::PreserveSize |
GFXTextureProfile::Static |
GFXTextureProfile::Static | GFXTextureProfile::SRGB |
GFXTextureProfile::NoPadding,
GFXTextureProfile::NONE);
@ -200,7 +200,7 @@ bool GuiControlProfile::protectedSetBitmap( void *object, const char *index, con
//verify the bitmap
if (profile->mBitmapName && profile->mBitmapName[0] && dStricmp(profile->mBitmapName, "texhandle") != 0 &&
!profile->mTextureObject.set( profile->mBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
!profile->mTextureObject.set( profile->mBitmapName, &GFXTexturePersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
Con::errorf("Failed to load profile bitmap (%s)",profile->mBitmapName);
// If we've got a special border, make sure it's usable.
@ -566,7 +566,7 @@ S32 GuiControlProfile::constructBitmapArray()
if( mTextureObject.isNull() )
{
if ( !mBitmapName || !mBitmapName[0] || !mTextureObject.set( mBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
if ( !mBitmapName || !mBitmapName[0] || !mTextureObject.set( mBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
return 0;
}
@ -655,7 +655,7 @@ void GuiControlProfile::incLoadCount()
//
if (mBitmapName && mBitmapName[0] && dStricmp(mBitmapName, "texhandle") != 0 &&
!mTextureObject.set( mBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
!mTextureObject.set( mBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
Con::errorf("Failed to load profile bitmap (%s)",mBitmapName);
constructBitmapArray();