[sldev] Reviewing/Fixing the Particle System
Nicholaz Beresford
nicholaz at blueflash.cc
Tue May 22 16:11:16 PDT 2007
Hi!
I'm currently looking (again) at the particle system (bascially VWR-418).
There are a lot of intertwined issues, but one thing I'm trying to do is to
verify the parameters on the client side before generating particles.
Here is a piece of code I'm currently using to match the parameters against
http://wiki.secondlife.com/wiki/LlParticleSystem
Reviews please ...
// PATCH limit particle system and particle values [Nicholaz Beresford]
//
// see limits as per http://wiki.secondlife.com/wiki/LlParticleSystem
LLPartSysData &psd = mPartSysData; // a little shorthand
LLPartData &pd = psd.mPartData;
S32 parts_per_second =
(S32)((1.f/psd.mBurstRate)*(S32)psd.mBurstPartCount); // particle
generation rate
if (0.f == psd.mMaxAge || psd.mMaxAge > 60.f) // don't llclamp!
(zero equals indefinite => 60s)
{
psd.mMaxAge = 60.f;
}
psd.mPartAccel.mV[0] = llclamp(psd.mPartAccel.mV[0], 0.f, 100.f);
psd.mPartAccel.mV[1] = llclamp(psd.mPartAccel.mV[1], 0.f, 100.f);
psd.mPartAccel.mV[2] = llclamp(psd.mPartAccel.mV[2], 0.f, 100.f);
pd.mMaxAge = llclamp(pd.mMaxAge, 0.f, 30.f);
pd.mStartScale.mV[0] = llclamp(pd.mStartScale.mV[0], 0.04f, 4.f);
pd.mStartScale.mV[1] = llclamp(pd.mStartScale.mV[1], 0.04f, 4.f);
pd.mStartScale.mV[2] = llclamp(pd.mStartScale.mV[2], 0.04f, 4.f);
//
// ~PATCH
More information about the SLDev
mailing list