瀏覽代碼

Merge branch 'master' into patch-1

Kim Kulling 4 年之前
父節點
當前提交
76d370b054

+ 0 - 1
CMakeLists.txt

@@ -229,7 +229,6 @@ INCLUDE_DIRECTORIES( BEFORE
   include
   include
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_BINARY_DIR}/include
   ${CMAKE_CURRENT_BINARY_DIR}/include
-  contrib/pugixml/src
 )
 )
 
 
 LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
 LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )

+ 1 - 0
cmake/assimp-hunter-config.cmake.in

@@ -8,6 +8,7 @@ find_package(openddlparser CONFIG REQUIRED)
 find_package(poly2tri CONFIG REQUIRED)
 find_package(poly2tri CONFIG REQUIRED)
 find_package(polyclipping CONFIG REQUIRED)
 find_package(polyclipping CONFIG REQUIRED)
 find_package(zip CONFIG REQUIRED)
 find_package(zip CONFIG REQUIRED)
+find_package(pugixml CONFIG REQUIRED)
 
 
 include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
 include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
 check_required_components("@PROJECT_NAME@")
 check_required_components("@PROJECT_NAME@")

+ 10 - 3
code/AssetLib/Collada/ColladaParser.cpp

@@ -137,10 +137,12 @@ ColladaParser::ColladaParser(IOSystem *pIOHandler, const std::string &pFile) :
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 // Destructor, private as well
 // Destructor, private as well
 ColladaParser::~ColladaParser() {
 ColladaParser::~ColladaParser() {
-    for (NodeLibrary::iterator it = mNodeLibrary.begin(); it != mNodeLibrary.end(); ++it)
+    for (NodeLibrary::iterator it = mNodeLibrary.begin(); it != mNodeLibrary.end(); ++it) {
         delete it->second;
         delete it->second;
-    for (MeshLibrary::iterator it = mMeshLibrary.begin(); it != mMeshLibrary.end(); ++it)
+    }
+    for (MeshLibrary::iterator it = mMeshLibrary.begin(); it != mMeshLibrary.end(); ++it) {
         delete it->second;
         delete it->second;
+    }
 }
 }
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
@@ -1284,10 +1286,10 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam)
     if (node.empty()) {
     if (node.empty()) {
         return;
         return;
     }
     }
+
     XmlNodeIterator xmlIt(node);
     XmlNodeIterator xmlIt(node);
     xmlIt.collectChildrenPreOrder(node);
     xmlIt.collectChildrenPreOrder(node);
     XmlNode currentNode;
     XmlNode currentNode;
-
     while (xmlIt.getNext(currentNode)) {
     while (xmlIt.getNext(currentNode)) {
         const std::string &currentName = currentNode.name();
         const std::string &currentName = currentNode.name();
         if (currentName == "surface") {
         if (currentName == "surface") {
@@ -1313,6 +1315,11 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam)
             }
             }
             pParam.mType = Param_Sampler;
             pParam.mType = Param_Sampler;
             pParam.mReference = url.c_str() + 1;
             pParam.mReference = url.c_str() + 1;
+        } else if (currentName == "source") {
+            const char *source = currentNode.child_value();
+            if (nullptr != source) {
+                pParam.mReference = source;
+            }
         }
         }
     }
     }
 }
 }

+ 1 - 1
code/AssetLib/XGL/XGLLoader.cpp

@@ -598,7 +598,7 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) {
 	}
 	}
 
 
 	// finally extract output meshes and add them to the scope
 	// finally extract output meshes and add them to the scope
-	typedef std::pair<unsigned int, TempMaterialMesh> pairt;
+	typedef std::pair<const unsigned int, TempMaterialMesh> pairt;
 	for (const pairt &p : bymat) {
 	for (const pairt &p : bymat) {
 		aiMesh *const m = ToOutputMesh(p.second);
 		aiMesh *const m = ToOutputMesh(p.second);
 		scope.meshes_linear.push_back(m);
 		scope.meshes_linear.push_back(m);

+ 12 - 5
code/CMakeLists.txt

@@ -862,11 +862,16 @@ SET( Extra_SRCS
 SOURCE_GROUP( Extra FILES ${Extra_SRCS})
 SOURCE_GROUP( Extra FILES ${Extra_SRCS})
 
 
 # pugixml
 # pugixml
-SET( Pugixml_SRCS
-  ../contrib/pugixml/src/pugiconfig.hpp
-  ../contrib/pugixml/src/pugixml.hpp
-)
-SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
+IF(ASSIMP_HUNTER_ENABLED)
+  hunter_add_package(pugixml)
+  find_package(pugixml CONFIG REQUIRED)
+ELSE()
+  SET( Pugixml_SRCS
+    ../contrib/pugixml/src/pugiconfig.hpp
+    ../contrib/pugixml/src/pugixml.hpp
+  )
+  SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
+ENDIF()
 
 
 # utf8
 # utf8
 IF(ASSIMP_HUNTER_ENABLED)
 IF(ASSIMP_HUNTER_ENABLED)
@@ -1026,6 +1031,7 @@ IF(ASSIMP_HUNTER_ENABLED)
 ELSE()
 ELSE()
   INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" )
   INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" )
   INCLUDE_DIRECTORIES( "../contrib" )
   INCLUDE_DIRECTORIES( "../contrib" )
+  INCLUDE_DIRECTORIES( "../contrib/pugixml/src" )
   ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1 )
   ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1 )
   ADD_DEFINITIONS( -DRAPIDJSON_NOMEMBERITERATORCLASS )
   ADD_DEFINITIONS( -DRAPIDJSON_NOMEMBERITERATORCLASS )
 ENDIF()
 ENDIF()
@@ -1136,6 +1142,7 @@ IF(ASSIMP_HUNTER_ENABLED)
       RapidJSON::rapidjson
       RapidJSON::rapidjson
       utf8cpp
       utf8cpp
       zip::zip
       zip::zip
+      pugixml
   )
   )
 ELSE()
 ELSE()
   TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} )
   TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} )

+ 0 - 2
code/Common/BaseImporter.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 
 Copyright (c) 2006-2020, assimp team
 Copyright (c) 2006-2020, assimp team
 
 
-
-
 All rights reserved.
 All rights reserved.
 
 
 Redistribution and use of this software in source and binary forms,
 Redistribution and use of this software in source and binary forms,

+ 1 - 0
test/CMakeLists.txt

@@ -48,6 +48,7 @@ if(NOT ASSIMP_HUNTER_ENABLED)
   INCLUDE_DIRECTORIES(
   INCLUDE_DIRECTORIES(
     ${Assimp_SOURCE_DIR}/contrib/gtest/include
     ${Assimp_SOURCE_DIR}/contrib/gtest/include
     ${Assimp_SOURCE_DIR}/contrib/gtest/
     ${Assimp_SOURCE_DIR}/contrib/gtest/
+    ${Assimp_SOURCE_DIR}/contrib/pugixml/src
   )
   )
 endif()
 endif()