您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

280 行
9.4 KiB

  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2012, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file aiDefines.h
  35. * @brief Assimp build configuration setup. See the notes in the comment
  36. * blocks to find out how to customize _your_ Assimp build.
  37. */
  38. #ifndef INCLUDED_AI_DEFINES_H
  39. #define INCLUDED_AI_DEFINES_H
  40. //////////////////////////////////////////////////////////////////////////
  41. /* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific
  42. * file format loader. The loader is be excluded from the
  43. * build in this case. 'XX' stands for the most common file
  44. * extension of the file format. E.g.:
  45. * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader.
  46. *
  47. * If you're unsure about that, take a look at the implementation of the
  48. * import plugin you wish to disable. You'll find the right define in the
  49. * first lines of the corresponding unit.
  50. *
  51. * Other (mixed) configuration switches are listed here:
  52. * ASSIMP_BUILD_NO_COMPRESSED_X
  53. * - Disable support for compressed X files (zip)
  54. * ASSIMP_BUILD_NO_COMPRESSED_BLEND
  55. * - Disable support for compressed Blender files (zip)
  56. * ASSIMP_BUILD_NO_COMPRESSED_IFC
  57. * - Disable support for IFCZIP files (unzip)
  58. */
  59. //////////////////////////////////////////////////////////////////////////
  60. #ifndef ASSIMP_BUILD_NO_COMPRESSED_X
  61. # define ASSIMP_BUILD_NEED_Z_INFLATE
  62. #endif
  63. #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
  64. # define ASSIMP_BUILD_NEED_Z_INFLATE
  65. #endif
  66. #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
  67. # define ASSIMP_BUILD_NEED_Z_INFLATE
  68. # define ASSIMP_BUILD_NEED_UNZIP
  69. #endif
  70. #ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
  71. # define ASSIMP_BUILD_NEED_Z_INFLATE
  72. # define ASSIMP_BUILD_NEED_UNZIP
  73. #endif
  74. //////////////////////////////////////////////////////////////////////////
  75. /* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
  76. * post processing step. This is the current list of process names ('XX'):
  77. * CALCTANGENTS
  78. * JOINVERTICES
  79. * TRIANGULATE
  80. * GENFACENORMALS
  81. * GENVERTEXNORMALS
  82. * REMOVEVC
  83. * SPLITLARGEMESHES
  84. * PRETRANSFORMVERTICES
  85. * LIMITBONEWEIGHTS
  86. * VALIDATEDS
  87. * IMPROVECACHELOCALITY
  88. * FIXINFACINGNORMALS
  89. * REMOVE_REDUNDANTMATERIALS
  90. * OPTIMIZEGRAPH
  91. * SORTBYPTYPE
  92. * FINDINVALIDDATA
  93. * TRANSFORMTEXCOORDS
  94. * GENUVCOORDS
  95. * ENTITYMESHBUILDER
  96. * MAKELEFTHANDED
  97. * FLIPUVS
  98. * FLIPWINDINGORDER
  99. * OPTIMIZEMESHES
  100. * OPTIMIZEANIMS
  101. * OPTIMIZEGRAPH
  102. * GENENTITYMESHES
  103. * FIXTEXTUREPATHS */
  104. //////////////////////////////////////////////////////////////////////////
  105. #ifdef _MSC_VER
  106. # undef ASSIMP_API
  107. //////////////////////////////////////////////////////////////////////////
  108. /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
  109. //////////////////////////////////////////////////////////////////////////
  110. # ifdef ASSIMP_BUILD_DLL_EXPORT
  111. # define ASSIMP_API __declspec(dllexport)
  112. # define ASSIMP_API_WINONLY __declspec(dllexport)
  113. # pragma warning (disable : 4251)
  114. //////////////////////////////////////////////////////////////////////////
  115. /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
  116. * an external DLL under Windows. Default is static linkage. */
  117. //////////////////////////////////////////////////////////////////////////
  118. # elif (defined ASSIMP_DLL)
  119. # define ASSIMP_API __declspec(dllimport)
  120. # define ASSIMP_API_WINONLY __declspec(dllimport)
  121. # else
  122. # define ASSIMP_API
  123. # define ASSIMP_API_WINONLY
  124. # endif
  125. /* Force the compiler to inline a function, if possible
  126. */
  127. # define AI_FORCE_INLINE __forceinline
  128. /* Tells the compiler that a function never returns. Used in code analysis
  129. * to skip dead paths (e.g. after an assertion evaluated to false). */
  130. # define AI_WONT_RETURN __declspec(noreturn)
  131. #elif defined(SWIG)
  132. /* Do nothing, the relevant defines are all in AssimpSwigPort.i */
  133. #else
  134. # define AI_WONT_RETURN
  135. # define ASSIMP_API __attribute__ ((visibility("default")))
  136. # define ASSIMP_API_WINONLY
  137. # define AI_FORCE_INLINE inline
  138. #endif // (defined _MSC_VER)
  139. #ifdef __clang__
  140. # define AI_WONT_RETURN_SUFFIX __attribute__((analyzer_noreturn))
  141. #else
  142. # define AI_WONT_RETURN_SUFFIX
  143. #endif // (defined __clang__)
  144. #ifdef __cplusplus
  145. /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
  146. * in doxydocs.
  147. */
  148. # define C_STRUCT
  149. # define C_ENUM
  150. #else
  151. //////////////////////////////////////////////////////////////////////////
  152. /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
  153. * is defined by Doxygen's preprocessor. The corresponding
  154. * entries in the DOXYFILE are: */
  155. //////////////////////////////////////////////////////////////////////////
  156. #if 0
  157. ENABLE_PREPROCESSING = YES
  158. MACRO_EXPANSION = YES
  159. EXPAND_ONLY_PREDEF = YES
  160. SEARCH_INCLUDES = YES
  161. INCLUDE_PATH =
  162. INCLUDE_FILE_PATTERNS =
  163. PREDEFINED = ASSIMP_DOXYGEN_BUILD=1
  164. EXPAND_AS_DEFINED = C_STRUCT C_ENUM
  165. SKIP_FUNCTION_MACROS = YES
  166. #endif
  167. //////////////////////////////////////////////////////////////////////////
  168. /* Doxygen gets confused if we use c-struct typedefs to avoid
  169. * the explicit 'struct' notation. This trick here has the same
  170. * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
  171. * to typedef all structs/enums. */
  172. //////////////////////////////////////////////////////////////////////////
  173. # if (defined ASSIMP_DOXYGEN_BUILD)
  174. # define C_STRUCT
  175. # define C_ENUM
  176. # else
  177. # define C_STRUCT struct
  178. # define C_ENUM enum
  179. # endif
  180. #endif
  181. #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
  182. #error Currently, Borland is unsupported. Feel free to port Assimp.
  183. // "W8059 Packgröße der Struktur geändert"
  184. #endif
  185. //////////////////////////////////////////////////////////////////////////
  186. /* Define 'ASSIMP_BUILD_BOOST_WORKAROUND' to compile assimp
  187. * without boost. This is done by using a few workaround
  188. * classes and brings some limitations (e.g. some logging won't be done,
  189. * the library won't utilize threads or be threadsafe at all).
  190. * This implies the 'ASSIMP_BUILD_SINGLETHREADED' setting. */
  191. //////////////////////////////////////////////////////////////////////////
  192. #ifdef ASSIMP_BUILD_BOOST_WORKAROUND
  193. // threading support requires boost
  194. #ifndef ASSIMP_BUILD_SINGLETHREADED
  195. # define ASSIMP_BUILD_SINGLETHREADED
  196. #endif
  197. #endif // !! ASSIMP_BUILD_BOOST_WORKAROUND
  198. //////////////////////////////////////////////////////////////////////////
  199. /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
  200. * without threading support. The library doesn't utilize
  201. * threads then and is itself not threadsafe.
  202. * If this flag is specified boost::threads is *not* required. */
  203. //////////////////////////////////////////////////////////////////////////
  204. #ifndef ASSIMP_BUILD_SINGLETHREADED
  205. # define ASSIMP_BUILD_SINGLETHREADED
  206. #endif
  207. #if defined(_DEBUG) || ! defined(NDEBUG)
  208. # define ASSIMP_BUILD_DEBUG
  209. #endif
  210. //////////////////////////////////////////////////////////////////////////
  211. /* Useful constants */
  212. //////////////////////////////////////////////////////////////////////////
  213. /* This is PI. Hi PI. */
  214. #define AI_MATH_PI (3.141592653589793238462643383279 )
  215. #define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
  216. #define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
  217. /* And this is to avoid endless casts to float */
  218. #define AI_MATH_PI_F (3.1415926538f)
  219. #define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
  220. #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
  221. /* Tiny macro to convert from radians to degrees and back */
  222. #define AI_DEG_TO_RAD(x) (x*0.0174532925f)
  223. #define AI_RAD_TO_DEG(x) (x*57.2957795f)
  224. /* Support for big-endian builds */
  225. #if defined(__BYTE_ORDER__)
  226. # if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  227. # if !defined(__BIG_ENDIAN__)
  228. # define __BIG_ENDIAN__
  229. # endif
  230. # else /* little endian */
  231. # if defined (__BIG_ENDIAN__)
  232. # undef __BIG_ENDIAN__
  233. # endif
  234. # endif
  235. #endif
  236. #if defined(__BIG_ENDIAN__)
  237. # define AI_BUILD_BIG_ENDIAN
  238. #endif
  239. #endif // !! INCLUDED_AI_DEFINES_H