mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-25 17:43:44 +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
|
|
@ -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.")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ class VolumetricFog : public SceneObject
|
|||
|
||||
// Methods for modifying & networking various fog elements
|
||||
// Used in script
|
||||
void setFogColor(ColorF color);
|
||||
void setFogColor(LinearColorF color);
|
||||
void setFogColor(ColorI color);
|
||||
void setFogDensity(F32 density);
|
||||
void setFogModulation(F32 strength, Point2F speed1, Point2F speed2);
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ bool VolumetricFogRTManager::Init()
|
|||
mHeight = mFloor(mPlatformWindow->getClientExtent().y / mTargetScale);
|
||||
|
||||
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||
&GFXDefaultRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
&GFXRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!mDepthBuffer.isValid())
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create Depthbuffer");
|
||||
|
|
@ -164,7 +164,7 @@ bool VolumetricFogRTManager::Init()
|
|||
mDepthTarget.setTexture(mDepthBuffer);
|
||||
|
||||
mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||
&GFXDefaultRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
&GFXRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!mFrontBuffer.isValid())
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create front buffer");
|
||||
|
|
@ -240,7 +240,7 @@ bool VolumetricFogRTManager::Resize()
|
|||
mFrontBuffer->kill();
|
||||
|
||||
mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||
&GFXDefaultRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
&GFXRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!mFrontBuffer.isValid())
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager::Resize() Fatal Error: Unable to create front buffer");
|
||||
|
|
@ -249,7 +249,7 @@ bool VolumetricFogRTManager::Resize()
|
|||
mFrontTarget.setTexture(mFrontBuffer);
|
||||
|
||||
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
|
||||
&GFXDefaultRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
&GFXRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!mDepthBuffer.isValid())
|
||||
{
|
||||
Con::errorf("VolumetricFogRTManager::Resize() Fatal Error: Unable to create Depthbuffer");
|
||||
|
|
|
|||
|
|
@ -341,10 +341,10 @@ void BasicClouds::_initTexture()
|
|||
}
|
||||
|
||||
if ( mTexName[i].isNotEmpty() )
|
||||
mTexture[i].set( mTexName[i], &GFXDefaultStaticDiffuseProfile, "BasicClouds" );
|
||||
mTexture[i].set( mTexName[i], &GFXStaticTextureSRGBProfile, "BasicClouds" );
|
||||
|
||||
if ( mTexture[i].isNull() )
|
||||
mTexture[i].set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "BasicClouds" );
|
||||
mTexture[i].set( GFXTextureManager::getWarningTexturePath(), &GFXStaticTextureSRGBProfile, "BasicClouds" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -353,12 +353,12 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|||
mShaderConsts->setSafe( mEyePosWorldSC, camPos );
|
||||
|
||||
LightInfo *lightinfo = LIGHTMGR->getSpecialLight(LightManager::slSunLightType);
|
||||
const ColorF &sunlight = state->getAmbientLightColor();
|
||||
const LinearColorF &sunlight = state->getAmbientLightColor();
|
||||
|
||||
Point3F ambientColor( sunlight.red, sunlight.green, sunlight.blue );
|
||||
mShaderConsts->setSafe( mAmbientColorSC, ambientColor );
|
||||
|
||||
const ColorF &sunColor = lightinfo->getColor();
|
||||
const LinearColorF &sunColor = lightinfo->getColor();
|
||||
Point3F data( sunColor.red, sunColor.green, sunColor.blue );
|
||||
mShaderConsts->setSafe( mSunColorSC, data );
|
||||
|
||||
|
|
@ -398,10 +398,10 @@ void CloudLayer::_initTexture()
|
|||
}
|
||||
|
||||
if ( mTextureName.isNotEmpty() )
|
||||
mTexture.set( mTextureName, &GFXDefaultStaticDiffuseProfile, "CloudLayer" );
|
||||
mTexture.set( mTextureName, &GFXStaticTextureSRGBProfile, "CloudLayer" );
|
||||
|
||||
if ( mTexture.isNull() )
|
||||
mTexture.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "CloudLayer" );
|
||||
mTexture.set( GFXTextureManager::getWarningTexturePath(), &GFXStaticTextureSRGBProfile, "CloudLayer" );
|
||||
}
|
||||
|
||||
void CloudLayer::_initBuffers()
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ protected:
|
|||
Point2F mTexDirection[TEX_COUNT];
|
||||
F32 mTexSpeed[TEX_COUNT];
|
||||
|
||||
ColorF mBaseColor;
|
||||
LinearColorF mBaseColor;
|
||||
F32 mExposure;
|
||||
F32 mCoverage;
|
||||
F32 mWindSpeed;
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ void River::setShaderParams( SceneRenderState *state, BaseMatInstance* mat, cons
|
|||
// set pixel shader constants
|
||||
//-----------------------------------
|
||||
|
||||
ColorF c( mWaterFogData.color );
|
||||
LinearColorF c( mWaterFogData.color );
|
||||
matParams->setSafe(paramHandles.mBaseColorSC, c);
|
||||
|
||||
// By default we need to show a true reflection is fullReflect is enabled and
|
||||
|
|
|
|||
|
|
@ -122,10 +122,10 @@ ScatterSky::ScatterSky()
|
|||
mAmbientScale.set( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
mSunColor.set( 0, 0, 0, 1.0f );
|
||||
mSunScale = ColorF::WHITE;
|
||||
mSunScale = LinearColorF::WHITE;
|
||||
|
||||
mFogColor.set( 0, 0, 0, 1.0f );
|
||||
mFogScale = ColorF::WHITE;
|
||||
mFogScale = LinearColorF::WHITE;
|
||||
|
||||
mExposure = 1.0f;
|
||||
mNightInterpolant = 0;
|
||||
|
|
@ -548,7 +548,7 @@ void ScatterSky::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
stream->read( &mScale );
|
||||
|
||||
ColorF tmpColor( 0, 0, 0 );
|
||||
LinearColorF tmpColor( 0, 0, 0 );
|
||||
|
||||
stream->read( &tmpColor );
|
||||
|
||||
|
|
@ -1093,7 +1093,7 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
}
|
||||
|
||||
// Vertex color.
|
||||
ColorF moonVertColor( 1.0f, 1.0f, 1.0f, mNightInterpolant );
|
||||
LinearColorF moonVertColor( 1.0f, 1.0f, 1.0f, mNightInterpolant );
|
||||
|
||||
// Copy points to buffer.
|
||||
|
||||
|
|
@ -1104,7 +1104,7 @@ void ScatterSky::_renderMoon( ObjectRenderInst *ri, SceneRenderState *state, Bas
|
|||
|
||||
for ( S32 i = 0; i < 4; i++ )
|
||||
{
|
||||
pVert->color.set( moonVertColor );
|
||||
pVert->color.set( moonVertColor.toColorI());
|
||||
pVert->point.set( points[i] );
|
||||
pVert->texCoord.set( sCoords[i].x, sCoords[i].y );
|
||||
pVert++;
|
||||
|
|
@ -1182,8 +1182,8 @@ void ScatterSky::_interpolateColors()
|
|||
|
||||
mMieScattering = (mCurves[1].getVal( mTimeOfDay) * mSunSize ); //Scale the size of the sun's disk
|
||||
|
||||
ColorF moonTemp = mMoonTint;
|
||||
ColorF nightTemp = mNightColor;
|
||||
LinearColorF moonTemp = mMoonTint;
|
||||
LinearColorF nightTemp = mNightColor;
|
||||
|
||||
moonTemp.interpolate( mNightColor, mMoonTint, mCurves[4].getVal( mTimeOfDay ) );
|
||||
nightTemp.interpolate( mMoonTint, mNightColor, mCurves[4].getVal( mTimeOfDay ) );
|
||||
|
|
@ -1195,12 +1195,12 @@ void ScatterSky::_interpolateColors()
|
|||
mSunColor.interpolate( mSunColor, mMoonTint, mCurves[3].getVal( mTimeOfDay ) );//mNightInterpolant );
|
||||
}
|
||||
|
||||
void ScatterSky::_getSunColor( ColorF *outColor )
|
||||
void ScatterSky::_getSunColor( LinearColorF *outColor )
|
||||
{
|
||||
PROFILE_SCOPE( ScatterSky_GetSunColor );
|
||||
|
||||
U32 count = 0;
|
||||
ColorF tmpColor( 0, 0, 0 );
|
||||
LinearColorF tmpColor( 0, 0, 0 );
|
||||
VectorF tmpVec( 0, 0, 0 );
|
||||
|
||||
tmpVec = mLightDir;
|
||||
|
|
@ -1221,11 +1221,11 @@ void ScatterSky::_getSunColor( ColorF *outColor )
|
|||
(*outColor) /= count;
|
||||
}
|
||||
|
||||
void ScatterSky::_getAmbientColor( ColorF *outColor )
|
||||
void ScatterSky::_getAmbientColor( LinearColorF *outColor )
|
||||
{
|
||||
PROFILE_SCOPE( ScatterSky_GetAmbientColor );
|
||||
|
||||
ColorF tmpColor( 0, 0, 0, 0 );
|
||||
LinearColorF tmpColor( 0, 0, 0, 0 );
|
||||
U32 count = 0;
|
||||
|
||||
// Disable mieScattering for purposes of calculating the ambient color.
|
||||
|
|
@ -1246,7 +1246,7 @@ void ScatterSky::_getAmbientColor( ColorF *outColor )
|
|||
mMieScattering = oldMieScattering;
|
||||
}
|
||||
|
||||
void ScatterSky::_getFogColor( ColorF *outColor )
|
||||
void ScatterSky::_getFogColor( LinearColorF *outColor )
|
||||
{
|
||||
PROFILE_SCOPE( ScatterSky_GetFogColor );
|
||||
|
||||
|
|
@ -1261,7 +1261,7 @@ void ScatterSky::_getFogColor( ColorF *outColor )
|
|||
originalYaw = yaw;
|
||||
pitch = mDegToRad( 10.0f );
|
||||
|
||||
ColorF tmpColor( 0, 0, 0 );
|
||||
LinearColorF tmpColor( 0, 0, 0 );
|
||||
|
||||
U32 i = 0;
|
||||
for ( i = 0; i < 10; i++ )
|
||||
|
|
@ -1309,7 +1309,7 @@ F32 ScatterSky::_getRayleighPhase( F32 fCos2 )
|
|||
return 0.75 + 0.75 * fCos2;
|
||||
}
|
||||
|
||||
void ScatterSky::_getColor( const Point3F &pos, ColorF *outColor )
|
||||
void ScatterSky::_getColor( const Point3F &pos, LinearColorF *outColor )
|
||||
{
|
||||
PROFILE_SCOPE( ScatterSky_GetColor );
|
||||
|
||||
|
|
@ -1379,7 +1379,7 @@ void ScatterSky::_getColor( const Point3F &pos, ColorF *outColor )
|
|||
F32 miePhase = _getMiePhase( fCos, fCos2, g, g2 );
|
||||
|
||||
Point3F color = rayleighColor + (miePhase * mieColor);
|
||||
ColorF tmp( color.x, color.y, color.z, color.y );
|
||||
LinearColorF tmp( color.x, color.y, color.z, color.y );
|
||||
|
||||
Point3F expColor( 0, 0, 0 );
|
||||
expColor.x = 1.0f - exp(-mExposure * color.x);
|
||||
|
|
@ -1388,7 +1388,7 @@ void ScatterSky::_getColor( const Point3F &pos, ColorF *outColor )
|
|||
|
||||
tmp.set( expColor.x, expColor.y, expColor.z, 1.0f );
|
||||
|
||||
if ( !tmp.isValidColor() )
|
||||
if ( !tmp.isClamped() )
|
||||
{
|
||||
F32 len = expColor.len();
|
||||
if ( len > 0 )
|
||||
|
|
|
|||
|
|
@ -119,10 +119,10 @@ protected:
|
|||
|
||||
void _generateSkyPoints();
|
||||
|
||||
void _getColor( const Point3F &pos, ColorF *outColor );
|
||||
void _getFogColor( ColorF *outColor );
|
||||
void _getAmbientColor( ColorF *outColor );
|
||||
void _getSunColor( ColorF *outColor );
|
||||
void _getColor( const Point3F &pos, LinearColorF *outColor );
|
||||
void _getFogColor( LinearColorF *outColor );
|
||||
void _getAmbientColor( LinearColorF *outColor );
|
||||
void _getSunColor( LinearColorF *outColor );
|
||||
void _interpolateColors();
|
||||
|
||||
void _conformLights();
|
||||
|
|
@ -161,7 +161,7 @@ protected:
|
|||
|
||||
F32 mOuterRadius;
|
||||
F32 mScale;
|
||||
ColorF mWavelength;
|
||||
LinearColorF mWavelength;
|
||||
F32 mWavelength4[3];
|
||||
F32 mRayleighScaleDepth;
|
||||
F32 mMieScaleDepth;
|
||||
|
|
@ -185,16 +185,16 @@ protected:
|
|||
|
||||
F32 mBrightness;
|
||||
|
||||
ColorF mNightColor;
|
||||
ColorF mNightFogColor;
|
||||
LinearColorF mNightColor;
|
||||
LinearColorF mNightFogColor;
|
||||
|
||||
ColorF mAmbientColor; ///< Not a field
|
||||
ColorF mSunColor; ///< Not a field
|
||||
ColorF mFogColor; ///< Not a field
|
||||
LinearColorF mAmbientColor; ///< Not a field
|
||||
LinearColorF mSunColor; ///< Not a field
|
||||
LinearColorF mFogColor; ///< Not a field
|
||||
|
||||
ColorF mAmbientScale;
|
||||
ColorF mSunScale;
|
||||
ColorF mFogScale;
|
||||
LinearColorF mAmbientScale;
|
||||
LinearColorF mSunScale;
|
||||
LinearColorF mFogScale;
|
||||
|
||||
LightInfo *mLight;
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ protected:
|
|||
String mMoonMatName;
|
||||
BaseMatInstance *mMoonMatInst;
|
||||
F32 mMoonScale;
|
||||
ColorF mMoonTint;
|
||||
LinearColorF mMoonTint;
|
||||
VectorF mMoonLightDir;
|
||||
CubemapData *mNightCubemap;
|
||||
String mNightCubemapName;
|
||||
|
|
@ -241,7 +241,7 @@ protected:
|
|||
GFXShaderConstHandle *mNightInterpolantAndExposureSC;
|
||||
GFXShaderConstHandle *mUseCubemapSC;
|
||||
F32 mColorizeAmt;
|
||||
ColorF mColorize;
|
||||
LinearColorF mColorize;
|
||||
GFXShaderConstHandle *mColorizeSC;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void SkyBox::prepRenderImage( SceneRenderState *state )
|
|||
|
||||
void SkyBox::_renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *mi )
|
||||
{
|
||||
GFXDEBUGEVENT_SCOPE( SkyBox_RenderObject, ColorF::WHITE );
|
||||
GFXDEBUGEVENT_SCOPE( SkyBox_RenderObject, ColorI::WHITE );
|
||||
|
||||
GFXTransformSaver saver;
|
||||
GFX->setVertexBuffer( mVB );
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ protected:
|
|||
Material *mFogBandMat;
|
||||
BaseMatInstance *mFogBandMatInst;
|
||||
|
||||
ColorF mLastFogColor;
|
||||
LinearColorF mLastFogColor;
|
||||
|
||||
bool mDrawBottom;
|
||||
bool mIsVBDirty;
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ void Sun::setElevation( F32 elevation )
|
|||
setMaskBits( UpdateMask ); // TODO: Break out the masks to save some space!
|
||||
}
|
||||
|
||||
void Sun::setColor( const ColorF &color )
|
||||
void Sun::setColor( const LinearColorF &color )
|
||||
{
|
||||
mLightColor = color;
|
||||
_conformLights();
|
||||
|
|
@ -490,7 +490,7 @@ void Sun::_renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatI
|
|||
points[i] += mLightWorldPos;
|
||||
}
|
||||
|
||||
ColorF vertColor;
|
||||
LinearColorF vertColor;
|
||||
if ( mCoronaUseLightColor )
|
||||
vertColor = mLightColor;
|
||||
else
|
||||
|
|
@ -503,7 +503,7 @@ void Sun::_renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatI
|
|||
|
||||
for ( S32 i = 0; i < 4; i++ )
|
||||
{
|
||||
pVert->color.set( vertColor );
|
||||
pVert->color.set( vertColor.toColorI());
|
||||
pVert->point.set( points[i] );
|
||||
pVert->texCoord.set( sCoords[i].x, sCoords[i].y );
|
||||
pVert++;
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ protected:
|
|||
|
||||
F32 mSunElevation;
|
||||
|
||||
ColorF mLightColor;
|
||||
LinearColorF mLightColor;
|
||||
|
||||
ColorF mLightAmbient;
|
||||
LinearColorF mLightAmbient;
|
||||
|
||||
F32 mBrightness;
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ protected:
|
|||
BaseMatInstance *mCoronaMatInst;
|
||||
MatrixSet *mMatrixSet;
|
||||
F32 mCoronaScale;
|
||||
ColorF mCoronaTint;
|
||||
LinearColorF mCoronaTint;
|
||||
bool mCoronaUseLightColor;
|
||||
|
||||
// These are not user specified.
|
||||
|
|
@ -136,7 +136,7 @@ public:
|
|||
void setElevation( F32 elevation );
|
||||
|
||||
///
|
||||
void setColor( const ColorF &color );
|
||||
void setColor( const LinearColorF &color );
|
||||
|
||||
///
|
||||
void animate( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation );
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ F32 TimeOfDay::_calcAzimuth( F32 lat, F32 dec, F32 mer )
|
|||
return mAtan2( mSin(mer), mCos(mer) * mSin(lat) - mTan(dec) * mCos(lat) ) + M_PI_F;
|
||||
}
|
||||
|
||||
void TimeOfDay::_getSunColor( ColorF *outColor ) const
|
||||
void TimeOfDay::_getSunColor( LinearColorF *outColor ) const
|
||||
{
|
||||
const COLOR_TARGET *ct = NULL;
|
||||
|
||||
|
|
@ -451,8 +451,8 @@ void TimeOfDay::_initColors()
|
|||
// NOTE: The elevation targets represent distances
|
||||
// from PI/2 radians (strait up).
|
||||
|
||||
ColorF c;
|
||||
ColorF bc;
|
||||
LinearColorF c;
|
||||
LinearColorF bc;
|
||||
|
||||
// e is for elevation
|
||||
F32 e = M_PI_F / 13.0f; // (semicircle in radians)/(number of color target entries);
|
||||
|
|
@ -495,7 +495,7 @@ void TimeOfDay::_initColors()
|
|||
_addColorTarget(M_PI_F, c, 1.0f, c); // Midnight at equanox.
|
||||
}
|
||||
|
||||
void TimeOfDay::_addColorTarget( F32 ele, const ColorF &color, F32 bandMod, const ColorF &bandColor )
|
||||
void TimeOfDay::_addColorTarget( F32 ele, const LinearColorF &color, F32 bandMod, const LinearColorF &bandColor )
|
||||
{
|
||||
COLOR_TARGET newTarget;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ class TimeOfDay;
|
|||
struct COLOR_TARGET
|
||||
{
|
||||
F32 elevation; // maximum target elevation
|
||||
ColorF color; //normalized 0 = 1.0 ...
|
||||
LinearColorF color; //normalized 0 = 1.0 ...
|
||||
F32 bandMod; //6 is max
|
||||
ColorF bandColor;
|
||||
LinearColorF bandColor;
|
||||
};
|
||||
|
||||
typedef Vector<COLOR_TARGET> COLOR_TARGETS;
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
{ return (mCurrentColor.blue + mCurrentColor.green + mCurrentColor.red) / 3; }
|
||||
*/
|
||||
static TimeOfDayUpdateSignal& getTimeOfDayUpdateSignal() { return smTimeOfDayUpdateSignal; }
|
||||
void getSunColor( ColorF *outColor ) const { _getSunColor( outColor ); }
|
||||
void getSunColor( LinearColorF *outColor ) const { _getSunColor( outColor ); }
|
||||
|
||||
void addTimeEvent( F32 triggerElevation, const UTF8 *identifier );
|
||||
|
||||
|
|
@ -150,10 +150,10 @@ protected:
|
|||
/// @param color [in] target color.
|
||||
/// @param bandMod [in]
|
||||
/// @param bandColor [in]
|
||||
void _addColorTarget( F32 ele, const ColorF &color, F32 bandMod, const ColorF &bandColor );
|
||||
void _addColorTarget( F32 ele, const LinearColorF &color, F32 bandMod, const LinearColorF &bandColor );
|
||||
|
||||
// Grab our sun and sky colors based upon sun elevation.
|
||||
void _getSunColor( ColorF *outColor ) const;
|
||||
void _getSunColor( LinearColorF *outColor ) const;
|
||||
|
||||
static bool setTimeOfDay( void *object, const char *index, const char *data );
|
||||
static bool setPlay( void *object, const char *index, const char *data );
|
||||
|
|
@ -196,9 +196,9 @@ protected:
|
|||
bool mAnimate;
|
||||
|
||||
/*
|
||||
ColorF mCurrentColor;
|
||||
LinearColorF mCurrentColor;
|
||||
F32 mBandMod;
|
||||
ColorF mCurrentBandColor;
|
||||
LinearColorF mCurrentBandColor;
|
||||
|
||||
// PersistFields preparation
|
||||
bool mConvertedToRads;
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ void WaterBlock::setShaderParams( SceneRenderState *state, BaseMatInstance *mat,
|
|||
// set pixel shader constants
|
||||
//-----------------------------------
|
||||
|
||||
ColorF c( mWaterFogData.color );
|
||||
LinearColorF c( mWaterFogData.color );
|
||||
matParams->setSafe( paramHandles.mBaseColorSC, c );
|
||||
|
||||
// By default we need to show a true reflection is fullReflect is enabled and
|
||||
|
|
|
|||
|
|
@ -1022,7 +1022,7 @@ void WaterObject::setShaderParams( SceneRenderState *state, BaseMatInstance *mat
|
|||
matParams->setSafe(paramHandles.mDistortionParamsSC, distortionParams );
|
||||
|
||||
LightInfo *sun = LIGHTMGR->getSpecialLight(LightManager::slSunLightType);
|
||||
const ColorF &sunlight = state->getAmbientLightColor();
|
||||
const LinearColorF &sunlight = state->getAmbientLightColor();
|
||||
Point3F ambientColor = mEmissive ? Point3F::One : sunlight;
|
||||
matParams->setSafe(paramHandles.mAmbientColorSC, ambientColor );
|
||||
matParams->setSafe(paramHandles.mLightDirSC, sun->getDirection() );
|
||||
|
|
@ -1036,7 +1036,7 @@ void WaterObject::setShaderParams( SceneRenderState *state, BaseMatInstance *mat
|
|||
Point4F specularParams( mSpecularColor.red, mSpecularColor.green, mSpecularColor.blue, mSpecularPower );
|
||||
if ( !mEmissive )
|
||||
{
|
||||
const ColorF &sunColor = sun->getColor();
|
||||
const LinearColorF &sunColor = sun->getColor();
|
||||
F32 brightness = sun->getBrightness();
|
||||
specularParams.x *= sunColor.red * brightness;
|
||||
specularParams.y *= sunColor.green * brightness;
|
||||
|
|
@ -1159,22 +1159,22 @@ bool WaterObject::initMaterial( S32 idx )
|
|||
void WaterObject::initTextures()
|
||||
{
|
||||
if ( mRippleTexName.isNotEmpty() )
|
||||
mRippleTex.set( mRippleTexName, &GFXDefaultStaticDiffuseProfile, "WaterObject::mRippleTex" );
|
||||
mRippleTex.set( mRippleTexName, &GFXStaticTextureSRGBProfile, "WaterObject::mRippleTex" );
|
||||
if ( mRippleTex.isNull() )
|
||||
mRippleTex.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "WaterObject::mRippleTex" );
|
||||
mRippleTex.set( GFXTextureManager::getWarningTexturePath(), &GFXStaticTextureSRGBProfile, "WaterObject::mRippleTex" );
|
||||
|
||||
if ( mDepthGradientTexName.isNotEmpty() )
|
||||
mDepthGradientTex.set( mDepthGradientTexName, &GFXDefaultStaticDiffuseProfile, "WaterObject::mDepthGradientTex" );
|
||||
mDepthGradientTex.set( mDepthGradientTexName, &GFXStaticTextureSRGBProfile, "WaterObject::mDepthGradientTex" );
|
||||
if ( mDepthGradientTex.isNull() )
|
||||
mDepthGradientTex.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "WaterObject::mDepthGradientTex" );
|
||||
mDepthGradientTex.set( GFXTextureManager::getWarningTexturePath(), &GFXStaticTextureSRGBProfile, "WaterObject::mDepthGradientTex" );
|
||||
|
||||
if ( mNamedDepthGradTex.isRegistered() )
|
||||
mNamedDepthGradTex.setTexture( mDepthGradientTex );
|
||||
|
||||
if ( mFoamTexName.isNotEmpty() )
|
||||
mFoamTex.set( mFoamTexName, &GFXDefaultStaticDiffuseProfile, "WaterObject::mFoamTex" );
|
||||
mFoamTex.set( mFoamTexName, &GFXStaticTextureSRGBProfile, "WaterObject::mFoamTex" );
|
||||
if ( mFoamTex.isNull() )
|
||||
mFoamTex.set( GFXTextureManager::getWarningTexturePath(), &GFXDefaultStaticDiffuseProfile, "WaterObject::mFoamTex" );
|
||||
mFoamTex.set( GFXTextureManager::getWarningTexturePath(), &GFXStaticTextureSRGBProfile, "WaterObject::mFoamTex" );
|
||||
|
||||
if ( mCubemapName.isNotEmpty() )
|
||||
Sim::findObject( mCubemapName, mCubemap );
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ protected:
|
|||
F32 mFresnelBias;
|
||||
F32 mFresnelPower;
|
||||
F32 mSpecularPower;
|
||||
ColorF mSpecularColor;
|
||||
LinearColorF mSpecularColor;
|
||||
bool mEmissive;
|
||||
|
||||
// Reflection
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ void WaterPlane::setShaderParams( SceneRenderState *state, BaseMatInstance* mat,
|
|||
// set pixel shader constants
|
||||
//-----------------------------------
|
||||
|
||||
ColorF c( mWaterFogData.color );
|
||||
LinearColorF c( mWaterFogData.color );
|
||||
matParams->setSafe( paramHandles.mBaseColorSC, c );
|
||||
|
||||
// By default we need to show a true reflection is fullReflect is enabled and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue