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

@ -145,7 +145,7 @@ GFXDevice::GFXDevice()
}
mGlobalAmbientColorDirty = false;
mGlobalAmbientColor = ColorF(0.0f, 0.0f, 0.0f, 1.0f);
mGlobalAmbientColor = LinearColorF(0.0f, 0.0f, 0.0f, 1.0f);
mLightMaterialDirty = false;
dMemset(&mCurrentLightMaterial, 0, sizeof(GFXLightMaterial));
@ -213,11 +213,11 @@ void GFXDevice::deviceInited()
// Initialize the static helper textures.
GBitmap temp( 2, 2, false, GFXFormatR8G8B8A8 );
temp.fill( ColorI::ONE );
GFXTexHandle::ONE.set( &temp, &GFXDefaultStaticDiffuseProfile, false, "GFXTexHandle::ONE" );
GFXTexHandle::ONE.set( &temp, &GFXStaticTextureSRGBProfile, false, "GFXTexHandle::ONE" );
temp.fill( ColorI::ZERO );
GFXTexHandle::ZERO.set( &temp, &GFXDefaultStaticDiffuseProfile, false, "GFXTexHandle::ZERO" );
GFXTexHandle::ZERO.set( &temp, &GFXStaticTextureSRGBProfile, false, "GFXTexHandle::ZERO" );
temp.fill( ColorI( 128, 128, 255 ) );
GFXTexHandle::ZUP.set( &temp, &GFXDefaultStaticNormalMapProfile, false, "GFXTexHandle::ZUP" );
GFXTexHandle::ZUP.set( &temp, &GFXNormalMapProfile, false, "GFXTexHandle::ZUP" );
}
bool GFXDevice::destroy()
@ -739,7 +739,7 @@ void GFXDevice::setLightMaterial(const GFXLightMaterial& mat)
mStateDirty = true;
}
void GFXDevice::setGlobalAmbientColor(const ColorF& color)
void GFXDevice::setGlobalAmbientColor(const LinearColorF& color)
{
if(mGlobalAmbientColor != color)
{
@ -1315,10 +1315,9 @@ DefineEngineFunction( getBestHDRFormat, GFXFormat, (),,
// Figure out the best HDR format. This is the smallest
// format which supports blending and filtering.
Vector<GFXFormat> formats;
//formats.push_back( GFXFormatR10G10B10A2 ); TODO: replace with SRGB format once DX9 is gone - BJR
formats.push_back( GFXFormatR16G16B16A16F );
formats.push_back( GFXFormatR16G16B16A16 );
GFXFormat format = GFX->selectSupportedFormat( &GFXDefaultRenderTargetProfile,
formats.push_back(GFXFormatR16G16B16A16F);
formats.push_back( GFXFormatR10G10B10A2 );
GFXFormat format = GFX->selectSupportedFormat( &GFXRenderTargetProfile,
formats,
true,
true,