summaryrefslogtreecommitdiff
path: root/indra/newview/llpolymorph.cpp
diff options
context:
space:
mode:
authorsimon@Simon-PC.lindenlab.com <simon@Simon-PC.lindenlab.com>2012-10-15 14:23:29 -0700
committersimon@Simon-PC.lindenlab.com <simon@Simon-PC.lindenlab.com>2012-10-15 14:23:29 -0700
commitd6e3b0445a49d0fb10ca9e6cb668c65984ce1866 (patch)
treee12511d8f64e0ec42c2d6abb4ed4efa5f7853a83 /indra/newview/llpolymorph.cpp
parent9b7bfcf594a8388eae087886c53ead164251c62e (diff)
parent1709952adbb3ad3ba4eb7d5be39c0c67c389c7c5 (diff)
Merge in viewer-development code and fix build
Diffstat (limited to 'indra/newview/llpolymorph.cpp')
-rw-r--r--indra/newview/llpolymorph.cpp62
1 files changed, 49 insertions, 13 deletions
diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp
index dea8868034..495fdc348c 100644
--- a/indra/newview/llpolymorph.cpp
+++ b/indra/newview/llpolymorph.cpp
@@ -75,9 +75,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
U32 size = sizeof(LLVector4a)*numVertices;
- mCoords = (LLVector4a*) ll_aligned_malloc_16(size);
- mNormals = (LLVector4a*) ll_aligned_malloc_16(size);
- mBinormals = (LLVector4a*) ll_aligned_malloc_16(size);
+ mCoords = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
+ mNormals = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
+ mBinormals = static_cast<LLVector4a*>( ll_aligned_malloc_16(size) );
mTexCoords = new LLVector2[numVertices];
mVertexIndices = new U32[numVertices];
@@ -91,18 +91,12 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
}
}
-
//-----------------------------------------------------------------------------
// ~LLPolyMorphData()
//-----------------------------------------------------------------------------
LLPolyMorphData::~LLPolyMorphData()
{
- ll_aligned_free_16(mCoords);
- ll_aligned_free_16(mNormals);
- ll_aligned_free_16(mBinormals);
-
- delete [] mTexCoords;
- delete [] mVertexIndices;
+ freeData();
}
//-----------------------------------------------------------------------------
@@ -122,14 +116,20 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
}
//-------------------------------------------------------------------------
+ // free any existing data
+ //-------------------------------------------------------------------------
+ freeData();
+
+ //-------------------------------------------------------------------------
// allocate vertices
//-------------------------------------------------------------------------
U32 size = sizeof(LLVector4a)*numVertices;
- mCoords = (LLVector4a*) ll_aligned_malloc_16(size);
- mNormals = (LLVector4a*) ll_aligned_malloc_16(size);
- mBinormals = (LLVector4a*) ll_aligned_malloc_16(size);
+ mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
+ mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
+ mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(size));
+
mTexCoords = new LLVector2[numVertices];
// Actually, we are allocating more space than we need for the skiplist
mVertexIndices = new U32[numVertices];
@@ -213,6 +213,42 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
}
//-----------------------------------------------------------------------------
+// freeData()
+//-----------------------------------------------------------------------------
+void LLPolyMorphData::freeData()
+{
+ if (mCoords != NULL)
+ {
+ ll_aligned_free_16(mCoords);
+ mCoords = NULL;
+ }
+
+ if (mNormals != NULL)
+ {
+ ll_aligned_free_16(mNormals);
+ mNormals = NULL;
+ }
+
+ if (mBinormals != NULL)
+ {
+ ll_aligned_free_16(mBinormals);
+ mBinormals = NULL;
+ }
+
+ if (mTexCoords != NULL)
+ {
+ delete [] mTexCoords;
+ mTexCoords = NULL;
+ }
+
+ if (mVertexIndices != NULL)
+ {
+ delete [] mVertexIndices;
+ mVertexIndices = NULL;
+ }
+}
+
+//-----------------------------------------------------------------------------
// LLPolyMorphTargetInfo()
//-----------------------------------------------------------------------------
LLPolyMorphTargetInfo::LLPolyMorphTargetInfo()