//----------------------------------------------------------------------- void ColourFaderAffector::_affectParticles(ParticleSystem* pSystem, Real timeElapsed) { ParticleIterator pi = pSystem->_getIterator(); Particle *p; float dr, dg, db, da; // Scale adjustments by time dr = mRedAdj * timeElapsed; dg = mGreenAdj * timeElapsed; db = mBlueAdj * timeElapsed; da = mAlphaAdj * timeElapsed; while (!pi.end()) { p = pi.getNext(); applyAdjustWithClamp(&p->colour.r, dr); applyAdjustWithClamp(&p->colour.g, dg); applyAdjustWithClamp(&p->colour.b, db); applyAdjustWithClamp(&p->colour.a, da); } }
//----------------------------------------------------------------------- void ColourFaderAffector2::_affectParticles(ParticleSystem* pSystem, Real timeElapsed) { ParticleIterator pi = pSystem->_getIterator(); Particle *p; float dr1, dg1, db1, da1; float dr2, dg2, db2, da2; // Scale adjustments by time dr1 = mRedAdj1 * timeElapsed; dg1 = mGreenAdj1 * timeElapsed; db1 = mBlueAdj1 * timeElapsed; da1 = mAlphaAdj1 * timeElapsed; // Scale adjustments by time dr2 = mRedAdj2 * timeElapsed; dg2 = mGreenAdj2 * timeElapsed; db2 = mBlueAdj2 * timeElapsed; da2 = mAlphaAdj2 * timeElapsed; while (!pi.end()) { p = pi.getNext(); if( p->timeToLive > StateChangeVal ) { applyAdjustWithClamp(&p->colour.r, dr1); applyAdjustWithClamp(&p->colour.g, dg1); applyAdjustWithClamp(&p->colour.b, db1); applyAdjustWithClamp(&p->colour.a, da1); } else { applyAdjustWithClamp(&p->colour.r, dr2); applyAdjustWithClamp(&p->colour.g, dg2); applyAdjustWithClamp(&p->colour.b, db2); applyAdjustWithClamp(&p->colour.a, da2); } } }