mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-24 14:49:27 +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
|
|
@ -265,7 +265,7 @@ void AccumulationVolume::setTexture( const String& name )
|
|||
mTextureName = name;
|
||||
if ( isClientObject() && mTextureName.isNotEmpty() )
|
||||
{
|
||||
mAccuTexture.set(mTextureName, &GFXDefaultStaticDiffuseProfile, "AccumulationVolume::mAccuTexture");
|
||||
mAccuTexture.set(mTextureName, &GFXStaticTextureSRGBProfile, "AccumulationVolume::mAccuTexture");
|
||||
if ( mAccuTexture.isNull() )
|
||||
Con::warnf( "AccumulationVolume::setTexture - Unable to load texture: %s", mTextureName.c_str() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1226,7 +1226,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
|
||||
PrimBuild::begin( GFXLineList, edgeList.size() * 2 );
|
||||
|
||||
PrimBuild::color( ColorI::WHITE * 0.8f );
|
||||
PrimBuild::color( LinearColorF(ColorI::WHITE) * 0.8f );
|
||||
|
||||
for ( S32 j = 0; j < edgeList.size(); j++ )
|
||||
{
|
||||
|
|
@ -1260,11 +1260,13 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
for ( S32 i = 0; i < faceList.size(); i++ )
|
||||
{
|
||||
ColorI color = faceColorsx[ i % 4 ];
|
||||
LinearColorF tCol = LinearColorF(color);
|
||||
S32 div = ( i / 4 ) * 4;
|
||||
if ( div > 0 )
|
||||
color /= div;
|
||||
color.alpha = 255;
|
||||
|
||||
tCol /= div;
|
||||
tCol.alpha = 1;
|
||||
color = tCol.toColorI();
|
||||
|
||||
Point3F pnt;
|
||||
objToWorld.mulP( faceList[i].centroid, &pnt );
|
||||
drawer->drawCube( desc, size, pnt, color, NULL );
|
||||
|
|
@ -1295,11 +1297,13 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
objToWorld.mulP( p0 );
|
||||
objToWorld.mulP( p1 );
|
||||
|
||||
ColorI color = faceColorsx[ j % 4 ];
|
||||
S32 div = ( j / 4 ) * 4;
|
||||
if ( div > 0 )
|
||||
color /= div;
|
||||
color.alpha = 255;
|
||||
ColorI color = faceColorsx[j % 4];
|
||||
LinearColorF tCol = LinearColorF(color);
|
||||
S32 div = (j / 4) * 4;
|
||||
if (div > 0)
|
||||
tCol /= div;
|
||||
tCol.alpha = 1;
|
||||
color = tCol.toColorI();
|
||||
|
||||
PrimBuild::color( color );
|
||||
PrimBuild::vertex3fv( p0 );
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ class GuiClockHud : public GuiControl
|
|||
bool mShowFill;
|
||||
bool mTimeReversed;
|
||||
|
||||
ColorF mFillColor;
|
||||
ColorF mFrameColor;
|
||||
ColorF mTextColor;
|
||||
LinearColorF mFillColor;
|
||||
LinearColorF mFrameColor;
|
||||
LinearColorF mTextColor;
|
||||
|
||||
S32 mTimeOffset;
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// Background first
|
||||
if (mShowFill)
|
||||
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||
drawUtil->drawRectFill(updateRect, mFillColor.toColorI());
|
||||
|
||||
// Convert ms time into hours, minutes and seconds.
|
||||
S32 time = S32(getTime());
|
||||
|
|
@ -131,13 +131,13 @@ void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
// Center the text
|
||||
offset.x += (getWidth() - mProfile->mFont->getStrWidth((const UTF8 *)buf)) / 2;
|
||||
offset.y += (getHeight() - mProfile->mFont->getHeight()) / 2;
|
||||
drawUtil->setBitmapModulation(mTextColor);
|
||||
drawUtil->setBitmapModulation(mTextColor.toColorI());
|
||||
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// Border last
|
||||
if (mShowFrame)
|
||||
drawUtil->drawRect(updateRect, mFrameColor);
|
||||
drawUtil->drawRect(updateRect, mFrameColor.toColorI());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ class GuiCrossHairHud : public GuiBitmapCtrl
|
|||
{
|
||||
typedef GuiBitmapCtrl Parent;
|
||||
|
||||
ColorF mDamageFillColor;
|
||||
ColorF mDamageFrameColor;
|
||||
LinearColorF mDamageFillColor;
|
||||
LinearColorF mDamageFrameColor;
|
||||
Point2I mDamageRectSize;
|
||||
Point2I mDamageOffset;
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ void GuiCrossHairHud::drawDamage(Point2I offset, F32 damage, F32 opacity)
|
|||
rect.point.x -= mDamageRectSize.x / 2;
|
||||
|
||||
// Draw the border
|
||||
GFX->getDrawUtil()->drawRect(rect, mDamageFrameColor);
|
||||
GFX->getDrawUtil()->drawRect(rect, mDamageFrameColor.toColorI());
|
||||
|
||||
// Draw the damage % fill
|
||||
rect.point += Point2I(1, 1);
|
||||
|
|
@ -187,5 +187,5 @@ void GuiCrossHairHud::drawDamage(Point2I offset, F32 damage, F32 opacity)
|
|||
if (rect.extent.x == 1)
|
||||
rect.extent.x = 2;
|
||||
if (rect.extent.x > 0)
|
||||
GFX->getDrawUtil()->drawRectFill(rect, mDamageFillColor);
|
||||
GFX->getDrawUtil()->drawRectFill(rect, mDamageFillColor.toColorI());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ class GuiHealthBarHud : public GuiControl
|
|||
bool mDisplayEnergy;
|
||||
bool mFlip;
|
||||
|
||||
ColorF mFillColor;
|
||||
ColorF mFrameColor;
|
||||
ColorF mDamageFillColor;
|
||||
LinearColorF mFillColor;
|
||||
LinearColorF mFrameColor;
|
||||
LinearColorF mDamageFillColor;
|
||||
|
||||
S32 mPulseRate;
|
||||
F32 mPulseThreshold;
|
||||
|
|
@ -163,7 +163,7 @@ void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// Background first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor.toColorI());
|
||||
|
||||
// Pulse the damage fill if it's below the threshold
|
||||
if (mPulseRate != 0)
|
||||
|
|
@ -196,9 +196,9 @@ void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
else
|
||||
rect.point.y = bottomY - rect.extent.y;
|
||||
}
|
||||
GFX->getDrawUtil()->drawRectFill(rect, mDamageFillColor);
|
||||
GFX->getDrawUtil()->drawRectFill(rect, mDamageFillColor.toColorI());
|
||||
|
||||
// Border last
|
||||
if (mShowFrame)
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor.toColorI());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ class GuiHealthTextHud : public GuiControl
|
|||
bool mShowEnergy;
|
||||
bool mShowTrueHealth;
|
||||
|
||||
ColorF mFillColor;
|
||||
ColorF mFrameColor;
|
||||
ColorF mTextColor;
|
||||
ColorF mWarnColor;
|
||||
LinearColorF mFillColor;
|
||||
LinearColorF mFrameColor;
|
||||
LinearColorF mTextColor;
|
||||
LinearColorF mWarnColor;
|
||||
|
||||
F32 mWarnLevel;
|
||||
F32 mPulseThreshold;
|
||||
|
|
@ -167,7 +167,7 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// If enabled draw background first
|
||||
if (mShowFill)
|
||||
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||
drawUtil->drawRectFill(updateRect, mFillColor.toColorI());
|
||||
|
||||
// Prepare text and center it
|
||||
S32 val = (S32)mValue;
|
||||
|
|
@ -176,7 +176,7 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
offset.x += (getBounds().extent.x - mProfile->mFont->getStrWidth((const UTF8 *)buf)) / 2;
|
||||
offset.y += (getBounds().extent.y - mProfile->mFont->getHeight()) / 2;
|
||||
|
||||
ColorF tColor = mTextColor;
|
||||
LinearColorF tColor = mTextColor;
|
||||
|
||||
// If warning level is exceeded switch to warning color
|
||||
if(mValue < mWarnLevel)
|
||||
|
|
@ -192,11 +192,11 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
}
|
||||
|
||||
drawUtil->setBitmapModulation(tColor);
|
||||
drawUtil->setBitmapModulation(tColor.toColorI());
|
||||
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// If enabled draw the border last
|
||||
if (mShowFrame)
|
||||
drawUtil->drawRect(updateRect, mFrameColor);
|
||||
drawUtil->drawRect(updateRect, mFrameColor.toColorI());
|
||||
}
|
||||
|
|
@ -47,11 +47,11 @@ class GuiShapeNameHud : public GuiControl {
|
|||
typedef GuiControl Parent;
|
||||
|
||||
// field data
|
||||
ColorF mFillColor;
|
||||
ColorF mFrameColor;
|
||||
ColorF mTextColor;
|
||||
ColorF mLabelFillColor;
|
||||
ColorF mLabelFrameColor;
|
||||
LinearColorF mFillColor;
|
||||
LinearColorF mFrameColor;
|
||||
LinearColorF mTextColor;
|
||||
LinearColorF mLabelFillColor;
|
||||
LinearColorF mLabelFrameColor;
|
||||
|
||||
F32 mVerticalOffset;
|
||||
F32 mDistanceFade;
|
||||
|
|
@ -162,7 +162,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
|||
{
|
||||
// Background fill first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor.toColorI());
|
||||
|
||||
// Must be in a TS Control
|
||||
GuiTSCtrl *parent = dynamic_cast<GuiTSCtrl*>(getParent());
|
||||
|
|
@ -274,7 +274,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
|||
|
||||
// Border last
|
||||
if (mShowFrame)
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor.toColorI());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -302,16 +302,16 @@ void GuiShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
|
|||
|
||||
// Background fill first
|
||||
if (mShowLabelFill)
|
||||
drawUtil->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||
drawUtil->drawRectFill(RectI(offset, extent), mLabelFillColor.toColorI());
|
||||
|
||||
// Deal with opacity and draw.
|
||||
mTextColor.alpha = opacity;
|
||||
drawUtil->setBitmapModulation(mTextColor);
|
||||
drawUtil->setBitmapModulation(mTextColor.toColorI());
|
||||
drawUtil->drawText(mProfile->mFont, offset + mLabelPadding, name);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// Border last
|
||||
if (mShowLabelFrame)
|
||||
drawUtil->drawRect(RectI(offset, extent), mLabelFrameColor);
|
||||
drawUtil->drawRect(RectI(offset, extent), mLabelFrameColor.toColorI());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ class ExplosionData : public GameBaseData {
|
|||
// interpolated from start to end time.
|
||||
F32 lightStartRadius;
|
||||
F32 lightEndRadius;
|
||||
ColorF lightStartColor;
|
||||
ColorF lightEndColor;
|
||||
LinearColorF lightStartColor;
|
||||
LinearColorF lightEndColor;
|
||||
F32 lightStartBrightness;
|
||||
F32 lightEndBrightness;
|
||||
F32 lightNormalOffset;
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void fxFoliageRenderList::SetupClipPlanes( SceneRenderState* state, const F32 fa
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
inline void fxFoliageRenderList::DrawQuadBox(const Box3F& QuadBox, const ColorF Colour)
|
||||
inline void fxFoliageRenderList::DrawQuadBox(const Box3F& QuadBox, const LinearColorF Colour)
|
||||
{
|
||||
// Define our debug box.
|
||||
static Point3F BoxPnts[] = {
|
||||
|
|
@ -1260,7 +1260,7 @@ bool fxFoliageReplicator::onAdd()
|
|||
{
|
||||
// Yes, so load foliage texture.
|
||||
if( mFieldData.mFoliageFile != NULL && dStrlen(mFieldData.mFoliageFile) > 0 )
|
||||
mFieldData.mFoliageTexture = GFXTexHandle( mFieldData.mFoliageFile, &GFXDefaultStaticDiffuseProfile, avar("%s() - mFieldData.mFoliageTexture (line %d)", __FUNCTION__, __LINE__) );
|
||||
mFieldData.mFoliageTexture = GFXTexHandle( mFieldData.mFoliageFile, &GFXStaticTextureSRGBProfile, avar("%s() - mFieldData.mFoliageTexture (line %d)", __FUNCTION__, __LINE__) );
|
||||
|
||||
if ((GFXTextureObject*) mFieldData.mFoliageTexture == NULL)
|
||||
Con::printf("fxFoliageReplicator: %s is an invalid or missing foliage texture file.", mFieldData.mFoliageFile);
|
||||
|
|
@ -1407,7 +1407,7 @@ void fxFoliageReplicator::computeAlphaTex()
|
|||
ColorI c((U8) (255.0f * ItemAlpha), 0, 0);
|
||||
mAlphaLookup->setColor(i, 0, c);
|
||||
}
|
||||
mAlphaTexture.set(mAlphaLookup, &GFXDefaultStaticDiffuseProfile, false, String("fxFoliage Replicator Alpha Texture") );
|
||||
mAlphaTexture.set(mAlphaLookup, &GFXStaticTextureSRGBProfile, false, String("fxFoliage Replicator Alpha Texture") );
|
||||
}
|
||||
|
||||
// Renders a triangle stripped oval
|
||||
|
|
@ -1619,7 +1619,7 @@ void fxFoliageReplicator::renderQuad(fxFoliageQuadrantNode* quadNode, const Matr
|
|||
{
|
||||
// Draw the Quad Box (Debug Only).
|
||||
if (UseDebug)
|
||||
mFrustumRenderSet.DrawQuadBox(quadNode->QuadrantBox, ColorF(0.0f, 1.0f, 0.1f, 1.0f));
|
||||
mFrustumRenderSet.DrawQuadBox(quadNode->QuadrantBox, LinearColorF(0.0f, 1.0f, 0.1f, 1.0f));
|
||||
if (quadNode->Level != 0) {
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
renderQuad(quadNode->QuadrantChildNode[i], RenderTransform, UseDebug);
|
||||
|
|
@ -1632,7 +1632,7 @@ void fxFoliageReplicator::renderQuad(fxFoliageQuadrantNode* quadNode, const Matr
|
|||
} else {
|
||||
// Use a different color to say "I think I'm not visible!"
|
||||
if (UseDebug)
|
||||
mFrustumRenderSet.DrawQuadBox(quadNode->QuadrantBox, ColorF(1.0f, 0.8f, 0.1f, 1.0f));
|
||||
mFrustumRenderSet.DrawQuadBox(quadNode->QuadrantBox, LinearColorF(1.0f, 0.8f, 0.1f, 1.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1791,7 +1791,7 @@ void fxFoliageReplicator::unpackUpdate(NetConnection * con, BitStream * stream)
|
|||
|
||||
// Load Foliage Texture on the client.
|
||||
if( mFieldData.mFoliageFile != NULL && dStrlen(mFieldData.mFoliageFile) > 0 )
|
||||
mFieldData.mFoliageTexture = GFXTexHandle( mFieldData.mFoliageFile, &GFXDefaultStaticDiffuseProfile, avar("%s() - mFieldData.mFoliageTexture (line %d)", __FUNCTION__, __LINE__) );
|
||||
mFieldData.mFoliageTexture = GFXTexHandle( mFieldData.mFoliageFile, &GFXStaticTextureSRGBProfile, avar("%s() - mFieldData.mFoliageTexture (line %d)", __FUNCTION__, __LINE__) );
|
||||
|
||||
if ((GFXTextureObject*) mFieldData.mFoliageTexture == NULL)
|
||||
Con::printf("fxFoliageReplicator: %s is an invalid or missing foliage texture file.", mFieldData.mFoliageFile);
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ public:
|
|||
public:
|
||||
bool IsQuadrantVisible(const Box3F VisBox, const MatrixF& RenderTransform);
|
||||
void SetupClipPlanes(SceneRenderState* state, const F32 FarClipPlane);
|
||||
void DrawQuadBox(const Box3F& QuadBox, const ColorF Colour);
|
||||
void DrawQuadBox(const Box3F& QuadBox, const LinearColorF Colour);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ public:
|
|||
bool mHideFoliage;
|
||||
bool mShowPlacementArea;
|
||||
U32 mPlacementBandHeight;
|
||||
ColorF mPlaceAreaColour;
|
||||
LinearColorF mPlaceAreaColour;
|
||||
|
||||
tagFieldData()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public:
|
|||
bool mHideReplications;
|
||||
bool mShowPlacementArea;
|
||||
U32 mPlacementBandHeight;
|
||||
ColorF mPlaceAreaColour;
|
||||
LinearColorF mPlaceAreaColour;
|
||||
|
||||
tagFieldData()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ protected:
|
|||
U32 type;
|
||||
F32 windAmplitude;
|
||||
Box3F worldBox;
|
||||
ColorF lmColor;
|
||||
LinearColorF lmColor;
|
||||
};
|
||||
|
||||
/// This is the x,y index for this cell.
|
||||
|
|
@ -239,7 +239,7 @@ void GroundCoverCell::_rebuildVB()
|
|||
const S32 &type = (*iter).type;
|
||||
const Point3F &size = (*iter).size;
|
||||
const F32 &windAmplitude = (*iter).windAmplitude;
|
||||
GFXVertexColor color = (ColorI)(*iter).lmColor;
|
||||
color = LinearColorF((*iter).lmColor).toColorI();
|
||||
U8 *col = (U8 *)const_cast<U32 *>( (const U32 *)color );
|
||||
|
||||
vertPtr->point = position;
|
||||
|
|
@ -944,7 +944,7 @@ void GroundCover::_initialize( U32 cellCount, U32 cellPlacementCount )
|
|||
Material* mat = dynamic_cast<Material*>(mMatInst->getMaterial());
|
||||
if(mat)
|
||||
{
|
||||
GFXTexHandle tex(mat->mDiffuseMapFilename[0], &GFXDefaultStaticDiffuseProfile, "GroundCover texture aspect ratio check" );
|
||||
GFXTexHandle tex(mat->mDiffuseMapFilename[0], &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check" );
|
||||
if(tex.isValid())
|
||||
{
|
||||
U32 w = tex.getWidth();
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ bool LightningData::preload(bool server, String &errorStr)
|
|||
{
|
||||
if (strikeTextureNames[i][0])
|
||||
{
|
||||
strikeTextures[i] = GFXTexHandle(strikeTextureNames[i], &GFXDefaultStaticDiffuseProfile, avar("%s() - strikeTextures[%d] (line %d)", __FUNCTION__, i, __LINE__));
|
||||
strikeTextures[i] = GFXTexHandle(strikeTextureNames[i], &GFXStaticTextureProfile, avar("%s() - strikeTextures[%d] (line %d)", __FUNCTION__, i, __LINE__));
|
||||
mNumStrikeTextures++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ class Lightning : public GameBase
|
|||
F32 chanceToHitTarget;
|
||||
F32 strikeRadius;
|
||||
F32 boltStartRadius;
|
||||
ColorF color;
|
||||
ColorF fadeColor;
|
||||
LinearColorF color;
|
||||
LinearColorF fadeColor;
|
||||
bool useFog;
|
||||
|
||||
GFXStateBlockRef mLightningSB;
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ void ParticleData::initPersistFields()
|
|||
"Deprecated. Use textureName instead." );
|
||||
|
||||
// Interpolation variables
|
||||
addField( "colors", TYPEID< ColorF >(), Offset(colors, ParticleData), PDC_NUM_KEYS,
|
||||
addField( "colors", TYPEID< LinearColorF >(), Offset(colors, ParticleData), PDC_NUM_KEYS,
|
||||
"@brief Particle RGBA color keyframe values.\n\n"
|
||||
"The particle color will linearly interpolate between the color/time keys "
|
||||
"over the lifetime of the particle." );
|
||||
|
|
@ -488,7 +488,7 @@ bool ParticleData::preload(bool server, String &errorStr)
|
|||
// texture is *not* an error since the emitter may provide one.
|
||||
if (textureName && textureName[0])
|
||||
{
|
||||
textureHandle = GFXTexHandle(textureName, &GFXDefaultStaticDiffuseProfile, avar("%s() - textureHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
textureHandle = GFXTexHandle(textureName, &GFXStaticTextureSRGBProfile, avar("%s() - textureHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!textureHandle)
|
||||
{
|
||||
errorStr = String::ToString("Missing particle texture: %s", textureName);
|
||||
|
|
@ -613,7 +613,7 @@ bool ParticleData::reload(char errorBuffer[256])
|
|||
bool error = false;
|
||||
if (textureName && textureName[0])
|
||||
{
|
||||
textureHandle = GFXTexHandle(textureName, &GFXDefaultStaticDiffuseProfile, avar("%s() - textureHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
textureHandle = GFXTexHandle(textureName, &GFXStaticTextureSRGBProfile, avar("%s() - textureHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!textureHandle)
|
||||
{
|
||||
dSprintf(errorBuffer, 256, "Missing particle texture: %s", textureName);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class ParticleData : public SimDataBlock
|
|||
U32 numFrames;
|
||||
U32 framesPerSec;
|
||||
|
||||
ColorF colors[ PDC_NUM_KEYS ];
|
||||
LinearColorF colors[ PDC_NUM_KEYS ];
|
||||
F32 sizes[ PDC_NUM_KEYS ];
|
||||
F32 times[ PDC_NUM_KEYS ];
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ struct Particle
|
|||
|
||||
|
||||
// are these necessary to store here? - they are interpolated in real time
|
||||
ColorF color;
|
||||
LinearColorF color;
|
||||
F32 size;
|
||||
|
||||
F32 spinSpeed;
|
||||
|
|
|
|||
|
|
@ -603,7 +603,7 @@ bool ParticleEmitterData::preload(bool server, String &errorStr)
|
|||
// load emitter texture if specified
|
||||
if (textureName && textureName[0])
|
||||
{
|
||||
textureHandle = GFXTexHandle(textureName, &GFXDefaultStaticDiffuseProfile, avar("%s() - textureHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
textureHandle = GFXTexHandle(textureName, &GFXStaticTextureSRGBProfile, avar("%s() - textureHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
if (!textureHandle)
|
||||
{
|
||||
errorStr = String::ToString("Missing particle emitter texture: %s", textureName);
|
||||
|
|
@ -833,10 +833,10 @@ bool ParticleEmitter::onNewDataBlock( GameBaseData *dptr, bool reload )
|
|||
//-----------------------------------------------------------------------------
|
||||
// getCollectiveColor
|
||||
//-----------------------------------------------------------------------------
|
||||
ColorF ParticleEmitter::getCollectiveColor()
|
||||
LinearColorF ParticleEmitter::getCollectiveColor()
|
||||
{
|
||||
U32 count = 0;
|
||||
ColorF color = ColorF(0.0f, 0.0f, 0.0f);
|
||||
LinearColorF color = LinearColorF(0.0f, 0.0f, 0.0f);
|
||||
|
||||
count = n_parts;
|
||||
for( Particle* part = part_list_head.next; part != NULL; part = part->next )
|
||||
|
|
@ -937,7 +937,7 @@ void ParticleEmitter::setSizes( F32 *sizeList )
|
|||
//-----------------------------------------------------------------------------
|
||||
// setColors
|
||||
//-----------------------------------------------------------------------------
|
||||
void ParticleEmitter::setColors( ColorF *colorList )
|
||||
void ParticleEmitter::setColors( LinearColorF *colorList )
|
||||
{
|
||||
for( S32 i=0; i<ParticleData::PDC_NUM_KEYS; i++ )
|
||||
{
|
||||
|
|
@ -1467,7 +1467,7 @@ S32 QSORT_CALLBACK cmpSortParticles(const void* p1, const void* p2)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void ParticleEmitter::copyToVB( const Point3F &camPos, const ColorF &ambientColor )
|
||||
void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambientColor )
|
||||
{
|
||||
static Vector<SortParticle> orderedVector(__FILE__, __LINE__);
|
||||
|
||||
|
|
@ -1653,7 +1653,7 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const ColorF &ambientColo
|
|||
void ParticleEmitter::setupBillboard( Particle *part,
|
||||
Point3F *basePts,
|
||||
const MatrixF &camView,
|
||||
const ColorF &ambientColor,
|
||||
const LinearColorF &ambientColor,
|
||||
ParticleVertexType *lVerts )
|
||||
{
|
||||
F32 width = part->size * 0.5f;
|
||||
|
|
@ -1663,7 +1663,7 @@ void ParticleEmitter::setupBillboard( Particle *part,
|
|||
mSinCos(spinAngle, sy, cy);
|
||||
|
||||
const F32 ambientLerp = mClampF( mDataBlock->ambientFactor, 0.0f, 1.0f );
|
||||
ColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||
LinearColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||
|
||||
// fill four verts, use macro and unroll loop
|
||||
#define fillVert(){ \
|
||||
|
|
@ -1673,7 +1673,7 @@ void ParticleEmitter::setupBillboard( Particle *part,
|
|||
camView.mulV( lVerts->point ); \
|
||||
lVerts->point *= width; \
|
||||
lVerts->point += part->pos; \
|
||||
lVerts->color = partCol; } \
|
||||
lVerts->color = partCol.toColorI(); } \
|
||||
|
||||
// Here we deal with UVs for animated particle (billboard)
|
||||
if (part->dataBlock->animateTexture && !part->dataBlock->animTexFrames.empty())
|
||||
|
|
@ -1737,7 +1737,7 @@ void ParticleEmitter::setupBillboard( Particle *part,
|
|||
//-----------------------------------------------------------------------------
|
||||
void ParticleEmitter::setupOriented( Particle *part,
|
||||
const Point3F &camPos,
|
||||
const ColorF &ambientColor,
|
||||
const LinearColorF &ambientColor,
|
||||
ParticleVertexType *lVerts )
|
||||
{
|
||||
Point3F dir;
|
||||
|
|
@ -1766,8 +1766,8 @@ void ParticleEmitter::setupOriented( Particle *part,
|
|||
Point3F end = part->pos + dir;
|
||||
|
||||
const F32 ambientLerp = mClampF( mDataBlock->ambientFactor, 0.0f, 1.0f );
|
||||
ColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||
|
||||
LinearColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||
const ColorI color = partCol.toColorI();
|
||||
// Here we deal with UVs for animated particle (oriented)
|
||||
if (part->dataBlock->animateTexture)
|
||||
{
|
||||
|
|
@ -1779,55 +1779,55 @@ void ParticleEmitter::setupOriented( Particle *part,
|
|||
uv[1] = uv[0] + (part->dataBlock->animTexTiling.x + 1);
|
||||
uv[2] = uv[1] + 1;
|
||||
uv[3] = uv[0] + 1;
|
||||
|
||||
lVerts->point = start + crossDir;
|
||||
lVerts->color = color;
|
||||
// Here and below, we copy UVs from particle datablock's current frame's UVs (oriented)
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[0]];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = start + crossDir;
|
||||
lVerts->color = partCol;
|
||||
// Here and below, we copy UVs from particle datablock's current frame's UVs (oriented)
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[0]];
|
||||
++lVerts;
|
||||
lVerts->point = start - crossDir;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[1]];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = start - crossDir;
|
||||
lVerts->color = partCol;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[1]];
|
||||
++lVerts;
|
||||
lVerts->point = end - crossDir;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[2]];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end - crossDir;
|
||||
lVerts->color = partCol;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[2]];
|
||||
++lVerts;
|
||||
lVerts->point = end + crossDir;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[3]];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end + crossDir;
|
||||
lVerts->color = partCol;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[3]];
|
||||
++lVerts;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
lVerts->point = start + crossDir;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
// Here and below, we copy UVs from particle datablock's texCoords (oriented)
|
||||
lVerts->texCoord = part->dataBlock->texCoords[1];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = start - crossDir;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->texCoords[2];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end - crossDir;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->texCoords[3];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end + crossDir;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->texCoords[0];
|
||||
++lVerts;
|
||||
}
|
||||
|
||||
void ParticleEmitter::setupAligned( const Particle *part,
|
||||
const ColorF &ambientColor,
|
||||
const LinearColorF &ambientColor,
|
||||
ParticleVertexType *lVerts )
|
||||
{
|
||||
// The aligned direction will always be normalized.
|
||||
|
|
@ -1877,8 +1877,8 @@ void ParticleEmitter::setupAligned( const Particle *part,
|
|||
Point3F end = part->pos + right;
|
||||
|
||||
const F32 ambientLerp = mClampF( mDataBlock->ambientFactor, 0.0f, 1.0f );
|
||||
ColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||
|
||||
LinearColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||
const ColorI color = partCol.toColorI();
|
||||
// Here we deal with UVs for animated particle
|
||||
if (part->dataBlock->animateTexture)
|
||||
{
|
||||
|
|
@ -1891,46 +1891,46 @@ void ParticleEmitter::setupAligned( const Particle *part,
|
|||
uv[2] = uv[1] + 1;
|
||||
uv[3] = uv[0] + 1;
|
||||
|
||||
lVerts->point = start + cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[0]];
|
||||
++lVerts;
|
||||
lVerts->point = start + cross;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[0]];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = start - cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[1]];
|
||||
++lVerts;
|
||||
lVerts->point = start - cross;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[1]];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end - cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[2]];
|
||||
++lVerts;
|
||||
lVerts->point = end - cross;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[2]];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end + cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[3]];
|
||||
++lVerts;
|
||||
lVerts->point = end + cross;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->animTexUVs[uv[3]];
|
||||
++lVerts;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Here and below, we copy UVs from particle datablock's texCoords
|
||||
lVerts->point = start + cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->texCoords[0];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = start - cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->texCoords[1];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end - cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->texCoords[2];
|
||||
++lVerts;
|
||||
|
||||
lVerts->point = end + cross;
|
||||
lVerts->color = partCol;
|
||||
lVerts->color = color;
|
||||
lVerts->texCoord = part->dataBlock->texCoords[3];
|
||||
++lVerts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class ParticleEmitter : public GameBase
|
|||
static Point3F mWindVelocity;
|
||||
static void setWindVelocity( const Point3F &vel ){ mWindVelocity = vel; }
|
||||
|
||||
ColorF getCollectiveColor();
|
||||
LinearColorF getCollectiveColor();
|
||||
|
||||
/// Sets sizes of particles based on sizelist provided
|
||||
/// @param sizeList List of sizes
|
||||
|
|
@ -142,7 +142,7 @@ class ParticleEmitter : public GameBase
|
|||
|
||||
/// Sets colors for particles based on color list provided
|
||||
/// @param colorList List of colors
|
||||
void setColors( ColorF *colorList );
|
||||
void setColors( LinearColorF *colorList );
|
||||
|
||||
ParticleEmitterData *getDataBlock(){ return mDataBlock; }
|
||||
bool onNewDataBlock( GameBaseData *dptr, bool reload );
|
||||
|
|
@ -196,16 +196,16 @@ class ParticleEmitter : public GameBase
|
|||
inline void setupBillboard( Particle *part,
|
||||
Point3F *basePts,
|
||||
const MatrixF &camView,
|
||||
const ColorF &ambientColor,
|
||||
const LinearColorF &ambientColor,
|
||||
ParticleVertexType *lVerts );
|
||||
|
||||
inline void setupOriented( Particle *part,
|
||||
const Point3F &camPos,
|
||||
const ColorF &ambientColor,
|
||||
const LinearColorF &ambientColor,
|
||||
ParticleVertexType *lVerts );
|
||||
|
||||
inline void setupAligned( const Particle *part,
|
||||
const ColorF &ambientColor,
|
||||
const LinearColorF &ambientColor,
|
||||
ParticleVertexType *lVerts );
|
||||
|
||||
/// Updates the bounding box for the particle system
|
||||
|
|
@ -222,7 +222,7 @@ class ParticleEmitter : public GameBase
|
|||
// Rendering
|
||||
protected:
|
||||
void prepRenderImage( SceneRenderState *state );
|
||||
void copyToVB( const Point3F &camPos, const ColorF &ambientColor );
|
||||
void copyToVB( const Point3F &camPos, const LinearColorF &ambientColor );
|
||||
|
||||
// PEngine interface
|
||||
private:
|
||||
|
|
@ -254,7 +254,7 @@ class ParticleEmitter : public GameBase
|
|||
S32 mElapsedTimeMS;
|
||||
|
||||
F32 sizes[ ParticleData::PDC_NUM_KEYS ];
|
||||
ColorF colors[ ParticleData::PDC_NUM_KEYS ];
|
||||
LinearColorF colors[ ParticleData::PDC_NUM_KEYS ];
|
||||
|
||||
GFXVertexBufferHandle<ParticleVertexType> mVertBuff;
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ Precipitation::Precipitation()
|
|||
mDropAnimateMS = 0;
|
||||
|
||||
mUseLighting = false;
|
||||
mGlowIntensity = ColorF( 0,0,0,0 );
|
||||
mGlowIntensity = LinearColorF( 0,0,0,0 );
|
||||
|
||||
mReflect = false;
|
||||
|
||||
|
|
@ -604,7 +604,7 @@ void Precipitation::initMaterials()
|
|||
mDropShader = NULL;
|
||||
mSplashShader = NULL;
|
||||
|
||||
if( dStrlen(pd->mDropName) > 0 && !mDropHandle.set(pd->mDropName, &GFXDefaultStaticDiffuseProfile, avar("%s() - mDropHandle (line %d)", __FUNCTION__, __LINE__)) )
|
||||
if( dStrlen(pd->mDropName) > 0 && !mDropHandle.set(pd->mDropName, &GFXStaticTextureSRGBProfile, avar("%s() - mDropHandle (line %d)", __FUNCTION__, __LINE__)) )
|
||||
Con::warnf("Precipitation::initMaterials - failed to locate texture '%s'!", pd->mDropName);
|
||||
|
||||
if ( dStrlen(pd->mDropShaderName) > 0 )
|
||||
|
|
@ -625,7 +625,7 @@ void Precipitation::initMaterials()
|
|||
}
|
||||
}
|
||||
|
||||
if( dStrlen(pd->mSplashName) > 0 && !mSplashHandle.set(pd->mSplashName, &GFXDefaultStaticDiffuseProfile, avar("%s() - mSplashHandle (line %d)", __FUNCTION__, __LINE__)) )
|
||||
if( dStrlen(pd->mSplashName) > 0 && !mSplashHandle.set(pd->mSplashName, &GFXStaticTextureSRGBProfile, avar("%s() - mSplashHandle (line %d)", __FUNCTION__, __LINE__)) )
|
||||
Con::warnf("Precipitation::initMaterials - failed to locate texture '%s'!", pd->mSplashName);
|
||||
|
||||
if ( dStrlen(pd->mSplashShaderName) > 0 )
|
||||
|
|
@ -1581,7 +1581,7 @@ void Precipitation::renderObject(ObjectRenderInst *ri, SceneRenderState *state,
|
|||
// shader. Once the lighting and shadow systems
|
||||
// are added into TSE we can expand this to include
|
||||
// the N nearest lights to the camera + the ambient.
|
||||
ColorF ambient( 1, 1, 1 );
|
||||
LinearColorF ambient( 1, 1, 1 );
|
||||
if ( mUseLighting )
|
||||
{
|
||||
const LightInfo *sunlight = LIGHTMGR->getSpecialLight(LightManager::slSunLightType);
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ class Precipitation : public GameBase
|
|||
bool mUseLighting; ///< This enables shading of the drops and splashes
|
||||
///< by the sun color.
|
||||
|
||||
ColorF mGlowIntensity; ///< Set it to 0 to disable the glow or use it to control
|
||||
LinearColorF mGlowIntensity; ///< Set it to 0 to disable the glow or use it to control
|
||||
///< the intensity of each channel.
|
||||
|
||||
bool mReflect; ///< This enables the precipitation to be rendered
|
||||
|
|
|
|||
|
|
@ -562,16 +562,16 @@ void Ribbon::createBuffers(SceneRenderState *state, GFXVertexBufferHandle<GFXVer
|
|||
Point3F leftvert = mSegmentPoints[i];
|
||||
Point3F rightvert = mSegmentPoints[i];
|
||||
F32 tRadius = mDataBlock->mSizes[0];
|
||||
ColorF tColor = mDataBlock->mColours[0];
|
||||
LinearColorF tColor = mDataBlock->mColours[0];
|
||||
|
||||
for (U8 j = 0; j < RibbonData::NumFields-1; j++) {
|
||||
|
||||
F32 curPosition = mDataBlock->mTimes[j];
|
||||
F32 curRadius = mDataBlock->mSizes[j];
|
||||
ColorF curColor = mDataBlock->mColours[j];
|
||||
LinearColorF curColor = mDataBlock->mColours[j];
|
||||
F32 nextPosition = mDataBlock->mTimes[j+1];
|
||||
F32 nextRadius = mDataBlock->mSizes[j+1];
|
||||
ColorF nextColor = mDataBlock->mColours[j+1];
|
||||
LinearColorF nextColor = mDataBlock->mColours[j+1];
|
||||
|
||||
if ( curPosition < 0
|
||||
|| curPosition > interpol )
|
||||
|
|
@ -603,7 +603,7 @@ void Ribbon::createBuffers(SceneRenderState *state, GFXVertexBufferHandle<GFXVer
|
|||
perpendicular += mSegmentPoints[i];
|
||||
|
||||
verts[count].point.set(perpendicular);
|
||||
ColorF color = tColor;
|
||||
LinearColorF color = tColor;
|
||||
|
||||
if (mDataBlock->mUseFadeOut)
|
||||
color.alpha *= mFadeOut;
|
||||
|
|
@ -623,7 +623,7 @@ void Ribbon::createBuffers(SceneRenderState *state, GFXVertexBufferHandle<GFXVer
|
|||
else
|
||||
texCoords = (1.0f - interpol)*mDataBlock->mTileScale;
|
||||
|
||||
verts[count].color = color;
|
||||
verts[count].color = color.toColorI();
|
||||
verts[count].texCoord[1] = Point2F(interpol, 0);
|
||||
verts[count].texCoord[0] = Point2F(0.0f, texCoords);
|
||||
verts[count].normal.set(diff);
|
||||
|
|
@ -651,7 +651,7 @@ void Ribbon::createBuffers(SceneRenderState *state, GFXVertexBufferHandle<GFXVer
|
|||
if (mDataBlock->mUseFadeOut)
|
||||
color.alpha *= mFadeOut;
|
||||
|
||||
verts[count].color = color;
|
||||
verts[count].color = color.toColorI();
|
||||
verts[count].texCoord[1] = Point2F(interpol, 1);
|
||||
verts[count].texCoord[0] = Point2F(1.0f, texCoords);
|
||||
verts[count].normal.set(diff);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public:
|
|||
};
|
||||
|
||||
F32 mSizes[NumFields]; ///< The radius for each keyframe.
|
||||
ColorF mColours[NumFields]; ///< The colour of the ribbon for each keyframe.
|
||||
LinearColorF mColours[NumFields]; ///< The colour of the ribbon for each keyframe.
|
||||
F32 mTimes[NumFields]; ///< The relative time for each keyframe.
|
||||
|
||||
U32 mRibbonLength; ///< The amount of segments that will make up the ribbon.
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ bool SplashData::preload(bool server, String &errorStr)
|
|||
{
|
||||
if (textureName[i] && textureName[i][0])
|
||||
{
|
||||
textureHandle[i] = GFXTexHandle(textureName[i], &GFXDefaultStaticDiffuseProfile, avar("%s() - textureHandle[%d] (line %d)", __FUNCTION__, i, __LINE__) );
|
||||
textureHandle[i] = GFXTexHandle(textureName[i], &GFXStaticTextureSRGBProfile, avar("%s() - textureHandle[%d] (line %d)", __FUNCTION__, i, __LINE__) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ struct SplashRingPoint
|
|||
struct SplashRing
|
||||
{
|
||||
Vector <SplashRingPoint> points;
|
||||
ColorF color;
|
||||
LinearColorF color;
|
||||
F32 lifetime;
|
||||
F32 elapsedTime;
|
||||
F32 v;
|
||||
|
|
@ -114,7 +114,7 @@ public:
|
|||
F32 startRadius;
|
||||
|
||||
F32 times[ NUM_TIME_KEYS ];
|
||||
ColorF colors[ NUM_TIME_KEYS ];
|
||||
LinearColorF colors[ NUM_TIME_KEYS ];
|
||||
|
||||
StringTableEntry textureName[NUM_TEX];
|
||||
GFXTexHandle textureHandle[NUM_TEX];
|
||||
|
|
@ -152,7 +152,7 @@ private:
|
|||
F32 mRadius;
|
||||
F32 mVelocity;
|
||||
F32 mHeight;
|
||||
ColorF mColor;
|
||||
LinearColorF mColor;
|
||||
F32 mTimeSinceLastRing;
|
||||
bool mDead;
|
||||
F32 mElapsedTime;
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ bool GuiMaterialPreview::onWake()
|
|||
if (!mFakeSun)
|
||||
mFakeSun = LightManager::createLightInfo();
|
||||
|
||||
mFakeSun->setColor( ColorF( 1.0f, 1.0f, 1.0f ) );
|
||||
mFakeSun->setAmbient( ColorF( 0.5f, 0.5f, 0.5f ) );
|
||||
mFakeSun->setColor( LinearColorF( 1.0f, 1.0f, 1.0f ) );
|
||||
mFakeSun->setAmbient( LinearColorF( 0.5f, 0.5f, 0.5f ) );
|
||||
mFakeSun->setDirection( VectorF( 0.0f, 0.707f, -0.707f ) );
|
||||
mFakeSun->setPosition( mFakeSun->getDirection() * -10000.0f );
|
||||
mFakeSun->setRange( 2000000.0f );
|
||||
|
|
@ -89,7 +89,7 @@ bool GuiMaterialPreview::onWake()
|
|||
// This function allows the viewport's ambient color to be changed. This is exposed to script below.
|
||||
void GuiMaterialPreview::setAmbientLightColor( F32 r, F32 g, F32 b )
|
||||
{
|
||||
ColorF temp(r, g, b);
|
||||
LinearColorF temp(r, g, b);
|
||||
temp.clamp();
|
||||
GuiMaterialPreview::mFakeSun->setAmbient( temp );
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ void GuiMaterialPreview::setAmbientLightColor( F32 r, F32 g, F32 b )
|
|||
// This function allows the light's color to be changed. This is exposed to script below.
|
||||
void GuiMaterialPreview::setLightColor( F32 r, F32 g, F32 b )
|
||||
{
|
||||
ColorF temp(r, g, b);
|
||||
LinearColorF temp(r, g, b);
|
||||
temp.clamp();
|
||||
GuiMaterialPreview::mFakeSun->setColor( temp );
|
||||
}
|
||||
|
|
@ -437,8 +437,8 @@ void GuiMaterialPreview::resetViewport()
|
|||
mOrbitPos = mModel->getShape()->center;
|
||||
|
||||
// Reset the viewport's lighting.
|
||||
GuiMaterialPreview::mFakeSun->setColor( ColorF( 1.0f, 1.0f, 1.0f ) );
|
||||
GuiMaterialPreview::mFakeSun->setAmbient( ColorF( 0.5f, 0.5f, 0.5f ) );
|
||||
GuiMaterialPreview::mFakeSun->setColor( LinearColorF( 1.0f, 1.0f, 1.0f ) );
|
||||
GuiMaterialPreview::mFakeSun->setAmbient( LinearColorF( 0.5f, 0.5f, 0.5f ) );
|
||||
GuiMaterialPreview::mFakeSun->setDirection( VectorF( 0.0f, 0.707f, -0.707f ) );
|
||||
}
|
||||
|
||||
|
|
@ -482,14 +482,14 @@ DefineEngineMethod(GuiMaterialPreview, reset, void, (),,
|
|||
}
|
||||
|
||||
// This function allows the user to change the light's color.
|
||||
DefineEngineMethod(GuiMaterialPreview, setLightColor, void, ( ColorF color ),,
|
||||
DefineEngineMethod(GuiMaterialPreview, setLightColor, void, ( LinearColorF color ),,
|
||||
"Sets the color of the light in the scene.\n")
|
||||
{
|
||||
object->setLightColor( color.red, color.green, color.blue );
|
||||
}
|
||||
|
||||
// This function allows the user to change the viewports's ambient color.
|
||||
DefineEngineMethod(GuiMaterialPreview, setAmbientLightColor, void, ( ColorF color ),,
|
||||
DefineEngineMethod(GuiMaterialPreview, setAmbientLightColor, void, ( LinearColorF color ),,
|
||||
"Sets the color of the ambient light in the scene.\n")
|
||||
{
|
||||
object->setAmbientLightColor( color.red, color.green, color.blue );
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ void GuiObjectView::setCameraRotation( const EulerF& rotation )
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void GuiObjectView::setLightColor( const ColorF& color )
|
||||
void GuiObjectView::setLightColor( const LinearColorF& color )
|
||||
{
|
||||
mLightColor = color;
|
||||
if( mLight )
|
||||
|
|
@ -599,7 +599,7 @@ void GuiObjectView::setLightColor( const ColorF& color )
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void GuiObjectView::setLightAmbient( const ColorF& color )
|
||||
void GuiObjectView::setLightAmbient( const LinearColorF& color )
|
||||
{
|
||||
mLightAmbient = color;
|
||||
if( mLight )
|
||||
|
|
@ -952,7 +952,7 @@ DefineEngineMethod( GuiObjectView, setCameraSpeed, void, (F32 factor),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( GuiObjectView, setLightColor, void, ( ColorF color),,
|
||||
DefineEngineMethod( GuiObjectView, setLightColor, void, ( LinearColorF color),,
|
||||
"@brief Set the light color on the sun object used to render the model.\n\n"
|
||||
"@param color Color of sunlight.\n"
|
||||
"@tsexample\n"
|
||||
|
|
@ -968,7 +968,7 @@ DefineEngineMethod( GuiObjectView, setLightColor, void, ( ColorF color),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( GuiObjectView, setLightAmbient, void, (ColorF color),,
|
||||
DefineEngineMethod( GuiObjectView, setLightAmbient, void, (LinearColorF color),,
|
||||
"@brief Set the light ambient color on the sun object used to render the model.\n\n"
|
||||
"@param color Ambient color of sunlight.\n"
|
||||
"@tsexample\n"
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@ class GuiObjectView : public GuiTSCtrl
|
|||
LightInfo* mLight;
|
||||
|
||||
///
|
||||
ColorF mLightColor;
|
||||
LinearColorF mLightColor;
|
||||
|
||||
///
|
||||
ColorF mLightAmbient;
|
||||
LinearColorF mLightAmbient;
|
||||
|
||||
///
|
||||
Point3F mLightDirection;
|
||||
|
|
@ -255,10 +255,10 @@ class GuiObjectView : public GuiTSCtrl
|
|||
/// @{
|
||||
|
||||
///
|
||||
void setLightColor( const ColorF& color );
|
||||
void setLightColor( const LinearColorF& color );
|
||||
|
||||
///
|
||||
void setLightAmbient( const ColorF& color );
|
||||
void setLightAmbient( const LinearColorF& color );
|
||||
|
||||
///
|
||||
void setLightDirection( const Point3F& direction );
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ struct ItemData: public ShapeBaseData {
|
|||
|
||||
bool lightOnlyStatic;
|
||||
S32 lightType;
|
||||
ColorF lightColor;
|
||||
LinearColorF lightColor;
|
||||
S32 lightTime;
|
||||
F32 lightRadius;
|
||||
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ void LevelInfo::setLevelAccuTexture(const String& name)
|
|||
mAccuTextureName = name;
|
||||
if (isClientObject() && mAccuTextureName.isNotEmpty())
|
||||
{
|
||||
mAccuTexture.set(mAccuTextureName, &GFXDefaultStaticDiffuseProfile, "AccumulationVolume::mAccuTexture");
|
||||
mAccuTexture.set(mAccuTextureName, &GFXStaticTextureSRGBProfile, "AccumulationVolume::mAccuTexture");
|
||||
if (mAccuTexture.isNull())
|
||||
Con::warnf("AccumulationVolume::setTexture - Unable to load texture: %s", mAccuTextureName.c_str());
|
||||
else
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ void LightAnimData::animate( LightInfo *lightInfo, LightAnimState *state )
|
|||
|
||||
lightInfo->setTransform( transform );
|
||||
|
||||
ColorF color = state->color;
|
||||
LinearColorF color = state->color;
|
||||
mColor.animate( time, color );
|
||||
lightInfo->setColor( color );
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ struct LightAnimState
|
|||
MatrixF transform;
|
||||
|
||||
/// The set light color before animation occurs.
|
||||
ColorF color;
|
||||
LinearColorF color;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ ConsoleDocClass( LightBase,
|
|||
|
||||
LightBase::LightBase()
|
||||
: mIsEnabled( true ),
|
||||
mColor( ColorF::WHITE ),
|
||||
mColor( LinearColorF::WHITE ),
|
||||
mBrightness( 1.0f ),
|
||||
mCastShadows( false ),
|
||||
mStaticRefreshFreq( 250 ),
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ protected:
|
|||
|
||||
bool mIsEnabled;
|
||||
|
||||
ColorF mColor;
|
||||
LinearColorF mColor;
|
||||
|
||||
F32 mBrightness;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
|
||||
LightDescription::LightDescription()
|
||||
: color( ColorF::WHITE ),
|
||||
: color( LinearColorF::WHITE ),
|
||||
brightness( 1.0f ),
|
||||
range( 5.0f ),
|
||||
castShadows( false ),
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
bool _preload( bool server, String &errorStr );
|
||||
|
||||
ColorF color;
|
||||
LinearColorF color;
|
||||
F32 brightness;
|
||||
F32 range;
|
||||
bool castShadows;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ LightFlareData::LightFlareData()
|
|||
{
|
||||
dMemset( mElementRect, 0, sizeof( RectF ) * MAX_ELEMENTS );
|
||||
dMemset( mElementScale, 0, sizeof( F32 ) * MAX_ELEMENTS );
|
||||
dMemset( mElementTint, 0, sizeof( ColorF ) * MAX_ELEMENTS );
|
||||
dMemset( mElementTint, 0, sizeof( LinearColorF ) * MAX_ELEMENTS );
|
||||
dMemset( mElementRotate, 0, sizeof( bool ) * MAX_ELEMENTS );
|
||||
dMemset( mElementUseLightColor, 0, sizeof( bool ) * MAX_ELEMENTS );
|
||||
|
||||
|
|
@ -524,7 +524,7 @@ void LightFlareData::prepRender(SceneRenderState *state, LightFlareState *flareS
|
|||
//
|
||||
// These are the factors which affect the "alpha" of the flare effect.
|
||||
// Modulate more in as appropriate.
|
||||
ColorF baseColor = ColorF::WHITE * lightSourceBrightnessScale * occlusionFade;
|
||||
LinearColorF baseColor = LinearColorF::WHITE * lightSourceBrightnessScale * occlusionFade;
|
||||
|
||||
// Setup the vertex buffer for the maximum flare elements.
|
||||
const U32 vertCount = 4 * mElementCount;
|
||||
|
|
@ -544,7 +544,7 @@ void LightFlareData::prepRender(SceneRenderState *state, LightFlareState *flareS
|
|||
|
||||
Point3F *basePos = mElementRotate[i] ? rotatedBasePoints : sBasePoints;
|
||||
|
||||
ColorF color( baseColor * mElementTint[i] );
|
||||
LinearColorF color( baseColor * mElementTint[i] );
|
||||
if ( mElementUseLightColor[i] )
|
||||
color *= lightInfo->getColor();
|
||||
color.clamp();
|
||||
|
|
@ -571,22 +571,23 @@ void LightFlareData::prepRender(SceneRenderState *state, LightFlareState *flareS
|
|||
size.y = getMax( size.y, 1.0f );
|
||||
size *= oneOverViewportExtent;
|
||||
|
||||
vert->color = color;
|
||||
const ColorI colori = color.toColorI();
|
||||
vert->color = colori;
|
||||
vert->point = ( basePos[0] * size ) + pos;
|
||||
vert->texCoord.set( texCoordMin.x, texCoordMax.y );
|
||||
vert++;
|
||||
|
||||
vert->color = color;
|
||||
vert->color = colori;
|
||||
vert->point = ( basePos[1] * size ) + pos;
|
||||
vert->texCoord.set( texCoordMax.x, texCoordMax.y );
|
||||
vert++;
|
||||
|
||||
vert->color = color;
|
||||
vert->color = colori;
|
||||
vert->point = ( basePos[2] * size ) + pos;
|
||||
vert->texCoord.set( texCoordMax.x, texCoordMin.y );
|
||||
vert++;
|
||||
|
||||
vert->color = color;
|
||||
vert->color = colori;
|
||||
vert->point = ( basePos[3] * size ) + pos;
|
||||
vert->texCoord.set( texCoordMin.x, texCoordMin.y );
|
||||
vert++;
|
||||
|
|
@ -633,7 +634,7 @@ bool LightFlareData::_preload( bool server, String &errorStr )
|
|||
if ( !server )
|
||||
{
|
||||
if ( mFlareTextureName.isNotEmpty() )
|
||||
mFlareTexture.set( mFlareTextureName, &GFXDefaultStaticDiffuseProfile, "FlareTexture" );
|
||||
mFlareTexture.set( mFlareTextureName, &GFXStaticTextureSRGBProfile, "FlareTexture" );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ protected:
|
|||
RectF mElementRect[MAX_ELEMENTS];
|
||||
F32 mElementDist[MAX_ELEMENTS];
|
||||
F32 mElementScale[MAX_ELEMENTS];
|
||||
ColorF mElementTint[MAX_ELEMENTS];
|
||||
LinearColorF mElementTint[MAX_ELEMENTS];
|
||||
bool mElementRotate[MAX_ELEMENTS];
|
||||
bool mElementUseLightColor[MAX_ELEMENTS];
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ void PhysicalZone::renderObject( ObjectRenderInst *ri,
|
|||
drawer->drawPolyhedron( desc, mPolyhedron, ColorI( 0, 255, 0, 45 ) );
|
||||
|
||||
desc.setFillModeWireframe();
|
||||
drawer->drawPolyhedron( desc, mPolyhedron, ColorF::BLACK );
|
||||
drawer->drawPolyhedron( desc, mPolyhedron, ColorI::BLACK );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -3893,7 +3893,7 @@ void Player::updateActionThread()
|
|||
ParticleEmitter * emitter = new ParticleEmitter;
|
||||
emitter->onNewDataBlock( mDataBlock->footPuffEmitter, false );
|
||||
|
||||
ColorF colorList[ ParticleData::PDC_NUM_KEYS];
|
||||
LinearColorF colorList[ ParticleData::PDC_NUM_KEYS];
|
||||
|
||||
for( U32 x = 0; x < getMin( Material::NUM_EFFECT_COLOR_STAGES, ParticleData::PDC_NUM_KEYS ); ++ x )
|
||||
colorList[ x ].set( material->mEffectColor[ x ].red,
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ void PointLight::_renderViz( SceneRenderState *state )
|
|||
desc.setBlend( true );
|
||||
|
||||
// Base the sphere color on the light color.
|
||||
ColorI color( mColor );
|
||||
ColorI color = mColor.toColorI();
|
||||
color.alpha = 16;
|
||||
|
||||
draw->drawSphere( desc, mRadius, getPosition(), color );
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ void Portal::_renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseM
|
|||
GFX->getDrawUtil()->drawPolygon( desc, mPortalPolygonWS.address(), mPortalPolygonWS.size(), color );
|
||||
|
||||
desc.setFillModeWireframe();
|
||||
GFX->getDrawUtil()->drawPolygon( desc, mPortalPolygonWS.address(), mPortalPolygonWS.size(), ColorF::RED );
|
||||
GFX->getDrawUtil()->drawPolygon( desc, mPortalPolygonWS.address(), mPortalPolygonWS.size(), ColorI::RED );
|
||||
|
||||
// Render rest.
|
||||
|
||||
|
|
|
|||
|
|
@ -653,7 +653,7 @@ void ProximityMine::renderObject( ObjectRenderInst* ri,
|
|||
// Render the trigger area
|
||||
if ( mState == Armed || mState == Triggered )
|
||||
{
|
||||
const ColorF drawColor(1, 0, 0, 0.05f);
|
||||
const LinearColorF drawColor(1, 0, 0, 0.05f);
|
||||
if ( drawColor.alpha > 0 )
|
||||
{
|
||||
GFXStateBlockDesc desc;
|
||||
|
|
|
|||
|
|
@ -2389,7 +2389,7 @@ void ShapeBase::emitDust( ParticleEmitter* emitter, F32 triggerHeight, const Poi
|
|||
Material* material = ( rayInfo.material ? dynamic_cast< Material* >( rayInfo.material->getMaterial() ) : 0 );
|
||||
if( material && material->mShowDust )
|
||||
{
|
||||
ColorF colorList[ ParticleData::PDC_NUM_KEYS ];
|
||||
LinearColorF colorList[ ParticleData::PDC_NUM_KEYS ];
|
||||
|
||||
for( U32 x = 0; x < getMin( Material::NUM_EFFECT_COLOR_STAGES, ParticleData::PDC_NUM_KEYS ); ++ x )
|
||||
colorList[ x ] = material->mEffectColor[ x ];
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ struct ShapeBaseImageData: public GameBaseData {
|
|||
S32 lightType; ///< Indicates the type of the light.
|
||||
///
|
||||
/// One of: ConstantLight, PulsingLight, WeaponFireLight.
|
||||
ColorF lightColor;
|
||||
LinearColorF lightColor;
|
||||
S32 lightDuration; ///< The duration in SimTime of Pulsing or WeaponFire type lights.
|
||||
F32 lightRadius; ///< Extent of light.
|
||||
F32 lightBrightness; ///< Brightness of the light ( if it is WeaponFireLight ).
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ void SpotLight::_renderViz( SceneRenderState *state )
|
|||
desc.setBlend( true );
|
||||
|
||||
// Base the color on the light color.
|
||||
ColorI color( mColor );
|
||||
ColorI color = mColor.toColorI();
|
||||
color.alpha = 16;
|
||||
|
||||
F32 radius = mRange * mSin( mDegToRad( mOuterConeAngle * 0.5f ) );
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class GuiSpeedometerHud : public GuiBitmapCtrl
|
|||
F32 mMaxAngle; ///< Max pos of needle
|
||||
F32 mMinAngle; ///< Min pos of needle
|
||||
Point2F mCenter; ///< Center of needle rotation
|
||||
ColorF mColor; ///< Needle Color
|
||||
LinearColorF mColor; ///< Needle Color
|
||||
F32 mNeedleLength;
|
||||
F32 mNeedleWidth;
|
||||
F32 mTailLength;
|
||||
|
|
|
|||
|
|
@ -1235,7 +1235,7 @@ void WheeledVehicle::updateWheelParticles(F32 dt)
|
|||
|
||||
if( material)//&& material->mShowDust )
|
||||
{
|
||||
ColorF colorList[ ParticleData::PDC_NUM_KEYS ];
|
||||
LinearColorF colorList[ ParticleData::PDC_NUM_KEYS ];
|
||||
|
||||
for( U32 x = 0; x < getMin( Material::NUM_EFFECT_COLOR_STAGES, ParticleData::PDC_NUM_KEYS ); ++ x )
|
||||
colorList[ x ] = material->mEffectColor[ x ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue