aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llselectmgr.cpp')
-rw-r--r--linden/indra/newview/llselectmgr.cpp110
1 files changed, 27 insertions, 83 deletions
diff --git a/linden/indra/newview/llselectmgr.cpp b/linden/indra/newview/llselectmgr.cpp
index 598ded9..ec7ba78 100644
--- a/linden/indra/newview/llselectmgr.cpp
+++ b/linden/indra/newview/llselectmgr.cpp
@@ -91,7 +91,6 @@ const S32 MAX_ACTION_QUEUE_SIZE = 20;
91const S32 MAX_SILS_PER_FRAME = 50; 91const S32 MAX_SILS_PER_FRAME = 50;
92const S32 MAX_OBJECTS_PER_PACKET = 254; 92const S32 MAX_OBJECTS_PER_PACKET = 254;
93 93
94extern LLGlobalEconomy *gGlobalEconomy;
95extern LLUUID gLastHitObjectID; 94extern LLUUID gLastHitObjectID;
96extern LLVector3d gLastHitObjectOffset; 95extern LLVector3d gLastHitObjectOffset;
97 96
@@ -208,6 +207,20 @@ LLSelectMgr::~LLSelectMgr()
208 207
209void LLSelectMgr::updateEffects() 208void LLSelectMgr::updateEffects()
210{ 209{
210
211 //keep reference grid objects active
212 for (LLSelectNode* grid_nodep = mGridObjects.getFirstNode();
213 grid_nodep;
214 grid_nodep = mGridObjects.getNextNode())
215 {
216 LLViewerObject* grid_object = grid_nodep->getObject();
217 LLDrawable* drawable = grid_object->mDrawable;
218 if (drawable)
219 {
220 gPipeline.markMoved(drawable);
221 }
222 }
223
211 if (mEffectsTimer.getElapsedTimeF32() > 1.f) 224 if (mEffectsTimer.getElapsedTimeF32() > 1.f)
212 { 225 {
213 mSelectedObjects->updateEffects(); 226 mSelectedObjects->updateEffects();
@@ -993,7 +1006,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
993 LLVector3 first_grid_obj_pos = grid_object->getRenderPosition(); 1006 LLVector3 first_grid_obj_pos = grid_object->getRenderPosition();
994 1007
995 LLVector3 min_extents(F32_MAX, F32_MAX, F32_MAX); 1008 LLVector3 min_extents(F32_MAX, F32_MAX, F32_MAX);
996 LLVector3 max_extents(F32_MIN, F32_MIN, F32_MIN); 1009 LLVector3 max_extents(-min_extents);
997 BOOL grid_changed = FALSE; 1010 BOOL grid_changed = FALSE;
998 LLSelectNode* grid_nodep; 1011 LLSelectNode* grid_nodep;
999 for (grid_nodep = mGridObjects.getFirstNode(); 1012 for (grid_nodep = mGridObjects.getFirstNode();
@@ -1001,34 +1014,23 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
1001 grid_nodep = mGridObjects.getNextNode()) 1014 grid_nodep = mGridObjects.getNextNode())
1002 { 1015 {
1003 grid_object = grid_nodep->getObject(); 1016 grid_object = grid_nodep->getObject();
1004 1017 LLDrawable* drawable = grid_object->mDrawable;
1005 LLVector3 local_min_extents(F32_MAX, F32_MAX, F32_MAX); 1018 if (drawable)
1006 LLVector3 local_max_extents(F32_MIN, F32_MIN, F32_MIN);
1007
1008 // *FIX: silhouette flag is insufficient as it gets
1009 // cleared by view update.
1010 if (!mGridValid ||
1011 grid_object->isChanged(LLXform::SILHOUETTE)
1012 || (grid_object->getParent() && grid_object->getParent()->isChanged(LLXform::SILHOUETTE)))
1013 { 1019 {
1014 getSilhouetteExtents(grid_nodep, mGridRotation, local_min_extents, local_max_extents); 1020 const LLVector3* ext = drawable->getSpatialExtents();
1021 update_min_max(min_extents, max_extents, ext[0]);
1022 update_min_max(min_extents, max_extents, ext[1]);
1015 grid_changed = TRUE; 1023 grid_changed = TRUE;
1016 LLVector3 object_offset = (grid_object->getRenderPosition() - first_grid_obj_pos) * ~mGridRotation;
1017 local_min_extents += object_offset;
1018 local_max_extents += object_offset;
1019 } 1024 }
1020 min_extents.mV[VX] = llmin(min_extents.mV[VX], local_min_extents.mV[VX]);
1021 min_extents.mV[VY] = llmin(min_extents.mV[VY], local_min_extents.mV[VY]);
1022 min_extents.mV[VZ] = llmin(min_extents.mV[VZ], local_min_extents.mV[VZ]);
1023 max_extents.mV[VX] = llmax(max_extents.mV[VX], local_max_extents.mV[VX]);
1024 max_extents.mV[VY] = llmax(max_extents.mV[VY], local_max_extents.mV[VY]);
1025 max_extents.mV[VZ] = llmax(max_extents.mV[VZ], local_max_extents.mV[VZ]);
1026 } 1025 }
1027 if (grid_changed) 1026 if (grid_changed)
1028 { 1027 {
1029 mGridOrigin = lerp(min_extents, max_extents, 0.5f); 1028 mGridOrigin = lerp(min_extents, max_extents, 0.5f);
1030 mGridOrigin = mGridOrigin * ~mGridRotation; 1029 LLDrawable* drawable = grid_object->mDrawable;
1031 mGridOrigin += first_grid_obj_pos; 1030 if (drawable && drawable->isActive())
1031 {
1032 mGridOrigin = mGridOrigin * grid_object->getRenderMatrix();
1033 }
1032 mGridScale = (max_extents - min_extents) * 0.5f; 1034 mGridScale = (max_extents - min_extents) * 0.5f;
1033 } 1035 }
1034 } 1036 }
@@ -4939,66 +4941,6 @@ void LLSelectMgr::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_
4939 } 4941 }
4940} 4942}
4941 4943
4942void LLSelectMgr::getSilhouetteExtents(LLSelectNode* nodep, const LLQuaternion& orientation, LLVector3& min_extents, LLVector3& max_extents)
4943{
4944 LLViewerObject* objectp = nodep->getObject();
4945
4946 if (objectp->mDrawable.isNull())
4947 {
4948 return;
4949 }
4950
4951 LLQuaternion test_rot = orientation * ~objectp->getRenderRotation();
4952 LLVector3 x_axis_rot = LLVector3::x_axis * test_rot;
4953 LLVector3 y_axis_rot = LLVector3::y_axis * test_rot;
4954 LLVector3 z_axis_rot = LLVector3::z_axis * test_rot;
4955
4956 x_axis_rot.scaleVec(objectp->mDrawable->getScale());
4957 y_axis_rot.scaleVec(objectp->mDrawable->getScale());
4958 z_axis_rot.scaleVec(objectp->mDrawable->getScale());
4959
4960 generateSilhouette(nodep, objectp->mDrawable->getPositionAgent() + x_axis_rot * 100.f);
4961
4962 S32 num_vertices = nodep->mSilhouetteVertices.size();
4963 if (num_vertices)
4964 {
4965 min_extents.mV[VY] = llmin(min_extents.mV[VY], nodep->mSilhouetteVertices[0] * y_axis_rot);
4966 max_extents.mV[VY] = llmax(max_extents.mV[VY], nodep->mSilhouetteVertices[0] * y_axis_rot);
4967
4968 min_extents.mV[VZ] = llmin(min_extents.mV[VZ], nodep->mSilhouetteVertices[0] * z_axis_rot);
4969 max_extents.mV[VZ] = llmax(min_extents.mV[VZ], nodep->mSilhouetteVertices[0] * z_axis_rot);
4970
4971 for (S32 vert = 1; vert < num_vertices; vert++)
4972 {
4973 F32 y_pos = nodep->mSilhouetteVertices[vert] * y_axis_rot;
4974 F32 z_pos = nodep->mSilhouetteVertices[vert] * z_axis_rot;
4975 min_extents.mV[VY] = llmin(y_pos, min_extents.mV[VY]);
4976 max_extents.mV[VY] = llmax(y_pos, max_extents.mV[VY]);
4977 min_extents.mV[VZ] = llmin(z_pos, min_extents.mV[VZ]);
4978 max_extents.mV[VZ] = llmax(z_pos, max_extents.mV[VZ]);
4979 }
4980 }
4981
4982 generateSilhouette(nodep, objectp->mDrawable->getPositionAgent() + y_axis_rot * 100.f);
4983
4984 num_vertices = nodep->mSilhouetteVertices.size();
4985 if (num_vertices)
4986 {
4987 min_extents.mV[VX] = llmin(min_extents.mV[VX], nodep->mSilhouetteVertices[0] * x_axis_rot);
4988 max_extents.mV[VX] = llmax(max_extents.mV[VX], nodep->mSilhouetteVertices[0] * x_axis_rot);
4989
4990 for (S32 vert = 1; vert < num_vertices; vert++)
4991 {
4992 F32 x_pos = nodep->mSilhouetteVertices[vert] * x_axis_rot;
4993 min_extents.mV[VX] = llmin(x_pos, min_extents.mV[VX]);
4994 max_extents.mV[VX] = llmax(x_pos, max_extents.mV[VX]);
4995 }
4996 }
4997
4998 generateSilhouette(nodep, gCamera->getOrigin());
4999}
5000
5001
5002// 4944//
5003// Utility classes 4945// Utility classes
5004// 4946//
@@ -6479,6 +6421,8 @@ LLViewerObject* LLObjectSelection::getFirstDeleteableObject(BOOL get_root)
6479 } 6421 }
6480 else 6422 else
6481 { 6423 {
6424 // We've avoided this path for a while. It may not work.
6425 llwarns << "!get_root code path may have bitrotted." << llendl;
6482 for(LLViewerObject* current = getFirstObject(); 6426 for(LLViewerObject* current = getFirstObject();
6483 current != NULL; 6427 current != NULL;
6484 current = getNextObject()) 6428 current = getNextObject())