aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llflexibleobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llflexibleobject.cpp')
-rw-r--r--linden/indra/newview/llflexibleobject.cpp78
1 files changed, 60 insertions, 18 deletions
diff --git a/linden/indra/newview/llflexibleobject.cpp b/linden/indra/newview/llflexibleobject.cpp
index eb9b927..e9c2332 100644
--- a/linden/indra/newview/llflexibleobject.cpp
+++ b/linden/indra/newview/llflexibleobject.cpp
@@ -47,6 +47,7 @@
47#include "llviewerobjectlist.h" 47#include "llviewerobjectlist.h"
48#include "llviewerregion.h" 48#include "llviewerregion.h"
49#include "llworld.h" 49#include "llworld.h"
50#include "llvoavatar.h"
50 51
51/*static*/ F32 LLVolumeImplFlexible::sUpdateFactor = 1.0f; 52/*static*/ F32 LLVolumeImplFlexible::sUpdateFactor = 1.0f;
52 53
@@ -66,6 +67,11 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD
66 mSimulateRes = 0; 67 mSimulateRes = 0;
67 mFrameNum = 0; 68 mFrameNum = 0;
68 mRenderRes = 1; 69 mRenderRes = 1;
70
71 if(mVO->mDrawable.notNull())
72 {
73 mVO->mDrawable->makeActive() ;
74 }
69}//----------------------------------------------- 75}//-----------------------------------------------
70 76
71LLVector3 LLVolumeImplFlexible::getFramePosition() const 77LLVector3 LLVolumeImplFlexible::getFramePosition() const
@@ -240,12 +246,7 @@ void LLVolumeImplFlexible::setAttributesOfAllSections()
240 246
241void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, const S32 detail) 247void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, const S32 detail)
242{ 248{
243 /*doIdleUpdate(gAgent, *gWorldp, 0.0); 249
244 if (mVO && mVO->mDrawable.notNull())
245 {
246 gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
247 gPipeline.markMoved(mVO->mDrawable);
248 }*/
249} 250}
250 251
251//--------------------------------------------------------------------------------- 252//---------------------------------------------------------------------------------
@@ -255,13 +256,14 @@ void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, cons
255//--------------------------------------------------------------------------------- 256//---------------------------------------------------------------------------------
256BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) 257BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
257{ 258{
258
259 if (mVO->mDrawable.isNull()) 259 if (mVO->mDrawable.isNull())
260 { 260 {
261 // Don't do anything until we have a drawable 261 // Don't do anything until we have a drawable
262 return FALSE; // (we are not initialized or updated) 262 return FALSE; // (we are not initialized or updated)
263 } 263 }
264 264
265 BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE;
266
265 //flexible objects never go static 267 //flexible objects never go static
266 mVO->mDrawable->mQuietCount = 0; 268 mVO->mDrawable->mQuietCount = 0;
267 if (!mVO->mDrawable->isRoot()) 269 if (!mVO->mDrawable->isRoot())
@@ -307,7 +309,11 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6
307 return FALSE; // (we are not initialized or updated) 309 return FALSE; // (we are not initialized or updated)
308 } 310 }
309 311
310 if (mVO->mDrawable->isVisible() && 312 if (force_update)
313 {
314 gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE);
315 }
316 else if (mVO->mDrawable->isVisible() &&
311 !mVO->mDrawable->isState(LLDrawable::IN_REBUILD_Q1) && 317 !mVO->mDrawable->isState(LLDrawable::IN_REBUILD_Q1) &&
312 mVO->getPixelArea() > 256.f) 318 mVO->getPixelArea() > 256.f)
313 { 319 {
@@ -332,7 +338,7 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6
332 } 338 }
333 } 339 }
334 340
335 return TRUE; 341 return force_update;
336} 342}
337 343
338inline S32 log2(S32 x) 344inline S32 log2(S32 x)
@@ -348,7 +354,8 @@ inline S32 log2(S32 x)
348 354
349void LLVolumeImplFlexible::doFlexibleUpdate() 355void LLVolumeImplFlexible::doFlexibleUpdate()
350{ 356{
351 LLPath *path = &mVO->getVolume()->getPath(); 357 LLVolume* volume = mVO->getVolume();
358 LLPath *path = &volume->getPath();
352 if (mSimulateRes == 0) 359 if (mSimulateRes == 0)
353 { 360 {
354 mVO->markForUpdate(TRUE); 361 mVO->markForUpdate(TRUE);
@@ -568,7 +575,11 @@ void LLVolumeImplFlexible::doFlexibleUpdate()
568 575
569 // Create points 576 // Create points
570 S32 num_render_sections = 1<<mRenderRes; 577 S32 num_render_sections = 1<<mRenderRes;
571 path->resizePath(num_render_sections+1); 578 if (path->getPathLength() != num_render_sections+1)
579 {
580 ((LLVOVolume*) mVO)->mVolumeChanged = TRUE;
581 volume->resizePath(num_render_sections+1);
582 }
572 583
573 LLPath::PathPt *new_point; 584 LLPath::PathPt *new_point;
574 585
@@ -600,7 +611,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate()
600 LLVector3 pos = newSection[i].mPosition * rel_xform; 611 LLVector3 pos = newSection[i].mPosition * rel_xform;
601 LLQuaternion rot = mSection[i].mAxisRotation * newSection[i].mRotation * delta_rot; 612 LLQuaternion rot = mSection[i].mAxisRotation * newSection[i].mRotation * delta_rot;
602 613
603 if (!mUpdated || (new_point->mPos-pos).magVecSquared() > 0.000001f) 614 if (!mUpdated || (new_point->mPos-pos).magVec()/mVO->mDrawable->mDistanceWRTCamera > 0.001f)
604 { 615 {
605 new_point->mPos = newSection[i].mPosition * rel_xform; 616 new_point->mPos = newSection[i].mPosition * rel_xform;
606 mUpdated = FALSE; 617 mUpdated = FALSE;
@@ -614,9 +625,19 @@ void LLVolumeImplFlexible::doFlexibleUpdate()
614 mLastSegmentRotation = parentSegmentRotation; 625 mLastSegmentRotation = parentSegmentRotation;
615} 626}
616 627
628void LLVolumeImplFlexible::preRebuild()
629{
630 if (!mUpdated)
631 {
632 doFlexibleRebuild();
633 }
634}
635
617void LLVolumeImplFlexible::doFlexibleRebuild() 636void LLVolumeImplFlexible::doFlexibleRebuild()
618{ 637{
619 mVO->getVolume()->regen(); 638 LLVolume* volume = mVO->getVolume();
639 volume->regen();
640
620 mUpdated = TRUE; 641 mUpdated = TRUE;
621} 642}
622 643
@@ -631,7 +652,26 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
631{ 652{
632 LLVOVolume *volume = (LLVOVolume*)mVO; 653 LLVOVolume *volume = (LLVOVolume*)mVO;
633 654
634 if (volume->mDrawable.isNull()) // Not sure why this is happening, but it is... 655 if (mVO->isAttachment())
656 { //don't update flexible attachments for impostored avatars unless the
657 //impostor is being updated this frame (w00!)
658 LLViewerObject* parent = (LLViewerObject*) mVO->getParent();
659 while (parent && !parent->isAvatar())
660 {
661 parent = (LLViewerObject*) parent->getParent();
662 }
663
664 if (parent)
665 {
666 LLVOAvatar* avatar = (LLVOAvatar*) parent;
667 if (avatar->isImpostor() && !avatar->needsImpostorUpdate())
668 {
669 return TRUE;
670 }
671 }
672 }
673
674 if (volume->mDrawable.isNull())
635 { 675 {
636 return TRUE; // No update to complete 676 return TRUE; // No update to complete
637 } 677 }
@@ -660,11 +700,14 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
660 { 700 {
661 volume->regenFaces(); 701 volume->regenFaces();
662 volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME); 702 volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME);
703 volume->dirtySpatialGroup();
704 doFlexibleRebuild();
705 volume->genBBoxes(isVolumeGlobal());
663 } 706 }
664 707 else if (!mUpdated || rotated)
665 if (!mUpdated || volume->mFaceMappingChanged || volume->mVolumeChanged || rotated)
666 { 708 {
667 doFlexibleRebuild(); 709 volume->mDrawable->setState(LLDrawable::REBUILD_POSITION);
710 volume->dirtyMesh();
668 volume->genBBoxes(isVolumeGlobal()); 711 volume->genBBoxes(isVolumeGlobal());
669 } 712 }
670 713
@@ -672,7 +715,6 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
672 volume->mLODChanged = FALSE; 715 volume->mLODChanged = FALSE;
673 volume->mFaceMappingChanged = FALSE; 716 volume->mFaceMappingChanged = FALSE;
674 717
675
676 // clear UV flag 718 // clear UV flag
677 drawable->clearState(LLDrawable::UV); 719 drawable->clearState(LLDrawable::UV);
678 720