diff options
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/llvolume.cpp | 17 | ||||
-rw-r--r-- | indra/llmath/llvolume.h | 4 | ||||
-rw-r--r-- | indra/llmath/llvolumeoctree.cpp | 8 |
3 files changed, 18 insertions, 11 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 4798197921..07339f7526 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2569,14 +2569,13 @@ void LLVolume::makeTetrahedron() mIsTetrahedron = TRUE; } -void LLVolume::copyVolumeFaces(LLVolume* volume) +void LLVolume::copyVolumeFaces(const LLVolume* volume) { mVolumeFaces = volume->mVolumeFaces; mSculptLevel = 0; mIsTetrahedron = FALSE; } - S32 LLVolume::getNumFaces() const { #if LL_MESH_ENABLED @@ -5462,12 +5461,17 @@ void LLVolumeFace::optimize(F32 angle_cutoff) } -void LLVolumeFace::createOctree() +void LLVolumeFace::createOctree(F32 scaler) { + if (mOctree) + { + return; + } + LLVector4a center; LLVector4a size; center.splat(0.f); - size.splat(1.f); + size.splat(0.5f); mOctree = new LLOctreeRoot<LLVolumeTriangle>(center, size, NULL); new LLVolumeOctreeListener(mOctree); @@ -5511,12 +5515,15 @@ void LLVolumeFace::createOctree() LLVector4a size; size.setSub(max,min); - tri->mRadius = size.getLength3().getF32() * 0.5f; + tri->mRadius = size.getLength3().getF32() * scaler; //insert mOctree->insert(tri); } + //remove unneeded octree layers + while (!mOctree->balance()) { } + //calculate AABB for each node LLVolumeOctreeRebound rebound(this); rebound.traverse(mOctree); diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index af28337f57..ff5e3d9dfa 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -882,7 +882,7 @@ public: }; void optimize(F32 angle_cutoff = 2.f); - void createOctree(); + void createOctree(F32 scaler = 0.25f); enum { @@ -1044,7 +1044,7 @@ public: LLVector3 mLODScaleBias; // vector for biasing LOD based on scale void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level); - void copyVolumeFaces(LLVolume* volume); + void copyVolumeFaces(const LLVolume* volume); private: void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type); diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 12fe90f35d..cb6211f63c 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -223,14 +223,14 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch) test_min.setSub(center, size); test_max.setAdd(center, size); - if (!test_min.equals3(min) || - !test_max.equals3(max)) + if (!test_min.equals3(min, 0.001f) || + !test_max.equals3(max, 0.001f)) { llerrs << "Bad bounding box data found." << llendl; } - test_min.sub(LLVector4a::getEpsilon()); - test_max.add(LLVector4a::getEpsilon()); + test_min.sub(LLVector4a(0.001f)); + test_max.add(LLVector4a(0.001f)); for (U32 i = 0; i < branch->getChildCount(); ++i) { |