summaryrefslogtreecommitdiff
path: root/indra/llappearance/llpolymorph.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2012-11-28 23:46:06 +0000
committerDon Kjer <don@lindenlab.com>2012-11-28 23:46:06 +0000
commit96ef49df75c0248e4843f9a5b53f010b819d59f3 (patch)
tree9f542fae939073bbb39464500d3fd477d1ed5fe5 /indra/llappearance/llpolymorph.cpp
parentdc71cae16b9c49a1d6b4d4a888c3a574049fd087 (diff)
parente0432f98ee515f9777604aa784d28b63d2abfe40 (diff)
Automated merge
Diffstat (limited to 'indra/llappearance/llpolymorph.cpp')
-rw-r--r--indra/llappearance/llpolymorph.cpp60
1 files changed, 48 insertions, 12 deletions
diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp
index aa680894ff..f7c4a69186 100644
--- a/indra/llappearance/llpolymorph.cpp
+++ b/indra/llappearance/llpolymorph.cpp
@@ -74,9 +74,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
{
const S32 numVertices = mNumIndices;
- mCoords = new LLVector4a[numVertices];
- mNormals = new LLVector4a[numVertices];
- mBinormals = new LLVector4a[numVertices];
+ mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
+ mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
+ mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
mTexCoords = new LLVector2[numVertices];
mVertexIndices = new U32[numVertices];
@@ -90,17 +90,12 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
}
}
-
//-----------------------------------------------------------------------------
// ~LLPolyMorphData()
//-----------------------------------------------------------------------------
LLPolyMorphData::~LLPolyMorphData()
{
- delete [] mVertexIndices;
- delete [] mCoords;
- delete [] mNormals;
- delete [] mBinormals;
- delete [] mTexCoords;
+ freeData();
}
//-----------------------------------------------------------------------------
@@ -120,11 +115,16 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
}
//-------------------------------------------------------------------------
+ // free any existing data
+ //-------------------------------------------------------------------------
+ freeData();
+
+ //-------------------------------------------------------------------------
// allocate vertices
//-------------------------------------------------------------------------
- mCoords = new LLVector4a[numVertices];
- mNormals = new LLVector4a[numVertices];
- mBinormals = new LLVector4a[numVertices];
+ mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
+ mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
+ mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
mTexCoords = new LLVector2[numVertices];
// Actually, we are allocating more space than we need for the skiplist
mVertexIndices = new U32[numVertices];
@@ -208,6 +208,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()