Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:30:08

0001 /*
0002 ---------------------------------------------------------------------------
0003 Open Asset Import Library (assimp)
0004 ---------------------------------------------------------------------------
0005 
0006 Copyright (c) 2006-2024, 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 /* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific
0059  * file format loader. The loader is be excluded from the
0060  * build in this case. 'XX' stands for the most common file
0061  * extension of the file format. E.g.:
0062  * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader.
0063  *
0064  * If you're unsure about that, take a look at the implementation of the
0065  * import plugin you wish to disable. You'll find the right define in the
0066  * first lines of the corresponding unit.
0067  *
0068  * Other (mixed) configuration switches are listed here:
0069  *    ASSIMP_BUILD_NO_COMPRESSED_X
0070  *      - Disable support for compressed X files (zip)
0071  *    ASSIMP_BUILD_NO_COMPRESSED_BLEND
0072  *      - Disable support for compressed Blender files (zip)
0073  *    ASSIMP_BUILD_NO_COMPRESSED_IFC
0074  *      - Disable support for IFCZIP files (unzip)
0075  */
0076 //////////////////////////////////////////////////////////////////////////
0077 
0078 #ifndef ASSIMP_BUILD_NO_COMPRESSED_X
0079 #define ASSIMP_BUILD_NEED_Z_INFLATE
0080 #endif
0081 
0082 #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
0083 #define ASSIMP_BUILD_NEED_Z_INFLATE
0084 #endif
0085 
0086 #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
0087 #define ASSIMP_BUILD_NEED_Z_INFLATE
0088 #define ASSIMP_BUILD_NEED_UNZIP
0089 #endif
0090 
0091 #ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
0092 #define ASSIMP_BUILD_NEED_Z_INFLATE
0093 #define ASSIMP_BUILD_NEED_UNZIP
0094 #endif
0095 
0096 // We need those constants, workaround for any platforms where nobody defined them yet
0097 #if (!defined SIZE_MAX)
0098 #define SIZE_MAX (~((size_t)0))
0099 #endif
0100 
0101 /*#if (!defined UINT_MAX)
0102 #define UINT_MAX (~((unsigned int)0))
0103 #endif*/
0104 
0105 //////////////////////////////////////////////////////////////////////////
0106 /* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
0107  * post processing step. This is the current list of process names ('XX'):
0108  * CALCTANGENTS
0109  * JOINVERTICES
0110  * TRIANGULATE
0111  * DROPFACENORMALS
0112  * GENFACENORMALS
0113  * GENVERTEXNORMALS
0114  * REMOVEVC
0115  * SPLITLARGEMESHES
0116  * PRETRANSFORMVERTICES
0117  * LIMITBONEWEIGHTS
0118  * VALIDATEDS
0119  * IMPROVECACHELOCALITY
0120  * FIXINFACINGNORMALS
0121  * REMOVE_REDUNDANTMATERIALS
0122  * OPTIMIZEGRAPH
0123  * SORTBYPTYPE
0124  * FINDINVALIDDATA
0125  * TRANSFORMTEXCOORDS
0126  * GENUVCOORDS
0127  * ENTITYMESHBUILDER
0128  * EMBEDTEXTURES
0129  * MAKELEFTHANDED
0130  * FLIPUVS
0131  * FLIPWINDINGORDER
0132  * OPTIMIZEMESHES
0133  * OPTIMIZEANIMS
0134  * OPTIMIZEGRAPH
0135  * GENENTITYMESHES
0136  * FIXTEXTUREPATHS
0137  * GENBOUNDINGBOXES */
0138 //////////////////////////////////////////////////////////////////////////
0139 
0140 #ifdef _WIN32
0141 #undef ASSIMP_API
0142 //////////////////////////////////////////////////////////////////////////
0143 /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
0144 //////////////////////////////////////////////////////////////////////////
0145 #ifdef ASSIMP_BUILD_DLL_EXPORT
0146 #define ASSIMP_API __declspec(dllexport)
0147 #define ASSIMP_API_WINONLY __declspec(dllexport)
0148 
0149 //////////////////////////////////////////////////////////////////////////
0150 /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
0151      * an external DLL under Windows. Default is static linkage. */
0152 //////////////////////////////////////////////////////////////////////////
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 #elif defined(SWIG)
0161 /* Do nothing, the relevant defines are all in AssimpSwigPort.i */
0162 #else
0163 #define ASSIMP_API __attribute__((visibility("default")))
0164 #define ASSIMP_API_WINONLY
0165 #endif // _WIN32
0166 
0167 #ifdef _MSC_VER
0168     #pragma warning(disable : 4521 4512 4714 4127 4351 4510)
0169     #ifdef ASSIMP_BUILD_DLL_EXPORT
0170         #pragma warning(disable : 4251)
0171     #endif
0172     /* Force the compiler to inline a function, if possible */
0173     #define AI_FORCE_INLINE inline
0174 
0175     /* Tells the compiler that a function never returns. Used in code analysis
0176     * to skip dead paths (e.g. after an assertion evaluated to false). */
0177     #define AI_WONT_RETURN __declspec(noreturn)
0178 #elif defined(SWIG)
0179   /* Do nothing, the relevant defines are all in AssimpSwigPort.i */
0180 #else
0181     #define AI_WONT_RETURN
0182     #define AI_FORCE_INLINE inline
0183 #endif // (defined _MSC_VER)
0184 
0185 #ifdef __GNUC__
0186 #   define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
0187 #elif _MSC_VER
0188 #if defined(__clang__)
0189 #   define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
0190 #else
0191 #   define AI_WONT_RETURN_SUFFIX
0192 #endif
0193 #else
0194 #   define AI_WONT_RETURN_SUFFIX
0195 #endif // (defined __clang__)
0196 
0197 #ifdef __cplusplus
0198 /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
0199  * in doxydocs. */
0200 #define C_STRUCT
0201 #define C_ENUM
0202 #else
0203 //////////////////////////////////////////////////////////////////////////
0204 /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
0205  * is defined by Doxygen's preprocessor. The corresponding
0206  * entries in the DOXYFILE are: */
0207 //////////////////////////////////////////////////////////////////////////
0208 #if 0
0209     ENABLE_PREPROCESSING   = YES
0210     MACRO_EXPANSION        = YES
0211     EXPAND_ONLY_PREDEF     = YES
0212     SEARCH_INCLUDES        = YES
0213     INCLUDE_PATH           =
0214     INCLUDE_FILE_PATTERNS  =
0215     PREDEFINED             = ASSIMP_DOXYGEN_BUILD=1
0216     EXPAND_AS_DEFINED      = C_STRUCT C_ENUM
0217     SKIP_FUNCTION_MACROS   = YES
0218 #endif
0219 //////////////////////////////////////////////////////////////////////////
0220 /* Doxygen gets confused if we use c-struct typedefs to avoid
0221      * the explicit 'struct' notation. This trick here has the same
0222      * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
0223      * to typedef all structs/enums. */
0224 //////////////////////////////////////////////////////////////////////////
0225 #if (defined ASSIMP_DOXYGEN_BUILD)
0226 #define C_STRUCT
0227 #define C_ENUM
0228 #else
0229 #define C_STRUCT struct
0230 #define C_ENUM enum
0231 #endif
0232 #endif
0233 
0234 #if (defined(__BORLANDC__) || defined(__BCPLUSPLUS__))
0235 #error Currently, Borland is unsupported. Feel free to port Assimp.
0236 #endif
0237 
0238 //////////////////////////////////////////////////////////////////////////
0239 /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
0240      * without threading support. The library doesn't utilize
0241      * threads then and is itself not threadsafe. */
0242 //////////////////////////////////////////////////////////////////////////
0243 #ifndef ASSIMP_BUILD_SINGLETHREADED
0244 #define ASSIMP_BUILD_SINGLETHREADED
0245 #endif
0246 
0247 #if defined(_DEBUG) || !defined(NDEBUG)
0248 #define ASSIMP_BUILD_DEBUG
0249 #endif
0250 
0251 //////////////////////////////////////////////////////////////////////////
0252 /* Define ASSIMP_DOUBLE_PRECISION to compile assimp
0253  * with double precision support (64-bit). */
0254 //////////////////////////////////////////////////////////////////////////
0255 
0256 #ifdef ASSIMP_DOUBLE_PRECISION
0257 typedef double ai_real;
0258 typedef signed long long int ai_int;
0259 typedef unsigned long long int ai_uint;
0260 #ifndef ASSIMP_AI_REAL_TEXT_PRECISION
0261 #define ASSIMP_AI_REAL_TEXT_PRECISION 17
0262 #endif // ASSIMP_AI_REAL_TEXT_PRECISION
0263 #else // ASSIMP_DOUBLE_PRECISION
0264 typedef float ai_real;
0265 typedef signed int ai_int;
0266 typedef unsigned int ai_uint;
0267 #ifndef ASSIMP_AI_REAL_TEXT_PRECISION
0268 #define ASSIMP_AI_REAL_TEXT_PRECISION 9
0269 #endif // ASSIMP_AI_REAL_TEXT_PRECISION
0270 #endif // ASSIMP_DOUBLE_PRECISION
0271 
0272 //////////////////////////////////////////////////////////////////////////
0273 /* Useful constants */
0274 //////////////////////////////////////////////////////////////////////////
0275 
0276 /* This is PI. Hi PI. */
0277 #define AI_MATH_PI (3.141592653589793238462643383279)
0278 #define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
0279 #define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
0280 
0281 /* And this is to avoid endless casts to float */
0282 #define AI_MATH_PI_F (3.1415926538f)
0283 #define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
0284 #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
0285 
0286 /* Tiny macro to convert from radians to degrees and back */
0287 #define AI_DEG_TO_RAD(x) ((x) * (ai_real) 0.0174532925)
0288 #define AI_RAD_TO_DEG(x) ((x) * (ai_real) 57.2957795)
0289 
0290 /* Numerical limits */
0291 #ifdef __cplusplus
0292 constexpr ai_real ai_epsilon = (ai_real) 1e-6;
0293 #else
0294 #define ai_epsilon ((ai_real)1e-6)
0295 #endif
0296 
0297 /* Support for big-endian builds */
0298 #if defined(__BYTE_ORDER__)
0299 #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
0300 #if !defined(__BIG_ENDIAN__)
0301 #define __BIG_ENDIAN__
0302 #endif
0303 #else /* little endian */
0304 #if defined(__BIG_ENDIAN__)
0305 #undef __BIG_ENDIAN__
0306 #endif
0307 #endif
0308 #endif
0309 #if defined(__BIG_ENDIAN__)
0310 #define AI_BUILD_BIG_ENDIAN
0311 #endif
0312 
0313 /**
0314  *  To avoid running out of memory
0315  *  This can be adjusted for specific use cases
0316  *  It's NOT a total limit, just a limit for individual allocations
0317  */
0318 #define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
0319 
0320 #ifndef _MSC_VER
0321 #if __cplusplus >= 201103L // C++11
0322 #define AI_NO_EXCEPT noexcept
0323 #else
0324 #define AI_NO_EXCEPT
0325 #endif
0326 #else
0327 #if (_MSC_VER >= 1915)
0328 #define AI_NO_EXCEPT noexcept
0329 #else
0330 #define AI_NO_EXCEPT
0331 #endif
0332 #endif // _MSC_VER
0333 
0334 /**
0335  *  Helper macro to set a pointer to NULL in debug builds
0336  */
0337 #if (defined ASSIMP_BUILD_DEBUG)
0338 #define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
0339 #else
0340 #define AI_DEBUG_INVALIDATE_PTR(x)
0341 #endif
0342 
0343 #define AI_COUNT_OF(X) (sizeof(X) / sizeof((X)[0]))
0344 
0345 #endif // !! AI_DEFINES_H_INC