瀏覽代碼

Merge pull request #2378 from assimp/issue_1650

Issue 1650
Kim Kulling 6 年之前
父節點
當前提交
0973f504b5
共有 7 個文件被更改,包括 41 次插入26 次删除
  1. 2 1
      CMakeLists.txt
  2. 5 6
      code/CMakeLists.txt
  3. 4 3
      code/glTF2Asset.h
  4. 4 1
      contrib/irrXML/CMakeLists.txt
  5. 9 4
      contrib/irrXML/CXMLReaderImpl.h
  6. 2 2
      contrib/irrXML/irrXML.cpp
  7. 15 9
      contrib/irrXML/irrXML.h

+ 2 - 1
CMakeLists.txt

@@ -67,7 +67,7 @@ OPTION( ASSIMP_NO_EXPORT
 )
 )
 OPTION( ASSIMP_BUILD_ZLIB
 OPTION( ASSIMP_BUILD_ZLIB
   "Build your own zlib"
   "Build your own zlib"
-  OFF
+  OFF  
 )
 )
 OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
 OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
   "If the supplementary tools for Assimp are built in addition to the library."
   "If the supplementary tools for Assimp are built in addition to the library."
@@ -477,6 +477,7 @@ ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
 IF ( ASSIMP_BUILD_SAMPLES)
 IF ( ASSIMP_BUILD_SAMPLES)
   IF ( WIN32 )
   IF ( WIN32 )
     ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ )
     ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ )
+    ADD_SUBDIRECTORY( samples/SimpleTexturedDirectx11 )
   ENDIF ( WIN32 )
   ENDIF ( WIN32 )
   ADD_SUBDIRECTORY( samples/SimpleOpenGL/ )
   ADD_SUBDIRECTORY( samples/SimpleOpenGL/ )
 ENDIF ( ASSIMP_BUILD_SAMPLES )
 ENDIF ( ASSIMP_BUILD_SAMPLES )

+ 5 - 6
code/CMakeLists.txt

@@ -829,12 +829,11 @@ SET( Extra_SRCS
 )
 )
 SOURCE_GROUP( Extra FILES ${Extra_SRCS})
 SOURCE_GROUP( Extra FILES ${Extra_SRCS})
 
 
-
 SET( Clipper_SRCS
 SET( Clipper_SRCS
   ../contrib/clipper/clipper.hpp
   ../contrib/clipper/clipper.hpp
   ../contrib/clipper/clipper.cpp
   ../contrib/clipper/clipper.cpp
 )
 )
-SOURCE_GROUP( Clipper FILES ${Clipper_SRCS})
+SOURCE_GROUP( Contrib\\Clipper FILES ${Clipper_SRCS})
 
 
 SET( Poly2Tri_SRCS
 SET( Poly2Tri_SRCS
   ../contrib/poly2tri/poly2tri/common/shapes.cc
   ../contrib/poly2tri/poly2tri/common/shapes.cc
@@ -849,7 +848,7 @@ SET( Poly2Tri_SRCS
   ../contrib/poly2tri/poly2tri/sweep/sweep_context.cc
   ../contrib/poly2tri/poly2tri/sweep/sweep_context.cc
   ../contrib/poly2tri/poly2tri/sweep/sweep_context.h
   ../contrib/poly2tri/poly2tri/sweep/sweep_context.h
 )
 )
-SOURCE_GROUP( Poly2Tri FILES ${Poly2Tri_SRCS})
+SOURCE_GROUP( Contrib\\Poly2Tri FILES ${Poly2Tri_SRCS})
 
 
 SET( unzip_SRCS
 SET( unzip_SRCS
   ../contrib/unzip/crypt.h
   ../contrib/unzip/crypt.h
@@ -858,7 +857,7 @@ SET( unzip_SRCS
   ../contrib/unzip/unzip.c
   ../contrib/unzip/unzip.c
   ../contrib/unzip/unzip.h
   ../contrib/unzip/unzip.h
 )
 )
-SOURCE_GROUP( unzip FILES ${unzip_SRCS})
+SOURCE_GROUP(Contrib\\unzip FILES ${unzip_SRCS})
 
 
 SET( ziplib_SRCS
 SET( ziplib_SRCS
   ../contrib/zip/src/miniz.h
   ../contrib/zip/src/miniz.h
@@ -890,7 +889,7 @@ SET ( openddl_parser_SRCS
   ../contrib/openddlparser/include/openddlparser/DDLNode.h
   ../contrib/openddlparser/include/openddlparser/DDLNode.h
   ../contrib/openddlparser/include/openddlparser/Value.h
   ../contrib/openddlparser/include/openddlparser/Value.h
 )
 )
-SOURCE_GROUP( openddl_parser FILES ${openddl_parser_SRCS})
+SOURCE_GROUP( Contrib\\openddl_parser FILES ${openddl_parser_SRCS})
 
 
 SET ( open3dgc_SRCS
 SET ( open3dgc_SRCS
   ../contrib/Open3DGC/o3dgcAdjacencyInfo.h
   ../contrib/Open3DGC/o3dgcAdjacencyInfo.h
@@ -923,7 +922,7 @@ SET ( open3dgc_SRCS
   ../contrib/Open3DGC/o3dgcVector.h
   ../contrib/Open3DGC/o3dgcVector.h
   ../contrib/Open3DGC/o3dgcVector.inl
   ../contrib/Open3DGC/o3dgcVector.inl
 )
 )
-SOURCE_GROUP( open3dgc FILES ${open3dgc_SRCS})
+SOURCE_GROUP( Contrib\\open3dgc FILES ${open3dgc_SRCS})
 
 
 # Check dependencies for glTF importer with Open3DGC-compression.
 # Check dependencies for glTF importer with Open3DGC-compression.
 # RT-extensions is used in "contrib/Open3DGC/o3dgcTimer.h" for collecting statistics. Pointed file
 # RT-extensions is used in "contrib/Open3DGC/o3dgcTimer.h" for collecting statistics. Pointed file

+ 4 - 3
code/glTF2Asset.h

@@ -223,7 +223,8 @@ namespace glTF2
         ComponentType_FLOAT = 5126
         ComponentType_FLOAT = 5126
     };
     };
 
 
-    inline unsigned int ComponentTypeSize(ComponentType t)
+    inline
+    unsigned int ComponentTypeSize(ComponentType t)
     {
     {
         switch (t) {
         switch (t) {
             case ComponentType_SHORT:
             case ComponentType_SHORT:
@@ -250,7 +251,7 @@ namespace glTF2
     };
     };
 
 
     //! Values for the Sampler::magFilter field
     //! Values for the Sampler::magFilter field
-    enum class SamplerMagFilter: unsigned int
+    enum class SamplerMagFilter : unsigned int
     {
     {
         UNSET = 0,
         UNSET = 0,
         SamplerMagFilter_Nearest = 9728,
         SamplerMagFilter_Nearest = 9728,
@@ -258,7 +259,7 @@ namespace glTF2
     };
     };
 
 
     //! Values for the Sampler::minFilter field
     //! Values for the Sampler::minFilter field
-    enum class SamplerMinFilter: unsigned int
+    enum class SamplerMinFilter : unsigned int
     {
     {
         UNSET = 0,
         UNSET = 0,
         SamplerMinFilter_Nearest = 9728,
         SamplerMinFilter_Nearest = 9728,

+ 4 - 1
contrib/irrXML/CMakeLists.txt

@@ -13,10 +13,13 @@ if ( MSVC )
   ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
   ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
 endif ( MSVC )
 endif ( MSVC )
 
 
-add_library(IrrXML STATIC ${IrrXML_SRCS})
+add_library(IrrXML ${IrrXML_SRCS})
 set(IRRXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "IrrXML_Include" )
 set(IRRXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "IrrXML_Include" )
 set(IRRXML_LIBRARY "IrrXML" CACHE INTERNAL "IrrXML" )
 set(IRRXML_LIBRARY "IrrXML" CACHE INTERNAL "IrrXML" )
 
 
 install(TARGETS IrrXML
 install(TARGETS IrrXML
+  LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
   ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
   ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
+  RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}
+  FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
   COMPONENT ${LIBASSIMP_COMPONENT})
   COMPONENT ${LIBASSIMP_COMPONENT})

+ 9 - 4
contrib/irrXML/CXMLReaderImpl.h

@@ -10,8 +10,11 @@
 #include "irrArray.h"
 #include "irrArray.h"
 
 
 #include <cassert>
 #include <cassert>
+#include <stdlib.h>    
+#include <cctype>
+#include <cstdint>
+//using namespace Assimp;
 
 
-using namespace Assimp;
 
 
 #ifdef _DEBUG
 #ifdef _DEBUG
 #define IRR_DEBUGPRINT(x) printf((x));
 #define IRR_DEBUGPRINT(x) printf((x));
@@ -162,7 +165,8 @@ public:
 			return 0;
 			return 0;
 
 
 		core::stringc c = attr->Value.c_str();
 		core::stringc c = attr->Value.c_str();
-		return fast_atof(c.c_str());
+        return static_cast<float>(atof(c.c_str()));
+        //return fast_atof(c.c_str());
 	}
 	}
 
 
 
 
@@ -174,7 +178,8 @@ public:
 			return 0;
 			return 0;
 
 
 		core::stringc c = attrvalue;
 		core::stringc c = attrvalue;
-		return fast_atof(c.c_str());
+        return static_cast<float>(atof(c.c_str()));
+		//return fast_atof(c.c_str());
 	}
 	}
 
 
 
 
@@ -428,7 +433,7 @@ private:
 			++P;
 			++P;
 
 
     // remove trailing whitespace, if any
     // remove trailing whitespace, if any
-    while( isspace( P[-1]))
+    while( std::isspace( P[-1]))
       --P;
       --P;
 
 
 		NodeName = core::string<char_type>(pBeginClose, (int)(P - pBeginClose));
 		NodeName = core::string<char_type>(pBeginClose, (int)(P - pBeginClose));

+ 2 - 2
contrib/irrXML/irrXML.cpp

@@ -9,7 +9,7 @@
 #include "irrXML.h"
 #include "irrXML.h"
 #include "irrString.h"
 #include "irrString.h"
 #include "irrArray.h"
 #include "irrArray.h"
-#include <assimp/fast_atof.h>
+//#include <assimp/fast_atof.h>
 #include "CXMLReaderImpl.h"
 #include "CXMLReaderImpl.h"
 
 
 namespace irr
 namespace irr
@@ -18,7 +18,7 @@ namespace io
 {
 {
 
 
 //! Implementation of the file read callback for ordinary files
 //! Implementation of the file read callback for ordinary files
-class CFileReadCallBack : public IFileReadCallBack
+class IRRXML_API CFileReadCallBack : public IFileReadCallBack
 {
 {
 public:
 public:
 
 

+ 15 - 9
contrib/irrXML/irrXML.h

@@ -7,6 +7,12 @@
 
 
 #include <stdio.h>
 #include <stdio.h>
 
 
+#ifdef _WIN32
+#   define IRRXML_API __declspec(dllexport)
+#else
+#   define IRRXML_API __attribute__ ((visibility("default")))
+#endif // _WIN32
+
 /** \mainpage irrXML 1.2 API documentation
 /** \mainpage irrXML 1.2 API documentation
  <div align="center"><img src="logobig.png" ></div>
  <div align="center"><img src="logobig.png" ></div>
 
 
@@ -409,7 +415,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReader* createIrrXMLReader(const char* filename);
+    IRRXML_API IrrXMLReader* createIrrXMLReader(const char* filename);
 
 
 	//! Creates an instance of an UFT-8 or ASCII character xml parser.
 	//! Creates an instance of an UFT-8 or ASCII character xml parser.
 	/** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can 
 	/** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can 
@@ -421,7 +427,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReader* createIrrXMLReader(FILE* file);
+    IRRXML_API IrrXMLReader* createIrrXMLReader(FILE* file);
 
 
 	//! Creates an instance of an UFT-8 or ASCII character xml parser. 
 	//! Creates an instance of an UFT-8 or ASCII character xml parser. 
 	/** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can 
 	/** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can 
@@ -434,7 +440,7 @@ namespace io
 	 \return Returns a pointer to the created xml parser. This pointer should be 
 	 \return Returns a pointer to the created xml parser. This pointer should be 
 	 deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	 deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	 and the file could not be opened. */
 	 and the file could not be opened. */
-	IrrXMLReader* createIrrXMLReader(IFileReadCallBack* callback);
+    IRRXML_API IrrXMLReader* createIrrXMLReader(IFileReadCallBack* callback);
 
 
 	//! Creates an instance of an UFT-16 xml parser. 
 	//! Creates an instance of an UFT-16 xml parser. 
 	/** This means that
 	/** This means that
@@ -446,7 +452,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReaderUTF16* createIrrXMLReaderUTF16(const char* filename);
+    IRRXML_API IrrXMLReaderUTF16* createIrrXMLReaderUTF16(const char* filename);
 
 
 	//! Creates an instance of an UFT-16 xml parser. 
 	//! Creates an instance of an UFT-16 xml parser. 
 	/** This means that all character data will be returned in UTF-16. The file to read can 
 	/** This means that all character data will be returned in UTF-16. The file to read can 
@@ -458,7 +464,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReaderUTF16* createIrrXMLReaderUTF16(FILE* file);
+    IRRXML_API IrrXMLReaderUTF16* createIrrXMLReaderUTF16(FILE* file);
 
 
 	//! Creates an instance of an UFT-16 xml parser. 
 	//! Creates an instance of an UFT-16 xml parser. 
 	/** This means that all character data will be returned in UTF-16. The file to read can 
 	/** This means that all character data will be returned in UTF-16. The file to read can 
@@ -471,7 +477,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReaderUTF16* createIrrXMLReaderUTF16(IFileReadCallBack* callback);
+    IRRXML_API IrrXMLReaderUTF16* createIrrXMLReaderUTF16(IFileReadCallBack* callback);
 
 
 
 
 	//! Creates an instance of an UFT-32 xml parser. 
 	//! Creates an instance of an UFT-32 xml parser. 
@@ -483,7 +489,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReaderUTF32* createIrrXMLReaderUTF32(const char* filename);
+    IRRXML_API IrrXMLReaderUTF32* createIrrXMLReaderUTF32(const char* filename);
 
 
 	//! Creates an instance of an UFT-32 xml parser. 
 	//! Creates an instance of an UFT-32 xml parser. 
 	/** This means that all character data will be returned in UTF-32. The file to read can 
 	/** This means that all character data will be returned in UTF-32. The file to read can 
@@ -495,7 +501,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReaderUTF32* createIrrXMLReaderUTF32(FILE* file);
+    IRRXML_API IrrXMLReaderUTF32* createIrrXMLReaderUTF32(FILE* file);
 
 
 	//! Creates an instance of an UFT-32 xml parser. 
 	//! Creates an instance of an UFT-32 xml parser. 
 	/** This means that
 	/** This means that
@@ -509,7 +515,7 @@ namespace io
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	\return Returns a pointer to the created xml parser. This pointer should be 
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	deleted using 'delete' after no longer needed. Returns 0 if an error occured
 	and the file could not be opened. */
 	and the file could not be opened. */
-	IrrXMLReaderUTF32* createIrrXMLReaderUTF32(IFileReadCallBack* callback);
+    IRRXML_API IrrXMLReaderUTF32* createIrrXMLReaderUTF32(IFileReadCallBack* callback);
 	
 	
 
 
 	/*! \file irrxml.h
 	/*! \file irrxml.h