diff options
author | Oz Linden <oz@lindenlab.com> | 2013-03-18 14:30:57 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-03-18 14:30:57 -0400 |
commit | ed7785bf97a601448ba2da5fb2f19ea2861454c5 (patch) | |
tree | 17e8d9ccf28ae30c5029ecea7e0ab8bed0fe3926 /indra/newview/llflexibleobject.cpp | |
parent | c8533650b4779040c5e196f9ff156e3454edc9c8 (diff) | |
parent | bf95c1cae7a84d1a97dacd8ea7f1b6af8be067a9 (diff) |
merge up to 3.5.0-beta3 (chui)
Diffstat (limited to 'indra/newview/llflexibleobject.cpp')
-rw-r--r-- | indra/newview/llflexibleobject.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 28d195d5e9..a5ee4607a1 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -48,7 +48,7 @@ std::vector<LLVolumeImplFlexible*> LLVolumeImplFlexible::sInstanceList; std::vector<S32> LLVolumeImplFlexible::sUpdateDelay; static LLFastTimer::DeclareTimer FTM_FLEXIBLE_REBUILD("Rebuild"); -static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Update"); +static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Flexible Update"); // LLFlexibleObjectData::pack/unpack now in llprimitive.cpp @@ -66,7 +66,7 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD mSimulateRes = 0; mFrameNum = 0; mCollisionSphereRadius = 0.f; - mRenderRes = 1; + mRenderRes = -1; if(mVO->mDrawable.notNull()) { @@ -342,31 +342,32 @@ void LLVolumeImplFlexible::doIdleUpdate() if (drawablep) { //LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); - + //ensure drawable is active drawablep->makeActive(); - + if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) { bool visible = drawablep->isVisible(); - if ((mSimulateRes == 0) && visible) + if (mRenderRes == -1) { updateRenderRes(); gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); + sUpdateDelay[mInstanceIndex] = 0; } else { F32 pixel_area = mVO->getPixelArea(); - U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; + U32 update_period = (U32) (llmax((S32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f))),0)+1); // MAINT-1890 Clamp the update period to ensure that the update_period is no greater than 32 frames update_period = llclamp(update_period, 0U, 32U); if (visible) { if (!drawablep->isState(LLDrawable::IN_REBUILD_Q1) && - mVO->getPixelArea() > 256.f) + pixel_area > 256.f) { U32 id; @@ -380,21 +381,31 @@ void LLVolumeImplFlexible::doIdleUpdate() id = parent->getVolumeInterfaceID(); } - if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) - { + if (mVO->isRootEdit()) + { + id = mID; + } + else + { + LLVOVolume* parent = (LLVOVolume*) mVO->getParent(); + id = parent->getVolumeInterfaceID(); + } + + if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) + { sUpdateDelay[mInstanceIndex] = (S32) update_period-1; - updateRenderRes(); + updateRenderRes(); - gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); - } - } + gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); } + } + } else { sUpdateDelay[mInstanceIndex] = (S32) update_period; - } - } + } +} } } @@ -419,7 +430,6 @@ void LLVolumeImplFlexible::doFlexibleUpdate() if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible()) { BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE; - doIdleUpdate(); if (!force_update || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) @@ -434,7 +444,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() return ; } - // stinson 11/12/2012: Need to check with davep on the following. + // Fix for MAINT-1894 // Skipping the flexible update if render res is negative. If we were to continue with a negative value, // the subsequent S32 num_render_sections = 1<<mRenderRes; code will specify a really large number of // render sections which will then create a length exception in the std::vector::resize() method. @@ -650,6 +660,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() mSection[i].mdPosition = (mSection[i].mPosition - mSection[i-1].mPosition) * inv_section_length; // Create points + llassert(mRenderRes > -1) S32 num_render_sections = 1<<mRenderRes; if (path->getPathLength() != num_render_sections+1) { |