From 7d665832f6e620ce577f4cfe3619d6b3c27107e3 Mon Sep 17 00:00:00 2001 From: cgmelt Date: Mon, 22 Sep 2008 08:16:37 +0000 Subject: [PATCH] destructors implemented per mesh normals git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@159 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ObjFileData.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/code/ObjFileData.h b/code/ObjFileData.h index 1db6fa2bd..0af59df94 100644 --- a/code/ObjFileData.h +++ b/code/ObjFileData.h @@ -93,7 +93,18 @@ struct Face //! \brief Destructor ~Face() { - // empty + if(m_pVertices) { + delete m_pVertices; + m_pVertices = NULL; + } + if(m_pNormals) { + delete m_pNormals; + m_pNormals = NULL; + } + if(m_pTexturCoords) { + delete m_pTexturCoords; + m_pTexturCoords = NULL; + } } }; @@ -181,11 +192,13 @@ struct Mesh /// Material index. unsigned int m_uiMaterialIndex; + bool m_hasNormals; /// Constructor Mesh() : m_pMaterial(NULL), m_uiNumIndices(0), - m_uiMaterialIndex(0) + m_uiMaterialIndex(0), + m_hasNormals(false) { memset(m_uiUVCoordinates, 0, sizeof( unsigned int ) * AI_MAX_NUMBER_OF_TEXTURECOORDS); } @@ -193,7 +206,12 @@ struct Mesh /// Destructor ~Mesh() { - // empty + for (std::vector::iterator it = m_Faces.begin(); + it != m_Faces.end(); ++it) + { + delete *it; + } + } }; @@ -269,7 +287,17 @@ struct Model { delete *it; } + m_Meshes.clear(); + + for(GroupMapIt it = m_Groups.begin(); + it != m_Groups.end(); ++it) + { + delete it->second; + } + + m_Groups.clear(); + } };