From 3c4f012480459e44aee2c6d2a46ae1466bdd8d2d Mon Sep 17 00:00:00 2001 From: Shyotl Date: Fri, 2 Sep 2011 06:56:32 -0500 Subject: [PATCH] LLVOVolume::lineSegmentIntersect crashfix. http://hg.secondlife.com/mesh-development/changeset/741175a108d1 --- indra/llmath/llvolume.cpp | 5 +++-- indra/newview/llvovolume.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index f3e5cd34b..abe1cd402 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2414,7 +2414,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) LLSD mdl; if (!unzip_llsd(mdl, is, size)) { - llwarns << "not a valid mesh asset!" << llendl; + LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << llendl; return false; } @@ -2740,9 +2740,10 @@ void LLVolume::cacheOptimize() S32 LLVolume::getNumFaces() const { - return (S32)mProfilep->mFaces.size(); + return mIsMeshAssetLoaded ? getNumVolumeFaces() : (S32)mProfilep->mFaces.size(); } + void LLVolume::createVolumeFaces() { LLMemType m1(LLMemType::MTYPE_VOLUME); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 390d29139..1fb7d82fc 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1440,11 +1440,16 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) compiled = TRUE; sNumLODChanges += new_num_faces ; + if((S32)getNumTEs() != getVolume()->getNumFaces()) + { + setNumTEs(getVolume()->getNumFaces()); //mesh loading may change number of faces. + } + drawable->setState(LLDrawable::REBUILD_VOLUME); // for face->genVolumeTriangles() { LLFastTimer t(LLFastTimer::FTM_GEN_TRIANGLES); - if (new_num_faces != old_num_faces) + if (new_num_faces != old_num_faces || mNumFaces != (S32)getNumTEs()) { regenFaces(); }