miniassimp

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