From c1a3912b3f6c477fa406c1b9bd983a54dc25ff58 Mon Sep 17 00:00:00 2001 From: Alexandr Arutjunov Date: Fri, 30 Sep 2016 02:12:46 +0300 Subject: [PATCH 1/2] [F] Erasing with constant iterator. Strange that new gcc is allow this. [*] Few changes for building using old (or MS) compilers. --- code/AMFImporter_Postprocess.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/AMFImporter_Postprocess.cpp b/code/AMFImporter_Postprocess.cpp index fa052efdf..6988ce159 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,9 @@ 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[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, From 9d4d0de6078fbbfc73e562e60eee2d8e4c9e2853 Mon Sep 17 00:00:00 2001 From: Alexandr Arutjunov Date: Fri, 30 Sep 2016 02:24:24 +0300 Subject: [PATCH 2/2] [*] Few changes for building using old (or MS) compilers. --- code/AMFImporter_Postprocess.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/AMFImporter_Postprocess.cpp b/code/AMFImporter_Postprocess.cpp index 6988ce159..dbee3d446 100644 --- a/code/AMFImporter_Postprocess.cpp +++ b/code/AMFImporter_Postprocess.cpp @@ -595,8 +595,9 @@ 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]; + 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. @@ -628,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)