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

@ -1074,7 +1074,7 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa
mPPShaderConsts->setSafe(mPPModelViewProjSC, xform);
const ColorF &sunlight = state->getAmbientLightColor();
const LinearColorF &sunlight = state->getAmbientLightColor();
Point3F ambientColor(sunlight.red, sunlight.green, sunlight.blue);
mShaderConsts->setSafe(mAmbientColorSC, ambientColor);
@ -1204,7 +1204,7 @@ void VolumetricFog::InitTexture()
mIsTextured = false;
if (mTextureName.isNotEmpty())
mTexture.set(mTextureName, &GFXDefaultStaticDiffuseProfile, "VolumetricFogMod");
mTexture.set(mTextureName, &GFXStaticTextureSRGBProfile, "VolumetricFogMod");
if (!mTexture.isNull())
{
@ -1218,7 +1218,7 @@ void VolumetricFog::InitTexture()
}
}
void VolumetricFog::setFogColor(ColorF color)
void VolumetricFog::setFogColor(LinearColorF color)
{
mFogColor.set(255 * color.red,255 * color.green,255 * color.blue);
setMaskBits(FogColorMask);
@ -1266,7 +1266,7 @@ bool VolumetricFog::isInsideFog()
return mCamInFog;
}
DefineEngineMethod(VolumetricFog, SetFogColorF, void, (ColorF new_color), ,
DefineEngineMethod(VolumetricFog, SetFogColorF, void, (LinearColorF new_color), ,
"@brief Changes the color of the fog\n\n."
"@params new_color the new fog color (rgb 0.0 - 1.0, a is ignored.")
{