From 8c32e3bf29337e330a313d0e4865ebd03ad9ca50 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 24 May 2010 14:03:10 -0500 Subject: Fix for bad indexes on cube faces. Extra validation on vertex buffers. --- indra/llmath/llvolume.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 88969af4bd..31544016db 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -4173,7 +4173,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, for (S32 i = start_face; i <= end_face; i++) { - const LLVolumeFace &face = getVolumeFace((U32)i); + LLVolumeFace &face = mVolumeFaces[i]; LLVector3 box_center = (face.mExtents[0] + face.mExtents[1]) / 2.f; LLVector3 box_size = face.mExtents[1] - face.mExtents[0]; @@ -4235,6 +4235,10 @@ S32 LLVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, if (bi_normal != NULL) { + if (!face.mBinormals) + { + face.createBinormals(); + } LLVector4* binormal = (LLVector4*) face.mBinormals; if (binormal) { @@ -5174,7 +5178,6 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build) LLVector4a* binorm = (LLVector4a*) mBinormals; LLVector2* tc = (LLVector2*) mTexCoords; - S32 vtop = mNumVertices; for(int gx = 0;gx=0;i--) { - *out++ = (vtop+(gy*(grid_size+1))+gx+idxs[i]); + *out++ = ((gy*(grid_size+1))+gx+idxs[i]); } } else { for(S32 i=0;i<6;i++) { - *out++ = (vtop+(gy*(grid_size+1))+gx+idxs[i]); + *out++ = ((gy*(grid_size+1))+gx+idxs[i]); } } } -- cgit v1.2.3