aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvotree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llvotree.cpp')
-rw-r--r--linden/indra/newview/llvotree.cpp195
1 files changed, 98 insertions, 97 deletions
diff --git a/linden/indra/newview/llvotree.cpp b/linden/indra/newview/llvotree.cpp
index af68a7a..4630127 100644
--- a/linden/indra/newview/llvotree.cpp
+++ b/linden/indra/newview/llvotree.cpp
@@ -44,7 +44,6 @@
44#include "object_flags.h" 44#include "object_flags.h"
45 45
46#include "llagent.h" 46#include "llagent.h"
47#include "llcylinder.h"
48#include "lldrawable.h" 47#include "lldrawable.h"
49#include "llface.h" 48#include "llface.h"
50#include "llviewercamera.h" 49#include "llviewercamera.h"
@@ -54,11 +53,17 @@
54#include "llworld.h" 53#include "llworld.h"
55#include "noise.h" 54#include "noise.h"
56#include "pipeline.h" 55#include "pipeline.h"
56#include "llspatialpartition.h"
57#include "llviewerwindow.h" 57#include "llviewerwindow.h"
58 58
59extern LLPipeline gPipeline; 59extern LLPipeline gPipeline;
60 60
61LLGLuint mLeafDList; 61const S32 MAX_SLICES = 32;
62const F32 LEAF_LEFT = 0.52f;
63const F32 LEAF_RIGHT = 0.98f;
64const F32 LEAF_TOP = 1.0f;
65const F32 LEAF_BOTTOM = 0.52f;
66const F32 LEAF_WIDTH = 1.f;
62 67
63S32 LLVOTree::sLODVertexOffset[4]; 68S32 LLVOTree::sLODVertexOffset[4];
64S32 LLVOTree::sLODVertexCount[4]; 69S32 LLVOTree::sLODVertexCount[4];
@@ -310,7 +315,6 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys,
310 if (mTreeImagep) 315 if (mTreeImagep)
311 { 316 {
312 mTreeImagep->bindTexture(0); 317 mTreeImagep->bindTexture(0);
313 mTreeImagep->setClamp(TRUE, TRUE);
314 } 318 }
315 mBranchLength = sSpeciesTable[mSpecies]->mBranchLength; 319 mBranchLength = sSpeciesTable[mSpecies]->mBranchLength;
316 mTrunkLength = sSpeciesTable[mSpecies]->mTrunkLength; 320 mTrunkLength = sSpeciesTable[mSpecies]->mTrunkLength;
@@ -447,16 +451,9 @@ const S32 LEAF_VERTICES = 16;
447BOOL LLVOTree::updateGeometry(LLDrawable *drawable) 451BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
448{ 452{
449 LLFastTimer ftm(LLFastTimer::FTM_UPDATE_TREE); 453 LLFastTimer ftm(LLFastTimer::FTM_UPDATE_TREE);
454 const F32 SRR3 = 0.577350269f; // sqrt(1/3)
455 const F32 SRR2 = 0.707106781f; // sqrt(1/2)
450 U32 i, j; 456 U32 i, j;
451 const S32 MAX_SLICES = 32;
452
453 const F32 LEAF_LEFT = 0.52f;
454 const F32 LEAF_RIGHT = 0.98f;
455 const F32 LEAF_TOP = 1.0f;
456 const F32 LEAF_BOTTOM = 0.52f;
457
458 const F32 LEAF_WIDTH = 1.f;
459
460 457
461 U32 slices = MAX_SLICES; 458 U32 slices = MAX_SLICES;
462 459
@@ -483,7 +480,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
483 LLStrider<LLVector3> vertices; 480 LLStrider<LLVector3> vertices;
484 LLStrider<LLVector3> normals; 481 LLStrider<LLVector3> normals;
485 LLStrider<LLVector2> tex_coords; 482 LLStrider<LLVector2> tex_coords;
486 LLStrider<U32> indicesp; 483 LLStrider<U16> indicesp;
487 484
488 face->setSize(max_vertices, max_indices); 485 face->setSize(max_vertices, max_indices);
489 486
@@ -499,23 +496,22 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
499 S32 index_count = 0; 496 S32 index_count = 0;
500 497
501 // First leaf 498 // First leaf
502 for (i = 0; i < 4; i++) 499 *(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
503 {
504 *(normals++) = LLVector3(0.f, 0.f, 1.f);
505 }
506
507 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM); 500 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
508 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f); 501 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
509 vertex_count++; 502 vertex_count++;
510 503
504 *(normals++) = LLVector3(SRR3, -SRR3, SRR3);
511 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP); 505 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
512 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f); 506 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
513 vertex_count++; 507 vertex_count++;
514 508
515 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP); 509 *(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
510 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
516 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f); 511 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
517 vertex_count++; 512 vertex_count++;
518 513
514 *(normals++) = LLVector3(SRR2, -SRR2, 0.f);
519 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM); 515 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
520 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f); 516 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
521 vertex_count++; 517 vertex_count++;
@@ -536,26 +532,22 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
536 index_count++; 532 index_count++;
537 533
538 // Same leaf, inverse winding/normals 534 // Same leaf, inverse winding/normals
539 for (i = 0; i < 4; i++) 535 *(normals++) = LLVector3(-SRR2, SRR2, 0.f);
540 {
541 *(normals++) = LLVector3(0.f, 0.f, 1.f);
542 }
543
544 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM); 536 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
545 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f); 537 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
546 vertex_count++; 538 vertex_count++;
547 539
548 //*(tex_coords++) = LLVector2(1.f, 1.0f); 540 *(normals++) = LLVector3(SRR3, SRR3, SRR3);
549 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP); 541 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
550 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f); 542 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
551 vertex_count++; 543 vertex_count++;
552 544
553 //*(tex_coords++) = LLVector2(0.52f, 1.0f); 545 *(normals++) = LLVector3(-SRR3, SRR3, SRR3);
554 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP); 546 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
555 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f); 547 *(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
556 vertex_count++; 548 vertex_count++;
557 549
558 //*(tex_coords++) = LLVector2(1.f, 0.52f); 550 *(normals++) = LLVector3(SRR2, SRR2, 0.f);
559 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM); 551 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
560 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f); 552 *(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
561 vertex_count++; 553 vertex_count++;
@@ -575,23 +567,23 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
575 index_count++; 567 index_count++;
576 568
577 569
578 for (i = 0; i < 4; i++) 570 // next leaf
579 { 571 *(normals++) = LLVector3(SRR2, -SRR2, 0.f);
580 *(normals++) = LLVector3(0.f, 0.f, 1.f);
581 }
582
583 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM); 572 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
584 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f); 573 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
585 vertex_count++; 574 vertex_count++;
586 575
576 *(normals++) = LLVector3(SRR3, SRR3, SRR3);
587 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP); 577 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
588 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f); 578 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
589 vertex_count++; 579 vertex_count++;
590 580
591 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP); 581 *(normals++) = LLVector3(SRR3, -SRR3, SRR3);
582 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
592 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f); 583 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
593 vertex_count++; 584 vertex_count++;
594 585
586 *(normals++) = LLVector3(SRR2, SRR2, 0.f);
595 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM); 587 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
596 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f); 588 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
597 vertex_count++; 589 vertex_count++;
@@ -610,28 +602,28 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
610 *(indicesp++) = 9; 602 *(indicesp++) = 9;
611 index_count++; 603 index_count++;
612 604
613 for (i = 0; i < 4; i++)
614 {
615 *(normals++) = LLVector3(0.f, 0.f, 1.f);
616 }
617 605
606 // other side of same leaf
607 *(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
618 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM); 608 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
619 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f); 609 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
620 vertex_count++; 610 vertex_count++;
621 611
612 *(normals++) = LLVector3(-SRR3, SRR3, SRR3);
622 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP); 613 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
623 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f); 614 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
624 vertex_count++; 615 vertex_count++;
625 616
626 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP); 617 *(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
618 *(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
627 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f); 619 *(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
628 vertex_count++; 620 vertex_count++;
629 621
622 *(normals++) = LLVector3(-SRR2, SRR2, 0.f);
630 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM); 623 *(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
631 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f); 624 *(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
632 vertex_count++; 625 vertex_count++;
633 626
634
635 *(indicesp++) = 12; 627 *(indicesp++) = 12;
636 index_count++; 628 index_count++;
637 *(indicesp++) = 14; 629 *(indicesp++) = 14;
@@ -786,13 +778,14 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
786 slices /= 2; 778 slices /= 2;
787 } 779 }
788 780
781 face->mVertexBuffer->setBuffer(0);
789 llassert(vertex_count == max_vertices); 782 llassert(vertex_count == max_vertices);
790 llassert(index_count == max_indices); 783 llassert(index_count == max_indices);
791 784
792 return TRUE; 785 return TRUE;
793} 786}
794 787
795U32 LLVOTree::drawBranchPipeline(U32* indicesp, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 scale, F32 twist, F32 droop, F32 branches, F32 alpha) 788U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 scale, F32 twist, F32 droop, F32 branches, F32 alpha)
796{ 789{
797 U32 ret = 0; 790 U32 ret = 0;
798 // 791 //
@@ -810,7 +803,7 @@ U32 LLVOTree::drawBranchPipeline(U32* indicesp, S32 trunk_LOD, S32 stop_level, U
810 803
811 constant_twist = 360.f/branches; 804 constant_twist = 360.f/branches;
812 805
813 if (stop_level >= 0) 806 if (!LLPipeline::sReflectionRender && stop_level >= 0)
814 { 807 {
815 // 808 //
816 // Draw the tree using recursion 809 // Draw the tree using recursion
@@ -820,39 +813,46 @@ U32 LLVOTree::drawBranchPipeline(U32* indicesp, S32 trunk_LOD, S32 stop_level, U
820 { 813 {
821 llassert(sLODIndexCount[trunk_LOD] > 0); 814 llassert(sLODIndexCount[trunk_LOD] > 0);
822 width = scale * length * aspect; 815 width = scale * length * aspect;
823 glPushMatrix(); 816 LLMatrix4 scale_mat;
824 glScalef(width,width,scale * length); 817 scale_mat.mMatrix[0][0] = width;
825 glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_INT, indicesp + sLODIndexOffset[trunk_LOD]); 818 scale_mat.mMatrix[1][1] = width;
826 /*glDrawRangeElements(GL_TRIANGLES, 819 scale_mat.mMatrix[2][2] = scale*length;
827 sLODVertexOffset[trunk_LOD], 820 scale_mat *= matrix;
828 sLODVertexOffset[trunk_LOD] + sLODVertexCount[trunk_LOD]-1, 821
829 sLODIndexCount[trunk_LOD], 822 glLoadMatrixf((F32*) scale_mat.mMatrix);
830 GL_UNSIGNED_INT, 823 glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_SHORT, indicesp + sLODIndexOffset[trunk_LOD]);
831 indicesp + sLODIndexOffset[trunk_LOD]);*/ 824
832 stop_glerror(); 825 stop_glerror();
833 ret += sLODIndexCount[trunk_LOD]; 826 ret += sLODIndexCount[trunk_LOD];
834 glPopMatrix();
835 } 827 }
836 828
837 // Recurse to create more branches 829 // Recurse to create more branches
838 for (S32 i=0; i < (S32)branches; i++) 830 for (S32 i=0; i < (S32)branches; i++)
839 { 831 {
840 glPushMatrix(); 832 LLMatrix4 trans_mat;
841 glTranslatef(0.f, 0.f, scale * length); 833 trans_mat.setTranslation(0,0,scale*length);
842 glRotatef((constant_twist + ((i%2==0)?twist:-twist))*i, 0.f, 0.f, 1.f); 834 trans_mat *= matrix;
843 glRotatef(droop, 0.f, 1.f, 0.f); 835
844 glRotatef(20.f, 0.f, 0.f, 1.f); // rotate 20deg about axis of new branch to add some random variation 836 LLQuaternion rot =
845 ret += drawBranchPipeline(indicesp, trunk_LOD, stop_level, depth - 1, 0, scale*mScaleStep, twist, droop, branches, alpha); 837 LLQuaternion(20.f*DEG_TO_RAD, LLVector4(0.f, 0.f, 1.f)) *
846 glPopMatrix(); 838 LLQuaternion(droop*DEG_TO_RAD, LLVector4(0.f, 1.f, 0.f)) *
839 LLQuaternion(((constant_twist + ((i%2==0)?twist:-twist))*i)*DEG_TO_RAD, LLVector4(0.f, 0.f, 1.f));
840
841 LLMatrix4 rot_mat(rot);
842 rot_mat *= trans_mat;
843
844 ret += drawBranchPipeline(rot_mat, indicesp, trunk_LOD, stop_level, depth - 1, 0, scale*mScaleStep, twist, droop, branches, alpha);
847 } 845 }
848 // Recurse to continue trunk 846 // Recurse to continue trunk
849 if (trunk_depth) 847 if (trunk_depth)
850 { 848 {
851 glPushMatrix(); 849 LLMatrix4 trans_mat;
852 glTranslatef(0.f, 0.f, scale * length); 850 trans_mat.setTranslation(0,0,scale*length);
853 glRotatef(70.5f, 0.f, 0.f, 1.f); // rotate a bit around Z when ascending 851 trans_mat *= matrix;
854 ret += drawBranchPipeline(indicesp, trunk_LOD, stop_level, depth, trunk_depth-1, scale*mScaleStep, twist, droop, branches, alpha); 852
855 glPopMatrix(); 853 LLMatrix4 rot_mat(70.5f*DEG_TO_RAD, LLVector4(0,0,1));
854 rot_mat *= trans_mat; // rotate a bit around Z when ascending
855 ret += drawBranchPipeline(rot_mat, indicesp, trunk_LOD, stop_level, depth, trunk_depth-1, scale*mScaleStep, twist, droop, branches, alpha);
856 } 856 }
857 } 857 }
858 else 858 else
@@ -861,21 +861,19 @@ U32 LLVOTree::drawBranchPipeline(U32* indicesp, S32 trunk_LOD, S32 stop_level, U
861 // Draw leaves as two 90 deg crossed quads with leaf textures 861 // Draw leaves as two 90 deg crossed quads with leaf textures
862 // 862 //
863 { 863 {
864 glPushMatrix(); 864 LLMatrix4 scale_mat;
865 //glRotatef(llFrand(50.0), llFrand(1.0), llFrand(1.0), llFrand(1.0); 865 scale_mat.mMatrix[0][0] =
866 //width = scale * (TREE_BRANCH_ASPECT + TREE_LEAF_ASPECT); 866 scale_mat.mMatrix[1][1] =
867 glScalef(scale*mLeafScale, scale*mLeafScale, scale*mLeafScale); 867 scale_mat.mMatrix[2][2] = scale*mLeafScale;
868 //glScalef(1.5f*width*mLeafScale,1,1.5f*scale*mLeafScale); 868
869 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_INT, indicesp); 869 scale_mat *= matrix;
870 /*glDrawRangeElements(GL_TRIANGLES, 870
871 0, 871
872 LEAF_VERTICES-1, 872 glLoadMatrixf((F32*) scale_mat.mMatrix);
873 LEAF_INDICES, 873 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
874 GL_UNSIGNED_INT, 874
875 indicesp);*/
876 stop_glerror(); 875 stop_glerror();
877 ret += LEAF_INDICES; 876 ret += LEAF_INDICES;
878 glPopMatrix();
879 } 877 }
880 } 878 }
881 } 879 }
@@ -885,26 +883,25 @@ U32 LLVOTree::drawBranchPipeline(U32* indicesp, S32 trunk_LOD, S32 stop_level, U
885 // Draw the tree as a single billboard texture 883 // Draw the tree as a single billboard texture
886 // 884 //
887 885
886 LLMatrix4 scale_mat;
887 scale_mat.mMatrix[0][0] =
888 scale_mat.mMatrix[1][1] =
889 scale_mat.mMatrix[2][2] = mBillboardScale*mBillboardRatio;
890
891 scale_mat *= matrix;
892
888 glMatrixMode(GL_TEXTURE); 893 glMatrixMode(GL_TEXTURE);
889 glPushMatrix();
890 glTranslatef(0.0, -0.5, 0.0); 894 glTranslatef(0.0, -0.5, 0.0);
891 glMatrixMode(GL_MODELVIEW); 895 glMatrixMode(GL_MODELVIEW);
892 { 896
893 glPushMatrix(); 897 glLoadMatrixf((F32*) scale_mat.mMatrix);
894 glScalef(mBillboardScale*mBillboardRatio, mBillboardScale*mBillboardRatio, mBillboardScale); 898 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
895 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_INT, indicesp); 899
896/* glDrawRangeElements(GL_TRIANGLES, 900 stop_glerror();
897 0, 901 ret += LEAF_INDICES;
898 LEAF_VERTICES-1, 902
899 LEAF_INDICES,
900 GL_UNSIGNED_INT,
901 indicesp);*/
902 stop_glerror();
903 ret += LEAF_INDICES;
904 glPopMatrix();
905 }
906 glMatrixMode(GL_TEXTURE); 903 glMatrixMode(GL_TEXTURE);
907 glPopMatrix(); 904 glLoadIdentity();
908 glMatrixMode(GL_MODELVIEW); 905 glMatrixMode(GL_MODELVIEW);
909 } 906 }
910 907
@@ -923,18 +920,22 @@ void LLVOTree::updateRadius()
923 920
924void LLVOTree::updateSpatialExtents(LLVector3& newMin, LLVector3& newMax) 921void LLVOTree::updateSpatialExtents(LLVector3& newMin, LLVector3& newMax)
925{ 922{
923 F32 radius = getScale().magVec()*0.05f;
926 LLVector3 center = getRenderPosition(); 924 LLVector3 center = getRenderPosition();
927 LLVector3 size = getScale();
928 center.mV[2] += size.mV[2];
929 925
926 F32 sz = mBillboardScale*mBillboardRatio*radius*0.5f;
927 LLVector3 size(sz,sz,sz);
928
929 center += LLVector3(0, 0, size.mV[2]) * getRotation();
930
930 newMin.setVec(center-size); 931 newMin.setVec(center-size);
931 newMax.setVec(center+size); 932 newMax.setVec(center+size);
932 mDrawable->setPositionGroup((newMin + newMax) * 0.5f); 933 mDrawable->setPositionGroup(center);
933} 934}
934 935
935U32 LLVOTree::getPartitionType() const 936U32 LLVOTree::getPartitionType() const
936{ 937{
937 return LLPipeline::PARTITION_TREE; 938 return LLViewerRegion::PARTITION_TREE;
938} 939}
939 940
940LLTreePartition::LLTreePartition() 941LLTreePartition::LLTreePartition()
@@ -942,7 +943,7 @@ LLTreePartition::LLTreePartition()
942{ 943{
943 mRenderByGroup = FALSE; 944 mRenderByGroup = FALSE;
944 mDrawableType = LLPipeline::RENDER_TYPE_TREE; 945 mDrawableType = LLPipeline::RENDER_TYPE_TREE;
945 mPartitionType = LLPipeline::PARTITION_TREE; 946 mPartitionType = LLViewerRegion::PARTITION_TREE;
946 mSlopRatio = 0.f; 947 mSlopRatio = 0.f;
947 mLODPeriod = 1; 948 mLODPeriod = 1;
948} 949}