diff options
author | Dave Parks <davep@lindenlab.com> | 2010-05-22 12:37:53 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-05-22 12:37:53 -0500 |
commit | d7cab99ba74b214c557d9b5e02a7800b6a25c109 (patch) | |
tree | 67ed59653e8c4e8e8a3bba2e790c649b47f9d576 /indra/llmath/llvolume.cpp | |
parent | 4d57cb3c0975ff0bcea0d6fb3498f2d90962ff16 (diff) |
Fix for a couple dumb mistakes.
Diffstat (limited to 'indra/llmath/llvolume.cpp')
-rw-r--r-- | indra/llmath/llvolume.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 01fe2be371..88969af4bd 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5206,7 +5206,7 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build) if (!partial_build) { - resizeIndices(grid_size*6); + resizeIndices(grid_size*grid_size*6); U16* out = mIndices; @@ -5689,12 +5689,21 @@ void LLVolumeFace::resizeVertices(S32 num_verts) mBinormals = NULL; - mPositions = (F32*) _mm_malloc(num_verts*16, 16); - mNormals = (F32*) _mm_malloc(num_verts*16, 16); + if (num_verts) + { + mPositions = (F32*) _mm_malloc(num_verts*16, 16); + mNormals = (F32*) _mm_malloc(num_verts*16, 16); - //pad texture coordinate block end to allow for QWORD reads - S32 size = ((num_verts*8) + 0xF) & ~0xF; - mTexCoords = (F32*) _mm_malloc(size, 16); + //pad texture coordinate block end to allow for QWORD reads + S32 size = ((num_verts*8) + 0xF) & ~0xF; + mTexCoords = (F32*) _mm_malloc(size, 16); + } + else + { + mPositions = NULL; + mNormals = NULL; + mTexCoords = NULL; + } mNumVertices = num_verts; } @@ -5710,10 +5719,17 @@ void LLVolumeFace::resizeIndices(S32 num_indices) { _mm_free(mIndices); - //pad index block end to allow for QWORD reads - S32 size = ((num_indices*2) + 0xF) & ~0xF; - - mIndices = (U16*) _mm_malloc(size,16); + if (num_indices) + { + //pad index block end to allow for QWORD reads + S32 size = ((num_indices*2) + 0xF) & ~0xF; + + mIndices = (U16*) _mm_malloc(size,16); + } + else + { + mIndices = NULL; + } mNumIndices = num_indices; } @@ -5954,7 +5970,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) LLVector3& face_max = mExtents[1]; mCenter.clearVec(); - face_min = face_max = LLVector3((F32*) &(pos[i].mQ)); + face_min = face_max = LLVector3((F32*) &(pos[0].mQ)); for (U32 i = 1; i < mNumVertices; ++i) { |