diff options
author | McCabe Maxsted | 2010-11-05 19:38:17 -0700 |
---|---|---|
committer | McCabe Maxsted | 2010-11-05 19:38:17 -0700 |
commit | c84c7fa1386665190f9043344d4849fade9c03a1 (patch) | |
tree | 83f567443a7f7458136cd89d92fc6f7851a5885b /linden/indra/newview/llvotree.cpp | |
parent | Merge remote branch 'thickbrick/weekly' into weekly (diff) | |
download | meta-impy-c84c7fa1386665190f9043344d4849fade9c03a1.zip meta-impy-c84c7fa1386665190f9043344d4849fade9c03a1.tar.gz meta-impy-c84c7fa1386665190f9043344d4849fade9c03a1.tar.bz2 meta-impy-c84c7fa1386665190f9043344d4849fade9c03a1.tar.xz |
Applied patch by Qarl Fizz to allow drag selection on plants. See http://www.qarl.com/qLab/?p=67
Diffstat (limited to 'linden/indra/newview/llvotree.cpp')
-rw-r--r-- | linden/indra/newview/llvotree.cpp | 125 |
1 files changed, 125 insertions, 0 deletions
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 | |||
1333 | void 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 | |||
1415 | void 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 | } | ||