miniassimp

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/miniassimp/defs.h	Mon Jan 28 18:19:26 2019 +0200
     1.3 @@ -0,0 +1,295 @@
     1.4 +/*
     1.5 +---------------------------------------------------------------------------
     1.6 +Open Asset Import Library (assimp)
     1.7 +---------------------------------------------------------------------------
     1.8 +
     1.9 +Copyright (c) 2006-2018, assimp team
    1.10 +
    1.11 +
    1.12 +
    1.13 +All rights reserved.
    1.14 +
    1.15 +Redistribution and use of this software in source and binary forms,
    1.16 +with or without modification, are permitted provided that the following
    1.17 +conditions are met:
    1.18 +
    1.19 +* Redistributions of source code must retain the above
    1.20 +  copyright notice, this list of conditions and the
    1.21 +  following disclaimer.
    1.22 +
    1.23 +* Redistributions in binary form must reproduce the above
    1.24 +  copyright notice, this list of conditions and the
    1.25 +  following disclaimer in the documentation and/or other
    1.26 +  materials provided with the distribution.
    1.27 +
    1.28 +* Neither the name of the assimp team, nor the names of its
    1.29 +  contributors may be used to endorse or promote products
    1.30 +  derived from this software without specific prior
    1.31 +  written permission of the assimp team.
    1.32 +
    1.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    1.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.44 +---------------------------------------------------------------------------
    1.45 +*/
    1.46 +
    1.47 +/** @file defs.h
    1.48 + *  @brief Assimp build configuration setup. See the notes in the comment
    1.49 + *  blocks to find out how to customize _your_ Assimp build.
    1.50 + */
    1.51 +
    1.52 +#pragma once
    1.53 +#ifndef AI_DEFINES_H_INC
    1.54 +#define AI_DEFINES_H_INC
    1.55 +
    1.56 +#include <miniassimp/config.h>
    1.57 +
    1.58 +//////////////////////////////////////////////////////////////////////////
    1.59 +/* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific
    1.60 + * file format loader. The loader is be excluded from the
    1.61 + * build in this case. 'XX' stands for the most common file
    1.62 + * extension of the file format. E.g.:
    1.63 + * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader.
    1.64 + *
    1.65 + * If you're unsure about that, take a look at the implementation of the
    1.66 + * import plugin you wish to disable. You'll find the right define in the
    1.67 + * first lines of the corresponding unit.
    1.68 + *
    1.69 + * Other (mixed) configuration switches are listed here:
    1.70 + *    ASSIMP_BUILD_NO_COMPRESSED_X
    1.71 + *      - Disable support for compressed X files (zip)
    1.72 + *    ASSIMP_BUILD_NO_COMPRESSED_BLEND
    1.73 + *      - Disable support for compressed Blender files (zip)
    1.74 + *    ASSIMP_BUILD_NO_COMPRESSED_IFC
    1.75 + *      - Disable support for IFCZIP files (unzip)
    1.76 + */
    1.77 +//////////////////////////////////////////////////////////////////////////
    1.78 +
    1.79 +#ifndef ASSIMP_BUILD_NO_COMPRESSED_X
    1.80 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
    1.81 +#endif
    1.82 +
    1.83 +#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
    1.84 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
    1.85 +#endif
    1.86 +
    1.87 +#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
    1.88 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
    1.89 +#   define ASSIMP_BUILD_NEED_UNZIP
    1.90 +#endif
    1.91 +
    1.92 +#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
    1.93 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
    1.94 +#   define ASSIMP_BUILD_NEED_UNZIP
    1.95 +#endif
    1.96 +
    1.97 +//////////////////////////////////////////////////////////////////////////
    1.98 +/* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
    1.99 + * post processing step. This is the current list of process names ('XX'):
   1.100 + * CALCTANGENTS
   1.101 + * JOINVERTICES
   1.102 + * TRIANGULATE
   1.103 + * DROPFACENORMALS
   1.104 + * GENFACENORMALS
   1.105 + * GENVERTEXNORMALS
   1.106 + * REMOVEVC
   1.107 + * SPLITLARGEMESHES
   1.108 + * PRETRANSFORMVERTICES
   1.109 + * LIMITBONEWEIGHTS
   1.110 + * VALIDATEDS
   1.111 + * IMPROVECACHELOCALITY
   1.112 + * FIXINFACINGNORMALS
   1.113 + * REMOVE_REDUNDANTMATERIALS
   1.114 + * OPTIMIZEGRAPH
   1.115 + * SORTBYPTYPE
   1.116 + * FINDINVALIDDATA
   1.117 + * TRANSFORMTEXCOORDS
   1.118 + * GENUVCOORDS
   1.119 + * ENTITYMESHBUILDER
   1.120 + * EMBEDTEXTURES
   1.121 + * MAKELEFTHANDED
   1.122 + * FLIPUVS
   1.123 + * FLIPWINDINGORDER
   1.124 + * OPTIMIZEMESHES
   1.125 + * OPTIMIZEANIMS
   1.126 + * OPTIMIZEGRAPH
   1.127 + * GENENTITYMESHES
   1.128 + * FIXTEXTUREPATHS */
   1.129 +//////////////////////////////////////////////////////////////////////////
   1.130 +
   1.131 +#ifdef _MSC_VER
   1.132 +#   undef ASSIMP_API
   1.133 +
   1.134 +    //////////////////////////////////////////////////////////////////////////
   1.135 +    /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
   1.136 +    //////////////////////////////////////////////////////////////////////////
   1.137 +#   ifdef ASSIMP_BUILD_DLL_EXPORT
   1.138 +#       define ASSIMP_API __declspec(dllexport)
   1.139 +#       define ASSIMP_API_WINONLY __declspec(dllexport)
   1.140 +#       pragma warning (disable : 4251)
   1.141 +
   1.142 +    //////////////////////////////////////////////////////////////////////////
   1.143 +    /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
   1.144 +     * an external DLL under Windows. Default is static linkage. */
   1.145 +    //////////////////////////////////////////////////////////////////////////
   1.146 +#   elif (defined ASSIMP_DLL)
   1.147 +#       define ASSIMP_API __declspec(dllimport)
   1.148 +#       define ASSIMP_API_WINONLY __declspec(dllimport)
   1.149 +#   else
   1.150 +#       define ASSIMP_API
   1.151 +#       define ASSIMP_API_WINONLY
   1.152 +#   endif
   1.153 +
   1.154 +    /* Force the compiler to inline a function, if possible
   1.155 +     */
   1.156 +#   define AI_FORCE_INLINE __forceinline
   1.157 +
   1.158 +    /* Tells the compiler that a function never returns. Used in code analysis
   1.159 +     * to skip dead paths (e.g. after an assertion evaluated to false). */
   1.160 +#   define AI_WONT_RETURN __declspec(noreturn)
   1.161 +
   1.162 +#elif defined(SWIG)
   1.163 +
   1.164 +    /* Do nothing, the relevant defines are all in AssimpSwigPort.i */
   1.165 +
   1.166 +#else
   1.167 +
   1.168 +#   define AI_WONT_RETURN
   1.169 +
   1.170 +#   define ASSIMP_API
   1.171 +#   define ASSIMP_API_WINONLY
   1.172 +#   define AI_FORCE_INLINE inline
   1.173 +#endif // (defined _MSC_VER)
   1.174 +
   1.175 +#ifdef __GNUC__
   1.176 +#   define AI_WONT_RETURN_SUFFIX  __attribute__((noreturn))
   1.177 +#else
   1.178 +#   define AI_WONT_RETURN_SUFFIX
   1.179 +#endif // (defined __clang__)
   1.180 +
   1.181 +#ifdef __cplusplus
   1.182 +    /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
   1.183 +     * in doxydocs.
   1.184 +     */
   1.185 +#   define C_STRUCT
   1.186 +#   define C_ENUM
   1.187 +#else
   1.188 +    //////////////////////////////////////////////////////////////////////////
   1.189 +    /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
   1.190 +     * is defined by Doxygen's preprocessor. The corresponding
   1.191 +     * entries in the DOXYFILE are: */
   1.192 +    //////////////////////////////////////////////////////////////////////////
   1.193 +#if 0
   1.194 +    ENABLE_PREPROCESSING   = YES
   1.195 +    MACRO_EXPANSION        = YES
   1.196 +    EXPAND_ONLY_PREDEF     = YES
   1.197 +    SEARCH_INCLUDES        = YES
   1.198 +    INCLUDE_PATH           =
   1.199 +    INCLUDE_FILE_PATTERNS  =
   1.200 +    PREDEFINED             = ASSIMP_DOXYGEN_BUILD=1
   1.201 +    EXPAND_AS_DEFINED      = C_STRUCT C_ENUM
   1.202 +    SKIP_FUNCTION_MACROS   = YES
   1.203 +#endif
   1.204 +    //////////////////////////////////////////////////////////////////////////
   1.205 +    /* Doxygen gets confused if we use c-struct typedefs to avoid
   1.206 +     * the explicit 'struct' notation. This trick here has the same
   1.207 +     * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
   1.208 +     * to typedef all structs/enums. */
   1.209 +     //////////////////////////////////////////////////////////////////////////
   1.210 +#   if (defined ASSIMP_DOXYGEN_BUILD)
   1.211 +#       define C_STRUCT
   1.212 +#       define C_ENUM
   1.213 +#   else
   1.214 +#       define C_STRUCT struct
   1.215 +#       define C_ENUM   enum
   1.216 +#   endif
   1.217 +#endif
   1.218 +
   1.219 +#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
   1.220 +#error Currently, Borland is unsupported. Feel free to port Assimp.
   1.221 +
   1.222 +// "W8059 Packgröße der Struktur geändert"
   1.223 +
   1.224 +#endif
   1.225 +
   1.226 +
   1.227 +    //////////////////////////////////////////////////////////////////////////
   1.228 +    /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
   1.229 +     * without threading support. The library doesn't utilize
   1.230 +     * threads then and is itself not threadsafe. */
   1.231 +    //////////////////////////////////////////////////////////////////////////
   1.232 +#ifndef ASSIMP_BUILD_SINGLETHREADED
   1.233 +#   define ASSIMP_BUILD_SINGLETHREADED
   1.234 +#endif
   1.235 +
   1.236 +#if defined(_DEBUG) || ! defined(NDEBUG)
   1.237 +#   define ASSIMP_BUILD_DEBUG
   1.238 +#endif
   1.239 +
   1.240 +    //////////////////////////////////////////////////////////////////////////
   1.241 +    /* Define ASSIMP_DOUBLE_PRECISION to compile assimp
   1.242 +     * with double precision support (64-bit). */
   1.243 +    //////////////////////////////////////////////////////////////////////////
   1.244 +
   1.245 +#ifdef ASSIMP_DOUBLE_PRECISION
   1.246 +    typedef double ai_real;
   1.247 +    typedef signed long long int ai_int;
   1.248 +    typedef unsigned long long int ai_uint;
   1.249 +#else // ASSIMP_DOUBLE_PRECISION
   1.250 +    typedef float ai_real;
   1.251 +    typedef signed int ai_int;
   1.252 +    typedef unsigned int ai_uint;
   1.253 +#endif // ASSIMP_DOUBLE_PRECISION
   1.254 +
   1.255 +    //////////////////////////////////////////////////////////////////////////
   1.256 +    /* Useful constants */
   1.257 +    //////////////////////////////////////////////////////////////////////////
   1.258 +
   1.259 +/* This is PI. Hi PI. */
   1.260 +#define AI_MATH_PI          (3.141592653589793238462643383279 )
   1.261 +#define AI_MATH_TWO_PI      (AI_MATH_PI * 2.0)
   1.262 +#define AI_MATH_HALF_PI     (AI_MATH_PI * 0.5)
   1.263 +
   1.264 +/* And this is to avoid endless casts to float */
   1.265 +#define AI_MATH_PI_F        (3.1415926538f)
   1.266 +#define AI_MATH_TWO_PI_F    (AI_MATH_PI_F * 2.0f)
   1.267 +#define AI_MATH_HALF_PI_F   (AI_MATH_PI_F * 0.5f)
   1.268 +
   1.269 +/* Tiny macro to convert from radians to degrees and back */
   1.270 +#define AI_DEG_TO_RAD(x) ((x)*(ai_real)0.0174532925)
   1.271 +#define AI_RAD_TO_DEG(x) ((x)*(ai_real)57.2957795)
   1.272 +
   1.273 +/* Support for big-endian builds */
   1.274 +#if defined(__BYTE_ORDER__)
   1.275 +#   if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
   1.276 +#       if !defined(__BIG_ENDIAN__)
   1.277 +#           define __BIG_ENDIAN__
   1.278 +#       endif
   1.279 +#   else /* little endian */
   1.280 +#       if defined (__BIG_ENDIAN__)
   1.281 +#           undef __BIG_ENDIAN__
   1.282 +#       endif
   1.283 +#   endif
   1.284 +#endif
   1.285 +#if defined(__BIG_ENDIAN__)
   1.286 +#   define AI_BUILD_BIG_ENDIAN
   1.287 +#endif
   1.288 +
   1.289 +
   1.290 +/* To avoid running out of memory
   1.291 + * This can be adjusted for specific use cases
   1.292 + * It's NOT a total limit, just a limit for individual allocations
   1.293 + */
   1.294 +#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
   1.295 +
   1.296 +#define AI_NO_EXCEPT
   1.297 +
   1.298 +#endif // !! AI_DEFINES_H_INC