diff --git a/code/AMFImporter.cpp b/code/AMFImporter.cpp index d8fe90ff1..300766dad 100644 --- a/code/AMFImporter.cpp +++ b/code/AMFImporter.cpp @@ -39,14 +39,14 @@ const aiImporterDesc AMFImporter::Description = { void AMFImporter::Clear() { - mNodeElement_Cur = NULL; + mNodeElement_Cur = nullptr; mUnit.clear(); mMaterial_Converted.clear(); mTexture_Converted.clear(); // Delete all elements if(mNodeElement_List.size()) { - for(std::list::iterator it = mNodeElement_List.begin(); it != mNodeElement_List.end(); it++) delete *it; + for(CAMFImporter_NodeElement* ne: mNodeElement_List) { delete ne; } mNodeElement_List.clear(); } @@ -54,7 +54,7 @@ void AMFImporter::Clear() AMFImporter::~AMFImporter() { - if(mReader != NULL) delete mReader; + if(mReader != nullptr) delete mReader; // Clear() is accounting if data already is deleted. So, just check again if all data is deleted. Clear(); } @@ -65,15 +65,15 @@ AMFImporter::~AMFImporter() bool AMFImporter::Find_NodeElement(const std::string& pID, const CAMFImporter_NodeElement::EType pType, CAMFImporter_NodeElement** pNodeElement) const { - for(std::list::const_iterator it = mNodeElement_List.begin(); it != mNodeElement_List.end(); it++) + for(CAMFImporter_NodeElement* ne: mNodeElement_List) { - if(((*it)->ID == pID) && ((*it)->Type == pType)) + if((ne->ID == pID) && (ne->Type == pType)) { - if(pNodeElement != NULL) *pNodeElement = *it; + if(pNodeElement != nullptr) *pNodeElement = ne; return true; } - }// for(std::list::const_iterator it = mNodeElement_List.begin(); it != mNodeElement_List.end(); it++) + }// for(CAMFImporter_NodeElement* ne: mNodeElement_List) return false; } @@ -82,30 +82,30 @@ bool AMFImporter::Find_ConvertedNode(const std::string& pID, std::list& { aiString node_name(pID.c_str()); - for(std::list::const_iterator it = pNodeList.begin(); it != pNodeList.end(); it++) + for(aiNode* node: pNodeList) { - if((*it)->mName == node_name) + if(node->mName == node_name) { - if(pNode != NULL) *pNode = *it; + if(pNode != nullptr) *pNode = node; return true; } - }// for(std::list::const_iterator it = pNodeList.begin(); it != pNodeList.end(); it++) + }// for(aiNode* node: pNodeList) return false; } bool AMFImporter::Find_ConvertedMaterial(const std::string& pID, const SPP_Material** pConvertedMaterial) const { - for(std::list::const_iterator it = mMaterial_Converted.begin(); it != mMaterial_Converted.end(); it++) + for(const SPP_Material& mat: mMaterial_Converted) { - if((*it).ID == pID) + if(mat.ID == pID) { - if(pConvertedMaterial != NULL) *pConvertedMaterial = (SPP_Material*)&(*it); + if(pConvertedMaterial != nullptr) *pConvertedMaterial = &mat; return true; } - }// for(std::list::const_iterator it = mMaterial_Converted.begin(); it != mMaterial_Converted.end(); it++) + }// for(const SPP_Material& mat: mMaterial_Converted) return false; } @@ -277,7 +277,7 @@ void AMFImporter::ParseHelper_Node_Enter(CAMFImporter_NodeElement* pNode) void AMFImporter::ParseHelper_Node_Exit() { // check if we can walk up. - if(mNodeElement_Cur != NULL) mNodeElement_Cur = mNodeElement_Cur->Parent; + if(mNodeElement_Cur != nullptr) mNodeElement_Cur = mNodeElement_Cur->Parent; } void AMFImporter::ParseHelper_FixTruncatedFloatString(const char* pInStr, std::string& pOutString) @@ -412,7 +412,7 @@ CAMFImporter_NodeElement* ne; } // create root node element. - ne = new CAMFImporter_NodeElement_Root(NULL); + ne = new CAMFImporter_NodeElement_Root(nullptr); mNodeElement_Cur = ne;// set first "current" element // and assign attribute's values ((CAMFImporter_NodeElement_Root*)ne)->Unit = unit; diff --git a/code/AMFImporter.hpp b/code/AMFImporter.hpp index b281fd8c1..bee0f35c9 100644 --- a/code/AMFImporter.hpp +++ b/code/AMFImporter.hpp @@ -27,26 +27,13 @@ namespace Assimp /// /// Implementing features. /// -/// Triangles/faces colors and texture mapping. -/// In both cases used same method. At begin - Assimp declare that -/// "A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex colors per vertex. NULL if not present. Each array is mNumVertices in size if present." -/// and -/// "A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per vertex. NULL if not present. The array is mNumVertices in size.". -/// As you seen arrays must has mNumVertices in size. But Assimp can not check size of that arrays. So, we can create create arrays with any size. -/// That is used. For colors importer create two arrays mColors: one for vertices colors and one for faces colors. -/// For texture mapping used one more feature: Assimp can not store texture ID for every face. In this case importer also create two arrays mTextureCoords: -/// one for texture coordinates of faces and one for texture IDs of faces. -/// -/// Using \ref achFormatHint in \ref aiTexture importer set information about texture properties. For now used: -/// Texture format description used in achFormatHint array: -/// Byte 0 -/// Bit 0 - texture fill mode: -/// value 0 - clamp -/// value 1 - repeat -/// -/// /// Limitations. /// +/// 1. When for texture mapping used set of source textures (r, g, b, a) not only one then attribute "tiled" for all set will be true if it true in any of +/// source textures. +/// Example. Triangle use for texture mapping three textures. Two of them has "tiled" set to false and one - set to true. In scene all three textures +/// will be tiled. +/// /// Unsupported features: /// 1. Node , formulas in and . For implementing this feature can be used expression parser "muParser" like in project /// "amf_tools". @@ -54,11 +41,7 @@ namespace Assimp /// 3. Curved geometry: , and children nodes of them. /// 4. Attributes: "unit" and "version" in read but do nothing. /// 5. stored only for root node . -/// 6. When for texture mappinf used set of source textures (r, g, b, a) not only one then attribute "tiled" for all set will be true if it true in any of -/// source textures. -/// Example. Triangle use for texture mapping three textures. Two of them has "tiled" set to false and one - set to true. In scene all three textures -/// will be tiled. -/// 7. Color averaging of vertices for which 's set different colors. +/// 6. Color averaging of vertices for which 's set different colors. /// /// Supported nodes: /// General: @@ -197,16 +180,17 @@ private: /// \return true - if the material is found, else - false. bool Find_ConvertedMaterial(const std::string& pID, const SPP_Material** pConvertedMaterial) const; - /// \fn bool Find_ConvertedTexture(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, const std::string& pID_A, uint32_t* pConvertedTextureIndex = NULL) const + /// \fn bool Find_ConvertedTexture(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, const std::string& pID_A, uint32_t* pConvertedTextureIndex = nullptr) const /// Find texture in list of converted textures. Use at postprocessing step, /// \param [in] pID_R - ID of source "red" texture. /// \param [in] pID_G - ID of source "green" texture. /// \param [in] pID_B - ID of source "blue" texture. /// \param [in] pID_A - ID of source "alpha" texture. Use empty string to find RGB-texture. - /// \param [out] pConvertedTextureIndex - pointer where index in list of found texture will be written. If equivalent to NULL then nothing will be written. + /// \param [out] pConvertedTextureIndex - pointer where index in list of found texture will be written. If equivalent to nullptr then nothing will be + /// written. /// \return true - if the texture is found, else - false. bool Find_ConvertedTexture(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, const std::string& pID_A, - uint32_t* pConvertedTextureIndex = NULL) const; + uint32_t* pConvertedTextureIndex = nullptr) const; /***********************************************/ /********* Functions: postprocess set **********/ @@ -217,7 +201,7 @@ private: /// \param [in] pNodeElement - reference to node element which kept data. /// \param [in] pVertexCoordinateArray - reference to vertices coordinates kept in . /// \param [in] pVertexColorArray - reference to vertices colors for all & pVertexCoordinateArray, std::vector& pVertexColorArray) const; @@ -258,8 +242,8 @@ private: /// \param [in] pNodeElement - reference to node element which kept data. /// \param [in] pVertexCoordinateArray - reference to vertices coordinates for all 's. /// \param [in] pVertexColorArray - reference to vertices colors for all 's. If color for vertex is not set then corresponding member of array - /// contain NULL. - /// \param [in] pObjectColor - pointer to colors for . If color is not set then argument contain NULL. + /// contain nullptr. + /// \param [in] pObjectColor - pointer to colors for . If color is not set then argument contain nullptr. /// \param [in] pMaterialList - reference to a list with defined materials. /// \param [out] pMeshList - reference to a list with all aiMesh of the scene. /// \param [out] pSceneNode - reference to aiNode which will own new aiMesh's. @@ -503,7 +487,7 @@ public: /// \fn AMFImporter() /// Default constructor. AMFImporter() - : mNodeElement_Cur(NULL), mReader(NULL) + : mNodeElement_Cur(nullptr), mReader(nullptr) {} /// \fn ~AMFImporter() diff --git a/code/AMFImporter_Node.hpp b/code/AMFImporter_Node.hpp index 1d8344c41..b3ec54833 100644 --- a/code/AMFImporter_Node.hpp +++ b/code/AMFImporter_Node.hpp @@ -63,7 +63,7 @@ public: public: std::string ID;///< ID of element. - CAMFImporter_NodeElement* Parent;///< Parrent element. If NULL then this node is root. + CAMFImporter_NodeElement* Parent;///< Parrent element. If nullptr then this node is root. std::list Child;///< Child elements. /***********************************************/ diff --git a/code/AMFImporter_Postprocess.cpp b/code/AMFImporter_Postprocess.cpp index b1875e638..dc6fcbdc1 100644 --- a/code/AMFImporter_Postprocess.cpp +++ b/code/AMFImporter_Postprocess.cpp @@ -51,49 +51,50 @@ aiColor4D tcol; void AMFImporter::PostprocessHelper_CreateMeshDataArray(const CAMFImporter_NodeElement_Mesh& pNodeElement, std::vector& pVertexCoordinateArray, std::vector& pVertexColorArray) const { -CAMFImporter_NodeElement_Vertices* vn = NULL; +CAMFImporter_NodeElement_Vertices* vn = nullptr; size_t col_idx; // All data stored in "vertices", search for it. - for(std::list::const_iterator it = pNodeElement.Child.begin(); it != pNodeElement.Child.end(); it++) + for(CAMFImporter_NodeElement* ne_child: pNodeElement.Child) { - if((*it)->Type == CAMFImporter_NodeElement::ENET_Vertices) vn = (CAMFImporter_NodeElement_Vertices*)(*it); + if(ne_child->Type == CAMFImporter_NodeElement::ENET_Vertices) vn = (CAMFImporter_NodeElement_Vertices*)ne_child; } + // If "vertices" not found then no work for us. - if(vn == NULL) return; + if(vn == nullptr) return; pVertexCoordinateArray.reserve(vn->Child.size());// all coordinates stored as child and we need to reserve space for future push_back's. pVertexColorArray.resize(vn->Child.size());// colors count equal vertices count. col_idx = 0; // Inside vertices collect all data and place to arrays - for(std::list::const_iterator it = vn->Child.begin(); it != vn->Child.end(); it++) + for(CAMFImporter_NodeElement* vn_child: vn->Child) { // vertices, colors - if((*it)->Type == CAMFImporter_NodeElement::ENET_Vertex) + if(vn_child->Type == CAMFImporter_NodeElement::ENET_Vertex) { // by default clear color for current vertex - pVertexColorArray[col_idx] = NULL; + pVertexColorArray[col_idx] = nullptr; - for(std::list::const_iterator vtx_it = (*it)->Child.begin(); vtx_it != (*it)->Child.end(); vtx_it++) + for(CAMFImporter_NodeElement* vtx: vn_child->Child) { - if((*vtx_it)->Type == CAMFImporter_NodeElement::ENET_Coordinates) + if(vtx->Type == CAMFImporter_NodeElement::ENET_Coordinates) { - pVertexCoordinateArray.push_back(((CAMFImporter_NodeElement_Coordinates*)(*vtx_it))->Coordinate); + pVertexCoordinateArray.push_back(((CAMFImporter_NodeElement_Coordinates*)vtx)->Coordinate); continue; - }// if((*vtx_it)->Type == CAMFImporter_NodeElement::ENET_Coordinates) + } - if((*vtx_it)->Type == CAMFImporter_NodeElement::ENET_Color) + if(vtx->Type == CAMFImporter_NodeElement::ENET_Color) { - pVertexColorArray[col_idx] = (CAMFImporter_NodeElement_Color*)(*vtx_it); + pVertexColorArray[col_idx] = (CAMFImporter_NodeElement_Color*)vtx; continue; - }// if((*vtx_it)->Type == CAMFImporter_NodeElement::ENET_Coordinates) - }// for(std::list::const_iterator vtx_it = (*it)->Child.begin(); vtx_it != (*it)->Child.end(); vtx_it++) + } + }// for(CAMFImporter_NodeElement* vtx: vn_child->Child) col_idx++; - }// if((*it)->Type == CAMFImporter_NodeElement::ENET_Vertex) - }// for(std::list::const_iterator it = pNodeElement.Child.begin(); it != pNodeElement.Child.end(); it++) + }// if(vn_child->Type == CAMFImporter_NodeElement::ENET_Vertex) + }// for(CAMFImporter_NodeElement* vn_child: vn->Child) } size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, @@ -300,7 +301,7 @@ void AMFImporter::Postprocess_AddMetadata(const std::list 0) { - if(pSceneNode.mMetaData != NULL) throw DeadlyImportError("Postprocess. MetaData member in node are not NULL. Something went wrong."); + if(pSceneNode.mMetaData != nullptr) throw DeadlyImportError("Postprocess. MetaData member in node are not nullptr. Something went wrong."); // copy collected metadata to output node. pSceneNode.mMetaData = new aiMetadata(); @@ -310,37 +311,37 @@ void AMFImporter::Postprocess_AddMetadata(const std::list::const_iterator it = pMetadataList.begin(); it != pMetadataList.end(); it++) + for(const CAMFImporter_NodeElement_Metadata& metadata: pMetadataList) { - pSceneNode.mMetaData->Set(meta_idx++, (*it)->Type, (*it)->Value.c_str()); + pSceneNode.mMetaData->Set(meta_idx++, metadata.Type, metadata.Value.c_str()); } }// if(pMetadataList.size() > 0) } void AMFImporter::Postprocess_BuildNodeAndObject(const CAMFImporter_NodeElement_Object& pNodeElement, std::list& pMeshList, aiNode** pSceneNode) { -CAMFImporter_NodeElement_Color* object_color = NULL; +CAMFImporter_NodeElement_Color* object_color = nullptr; // create new aiNode and set name as has. *pSceneNode = new aiNode; (*pSceneNode)->mName = pNodeElement.ID; // read mesh and color - for(std::list::const_iterator it = pNodeElement.Child.begin(); it != pNodeElement.Child.end(); it++) + for(const CAMFImporter_NodeElement* ne_child: pNodeElement.Child) { std::vector vertex_arr; std::vector color_arr; // color for object - if((*it)->Type == CAMFImporter_NodeElement::ENET_Color) object_color = (CAMFImporter_NodeElement_Color*)(*it); + if(ne_child->Type == CAMFImporter_NodeElement::ENET_Color) object_color = (CAMFImporter_NodeElement_Color*)ne_child; - if((*it)->Type == CAMFImporter_NodeElement::ENET_Mesh) + if(ne_child->Type == CAMFImporter_NodeElement::ENET_Mesh) { // Create arrays from children of mesh: vertices. - PostprocessHelper_CreateMeshDataArray(*((CAMFImporter_NodeElement_Mesh*)*it), vertex_arr, color_arr); + PostprocessHelper_CreateMeshDataArray(*((CAMFImporter_NodeElement_Mesh*)ne_child), vertex_arr, color_arr); // Use this arrays as a source when creating every aiMesh - Postprocess_BuildMeshSet(*((CAMFImporter_NodeElement_Mesh*)*it), vertex_arr, color_arr, object_color, pMeshList, **pSceneNode); - }// if((*it)->Type == CAMFImporter_NodeElement::ENET_Mesh) - }// for(std::list::const_iterator it = pNodeElement.Child.begin(); it != pNodeElement.Child.end(); it++) + Postprocess_BuildMeshSet(*((CAMFImporter_NodeElement_Mesh*)ne_child), vertex_arr, color_arr, object_color, pMeshList, **pSceneNode); + } + }// for(const CAMFImporter_NodeElement* ne_child: pNodeElement) } void AMFImporter::Postprocess_BuildMeshSet(const CAMFImporter_NodeElement_Mesh& pNodeElement, const std::vector& pVertexCoordinateArray, @@ -521,7 +522,7 @@ std::list mesh_idx; else// set default color. { return {0, 0, 0, 0}; - }// if((vi < pVertexColorArray.size()) && (pVertexColorArray[vi] != NULL)) else + }// if((vi < pVertexColorArray.size()) && (pVertexColorArray[vi] != nullptr)) else };// auto Vertex_CalculateColor = [&](const size_t pIdx) -> aiColor4D @@ -680,17 +681,17 @@ void AMFImporter::Postprocess_BuildMaterial(const CAMFImporter_NodeElement_Mater SPP_Material new_mat; new_mat.ID = pMaterial.ID; - for(std::list::const_iterator it = pMaterial.Child.begin(); it != pMaterial.Child.end(); it++) + for(const CAMFImporter_NodeElement* mat_child: pMaterial.Child) { - if((*it)->Type == CAMFImporter_NodeElement::ENET_Color) + if(mat_child->Type == CAMFImporter_NodeElement::ENET_Color) { - new_mat.Color = (CAMFImporter_NodeElement_Color*)(*it); + new_mat.Color = (CAMFImporter_NodeElement_Color*)mat_child; } - else if((*it)->Type == CAMFImporter_NodeElement::ENET_Metadata) + else if(mat_child->Type == CAMFImporter_NodeElement::ENET_Metadata) { - new_mat.Metadata.push_back((CAMFImporter_NodeElement_Metadata*)(*it)); + new_mat.Metadata.push_back((CAMFImporter_NodeElement_Metadata*)mat_child); } - }// for(std::list::const_iterator it = pMaterial.Child.begin(); it != pMaterial.Child.end(); it++) + }// for(const CAMFImporter_NodeElement* mat_child; pMaterial.Child) // place converted material to special list mMaterial_Converted.push_back(new_mat); @@ -709,17 +710,17 @@ std::list ch_node; con_node = new aiNode; con_node->mName = pConstellation.ID; // Walk thru children and search for instances of another objects, constellations. - for(std::list::const_iterator it = pConstellation.Child.begin(); it != pConstellation.Child.end(); it++) + for(const CAMFImporter_NodeElement* ne: pConstellation.Child) { aiMatrix4x4 tmat; aiNode* t_node; aiNode* found_node; - if((*it)->Type == CAMFImporter_NodeElement::ENET_Metadata) continue; - if((*it)->Type != CAMFImporter_NodeElement::ENET_Instance) throw DeadlyImportError("Only nodes can be in ."); + if(ne->Type == CAMFImporter_NodeElement::ENET_Metadata) continue; + if(ne->Type != CAMFImporter_NodeElement::ENET_Instance) throw DeadlyImportError("Only nodes can be in ."); // create alias for conveniance - CAMFImporter_NodeElement_Instance& als = *((CAMFImporter_NodeElement_Instance*)(*it)); + CAMFImporter_NodeElement_Instance& als = *((CAMFImporter_NodeElement_Instance*)ne); // find referenced object if(!Find_ConvertedNode(als.ObjectID, pNodeList, &found_node)) Throw_ID_NotFound(als.ObjectID); @@ -737,7 +738,7 @@ std::list ch_node; SceneCombiner::Copy(&t_node->mChildren[0], found_node); t_node->mChildren[0]->mParent = t_node; ch_node.push_back(t_node); - }// for(std::list::const_iterator it = mNodeElement_List.begin(); it != mNodeElement_List.end(); it++) + }// for(const CAMFImporter_NodeElement* ne: pConstellation.Child) // copy found aiNode's as children if(ch_node.size() == 0) throw DeadlyImportError(" must have at least one ."); @@ -746,7 +747,7 @@ std::list ch_node; con_node->mNumChildren = ch_node.size(); con_node->mChildren = new aiNode*[con_node->mNumChildren]; - for(std::list::const_iterator it = ch_node.begin(); it != ch_node.end(); it++) con_node->mChildren[ch_idx++] = *it; + for(aiNode* node: ch_node) con_node->mChildren[ch_idx++] = node; // and place "root" of node to node list pNodeList.push_back(con_node); @@ -763,21 +764,22 @@ std::list meta_list; // For building aiScene we are must to do few steps: // at first creating root node for aiScene. pScene->mRootNode = new aiNode; - pScene->mRootNode->mParent = NULL; + pScene->mRootNode->mParent = nullptr; pScene->mFlags |= AI_SCENE_FLAGS_ALLOW_SHARED; // search for root() element - CAMFImporter_NodeElement* root_el = NULL; - for(std::list::const_iterator it = mNodeElement_List.begin(); it != mNodeElement_List.end(); it++) - { - if((*it)->Type != CAMFImporter_NodeElement::ENET_Root) continue; + CAMFImporter_NodeElement* root_el = nullptr; - root_el = *it; + for(CAMFImporter_NodeElement* ne: mNodeElement_List) + { + if(ne->Type != CAMFImporter_NodeElement::ENET_Root) continue; + + root_el = ne; break; - }// for(std::list::const_iterator it = mNodeElement_List.begin(); it != mNodeElement_List.end(); it++) + }// for(const CAMFImporter_NodeElement* ne: mNodeElement_List) // Check if root element are found. - if(root_el == NULL) throw DeadlyImportError("Root() element not found."); + if(root_el == nullptr) throw DeadlyImportError("Root() element not found."); // after that walk thru children of root and collect data. Five types of nodes can be placed at top level - in : , , , // and . But at first we must read and because they will be used in . can be read @@ -785,41 +787,41 @@ std::list meta_list; // // 1. // 2. will be converted later when processing triangles list. \sa Postprocess_BuildMeshSet - for(std::list::const_iterator it = root_el->Child.begin(), it_end = root_el->Child.end(); it != it_end; it++) + for(const CAMFImporter_NodeElement* root_child: root_el->Child) { - if((*it)->Type == CAMFImporter_NodeElement::ENET_Material) Postprocess_BuildMaterial(*((CAMFImporter_NodeElement_Material*)*it)); + if(root_child->Type == CAMFImporter_NodeElement::ENET_Material) Postprocess_BuildMaterial(*((CAMFImporter_NodeElement_Material*)root_child)); } // After "appearance" nodes we must read because it will be used in -> . // // 3. - for(std::list::const_iterator it = root_el->Child.begin(), it_end = root_el->Child.end(); it != it_end; it++) + for(const CAMFImporter_NodeElement* root_child: root_el->Child) { - if((*it)->Type == CAMFImporter_NodeElement::ENET_Object) + if(root_child->Type == CAMFImporter_NodeElement::ENET_Object) { - aiNode* tnode = NULL; + aiNode* tnode = nullptr; // for mesh and node must be built: object ID assigned to aiNode name and will be used in future for - Postprocess_BuildNodeAndObject(*((CAMFImporter_NodeElement_Object*)*it), mesh_list, &tnode); - if(tnode != NULL) node_list.push_back(tnode); + Postprocess_BuildNodeAndObject(*((CAMFImporter_NodeElement_Object*)root_child), mesh_list, &tnode); + if(tnode != nullptr) node_list.push_back(tnode); - }// if(it->Type == CAMFImporter_NodeElement::ENET_Object) - }// for(std::list::const_iterator it = root_el->Child.begin(), it_end = root_el->Child.end(); it != it_end; it++) + } + }// for(const CAMFImporter_NodeElement* root_child: root_el->Child) // And finally read rest of nodes. // - for(std::list::const_iterator it = root_el->Child.begin(), it_end = root_el->Child.end(); it != it_end; it++) + for(const CAMFImporter_NodeElement* root_child: root_el->Child) { // 4. - if((*it)->Type == CAMFImporter_NodeElement::ENET_Constellation) + if(root_child->Type == CAMFImporter_NodeElement::ENET_Constellation) { // and at top of self abstraction use aiNode. So we can use only aiNode list for creating new aiNode's. - Postprocess_BuildConstellation(*((CAMFImporter_NodeElement_Constellation*)*it), node_list); + Postprocess_BuildConstellation(*((CAMFImporter_NodeElement_Constellation*)root_child), node_list); } // 5, - if((*it)->Type == CAMFImporter_NodeElement::ENET_Metadata) meta_list.push_back((CAMFImporter_NodeElement_Metadata*)*it); - }// for(std::list::const_iterator it = root_el->Child.begin(), it_end = root_el->Child.end(); it != it_end; it++) + if(root_child->Type == CAMFImporter_NodeElement::ENET_Metadata) meta_list.push_back((CAMFImporter_NodeElement_Metadata*)root_child); + }// for(const CAMFImporter_NodeElement* root_child: root_el->Child) // at now we can add collected metadata to root node Postprocess_AddMetadata(meta_list, *pScene->mRootNode); @@ -843,7 +845,7 @@ nl_clean_loop: next_it++; for(; next_it != node_list.end(); next_it++) { - if((*next_it)->FindNode((*nl_it)->mName) != NULL) + if((*next_it)->FindNode((*nl_it)->mName) != nullptr) { // if current top node(nl_it) found in another top node then erase it from node_list and restart search loop. node_list.erase(nl_it);