defs.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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
  54. * ASSIMP_BUILD_NO_COMPRESSED_BLEND
  55. * - Disable support for compressed Blender files*/
  56. //////////////////////////////////////////////////////////////////////////
  57. #ifndef ASSIMP_BUILD_NO_COMPRESSED_X
  58. # define ASSIMP_BUILD_NEED_Z_INFLATE
  59. #endif
  60. #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
  61. # define ASSIMP_BUILD_NEED_Z_INFLATE
  62. #endif
  63. //////////////////////////////////////////////////////////////////////////
  64. /* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
  65. * post processing step. This is the current list of process names ('XX'):
  66. * CALCTANGENTS
  67. * JOINVERTICES
  68. * TRIANGULATE
  69. * GENFACENORMALS
  70. * GENVERTEXNORMALS
  71. * REMOVEVC
  72. * SPLITLARGEMESHES
  73. * PRETRANSFORMVERTICES
  74. * LIMITBONEWEIGHTS
  75. * VALIDATEDS
  76. * IMPROVECACHELOCALITY
  77. * FIXINFACINGNORMALS
  78. * REMOVE_REDUNDANTMATERIALS
  79. * OPTIMIZEGRAPH
  80. * SORTBYPTYPE
  81. * FINDINVALIDDATA
  82. * TRANSFORMTEXCOORDS
  83. * GENUVCOORDS
  84. * ENTITYMESHBUILDER
  85. * MAKELEFTHANDED
  86. * FLIPUVS
  87. * FLIPWINDINGORDER
  88. * OPTIMIZEMESHES
  89. * OPTIMIZEANIMS
  90. * OPTIMIZEGRAPH
  91. * GENENTITYMESHES
  92. * FIXTEXTUREPATHS */
  93. //////////////////////////////////////////////////////////////////////////
  94. #ifdef _MSC_VER
  95. # undef ASSIMP_API
  96. //////////////////////////////////////////////////////////////////////////
  97. /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
  98. //////////////////////////////////////////////////////////////////////////
  99. # ifdef ASSIMP_BUILD_DLL_EXPORT
  100. # define ASSIMP_API __declspec(dllexport)
  101. # define ASSIMP_API_WINONLY __declspec(dllexport)
  102. # pragma warning (disable : 4251)
  103. //////////////////////////////////////////////////////////////////////////
  104. /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
  105. * an external DLL under Windows. Default is static linkage. */
  106. //////////////////////////////////////////////////////////////////////////
  107. # elif (defined ASSIMP_DLL)
  108. # define ASSIMP_API __declspec(dllimport)
  109. # define ASSIMP_API_WINONLY __declspec(dllimport)
  110. # else
  111. # define ASSIMP_API
  112. # define ASSIMP_API_WINONLY
  113. # endif
  114. /* Force the compiler to inline a function, if possible
  115. */
  116. # define AI_FORCE_INLINE __forceinline
  117. /* Tells the compiler that a function never returns. Used in code analysis
  118. * to skip dead paths (e.g. after an assertion evaluated to false). */
  119. # define AI_WONT_RETURN __declspec(noreturn)
  120. #else
  121. # define AI_WONT_RETURN
  122. # define ASSIMP_API __attribute__ ((visibility("default")))
  123. # define ASSIMP_API_WINONLY
  124. # define AI_FORCE_INLINE inline
  125. #endif // (defined _MSC_VER)
  126. #ifdef __cplusplus
  127. /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
  128. * in doxydocs.
  129. */
  130. # define C_STRUCT
  131. # define C_ENUM
  132. #else
  133. //////////////////////////////////////////////////////////////////////////
  134. /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
  135. * is defined by Doxygen's preprocessor. The corresponding
  136. * entries in the DOXYFILE are: */
  137. //////////////////////////////////////////////////////////////////////////
  138. #if 0
  139. ENABLE_PREPROCESSING = YES
  140. MACRO_EXPANSION = YES
  141. EXPAND_ONLY_PREDEF = YES
  142. SEARCH_INCLUDES = YES
  143. INCLUDE_PATH =
  144. INCLUDE_FILE_PATTERNS =
  145. PREDEFINED = ASSIMP_DOXYGEN_BUILD=1
  146. EXPAND_AS_DEFINED = C_STRUCT C_ENUM
  147. SKIP_FUNCTION_MACROS = YES
  148. #endif
  149. //////////////////////////////////////////////////////////////////////////
  150. /* Doxygen gets confused if we use c-struct typedefs to avoid
  151. * the explicit 'struct' notation. This trick here has the same
  152. * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
  153. * to typedef all structs/enums. */
  154. //////////////////////////////////////////////////////////////////////////
  155. # if (defined ASSIMP_DOXYGEN_BUILD)
  156. # define C_STRUCT
  157. # define C_ENUM
  158. # else
  159. # define C_STRUCT struct
  160. # define C_ENUM enum
  161. # endif
  162. #endif
  163. #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
  164. #error Currently, Borland is unsupported. Feel free to port Assimp.
  165. // "W8059 Packgröße der Struktur geändert"
  166. #endif
  167. //////////////////////////////////////////////////////////////////////////
  168. /* Define 'ASSIMP_BUILD_BOOST_WORKAROUND' to compile assimp
  169. * without boost. This is done by using a few workaround
  170. * classes and brings some limitations (e.g. some logging won't be done,
  171. * the library won't utilize threads or be threadsafe at all).
  172. * This implies the 'ASSIMP_BUILD_SINGLETHREADED' setting. */
  173. //////////////////////////////////////////////////////////////////////////
  174. #ifdef ASSIMP_BUILD_BOOST_WORKAROUND
  175. // threading support requires boost
  176. #ifndef ASSIMP_BUILD_SINGLETHREADED
  177. # define ASSIMP_BUILD_SINGLETHREADED
  178. #endif
  179. #endif // !! ASSIMP_BUILD_BOOST_WORKAROUND
  180. //////////////////////////////////////////////////////////////////////////
  181. /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
  182. * without threading support. The library doesn't utilize
  183. * threads then and is itself not threadsafe.
  184. * If this flag is specified boost::threads is *not* required. */
  185. //////////////////////////////////////////////////////////////////////////
  186. #ifndef ASSIMP_BUILD_SINGLETHREADED
  187. # define ASSIMP_BUILD_SINGLETHREADED
  188. #endif
  189. #ifndef ASSIMP_BUILD_SINGLETHREADED
  190. # define AI_C_THREADSAFE
  191. #endif // !! ASSIMP_BUILD_SINGLETHREADED
  192. #ifdef _DEBUG
  193. # define ASSIMP_BUILD_DEBUG
  194. #endif
  195. //////////////////////////////////////////////////////////////////////////
  196. /* Useful constants */
  197. //////////////////////////////////////////////////////////////////////////
  198. /* This is PI. Hi PI. */
  199. #define AI_MATH_PI (3.141592653589793238462643383279 )
  200. #define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
  201. #define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
  202. /* And this is to avoid endless casts to float */
  203. #define AI_MATH_PI_F (3.1415926538f)
  204. #define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
  205. #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
  206. /* Tiny macro to convert from radians to degrees and back */
  207. #define AI_DEG_TO_RAD(x) (x*0.0174532925f)
  208. #define AI_RAD_TO_DEG(x) (x*57.2957795f)
  209. /* Support for big-endian builds */
  210. #if defined(__BYTE_ORDER__)
  211. # if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  212. # if !defined(__BIG_ENDIAN__)
  213. # define __BIG_ENDIAN__
  214. # endif
  215. # else /* little endian */
  216. # if defined (__BIG_ENDIAN__)
  217. # undef __BIG_ENDIAN__
  218. # endif
  219. # endif
  220. #endif
  221. #if defined(__BIG_ENDIAN__)
  222. # define AI_BUILD_BIG_ENDIAN
  223. #endif
  224. #endif // !! INCLUDED_AI_DEFINES_H