miniassimp

view include/miniassimp/defs.h @ 0:879c81d94345

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