aiDefines.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2010, ASSIMP Development 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 Development 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. # pragma warning (disable : 4251)
  102. //////////////////////////////////////////////////////////////////////////
  103. /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
  104. * an external DLL under Windows. Default is static linkage. */
  105. //////////////////////////////////////////////////////////////////////////
  106. # elif (defined ASSIMP_DLL)
  107. # define ASSIMP_API __declspec(dllimport)
  108. # else
  109. # define ASSIMP_API
  110. # endif
  111. /* Force the compiler to inline a function, if possible
  112. */
  113. # define AI_FORCE_INLINE __forceinline
  114. /* Tells the compiler that a function never returns. Used in code analysis
  115. * to skip dead paths (e.g. after an assertion evaluated to false). */
  116. # define AI_WONT_RETURN __declspec(noreturn)
  117. #else
  118. # define AI_WONT_RETURN
  119. # define ASSIMP_API
  120. # define AI_FORCE_INLINE inline
  121. #endif // (defined _MSC_VER)
  122. #ifdef __cplusplus
  123. /* No explicit 'struct' and 'enum' tags for C++, we don't want to
  124. * confuse the _AI_ of our IDE.
  125. */
  126. # define C_STRUCT
  127. # define C_ENUM
  128. #else
  129. //////////////////////////////////////////////////////////////////////////
  130. /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
  131. * is defined by Doxygen's preprocessor. The corresponding
  132. * entries in the DOXYFILE are: */
  133. //////////////////////////////////////////////////////////////////////////
  134. #if 0
  135. ENABLE_PREPROCESSING = YES
  136. MACRO_EXPANSION = YES
  137. EXPAND_ONLY_PREDEF = YES
  138. SEARCH_INCLUDES = YES
  139. INCLUDE_PATH =
  140. INCLUDE_FILE_PATTERNS =
  141. PREDEFINED = ASSIMP_DOXYGEN_BUILD=1
  142. EXPAND_AS_DEFINED = C_STRUCT C_ENUM
  143. SKIP_FUNCTION_MACROS = YES
  144. #endif
  145. //////////////////////////////////////////////////////////////////////////
  146. /* Doxygen gets confused if we use c-struct typedefs to avoid
  147. * the explicit 'struct' notation. This trick here has the same
  148. * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
  149. * to typedef all structs/enums. */
  150. //////////////////////////////////////////////////////////////////////////
  151. # if (defined ASSIMP_DOXYGEN_BUILD)
  152. # define C_STRUCT
  153. # define C_ENUM
  154. # else
  155. # define C_STRUCT struct
  156. # define C_ENUM enum
  157. # endif
  158. #endif
  159. #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
  160. #error Currently, Borland is unsupported. Feel free to port Assimp.
  161. // "W8059 Packgröße der Struktur geändert"
  162. #endif
  163. //////////////////////////////////////////////////////////////////////////
  164. /* Define 'ASSIMP_BUILD_BOOST_WORKAROUND' to compile assimp
  165. * without boost. This is done by using a few workaround
  166. * classes and brings some limitations (e.g. some logging won't be done,
  167. * the library won't utilize threads or be threadsafe at all).
  168. * This implies the 'ASSIMP_BUILD_SINGLETHREADED' setting. */
  169. //////////////////////////////////////////////////////////////////////////
  170. #ifdef ASSIMP_BUILD_BOOST_WORKAROUND
  171. // threading support requires boost
  172. #ifndef ASSIMP_BUILD_SINGLETHREADED
  173. # define ASSIMP_BUILD_SINGLETHREADED
  174. #endif
  175. #endif // !! ASSIMP_BUILD_BOOST_WORKAROUND
  176. //////////////////////////////////////////////////////////////////////////
  177. /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
  178. * without threading support. The library doesn't utilize
  179. * threads then and is itself not threadsafe.
  180. * If this flag is specified boost::threads is *not* required. */
  181. //////////////////////////////////////////////////////////////////////////
  182. #ifndef ASSIMP_BUILD_SINGLETHREADED
  183. # define ASSIMP_BUILD_SINGLETHREADED
  184. #endif
  185. #ifndef ASSIMP_BUILD_SINGLETHREADED
  186. # define AI_C_THREADSAFE
  187. #endif // !! ASSIMP_BUILD_SINGLETHREADED
  188. #ifdef _DEBUG
  189. # define ASSIMP_BUILD_DEBUG
  190. #endif
  191. //////////////////////////////////////////////////////////////////////////
  192. /* ASSIMP_BUILD_XXXX_NNBIT_ARCHITECTURE */
  193. //////////////////////////////////////////////////////////////////////////
  194. #if defined(_MSC_VER)
  195. // See http://msdn.microsoft.com/en-us/library/b0084kay.
  196. # if defined(_M_IX86)
  197. # define ASSIMP_BUILD_X86_32BIT_ARCHITECTURE
  198. # elif defined(_M_X64)
  199. # define ASSIMP_BUILD_X86_64BIT_ARCHITECTURE
  200. # elif defined(_M_IA64)
  201. # define ASSIMP_BUILD_IA_64BIT_ARCHITECTURE
  202. # else
  203. # error unknown architecture
  204. # endif
  205. #elif defined(__GNUC__)
  206. // See http://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html.
  207. # if defined(__x86_32__) || defined(__i386__)
  208. # define ASSIMP_BUILD_X86_32BIT_ARCHITECTURE
  209. # elif defined(__x86_64__)
  210. # define ASSIMP_BUILD_X86_64BIT_ARCHITECTURE
  211. # elif defined(__ppc__)
  212. # define ASSIMP_BUILD_PPC_32BIT_ARCHITECTURE
  213. # elif defined(__arm__)
  214. # define ASSIMP_BUILD_ARM_32BIT_ARCHITECTURE
  215. # else
  216. # error "unknown architecture"
  217. # endif
  218. #else
  219. # error unknown compiler
  220. #endif
  221. //////////////////////////////////////////////////////////////////////////
  222. /* Useful constants */
  223. //////////////////////////////////////////////////////////////////////////
  224. /* This is PI. Hi PI. */
  225. #define AI_MATH_PI (3.141592653589793238462643383279 )
  226. #define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
  227. #define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
  228. /* And this is to avoid endless casts to float */
  229. #define AI_MATH_PI_F (3.1415926538f)
  230. #define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
  231. #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
  232. /* Tiny macro to convert from radians to degrees and back */
  233. #define AI_DEG_TO_RAD(x) (x*0.0174532925f)
  234. #define AI_RAD_TO_DEG(x) (x*57.2957795f)
  235. /* Support for big-endian builds on Mac OS X. */
  236. #if defined(__APPLE__) && defined(__BIG_ENDIAN__)
  237. #define AI_BUILD_BIG_ENDIAN
  238. #endif
  239. #endif // !! INCLUDED_AI_DEFINES_H