From c73ff82fc496d316512f9db0dd753fcb1eb65f81 Mon Sep 17 00:00:00 2001 From: sola Date: Fri, 25 Feb 2022 19:58:44 +0800 Subject: [PATCH] FBXConvert::ConvertMeshMultiMaterial: allocate memory using variable count_vertices --- code/AssetLib/FBX/FBXConverter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index 39db79a3e..32872108b 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -1267,7 +1267,7 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co const std::vector &normals = mesh.GetNormals(); if (normals.size()) { ai_assert(normals.size() == vertices.size()); - out_mesh->mNormals = new aiVector3D[vertices.size()]; + out_mesh->mNormals = new aiVector3D[count_vertices]; } // allocate tangents, binormals. @@ -1295,8 +1295,8 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co ai_assert(tangents.size() == vertices.size()); ai_assert(binormals->size() == vertices.size()); - out_mesh->mTangents = new aiVector3D[vertices.size()]; - out_mesh->mBitangents = new aiVector3D[vertices.size()]; + out_mesh->mTangents = new aiVector3D[count_vertices]; + out_mesh->mBitangents = new aiVector3D[count_vertices]; } } @@ -1308,7 +1308,7 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co break; } - out_mesh->mTextureCoords[i] = new aiVector3D[vertices.size()]; + out_mesh->mTextureCoords[i] = new aiVector3D[count_vertices]; out_mesh->mNumUVComponents[i] = 2; } @@ -1320,7 +1320,7 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co break; } - out_mesh->mColors[i] = new aiColor4D[vertices.size()]; + out_mesh->mColors[i] = new aiColor4D[count_vertices]; } unsigned int cursor = 0, in_cursor = 0;