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
8780f83262
commit
25686ed4be
294 changed files with 3894 additions and 2813 deletions
|
|
@ -645,7 +645,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
MaterialParameters *matParams = matInstance->getMaterialParameters();
|
||||
|
||||
// Set color in the right format, set alpha to the luminance value for the color.
|
||||
ColorF col = lightInfo->getColor();
|
||||
LinearColorF col = lightInfo->getColor();
|
||||
|
||||
// TODO: The specularity control of the light
|
||||
// is being scaled by the overall lumiance.
|
||||
|
|
@ -658,7 +658,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
F32 lumiance = mDot(*((const Point3F *)&lightInfo->getColor()), colorToLumiance );
|
||||
col.alpha *= lumiance;
|
||||
|
||||
matParams->setSafe( lightColor, col.toLinear() );
|
||||
matParams->setSafe( lightColor, col );
|
||||
matParams->setSafe( lightBrightness, lightInfo->getBrightness() );
|
||||
|
||||
switch( lightInfo->getType() )
|
||||
|
|
@ -672,9 +672,9 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
|
||||
// Set small number for alpha since it represents existing specular in
|
||||
// the vector light. This prevents a divide by zero.
|
||||
ColorF ambientColor = renderState->getAmbientLightColor();
|
||||
LinearColorF ambientColor = renderState->getAmbientLightColor();
|
||||
ambientColor.alpha = 0.00001f;
|
||||
matParams->setSafe( lightAmbient, ambientColor.toLinear() );
|
||||
matParams->setSafe( lightAmbient, ambientColor );
|
||||
|
||||
// If no alt color is specified, set it to the average of
|
||||
// the ambient and main color to avoid artifacts.
|
||||
|
|
@ -682,13 +682,13 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
// TODO: Trilight disabled until we properly implement it
|
||||
// in the light info!
|
||||
//
|
||||
//ColorF lightAlt = lightInfo->getAltColor();
|
||||
ColorF lightAlt( ColorF::BLACK ); // = lightInfo->getAltColor();
|
||||
//LinearColorF lightAlt = lightInfo->getAltColor();
|
||||
LinearColorF lightAlt( LinearColorF::BLACK ); // = lightInfo->getAltColor();
|
||||
if ( lightAlt.red == 0.0f && lightAlt.green == 0.0f && lightAlt.blue == 0.0f )
|
||||
lightAlt = (lightInfo->getColor() + renderState->getAmbientLightColor()) / 2.0f;
|
||||
|
||||
ColorF trilightColor = lightAlt;
|
||||
matParams->setSafe(lightTrilight, trilightColor.toLinear());
|
||||
LinearColorF trilightColor = lightAlt;
|
||||
matParams->setSafe(lightTrilight, trilightColor);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -787,7 +787,7 @@ bool LightMatInstance::setupPass( SceneRenderState *state, const SceneData &sgDa
|
|||
getMaterialParameters()->set( mLightMapParamsSC, lmParams->shadowDarkenColor );
|
||||
}
|
||||
else
|
||||
getMaterialParameters()->set( mLightMapParamsSC, ColorF::WHITE );
|
||||
getMaterialParameters()->set( mLightMapParamsSC, LinearColorF::WHITE );
|
||||
}
|
||||
|
||||
// Now override stateblock with our own
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue