OpenGEX: Replace another raw pointer with vector to fix a memory leak
parent
880be5403f
commit
1aed63afb7
|
@ -223,8 +223,6 @@ static void propId2StdString( Property *prop, std::string &name, std::string &ke
|
||||||
OpenGEXImporter::VertexContainer::VertexContainer()
|
OpenGEXImporter::VertexContainer::VertexContainer()
|
||||||
: m_numColors( 0 )
|
: m_numColors( 0 )
|
||||||
, m_colors( nullptr )
|
, m_colors( nullptr )
|
||||||
, m_numNormals( 0 )
|
|
||||||
, m_normals( nullptr )
|
|
||||||
, m_numUVComps()
|
, m_numUVComps()
|
||||||
, m_textureCoords() {
|
, m_textureCoords() {
|
||||||
// empty
|
// empty
|
||||||
|
@ -233,7 +231,6 @@ OpenGEXImporter::VertexContainer::VertexContainer()
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
OpenGEXImporter::VertexContainer::~VertexContainer() {
|
OpenGEXImporter::VertexContainer::~VertexContainer() {
|
||||||
delete[] m_colors;
|
delete[] m_colors;
|
||||||
delete[] m_normals;
|
|
||||||
|
|
||||||
for(auto &texcoords : m_textureCoords) {
|
for(auto &texcoords : m_textureCoords) {
|
||||||
delete [] texcoords;
|
delete [] texcoords;
|
||||||
|
@ -861,9 +858,8 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene
|
||||||
m_currentVertices.m_colors = new aiColor4D[ numItems ];
|
m_currentVertices.m_colors = new aiColor4D[ numItems ];
|
||||||
copyColor4DArray( numItems, vaList, m_currentVertices.m_colors );
|
copyColor4DArray( numItems, vaList, m_currentVertices.m_colors );
|
||||||
} else if( Normal == attribType ) {
|
} else if( Normal == attribType ) {
|
||||||
m_currentVertices.m_numNormals = numItems;
|
m_currentVertices.m_normals.resize( numItems );
|
||||||
m_currentVertices.m_normals = new aiVector3D[ numItems ];
|
copyVectorArray( numItems, vaList, m_currentVertices.m_normals.data() );
|
||||||
copyVectorArray( numItems, vaList, m_currentVertices.m_normals );
|
|
||||||
} else if( TexCoord == attribType ) {
|
} else if( TexCoord == attribType ) {
|
||||||
m_currentVertices.m_numUVComps[ 0 ] = numItems;
|
m_currentVertices.m_numUVComps[ 0 ] = numItems;
|
||||||
m_currentVertices.m_textureCoords[ 0 ] = new aiVector3D[ numItems ];
|
m_currentVertices.m_textureCoords[ 0 ] = new aiVector3D[ numItems ];
|
||||||
|
@ -900,7 +896,7 @@ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene *
|
||||||
hasColors = true;
|
hasColors = true;
|
||||||
}
|
}
|
||||||
bool hasNormalCoords( false );
|
bool hasNormalCoords( false );
|
||||||
if ( m_currentVertices.m_numNormals > 0 ) {
|
if ( !m_currentVertices.m_normals.empty() ) {
|
||||||
m_currentMesh->mNormals = new aiVector3D[ m_currentMesh->mNumVertices ];
|
m_currentMesh->mNormals = new aiVector3D[ m_currentMesh->mNumVertices ];
|
||||||
hasNormalCoords = true;
|
hasNormalCoords = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,8 +147,7 @@ private:
|
||||||
std::vector<aiVector3D> m_vertices;
|
std::vector<aiVector3D> m_vertices;
|
||||||
size_t m_numColors;
|
size_t m_numColors;
|
||||||
aiColor4D *m_colors;
|
aiColor4D *m_colors;
|
||||||
size_t m_numNormals;
|
std::vector<aiVector3D> m_normals;
|
||||||
aiVector3D *m_normals;
|
|
||||||
size_t m_numUVComps[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
size_t m_numUVComps[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||||
aiVector3D *m_textureCoords[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
aiVector3D *m_textureCoords[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue