瀏覽代碼

glFT: refactoring.

Kim Kulling 5 年之前
父節點
當前提交
243c1e15fe

+ 5 - 60
code/AssetLib/glTF/glTFAsset.h

@@ -51,66 +51,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 #if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
 #if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
 
 
-#include <assimp/Exceptional.h>
-
-#include <map>
-#include <string>
-#include <list>
-#include <vector>
-#include <algorithm>
-#include <stdexcept>
-
-#ifndef RAPIDJSON_HAS_STDSTRING
-#define RAPIDJSON_HAS_STDSTRING 1
-#endif
-
-#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wclass-memaccess"
-#endif
-
-#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
-#define RAPIDJSON_NOMEMBERITERATORCLASS
-#endif
-
-#include <rapidjson/rapidjson.h>
-#include <rapidjson/document.h>
-#include <rapidjson/error/en.h>
-
-#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
-#pragma GCC diagnostic pop
-#endif
-
-#ifdef ASSIMP_API
-#   include <memory>
-#   include <assimp/DefaultIOSystem.h>
-#   include <assimp/ByteSwapper.h>
-#else
-#   include <memory>
-#   define AI_SWAP4(p)
-#   define ai_assert
-#endif
-
-
-#if _MSC_VER > 1500 || (defined __GNUC___)
-#       define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
-#   else
-#       define gltf_unordered_map map
-#endif
-
-#ifdef ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
-#   include <unordered_map>
-#   if _MSC_VER > 1600
-#       define gltf_unordered_map unordered_map
-#   else
-#       define gltf_unordered_map tr1::unordered_map
-#   endif
-#endif
-
-#include "AssetLib/glTF/glTFCommon.h"
-
-namespace glTF
-{
+#include "AssetLib/glTFCommon/glTFCommon.h"
+
+
+namespace glTF {
+
     using glTFCommon::shared_ptr;
     using glTFCommon::shared_ptr;
     using glTFCommon::IOSystem;
     using glTFCommon::IOSystem;
     using glTFCommon::IOStream;
     using glTFCommon::IOStream;

+ 1 - 34
code/AssetLib/glTF2/glTF2Asset.h

@@ -62,37 +62,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
 
 
-#ifndef RAPIDJSON_HAS_STDSTRING
-#define RAPIDJSON_HAS_STDSTRING 1
-#endif
-
-#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wclass-memaccess"
-#endif
-
-#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
-#define RAPIDJSON_NOMEMBERITERATORCLASS
-#endif 
-
-#include <rapidjson/document.h>
-#include <rapidjson/error/en.h>
-#include <rapidjson/rapidjson.h>
-
-#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
-#pragma GCC diagnostic pop
-#endif
-
-#ifdef ASSIMP_API
-#include <assimp/ByteSwapper.h>
-#include <assimp/DefaultIOSystem.h>
-#include <memory>
-#else
-#include <memory>
-#define AI_SWAP4(p)
-#define ai_assert
-#endif
-
 #if _MSC_VER > 1500 || (defined __GNUC___)
 #if _MSC_VER > 1500 || (defined __GNUC___)
 #define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
 #define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
 #else
 #else
@@ -112,9 +81,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 #endif
 #endif
 #endif
 
 
-#include <assimp/StringUtils.h>
-
-#include "AssetLib/glTF/glTFCommon.h"
+#include "AssetLib/glTFCommon/glTFCommon.h"
 
 
 namespace glTF2 {
 namespace glTF2 {
 
 

+ 1 - 1
code/AssetLib/glTF2/glTF2Asset.inl

@@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 */
 */
 
 
-#include "AssetLib/glTF/glTFCommon.h"
+#include "AssetLib/glTFCommon/glTFCommon.h"
 
 
 #include <assimp/StringUtils.h>
 #include <assimp/StringUtils.h>
 #include <assimp/DefaultLogger.hpp>
 #include <assimp/DefaultLogger.hpp>

+ 1 - 1
code/AssetLib/glTF/glTFCommon.cpp → code/AssetLib/glTFCommon/glTFCommon.cpp

@@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 */
 */
-#include "AssetLib/glTF/glTFCommon.h"
+#include "AssetLib/glTFCommon/glTFCommon.h"
 
 
 namespace glTFCommon {
 namespace glTFCommon {
 
 

+ 28 - 14
code/AssetLib/glTF/glTFCommon.h → code/AssetLib/glTFCommon/glTFCommon.h

@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
 #ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
 
 
 #include <assimp/Exceptional.h>
 #include <assimp/Exceptional.h>
+#include <assimp/StringUtils.h>
 
 
 #include <algorithm>
 #include <algorithm>
 #include <list>
 #include <list>
@@ -51,36 +52,49 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <stdexcept>
 #include <stdexcept>
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
+#include <set>
+
+#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
+#   pragma GCC diagnostic push
+#   pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
+
 
 
 #define RAPIDJSON_HAS_STDSTRING 1
 #define RAPIDJSON_HAS_STDSTRING 1
 #define RAPIDJSON_NOMEMBERITERATORCLASS
 #define RAPIDJSON_NOMEMBERITERATORCLASS
+
 #include <rapidjson/document.h>
 #include <rapidjson/document.h>
 #include <rapidjson/error/en.h>
 #include <rapidjson/error/en.h>
 #include <rapidjson/rapidjson.h>
 #include <rapidjson/rapidjson.h>
 
 
+#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
+#   pragma GCC diagnostic pop
+#endif
+
 #ifdef ASSIMP_API
 #ifdef ASSIMP_API
-#include <assimp/ByteSwapper.h>
-#include <assimp/DefaultIOSystem.h>
-#include <memory>
+#   include <assimp/ByteSwapper.h>
+#   include <assimp/DefaultIOSystem.h>
+#   include <memory>
 #else
 #else
-#include <memory>
-#define AI_SWAP4(p)
-#define ai_assert
+#   include <memory>
+#   define AI_SWAP4(p)
+#   define ai_assert
 #endif
 #endif
 
 
 #if _MSC_VER > 1500 || (defined __GNUC___)
 #if _MSC_VER > 1500 || (defined __GNUC___)
-#define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
+#   define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
 #else
 #else
-#define gltf_unordered_map map
+#   define gltf_unordered_map map
 #endif
 #endif
 
 
 #ifdef ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
 #ifdef ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
-#include <unordered_map>
-#if _MSC_VER > 1600
-#define gltf_unordered_map unordered_map
-#else
-#define gltf_unordered_map tr1::unordered_map
-#endif
+#   include <unordered_map>
+#   if _MSC_VER > 1600
+#       define gltf_unordered_map unordered_map
+#    else
+#       define gltf_unordered_map tr1::unordered_map
+#       define gltf_unordered_set set
+#    endif
 #endif
 #endif
 
 
 namespace glTFCommon {
 namespace glTFCommon {

+ 2 - 2
code/CMakeLists.txt

@@ -818,8 +818,8 @@ ADD_ASSIMP_IMPORTER( X3D
 )
 )
 
 
 ADD_ASSIMP_IMPORTER( GLTF
 ADD_ASSIMP_IMPORTER( GLTF
-  AssetLib/glTF/glTFCommon.h
-  AssetLib/glTF/glTFCommon.cpp
+  AssetLib/glTFCommon/glTFCommon.h
+  AssetLib/glTFCommon/glTFCommon.cpp
   AssetLib/glTF/glTFAsset.h
   AssetLib/glTF/glTFAsset.h
   AssetLib/glTF/glTFAsset.inl
   AssetLib/glTF/glTFAsset.inl
   AssetLib/glTF/glTFAssetWriter.h
   AssetLib/glTF/glTFAssetWriter.h