|
|
|||
File indexing completed on 2026-03-29 07:58:15
0001 /* 0002 --------------------------------------------------------------------------- 0003 Open Asset Import Library (assimp) 0004 --------------------------------------------------------------------------- 0005 0006 Copyright (c) 2006-2025, assimp team 0007 0008 All rights reserved. 0009 0010 Redistribution and use of this software in source and binary forms, 0011 with or without modification, are permitted provided that the following 0012 conditions are met: 0013 0014 * Redistributions of source code must retain the above 0015 copyright notice, this list of conditions and the 0016 following disclaimer. 0017 0018 * Redistributions in binary form must reproduce the above 0019 copyright notice, this list of conditions and the 0020 following disclaimer in the documentation and/or other 0021 materials provided with the distribution. 0022 0023 * Neither the name of the assimp team, nor the names of its 0024 contributors may be used to endorse or promote products 0025 derived from this software without specific prior 0026 written permission of the assimp team. 0027 0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0039 --------------------------------------------------------------------------- 0040 */ 0041 0042 /** @file defs.h 0043 * @brief Assimp build configuration setup. See the notes in the comment 0044 * blocks to find out how to customize _your_ Assimp build. 0045 */ 0046 0047 #pragma once 0048 #ifndef AI_DEFINES_H_INC 0049 #define AI_DEFINES_H_INC 0050 0051 #ifdef __GNUC__ 0052 # pragma GCC system_header 0053 #endif 0054 0055 #include <assimp/config.h> 0056 0057 ////////////////////////////////////////////////////////////////////////// 0058 /** 0059 * @brief Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific file format loader. 0060 * 0061 * The loader is be excluded from the 0062 * build in this case. 'XX' stands for the most common file 0063 * extension of the file format. E.g.: 0064 * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader. 0065 * 0066 * If you're unsure about that, take a look at the implementation of the 0067 * import plugin you wish to disable. You'll find the right define in the 0068 * first lines of the corresponding unit. 0069 * 0070 * Other (mixed) configuration switches are listed here: 0071 * ASSIMP_BUILD_NO_COMPRESSED_X 0072 * - Disable support for compressed X files (zip) 0073 * ASSIMP_BUILD_NO_COMPRESSED_BLEND 0074 * - Disable support for compressed Blender files (zip) 0075 * ASSIMP_BUILD_NO_COMPRESSED_IFC 0076 * - Disable support for IFCZIP files (unzip) 0077 */ 0078 ////////////////////////////////////////////////////////////////////////// 0079 0080 #ifndef ASSIMP_BUILD_NO_COMPRESSED_X 0081 # define ASSIMP_BUILD_NEED_Z_INFLATE 0082 #endif 0083 0084 #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND 0085 # define ASSIMP_BUILD_NEED_Z_INFLATE 0086 #endif 0087 0088 #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC 0089 # define ASSIMP_BUILD_NEED_Z_INFLATE 0090 # define ASSIMP_BUILD_NEED_UNZIP 0091 #endif 0092 0093 #ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER 0094 # define ASSIMP_BUILD_NEED_Z_INFLATE 0095 # define ASSIMP_BUILD_NEED_UNZIP 0096 #endif 0097 0098 /** 0099 * @brief We need those constants, workaround for any platforms where nobody defined them yet. 0100 */ 0101 #if (!defined SIZE_MAX) 0102 # define SIZE_MAX (~((size_t)0)) 0103 #endif 0104 0105 ////////////////////////////////////////////////////////////////////////// 0106 /** @brief Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific 0107 * 0108 * post processing step. This is the current list of process names ('XX'): 0109 * CALCTANGENTS 0110 * JOINVERTICES 0111 * TRIANGULATE 0112 * DROPFACENORMALS 0113 * GENFACENORMALS 0114 * GENVERTEXNORMALS 0115 * REMOVEVC 0116 * SPLITLARGEMESHES 0117 * PRETRANSFORMVERTICES 0118 * LIMITBONEWEIGHTS 0119 * VALIDATEDS 0120 * IMPROVECACHELOCALITY 0121 * FIXINFACINGNORMALS 0122 * REMOVE_REDUNDANTMATERIALS 0123 * OPTIMIZEGRAPH 0124 * SORTBYPTYPE 0125 * FINDINVALIDDATA 0126 * TRANSFORMTEXCOORDS 0127 * GENUVCOORDS 0128 * ENTITYMESHBUILDER 0129 * EMBEDTEXTURES 0130 * MAKELEFTHANDED 0131 * FLIPUVS 0132 * FLIPWINDINGORDER 0133 * OPTIMIZEMESHES 0134 * OPTIMIZEANIMS 0135 * OPTIMIZEGRAPH 0136 * GENENTITYMESHES 0137 * FIXTEXTUREPATHS 0138 * GENBOUNDINGBOXES 0139 */ 0140 0141 ////////////////////////////////////////////////////////////////////////// 0142 /** @brief Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library 0143 * 0144 * Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in 0145 * an external DLL under Windows. Default is static linkage. 0146 */ 0147 ////////////////////////////////////////////////////////////////////////// 0148 #ifdef _WIN32 0149 # undef ASSIMP_API 0150 # ifdef ASSIMP_BUILD_DLL_EXPORT 0151 # define ASSIMP_API __declspec(dllexport) 0152 # define ASSIMP_API_WINONLY __declspec(dllexport) 0153 # elif (defined ASSIMP_DLL) 0154 # define ASSIMP_API __declspec(dllimport) 0155 # define ASSIMP_API_WINONLY __declspec(dllimport) 0156 # else 0157 # define ASSIMP_API 0158 # define ASSIMP_API_WINONLY 0159 # endif 0160 #else 0161 # define ASSIMP_API __attribute__((visibility("default"))) 0162 # define ASSIMP_API_WINONLY 0163 #endif // _WIN32 0164 0165 /** 0166 * @brief Helper macros 0167 * 0168 * @def AI_FORCE_INLINE 0169 * @brief Force the compiler to inline a function, if possible 0170 * 0171 * @def AI_WONT_RETURN 0172 * @brief Tells the compiler that a function never returns. 0173 * 0174 * Used in code analysis to skip dead paths (e.g. after an assertion evaluated to false). 0175 */ 0176 #ifdef _MSC_VER 0177 #pragma warning(disable : 4521 4512 4714 4127 4510) 0178 #if _MSC_VER < 1900 0179 #pragma warning(disable : 4351) 0180 #endif 0181 #ifdef ASSIMP_BUILD_DLL_EXPORT 0182 #pragma warning(disable : 4251) 0183 #endif 0184 #define AI_FORCE_INLINE inline 0185 #define AI_WONT_RETURN __declspec(noreturn) 0186 #elif defined(SWIG) 0187 /* Do nothing, the relevant defines are all in AssimpSwigPort.i */ 0188 #else 0189 #define AI_WONT_RETURN 0190 #define AI_FORCE_INLINE inline 0191 #endif // (defined _MSC_VER) 0192 0193 #ifdef __GNUC__ 0194 # define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) 0195 #elif _MSC_VER 0196 #if defined(__clang__) 0197 # define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) 0198 #else 0199 # define AI_WONT_RETURN_SUFFIX 0200 #endif 0201 #else 0202 # define AI_WONT_RETURN_SUFFIX 0203 #endif // (defined __clang__) 0204 0205 #ifdef __cplusplus 0206 /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up 0207 * in doxydocs. */ 0208 #define C_STRUCT 0209 #define C_ENUM 0210 #else 0211 ////////////////////////////////////////////////////////////////////////// 0212 /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD 0213 * is defined by Doxygen's preprocessor. The corresponding 0214 * entries in the DOXYFILE are: */ 0215 ////////////////////////////////////////////////////////////////////////// 0216 #if 0 0217 ENABLE_PREPROCESSING = YES 0218 MACRO_EXPANSION = YES 0219 EXPAND_ONLY_PREDEF = YES 0220 SEARCH_INCLUDES = YES 0221 INCLUDE_PATH = 0222 INCLUDE_FILE_PATTERNS = 0223 PREDEFINED = ASSIMP_DOXYGEN_BUILD=1 0224 EXPAND_AS_DEFINED = C_STRUCT C_ENUM 0225 SKIP_FUNCTION_MACROS = YES 0226 #endif 0227 ////////////////////////////////////////////////////////////////////////// 0228 /* Doxygen gets confused if we use c-struct typedefs to avoid 0229 * the explicit 'struct' notation. This trick here has the same 0230 * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need 0231 * to typedef all structs/enums. */ 0232 ////////////////////////////////////////////////////////////////////////// 0233 #if (defined ASSIMP_DOXYGEN_BUILD) 0234 # define C_STRUCT 0235 # define C_ENUM 0236 #else 0237 # define C_STRUCT struct 0238 # define C_ENUM enum 0239 #endif 0240 #endif 0241 0242 #if (defined(__BORLANDC__) || defined(__BCPLUSPLUS__)) 0243 # error Currently, Borland is unsupported. Feel free to port Assimp. 0244 #endif 0245 0246 ////////////////////////////////////////////////////////////////////////// 0247 /** 0248 * Define ASSIMP_BUILD_SINGLETHREADED to compile assimp 0249 * without threading support. The library doesn't utilize 0250 * threads then and is itself not threadsafe. 0251 */ 0252 ////////////////////////////////////////////////////////////////////////// 0253 #ifndef ASSIMP_BUILD_SINGLETHREADED 0254 # define ASSIMP_BUILD_SINGLETHREADED 0255 #endif 0256 0257 #if defined(_DEBUG) || !defined(NDEBUG) 0258 # define ASSIMP_BUILD_DEBUG 0259 #endif 0260 0261 ////////////////////////////////////////////////////////////////////////// 0262 /* Define ASSIMP_DOUBLE_PRECISION to compile assimp 0263 * with double precision support (64-bit). */ 0264 ////////////////////////////////////////////////////////////////////////// 0265 0266 #ifdef ASSIMP_DOUBLE_PRECISION 0267 typedef double ai_real; 0268 typedef signed long long int ai_int; 0269 typedef unsigned long long int ai_uint; 0270 #ifndef ASSIMP_AI_REAL_TEXT_PRECISION 0271 #define ASSIMP_AI_REAL_TEXT_PRECISION 17 0272 #endif // ASSIMP_AI_REAL_TEXT_PRECISION 0273 #else // ASSIMP_DOUBLE_PRECISION 0274 typedef float ai_real; 0275 typedef signed int ai_int; 0276 typedef unsigned int ai_uint; 0277 #ifndef ASSIMP_AI_REAL_TEXT_PRECISION 0278 #define ASSIMP_AI_REAL_TEXT_PRECISION 9 0279 #endif // ASSIMP_AI_REAL_TEXT_PRECISION 0280 #endif // ASSIMP_DOUBLE_PRECISION 0281 0282 ////////////////////////////////////////////////////////////////////////// 0283 /* Useful constants */ 0284 ////////////////////////////////////////////////////////////////////////// 0285 0286 /* This is PI. Hi PI. */ 0287 #define AI_MATH_PI (3.141592653589793238462643383279) 0288 #define AI_MATH_TWO_PI (AI_MATH_PI * 2.0) 0289 #define AI_MATH_HALF_PI (AI_MATH_PI * 0.5) 0290 0291 /* And this is to avoid endless casts to float */ 0292 #define AI_MATH_PI_F (3.1415926538f) 0293 #define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f) 0294 #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f) 0295 0296 /* Tiny macro to convert from radians to degrees and back */ 0297 #define AI_DEG_TO_RAD(x) ((x) * (ai_real) 0.0174532925) 0298 #define AI_RAD_TO_DEG(x) ((x) * (ai_real) 57.2957795) 0299 0300 /* Numerical limits */ 0301 #ifdef __cplusplus 0302 constexpr ai_real ai_epsilon = (ai_real) 1e-6; 0303 #else 0304 # define ai_epsilon ((ai_real)1e-6) 0305 #endif 0306 0307 /** 0308 * @brief Support for big-endian builds 0309 * 0310 * This will check which byte ordering is used on the target architecture. 0311 */ 0312 #if defined(__BYTE_ORDER__) 0313 # if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 0314 # if !defined(__BIG_ENDIAN__) 0315 # define __BIG_ENDIAN__ 0316 # endif 0317 # else /* little endian */ 0318 # if defined(__BIG_ENDIAN__) 0319 # undef __BIG_ENDIAN__ 0320 # endif 0321 # endif 0322 #endif 0323 #if defined(__BIG_ENDIAN__) 0324 # define AI_BUILD_BIG_ENDIAN 0325 #endif 0326 0327 /** 0328 * @brief To avoid running out of memory 0329 * 0330 * This can be adjusted for specific use cases 0331 * It's NOT a total limit, just a limit for individual allocations 0332 */ 0333 #define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type)) 0334 0335 #ifndef _MSC_VER 0336 # if __cplusplus >= 201103L // C++11 0337 # define AI_NO_EXCEPT noexcept 0338 # else 0339 # define AI_NO_EXCEPT 0340 # endif 0341 #else 0342 # if (_MSC_VER >= 1915) 0343 # define AI_NO_EXCEPT noexcept 0344 # else 0345 # define AI_NO_EXCEPT 0346 # endif 0347 #endif // _MSC_VER 0348 0349 /** 0350 * @brief Helper macro to set a pointer to NULL in debug builds 0351 */ 0352 #if (defined ASSIMP_BUILD_DEBUG) 0353 # define AI_DEBUG_INVALIDATE_PTR(x) x = NULL; 0354 #else 0355 # define AI_DEBUG_INVALIDATE_PTR(x) 0356 #endif 0357 0358 #define AI_COUNT_OF(X) (sizeof(X) / sizeof((X)[0])) 0359 0360 /** 0361 * @brief Will mark functions or classes as deprecated. 0362 * 0363 * Deprecation means that we will remove this function, class or methods in the next m 0364 */ 0365 #if defined(__GNUC__) || defined(__clang__) 0366 # define AI_DEPRECATED __attribute__((deprecated)) 0367 #elif defined(_MSC_VER) 0368 # define AI_DEPRECATED __declspec(deprecated) 0369 #else 0370 # pragma message("WARNING: You need to implement DEPRECATED for this compiler") 0371 # define AI_DEPRECATED 0372 #endif 0373 0374 #endif // !! AI_DEFINES_H_INC
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|