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