Mats.
This commit is contained in:
@@ -86,12 +86,31 @@ LLViewerPart::LLViewerPart() :
|
||||
mImagep(NULL)
|
||||
{
|
||||
mPartSourcep = NULL;
|
||||
|
||||
mParent = NULL;
|
||||
mChild = NULL;
|
||||
++LLViewerPartSim::sParticleCount2 ;
|
||||
}
|
||||
|
||||
LLViewerPart::~LLViewerPart()
|
||||
{
|
||||
if (mPartSourcep.notNull() && mPartSourcep->mLastPart == this)
|
||||
{
|
||||
mPartSourcep->mLastPart = NULL;
|
||||
}
|
||||
|
||||
//patch up holes in the ribbon
|
||||
if (mParent)
|
||||
{
|
||||
llassert(mParent->mChild == this);
|
||||
mParent->mChild = mChild;
|
||||
}
|
||||
|
||||
if (mChild)
|
||||
{
|
||||
llassert (mChild->mParent == this);
|
||||
mChild->mParent = mParent;
|
||||
}
|
||||
|
||||
mPartSourcep = NULL;
|
||||
|
||||
--LLViewerPartSim::sParticleCount2 ;
|
||||
@@ -147,7 +166,11 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo
|
||||
}
|
||||
mVOPartGroupp->setViewerPartGroup(this);
|
||||
mVOPartGroupp->setPositionAgent(getCenterAgent());
|
||||
|
||||
mBoxSide = box_side;
|
||||
|
||||
F32 scale = box_side * 0.5f;
|
||||
|
||||
mVOPartGroupp->setScale(LLVector3(scale,scale,scale));
|
||||
|
||||
//gPipeline.addObject(mVOPartGroupp);
|
||||
@@ -373,6 +396,9 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt)
|
||||
part->mScale += frac*part->mEndScale;
|
||||
}
|
||||
|
||||
// Do glow interpolation
|
||||
part->mGlow.mV[3] = (U8) llround(lerp(part->mStartGlow, part->mEndGlow, frac)*255.f);
|
||||
|
||||
// Set the last update time to now.
|
||||
part->mLastUpdateTime = cur_time;
|
||||
|
||||
@@ -491,11 +517,16 @@ void LLViewerPartSim::destroyClass()
|
||||
mViewerPartSources.clear();
|
||||
}
|
||||
|
||||
//static
|
||||
BOOL LLViewerPartSim::shouldAddPart()
|
||||
{
|
||||
if (sParticleCount >= MAX_PART_COUNT)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (sParticleCount > PART_THROTTLE_THRESHOLD*sMaxParticleCount)
|
||||
{
|
||||
|
||||
F32 frac = (F32)sParticleCount/(F32)sMaxParticleCount;
|
||||
frac -= PART_THROTTLE_THRESHOLD;
|
||||
frac *= PART_THROTTLE_RESCALE;
|
||||
@@ -505,7 +536,10 @@ BOOL LLViewerPartSim::shouldAddPart()
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (sParticleCount >= MAX_PART_COUNT)
|
||||
|
||||
// Check frame rate, and don't add more if the viewer is really slow
|
||||
const F32 MIN_FRAME_RATE_FOR_NEW_PARTICLES = 4.f;
|
||||
if (gFPSClamped < MIN_FRAME_RATE_FOR_NEW_PARTICLES)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -621,6 +655,9 @@ void LLViewerPartSim::updateSimulation()
|
||||
{
|
||||
static LLFrameTimer update_timer;
|
||||
|
||||
//reset VBO cursor
|
||||
LLVOPartGroup::sVBSlotCursor = 0;
|
||||
|
||||
const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
|
||||
|
||||
if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
|
||||
|
||||
Reference in New Issue
Block a user