aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/newview/llglsandbox.cpp10
-rw-r--r--linden/indra/newview/llselectmgr.cpp35
-rw-r--r--linden/indra/newview/llviewercamera.cpp4
-rw-r--r--linden/indra/newview/llvograss.cpp91
-rw-r--r--linden/indra/newview/llvograss.h9
-rw-r--r--linden/indra/newview/llvotree.cpp125
-rw-r--r--linden/indra/newview/llvotree.h14
7 files changed, 279 insertions, 9 deletions
diff --git a/linden/indra/newview/llglsandbox.cpp b/linden/indra/newview/llglsandbox.cpp
index a487150..98c4d06 100644
--- a/linden/indra/newview/llglsandbox.cpp
+++ b/linden/indra/newview/llglsandbox.cpp
@@ -275,7 +275,11 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
275 virtual bool apply(LLViewerObject* vobjp) 275 virtual bool apply(LLViewerObject* vobjp)
276 { 276 {
277 LLDrawable* drawable = vobjp->mDrawable; 277 LLDrawable* drawable = vobjp->mDrawable;
278 if (!drawable || vobjp->getPCode() != LL_PCODE_VOLUME || vobjp->isAttachment()) 278 if (!drawable ||
279 ((vobjp->getPCode() != LL_PCODE_VOLUME) &&
280 (vobjp->getPCode() != LL_PCODE_LEGACY_TREE) &&
281 (vobjp->getPCode() != LL_PCODE_LEGACY_GRASS) )||
282 vobjp->isAttachment())
279 { 283 {
280 return true; 284 return true;
281 } 285 }
@@ -326,7 +330,9 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
326 LLViewerObject* vobjp = drawable->getVObj(); 330 LLViewerObject* vobjp = drawable->getVObj();
327 331
328 if (!drawable || !vobjp || 332 if (!drawable || !vobjp ||
329 vobjp->getPCode() != LL_PCODE_VOLUME || 333 ((vobjp->getPCode() != LL_PCODE_VOLUME) &&
334 (vobjp->getPCode() != LL_PCODE_LEGACY_TREE) &&
335 (vobjp->getPCode() != LL_PCODE_LEGACY_GRASS) )||
330 vobjp->isAttachment() || 336 vobjp->isAttachment() ||
331 (deselect && !vobjp->isSelected())) 337 (deselect && !vobjp->isSelected()))
332 { 338 {
diff --git a/linden/indra/newview/llselectmgr.cpp b/linden/indra/newview/llselectmgr.cpp
index 0d53e82..b0a6834 100644
--- a/linden/indra/newview/llselectmgr.cpp
+++ b/linden/indra/newview/llselectmgr.cpp
@@ -85,6 +85,8 @@
85#include "llviewerregion.h" 85#include "llviewerregion.h"
86#include "llviewerstats.h" 86#include "llviewerstats.h"
87#include "llvoavatar.h" 87#include "llvoavatar.h"
88#include "llvograss.h"
89#include "llvotree.h"
88#include "llvovolume.h" 90#include "llvovolume.h"
89#include "pipeline.h" 91#include "pipeline.h"
90 92
@@ -832,7 +834,10 @@ void LLSelectMgr::highlightObjectOnly(LLViewerObject* objectp)
832 return; 834 return;
833 } 835 }
834 836
835 if (objectp->getPCode() != LL_PCODE_VOLUME) 837 if ((objectp->getPCode() != LL_PCODE_VOLUME) &&
838 (objectp->getPCode() != LL_PCODE_LEGACY_TREE) &&
839 (objectp->getPCode() != LL_PCODE_LEGACY_GRASS))
840
836 { 841 {
837 return; 842 return;
838 } 843 }
@@ -880,7 +885,10 @@ void LLSelectMgr::highlightObjectAndFamily(const std::vector<LLViewerObject*>& o
880 { 885 {
881 continue; 886 continue;
882 } 887 }
883 if (object->getPCode() != LL_PCODE_VOLUME) 888
889 if ((object->getPCode() != LL_PCODE_VOLUME) &&
890 (object->getPCode() != LL_PCODE_LEGACY_TREE) &&
891 (object->getPCode() != LL_PCODE_LEGACY_GRASS))
884 { 892 {
885 continue; 893 continue;
886 } 894 }
@@ -900,7 +908,14 @@ void LLSelectMgr::highlightObjectAndFamily(const std::vector<LLViewerObject*>& o
900 908
901void LLSelectMgr::unhighlightObjectOnly(LLViewerObject* objectp) 909void LLSelectMgr::unhighlightObjectOnly(LLViewerObject* objectp)
902{ 910{
903 if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME)) 911 if (!objectp)
912 {
913 return;
914 }
915
916 if ((objectp->getPCode() != LL_PCODE_VOLUME) &&
917 (objectp->getPCode() != LL_PCODE_LEGACY_TREE) &&
918 (objectp->getPCode() != LL_PCODE_LEGACY_GRASS))
904 { 919 {
905 return; 920 return;
906 } 921 }
@@ -5020,6 +5035,14 @@ void LLSelectMgr::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_
5020 { 5035 {
5021 ((LLVOVolume*)objectp)->generateSilhouette(nodep, view_point); 5036 ((LLVOVolume*)objectp)->generateSilhouette(nodep, view_point);
5022 } 5037 }
5038 else if (objectp && objectp->getPCode() == LL_PCODE_LEGACY_GRASS)
5039 {
5040 ((LLVOGrass*)objectp)->generateSilhouette(nodep, view_point);
5041 }
5042 else if (objectp && objectp->getPCode() == LL_PCODE_LEGACY_TREE)
5043 {
5044 ((LLVOTree*)objectp)->generateSilhouette(nodep, view_point);
5045 }
5023} 5046}
5024 5047
5025// 5048//
@@ -5355,8 +5378,10 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
5355 glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix); 5378 glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix);
5356 } 5379 }
5357 5380
5358 LLVolume *volume = objectp->getVolume(); 5381 //LLVolume *volume = objectp->getVolume();
5359 if (volume) 5382 //if (volume)
5383 // we used to only call this for volumes. but let's render silhouettes for any node that has them.
5384 if (1)
5360 { 5385 {
5361 F32 silhouette_thickness; 5386 F32 silhouette_thickness;
5362 if (is_hud_object && gAgent.getAvatarObject()) 5387 if (is_hud_object && gAgent.getAvatarObject())
diff --git a/linden/indra/newview/llviewercamera.cpp b/linden/indra/newview/llviewercamera.cpp
index dade65f..16f6e57 100644
--- a/linden/indra/newview/llviewercamera.cpp
+++ b/linden/indra/newview/llviewercamera.cpp
@@ -743,7 +743,9 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)
743 LLVolume* volume = volumep->getVolume(); 743 LLVolume* volume = volumep->getVolume();
744 if (!volume) 744 if (!volume)
745 { 745 {
746 return FALSE; 746 BOOL inside = pointInFrustum(volumep->getRenderPosition());
747
748 return (inside > 0);
747 } 749 }
748 750
749 LLVOVolume* vo_volume = (LLVOVolume*) volumep; 751 LLVOVolume* vo_volume = (LLVOVolume*) volumep;
diff --git a/linden/indra/newview/llvograss.cpp b/linden/indra/newview/llvograss.cpp
index f738872..913ec33 100644
--- a/linden/indra/newview/llvograss.cpp
+++ b/linden/indra/newview/llvograss.cpp
@@ -48,6 +48,7 @@
48#include "llviewercamera.h" 48#include "llviewercamera.h"
49#include "llviewerimagelist.h" 49#include "llviewerimagelist.h"
50#include "llviewerregion.h" 50#include "llviewerregion.h"
51#include "llselectmgr.h"
51#include "pipeline.h" 52#include "pipeline.h"
52#include "llspatialpartition.h" 53#include "llspatialpartition.h"
53#include "llworld.h" 54#include "llworld.h"
@@ -721,3 +722,93 @@ BOOL LLVOGrass::lineSegmentIntersect(const LLVector3& start, const LLVector3& en
721 return ret; 722 return ret;
722} 723}
723 724
725void LLVOGrass::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
726 std::vector<LLVector3> &normals,
727 std::vector<S32> &segments,
728 const LLVector3& obj_cam_vec,
729 const LLMatrix4& mat,
730 const LLMatrix3& norm_mat)
731{
732 vertices.clear();
733 normals.clear();
734 segments.clear();
735
736 F32 width = sSpeciesTable[mSpecies]->mBladeSizeX;
737 F32 height = sSpeciesTable[mSpecies]->mBladeSizeY;
738
739 for (S32 i = 0; i < mNumBlades; i++)
740 {
741 F32 x = exp_x[i] * mScale.mV[VX];
742 F32 y = exp_y[i] * mScale.mV[VY];
743 F32 xf = rot_x[i] * GRASS_BLADE_BASE * width * w_mod[i];
744 F32 yf = rot_y[i] * GRASS_BLADE_BASE * width * w_mod[i];
745 F32 dzx = dz_x [i];
746 F32 dzy = dz_y [i];
747
748 F32 blade_height= GRASS_BLADE_HEIGHT * height * w_mod[i];
749
750 LLVector3 position1;
751
752 position1.mV[0] = mPosition.mV[VX] + x + xf;
753 position1.mV[1] = mPosition.mV[VY] + y + yf;
754 position1.mV[2] = mRegionp->getLand().resolveHeightRegion(position1);
755
756 LLVector3 position2 = position1;
757
758 position2.mV[0] += dzx;
759 position2.mV[1] += dzy;
760 position2.mV[2] += blade_height;
761
762 LLVector3 position3;
763
764 position3.mV[0] = mPosition.mV[VX] + x - xf;
765 position3.mV[1] = mPosition.mV[VY] + y - xf;
766 position3.mV[2] = mRegionp->getLand().resolveHeightRegion(position3);
767
768 LLVector3 position4 = position3;
769
770 position4.mV[0] += dzx;
771 position4.mV[1] += dzy;
772 position4.mV[2] += blade_height;
773
774
775 LLVector3 normal = (position1-position2) % (position2 - position3);
776 normal.normalize();
777
778 vertices.push_back(position1 + mRegionp->getOriginAgent());
779 normals.push_back(normal);
780 vertices.push_back(position2 + mRegionp->getOriginAgent());
781 normals.push_back(normal);
782 segments.push_back(vertices.size());
783
784 vertices.push_back(position2 + mRegionp->getOriginAgent());
785 normals.push_back(normal);
786 vertices.push_back(position4 + mRegionp->getOriginAgent());
787 normals.push_back(normal);
788 segments.push_back(vertices.size());
789
790 vertices.push_back(position4 + mRegionp->getOriginAgent());
791 normals.push_back(normal);
792 vertices.push_back(position3 + mRegionp->getOriginAgent());
793 normals.push_back(normal);
794 segments.push_back(vertices.size());
795
796 vertices.push_back(position3 + mRegionp->getOriginAgent());
797 normals.push_back(normal);
798 vertices.push_back(position1 + mRegionp->getOriginAgent());
799 normals.push_back(normal);
800 segments.push_back(vertices.size());
801 }
802}
803
804
805
806void LLVOGrass::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point)
807{
808 generateSilhouetteVertices(nodep->mSilhouetteVertices, nodep->mSilhouetteNormals,
809 nodep->mSilhouetteSegments,
810 LLVector3(0,0,0), LLMatrix4(), LLMatrix3());
811
812 nodep->mSilhouetteExists = TRUE;
813
814}
diff --git a/linden/indra/newview/llvograss.h b/linden/indra/newview/llvograss.h
index 25fa04c..c76ab93 100644
--- a/linden/indra/newview/llvograss.h
+++ b/linden/indra/newview/llvograss.h
@@ -37,6 +37,7 @@
37#include "lldarray.h" 37#include "lldarray.h"
38#include <map> 38#include <map>
39 39
40class LLSelectNode;
40class LLSurfacePatch; 41class LLSurfacePatch;
41class LLViewerImage; 42class LLViewerImage;
42 43
@@ -76,6 +77,8 @@ public:
76 /*virtual*/ BOOL updateLOD(); 77 /*virtual*/ BOOL updateLOD();
77 /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area 78 /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
78 79
80 void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point);
81
79 void plantBlades(); 82 void plantBlades();
80 83
81 /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. 84 /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
@@ -125,6 +128,12 @@ protected:
125 ~LLVOGrass(); 128 ~LLVOGrass();
126 129
127private: 130private:
131 void generateSilhouetteVertices(std::vector<LLVector3> &vertices,
132 std::vector<LLVector3> &normals,
133 std::vector<S32> &segments,
134 const LLVector3& view_vec,
135 const LLMatrix4& mat,
136 const LLMatrix3& norm_mat);
128 void updateSpecies(); 137 void updateSpecies();
129 F32 mLastHeight; // For cheap update hack 138 F32 mLastHeight; // For cheap update hack
130 S32 mNumBlades; 139 S32 mNumBlades;
diff --git a/linden/indra/newview/llvotree.cpp b/linden/indra/newview/llvotree.cpp
index 6a59253..8c6abdc 100644
--- a/linden/indra/newview/llvotree.cpp
+++ b/linden/indra/newview/llvotree.cpp
@@ -47,6 +47,7 @@
47#include "llagent.h" 47#include "llagent.h"
48#include "lldrawable.h" 48#include "lldrawable.h"
49#include "llface.h" 49#include "llface.h"
50#include "llselectmgr.h"
50#include "llviewercamera.h" 51#include "llviewercamera.h"
51#include "llviewerimagelist.h" 52#include "llviewerimagelist.h"
52#include "llviewerobjectlist.h" 53#include "llviewerobjectlist.h"
@@ -1327,3 +1328,127 @@ LLTreePartition::LLTreePartition()
1327 mLODPeriod = 1; 1328 mLODPeriod = 1;
1328} 1329}
1329 1330
1331
1332
1333void LLVOTree::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
1334 std::vector<LLVector3> &normals,
1335 std::vector<S32> &segments,
1336 const LLVector3& obj_cam_vec,
1337 const LLMatrix4& local_matrix,
1338 const LLMatrix3& normal_matrix)
1339{
1340 vertices.clear();
1341 normals.clear();
1342 segments.clear();
1343
1344 F32 height = mBillboardScale; // *mBillboardRatio * 0.5;
1345 F32 width = height * mTrunkAspect;
1346
1347 LLVector3 position1 = LLVector3(-width * 0.5,0,0) * local_matrix;
1348 LLVector3 position2 = LLVector3(-width * 0.5,0,height) * local_matrix;
1349 LLVector3 position3 = LLVector3(+width * 0.5,0,height) * local_matrix;
1350 LLVector3 position4 = LLVector3(+width * 0.5,0,0) * local_matrix;
1351
1352 LLVector3 position5 = LLVector3(0,-width * 0.5,0) * local_matrix;
1353 LLVector3 position6 = LLVector3(0,-width * 0.5,height) * local_matrix;
1354 LLVector3 position7 = LLVector3(0,+width * 0.5,height) * local_matrix;
1355 LLVector3 position8 = LLVector3(0,+width * 0.5,0) * local_matrix;
1356
1357
1358 LLVector3 normal = (position1-position2) % (position2-position3);
1359 normal.normalize();
1360
1361 vertices.push_back(position1);
1362 normals.push_back(normal);
1363 vertices.push_back(position2);
1364 normals.push_back(normal);
1365 segments.push_back(vertices.size());
1366
1367 vertices.push_back(position2);
1368 normals.push_back(normal);
1369 vertices.push_back(position3);
1370 normals.push_back(normal);
1371 segments.push_back(vertices.size());
1372
1373 vertices.push_back(position3);
1374 normals.push_back(normal);
1375 vertices.push_back(position4);
1376 normals.push_back(normal);
1377 segments.push_back(vertices.size());
1378
1379 vertices.push_back(position4);
1380 normals.push_back(normal);
1381 vertices.push_back(position1);
1382 normals.push_back(normal);
1383 segments.push_back(vertices.size());
1384
1385 normal = (position5-position6) % (position6-position7);
1386 normal.normalize();
1387
1388 vertices.push_back(position5);
1389 normals.push_back(normal);
1390 vertices.push_back(position6);
1391 normals.push_back(normal);
1392 segments.push_back(vertices.size());
1393
1394 vertices.push_back(position6);
1395 normals.push_back(normal);
1396 vertices.push_back(position7);
1397 normals.push_back(normal);
1398 segments.push_back(vertices.size());
1399
1400 vertices.push_back(position7);
1401 normals.push_back(normal);
1402 vertices.push_back(position8);
1403 normals.push_back(normal);
1404 segments.push_back(vertices.size());
1405
1406 vertices.push_back(position8);
1407 normals.push_back(normal);
1408 vertices.push_back(position5);
1409 normals.push_back(normal);
1410 segments.push_back(vertices.size());
1411
1412}
1413
1414
1415void LLVOTree::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point)
1416{
1417 LLVector3 position;
1418 LLQuaternion rotation;
1419
1420 if (mDrawable->isActive())
1421 {
1422 if (mDrawable->isSpatialRoot())
1423 {
1424 position = LLVector3();
1425 rotation = LLQuaternion();
1426 }
1427 else
1428 {
1429 position = mDrawable->getPosition();
1430 rotation = mDrawable->getRotation();
1431 }
1432 }
1433 else
1434 {
1435 position = getPosition() + getRegion()->getOriginAgent();;
1436 rotation = getRotation();
1437 }
1438
1439 // trees have bizzare scaling rules... because it's cool to make needless exceptions
1440 // PS: the trees are the last remaining tidbit of Philip's code. take a look sometime.
1441 F32 radius = getScale().length() * 0.05f;
1442 LLVector3 scale = LLVector3(1,1,1) * radius;
1443
1444 // compose final matrix
1445 LLMatrix4 local_matrix;
1446 local_matrix.initAll(scale, rotation, position);
1447
1448
1449 generateSilhouetteVertices(nodep->mSilhouetteVertices, nodep->mSilhouetteNormals,
1450 nodep->mSilhouetteSegments,
1451 LLVector3(0,0,0), local_matrix, LLMatrix3());
1452
1453 nodep->mSilhouetteExists = TRUE;
1454}
diff --git a/linden/indra/newview/llvotree.h b/linden/indra/newview/llvotree.h
index 855c612..57116cc 100644
--- a/linden/indra/newview/llvotree.h
+++ b/linden/indra/newview/llvotree.h
@@ -39,7 +39,7 @@
39 39
40class LLFace; 40class LLFace;
41class LLDrawPool; 41class LLDrawPool;
42 42class LLSelectNode;
43 43
44class LLVOTree : public LLViewerObject 44class LLVOTree : public LLViewerObject
45{ 45{
@@ -124,6 +124,9 @@ public:
124 LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point 124 LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point
125 ); 125 );
126 126
127 void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point);
128
129
127 static S32 sMaxTreeSpecies; 130 static S32 sMaxTreeSpecies;
128 131
129 struct TreeSpeciesData 132 struct TreeSpeciesData
@@ -200,6 +203,15 @@ protected:
200 static S32 sLODVertexCount[4]; 203 static S32 sLODVertexCount[4];
201 static S32 sLODSlices[4]; 204 static S32 sLODSlices[4];
202 static F32 sLODAngles[4]; 205 static F32 sLODAngles[4];
206
207private:
208 void generateSilhouetteVertices(std::vector<LLVector3> &vertices,
209 std::vector<LLVector3> &normals,
210 std::vector<S32> &segments,
211 const LLVector3& view_vec,
212 const LLMatrix4& mat,
213 const LLMatrix3& norm_mat);
214
203}; 215};
204 216
205#endif 217#endif