diff --git a/code/AMFImporter_Postprocess.cpp b/code/AMFImporter_Postprocess.cpp index fa052efdf..dbee3d446 100644 --- a/code/AMFImporter_Postprocess.cpp +++ b/code/AMFImporter_Postprocess.cpp @@ -273,7 +273,7 @@ auto texmap_is_equal = [](const CAMFImporter_NodeElement_TexMap* pTexMap1, const SComplexFace face_start = pInputList.front(); std::list face_list_cur; - for(std::list::const_iterator it = pInputList.cbegin(), it_end = pInputList.cend(); it != it_end;) + for(std::list::iterator it = pInputList.begin(), it_end = pInputList.end(); it != it_end;) { if(texmap_is_equal(face_start.TexMap, it->TexMap)) { @@ -531,7 +531,7 @@ std::list mesh_idx; // Create vertices list and optimize indices. Optimisation mean following.In AMF all volumes use one big list of vertices. And one volume // can use only part of vertices list, for example: vertices list contain few thousands of vertices and volume use vertices 1, 3, 10. // Do you need all this thousands of garbage? Of course no. So, optimisation step transformate sparse indices set to continuous. - const size_t VertexCount_Max = tmesh->mNumFaces * 3;// 3 - triangles. + size_t VertexCount_Max = tmesh->mNumFaces * 3;// 3 - triangles. std::vector vert_arr, texcoord_arr; std::vector col_arr; @@ -595,7 +595,10 @@ std::list mesh_idx; ///TODO: clean unused vertices. "* 2": in certain cases - mesh full of triangle colors - vert_arr will contain duplicated vertices for /// colored triangles and initial vertices (for colored vertices) which in real became unused. This part need more thinking about /// optimisation. - bool idx_vert_used[VertexCount_Max * 2]{false}; + bool* idx_vert_used; + + idx_vert_used = new bool[VertexCount_Max * 2]; + for(size_t i = 0, i_e = VertexCount_Max * 2; i < i_e; i++) idx_vert_used[i] = false; // This ID's will be used when set materials ID in scene. tmesh->mMaterialIndex = PostprocessHelper_GetTextureID_Or_Create(face_list_cur.front().TexMap->TextureID_R, @@ -626,6 +629,7 @@ std::list mesh_idx; }// for(size_t idx_ind = 0; idx_ind < face_cur.Face.mNumIndices; idx_ind++) }// for(const SComplexFace& face_cur: face_list_cur) + delete [] idx_vert_used; // shrink array texcoord_arr.resize(idx_vert_new); }// if(face_list_cur.front().TexMap != nullptr)