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