mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-23 05:15:34 +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
8943c673fb
commit
0801a3cca8
294 changed files with 3894 additions and 2813 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue