miniassimp

changeset 0:879c81d94345 tip

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Jan 2019 18:19:26 +0200
parents
children
files .hgignore Makefile include/miniassimp/BaseImporter.h include/miniassimp/Compiler/poppack1.h include/miniassimp/Compiler/pstdint.h include/miniassimp/Compiler/pushpack1.h include/miniassimp/DefaultIOStream.h include/miniassimp/DefaultLogger.hpp include/miniassimp/Defines.h include/miniassimp/Exceptional.h include/miniassimp/GenericProperty.h include/miniassimp/Hash.h include/miniassimp/IOStream.hpp include/miniassimp/IOSystem.hpp include/miniassimp/Importer.hpp include/miniassimp/LogStream.hpp include/miniassimp/Logger.hpp include/miniassimp/NullLogger.hpp include/miniassimp/ProgressHandler.hpp include/miniassimp/TinyFormatter.h include/miniassimp/ai_assert.h include/miniassimp/anim.h include/miniassimp/camera.h include/miniassimp/cfileio.h include/miniassimp/cimport.h include/miniassimp/color4.h include/miniassimp/color4.inl include/miniassimp/config.h include/miniassimp/defs.h include/miniassimp/importerdesc.h include/miniassimp/light.h include/miniassimp/material.h include/miniassimp/material.inl include/miniassimp/matrix3x3.h include/miniassimp/matrix3x3.inl include/miniassimp/matrix4x4.h include/miniassimp/matrix4x4.inl include/miniassimp/mesh.h include/miniassimp/metadata.h include/miniassimp/postprocess.h include/miniassimp/quaternion.h include/miniassimp/quaternion.inl include/miniassimp/scene.h include/miniassimp/texture.h include/miniassimp/types.h include/miniassimp/vector2.h include/miniassimp/vector2.inl include/miniassimp/vector3.h include/miniassimp/vector3.inl src/Assimp.cpp src/CInterfaceIOWrapper.cpp src/CInterfaceIOWrapper.h src/Importer.h src/ScenePrivate.h
diffstat 54 files changed, 16721 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgignore	Mon Jan 28 18:19:26 2019 +0200
     1.3 @@ -0,0 +1,5 @@
     1.4 +\.o$
     1.5 +\.d$
     1.6 +\.swp$
     1.7 +\.a$
     1.8 +\.so\.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Makefile	Mon Jan 28 18:19:26 2019 +0200
     2.3 @@ -0,0 +1,43 @@
     2.4 +src = $(wildcard src/*.cpp)
     2.5 +obj = $(src:.cpp=.o)
     2.6 +dep = $(obj:.o=.d)
     2.7 +
     2.8 +name = miniassimp
     2.9 +so_major = 0
    2.10 +so_minor = 1
    2.11 +
    2.12 +liba = lib$(name).a
    2.13 +libso = lib$(name).so
    2.14 +ldname = lib$(name).so.$(so_major)
    2.15 +soname = lib$(name).so.$(so_major).$(so_minor)
    2.16 +
    2.17 +warn = -pedantic -Wall
    2.18 +dbg = -g
    2.19 +opt = -O0
    2.20 +inc = -Iinclude
    2.21 +
    2.22 +CC=gcc
    2.23 +CXX=g++
    2.24 +CFLAGS = $(warn) $(dbg) $(opt) $(def) $(inc)
    2.25 +CXXFLAGS = $(warn) $(dbg) $(opt) $(def) $(inc)
    2.26 +
    2.27 +shared = -shared -Wl,-soname,$(soname)
    2.28 +
    2.29 +.PHONY: all
    2.30 +all: $(libso) $(liba)
    2.31 +
    2.32 +$(liba): $(obj)
    2.33 +	$(AR) rcs $@ $(obj)
    2.34 +
    2.35 +$(libso): $(obj)
    2.36 +	$(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
    2.37 +
    2.38 +-include $(dep)
    2.39 +
    2.40 +%.d: %.cpp
    2.41 +	@echo depfile $@
    2.42 +	@$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
    2.43 +
    2.44 +.PHONY: clean
    2.45 +clean:
    2.46 +	rm -f $(obj) $(liba) $(libso)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/include/miniassimp/BaseImporter.h	Mon Jan 28 18:19:26 2019 +0200
     3.3 @@ -0,0 +1,361 @@
     3.4 +/*
     3.5 +Open Asset Import Library (assimp)
     3.6 +----------------------------------------------------------------------
     3.7 +
     3.8 +Copyright (c) 2006-2018, assimp team
     3.9 +
    3.10 +
    3.11 +All rights reserved.
    3.12 +
    3.13 +Redistribution and use of this software in source and binary forms,
    3.14 +with or without modification, are permitted provided that the
    3.15 +following conditions are met:
    3.16 +
    3.17 +* Redistributions of source code must retain the above
    3.18 +  copyright notice, this list of conditions and the
    3.19 +  following disclaimer.
    3.20 +
    3.21 +* Redistributions in binary form must reproduce the above
    3.22 +  copyright notice, this list of conditions and the
    3.23 +  following disclaimer in the documentation and/or other
    3.24 +  materials provided with the distribution.
    3.25 +
    3.26 +* Neither the name of the assimp team, nor the names of its
    3.27 +  contributors may be used to endorse or promote products
    3.28 +  derived from this software without specific prior
    3.29 +  written permission of the assimp team.
    3.30 +
    3.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    3.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    3.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    3.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    3.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    3.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    3.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    3.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    3.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    3.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    3.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3.42 +
    3.43 +----------------------------------------------------------------------
    3.44 +*/
    3.45 +
    3.46 +/** @file Definition of the base class for all importer worker classes. */
    3.47 +#ifndef INCLUDED_AI_BASEIMPORTER_H
    3.48 +#define INCLUDED_AI_BASEIMPORTER_H
    3.49 +
    3.50 +#include "Exceptional.h"
    3.51 +
    3.52 +#include <vector>
    3.53 +#include <set>
    3.54 +#include <miniassimp/types.h>
    3.55 +#include <miniassimp/ProgressHandler.hpp>
    3.56 +
    3.57 +struct aiScene;
    3.58 +struct aiImporterDesc;
    3.59 +
    3.60 +namespace Assimp    {
    3.61 +
    3.62 +class Importer;
    3.63 +class IOSystem;
    3.64 +class BaseProcess;
    3.65 +class SharedPostProcessInfo;
    3.66 +class IOStream;
    3.67 +
    3.68 +// utility to do char4 to uint32 in a portable manner
    3.69 +#define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \
    3.70 +    (string[1] << 16) + (string[2] << 8) + string[3]))
    3.71 +
    3.72 +
    3.73 +// ---------------------------------------------------------------------------
    3.74 +/** FOR IMPORTER PLUGINS ONLY: The BaseImporter defines a common interface
    3.75 + *  for all importer worker classes.
    3.76 + *
    3.77 + * The interface defines two functions: CanRead() is used to check if the
    3.78 + * importer can handle the format of the given file. If an implementation of
    3.79 + * this function returns true, the importer then calls ReadFile() which
    3.80 + * imports the given file. ReadFile is not overridable, it just calls
    3.81 + * InternReadFile() and catches any ImportErrorException that might occur.
    3.82 + */
    3.83 +class ASSIMP_API BaseImporter {
    3.84 +    friend class Importer;
    3.85 +
    3.86 +public:
    3.87 +
    3.88 +    /** Constructor to be privately used by #Importer */
    3.89 +    BaseImporter() AI_NO_EXCEPT;
    3.90 +
    3.91 +    /** Destructor, private as well */
    3.92 +    virtual ~BaseImporter();
    3.93 +
    3.94 +    // -------------------------------------------------------------------
    3.95 +    /** Returns whether the class can handle the format of the given file.
    3.96 +     *
    3.97 +     * The implementation should be as quick as possible. A check for
    3.98 +     * the file extension is enough. If no suitable loader is found with
    3.99 +     * this strategy, CanRead() is called again, the 'checkSig' parameter
   3.100 +     * set to true this time. Now the implementation is expected to
   3.101 +     * perform a full check of the file structure, possibly searching the
   3.102 +     * first bytes of the file for magic identifiers or keywords.
   3.103 +     *
   3.104 +     * @param pFile Path and file name of the file to be examined.
   3.105 +     * @param pIOHandler The IO handler to use for accessing any file.
   3.106 +     * @param checkSig Set to true if this method is called a second time.
   3.107 +     *   This time, the implementation may take more time to examine the
   3.108 +     *   contents of the file to be loaded for magic bytes, keywords, etc
   3.109 +     *   to be able to load files with unknown/not existent file extensions.
   3.110 +     * @return true if the class can read this file, false if not.
   3.111 +     */
   3.112 +    virtual bool CanRead(
   3.113 +        const std::string& pFile,
   3.114 +        IOSystem* pIOHandler,
   3.115 +        bool checkSig
   3.116 +        ) const = 0;
   3.117 +
   3.118 +    // -------------------------------------------------------------------
   3.119 +    /** Imports the given file and returns the imported data.
   3.120 +     * If the import succeeds, ownership of the data is transferred to
   3.121 +     * the caller. If the import fails, NULL is returned. The function
   3.122 +     * takes care that any partially constructed data is destroyed
   3.123 +     * beforehand.
   3.124 +     *
   3.125 +     * @param pImp #Importer object hosting this loader.
   3.126 +     * @param pFile Path of the file to be imported.
   3.127 +     * @param pIOHandler IO-Handler used to open this and possible other files.
   3.128 +     * @return The imported data or NULL if failed. If it failed a
   3.129 +     * human-readable error description can be retrieved by calling
   3.130 +     * GetErrorText()
   3.131 +     *
   3.132 +     * @note This function is not intended to be overridden. Implement
   3.133 +     * InternReadFile() to do the import. If an exception is thrown somewhere
   3.134 +     * in InternReadFile(), this function will catch it and transform it into
   3.135 +     *  a suitable response to the caller.
   3.136 +     */
   3.137 +    aiScene* ReadFile(
   3.138 +        const Importer* pImp,
   3.139 +        const std::string& pFile,
   3.140 +        IOSystem* pIOHandler
   3.141 +        );
   3.142 +
   3.143 +    // -------------------------------------------------------------------
   3.144 +    /** Returns the error description of the last error that occurred.
   3.145 +     * @return A description of the last error that occurred. An empty
   3.146 +     * string if there was no error.
   3.147 +     */
   3.148 +    const std::string& GetErrorText() const {
   3.149 +        return m_ErrorText;
   3.150 +    }
   3.151 +
   3.152 +    // -------------------------------------------------------------------
   3.153 +    /** Called prior to ReadFile().
   3.154 +     * The function is a request to the importer to update its configuration
   3.155 +     * basing on the Importer's configuration property list.
   3.156 +     * @param pImp Importer instance
   3.157 +     */
   3.158 +    virtual void SetupProperties(
   3.159 +        const Importer* pImp
   3.160 +        );
   3.161 +
   3.162 +    // -------------------------------------------------------------------
   3.163 +    /** Called by #Importer::GetImporterInfo to get a description of
   3.164 +     *  some loader features. Importers must provide this information. */
   3.165 +    virtual const aiImporterDesc* GetInfo() const = 0;
   3.166 +
   3.167 +    // -------------------------------------------------------------------
   3.168 +    /** Called by #Importer::GetExtensionList for each loaded importer.
   3.169 +     *  Take the extension list contained in the structure returned by
   3.170 +     *  #GetInfo and insert all file extensions into the given set.
   3.171 +     *  @param extension set to collect file extensions in*/
   3.172 +    void GetExtensionList(std::set<std::string>& extensions);
   3.173 +
   3.174 +protected:
   3.175 +
   3.176 +    // -------------------------------------------------------------------
   3.177 +    /** Imports the given file into the given scene structure. The
   3.178 +     * function is expected to throw an ImportErrorException if there is
   3.179 +     * an error. If it terminates normally, the data in aiScene is
   3.180 +     * expected to be correct. Override this function to implement the
   3.181 +     * actual importing.
   3.182 +     * <br>
   3.183 +     *  The output scene must meet the following requirements:<br>
   3.184 +     * <ul>
   3.185 +     * <li>At least a root node must be there, even if its only purpose
   3.186 +     *     is to reference one mesh.</li>
   3.187 +     * <li>aiMesh::mPrimitiveTypes may be 0. The types of primitives
   3.188 +     *   in the mesh are determined automatically in this case.</li>
   3.189 +     * <li>the vertex data is stored in a pseudo-indexed "verbose" format.
   3.190 +     *   In fact this means that every vertex that is referenced by
   3.191 +     *   a face is unique. Or the other way round: a vertex index may
   3.192 +     *   not occur twice in a single aiMesh.</li>
   3.193 +     * <li>aiAnimation::mDuration may be -1. Assimp determines the length
   3.194 +     *   of the animation automatically in this case as the length of
   3.195 +     *   the longest animation channel.</li>
   3.196 +     * <li>aiMesh::mBitangents may be NULL if tangents and normals are
   3.197 +     *   given. In this case bitangents are computed as the cross product
   3.198 +     *   between normal and tangent.</li>
   3.199 +     * <li>There needn't be a material. If none is there a default material
   3.200 +     *   is generated. However, it is recommended practice for loaders
   3.201 +     *   to generate a default material for yourself that matches the
   3.202 +     *   default material setting for the file format better than Assimp's
   3.203 +     *   generic default material. Note that default materials *should*
   3.204 +     *   be named AI_DEFAULT_MATERIAL_NAME if they're just color-shaded
   3.205 +     *   or AI_DEFAULT_TEXTURED_MATERIAL_NAME if they define a (dummy)
   3.206 +     *   texture. </li>
   3.207 +     * </ul>
   3.208 +     * If the AI_SCENE_FLAGS_INCOMPLETE-Flag is <b>not</b> set:<ul>
   3.209 +     * <li> at least one mesh must be there</li>
   3.210 +     * <li> there may be no meshes with 0 vertices or faces</li>
   3.211 +     * </ul>
   3.212 +     * This won't be checked (except by the validation step): Assimp will
   3.213 +     * crash if one of the conditions is not met!
   3.214 +     *
   3.215 +     * @param pFile Path of the file to be imported.
   3.216 +     * @param pScene The scene object to hold the imported data.
   3.217 +     * NULL is not a valid parameter.
   3.218 +     * @param pIOHandler The IO handler to use for any file access.
   3.219 +     * NULL is not a valid parameter. */
   3.220 +    virtual void InternReadFile(
   3.221 +        const std::string& pFile,
   3.222 +        aiScene* pScene,
   3.223 +        IOSystem* pIOHandler
   3.224 +        ) = 0;
   3.225 +
   3.226 +public: // static utilities
   3.227 +
   3.228 +    // -------------------------------------------------------------------
   3.229 +    /** A utility for CanRead().
   3.230 +     *
   3.231 +     *  The function searches the header of a file for a specific token
   3.232 +     *  and returns true if this token is found. This works for text
   3.233 +     *  files only. There is a rudimentary handling of UNICODE files.
   3.234 +     *  The comparison is case independent.
   3.235 +     *
   3.236 +     *  @param pIOSystem IO System to work with
   3.237 +     *  @param file File name of the file
   3.238 +     *  @param tokens List of tokens to search for
   3.239 +     *  @param numTokens Size of the token array
   3.240 +     *  @param searchBytes Number of bytes to be searched for the tokens.
   3.241 +     */
   3.242 +    static bool SearchFileHeaderForToken(
   3.243 +        IOSystem* pIOSystem,
   3.244 +        const std::string&  file,
   3.245 +        const char** tokens,
   3.246 +        unsigned int numTokens,
   3.247 +        unsigned int searchBytes = 200,
   3.248 +        bool tokensSol = false,
   3.249 +        bool noAlphaBeforeTokens = false);
   3.250 +
   3.251 +    // -------------------------------------------------------------------
   3.252 +    /** @brief Check whether a file has a specific file extension
   3.253 +     *  @param pFile Input file
   3.254 +     *  @param ext0 Extension to check for. Lowercase characters only, no dot!
   3.255 +     *  @param ext1 Optional second extension
   3.256 +     *  @param ext2 Optional third extension
   3.257 +     *  @note Case-insensitive
   3.258 +     */
   3.259 +    static bool SimpleExtensionCheck (
   3.260 +        const std::string& pFile,
   3.261 +        const char* ext0,
   3.262 +        const char* ext1 = NULL,
   3.263 +        const char* ext2 = NULL);
   3.264 +
   3.265 +    // -------------------------------------------------------------------
   3.266 +    /** @brief Extract file extension from a string
   3.267 +     *  @param pFile Input file
   3.268 +     *  @return Extension without trailing dot, all lowercase
   3.269 +     */
   3.270 +    static std::string GetExtension (
   3.271 +        const std::string& pFile);
   3.272 +
   3.273 +    // -------------------------------------------------------------------
   3.274 +    /** @brief Check whether a file starts with one or more magic tokens
   3.275 +     *  @param pFile Input file
   3.276 +     *  @param pIOHandler IO system to be used
   3.277 +     *  @param magic n magic tokens
   3.278 +     *  @params num Size of magic
   3.279 +     *  @param offset Offset from file start where tokens are located
   3.280 +     *  @param Size of one token, in bytes. Maximally 16 bytes.
   3.281 +     *  @return true if one of the given tokens was found
   3.282 +     *
   3.283 +     *  @note For convenience, the check is also performed for the
   3.284 +     *  byte-swapped variant of all tokens (big endian). Only for
   3.285 +     *  tokens of size 2,4.
   3.286 +     */
   3.287 +    static bool CheckMagicToken(
   3.288 +        IOSystem* pIOHandler,
   3.289 +        const std::string& pFile,
   3.290 +        const void* magic,
   3.291 +        unsigned int num,
   3.292 +        unsigned int offset = 0,
   3.293 +        unsigned int size   = 4);
   3.294 +
   3.295 +    // -------------------------------------------------------------------
   3.296 +    /** An utility for all text file loaders. It converts a file to our
   3.297 +     *   UTF8 character set. Errors are reported, but ignored.
   3.298 +     *
   3.299 +     *  @param data File buffer to be converted to UTF8 data. The buffer
   3.300 +     *  is resized as appropriate. */
   3.301 +    static void ConvertToUTF8(
   3.302 +        std::vector<char>& data);
   3.303 +
   3.304 +    // -------------------------------------------------------------------
   3.305 +    /** An utility for all text file loaders. It converts a file from our
   3.306 +     *   UTF8 character set back to ISO-8859-1. Errors are reported, but ignored.
   3.307 +     *
   3.308 +     *  @param data File buffer to be converted from UTF8 to ISO-8859-1. The buffer
   3.309 +     *  is resized as appropriate. */
   3.310 +    static void ConvertUTF8toISO8859_1(
   3.311 +        std::string& data);
   3.312 +
   3.313 +    // -------------------------------------------------------------------
   3.314 +    /// @brief  Enum to define, if empty files are ok or not.
   3.315 +    enum TextFileMode { 
   3.316 +        ALLOW_EMPTY,
   3.317 +        FORBID_EMPTY 
   3.318 +    };
   3.319 +
   3.320 +    // -------------------------------------------------------------------
   3.321 +    /** Utility for text file loaders which copies the contents of the
   3.322 +     *  file into a memory buffer and converts it to our UTF8
   3.323 +     *  representation.
   3.324 +     *  @param stream Stream to read from.
   3.325 +     *  @param data Output buffer to be resized and filled with the
   3.326 +     *   converted text file data. The buffer is terminated with
   3.327 +     *   a binary 0.
   3.328 +     *  @param mode Whether it is OK to load empty text files. */
   3.329 +    static void TextFileToBuffer(
   3.330 +        IOStream* stream,
   3.331 +        std::vector<char>& data,
   3.332 +        TextFileMode mode = FORBID_EMPTY);
   3.333 +
   3.334 +    // -------------------------------------------------------------------
   3.335 +    /** Utility function to move a std::vector into a aiScene array
   3.336 +    *  @param vec The vector to be moved
   3.337 +    *  @param out The output pointer to the allocated array.
   3.338 +    *  @param numOut The output count of elements copied. */
   3.339 +    template<typename T>
   3.340 +    AI_FORCE_INLINE
   3.341 +    static void CopyVector(
   3.342 +        std::vector<T>& vec,
   3.343 +        T*& out,
   3.344 +        unsigned int& outLength)
   3.345 +    {
   3.346 +        outLength = unsigned(vec.size());
   3.347 +        if (outLength) {
   3.348 +            out = new T[outLength];
   3.349 +            std::swap_ranges(vec.begin(), vec.end(), out);
   3.350 +        }
   3.351 +    }
   3.352 +
   3.353 +protected:
   3.354 +    /// Error description in case there was one.
   3.355 +    std::string m_ErrorText;
   3.356 +    /// Currently set progress handler.
   3.357 +    ProgressHandler* m_progress;
   3.358 +};
   3.359 +
   3.360 +
   3.361 +
   3.362 +} // end of namespace Assimp
   3.363 +
   3.364 +#endif // AI_BASEIMPORTER_H_INC
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/include/miniassimp/Compiler/poppack1.h	Mon Jan 28 18:19:26 2019 +0200
     4.3 @@ -0,0 +1,22 @@
     4.4 +
     4.5 +// ===============================================================================
     4.6 +// May be included multiple times - resets structure packing to the defaults 
     4.7 +// for all supported compilers. Reverts the changes made by #include <pushpack1.h> 
     4.8 +//
     4.9 +// Currently this works on the following compilers:
    4.10 +// MSVC 7,8,9
    4.11 +// GCC
    4.12 +// BORLAND (complains about 'pack state changed but not reverted', but works)
    4.13 +// ===============================================================================
    4.14 +
    4.15 +#ifndef AI_PUSHPACK_IS_DEFINED
    4.16 +#	error pushpack1.h must be included after poppack1.h
    4.17 +#endif
    4.18 +
    4.19 +// reset packing to the original value
    4.20 +#if defined(_MSC_VER) ||  defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
    4.21 +#	pragma pack( pop )
    4.22 +#endif
    4.23 +#undef PACK_STRUCT
    4.24 +
    4.25 +#undef AI_PUSHPACK_IS_DEFINED
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/include/miniassimp/Compiler/pstdint.h	Mon Jan 28 18:19:26 2019 +0200
     5.3 @@ -0,0 +1,912 @@
     5.4 +/*  A portable stdint.h
     5.5 + ****************************************************************************
     5.6 + *  BSD License:
     5.7 + ****************************************************************************
     5.8 + *
     5.9 + *  Copyright (c) 2005-2016 Paul Hsieh
    5.10 + *  All rights reserved.
    5.11 + *
    5.12 + *  Redistribution and use in source and binary forms, with or without
    5.13 + *  modification, are permitted provided that the following conditions
    5.14 + *  are met:
    5.15 + *
    5.16 + *  1. Redistributions of source code must retain the above copyright
    5.17 + *     notice, this list of conditions and the following disclaimer.
    5.18 + *  2. Redistributions in binary form must reproduce the above copyright
    5.19 + *     notice, this list of conditions and the following disclaimer in the
    5.20 + *     documentation and/or other materials provided with the distribution.
    5.21 + *  3. The name of the author may not be used to endorse or promote products
    5.22 + *     derived from this software without specific prior written permission.
    5.23 + *
    5.24 + *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    5.25 + *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    5.26 + *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    5.27 + *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    5.28 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    5.29 + *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    5.30 + *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    5.31 + *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    5.32 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    5.33 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    5.34 + *
    5.35 + ****************************************************************************
    5.36 + *
    5.37 + *  Version 0.1.15.4
    5.38 + *
    5.39 + *  The ANSI C standard committee, for the C99 standard, specified the
    5.40 + *  inclusion of a new standard include file called stdint.h.  This is
    5.41 + *  a very useful and long desired include file which contains several
    5.42 + *  very precise definitions for integer scalar types that is
    5.43 + *  critically important for making portable several classes of
    5.44 + *  applications including cryptography, hashing, variable length
    5.45 + *  integer libraries and so on.  But for most developers its likely
    5.46 + *  useful just for programming sanity.
    5.47 + *
    5.48 + *  The problem is that some compiler vendors chose to ignore the C99
    5.49 + *  standard and some older compilers have no opportunity to be updated.
    5.50 + *  Because of this situation, simply including stdint.h in your code
    5.51 + *  makes it unportable.
    5.52 + *
    5.53 + *  So that's what this file is all about.  Its an attempt to build a
    5.54 + *  single universal include file that works on as many platforms as
    5.55 + *  possible to deliver what stdint.h is supposed to.  Even compilers
    5.56 + *  that already come with stdint.h can use this file instead without
    5.57 + *  any loss of functionality.  A few things that should be noted about
    5.58 + *  this file:
    5.59 + *
    5.60 + *    1) It is not guaranteed to be portable and/or present an identical
    5.61 + *       interface on all platforms.  The extreme variability of the
    5.62 + *       ANSI C standard makes this an impossibility right from the
    5.63 + *       very get go. Its really only meant to be useful for the vast
    5.64 + *       majority of platforms that possess the capability of
    5.65 + *       implementing usefully and precisely defined, standard sized
    5.66 + *       integer scalars.  Systems which are not intrinsically 2s
    5.67 + *       complement may produce invalid constants.
    5.68 + *
    5.69 + *    2) There is an unavoidable use of non-reserved symbols.
    5.70 + *
    5.71 + *    3) Other standard include files are invoked.
    5.72 + *
    5.73 + *    4) This file may come in conflict with future platforms that do
    5.74 + *       include stdint.h.  The hope is that one or the other can be
    5.75 + *       used with no real difference.
    5.76 + *
    5.77 + *    5) In the current version, if your platform can't represent
    5.78 + *       int32_t, int16_t and int8_t, it just dumps out with a compiler
    5.79 + *       error.
    5.80 + *
    5.81 + *    6) 64 bit integers may or may not be defined.  Test for their
    5.82 + *       presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
    5.83 + *       Note that this is different from the C99 specification which
    5.84 + *       requires the existence of 64 bit support in the compiler.  If
    5.85 + *       this is not defined for your platform, yet it is capable of
    5.86 + *       dealing with 64 bits then it is because this file has not yet
    5.87 + *       been extended to cover all of your system's capabilities.
    5.88 + *
    5.89 + *    7) (u)intptr_t may or may not be defined.  Test for its presence
    5.90 + *       with the test: #ifdef PTRDIFF_MAX.  If this is not defined
    5.91 + *       for your platform, then it is because this file has not yet
    5.92 + *       been extended to cover all of your system's capabilities, not
    5.93 + *       because its optional.
    5.94 + *
    5.95 + *    8) The following might not been defined even if your platform is
    5.96 + *       capable of defining it:
    5.97 + *
    5.98 + *       WCHAR_MIN
    5.99 + *       WCHAR_MAX
   5.100 + *       (u)int64_t
   5.101 + *       PTRDIFF_MIN
   5.102 + *       PTRDIFF_MAX
   5.103 + *       (u)intptr_t
   5.104 + *
   5.105 + *    9) The following have not been defined:
   5.106 + *
   5.107 + *       WINT_MIN
   5.108 + *       WINT_MAX
   5.109 + *
   5.110 + *   10) The criteria for defining (u)int_least(*)_t isn't clear,
   5.111 + *       except for systems which don't have a type that precisely
   5.112 + *       defined 8, 16, or 32 bit types (which this include file does
   5.113 + *       not support anyways). Default definitions have been given.
   5.114 + *
   5.115 + *   11) The criteria for defining (u)int_fast(*)_t isn't something I
   5.116 + *       would trust to any particular compiler vendor or the ANSI C
   5.117 + *       committee.  It is well known that "compatible systems" are
   5.118 + *       commonly created that have very different performance
   5.119 + *       characteristics from the systems they are compatible with,
   5.120 + *       especially those whose vendors make both the compiler and the
   5.121 + *       system.  Default definitions have been given, but its strongly
   5.122 + *       recommended that users never use these definitions for any
   5.123 + *       reason (they do *NOT* deliver any serious guarantee of
   5.124 + *       improved performance -- not in this file, nor any vendor's
   5.125 + *       stdint.h).
   5.126 + *
   5.127 + *   12) The following macros:
   5.128 + *
   5.129 + *       PRINTF_INTMAX_MODIFIER
   5.130 + *       PRINTF_INT64_MODIFIER
   5.131 + *       PRINTF_INT32_MODIFIER
   5.132 + *       PRINTF_INT16_MODIFIER
   5.133 + *       PRINTF_LEAST64_MODIFIER
   5.134 + *       PRINTF_LEAST32_MODIFIER
   5.135 + *       PRINTF_LEAST16_MODIFIER
   5.136 + *       PRINTF_INTPTR_MODIFIER
   5.137 + *
   5.138 + *       are strings which have been defined as the modifiers required
   5.139 + *       for the "d", "u" and "x" printf formats to correctly output
   5.140 + *       (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
   5.141 + *       (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
   5.142 + *       PRINTF_INTPTR_MODIFIER is not defined for some systems which
   5.143 + *       provide their own stdint.h.  PRINTF_INT64_MODIFIER is not
   5.144 + *       defined if INT64_MAX is not defined.  These are an extension
   5.145 + *       beyond what C99 specifies must be in stdint.h.
   5.146 + *
   5.147 + *       In addition, the following macros are defined:
   5.148 + *
   5.149 + *       PRINTF_INTMAX_HEX_WIDTH
   5.150 + *       PRINTF_INT64_HEX_WIDTH
   5.151 + *       PRINTF_INT32_HEX_WIDTH
   5.152 + *       PRINTF_INT16_HEX_WIDTH
   5.153 + *       PRINTF_INT8_HEX_WIDTH
   5.154 + *       PRINTF_INTMAX_DEC_WIDTH
   5.155 + *       PRINTF_INT64_DEC_WIDTH
   5.156 + *       PRINTF_INT32_DEC_WIDTH
   5.157 + *       PRINTF_INT16_DEC_WIDTH
   5.158 + *       PRINTF_UINT8_DEC_WIDTH
   5.159 + *       PRINTF_UINTMAX_DEC_WIDTH
   5.160 + *       PRINTF_UINT64_DEC_WIDTH
   5.161 + *       PRINTF_UINT32_DEC_WIDTH
   5.162 + *       PRINTF_UINT16_DEC_WIDTH
   5.163 + *       PRINTF_UINT8_DEC_WIDTH
   5.164 + *
   5.165 + *       Which specifies the maximum number of characters required to
   5.166 + *       print the number of that type in either hexadecimal or decimal.
   5.167 + *       These are an extension beyond what C99 specifies must be in
   5.168 + *       stdint.h.
   5.169 + *
   5.170 + *  Compilers tested (all with 0 warnings at their highest respective
   5.171 + *  settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
   5.172 + *  bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
   5.173 + *  .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
   5.174 + *
   5.175 + *  This file should be considered a work in progress.  Suggestions for
   5.176 + *  improvements, especially those which increase coverage are strongly
   5.177 + *  encouraged.
   5.178 + *
   5.179 + *  Acknowledgements
   5.180 + *
   5.181 + *  The following people have made significant contributions to the
   5.182 + *  development and testing of this file:
   5.183 + *
   5.184 + *  Chris Howie
   5.185 + *  John Steele Scott
   5.186 + *  Dave Thorup
   5.187 + *  John Dill
   5.188 + *  Florian Wobbe
   5.189 + *  Christopher Sean Morrison
   5.190 + *  Mikkel Fahnoe Jorgensen
   5.191 + *
   5.192 + */
   5.193 +
   5.194 +#include <stddef.h>
   5.195 +#include <limits.h>
   5.196 +#include <signal.h>
   5.197 +
   5.198 +/*
   5.199 + *  For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
   5.200 + *  do nothing else.  On the Mac OS X version of gcc this is _STDINT_H_.
   5.201 + */
   5.202 +
   5.203 +#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
   5.204 +#include <stdint.h>
   5.205 +#define _PSTDINT_H_INCLUDED
   5.206 +# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__))
   5.207 +#  ifndef PRINTF_INT64_MODIFIER
   5.208 +#   define PRINTF_INT64_MODIFIER "l"
   5.209 +#  endif
   5.210 +#  ifndef PRINTF_INT32_MODIFIER
   5.211 +#   define PRINTF_INT32_MODIFIER ""
   5.212 +#  endif
   5.213 +# else
   5.214 +#  ifndef PRINTF_INT64_MODIFIER
   5.215 +#   define PRINTF_INT64_MODIFIER "ll"
   5.216 +#  endif
   5.217 +#  ifndef PRINTF_INT32_MODIFIER
   5.218 +#   if (UINT_MAX == UINT32_MAX)
   5.219 +#    define PRINTF_INT32_MODIFIER ""
   5.220 +#   else
   5.221 +#    define PRINTF_INT32_MODIFIER "l"
   5.222 +#   endif
   5.223 +#  endif
   5.224 +# endif
   5.225 +# ifndef PRINTF_INT16_MODIFIER
   5.226 +#  define PRINTF_INT16_MODIFIER "h"
   5.227 +# endif
   5.228 +# ifndef PRINTF_INTMAX_MODIFIER
   5.229 +#  define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
   5.230 +# endif
   5.231 +# ifndef PRINTF_INT64_HEX_WIDTH
   5.232 +#  define PRINTF_INT64_HEX_WIDTH "16"
   5.233 +# endif
   5.234 +# ifndef PRINTF_UINT64_HEX_WIDTH
   5.235 +#  define PRINTF_UINT64_HEX_WIDTH "16"
   5.236 +# endif
   5.237 +# ifndef PRINTF_INT32_HEX_WIDTH
   5.238 +#  define PRINTF_INT32_HEX_WIDTH "8"
   5.239 +# endif
   5.240 +# ifndef PRINTF_UINT32_HEX_WIDTH
   5.241 +#  define PRINTF_UINT32_HEX_WIDTH "8"
   5.242 +# endif
   5.243 +# ifndef PRINTF_INT16_HEX_WIDTH
   5.244 +#  define PRINTF_INT16_HEX_WIDTH "4"
   5.245 +# endif
   5.246 +# ifndef PRINTF_UINT16_HEX_WIDTH
   5.247 +#  define PRINTF_UINT16_HEX_WIDTH "4"
   5.248 +# endif
   5.249 +# ifndef PRINTF_INT8_HEX_WIDTH
   5.250 +#  define PRINTF_INT8_HEX_WIDTH "2"
   5.251 +# endif
   5.252 +# ifndef PRINTF_UINT8_HEX_WIDTH
   5.253 +#  define PRINTF_UINT8_HEX_WIDTH "2"
   5.254 +# endif
   5.255 +# ifndef PRINTF_INT64_DEC_WIDTH
   5.256 +#  define PRINTF_INT64_DEC_WIDTH "19"
   5.257 +# endif
   5.258 +# ifndef PRINTF_UINT64_DEC_WIDTH
   5.259 +#  define PRINTF_UINT64_DEC_WIDTH "20"
   5.260 +# endif
   5.261 +# ifndef PRINTF_INT32_DEC_WIDTH
   5.262 +#  define PRINTF_INT32_DEC_WIDTH "10"
   5.263 +# endif
   5.264 +# ifndef PRINTF_UINT32_DEC_WIDTH
   5.265 +#  define PRINTF_UINT32_DEC_WIDTH "10"
   5.266 +# endif
   5.267 +# ifndef PRINTF_INT16_DEC_WIDTH
   5.268 +#  define PRINTF_INT16_DEC_WIDTH "5"
   5.269 +# endif
   5.270 +# ifndef PRINTF_UINT16_DEC_WIDTH
   5.271 +#  define PRINTF_UINT16_DEC_WIDTH "5"
   5.272 +# endif
   5.273 +# ifndef PRINTF_INT8_DEC_WIDTH
   5.274 +#  define PRINTF_INT8_DEC_WIDTH "3"
   5.275 +# endif
   5.276 +# ifndef PRINTF_UINT8_DEC_WIDTH
   5.277 +#  define PRINTF_UINT8_DEC_WIDTH "3"
   5.278 +# endif
   5.279 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   5.280 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
   5.281 +# endif
   5.282 +# ifndef PRINTF_UINTMAX_HEX_WIDTH
   5.283 +#  define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
   5.284 +# endif
   5.285 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   5.286 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
   5.287 +# endif
   5.288 +# ifndef PRINTF_UINTMAX_DEC_WIDTH
   5.289 +#  define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
   5.290 +# endif
   5.291 +
   5.292 +/*
   5.293 + *  Something really weird is going on with Open Watcom.  Just pull some of
   5.294 + *  these duplicated definitions from Open Watcom's stdint.h file for now.
   5.295 + */
   5.296 +
   5.297 +# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
   5.298 +#  if !defined (INT64_C)
   5.299 +#   define INT64_C(x)   (x + (INT64_MAX - INT64_MAX))
   5.300 +#  endif
   5.301 +#  if !defined (UINT64_C)
   5.302 +#   define UINT64_C(x)  (x + (UINT64_MAX - UINT64_MAX))
   5.303 +#  endif
   5.304 +#  if !defined (INT32_C)
   5.305 +#   define INT32_C(x)   (x + (INT32_MAX - INT32_MAX))
   5.306 +#  endif
   5.307 +#  if !defined (UINT32_C)
   5.308 +#   define UINT32_C(x)  (x + (UINT32_MAX - UINT32_MAX))
   5.309 +#  endif
   5.310 +#  if !defined (INT16_C)
   5.311 +#   define INT16_C(x)   (x)
   5.312 +#  endif
   5.313 +#  if !defined (UINT16_C)
   5.314 +#   define UINT16_C(x)  (x)
   5.315 +#  endif
   5.316 +#  if !defined (INT8_C)
   5.317 +#   define INT8_C(x)   (x)
   5.318 +#  endif
   5.319 +#  if !defined (UINT8_C)
   5.320 +#   define UINT8_C(x)  (x)
   5.321 +#  endif
   5.322 +#  if !defined (UINT64_MAX)
   5.323 +#   define UINT64_MAX  18446744073709551615ULL
   5.324 +#  endif
   5.325 +#  if !defined (INT64_MAX)
   5.326 +#   define INT64_MAX  9223372036854775807LL
   5.327 +#  endif
   5.328 +#  if !defined (UINT32_MAX)
   5.329 +#   define UINT32_MAX  4294967295UL
   5.330 +#  endif
   5.331 +#  if !defined (INT32_MAX)
   5.332 +#   define INT32_MAX  2147483647L
   5.333 +#  endif
   5.334 +#  if !defined (INTMAX_MAX)
   5.335 +#   define INTMAX_MAX INT64_MAX
   5.336 +#  endif
   5.337 +#  if !defined (INTMAX_MIN)
   5.338 +#   define INTMAX_MIN INT64_MIN
   5.339 +#  endif
   5.340 +# endif
   5.341 +#endif
   5.342 +
   5.343 +/*
   5.344 + *  I have no idea what is the truly correct thing to do on older Solaris.
   5.345 + *  From some online discussions, this seems to be what is being
   5.346 + *  recommended.  For people who actually are developing on older Solaris,
   5.347 + *  what I would like to know is, does this define all of the relevant
   5.348 + *  macros of a complete stdint.h?  Remember, in pstdint.h 64 bit is
   5.349 + *  considered optional.
   5.350 + */
   5.351 +
   5.352 +#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED)
   5.353 +#include <sys/inttypes.h>
   5.354 +#define _PSTDINT_H_INCLUDED
   5.355 +#endif
   5.356 +
   5.357 +#ifndef _PSTDINT_H_INCLUDED
   5.358 +#define _PSTDINT_H_INCLUDED
   5.359 +
   5.360 +#ifndef SIZE_MAX
   5.361 +# define SIZE_MAX (~(size_t)0)
   5.362 +#endif
   5.363 +
   5.364 +/*
   5.365 + *  Deduce the type assignments from limits.h under the assumption that
   5.366 + *  integer sizes in bits are powers of 2, and follow the ANSI
   5.367 + *  definitions.
   5.368 + */
   5.369 +
   5.370 +#ifndef UINT8_MAX
   5.371 +# define UINT8_MAX 0xff
   5.372 +#endif
   5.373 +#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks)
   5.374 +# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
   5.375 +    typedef unsigned char uint8_t;
   5.376 +#   define UINT8_C(v) ((uint8_t) v)
   5.377 +# else
   5.378 +#   error "Platform not supported"
   5.379 +# endif
   5.380 +#endif
   5.381 +
   5.382 +#ifndef INT8_MAX
   5.383 +# define INT8_MAX 0x7f
   5.384 +#endif
   5.385 +#ifndef INT8_MIN
   5.386 +# define INT8_MIN INT8_C(0x80)
   5.387 +#endif
   5.388 +#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks)
   5.389 +# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
   5.390 +    typedef signed char int8_t;
   5.391 +#   define INT8_C(v) ((int8_t) v)
   5.392 +# else
   5.393 +#   error "Platform not supported"
   5.394 +# endif
   5.395 +#endif
   5.396 +
   5.397 +#ifndef UINT16_MAX
   5.398 +# define UINT16_MAX 0xffff
   5.399 +#endif
   5.400 +#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks)
   5.401 +#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
   5.402 +  typedef unsigned int uint16_t;
   5.403 +# ifndef PRINTF_INT16_MODIFIER
   5.404 +#  define PRINTF_INT16_MODIFIER ""
   5.405 +# endif
   5.406 +# define UINT16_C(v) ((uint16_t) (v))
   5.407 +#elif (USHRT_MAX == UINT16_MAX)
   5.408 +  typedef unsigned short uint16_t;
   5.409 +# define UINT16_C(v) ((uint16_t) (v))
   5.410 +# ifndef PRINTF_INT16_MODIFIER
   5.411 +#  define PRINTF_INT16_MODIFIER "h"
   5.412 +# endif
   5.413 +#else
   5.414 +#error "Platform not supported"
   5.415 +#endif
   5.416 +#endif
   5.417 +
   5.418 +#ifndef INT16_MAX
   5.419 +# define INT16_MAX 0x7fff
   5.420 +#endif
   5.421 +#ifndef INT16_MIN
   5.422 +# define INT16_MIN INT16_C(0x8000)
   5.423 +#endif
   5.424 +#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks)
   5.425 +#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
   5.426 +  typedef signed int int16_t;
   5.427 +# define INT16_C(v) ((int16_t) (v))
   5.428 +# ifndef PRINTF_INT16_MODIFIER
   5.429 +#  define PRINTF_INT16_MODIFIER ""
   5.430 +# endif
   5.431 +#elif (SHRT_MAX == INT16_MAX)
   5.432 +  typedef signed short int16_t;
   5.433 +# define INT16_C(v) ((int16_t) (v))
   5.434 +# ifndef PRINTF_INT16_MODIFIER
   5.435 +#  define PRINTF_INT16_MODIFIER "h"
   5.436 +# endif
   5.437 +#else
   5.438 +#error "Platform not supported"
   5.439 +#endif
   5.440 +#endif
   5.441 +
   5.442 +#ifndef UINT32_MAX
   5.443 +# define UINT32_MAX (0xffffffffUL)
   5.444 +#endif
   5.445 +#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks)
   5.446 +#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
   5.447 +  typedef unsigned long uint32_t;
   5.448 +# define UINT32_C(v) v ## UL
   5.449 +# ifndef PRINTF_INT32_MODIFIER
   5.450 +#  define PRINTF_INT32_MODIFIER "l"
   5.451 +# endif
   5.452 +#elif (UINT_MAX == UINT32_MAX)
   5.453 +  typedef unsigned int uint32_t;
   5.454 +# ifndef PRINTF_INT32_MODIFIER
   5.455 +#  define PRINTF_INT32_MODIFIER ""
   5.456 +# endif
   5.457 +# define UINT32_C(v) v ## U
   5.458 +#elif (USHRT_MAX == UINT32_MAX)
   5.459 +  typedef unsigned short uint32_t;
   5.460 +# define UINT32_C(v) ((unsigned short) (v))
   5.461 +# ifndef PRINTF_INT32_MODIFIER
   5.462 +#  define PRINTF_INT32_MODIFIER ""
   5.463 +# endif
   5.464 +#else
   5.465 +#error "Platform not supported"
   5.466 +#endif
   5.467 +#endif
   5.468 +
   5.469 +#ifndef INT32_MAX
   5.470 +# define INT32_MAX (0x7fffffffL)
   5.471 +#endif
   5.472 +#ifndef INT32_MIN
   5.473 +# define INT32_MIN INT32_C(0x80000000)
   5.474 +#endif
   5.475 +#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks)
   5.476 +#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
   5.477 +  typedef signed long int32_t;
   5.478 +# define INT32_C(v) v ## L
   5.479 +# ifndef PRINTF_INT32_MODIFIER
   5.480 +#  define PRINTF_INT32_MODIFIER "l"
   5.481 +# endif
   5.482 +#elif (INT_MAX == INT32_MAX)
   5.483 +  typedef signed int int32_t;
   5.484 +# define INT32_C(v) v
   5.485 +# ifndef PRINTF_INT32_MODIFIER
   5.486 +#  define PRINTF_INT32_MODIFIER ""
   5.487 +# endif
   5.488 +#elif (SHRT_MAX == INT32_MAX)
   5.489 +  typedef signed short int32_t;
   5.490 +# define INT32_C(v) ((short) (v))
   5.491 +# ifndef PRINTF_INT32_MODIFIER
   5.492 +#  define PRINTF_INT32_MODIFIER ""
   5.493 +# endif
   5.494 +#else
   5.495 +#error "Platform not supported"
   5.496 +#endif
   5.497 +#endif
   5.498 +
   5.499 +/*
   5.500 + *  The macro stdint_int64_defined is temporarily used to record
   5.501 + *  whether or not 64 integer support is available.  It must be
   5.502 + *  defined for any 64 integer extensions for new platforms that are
   5.503 + *  added.
   5.504 + */
   5.505 +
   5.506 +#undef stdint_int64_defined
   5.507 +#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
   5.508 +# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
   5.509 +#  define stdint_int64_defined
   5.510 +   typedef long long int64_t;
   5.511 +   typedef unsigned long long uint64_t;
   5.512 +#  define UINT64_C(v) v ## ULL
   5.513 +#  define  INT64_C(v) v ## LL
   5.514 +#  ifndef PRINTF_INT64_MODIFIER
   5.515 +#   define PRINTF_INT64_MODIFIER "ll"
   5.516 +#  endif
   5.517 +# endif
   5.518 +#endif
   5.519 +
   5.520 +#if !defined (stdint_int64_defined)
   5.521 +# if defined(__GNUC__) && !defined(vxWorks)
   5.522 +#  define stdint_int64_defined
   5.523 +   __extension__ typedef long long int64_t;
   5.524 +   __extension__ typedef unsigned long long uint64_t;
   5.525 +#  define UINT64_C(v) v ## ULL
   5.526 +#  define  INT64_C(v) v ## LL
   5.527 +#  ifndef PRINTF_INT64_MODIFIER
   5.528 +#   define PRINTF_INT64_MODIFIER "ll"
   5.529 +#  endif
   5.530 +# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
   5.531 +#  define stdint_int64_defined
   5.532 +   typedef long long int64_t;
   5.533 +   typedef unsigned long long uint64_t;
   5.534 +#  define UINT64_C(v) v ## ULL
   5.535 +#  define  INT64_C(v) v ## LL
   5.536 +#  ifndef PRINTF_INT64_MODIFIER
   5.537 +#   define PRINTF_INT64_MODIFIER "ll"
   5.538 +#  endif
   5.539 +# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
   5.540 +#  define stdint_int64_defined
   5.541 +   typedef __int64 int64_t;
   5.542 +   typedef unsigned __int64 uint64_t;
   5.543 +#  define UINT64_C(v) v ## UI64
   5.544 +#  define  INT64_C(v) v ## I64
   5.545 +#  ifndef PRINTF_INT64_MODIFIER
   5.546 +#   define PRINTF_INT64_MODIFIER "I64"
   5.547 +#  endif
   5.548 +# endif
   5.549 +#endif
   5.550 +
   5.551 +#if !defined (LONG_LONG_MAX) && defined (INT64_C)
   5.552 +# define LONG_LONG_MAX INT64_C (9223372036854775807)
   5.553 +#endif
   5.554 +#ifndef ULONG_LONG_MAX
   5.555 +# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
   5.556 +#endif
   5.557 +
   5.558 +#if !defined (INT64_MAX) && defined (INT64_C)
   5.559 +# define INT64_MAX INT64_C (9223372036854775807)
   5.560 +#endif
   5.561 +#if !defined (INT64_MIN) && defined (INT64_C)
   5.562 +# define INT64_MIN INT64_C (-9223372036854775808)
   5.563 +#endif
   5.564 +#if !defined (UINT64_MAX) && defined (INT64_C)
   5.565 +# define UINT64_MAX UINT64_C (18446744073709551615)
   5.566 +#endif
   5.567 +
   5.568 +/*
   5.569 + *  Width of hexadecimal for number field.
   5.570 + */
   5.571 +
   5.572 +#ifndef PRINTF_INT64_HEX_WIDTH
   5.573 +# define PRINTF_INT64_HEX_WIDTH "16"
   5.574 +#endif
   5.575 +#ifndef PRINTF_INT32_HEX_WIDTH
   5.576 +# define PRINTF_INT32_HEX_WIDTH "8"
   5.577 +#endif
   5.578 +#ifndef PRINTF_INT16_HEX_WIDTH
   5.579 +# define PRINTF_INT16_HEX_WIDTH "4"
   5.580 +#endif
   5.581 +#ifndef PRINTF_INT8_HEX_WIDTH
   5.582 +# define PRINTF_INT8_HEX_WIDTH "2"
   5.583 +#endif
   5.584 +#ifndef PRINTF_INT64_DEC_WIDTH
   5.585 +# define PRINTF_INT64_DEC_WIDTH "19"
   5.586 +#endif
   5.587 +#ifndef PRINTF_INT32_DEC_WIDTH
   5.588 +# define PRINTF_INT32_DEC_WIDTH "10"
   5.589 +#endif
   5.590 +#ifndef PRINTF_INT16_DEC_WIDTH
   5.591 +# define PRINTF_INT16_DEC_WIDTH "5"
   5.592 +#endif
   5.593 +#ifndef PRINTF_INT8_DEC_WIDTH
   5.594 +# define PRINTF_INT8_DEC_WIDTH "3"
   5.595 +#endif
   5.596 +#ifndef PRINTF_UINT64_DEC_WIDTH
   5.597 +# define PRINTF_UINT64_DEC_WIDTH "20"
   5.598 +#endif
   5.599 +#ifndef PRINTF_UINT32_DEC_WIDTH
   5.600 +# define PRINTF_UINT32_DEC_WIDTH "10"
   5.601 +#endif
   5.602 +#ifndef PRINTF_UINT16_DEC_WIDTH
   5.603 +# define PRINTF_UINT16_DEC_WIDTH "5"
   5.604 +#endif
   5.605 +#ifndef PRINTF_UINT8_DEC_WIDTH
   5.606 +# define PRINTF_UINT8_DEC_WIDTH "3"
   5.607 +#endif
   5.608 +
   5.609 +/*
   5.610 + *  Ok, lets not worry about 128 bit integers for now.  Moore's law says
   5.611 + *  we don't need to worry about that until about 2040 at which point
   5.612 + *  we'll have bigger things to worry about.
   5.613 + */
   5.614 +
   5.615 +#ifdef stdint_int64_defined
   5.616 +  typedef int64_t intmax_t;
   5.617 +  typedef uint64_t uintmax_t;
   5.618 +# define  INTMAX_MAX   INT64_MAX
   5.619 +# define  INTMAX_MIN   INT64_MIN
   5.620 +# define UINTMAX_MAX  UINT64_MAX
   5.621 +# define UINTMAX_C(v) UINT64_C(v)
   5.622 +# define  INTMAX_C(v)  INT64_C(v)
   5.623 +# ifndef PRINTF_INTMAX_MODIFIER
   5.624 +#   define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
   5.625 +# endif
   5.626 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   5.627 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
   5.628 +# endif
   5.629 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   5.630 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
   5.631 +# endif
   5.632 +#else
   5.633 +  typedef int32_t intmax_t;
   5.634 +  typedef uint32_t uintmax_t;
   5.635 +# define  INTMAX_MAX   INT32_MAX
   5.636 +# define UINTMAX_MAX  UINT32_MAX
   5.637 +# define UINTMAX_C(v) UINT32_C(v)
   5.638 +# define  INTMAX_C(v)  INT32_C(v)
   5.639 +# ifndef PRINTF_INTMAX_MODIFIER
   5.640 +#   define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
   5.641 +# endif
   5.642 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   5.643 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
   5.644 +# endif
   5.645 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   5.646 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
   5.647 +# endif
   5.648 +#endif
   5.649 +
   5.650 +/*
   5.651 + *  Because this file currently only supports platforms which have
   5.652 + *  precise powers of 2 as bit sizes for the default integers, the
   5.653 + *  least definitions are all trivial.  Its possible that a future
   5.654 + *  version of this file could have different definitions.
   5.655 + */
   5.656 +
   5.657 +#ifndef stdint_least_defined
   5.658 +  typedef   int8_t   int_least8_t;
   5.659 +  typedef  uint8_t  uint_least8_t;
   5.660 +  typedef  int16_t  int_least16_t;
   5.661 +  typedef uint16_t uint_least16_t;
   5.662 +  typedef  int32_t  int_least32_t;
   5.663 +  typedef uint32_t uint_least32_t;
   5.664 +# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
   5.665 +# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
   5.666 +# define  UINT_LEAST8_MAX  UINT8_MAX
   5.667 +# define   INT_LEAST8_MAX   INT8_MAX
   5.668 +# define UINT_LEAST16_MAX UINT16_MAX
   5.669 +# define  INT_LEAST16_MAX  INT16_MAX
   5.670 +# define UINT_LEAST32_MAX UINT32_MAX
   5.671 +# define  INT_LEAST32_MAX  INT32_MAX
   5.672 +# define   INT_LEAST8_MIN   INT8_MIN
   5.673 +# define  INT_LEAST16_MIN  INT16_MIN
   5.674 +# define  INT_LEAST32_MIN  INT32_MIN
   5.675 +# ifdef stdint_int64_defined
   5.676 +    typedef  int64_t  int_least64_t;
   5.677 +    typedef uint64_t uint_least64_t;
   5.678 +#   define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
   5.679 +#   define UINT_LEAST64_MAX UINT64_MAX
   5.680 +#   define  INT_LEAST64_MAX  INT64_MAX
   5.681 +#   define  INT_LEAST64_MIN  INT64_MIN
   5.682 +# endif
   5.683 +#endif
   5.684 +#undef stdint_least_defined
   5.685 +
   5.686 +/*
   5.687 + *  The ANSI C committee pretending to know or specify anything about
   5.688 + *  performance is the epitome of misguided arrogance.  The mandate of
   5.689 + *  this file is to *ONLY* ever support that absolute minimum
   5.690 + *  definition of the fast integer types, for compatibility purposes.
   5.691 + *  No extensions, and no attempt to suggest what may or may not be a
   5.692 + *  faster integer type will ever be made in this file.  Developers are
   5.693 + *  warned to stay away from these types when using this or any other
   5.694 + *  stdint.h.
   5.695 + */
   5.696 +
   5.697 +typedef   int_least8_t   int_fast8_t;
   5.698 +typedef  uint_least8_t  uint_fast8_t;
   5.699 +typedef  int_least16_t  int_fast16_t;
   5.700 +typedef uint_least16_t uint_fast16_t;
   5.701 +typedef  int_least32_t  int_fast32_t;
   5.702 +typedef uint_least32_t uint_fast32_t;
   5.703 +#define  UINT_FAST8_MAX  UINT_LEAST8_MAX
   5.704 +#define   INT_FAST8_MAX   INT_LEAST8_MAX
   5.705 +#define UINT_FAST16_MAX UINT_LEAST16_MAX
   5.706 +#define  INT_FAST16_MAX  INT_LEAST16_MAX
   5.707 +#define UINT_FAST32_MAX UINT_LEAST32_MAX
   5.708 +#define  INT_FAST32_MAX  INT_LEAST32_MAX
   5.709 +#define   INT_FAST8_MIN   INT_LEAST8_MIN
   5.710 +#define  INT_FAST16_MIN  INT_LEAST16_MIN
   5.711 +#define  INT_FAST32_MIN  INT_LEAST32_MIN
   5.712 +#ifdef stdint_int64_defined
   5.713 +  typedef  int_least64_t  int_fast64_t;
   5.714 +  typedef uint_least64_t uint_fast64_t;
   5.715 +# define UINT_FAST64_MAX UINT_LEAST64_MAX
   5.716 +# define  INT_FAST64_MAX  INT_LEAST64_MAX
   5.717 +# define  INT_FAST64_MIN  INT_LEAST64_MIN
   5.718 +#endif
   5.719 +
   5.720 +#undef stdint_int64_defined
   5.721 +
   5.722 +/*
   5.723 + *  Whatever piecemeal, per compiler thing we can do about the wchar_t
   5.724 + *  type limits.
   5.725 + */
   5.726 +
   5.727 +#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks)
   5.728 +# include <wchar.h>
   5.729 +# ifndef WCHAR_MIN
   5.730 +#  define WCHAR_MIN 0
   5.731 +# endif
   5.732 +# ifndef WCHAR_MAX
   5.733 +#  define WCHAR_MAX ((wchar_t)-1)
   5.734 +# endif
   5.735 +#endif
   5.736 +
   5.737 +/*
   5.738 + *  Whatever piecemeal, per compiler/platform thing we can do about the
   5.739 + *  (u)intptr_t types and limits.
   5.740 + */
   5.741 +
   5.742 +#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)
   5.743 +# define STDINT_H_UINTPTR_T_DEFINED
   5.744 +#endif
   5.745 +
   5.746 +#ifndef STDINT_H_UINTPTR_T_DEFINED
   5.747 +# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)
   5.748 +#  define stdint_intptr_bits 64
   5.749 +# elif defined (__WATCOMC__) || defined (__TURBOC__)
   5.750 +#  if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
   5.751 +#    define stdint_intptr_bits 16
   5.752 +#  else
   5.753 +#    define stdint_intptr_bits 32
   5.754 +#  endif
   5.755 +# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)
   5.756 +#  define stdint_intptr_bits 32
   5.757 +# elif defined (__INTEL_COMPILER)
   5.758 +/* TODO -- what did Intel do about x86-64? */
   5.759 +# else
   5.760 +/* #error "This platform might not be supported yet" */
   5.761 +# endif
   5.762 +
   5.763 +# ifdef stdint_intptr_bits
   5.764 +#  define stdint_intptr_glue3_i(a,b,c)  a##b##c
   5.765 +#  define stdint_intptr_glue3(a,b,c)    stdint_intptr_glue3_i(a,b,c)
   5.766 +#  ifndef PRINTF_INTPTR_MODIFIER
   5.767 +#    define PRINTF_INTPTR_MODIFIER      stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
   5.768 +#  endif
   5.769 +#  ifndef PTRDIFF_MAX
   5.770 +#    define PTRDIFF_MAX                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
   5.771 +#  endif
   5.772 +#  ifndef PTRDIFF_MIN
   5.773 +#    define PTRDIFF_MIN                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
   5.774 +#  endif
   5.775 +#  ifndef UINTPTR_MAX
   5.776 +#    define UINTPTR_MAX                 stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
   5.777 +#  endif
   5.778 +#  ifndef INTPTR_MAX
   5.779 +#    define INTPTR_MAX                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
   5.780 +#  endif
   5.781 +#  ifndef INTPTR_MIN
   5.782 +#    define INTPTR_MIN                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
   5.783 +#  endif
   5.784 +#  ifndef INTPTR_C
   5.785 +#    define INTPTR_C(x)                 stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
   5.786 +#  endif
   5.787 +#  ifndef UINTPTR_C
   5.788 +#    define UINTPTR_C(x)                stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
   5.789 +#  endif
   5.790 +  typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
   5.791 +  typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t)  intptr_t;
   5.792 +# else
   5.793 +/* TODO -- This following is likely wrong for some platforms, and does
   5.794 +   nothing for the definition of uintptr_t. */
   5.795 +  typedef ptrdiff_t intptr_t;
   5.796 +# endif
   5.797 +# define STDINT_H_UINTPTR_T_DEFINED
   5.798 +#endif
   5.799 +
   5.800 +/*
   5.801 + *  Assumes sig_atomic_t is signed and we have a 2s complement machine.
   5.802 + */
   5.803 +
   5.804 +#ifndef SIG_ATOMIC_MAX
   5.805 +# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
   5.806 +#endif
   5.807 +
   5.808 +#endif
   5.809 +
   5.810 +#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
   5.811 +
   5.812 +/*
   5.813 + *  Please compile with the maximum warning settings to make sure macros are
   5.814 + *  not defined more than once.
   5.815 + */
   5.816 +
   5.817 +#include <stdlib.h>
   5.818 +#include <stdio.h>
   5.819 +#include <string.h>
   5.820 +
   5.821 +#define glue3_aux(x,y,z) x ## y ## z
   5.822 +#define glue3(x,y,z) glue3_aux(x,y,z)
   5.823 +
   5.824 +#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);
   5.825 +#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);
   5.826 +
   5.827 +#define DECL(us,bits) glue3(DECL,us,) (bits)
   5.828 +
   5.829 +#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits)
   5.830 +
   5.831 +#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; }
   5.832 +
   5.833 +int main () {
   5.834 +	int err_n = 0;
   5.835 +	int err_first = 0;
   5.836 +	DECL(I,8)
   5.837 +	DECL(U,8)
   5.838 +	DECL(I,16)
   5.839 +	DECL(U,16)
   5.840 +	DECL(I,32)
   5.841 +	DECL(U,32)
   5.842 +#ifdef INT64_MAX
   5.843 +	DECL(I,64)
   5.844 +	DECL(U,64)
   5.845 +#endif
   5.846 +	intmax_t imax = INTMAX_C(0);
   5.847 +	uintmax_t umax = UINTMAX_C(0);
   5.848 +	char str0[256], str1[256];
   5.849 +
   5.850 +	sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647));
   5.851 +	if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
   5.852 +	if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH));
   5.853 +	sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295));
   5.854 +	if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
   5.855 +	if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH));
   5.856 +#ifdef INT64_MAX
   5.857 +	sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807));
   5.858 +	if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
   5.859 +	if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1)));
   5.860 +	sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591));
   5.861 +	if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
   5.862 +	if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1)));
   5.863 +#endif
   5.864 +
   5.865 +	sprintf (str0, "%d %x\n", 0, ~0);
   5.866 +
   5.867 +	sprintf (str1, "%d %x\n",  i8, ~0);
   5.868 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1));
   5.869 +	sprintf (str1, "%u %x\n",  u8, ~0);
   5.870 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1));
   5.871 +	sprintf (str1, "%d %x\n",  i16, ~0);
   5.872 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1));
   5.873 +	sprintf (str1, "%u %x\n",  u16, ~0);
   5.874 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1));
   5.875 +	sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n",  i32, ~0);
   5.876 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1));
   5.877 +	sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n",  u32, ~0);
   5.878 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1));
   5.879 +#ifdef INT64_MAX
   5.880 +	sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n",  i64, ~0);
   5.881 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1));
   5.882 +#endif
   5.883 +	sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n",  imax, ~0);
   5.884 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1));
   5.885 +	sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n",  umax, ~0);
   5.886 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1));
   5.887 +
   5.888 +	TESTUMAX(8);
   5.889 +	TESTUMAX(16);
   5.890 +	TESTUMAX(32);
   5.891 +#ifdef INT64_MAX
   5.892 +	TESTUMAX(64);
   5.893 +#endif
   5.894 +
   5.895 +#define STR(v) #v
   5.896 +#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v));
   5.897 +	if (err_n) {
   5.898 +		printf ("pstdint.h is not correct.  Please use sizes below to correct it:\n");
   5.899 +	}
   5.900 +
   5.901 +	Q(int)
   5.902 +	Q(unsigned)
   5.903 +	Q(long int)
   5.904 +	Q(short int)
   5.905 +	Q(int8_t)
   5.906 +	Q(int16_t)
   5.907 +	Q(int32_t)
   5.908 +#ifdef INT64_MAX
   5.909 +	Q(int64_t)
   5.910 +#endif
   5.911 +
   5.912 +	return EXIT_SUCCESS;
   5.913 +}
   5.914 +
   5.915 +#endif
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/include/miniassimp/Compiler/pushpack1.h	Mon Jan 28 18:19:26 2019 +0200
     6.3 @@ -0,0 +1,43 @@
     6.4 +
     6.5 +
     6.6 +// ===============================================================================
     6.7 +// May be included multiple times - sets structure packing to 1 
     6.8 +// for all supported compilers. #include <poppack1.h> reverts the changes.
     6.9 +//
    6.10 +// Currently this works on the following compilers:
    6.11 +// MSVC 7,8,9
    6.12 +// GCC
    6.13 +// BORLAND (complains about 'pack state changed but not reverted', but works)
    6.14 +// Clang
    6.15 +//
    6.16 +//
    6.17 +// USAGE:
    6.18 +//
    6.19 +// struct StructToBePacked {
    6.20 +// } PACK_STRUCT;
    6.21 +//
    6.22 +// ===============================================================================
    6.23 +
    6.24 +#ifdef AI_PUSHPACK_IS_DEFINED
    6.25 +#	error poppack1.h must be included after pushpack1.h
    6.26 +#endif
    6.27 +
    6.28 +#if defined(_MSC_VER) ||  defined(__BORLANDC__) ||	defined (__BCPLUSPLUS__)
    6.29 +#	pragma pack(push,1)
    6.30 +#	define PACK_STRUCT
    6.31 +#elif defined( __GNUC__ ) || defined(__clang__)
    6.32 +#	if !defined(HOST_MINGW)
    6.33 +#		define PACK_STRUCT	__attribute__((__packed__))
    6.34 +#	else
    6.35 +#		define PACK_STRUCT	__attribute__((gcc_struct, __packed__))
    6.36 +#	endif
    6.37 +#else
    6.38 +#	error Compiler not supported
    6.39 +#endif
    6.40 +
    6.41 +#if defined(_MSC_VER)
    6.42 +// C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop
    6.43 +#	pragma warning (disable : 4103) 
    6.44 +#endif
    6.45 +
    6.46 +#define AI_PUSHPACK_IS_DEFINED
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/include/miniassimp/DefaultIOStream.h	Mon Jan 28 18:19:26 2019 +0200
     7.3 @@ -0,0 +1,140 @@
     7.4 +/*
     7.5 +Open Asset Import Library (assimp)
     7.6 +----------------------------------------------------------------------
     7.7 +
     7.8 +Copyright (c) 2006-2018, assimp team
     7.9 +
    7.10 +
    7.11 +All rights reserved.
    7.12 +
    7.13 +Redistribution and use of this software in source and binary forms,
    7.14 +with or without modification, are permitted provided that the
    7.15 +following conditions are met:
    7.16 +
    7.17 +* Redistributions of source code must retain the above
    7.18 +  copyright notice, this list of conditions and the
    7.19 +  following disclaimer.
    7.20 +
    7.21 +* Redistributions in binary form must reproduce the above
    7.22 +  copyright notice, this list of conditions and the
    7.23 +  following disclaimer in the documentation and/or other
    7.24 +  materials provided with the distribution.
    7.25 +
    7.26 +* Neither the name of the assimp team, nor the names of its
    7.27 +  contributors may be used to endorse or promote products
    7.28 +  derived from this software without specific prior
    7.29 +  written permission of the assimp team.
    7.30 +
    7.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    7.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    7.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    7.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    7.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    7.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    7.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    7.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    7.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    7.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    7.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    7.42 +
    7.43 +----------------------------------------------------------------------
    7.44 +*/
    7.45 +
    7.46 +/** @file Default file I/O using fXXX()-family of functions */
    7.47 +#ifndef AI_DEFAULTIOSTREAM_H_INC
    7.48 +#define AI_DEFAULTIOSTREAM_H_INC
    7.49 +
    7.50 +#include <stdio.h>
    7.51 +#include <miniassimp/IOStream.hpp>
    7.52 +#include <miniassimp/importerdesc.h>
    7.53 +#include <miniassimp/Defines.h>
    7.54 +
    7.55 +namespace Assimp    {
    7.56 +
    7.57 +// ----------------------------------------------------------------------------------
    7.58 +//! @class  DefaultIOStream
    7.59 +//! @brief  Default IO implementation, use standard IO operations
    7.60 +//! @note   An instance of this class can exist without a valid file handle
    7.61 +//!         attached to it. All calls fail, but the instance can nevertheless be
    7.62 +//!         used with no restrictions.
    7.63 +class ASSIMP_API DefaultIOStream : public IOStream
    7.64 +{
    7.65 +    friend class DefaultIOSystem;
    7.66 +#if __ANDROID__
    7.67 +# if __ANDROID_API__ > 9
    7.68 +#  if defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
    7.69 +    friend class AndroidJNIIOSystem;
    7.70 +#  endif // defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
    7.71 +# endif // __ANDROID_API__ > 9
    7.72 +#endif // __ANDROID__
    7.73 +
    7.74 +protected:
    7.75 +    DefaultIOStream() AI_NO_EXCEPT;
    7.76 +    DefaultIOStream(FILE* pFile, const std::string &strFilename);
    7.77 +
    7.78 +public:
    7.79 +    /** Destructor public to allow simple deletion to close the file. */
    7.80 +    ~DefaultIOStream ();
    7.81 +
    7.82 +    // -------------------------------------------------------------------
    7.83 +    /// Read from stream
    7.84 +    size_t Read(void* pvBuffer,
    7.85 +        size_t pSize,
    7.86 +        size_t pCount);
    7.87 +
    7.88 +
    7.89 +    // -------------------------------------------------------------------
    7.90 +    /// Write to stream
    7.91 +    size_t Write(const void* pvBuffer,
    7.92 +        size_t pSize,
    7.93 +        size_t pCount);
    7.94 +
    7.95 +    // -------------------------------------------------------------------
    7.96 +    /// Seek specific position
    7.97 +    aiReturn Seek(size_t pOffset,
    7.98 +        aiOrigin pOrigin);
    7.99 +
   7.100 +    // -------------------------------------------------------------------
   7.101 +    /// Get current seek position
   7.102 +    size_t Tell() const;
   7.103 +
   7.104 +    // -------------------------------------------------------------------
   7.105 +    /// Get size of file
   7.106 +    size_t FileSize() const;
   7.107 +
   7.108 +    // -------------------------------------------------------------------
   7.109 +    /// Flush file contents
   7.110 +    void Flush();
   7.111 +
   7.112 +private:
   7.113 +    //  File data-structure, using clib
   7.114 +    FILE* mFile;
   7.115 +    //  Filename
   7.116 +    std::string mFilename;
   7.117 +    // Cached file size
   7.118 +    mutable size_t mCachedSize;
   7.119 +};
   7.120 +
   7.121 +// ----------------------------------------------------------------------------------
   7.122 +inline
   7.123 +DefaultIOStream::DefaultIOStream() AI_NO_EXCEPT
   7.124 +: mFile(0)
   7.125 +, mFilename("")
   7.126 +, mCachedSize(SIZE_MAX) {
   7.127 +    // empty
   7.128 +}
   7.129 +
   7.130 +// ----------------------------------------------------------------------------------
   7.131 +inline
   7.132 +DefaultIOStream::DefaultIOStream (FILE* pFile, const std::string &strFilename)
   7.133 +: mFile(pFile)
   7.134 +, mFilename(strFilename)
   7.135 +, mCachedSize(SIZE_MAX) {
   7.136 +    // empty
   7.137 +}
   7.138 +// ----------------------------------------------------------------------------------
   7.139 +
   7.140 +} // ns assimp
   7.141 +
   7.142 +#endif //!!AI_DEFAULTIOSTREAM_H_INC
   7.143 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/include/miniassimp/DefaultLogger.hpp	Mon Jan 28 18:19:26 2019 +0200
     8.3 @@ -0,0 +1,188 @@
     8.4 +/*
     8.5 +Open Asset Import Library (assimp)
     8.6 +----------------------------------------------------------------------
     8.7 +
     8.8 +Copyright (c) 2006-2018, assimp team
     8.9 +
    8.10 +
    8.11 +All rights reserved.
    8.12 +
    8.13 +Redistribution and use of this software in source and binary forms,
    8.14 +with or without modification, are permitted provided that the
    8.15 +following conditions are met:
    8.16 +
    8.17 +* Redistributions of source code must retain the above
    8.18 +  copyright notice, this list of conditions and the
    8.19 +  following disclaimer.
    8.20 +
    8.21 +* Redistributions in binary form must reproduce the above
    8.22 +  copyright notice, this list of conditions and the
    8.23 +  following disclaimer in the documentation and/or other
    8.24 +  materials provided with the distribution.
    8.25 +
    8.26 +* Neither the name of the assimp team, nor the names of its
    8.27 +  contributors may be used to endorse or promote products
    8.28 +  derived from this software without specific prior
    8.29 +  written permission of the assimp team.
    8.30 +
    8.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    8.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    8.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    8.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    8.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    8.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    8.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    8.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    8.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    8.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    8.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    8.42 +
    8.43 +----------------------------------------------------------------------
    8.44 +*/
    8.45 +/** @file DefaultLogger.hpp
    8.46 +*/
    8.47 +
    8.48 +#ifndef INCLUDED_AI_DEFAULTLOGGER
    8.49 +#define INCLUDED_AI_DEFAULTLOGGER
    8.50 +
    8.51 +#include "Logger.hpp"
    8.52 +#include "LogStream.hpp"
    8.53 +#include "NullLogger.hpp"
    8.54 +#include <vector>
    8.55 +
    8.56 +namespace Assimp    {
    8.57 +// ------------------------------------------------------------------------------------
    8.58 +class IOStream;
    8.59 +struct LogStreamInfo;
    8.60 +
    8.61 +/** default name of logfile */
    8.62 +#define ASSIMP_DEFAULT_LOG_NAME "AssimpLog.txt"
    8.63 +
    8.64 +// ------------------------------------------------------------------------------------
    8.65 +/** @brief CPP-API: Primary logging facility of Assimp.
    8.66 + *
    8.67 + *  The library stores its primary #Logger as a static member of this class.
    8.68 + *  #get() returns this primary logger. By default the underlying implementation is
    8.69 + *  just a #NullLogger which rejects all log messages. By calling #create(), logging
    8.70 + *  is turned on. To capture the log output multiple log streams (#LogStream) can be
    8.71 + *  attach to the logger. Some default streams for common streaming locations (such as
    8.72 + *  a file, std::cout, OutputDebugString()) are also provided.
    8.73 + *
    8.74 + *  If you wish to customize the logging at an even deeper level supply your own
    8.75 + *  implementation of #Logger to #set().
    8.76 + *  @note The whole logging stuff causes a small extra overhead for all imports. */
    8.77 +class ASSIMP_API DefaultLogger :
    8.78 +    public Logger   {
    8.79 +
    8.80 +public:
    8.81 +
    8.82 +    // ----------------------------------------------------------------------
    8.83 +    /** @brief Creates a logging instance.
    8.84 +     *  @param name Name for log file. Only valid in combination
    8.85 +     *    with the aiDefaultLogStream_FILE flag.
    8.86 +     *  @param severity Log severity, VERBOSE turns on debug messages
    8.87 +     *  @param defStreams  Default log streams to be attached. Any bitwise
    8.88 +     *    combination of the aiDefaultLogStream enumerated values.
    8.89 +     *    If #aiDefaultLogStream_FILE is specified but an empty string is
    8.90 +     *    passed for 'name', no log file is created at all.
    8.91 +     *  @param  io IOSystem to be used to open external files (such as the
    8.92 +     *   log file). Pass NULL to rely on the default implementation.
    8.93 +     *  This replaces the default #NullLogger with a #DefaultLogger instance. */
    8.94 +    static Logger *create(const char* name = ASSIMP_DEFAULT_LOG_NAME,
    8.95 +        LogSeverity severity    = NORMAL,
    8.96 +        unsigned int defStreams = aiDefaultLogStream_DEBUGGER | aiDefaultLogStream_FILE,
    8.97 +        IOSystem* io            = NULL);
    8.98 +
    8.99 +    // ----------------------------------------------------------------------
   8.100 +    /** @brief Setup a custom #Logger implementation.
   8.101 +     *
   8.102 +     *  Use this if the provided #DefaultLogger class doesn't fit into
   8.103 +     *  your needs. If the provided message formatting is OK for you,
   8.104 +     *  it's much easier to use #create() and to attach your own custom
   8.105 +     *  output streams to it.
   8.106 +     *  @param logger Pass NULL to setup a default NullLogger*/
   8.107 +    static void set (Logger *logger);
   8.108 +
   8.109 +    // ----------------------------------------------------------------------
   8.110 +    /** @brief  Getter for singleton instance
   8.111 +     *   @return Only instance. This is never null, but it could be a
   8.112 +     *  NullLogger. Use isNullLogger to check this.*/
   8.113 +    static Logger *get();
   8.114 +
   8.115 +    // ----------------------------------------------------------------------
   8.116 +    /** @brief  Return whether a #NullLogger is currently active
   8.117 +     *  @return true if the current logger is a #NullLogger.
   8.118 +     *  Use create() or set() to setup a logger that does actually do
   8.119 +     *  something else than just rejecting all log messages. */
   8.120 +    static bool isNullLogger();
   8.121 +
   8.122 +    // ----------------------------------------------------------------------
   8.123 +    /** @brief  Kills the current singleton logger and replaces it with a
   8.124 +     *  #NullLogger instance. */
   8.125 +    static void kill();
   8.126 +
   8.127 +    // ----------------------------------------------------------------------
   8.128 +    /** @copydoc Logger::attachStream   */
   8.129 +    bool attachStream(LogStream *pStream,
   8.130 +        unsigned int severity);
   8.131 +
   8.132 +    // ----------------------------------------------------------------------
   8.133 +    /** @copydoc Logger::detatchStream */
   8.134 +    bool detatchStream(LogStream *pStream,
   8.135 +        unsigned int severity);
   8.136 +
   8.137 +private:
   8.138 +    // ----------------------------------------------------------------------
   8.139 +    /** @briefPrivate construction for internal use by create().
   8.140 +     *  @param severity Logging granularity  */
   8.141 +    explicit DefaultLogger(LogSeverity severity);
   8.142 +
   8.143 +    // ----------------------------------------------------------------------
   8.144 +    /** @briefDestructor    */
   8.145 +    ~DefaultLogger();
   8.146 +
   8.147 +    /** @brief  Logs debug infos, only been written when severity level VERBOSE is set */
   8.148 +    void OnDebug(const char* message);
   8.149 +
   8.150 +    /** @brief  Logs an info message */
   8.151 +    void OnInfo(const char*  message);
   8.152 +
   8.153 +    /** @brief  Logs a warning message */
   8.154 +    void OnWarn(const char*  message);
   8.155 +
   8.156 +    /** @brief  Logs an error message */
   8.157 +    void OnError(const char* message);
   8.158 +
   8.159 +    // ----------------------------------------------------------------------
   8.160 +    /** @brief Writes a message to all streams */
   8.161 +    void WriteToStreams(const char* message, ErrorSeverity ErrorSev );
   8.162 +
   8.163 +    // ----------------------------------------------------------------------
   8.164 +    /** @brief Returns the thread id.
   8.165 +     *  @note This is an OS specific feature, if not supported, a
   8.166 +     *    zero will be returned.
   8.167 +     */
   8.168 +    unsigned int GetThreadID();
   8.169 +
   8.170 +private:
   8.171 +    //  Aliases for stream container
   8.172 +    typedef std::vector<LogStreamInfo*> StreamArray;
   8.173 +    typedef std::vector<LogStreamInfo*>::iterator StreamIt;
   8.174 +    typedef std::vector<LogStreamInfo*>::const_iterator ConstStreamIt;
   8.175 +
   8.176 +    //! only logging instance
   8.177 +    static Logger *m_pLogger;
   8.178 +    static NullLogger s_pNullLogger;
   8.179 +
   8.180 +    //! Attached streams
   8.181 +    StreamArray m_StreamArray;
   8.182 +
   8.183 +    bool noRepeatMsg;
   8.184 +    char lastMsg[MAX_LOG_MESSAGE_LENGTH*2];
   8.185 +    size_t lastLen;
   8.186 +};
   8.187 +// ------------------------------------------------------------------------------------
   8.188 +
   8.189 +} // Namespace Assimp
   8.190 +
   8.191 +#endif // !! INCLUDED_AI_DEFAULTLOGGER
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/include/miniassimp/Defines.h	Mon Jan 28 18:19:26 2019 +0200
     9.3 @@ -0,0 +1,49 @@
     9.4 +/*
     9.5 +Open Asset Import Library (assimp)
     9.6 +----------------------------------------------------------------------
     9.7 +
     9.8 +Copyright (c) 2006-2012, assimp team
     9.9 +All rights reserved.
    9.10 +
    9.11 +Redistribution and use of this software in source and binary forms,
    9.12 +with or without modification, are permitted provided that the
    9.13 +following conditions are met:
    9.14 +
    9.15 +* Redistributions of source code must retain the above
    9.16 +  copyright notice, this list of conditions and the
    9.17 +  following disclaimer.
    9.18 +
    9.19 +* Redistributions in binary form must reproduce the above
    9.20 +  copyright notice, this list of conditions and the
    9.21 +  following disclaimer in the documentation and/or other
    9.22 +  materials provided with the distribution.
    9.23 +
    9.24 +* Neither the name of the assimp team, nor the names of its
    9.25 +  contributors may be used to endorse or promote products
    9.26 +  derived from this software without specific prior
    9.27 +  written permission of the assimp team.
    9.28 +
    9.29 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    9.30 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    9.31 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    9.32 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    9.33 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    9.34 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    9.35 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    9.36 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    9.37 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    9.38 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    9.39 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    9.40 +
    9.41 +----------------------------------------------------------------------
    9.42 +*/
    9.43 +
    9.44 +// We need those constants, workaround for any platforms where nobody defined them yet
    9.45 +#if (!defined SIZE_MAX)
    9.46 +#   define SIZE_MAX (~((size_t)0))
    9.47 +#endif
    9.48 +
    9.49 +#if (!defined UINT_MAX)
    9.50 +#   define UINT_MAX (~((unsigned int)0))
    9.51 +#endif
    9.52 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/include/miniassimp/Exceptional.h	Mon Jan 28 18:19:26 2019 +0200
    10.3 @@ -0,0 +1,125 @@
    10.4 +/*
    10.5 +Open Asset Import Library (assimp)
    10.6 +----------------------------------------------------------------------
    10.7 +
    10.8 +Copyright (c) 2006-2008, assimp team
    10.9 +All rights reserved.
   10.10 +
   10.11 +Redistribution and use of this software in source and binary forms,
   10.12 +with or without modification, are permitted provided that the
   10.13 +following conditions are met:
   10.14 +
   10.15 +* Redistributions of source code must retain the above
   10.16 +  copyright notice, this list of conditions and the
   10.17 +  following disclaimer.
   10.18 +
   10.19 +* Redistributions in binary form must reproduce the above
   10.20 +  copyright notice, this list of conditions and the
   10.21 +  following disclaimer in the documentation and/or other
   10.22 +  materials provided with the distribution.
   10.23 +
   10.24 +* Neither the name of the assimp team, nor the names of its
   10.25 +  contributors may be used to endorse or promote products
   10.26 +  derived from this software without specific prior
   10.27 +  written permission of the assimp team.
   10.28 +
   10.29 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   10.30 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   10.31 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   10.32 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   10.33 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   10.34 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   10.35 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   10.36 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   10.37 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   10.38 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   10.39 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   10.40 +
   10.41 +----------------------------------------------------------------------
   10.42 +*/
   10.43 +
   10.44 +#ifndef INCLUDED_EXCEPTIONAL_H
   10.45 +#define INCLUDED_EXCEPTIONAL_H
   10.46 +
   10.47 +#include <stdexcept>
   10.48 +#include <miniassimp/DefaultIOStream.h>
   10.49 +using std::runtime_error;
   10.50 +
   10.51 +#ifdef _MSC_VER
   10.52 +#   pragma warning(disable : 4275)
   10.53 +#endif
   10.54 +
   10.55 +// ---------------------------------------------------------------------------
   10.56 +/** FOR IMPORTER PLUGINS ONLY: Simple exception class to be thrown if an
   10.57 + *  unrecoverable error occurs while importing. Loading APIs return
   10.58 + *  NULL instead of a valid aiScene then.  */
   10.59 +class DeadlyImportError
   10.60 +    : public runtime_error
   10.61 +{
   10.62 +public:
   10.63 +    /** Constructor with arguments */
   10.64 +    explicit DeadlyImportError( const std::string& errorText)
   10.65 +        : runtime_error(errorText)
   10.66 +    {
   10.67 +    }
   10.68 +
   10.69 +private:
   10.70 +};
   10.71 +
   10.72 +typedef DeadlyImportError DeadlyExportError;
   10.73 +
   10.74 +#ifdef _MSC_VER
   10.75 +#   pragma warning(default : 4275)
   10.76 +#endif
   10.77 +
   10.78 +// ---------------------------------------------------------------------------
   10.79 +template <typename T>
   10.80 +struct ExceptionSwallower   {
   10.81 +    T operator ()() const {
   10.82 +        return T();
   10.83 +    }
   10.84 +};
   10.85 +
   10.86 +// ---------------------------------------------------------------------------
   10.87 +template <typename T>
   10.88 +struct ExceptionSwallower<T*>   {
   10.89 +    T* operator ()() const {
   10.90 +        return NULL;
   10.91 +    }
   10.92 +};
   10.93 +
   10.94 +// ---------------------------------------------------------------------------
   10.95 +template <>
   10.96 +struct ExceptionSwallower<aiReturn> {
   10.97 +    aiReturn operator ()() const {
   10.98 +        try {
   10.99 +            throw;
  10.100 +        }
  10.101 +        catch (std::bad_alloc&) {
  10.102 +            return aiReturn_OUTOFMEMORY;
  10.103 +        }
  10.104 +        catch (...) {
  10.105 +            return aiReturn_FAILURE;
  10.106 +        }
  10.107 +    }
  10.108 +};
  10.109 +
  10.110 +// ---------------------------------------------------------------------------
  10.111 +template <>
  10.112 +struct ExceptionSwallower<void> {
  10.113 +    void operator ()() const {
  10.114 +        return;
  10.115 +    }
  10.116 +};
  10.117 +
  10.118 +#define ASSIMP_BEGIN_EXCEPTION_REGION()\
  10.119 +{\
  10.120 +    try {
  10.121 +
  10.122 +#define ASSIMP_END_EXCEPTION_REGION(type)\
  10.123 +    } catch(...) {\
  10.124 +        return ExceptionSwallower<type>()();\
  10.125 +    }\
  10.126 +}
  10.127 +
  10.128 +#endif // INCLUDED_EXCEPTIONAL_H
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/include/miniassimp/GenericProperty.h	Mon Jan 28 18:19:26 2019 +0200
    11.3 @@ -0,0 +1,133 @@
    11.4 +/*
    11.5 +Open Asset Import Library (assimp)
    11.6 +----------------------------------------------------------------------
    11.7 +
    11.8 +Copyright (c) 2006-2018, assimp team
    11.9 +
   11.10 +
   11.11 +All rights reserved.
   11.12 +
   11.13 +Redistribution and use of this software in source and binary forms,
   11.14 +with or without modification, are permitted provided that the
   11.15 +following conditions are met:
   11.16 +
   11.17 +* Redistributions of source code must retain the above
   11.18 +  copyright notice, this list of conditions and the
   11.19 +  following disclaimer.
   11.20 +
   11.21 +* Redistributions in binary form must reproduce the above
   11.22 +  copyright notice, this list of conditions and the
   11.23 +  following disclaimer in the documentation and/or other
   11.24 +  materials provided with the distribution.
   11.25 +
   11.26 +* Neither the name of the assimp team, nor the names of its
   11.27 +  contributors may be used to endorse or promote products
   11.28 +  derived from this software without specific prior
   11.29 +  written permission of the assimp team.
   11.30 +
   11.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   11.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   11.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   11.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   11.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   11.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   11.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   11.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   11.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   11.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   11.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   11.42 +
   11.43 +----------------------------------------------------------------------
   11.44 +*/
   11.45 +
   11.46 +#ifndef AI_GENERIC_PROPERTY_H_INCLUDED
   11.47 +#define AI_GENERIC_PROPERTY_H_INCLUDED
   11.48 +
   11.49 +#include <miniassimp/Importer.hpp>
   11.50 +#include <miniassimp/ai_assert.h>
   11.51 +#include "Hash.h"
   11.52 +
   11.53 +#include <map>
   11.54 +
   11.55 +// ------------------------------------------------------------------------------------------------
   11.56 +template <class T>
   11.57 +inline
   11.58 +bool SetGenericProperty(std::map< unsigned int, T >& list,
   11.59 +        const char* szName, const T& value) {
   11.60 +    ai_assert(0 != szName);
   11.61 +    const uint32_t hash = SuperFastHash(szName);
   11.62 +
   11.63 +    typename std::map<unsigned int, T>::iterator it = list.find(hash);
   11.64 +    if (it == list.end())   {
   11.65 +        list.insert(std::pair<unsigned int, T>( hash, value ));
   11.66 +        return false;
   11.67 +    }
   11.68 +    (*it).second = value;
   11.69 +
   11.70 +    return true;
   11.71 +}
   11.72 +
   11.73 +// ------------------------------------------------------------------------------------------------
   11.74 +template <class T>
   11.75 +inline
   11.76 +const T& GetGenericProperty(const std::map< unsigned int, T >& list,
   11.77 +        const char* szName, const T& errorReturn) {
   11.78 +    ai_assert(0 != szName);
   11.79 +    const uint32_t hash = SuperFastHash(szName);
   11.80 +
   11.81 +    typename std::map<unsigned int, T>::const_iterator it = list.find(hash);
   11.82 +    if (it == list.end()) {
   11.83 +        return errorReturn;
   11.84 +    }
   11.85 +
   11.86 +    return (*it).second;
   11.87 +}
   11.88 +
   11.89 +// ------------------------------------------------------------------------------------------------
   11.90 +// Special version for pointer types - they will be deleted when replaced with another value
   11.91 +// passing NULL removes the whole property
   11.92 +template <class T>
   11.93 +inline
   11.94 +void SetGenericPropertyPtr(std::map< unsigned int, T* >& list,
   11.95 +        const char* szName, T* value, bool* bWasExisting = 0 ) {
   11.96 +    ai_assert(0 != szName);
   11.97 +    const uint32_t hash = SuperFastHash(szName);
   11.98 +
   11.99 +    typename std::map<unsigned int, T*>::iterator it = list.find(hash);
  11.100 +    if (it == list.end())   {
  11.101 +        if (bWasExisting) {
  11.102 +            *bWasExisting = false;
  11.103 +        }
  11.104 +
  11.105 +        list.insert(std::pair<unsigned int,T*>( hash, value ));
  11.106 +        return;
  11.107 +    }
  11.108 +    if ((*it).second != value)  {
  11.109 +        delete (*it).second;
  11.110 +        (*it).second = value;
  11.111 +    }
  11.112 +    if (!value) {
  11.113 +        list.erase(it);
  11.114 +    }
  11.115 +    if (bWasExisting) {
  11.116 +        *bWasExisting = true;
  11.117 +    }
  11.118 +}
  11.119 +
  11.120 +// ------------------------------------------------------------------------------------------------
  11.121 +template <class T>
  11.122 +inline
  11.123 +bool HasGenericProperty(const std::map< unsigned int, T >& list,
  11.124 +        const char* szName) {
  11.125 +    ai_assert(0 != szName);
  11.126 +    const uint32_t hash = SuperFastHash(szName);
  11.127 +
  11.128 +    typename std::map<unsigned int, T>::const_iterator it = list.find(hash);
  11.129 +    if (it == list.end()) {
  11.130 +        return false;
  11.131 +    }
  11.132 +
  11.133 +    return true;
  11.134 +}
  11.135 +
  11.136 +#endif // !! AI_GENERIC_PROPERTY_H_INCLUDED
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/include/miniassimp/Hash.h	Mon Jan 28 18:19:26 2019 +0200
    12.3 @@ -0,0 +1,118 @@
    12.4 +/*
    12.5 +Open Asset Import Library (assimp)
    12.6 +----------------------------------------------------------------------
    12.7 +
    12.8 +Copyright (c) 2006-2018, assimp team
    12.9 +
   12.10 +
   12.11 +All rights reserved.
   12.12 +
   12.13 +Redistribution and use of this software in source and binary forms,
   12.14 +with or without modification, are permitted provided that the
   12.15 +following conditions are met:
   12.16 +
   12.17 +* Redistributions of source code must retain the above
   12.18 +  copyright notice, this list of conditions and the
   12.19 +  following disclaimer.
   12.20 +
   12.21 +* Redistributions in binary form must reproduce the above
   12.22 +  copyright notice, this list of conditions and the
   12.23 +  following disclaimer in the documentation and/or other
   12.24 +  materials provided with the distribution.
   12.25 +
   12.26 +* Neither the name of the assimp team, nor the names of its
   12.27 +  contributors may be used to endorse or promote products
   12.28 +  derived from this software without specific prior
   12.29 +  written permission of the assimp team.
   12.30 +
   12.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   12.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   12.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   12.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   12.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   12.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   12.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   12.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   12.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   12.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   12.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   12.42 +
   12.43 +----------------------------------------------------------------------
   12.44 +*/
   12.45 +
   12.46 +#ifndef AI_HASH_H_INCLUDED
   12.47 +#define AI_HASH_H_INCLUDED
   12.48 +
   12.49 +#include <inttypes.h>
   12.50 +#include <string.h>
   12.51 +
   12.52 +// ------------------------------------------------------------------------------------------------
   12.53 +// Hashing function taken from
   12.54 +// http://www.azillionmonkeys.com/qed/hash.html
   12.55 +// (incremental version)
   12.56 +//
   12.57 +// This code is Copyright 2004-2008 by Paul Hsieh. It is used here in the belief that
   12.58 +// Assimp's license is considered compatible with Pauls's derivative license as specified
   12.59 +// on his web page.
   12.60 +//
   12.61 +// (stdint.h should have been been included here)
   12.62 +// ------------------------------------------------------------------------------------------------
   12.63 +#undef get16bits
   12.64 +#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
   12.65 +  || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
   12.66 +#define get16bits(d) (*((const uint16_t *) (d)))
   12.67 +#endif
   12.68 +
   12.69 +#if !defined (get16bits)
   12.70 +#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
   12.71 +                       +(uint32_t)(((const uint8_t *)(d))[0]) )
   12.72 +#endif
   12.73 +
   12.74 +// ------------------------------------------------------------------------------------------------
   12.75 +inline uint32_t SuperFastHash (const char * data, uint32_t len = 0, uint32_t hash = 0) {
   12.76 +uint32_t tmp;
   12.77 +int rem;
   12.78 +
   12.79 +    if (!data) return 0;
   12.80 +    if (!len)len = (uint32_t)::strlen(data);
   12.81 +
   12.82 +    rem = len & 3;
   12.83 +    len >>= 2;
   12.84 +
   12.85 +    /* Main loop */
   12.86 +    for (;len > 0; len--) {
   12.87 +        hash  += get16bits (data);
   12.88 +        tmp    = (get16bits (data+2) << 11) ^ hash;
   12.89 +        hash   = (hash << 16) ^ tmp;
   12.90 +        data  += 2*sizeof (uint16_t);
   12.91 +        hash  += hash >> 11;
   12.92 +    }
   12.93 +
   12.94 +    /* Handle end cases */
   12.95 +    switch (rem) {
   12.96 +        case 3: hash += get16bits (data);
   12.97 +                hash ^= hash << 16;
   12.98 +                hash ^= data[sizeof (uint16_t)] << 18;
   12.99 +                hash += hash >> 11;
  12.100 +                break;
  12.101 +        case 2: hash += get16bits (data);
  12.102 +                hash ^= hash << 11;
  12.103 +                hash += hash >> 17;
  12.104 +                break;
  12.105 +        case 1: hash += *data;
  12.106 +                hash ^= hash << 10;
  12.107 +                hash += hash >> 1;
  12.108 +    }
  12.109 +
  12.110 +    /* Force "avalanching" of final 127 bits */
  12.111 +    hash ^= hash << 3;
  12.112 +    hash += hash >> 5;
  12.113 +    hash ^= hash << 4;
  12.114 +    hash += hash >> 17;
  12.115 +    hash ^= hash << 25;
  12.116 +    hash += hash >> 6;
  12.117 +
  12.118 +    return hash;
  12.119 +}
  12.120 +
  12.121 +#endif // !! AI_HASH_H_INCLUDED
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/include/miniassimp/IOStream.hpp	Mon Jan 28 18:19:26 2019 +0200
    13.3 @@ -0,0 +1,142 @@
    13.4 +/*
    13.5 +---------------------------------------------------------------------------
    13.6 +Open Asset Import Library (assimp)
    13.7 +---------------------------------------------------------------------------
    13.8 +
    13.9 +Copyright (c) 2006-2018, assimp team
   13.10 +
   13.11 +
   13.12 +
   13.13 +All rights reserved.
   13.14 +
   13.15 +Redistribution and use of this software in source and binary forms,
   13.16 +with or without modification, are permitted provided that the following
   13.17 +conditions are met:
   13.18 +
   13.19 +* Redistributions of source code must retain the above
   13.20 +  copyright notice, this list of conditions and the
   13.21 +  following disclaimer.
   13.22 +
   13.23 +* Redistributions in binary form must reproduce the above
   13.24 +  copyright notice, this list of conditions and the
   13.25 +  following disclaimer in the documentation and/or other
   13.26 +  materials provided with the distribution.
   13.27 +
   13.28 +* Neither the name of the assimp team, nor the names of its
   13.29 +  contributors may be used to endorse or promote products
   13.30 +  derived from this software without specific prior
   13.31 +  written permission of the assimp team.
   13.32 +
   13.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   13.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   13.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   13.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   13.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   13.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   13.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   13.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   13.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   13.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   13.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   13.44 +---------------------------------------------------------------------------
   13.45 +*/
   13.46 +/** @file IOStream.hpp
   13.47 + *  @brief File I/O wrappers for C++.
   13.48 + */
   13.49 +
   13.50 +#pragma once
   13.51 +#ifndef AI_IOSTREAM_H_INC
   13.52 +#define AI_IOSTREAM_H_INC
   13.53 +
   13.54 +#include "types.h"
   13.55 +
   13.56 +#ifndef __cplusplus
   13.57 +#   error This header requires C++ to be used. aiFileIO.h is the \
   13.58 +    corresponding C interface.
   13.59 +#endif
   13.60 +
   13.61 +namespace Assimp    {
   13.62 +
   13.63 +// ----------------------------------------------------------------------------------
   13.64 +/** @brief CPP-API: Class to handle file I/O for C++
   13.65 + *
   13.66 + *  Derive an own implementation from this interface to provide custom IO handling
   13.67 + *  to the Importer. If you implement this interface, be sure to also provide an
   13.68 + *  implementation for IOSystem that creates instances of your custom IO class.
   13.69 +*/
   13.70 +class ASSIMP_API IOStream
   13.71 +#ifndef SWIG
   13.72 +    : public Intern::AllocateFromAssimpHeap
   13.73 +#endif
   13.74 +{
   13.75 +protected:
   13.76 +    /** Constructor protected, use IOSystem::Open() to create an instance. */
   13.77 +    IOStream() AI_NO_EXCEPT;
   13.78 +
   13.79 +public:
   13.80 +    // -------------------------------------------------------------------
   13.81 +    /** @brief Destructor. Deleting the object closes the underlying file,
   13.82 +     * alternatively you may use IOSystem::Close() to release the file.
   13.83 +     */
   13.84 +    virtual ~IOStream();
   13.85 +
   13.86 +    // -------------------------------------------------------------------
   13.87 +    /** @brief Read from the file
   13.88 +     *
   13.89 +     * See fread() for more details
   13.90 +     * This fails for write-only files */
   13.91 +    virtual size_t Read(void* pvBuffer,
   13.92 +        size_t pSize,
   13.93 +        size_t pCount) = 0;
   13.94 +
   13.95 +    // -------------------------------------------------------------------
   13.96 +    /** @brief Write to the file
   13.97 +    *
   13.98 +    * See fwrite() for more details
   13.99 +    * This fails for read-only files */
  13.100 +    virtual size_t Write(const void* pvBuffer,
  13.101 +        size_t pSize,
  13.102 +        size_t pCount) = 0;
  13.103 +
  13.104 +    // -------------------------------------------------------------------
  13.105 +    /** @brief Set the read/write cursor of the file
  13.106 +     *
  13.107 +     * Note that the offset is _negative_ for aiOrigin_END.
  13.108 +     * See fseek() for more details */
  13.109 +    virtual aiReturn Seek(size_t pOffset,
  13.110 +        aiOrigin pOrigin) = 0;
  13.111 +
  13.112 +    // -------------------------------------------------------------------
  13.113 +    /** @brief Get the current position of the read/write cursor
  13.114 +     *
  13.115 +     * See ftell() for more details */
  13.116 +    virtual size_t Tell() const = 0;
  13.117 +
  13.118 +    // -------------------------------------------------------------------
  13.119 +    /** @brief Returns filesize
  13.120 +     *  Returns the filesize. */
  13.121 +    virtual size_t FileSize() const = 0;
  13.122 +
  13.123 +    // -------------------------------------------------------------------
  13.124 +    /** @brief Flush the contents of the file buffer (for writers)
  13.125 +     *  See fflush() for more details.
  13.126 +     */
  13.127 +    virtual void Flush() = 0;
  13.128 +}; //! class IOStream
  13.129 +
  13.130 +// ----------------------------------------------------------------------------------
  13.131 +inline
  13.132 +IOStream::IOStream() AI_NO_EXCEPT {
  13.133 +    // empty
  13.134 +}
  13.135 +
  13.136 +// ----------------------------------------------------------------------------------
  13.137 +inline
  13.138 +IOStream::~IOStream() {
  13.139 +    // empty
  13.140 +}
  13.141 +// ----------------------------------------------------------------------------------
  13.142 +
  13.143 +} //!namespace Assimp
  13.144 +
  13.145 +#endif //!!AI_IOSTREAM_H_INC
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/include/miniassimp/IOSystem.hpp	Mon Jan 28 18:19:26 2019 +0200
    14.3 @@ -0,0 +1,357 @@
    14.4 +/*
    14.5 +---------------------------------------------------------------------------
    14.6 +Open Asset Import Library (assimp)
    14.7 +---------------------------------------------------------------------------
    14.8 +
    14.9 +Copyright (c) 2006-2018, assimp team
   14.10 +
   14.11 +
   14.12 +
   14.13 +All rights reserved.
   14.14 +
   14.15 +Redistribution and use of this software in source and binary forms,
   14.16 +with or without modification, are permitted provided that the following
   14.17 +conditions are met:
   14.18 +
   14.19 +* Redistributions of source code must retain the above
   14.20 +  copyright notice, this list of conditions and the
   14.21 +  following disclaimer.
   14.22 +
   14.23 +* Redistributions in binary form must reproduce the above
   14.24 +  copyright notice, this list of conditions and the
   14.25 +  following disclaimer in the documentation and/or other
   14.26 +  materials provided with the distribution.
   14.27 +
   14.28 +* Neither the name of the assimp team, nor the names of its
   14.29 +  contributors may be used to endorse or promote products
   14.30 +  derived from this software without specific prior
   14.31 +  written permission of the assimp team.
   14.32 +
   14.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   14.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   14.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   14.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   14.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   14.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   14.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   14.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   14.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   14.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   14.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   14.44 +---------------------------------------------------------------------------
   14.45 +*/
   14.46 +
   14.47 +/** @file IOSystem.hpp
   14.48 + *  @brief File system wrapper for C++. Inherit this class to supply
   14.49 + *  custom file handling logic to the Import library.
   14.50 +*/
   14.51 +
   14.52 +#pragma once
   14.53 +#ifndef AI_IOSYSTEM_H_INC
   14.54 +#define AI_IOSYSTEM_H_INC
   14.55 +
   14.56 +#ifndef __cplusplus
   14.57 +#   error This header requires C++ to be used. aiFileIO.h is the \
   14.58 +    corresponding C interface.
   14.59 +#endif
   14.60 +
   14.61 +#include "types.h"
   14.62 +
   14.63 +#ifdef _WIN32
   14.64 +#   include <direct.h>  
   14.65 +#   include <stdlib.h>  
   14.66 +#   include <stdio.h>  
   14.67 +#else
   14.68 +#   include <sys/stat.h>
   14.69 +#   include <sys/types.h>
   14.70 +#   include <unistd.h>
   14.71 +#endif // _WIN32
   14.72 +
   14.73 +#include <vector>
   14.74 +
   14.75 +namespace Assimp    {
   14.76 +
   14.77 +    class IOStream;
   14.78 +
   14.79 +// ---------------------------------------------------------------------------
   14.80 +/** @brief CPP-API: Interface to the file system.
   14.81 + *
   14.82 + *  Derive an own implementation from this interface to supply custom file handling
   14.83 + *  to the importer library. If you implement this interface, you also want to
   14.84 + *  supply a custom implementation for IOStream.
   14.85 + *
   14.86 + *  @see Importer::SetIOHandler() 
   14.87 + */
   14.88 +class ASSIMP_API IOSystem
   14.89 +#ifndef SWIG
   14.90 +    : public Intern::AllocateFromAssimpHeap
   14.91 +#endif
   14.92 +{
   14.93 +public:
   14.94 +
   14.95 +    // -------------------------------------------------------------------
   14.96 +    /** @brief Default constructor.
   14.97 +     *
   14.98 +     *  Create an instance of your derived class and assign it to an
   14.99 +     *  #Assimp::Importer instance by calling Importer::SetIOHandler().
  14.100 +     */
  14.101 +    IOSystem() AI_NO_EXCEPT;
  14.102 +
  14.103 +    // -------------------------------------------------------------------
  14.104 +    /** @brief Virtual destructor.
  14.105 +     *
  14.106 +     *  It is safe to be called from within DLL Assimp, we're constructed
  14.107 +     *  on Assimp's heap.
  14.108 +     */
  14.109 +    virtual ~IOSystem();
  14.110 +
  14.111 +    // -------------------------------------------------------------------
  14.112 +    /** @brief For backward compatibility
  14.113 +     *  @see Exists(const char*)
  14.114 +     */
  14.115 +    AI_FORCE_INLINE bool Exists( const std::string& pFile) const;
  14.116 +
  14.117 +    // -------------------------------------------------------------------
  14.118 +    /** @brief Tests for the existence of a file at the given path.
  14.119 +     *
  14.120 +     * @param pFile Path to the file
  14.121 +     * @return true if there is a file with this path, else false.
  14.122 +     */
  14.123 +    virtual bool Exists( const char* pFile) const = 0;
  14.124 +
  14.125 +    // -------------------------------------------------------------------
  14.126 +    /** @brief Returns the system specific directory separator
  14.127 +     *  @return System specific directory separator
  14.128 +     */
  14.129 +    virtual char getOsSeparator() const = 0;
  14.130 +
  14.131 +    // -------------------------------------------------------------------
  14.132 +    /** @brief Open a new file with a given path.
  14.133 +     *
  14.134 +     *  When the access to the file is finished, call Close() to release
  14.135 +     *  all associated resources (or the virtual dtor of the IOStream).
  14.136 +     *
  14.137 +     *  @param pFile Path to the file
  14.138 +     *  @param pMode Desired file I/O mode. Required are: "wb", "w", "wt",
  14.139 +     *         "rb", "r", "rt".
  14.140 +     *
  14.141 +     *  @return New IOStream interface allowing the lib to access
  14.142 +     *         the underlying file.
  14.143 +     *  @note When implementing this class to provide custom IO handling,
  14.144 +     *  you probably have to supply an own implementation of IOStream as well.
  14.145 +     */
  14.146 +    virtual IOStream* Open(const char* pFile,
  14.147 +        const char* pMode = "rb") = 0;
  14.148 +
  14.149 +    // -------------------------------------------------------------------
  14.150 +    /** @brief For backward compatibility
  14.151 +     *  @see Open(const char*, const char*)
  14.152 +     */
  14.153 +    inline IOStream* Open(const std::string& pFile,
  14.154 +        const std::string& pMode = std::string("rb"));
  14.155 +
  14.156 +    // -------------------------------------------------------------------
  14.157 +    /** @brief Closes the given file and releases all resources
  14.158 +     *    associated with it.
  14.159 +     *  @param pFile The file instance previously created by Open().
  14.160 +     */
  14.161 +    virtual void Close( IOStream* pFile) = 0;
  14.162 +
  14.163 +    // -------------------------------------------------------------------
  14.164 +    /** @brief Compares two paths and check whether the point to
  14.165 +     *         identical files.
  14.166 +     *
  14.167 +     * The dummy implementation of this virtual member performs a
  14.168 +     * case-insensitive comparison of the given strings. The default IO
  14.169 +     * system implementation uses OS mechanisms to convert relative into
  14.170 +     * absolute paths, so the result can be trusted.
  14.171 +     * @param one First file
  14.172 +     * @param second Second file
  14.173 +     * @return true if the paths point to the same file. The file needn't
  14.174 +     *   be existing, however.
  14.175 +     */
  14.176 +    virtual bool ComparePaths (const char* one,
  14.177 +        const char* second) const;
  14.178 +
  14.179 +    // -------------------------------------------------------------------
  14.180 +    /** @brief For backward compatibility
  14.181 +     *  @see ComparePaths(const char*, const char*)
  14.182 +     */
  14.183 +    inline bool ComparePaths (const std::string& one,
  14.184 +        const std::string& second) const;
  14.185 +
  14.186 +    // -------------------------------------------------------------------
  14.187 +    /** @brief Pushes a new directory onto the directory stack.
  14.188 +     *  @param path Path to push onto the stack.
  14.189 +     *  @return True, when push was successful, false if path is empty.
  14.190 +     */
  14.191 +    virtual bool PushDirectory( const std::string &path );
  14.192 +
  14.193 +    // -------------------------------------------------------------------
  14.194 +    /** @brief Returns the top directory from the stack.
  14.195 +     *  @return The directory on the top of the stack.
  14.196 +     *          Returns empty when no directory was pushed to the stack.
  14.197 +     */
  14.198 +    virtual const std::string &CurrentDirectory() const;
  14.199 +
  14.200 +    // -------------------------------------------------------------------
  14.201 +    /** @brief Returns the number of directories stored on the stack.
  14.202 +     *  @return The number of directories of the stack.
  14.203 +     */
  14.204 +    virtual size_t StackSize() const;
  14.205 +
  14.206 +    // -------------------------------------------------------------------
  14.207 +    /** @brief Pops the top directory from the stack.
  14.208 +     *  @return True, when a directory was on the stack. False if no
  14.209 +     *          directory was on the stack.
  14.210 +     */
  14.211 +    virtual bool PopDirectory();
  14.212 +
  14.213 +    // -------------------------------------------------------------------
  14.214 +    /** @brief CReates an new directory at the given path.
  14.215 +     *  @param  path    [in] The path to create.
  14.216 +     *  @return True, when a directory was created. False if the directory
  14.217 +     *           cannot be created.
  14.218 +     */
  14.219 +    virtual bool CreateDirectory( const std::string &path );
  14.220 +
  14.221 +    // -------------------------------------------------------------------
  14.222 +    /** @brief Will change the current directory to the given path.
  14.223 +     *  @param path     [in] The path to change to.
  14.224 +     *  @return True, when the directory has changed successfully.
  14.225 +     */
  14.226 +    virtual bool ChangeDirectory( const std::string &path );
  14.227 +
  14.228 +    virtual bool DeleteFile( const std::string &file );
  14.229 +
  14.230 +private:
  14.231 +    std::vector<std::string> m_pathStack;
  14.232 +};
  14.233 +
  14.234 +// ----------------------------------------------------------------------------
  14.235 +AI_FORCE_INLINE
  14.236 +IOSystem::IOSystem() AI_NO_EXCEPT
  14.237 +: m_pathStack() {
  14.238 +    // empty
  14.239 +}
  14.240 +
  14.241 +// ----------------------------------------------------------------------------
  14.242 +AI_FORCE_INLINE
  14.243 +IOSystem::~IOSystem() {
  14.244 +    // empty
  14.245 +}
  14.246 +
  14.247 +// ----------------------------------------------------------------------------
  14.248 +// For compatibility, the interface of some functions taking a std::string was
  14.249 +// changed to const char* to avoid crashes between binary incompatible STL
  14.250 +// versions. This code her is inlined,  so it shouldn't cause any problems.
  14.251 +// ----------------------------------------------------------------------------
  14.252 +
  14.253 +// ----------------------------------------------------------------------------
  14.254 +AI_FORCE_INLINE
  14.255 +IOStream* IOSystem::Open(const std::string& pFile, const std::string& pMode) {
  14.256 +    // NOTE:
  14.257 +    // For compatibility, interface was changed to const char* to
  14.258 +    // avoid crashes between binary incompatible STL versions
  14.259 +    return Open(pFile.c_str(),pMode.c_str());
  14.260 +}
  14.261 +
  14.262 +// ----------------------------------------------------------------------------
  14.263 +AI_FORCE_INLINE
  14.264 +bool IOSystem::Exists( const std::string& pFile) const {
  14.265 +    // NOTE:
  14.266 +    // For compatibility, interface was changed to const char* to
  14.267 +    // avoid crashes between binary incompatible STL versions
  14.268 +    return Exists(pFile.c_str());
  14.269 +}
  14.270 +
  14.271 +// ----------------------------------------------------------------------------
  14.272 +AI_FORCE_INLINE
  14.273 +bool IOSystem::ComparePaths (const std::string& one, const std::string& second) const {
  14.274 +    // NOTE:
  14.275 +    // For compatibility, interface was changed to const char* to
  14.276 +    // avoid crashes between binary incompatible STL versions
  14.277 +    return ComparePaths(one.c_str(),second.c_str());
  14.278 +}
  14.279 +
  14.280 +// ----------------------------------------------------------------------------
  14.281 +AI_FORCE_INLINE
  14.282 +bool IOSystem::PushDirectory( const std::string &path ) {
  14.283 +    if ( path.empty() ) {
  14.284 +        return false;
  14.285 +    }
  14.286 +
  14.287 +    m_pathStack.push_back( path );
  14.288 +
  14.289 +    return true;
  14.290 +}
  14.291 +
  14.292 +// ----------------------------------------------------------------------------
  14.293 +AI_FORCE_INLINE
  14.294 +const std::string &IOSystem::CurrentDirectory() const {
  14.295 +    if ( m_pathStack.empty() ) {
  14.296 +        static const std::string Dummy("");
  14.297 +        return Dummy;
  14.298 +    }
  14.299 +    return m_pathStack[ m_pathStack.size()-1 ];
  14.300 +}
  14.301 +
  14.302 +// ----------------------------------------------------------------------------
  14.303 +AI_FORCE_INLINE
  14.304 +size_t IOSystem::StackSize() const {
  14.305 +    return m_pathStack.size();
  14.306 +}
  14.307 +
  14.308 +// ----------------------------------------------------------------------------
  14.309 +AI_FORCE_INLINE
  14.310 +bool IOSystem::PopDirectory() {
  14.311 +    if ( m_pathStack.empty() ) {
  14.312 +        return false;
  14.313 +    }
  14.314 +
  14.315 +    m_pathStack.pop_back();
  14.316 +
  14.317 +    return true;
  14.318 +}
  14.319 +
  14.320 +// ----------------------------------------------------------------------------
  14.321 +AI_FORCE_INLINE
  14.322 +bool IOSystem::CreateDirectory( const std::string &path ) {
  14.323 +    if ( path.empty() ) {
  14.324 +        return false;
  14.325 +    }
  14.326 +
  14.327 +#ifdef _WIN32
  14.328 +    return 0 != ::_mkdir( path.c_str() );
  14.329 +#else
  14.330 +    return 0 != ::mkdir( path.c_str(), 0777 );
  14.331 +#endif // _WIN32
  14.332 +}
  14.333 +
  14.334 +// ----------------------------------------------------------------------------
  14.335 +AI_FORCE_INLINE
  14.336 +bool IOSystem::ChangeDirectory( const std::string &path ) {
  14.337 +    if ( path.empty() ) {
  14.338 +        return false;
  14.339 +    }
  14.340 +
  14.341 +#ifdef _WIN32
  14.342 +    return 0 != ::_chdir( path.c_str() );
  14.343 +#else
  14.344 +    return 0 != ::chdir( path.c_str() );
  14.345 +#endif // _WIN32
  14.346 +}
  14.347 +
  14.348 +
  14.349 +// ----------------------------------------------------------------------------
  14.350 +AI_FORCE_INLINE
  14.351 +bool IOSystem::DeleteFile( const std::string &file ) {
  14.352 +    if ( file.empty() ) {
  14.353 +        return false;
  14.354 +    }
  14.355 +    const int retCode( ::remove( file.c_str() ) );
  14.356 +    return ( 0 == retCode );
  14.357 +}
  14.358 +} //!ns Assimp
  14.359 +
  14.360 +#endif //AI_IOSYSTEM_H_INC
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/include/miniassimp/Importer.hpp	Mon Jan 28 18:19:26 2019 +0200
    15.3 @@ -0,0 +1,649 @@
    15.4 +/*
    15.5 +---------------------------------------------------------------------------
    15.6 +Open Asset Import Library (assimp)
    15.7 +---------------------------------------------------------------------------
    15.8 +
    15.9 +Copyright (c) 2006-2018, assimp team
   15.10 +
   15.11 +
   15.12 +
   15.13 +All rights reserved.
   15.14 +
   15.15 +Redistribution and use of this software in source and binary forms,
   15.16 +with or without modification, are permitted provided that the following
   15.17 +conditions are met:
   15.18 +
   15.19 +* Redistributions of source code must retain the above
   15.20 +  copyright notice, this list of conditions and the
   15.21 +  following disclaimer.
   15.22 +
   15.23 +* Redistributions in binary form must reproduce the above
   15.24 +  copyright notice, this list of conditions and the
   15.25 +  following disclaimer in the documentation and/or other
   15.26 +  materials provided with the distribution.
   15.27 +
   15.28 +* Neither the name of the assimp team, nor the names of its
   15.29 +  contributors may be used to endorse or promote products
   15.30 +  derived from this software without specific prior
   15.31 +  written permission of the assimp team.
   15.32 +
   15.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   15.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   15.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   15.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   15.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   15.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   15.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   15.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   15.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   15.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   15.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   15.44 +---------------------------------------------------------------------------
   15.45 +*/
   15.46 +
   15.47 +/** @file  Importer.hpp
   15.48 + *  @brief Defines the C++-API to the Open Asset Import Library.
   15.49 + */
   15.50 +#pragma once
   15.51 +#ifndef AI_ASSIMP_HPP_INC
   15.52 +#define AI_ASSIMP_HPP_INC
   15.53 +
   15.54 +#ifndef __cplusplus
   15.55 +#   error This header requires C++ to be used. Use assimp.h for plain C.
   15.56 +#endif // __cplusplus
   15.57 +
   15.58 +// Public ASSIMP data structures
   15.59 +#include <miniassimp/types.h>
   15.60 +
   15.61 +namespace Assimp    {
   15.62 +    // =======================================================================
   15.63 +    // Public interface to Assimp
   15.64 +    class Importer;
   15.65 +    class IOStream;
   15.66 +    class IOSystem;
   15.67 +    class ProgressHandler;
   15.68 +
   15.69 +    // =======================================================================
   15.70 +    // Plugin development
   15.71 +    //
   15.72 +    // Include the following headers for the declarations:
   15.73 +    // BaseImporter.h
   15.74 +    // BaseProcess.h
   15.75 +    class BaseImporter;
   15.76 +    class BaseProcess;
   15.77 +    class SharedPostProcessInfo;
   15.78 +    class BatchLoader;
   15.79 +
   15.80 +    // =======================================================================
   15.81 +    // Holy stuff, only for members of the high council of the Jedi.
   15.82 +    class ImporterPimpl;
   15.83 +} //! namespace Assimp
   15.84 +
   15.85 +#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff
   15.86 +
   15.87 +struct aiScene;
   15.88 +
   15.89 +// importerdesc.h
   15.90 +struct aiImporterDesc;
   15.91 +
   15.92 +/** @namespace Assimp Assimp's CPP-API and all internal APIs */
   15.93 +namespace Assimp    {
   15.94 +
   15.95 +// ----------------------------------------------------------------------------------
   15.96 +/** CPP-API: The Importer class forms an C++ interface to the functionality of the
   15.97 +*   Open Asset Import Library.
   15.98 +*
   15.99 +* Create an object of this class and call ReadFile() to import a file.
  15.100 +* If the import succeeds, the function returns a pointer to the imported data.
  15.101 +* The data remains property of the object, it is intended to be accessed
  15.102 +* read-only. The imported data will be destroyed along with the Importer
  15.103 +* object. If the import fails, ReadFile() returns a NULL pointer. In this
  15.104 +* case you can retrieve a human-readable error description be calling
  15.105 +* GetErrorString(). You can call ReadFile() multiple times with a single Importer
  15.106 +* instance. Actually, constructing Importer objects involves quite many
  15.107 +* allocations and may take some time, so it's better to reuse them as often as
  15.108 +* possible.
  15.109 +*
  15.110 +* If you need the Importer to do custom file handling to access the files,
  15.111 +* implement IOSystem and IOStream and supply an instance of your custom
  15.112 +* IOSystem implementation by calling SetIOHandler() before calling ReadFile().
  15.113 +* If you do not assign a custion IO handler, a default handler using the
  15.114 +* standard C++ IO logic will be used.
  15.115 +*
  15.116 +* @note One Importer instance is not thread-safe. If you use multiple
  15.117 +* threads for loading, each thread should maintain its own Importer instance.
  15.118 +*/
  15.119 +class ASSIMP_API Importer   {
  15.120 +private:
  15.121 +    Importer(const Importer& other);
  15.122 +    Importer &operator=(const Importer &);
  15.123 +
  15.124 +public:
  15.125 +    /**
  15.126 +     *  @brief The upper limit for hints.
  15.127 +     */
  15.128 +    static const unsigned int MaxLenHint = 200;
  15.129 +
  15.130 +public:
  15.131 +
  15.132 +    // -------------------------------------------------------------------
  15.133 +    /** Constructor. Creates an empty importer object.
  15.134 +     *
  15.135 +     * Call ReadFile() to start the import process. The configuration
  15.136 +     * property table is initially empty.
  15.137 +     */
  15.138 +    Importer();
  15.139 +
  15.140 +    // -------------------------------------------------------------------
  15.141 +    /** Destructor. The object kept ownership of the imported data,
  15.142 +     * which now will be destroyed along with the object.
  15.143 +     */
  15.144 +    ~Importer();
  15.145 +
  15.146 +
  15.147 +    // -------------------------------------------------------------------
  15.148 +    /** Registers a new loader.
  15.149 +     *
  15.150 +     * @param pImp Importer to be added. The Importer instance takes
  15.151 +     *   ownership of the pointer, so it will be automatically deleted
  15.152 +     *   with the Importer instance.
  15.153 +     * @return AI_SUCCESS if the loader has been added. The registration
  15.154 +     *   fails if there is already a loader for a specific file extension.
  15.155 +     */
  15.156 +    aiReturn RegisterLoader(BaseImporter* pImp);
  15.157 +
  15.158 +    // -------------------------------------------------------------------
  15.159 +    /** Unregisters a loader.
  15.160 +     *
  15.161 +     * @param pImp Importer to be unregistered.
  15.162 +     * @return AI_SUCCESS if the loader has been removed. The function
  15.163 +     *   fails if the loader is currently in use (this could happen
  15.164 +     *   if the #Importer instance is used by more than one thread) or
  15.165 +     *   if it has not yet been registered.
  15.166 +     */
  15.167 +    aiReturn UnregisterLoader(BaseImporter* pImp);
  15.168 +
  15.169 +    // -------------------------------------------------------------------
  15.170 +    /** Registers a new post-process step.
  15.171 +     *
  15.172 +     * At the moment, there's a small limitation: new post processing
  15.173 +     * steps are added to end of the list, or in other words, executed
  15.174 +     * last, after all built-in steps.
  15.175 +     * @param pImp Post-process step to be added. The Importer instance
  15.176 +     *   takes ownership of the pointer, so it will be automatically
  15.177 +     *   deleted with the Importer instance.
  15.178 +     * @return AI_SUCCESS if the step has been added correctly.
  15.179 +     */
  15.180 +    aiReturn RegisterPPStep(BaseProcess* pImp);
  15.181 +
  15.182 +    // -------------------------------------------------------------------
  15.183 +    /** Unregisters a post-process step.
  15.184 +     *
  15.185 +     * @param pImp Step to be unregistered.
  15.186 +     * @return AI_SUCCESS if the step has been removed. The function
  15.187 +     *   fails if the step is currently in use (this could happen
  15.188 +     *   if the #Importer instance is used by more than one thread) or
  15.189 +     *   if it has not yet been registered.
  15.190 +     */
  15.191 +    aiReturn UnregisterPPStep(BaseProcess* pImp);
  15.192 +
  15.193 +    // -------------------------------------------------------------------
  15.194 +    /** Set an integer configuration property.
  15.195 +     * @param szName Name of the property. All supported properties
  15.196 +     *   are defined in the aiConfig.g header (all constants share the
  15.197 +     *   prefix AI_CONFIG_XXX and are simple strings).
  15.198 +     * @param iValue New value of the property
  15.199 +     * @return true if the property was set before. The new value replaces
  15.200 +     *   the previous value in this case.
  15.201 +     * @note Property of different types (float, int, string ..) are kept
  15.202 +     *   on different stacks, so calling SetPropertyInteger() for a
  15.203 +     *   floating-point property has no effect - the loader will call
  15.204 +     *   GetPropertyFloat() to read the property, but it won't be there.
  15.205 +     */
  15.206 +    bool SetPropertyInteger(const char* szName, int iValue);
  15.207 +
  15.208 +    // -------------------------------------------------------------------
  15.209 +    /** Set a boolean configuration property. Boolean properties
  15.210 +     *  are stored on the integer stack internally so it's possible
  15.211 +     *  to set them via #SetPropertyBool and query them with
  15.212 +     *  #GetPropertyBool and vice versa.
  15.213 +     * @see SetPropertyInteger()
  15.214 +     */
  15.215 +    bool SetPropertyBool(const char* szName, bool value)    {
  15.216 +        return SetPropertyInteger(szName,value);
  15.217 +    }
  15.218 +
  15.219 +    // -------------------------------------------------------------------
  15.220 +    /** Set a floating-point configuration property.
  15.221 +     * @see SetPropertyInteger()
  15.222 +     */
  15.223 +    bool SetPropertyFloat(const char* szName, ai_real fValue);
  15.224 +
  15.225 +    // -------------------------------------------------------------------
  15.226 +    /** Set a string configuration property.
  15.227 +     * @see SetPropertyInteger()
  15.228 +     */
  15.229 +    bool SetPropertyString(const char* szName, const std::string& sValue);
  15.230 +
  15.231 +    // -------------------------------------------------------------------
  15.232 +    /** Set a matrix configuration property.
  15.233 +     * @see SetPropertyInteger()
  15.234 +     */
  15.235 +    bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue);
  15.236 +
  15.237 +    // -------------------------------------------------------------------
  15.238 +    /** Get a configuration property.
  15.239 +     * @param szName Name of the property. All supported properties
  15.240 +     *   are defined in the aiConfig.g header (all constants share the
  15.241 +     *   prefix AI_CONFIG_XXX).
  15.242 +     * @param iErrorReturn Value that is returned if the property
  15.243 +     *   is not found.
  15.244 +     * @return Current value of the property
  15.245 +     * @note Property of different types (float, int, string ..) are kept
  15.246 +     *   on different lists, so calling SetPropertyInteger() for a
  15.247 +     *   floating-point property has no effect - the loader will call
  15.248 +     *   GetPropertyFloat() to read the property, but it won't be there.
  15.249 +     */
  15.250 +    int GetPropertyInteger(const char* szName,
  15.251 +        int iErrorReturn = 0xffffffff) const;
  15.252 +
  15.253 +    // -------------------------------------------------------------------
  15.254 +    /** Get a boolean configuration property. Boolean properties
  15.255 +     *  are stored on the integer stack internally so it's possible
  15.256 +     *  to set them via #SetPropertyBool and query them with
  15.257 +     *  #GetPropertyBool and vice versa.
  15.258 +     * @see GetPropertyInteger()
  15.259 +     */
  15.260 +    bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const {
  15.261 +        return GetPropertyInteger(szName,bErrorReturn)!=0;
  15.262 +    }
  15.263 +
  15.264 +    // -------------------------------------------------------------------
  15.265 +    /** Get a floating-point configuration property
  15.266 +     * @see GetPropertyInteger()
  15.267 +     */
  15.268 +    ai_real GetPropertyFloat(const char* szName,
  15.269 +        ai_real fErrorReturn = 10e10) const;
  15.270 +
  15.271 +    // -------------------------------------------------------------------
  15.272 +    /** Get a string configuration property
  15.273 +     *
  15.274 +     *  The return value remains valid until the property is modified.
  15.275 +     * @see GetPropertyInteger()
  15.276 +     */
  15.277 +    const std::string GetPropertyString(const char* szName,
  15.278 +        const std::string& sErrorReturn = "") const;
  15.279 +
  15.280 +    // -------------------------------------------------------------------
  15.281 +    /** Get a matrix configuration property
  15.282 +     *
  15.283 +     *  The return value remains valid until the property is modified.
  15.284 +     * @see GetPropertyInteger()
  15.285 +     */
  15.286 +    const aiMatrix4x4 GetPropertyMatrix(const char* szName,
  15.287 +        const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const;
  15.288 +
  15.289 +    // -------------------------------------------------------------------
  15.290 +    /** Supplies a custom IO handler to the importer to use to open and
  15.291 +     * access files. If you need the importer to use custom IO logic to
  15.292 +     * access the files, you need to provide a custom implementation of
  15.293 +     * IOSystem and IOFile to the importer. Then create an instance of
  15.294 +     * your custom IOSystem implementation and supply it by this function.
  15.295 +     *
  15.296 +     * The Importer takes ownership of the object and will destroy it
  15.297 +     * afterwards. The previously assigned handler will be deleted.
  15.298 +     * Pass NULL to take again ownership of your IOSystem and reset Assimp
  15.299 +     * to use its default implementation.
  15.300 +     *
  15.301 +     * @param pIOHandler The IO handler to be used in all file accesses
  15.302 +     *   of the Importer.
  15.303 +     */
  15.304 +    void SetIOHandler( IOSystem* pIOHandler);
  15.305 +
  15.306 +    // -------------------------------------------------------------------
  15.307 +    /** Retrieves the IO handler that is currently set.
  15.308 +     * You can use #IsDefaultIOHandler() to check whether the returned
  15.309 +     * interface is the default IO handler provided by ASSIMP. The default
  15.310 +     * handler is active as long the application doesn't supply its own
  15.311 +     * custom IO handler via #SetIOHandler().
  15.312 +     * @return A valid IOSystem interface, never NULL.
  15.313 +     */
  15.314 +    IOSystem* GetIOHandler() const;
  15.315 +
  15.316 +    // -------------------------------------------------------------------
  15.317 +    /** Checks whether a default IO handler is active
  15.318 +     * A default handler is active as long the application doesn't
  15.319 +     * supply its own custom IO handler via #SetIOHandler().
  15.320 +     * @return true by default
  15.321 +     */
  15.322 +    bool IsDefaultIOHandler() const;
  15.323 +
  15.324 +    // -------------------------------------------------------------------
  15.325 +    /** Supplies a custom progress handler to the importer. This
  15.326 +     *  interface exposes an #Update() callback, which is called
  15.327 +     *  more or less periodically (please don't sue us if it
  15.328 +     *  isn't as periodically as you'd like it to have ...).
  15.329 +     *  This can be used to implement progress bars and loading
  15.330 +     *  timeouts.
  15.331 +     *  @param pHandler Progress callback interface. Pass NULL to
  15.332 +     *    disable progress reporting.
  15.333 +     *  @note Progress handlers can be used to abort the loading
  15.334 +     *    at almost any time.*/
  15.335 +    void SetProgressHandler ( ProgressHandler* pHandler );
  15.336 +
  15.337 +    // -------------------------------------------------------------------
  15.338 +    /** Retrieves the progress handler that is currently set.
  15.339 +     * You can use #IsDefaultProgressHandler() to check whether the returned
  15.340 +     * interface is the default handler provided by ASSIMP. The default
  15.341 +     * handler is active as long the application doesn't supply its own
  15.342 +     * custom handler via #SetProgressHandler().
  15.343 +     * @return A valid ProgressHandler interface, never NULL.
  15.344 +     */
  15.345 +    ProgressHandler* GetProgressHandler() const;
  15.346 +
  15.347 +    // -------------------------------------------------------------------
  15.348 +    /** Checks whether a default progress handler is active
  15.349 +     * A default handler is active as long the application doesn't
  15.350 +     * supply its own custom progress handler via #SetProgressHandler().
  15.351 +     * @return true by default
  15.352 +     */
  15.353 +    bool IsDefaultProgressHandler() const;
  15.354 +
  15.355 +    // -------------------------------------------------------------------
  15.356 +    /** @brief Check whether a given set of post-processing flags
  15.357 +     *  is supported.
  15.358 +     *
  15.359 +     *  Some flags are mutually exclusive, others are probably
  15.360 +     *  not available because your excluded them from your
  15.361 +     *  Assimp builds. Calling this function is recommended if
  15.362 +     *  you're unsure.
  15.363 +     *
  15.364 +     *  @param pFlags Bitwise combination of the aiPostProcess flags.
  15.365 +     *  @return true if this flag combination is fine.
  15.366 +     */
  15.367 +    bool ValidateFlags(unsigned int pFlags) const;
  15.368 +
  15.369 +    // -------------------------------------------------------------------
  15.370 +    /** Reads the given file and returns its contents if successful.
  15.371 +     *
  15.372 +     * If the call succeeds, the contents of the file are returned as a
  15.373 +     * pointer to an aiScene object. The returned data is intended to be
  15.374 +     * read-only, the importer object keeps ownership of the data and will
  15.375 +     * destroy it upon destruction. If the import fails, NULL is returned.
  15.376 +     * A human-readable error description can be retrieved by calling
  15.377 +     * GetErrorString(). The previous scene will be deleted during this call.
  15.378 +     * @param pFile Path and filename to the file to be imported.
  15.379 +     * @param pFlags Optional post processing steps to be executed after
  15.380 +     *   a successful import. Provide a bitwise combination of the
  15.381 +     *   #aiPostProcessSteps flags. If you wish to inspect the imported
  15.382 +     *   scene first in order to fine-tune your post-processing setup,
  15.383 +     *   consider to use #ApplyPostProcessing().
  15.384 +     * @return A pointer to the imported data, NULL if the import failed.
  15.385 +     *   The pointer to the scene remains in possession of the Importer
  15.386 +     *   instance. Use GetOrphanedScene() to take ownership of it.
  15.387 +     *
  15.388 +     * @note Assimp is able to determine the file format of a file
  15.389 +     * automatically.
  15.390 +     */
  15.391 +    const aiScene* ReadFile(
  15.392 +        const char* pFile,
  15.393 +        unsigned int pFlags);
  15.394 +
  15.395 +    // -------------------------------------------------------------------
  15.396 +    /** Reads the given file from a memory buffer and returns its
  15.397 +     *  contents if successful.
  15.398 +     *
  15.399 +     * If the call succeeds, the contents of the file are returned as a
  15.400 +     * pointer to an aiScene object. The returned data is intended to be
  15.401 +     * read-only, the importer object keeps ownership of the data and will
  15.402 +     * destroy it upon destruction. If the import fails, NULL is returned.
  15.403 +     * A human-readable error description can be retrieved by calling
  15.404 +     * GetErrorString(). The previous scene will be deleted during this call.
  15.405 +     * Calling this method doesn't affect the active IOSystem.
  15.406 +     * @param pBuffer Pointer to the file data
  15.407 +     * @param pLength Length of pBuffer, in bytes
  15.408 +     * @param pFlags Optional post processing steps to be executed after
  15.409 +     *   a successful import. Provide a bitwise combination of the
  15.410 +     *   #aiPostProcessSteps flags. If you wish to inspect the imported
  15.411 +     *   scene first in order to fine-tune your post-processing setup,
  15.412 +     *   consider to use #ApplyPostProcessing().
  15.413 +     * @param pHint An additional hint to the library. If this is a non
  15.414 +     *   empty string, the library looks for a loader to support
  15.415 +     *   the file extension specified by pHint and passes the file to
  15.416 +     *   the first matching loader. If this loader is unable to completely
  15.417 +     *   the request, the library continues and tries to determine the
  15.418 +     *   file format on its own, a task that may or may not be successful.
  15.419 +     *   Check the return value, and you'll know ...
  15.420 +     * @return A pointer to the imported data, NULL if the import failed.
  15.421 +     *   The pointer to the scene remains in possession of the Importer
  15.422 +     *   instance. Use GetOrphanedScene() to take ownership of it.
  15.423 +     *
  15.424 +     * @note This is a straightforward way to decode models from memory
  15.425 +     * buffers, but it doesn't handle model formats that spread their
  15.426 +     * data across multiple files or even directories. Examples include
  15.427 +     * OBJ or MD3, which outsource parts of their material info into
  15.428 +     * external scripts. If you need full functionality, provide
  15.429 +     * a custom IOSystem to make Assimp find these files and use
  15.430 +     * the regular ReadFile() API.
  15.431 +     */
  15.432 +    const aiScene* ReadFileFromMemory(
  15.433 +        const void* pBuffer,
  15.434 +        size_t pLength,
  15.435 +        unsigned int pFlags,
  15.436 +        const char* pHint = "");
  15.437 +
  15.438 +    // -------------------------------------------------------------------
  15.439 +    /** Apply post-processing to an already-imported scene.
  15.440 +     *
  15.441 +     *  This is strictly equivalent to calling #ReadFile() with the same
  15.442 +     *  flags. However, you can use this separate function to inspect
  15.443 +     *  the imported scene first to fine-tune your post-processing setup.
  15.444 +     *  @param pFlags Provide a bitwise combination of the
  15.445 +     *   #aiPostProcessSteps flags.
  15.446 +     *  @return A pointer to the post-processed data. This is still the
  15.447 +     *   same as the pointer returned by #ReadFile(). However, if
  15.448 +     *   post-processing fails, the scene could now be NULL.
  15.449 +     *   That's quite a rare case, post processing steps are not really
  15.450 +     *   designed to 'fail'. To be exact, the #aiProcess_ValidateDS
  15.451 +     *   flag is currently the only post processing step which can actually
  15.452 +     *   cause the scene to be reset to NULL.
  15.453 +     *
  15.454 +     *  @note The method does nothing if no scene is currently bound
  15.455 +     *    to the #Importer instance.  */
  15.456 +    const aiScene* ApplyPostProcessing(unsigned int pFlags);
  15.457 +
  15.458 +    const aiScene* ApplyCustomizedPostProcessing( BaseProcess *rootProcess, bool requestValidation );
  15.459 +
  15.460 +    // -------------------------------------------------------------------
  15.461 +    /** @brief Reads the given file and returns its contents if successful.
  15.462 +     *
  15.463 +     * This function is provided for backward compatibility.
  15.464 +     * See the const char* version for detailed docs.
  15.465 +     * @see ReadFile(const char*, pFlags)  */
  15.466 +    const aiScene* ReadFile(
  15.467 +        const std::string& pFile,
  15.468 +        unsigned int pFlags);
  15.469 +
  15.470 +    // -------------------------------------------------------------------
  15.471 +    /** Frees the current scene.
  15.472 +     *
  15.473 +     *  The function does nothing if no scene has previously been
  15.474 +     *  read via ReadFile(). FreeScene() is called automatically by the
  15.475 +     *  destructor and ReadFile() itself.  */
  15.476 +    void FreeScene( );
  15.477 +
  15.478 +    // -------------------------------------------------------------------
  15.479 +    /** Returns an error description of an error that occurred in ReadFile().
  15.480 +     *
  15.481 +     * Returns an empty string if no error occurred.
  15.482 +     * @return A description of the last error, an empty string if no
  15.483 +     *   error occurred. The string is never NULL.
  15.484 +     *
  15.485 +     * @note The returned function remains valid until one of the
  15.486 +     * following methods is called: #ReadFile(), #FreeScene(). */
  15.487 +    const char* GetErrorString() const;
  15.488 +
  15.489 +    // -------------------------------------------------------------------
  15.490 +    /** Returns the scene loaded by the last successful call to ReadFile()
  15.491 +     *
  15.492 +     * @return Current scene or NULL if there is currently no scene loaded */
  15.493 +    const aiScene* GetScene() const;
  15.494 +
  15.495 +    // -------------------------------------------------------------------
  15.496 +    /** Returns the scene loaded by the last successful call to ReadFile()
  15.497 +     *  and releases the scene from the ownership of the Importer
  15.498 +     *  instance. The application is now responsible for deleting the
  15.499 +     *  scene. Any further calls to GetScene() or GetOrphanedScene()
  15.500 +     *  will return NULL - until a new scene has been loaded via ReadFile().
  15.501 +     *
  15.502 +     * @return Current scene or NULL if there is currently no scene loaded
  15.503 +     * @note Use this method with maximal caution, and only if you have to.
  15.504 +     *   By design, aiScene's are exclusively maintained, allocated and
  15.505 +     *   deallocated by Assimp and no one else. The reasoning behind this
  15.506 +     *   is the golden rule that deallocations should always be done
  15.507 +     *   by the module that did the original allocation because heaps
  15.508 +     *   are not necessarily shared. GetOrphanedScene() enforces you
  15.509 +     *   to delete the returned scene by yourself, but this will only
  15.510 +     *   be fine if and only if you're using the same heap as assimp.
  15.511 +     *   On Windows, it's typically fine provided everything is linked
  15.512 +     *   against the multithreaded-dll version of the runtime library.
  15.513 +     *   It will work as well for static linkage with Assimp.*/
  15.514 +    aiScene* GetOrphanedScene();
  15.515 +
  15.516 +    // -------------------------------------------------------------------
  15.517 +    /** Returns whether a given file extension is supported by ASSIMP.
  15.518 +     *
  15.519 +     * @param szExtension Extension to be checked.
  15.520 +     *   Must include a trailing dot '.'. Example: ".3ds", ".md3".
  15.521 +     *   Cases-insensitive.
  15.522 +     * @return true if the extension is supported, false otherwise */
  15.523 +    bool IsExtensionSupported(const char* szExtension) const;
  15.524 +
  15.525 +    // -------------------------------------------------------------------
  15.526 +    /** @brief Returns whether a given file extension is supported by ASSIMP.
  15.527 +     *
  15.528 +     * This function is provided for backward compatibility.
  15.529 +     * See the const char* version for detailed and up-to-date docs.
  15.530 +     * @see IsExtensionSupported(const char*) */
  15.531 +    inline bool IsExtensionSupported(const std::string& szExtension) const;
  15.532 +
  15.533 +    // -------------------------------------------------------------------
  15.534 +    /** Get a full list of all file extensions supported by ASSIMP.
  15.535 +     *
  15.536 +     * If a file extension is contained in the list this does of course not
  15.537 +     * mean that ASSIMP is able to load all files with this extension ---
  15.538 +     * it simply means there is an importer loaded which claims to handle
  15.539 +     * files with this file extension.
  15.540 +     * @param szOut String to receive the extension list.
  15.541 +     *   Format of the list: "*.3ds;*.obj;*.dae". This is useful for
  15.542 +     *   use with the WinAPI call GetOpenFileName(Ex). */
  15.543 +    void GetExtensionList(aiString& szOut) const;
  15.544 +
  15.545 +    // -------------------------------------------------------------------
  15.546 +    /** @brief Get a full list of all file extensions supported by ASSIMP.
  15.547 +     *
  15.548 +     * This function is provided for backward compatibility.
  15.549 +     * See the aiString version for detailed and up-to-date docs.
  15.550 +     * @see GetExtensionList(aiString&)*/
  15.551 +    inline void GetExtensionList(std::string& szOut) const;
  15.552 +
  15.553 +    // -------------------------------------------------------------------
  15.554 +    /** Get the number of importers currently registered with Assimp. */
  15.555 +    size_t GetImporterCount() const;
  15.556 +
  15.557 +    // -------------------------------------------------------------------
  15.558 +    /** Get meta data for the importer corresponding to a specific index..
  15.559 +    *
  15.560 +    *  For the declaration of #aiImporterDesc, include <assimp/importerdesc.h>.
  15.561 +    *  @param index Index to query, must be within [0,GetImporterCount())
  15.562 +    *  @return Importer meta data structure, NULL if the index does not
  15.563 +    *     exist or if the importer doesn't offer meta information (
  15.564 +    *     importers may do this at the cost of being hated by their peers).*/
  15.565 +    const aiImporterDesc* GetImporterInfo(size_t index) const;
  15.566 +
  15.567 +    // -------------------------------------------------------------------
  15.568 +    /** Find the importer corresponding to a specific index.
  15.569 +    *
  15.570 +    *  @param index Index to query, must be within [0,GetImporterCount())
  15.571 +    *  @return Importer instance. NULL if the index does not
  15.572 +    *     exist. */
  15.573 +    BaseImporter* GetImporter(size_t index) const;
  15.574 +
  15.575 +    // -------------------------------------------------------------------
  15.576 +    /** Find the importer corresponding to a specific file extension.
  15.577 +    *
  15.578 +    *  This is quite similar to #IsExtensionSupported except a
  15.579 +    *  BaseImporter instance is returned.
  15.580 +    *  @param szExtension Extension to check for. The following formats
  15.581 +    *    are recognized (BAH being the file extension): "BAH" (comparison
  15.582 +    *    is case-insensitive), ".bah", "*.bah" (wild card and dot
  15.583 +    *    characters at the beginning of the extension are skipped).
  15.584 +    *  @return NULL if no importer is found*/
  15.585 +    BaseImporter* GetImporter (const char* szExtension) const;
  15.586 +
  15.587 +    // -------------------------------------------------------------------
  15.588 +    /** Find the importer index corresponding to a specific file extension.
  15.589 +    *
  15.590 +    *  @param szExtension Extension to check for. The following formats
  15.591 +    *    are recognized (BAH being the file extension): "BAH" (comparison
  15.592 +    *    is case-insensitive), ".bah", "*.bah" (wild card and dot
  15.593 +    *    characters at the beginning of the extension are skipped).
  15.594 +    *  @return (size_t)-1 if no importer is found */
  15.595 +    size_t GetImporterIndex (const char* szExtension) const;
  15.596 +
  15.597 +    // -------------------------------------------------------------------
  15.598 +    /** Returns the storage allocated by ASSIMP to hold the scene data
  15.599 +     * in memory.
  15.600 +     *
  15.601 +     * This refers to the currently loaded file, see #ReadFile().
  15.602 +     * @param in Data structure to be filled.
  15.603 +     * @note The returned memory statistics refer to the actual
  15.604 +     *   size of the use data of the aiScene. Heap-related overhead
  15.605 +     *   is (naturally) not included.*/
  15.606 +    void GetMemoryRequirements(aiMemoryInfo& in) const;
  15.607 +
  15.608 +    // -------------------------------------------------------------------
  15.609 +    /** Enables "extra verbose" mode.
  15.610 +     *
  15.611 +     * 'Extra verbose' means the data structure is validated after *every*
  15.612 +     * single post processing step to make sure everyone modifies the data
  15.613 +     * structure in a well-defined manner. This is a debug feature and not
  15.614 +     * intended for use in production environments. */
  15.615 +    void SetExtraVerbose(bool bDo);
  15.616 +
  15.617 +    // -------------------------------------------------------------------
  15.618 +    /** Private, do not use. */
  15.619 +    ImporterPimpl* Pimpl() { return pimpl; }
  15.620 +    const ImporterPimpl* Pimpl() const { return pimpl; }
  15.621 +
  15.622 +protected:
  15.623 +
  15.624 +    // Just because we don't want you to know how we're hacking around.
  15.625 +    ImporterPimpl* pimpl;
  15.626 +}; //! class Importer
  15.627 +
  15.628 +
  15.629 +// ----------------------------------------------------------------------------
  15.630 +// For compatibility, the interface of some functions taking a std::string was
  15.631 +// changed to const char* to avoid crashes between binary incompatible STL
  15.632 +// versions. This code her is inlined,  so it shouldn't cause any problems.
  15.633 +// ----------------------------------------------------------------------------
  15.634 +
  15.635 +// ----------------------------------------------------------------------------
  15.636 +AI_FORCE_INLINE const aiScene* Importer::ReadFile( const std::string& pFile,unsigned int pFlags){
  15.637 +    return ReadFile(pFile.c_str(),pFlags);
  15.638 +}
  15.639 +// ----------------------------------------------------------------------------
  15.640 +AI_FORCE_INLINE void Importer::GetExtensionList(std::string& szOut) const   {
  15.641 +    aiString s;
  15.642 +    GetExtensionList(s);
  15.643 +    szOut = s.data;
  15.644 +}
  15.645 +// ----------------------------------------------------------------------------
  15.646 +AI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtension) const   {
  15.647 +    return IsExtensionSupported(szExtension.c_str());
  15.648 +}
  15.649 +
  15.650 +} // !namespace Assimp
  15.651 +
  15.652 +#endif // AI_ASSIMP_HPP_INC
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/include/miniassimp/LogStream.hpp	Mon Jan 28 18:19:26 2019 +0200
    16.3 @@ -0,0 +1,111 @@
    16.4 +/*
    16.5 +Open Asset Import Library (assimp)
    16.6 +----------------------------------------------------------------------
    16.7 +
    16.8 +Copyright (c) 2006-2018, assimp team
    16.9 +
   16.10 +
   16.11 +All rights reserved.
   16.12 +
   16.13 +Redistribution and use of this software in source and binary forms,
   16.14 +with or without modification, are permitted provided that the
   16.15 +following conditions are met:
   16.16 +
   16.17 +* Redistributions of source code must retain the above
   16.18 +  copyright notice, this list of conditions and the
   16.19 +  following disclaimer.
   16.20 +
   16.21 +* Redistributions in binary form must reproduce the above
   16.22 +  copyright notice, this list of conditions and the
   16.23 +  following disclaimer in the documentation and/or other
   16.24 +  materials provided with the distribution.
   16.25 +
   16.26 +* Neither the name of the assimp team, nor the names of its
   16.27 +  contributors may be used to endorse or promote products
   16.28 +  derived from this software without specific prior
   16.29 +  written permission of the assimp team.
   16.30 +
   16.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   16.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   16.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   16.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   16.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   16.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   16.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   16.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   16.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   16.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   16.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   16.42 +
   16.43 +----------------------------------------------------------------------
   16.44 +*/
   16.45 +
   16.46 +/** @file LogStream.hpp
   16.47 + *  @brief Abstract base class 'LogStream', representing an output log stream.
   16.48 + */
   16.49 +#ifndef INCLUDED_AI_LOGSTREAM_H
   16.50 +#define INCLUDED_AI_LOGSTREAM_H
   16.51 +
   16.52 +#include "types.h"
   16.53 +
   16.54 +namespace Assimp    {
   16.55 +
   16.56 +class IOSystem;
   16.57 +
   16.58 +// ------------------------------------------------------------------------------------
   16.59 +/** @brief CPP-API: Abstract interface for log stream implementations.
   16.60 + *
   16.61 + *  Several default implementations are provided, see #aiDefaultLogStream for more
   16.62 + *  details. Writing your own implementation of LogStream is just necessary if these
   16.63 + *  are not enough for your purpose. */
   16.64 +class ASSIMP_API LogStream
   16.65 +#ifndef SWIG
   16.66 +    : public Intern::AllocateFromAssimpHeap
   16.67 +#endif
   16.68 +{
   16.69 +protected:
   16.70 +    /** @brief  Default constructor */
   16.71 +    LogStream() AI_NO_EXCEPT;
   16.72 +
   16.73 +public:
   16.74 +    /** @brief  Virtual destructor  */
   16.75 +    virtual ~LogStream();
   16.76 +
   16.77 +    // -------------------------------------------------------------------
   16.78 +    /** @brief  Overwrite this for your own output methods
   16.79 +     *
   16.80 +     *  Log messages *may* consist of multiple lines and you shouldn't
   16.81 +     *  expect a consistent formatting. If you want custom formatting
   16.82 +     *  (e.g. generate HTML), supply a custom instance of Logger to
   16.83 +     *  #DefaultLogger:set(). Usually you can *expect* that a log message
   16.84 +     *  is exactly one line and terminated with a single \n character.
   16.85 +     *  @param message Message to be written */
   16.86 +    virtual void write(const char* message) = 0;
   16.87 +
   16.88 +    // -------------------------------------------------------------------
   16.89 +    /** @brief Creates a default log stream
   16.90 +     *  @param streams Type of the default stream
   16.91 +     *  @param name For aiDefaultLogStream_FILE: name of the output file
   16.92 +     *  @param io For aiDefaultLogStream_FILE: IOSystem to be used to open the output
   16.93 +     *   file. Pass NULL for the default implementation.
   16.94 +     *  @return New LogStream instance.  */
   16.95 +    static LogStream* createDefaultStream(aiDefaultLogStream stream,
   16.96 +        const char* name = "AssimpLog.txt",
   16.97 +        IOSystem* io = 0 );
   16.98 +
   16.99 +}; // !class LogStream
  16.100 +
  16.101 +inline
  16.102 +LogStream::LogStream() AI_NO_EXCEPT {
  16.103 +    // empty
  16.104 +}
  16.105 +
  16.106 +inline
  16.107 +LogStream::~LogStream() {
  16.108 +    // empty
  16.109 +}
  16.110 +
  16.111 +// ------------------------------------------------------------------------------------
  16.112 +} // Namespace Assimp
  16.113 +
  16.114 +#endif
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/include/miniassimp/Logger.hpp	Mon Jan 28 18:19:26 2019 +0200
    17.3 @@ -0,0 +1,305 @@
    17.4 +/*
    17.5 +Open Asset Import Library (assimp)
    17.6 +----------------------------------------------------------------------
    17.7 +
    17.8 +Copyright (c) 2006-2018, assimp team
    17.9 +
   17.10 +
   17.11 +All rights reserved.
   17.12 +
   17.13 +Redistribution and use of this software in source and binary forms,
   17.14 +with or without modification, are permitted provided that the
   17.15 +following conditions are met:
   17.16 +
   17.17 +* Redistributions of source code must retain the above
   17.18 +  copyright notice, this list of conditions and the
   17.19 +  following disclaimer.
   17.20 +
   17.21 +* Redistributions in binary form must reproduce the above
   17.22 +  copyright notice, this list of conditions and the
   17.23 +  following disclaimer in the documentation and/or other
   17.24 +  materials provided with the distribution.
   17.25 +
   17.26 +* Neither the name of the assimp team, nor the names of its
   17.27 +  contributors may be used to endorse or promote products
   17.28 +  derived from this software without specific prior
   17.29 +  written permission of the assimp team.
   17.30 +
   17.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   17.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   17.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   17.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   17.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   17.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   17.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   17.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   17.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   17.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   17.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   17.42 +
   17.43 +----------------------------------------------------------------------
   17.44 +*/
   17.45 +
   17.46 +/** @file Logger.hpp
   17.47 + *  @brief Abstract base class 'Logger', base of the logging system.
   17.48 + */
   17.49 +#ifndef INCLUDED_AI_LOGGER_H
   17.50 +#define INCLUDED_AI_LOGGER_H
   17.51 +
   17.52 +#include <miniassimp/types.h>
   17.53 +#include <miniassimp/TinyFormatter.h>
   17.54 +
   17.55 +namespace Assimp {
   17.56 +
   17.57 +class LogStream;
   17.58 +
   17.59 +// Maximum length of a log message. Longer messages are rejected.
   17.60 +#define MAX_LOG_MESSAGE_LENGTH 1024u
   17.61 +
   17.62 +// ----------------------------------------------------------------------------------
   17.63 +/** @brief CPP-API: Abstract interface for logger implementations.
   17.64 + *  Assimp provides a default implementation and uses it for almost all
   17.65 + *  logging stuff ('DefaultLogger'). This class defines just basic logging
   17.66 + *  behavior and is not of interest for you. Instead, take a look at #DefaultLogger. */
   17.67 +class ASSIMP_API Logger
   17.68 +#ifndef SWIG
   17.69 +    : public Intern::AllocateFromAssimpHeap
   17.70 +#endif
   17.71 +{
   17.72 +public:
   17.73 +
   17.74 +    // ----------------------------------------------------------------------
   17.75 +    /** @enum   LogSeverity
   17.76 +     *  @brief  Log severity to describe the granularity of logging.
   17.77 +     */
   17.78 +    enum LogSeverity {
   17.79 +        NORMAL,     //!< Normal granularity of logging
   17.80 +        VERBOSE     //!< Debug infos will be logged, too
   17.81 +    };
   17.82 +
   17.83 +    // ----------------------------------------------------------------------
   17.84 +    /** @enum   ErrorSeverity
   17.85 +     *  @brief  Description for severity of a log message.
   17.86 +     *
   17.87 +     *  Every LogStream has a bitwise combination of these flags.
   17.88 +     *  A LogStream doesn't receive any messages of a specific type
   17.89 +     *  if it doesn't specify the corresponding ErrorSeverity flag.
   17.90 +     */
   17.91 +    enum ErrorSeverity {
   17.92 +        Debugging   = 1,    //!< Debug log message
   17.93 +        Info        = 2,    //!< Info log message
   17.94 +        Warn        = 4,    //!< Warn log message
   17.95 +        Err         = 8     //!< Error log message
   17.96 +    };
   17.97 +
   17.98 +public:
   17.99 +
  17.100 +    /** @brief  Virtual destructor */
  17.101 +    virtual ~Logger();
  17.102 +
  17.103 +    // ----------------------------------------------------------------------
  17.104 +    /** @brief  Writes a debug message
  17.105 +     *   @param message Debug message*/
  17.106 +    void debug(const char* message);
  17.107 +    void debug(const std::string &message);
  17.108 +
  17.109 +    // ----------------------------------------------------------------------
  17.110 +    /** @brief  Writes a info message
  17.111 +     *  @param  message Info message*/
  17.112 +    void info(const char* message);
  17.113 +    void info(const std::string &message);
  17.114 +
  17.115 +    // ----------------------------------------------------------------------
  17.116 +    /** @brief  Writes a warning message
  17.117 +     *  @param  message Warn message*/
  17.118 +    void warn(const char* message);
  17.119 +    void warn(const std::string &message);
  17.120 +
  17.121 +    // ----------------------------------------------------------------------
  17.122 +    /** @brief  Writes an error message
  17.123 +     *  @param  message Error message*/
  17.124 +    void error(const char* message);
  17.125 +    void error(const std::string &message);
  17.126 +
  17.127 +    // ----------------------------------------------------------------------
  17.128 +    /** @brief  Set a new log severity.
  17.129 +     *  @param  log_severity New severity for logging*/
  17.130 +    void setLogSeverity(LogSeverity log_severity);
  17.131 +
  17.132 +    // ----------------------------------------------------------------------
  17.133 +    /** @brief Get the current log severity*/
  17.134 +    LogSeverity getLogSeverity() const;
  17.135 +
  17.136 +    // ----------------------------------------------------------------------
  17.137 +    /** @brief  Attach a new log-stream
  17.138 +     *
  17.139 +     *  The logger takes ownership of the stream and is responsible
  17.140 +     *  for its destruction (which is done using ::delete when the logger
  17.141 +     *  itself is destroyed). Call detachStream to detach a stream and to
  17.142 +     *  gain ownership of it again.
  17.143 +     *   @param pStream  Log-stream to attach
  17.144 +     *  @param severity  Message filter, specified which types of log
  17.145 +     *    messages are dispatched to the stream. Provide a bitwise
  17.146 +     *    combination of the ErrorSeverity flags.
  17.147 +     *  @return true if the stream has been attached, false otherwise.*/
  17.148 +    virtual bool attachStream(LogStream *pStream,
  17.149 +        unsigned int severity = Debugging | Err | Warn | Info) = 0;
  17.150 +
  17.151 +    // ----------------------------------------------------------------------
  17.152 +    /** @brief  Detach a still attached stream from the logger (or
  17.153 +     *          modify the filter flags bits)
  17.154 +     *   @param pStream Log-stream instance for detaching
  17.155 +     *  @param severity Provide a bitwise combination of the ErrorSeverity
  17.156 +     *    flags. This value is &~ed with the current flags of the stream,
  17.157 +     *    if the result is 0 the stream is detached from the Logger and
  17.158 +     *    the caller retakes the possession of the stream.
  17.159 +     *  @return true if the stream has been detached, false otherwise.*/
  17.160 +    virtual bool detatchStream(LogStream *pStream,
  17.161 +        unsigned int severity = Debugging | Err | Warn | Info) = 0;
  17.162 +
  17.163 +protected:
  17.164 +    /**
  17.165 +     *  Default constructor
  17.166 +     */
  17.167 +    Logger() AI_NO_EXCEPT;
  17.168 +
  17.169 +    /**
  17.170 +     *  Construction with a given log severity
  17.171 +     */
  17.172 +    explicit Logger(LogSeverity severity);
  17.173 +
  17.174 +    // ----------------------------------------------------------------------
  17.175 +    /**
  17.176 +     *  @brief Called as a request to write a specific debug message
  17.177 +     *  @param  message Debug message. Never longer than
  17.178 +     *    MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').
  17.179 +     *  @note  The message string is only valid until the scope of
  17.180 +     *    the function is left.
  17.181 +     */
  17.182 +    virtual void OnDebug(const char* message)= 0;
  17.183 +
  17.184 +    // ----------------------------------------------------------------------
  17.185 +    /**
  17.186 +     *  @brief Called as a request to write a specific info message
  17.187 +     *  @param  message Info message. Never longer than
  17.188 +     *    MAX_LOG_MESSAGE_LENGTH characters (ecxluding the '0').
  17.189 +     *  @note  The message string is only valid until the scope of
  17.190 +     *    the function is left.
  17.191 +     */
  17.192 +    virtual void OnInfo(const char* message) = 0;
  17.193 +
  17.194 +    // ----------------------------------------------------------------------
  17.195 +    /**
  17.196 +     *  @brief Called as a request to write a specific warn message
  17.197 +     *  @param  message Warn message. Never longer than
  17.198 +     *    MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
  17.199 +     *  @note  The message string is only valid until the scope of
  17.200 +     *    the function is left.
  17.201 +     */
  17.202 +    virtual void OnWarn(const char* essage) = 0;
  17.203 +
  17.204 +    // ----------------------------------------------------------------------
  17.205 +    /**
  17.206 +     *  @brief Called as a request to write a specific error message
  17.207 +     *  @param  message Error message. Never longer than
  17.208 +     *    MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
  17.209 +     *  @note  The message string is only valid until the scope of
  17.210 +     *    the function is left.
  17.211 +     */
  17.212 +    virtual void OnError(const char* message) = 0;
  17.213 +
  17.214 +protected:
  17.215 +    LogSeverity m_Severity;
  17.216 +};
  17.217 +
  17.218 +// ----------------------------------------------------------------------------------
  17.219 +//  Default constructor
  17.220 +inline
  17.221 +Logger::Logger() AI_NO_EXCEPT
  17.222 +: m_Severity(NORMAL) {
  17.223 +    // empty
  17.224 +}
  17.225 +
  17.226 +// ----------------------------------------------------------------------------------
  17.227 +//  Virtual destructor
  17.228 +inline
  17.229 +Logger::~Logger() {
  17.230 +    // empty
  17.231 +}
  17.232 +
  17.233 +// ----------------------------------------------------------------------------------
  17.234 +// Construction with given logging severity
  17.235 +inline
  17.236 +Logger::Logger(LogSeverity severity)
  17.237 +: m_Severity(severity) {
  17.238 +    // empty
  17.239 +}
  17.240 +
  17.241 +// ----------------------------------------------------------------------------------
  17.242 +// Log severity setter
  17.243 +inline
  17.244 +void Logger::setLogSeverity(LogSeverity log_severity){
  17.245 +    m_Severity = log_severity;
  17.246 +}
  17.247 +
  17.248 +// ----------------------------------------------------------------------------------
  17.249 +// Log severity getter
  17.250 +inline
  17.251 +Logger::LogSeverity Logger::getLogSeverity() const {
  17.252 +    return m_Severity;
  17.253 +}
  17.254 +
  17.255 +// ----------------------------------------------------------------------------------
  17.256 +inline
  17.257 +void Logger::debug(const std::string &message) {
  17.258 +    return debug(message.c_str());
  17.259 +}
  17.260 +
  17.261 +// ----------------------------------------------------------------------------------
  17.262 +inline
  17.263 +void Logger::error(const std::string &message) {
  17.264 +    return error(message.c_str());
  17.265 +}
  17.266 +
  17.267 +// ----------------------------------------------------------------------------------
  17.268 +inline
  17.269 +void Logger::warn(const std::string &message) {
  17.270 +    return warn(message.c_str());
  17.271 +}
  17.272 +
  17.273 +// ----------------------------------------------------------------------------------
  17.274 +inline
  17.275 +void Logger::info(const std::string &message) {
  17.276 +    return info(message.c_str());
  17.277 +}
  17.278 +
  17.279 +// ------------------------------------------------------------------------------------------------
  17.280 +#define ASSIMP_LOG_WARN_F(string,...)\
  17.281 +    DefaultLogger::get()->warn((Formatter::format(string),__VA_ARGS__))
  17.282 +
  17.283 +#define ASSIMP_LOG_ERROR_F(string,...)\
  17.284 +    DefaultLogger::get()->error((Formatter::format(string),__VA_ARGS__))
  17.285 +
  17.286 +#define ASSIMP_LOG_DEBUG_F(string,...)\
  17.287 +    DefaultLogger::get()->debug((Formatter::format(string),__VA_ARGS__))
  17.288 +
  17.289 +#define ASSIMP_LOG_INFO_F(string,...)\
  17.290 +    DefaultLogger::get()->info((Formatter::format(string),__VA_ARGS__))
  17.291 +
  17.292 +
  17.293 +#define ASSIMP_LOG_WARN(string)\
  17.294 +    DefaultLogger::get()->warn(string)
  17.295 +
  17.296 +#define ASSIMP_LOG_ERROR(string)\
  17.297 +    DefaultLogger::get()->error(string)
  17.298 +
  17.299 +#define ASSIMP_LOG_DEBUG(string)\
  17.300 +    DefaultLogger::get()->debug(string)
  17.301 +
  17.302 +#define ASSIMP_LOG_INFO(string)\
  17.303 +    DefaultLogger::get()->info(string)
  17.304 +
  17.305 +
  17.306 +} // Namespace Assimp
  17.307 +
  17.308 +#endif // !! INCLUDED_AI_LOGGER_H
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/include/miniassimp/NullLogger.hpp	Mon Jan 28 18:19:26 2019 +0200
    18.3 @@ -0,0 +1,99 @@
    18.4 +/*
    18.5 +Open Asset Import Library (assimp)
    18.6 +----------------------------------------------------------------------
    18.7 +
    18.8 +Copyright (c) 2006-2018, assimp team
    18.9 +
   18.10 +
   18.11 +All rights reserved.
   18.12 +
   18.13 +Redistribution and use of this software in source and binary forms,
   18.14 +with or without modification, are permitted provided that the
   18.15 +following conditions are met:
   18.16 +
   18.17 +* Redistributions of source code must retain the above
   18.18 +  copyright notice, this list of conditions and the
   18.19 +  following disclaimer.
   18.20 +
   18.21 +* Redistributions in binary form must reproduce the above
   18.22 +  copyright notice, this list of conditions and the
   18.23 +  following disclaimer in the documentation and/or other
   18.24 +  materials provided with the distribution.
   18.25 +
   18.26 +* Neither the name of the assimp team, nor the names of its
   18.27 +  contributors may be used to endorse or promote products
   18.28 +  derived from this software without specific prior
   18.29 +  written permission of the assimp team.
   18.30 +
   18.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   18.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   18.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   18.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   18.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   18.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   18.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   18.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   18.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   18.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   18.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   18.42 +
   18.43 +----------------------------------------------------------------------
   18.44 +*/
   18.45 +
   18.46 +/** @file  NullLogger.hpp
   18.47 + *  @brief Dummy logger
   18.48 +*/
   18.49 +
   18.50 +#ifndef INCLUDED_AI_NULLLOGGER_H
   18.51 +#define INCLUDED_AI_NULLLOGGER_H
   18.52 +
   18.53 +#include "Logger.hpp"
   18.54 +
   18.55 +namespace Assimp {
   18.56 +
   18.57 +// ---------------------------------------------------------------------------
   18.58 +/** @brief CPP-API: Empty logging implementation.
   18.59 + *
   18.60 + * Does nothing! Used by default if the application hasn't requested a
   18.61 + * custom logger via #DefaultLogger::set() or #DefaultLogger::create(); */
   18.62 +class ASSIMP_API NullLogger
   18.63 +    : public Logger {
   18.64 +
   18.65 +public:
   18.66 +
   18.67 +    /** @brief  Logs a debug message */
   18.68 +    void OnDebug(const char* message) {
   18.69 +        (void)message; //this avoids compiler warnings
   18.70 +    }
   18.71 +
   18.72 +    /** @brief  Logs an info message */
   18.73 +    void OnInfo(const char* message) {
   18.74 +        (void)message; //this avoids compiler warnings
   18.75 +    }
   18.76 +
   18.77 +    /** @brief  Logs a warning message */
   18.78 +    void OnWarn(const char* message) {
   18.79 +        (void)message; //this avoids compiler warnings
   18.80 +    }
   18.81 +
   18.82 +    /** @brief  Logs an error message */
   18.83 +    void OnError(const char* message) {
   18.84 +        (void)message; //this avoids compiler warnings
   18.85 +    }
   18.86 +
   18.87 +    /** @brief  Detach a still attached stream from logger */
   18.88 +    bool attachStream(LogStream *pStream, unsigned int severity) {
   18.89 +        (void)pStream; (void)severity; //this avoids compiler warnings
   18.90 +        return false;
   18.91 +    }
   18.92 +
   18.93 +    /** @brief  Detach a still attached stream from logger */
   18.94 +    bool detatchStream(LogStream *pStream, unsigned int severity) {
   18.95 +        (void)pStream; (void)severity; //this avoids compiler warnings
   18.96 +        return false;
   18.97 +    }
   18.98 +
   18.99 +private:
  18.100 +};
  18.101 +}
  18.102 +#endif // !! AI_NULLLOGGER_H_INCLUDED
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/include/miniassimp/ProgressHandler.hpp	Mon Jan 28 18:19:26 2019 +0200
    19.3 @@ -0,0 +1,145 @@
    19.4 +/*
    19.5 +Open Asset Import Library (assimp)
    19.6 +----------------------------------------------------------------------
    19.7 +
    19.8 +Copyright (c) 2006-2018, assimp team
    19.9 +
   19.10 +
   19.11 +All rights reserved.
   19.12 +
   19.13 +Redistribution and use of this software in source and binary forms,
   19.14 +with or without modification, are permitted provided that the
   19.15 +following conditions are met:
   19.16 +
   19.17 +* Redistributions of source code must retain the above
   19.18 +  copyright notice, this list of conditions and the
   19.19 +  following disclaimer.
   19.20 +
   19.21 +* Redistributions in binary form must reproduce the above
   19.22 +  copyright notice, this list of conditions and the
   19.23 +  following disclaimer in the documentation and/or other
   19.24 +  materials provided with the distribution.
   19.25 +
   19.26 +* Neither the name of the assimp team, nor the names of its
   19.27 +  contributors may be used to endorse or promote products
   19.28 +  derived from this software without specific prior
   19.29 +  written permission of the assimp team.
   19.30 +
   19.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   19.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   19.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   19.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   19.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   19.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   19.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   19.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   19.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   19.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   19.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   19.42 +
   19.43 +----------------------------------------------------------------------
   19.44 +*/
   19.45 +
   19.46 +/** @file ProgressHandler.hpp
   19.47 + *  @brief Abstract base class 'ProgressHandler'.
   19.48 + */
   19.49 +#pragma once
   19.50 +#ifndef AI_PROGRESSHANDLER_H_INC
   19.51 +#define AI_PROGRESSHANDLER_H_INC
   19.52 +
   19.53 +#include "types.h"
   19.54 +
   19.55 +namespace Assimp    {
   19.56 +
   19.57 +// ------------------------------------------------------------------------------------
   19.58 +/** @brief CPP-API: Abstract interface for custom progress report receivers.
   19.59 + *
   19.60 + *  Each #Importer instance maintains its own #ProgressHandler. The default
   19.61 + *  implementation provided by Assimp doesn't do anything at all. */
   19.62 +class ASSIMP_API ProgressHandler
   19.63 +#ifndef SWIG
   19.64 +    : public Intern::AllocateFromAssimpHeap
   19.65 +#endif
   19.66 +{
   19.67 +protected:
   19.68 +    /// @brief  Default constructor
   19.69 +    ProgressHandler () AI_NO_EXCEPT {
   19.70 +        // empty
   19.71 +    }
   19.72 +
   19.73 +public:
   19.74 +    /// @brief  Virtual destructor.
   19.75 +    virtual ~ProgressHandler () {
   19.76 +    }
   19.77 +
   19.78 +    // -------------------------------------------------------------------
   19.79 +    /** @brief Progress callback.
   19.80 +     *  @param percentage An estimate of the current loading progress,
   19.81 +     *    in percent. Or -1.f if such an estimate is not available.
   19.82 +     *
   19.83 +     *  There are restriction on what you may do from within your
   19.84 +     *  implementation of this method: no exceptions may be thrown and no
   19.85 +     *  non-const #Importer methods may be called. It is
   19.86 +     *  not generally possible to predict the number of callbacks
   19.87 +     *  fired during a single import.
   19.88 +     *
   19.89 +     *  @return Return false to abort loading at the next possible
   19.90 +     *   occasion (loaders and Assimp are generally allowed to perform
   19.91 +     *   all needed cleanup tasks prior to returning control to the
   19.92 +     *   caller). If the loading is aborted, #Importer::ReadFile()
   19.93 +     *   returns always NULL.
   19.94 +     *   */
   19.95 +    virtual bool Update(float percentage = -1.f) = 0;
   19.96 +
   19.97 +    // -------------------------------------------------------------------
   19.98 +    /** @brief Progress callback for file loading steps
   19.99 +     *  @param numberOfSteps The number of total post-processing
  19.100 +     *   steps
  19.101 +     *  @param currentStep The index of the current post-processing
  19.102 +     *   step that will run, or equal to numberOfSteps if all of
  19.103 +     *   them has finished. This number is always strictly monotone
  19.104 +     *   increasing, although not necessarily linearly.
  19.105 +     *
  19.106 +     *  @note This is currently only used at the start and the end
  19.107 +     *   of the file parsing.
  19.108 +     *   */
  19.109 +    virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {
  19.110 +        float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;
  19.111 +        Update( f * 0.5f );
  19.112 +    }
  19.113 +
  19.114 +    // -------------------------------------------------------------------
  19.115 +    /** @brief Progress callback for post-processing steps
  19.116 +     *  @param numberOfSteps The number of total post-processing
  19.117 +     *   steps
  19.118 +     *  @param currentStep The index of the current post-processing
  19.119 +     *   step that will run, or equal to numberOfSteps if all of
  19.120 +     *   them has finished. This number is always strictly monotone
  19.121 +     *   increasing, although not necessarily linearly.
  19.122 +     *   */
  19.123 +    virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {
  19.124 +        float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;
  19.125 +        Update( f * 0.5f + 0.5f );
  19.126 +    }
  19.127 +
  19.128 +
  19.129 +    // -------------------------------------------------------------------
  19.130 +    /** @brief Progress callback for export steps.
  19.131 +     *  @param numberOfSteps The number of total processing
  19.132 +     *   steps
  19.133 +     *  @param currentStep The index of the current post-processing
  19.134 +     *   step that will run, or equal to numberOfSteps if all of
  19.135 +     *   them has finished. This number is always strictly monotone
  19.136 +     *   increasing, although not necessarily linearly.
  19.137 +     *   */
  19.138 +    virtual void UpdateFileWrite(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {
  19.139 +        float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;
  19.140 +        Update(f * 0.5f);
  19.141 +    }
  19.142 +}; // !class ProgressHandler
  19.143 +
  19.144 +// ------------------------------------------------------------------------------------
  19.145 +
  19.146 +} // Namespace Assimp
  19.147 +
  19.148 +#endif // AI_PROGRESSHANDLER_H_INC
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/include/miniassimp/TinyFormatter.h	Mon Jan 28 18:19:26 2019 +0200
    20.3 @@ -0,0 +1,166 @@
    20.4 +/*
    20.5 +Open Asset Import Library (assimp)
    20.6 +----------------------------------------------------------------------
    20.7 +
    20.8 +Copyright (c) 2006-2018, assimp team
    20.9 +
   20.10 +
   20.11 +All rights reserved.
   20.12 +
   20.13 +Redistribution and use of this software in source and binary forms,
   20.14 +with or without modification, are permitted provided that the
   20.15 +following conditions are met:
   20.16 +
   20.17 +* Redistributions of source code must retain the above
   20.18 +  copyright notice, this list of conditions and the
   20.19 +  following disclaimer.
   20.20 +
   20.21 +* Redistributions in binary form must reproduce the above
   20.22 +  copyright notice, this list of conditions and the
   20.23 +  following disclaimer in the documentation and/or other
   20.24 +  materials provided with the distribution.
   20.25 +
   20.26 +* Neither the name of the assimp team, nor the names of its
   20.27 +  contributors may be used to endorse or promote products
   20.28 +  derived from this software without specific prior
   20.29 +  written permission of the assimp team.
   20.30 +
   20.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   20.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   20.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   20.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   20.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   20.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   20.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   20.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   20.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   20.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   20.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   20.42 +
   20.43 +----------------------------------------------------------------------
   20.44 +*/
   20.45 +
   20.46 +/** @file  TinyFormatter.h
   20.47 + *  @brief Utility to format log messages more easily. Introduced
   20.48 + *    to get rid of the boost::format dependency. Much slinker,
   20.49 + *    basically just extends stringstream.
   20.50 + */
   20.51 +#ifndef INCLUDED_TINY_FORMATTER_H
   20.52 +#define INCLUDED_TINY_FORMATTER_H
   20.53 +
   20.54 +#include <sstream>
   20.55 +
   20.56 +namespace Assimp {
   20.57 +namespace Formatter {
   20.58 +
   20.59 +// ------------------------------------------------------------------------------------------------
   20.60 +/** stringstream utility. Usage:
   20.61 + *  @code
   20.62 + *  void writelog(const std::string&s);
   20.63 + *  void writelog(const std::wstring&s);
   20.64 + *  ...
   20.65 + *  writelog(format()<< "hi! this is a number: " << 4);
   20.66 + *  writelog(wformat()<< L"hi! this is a number: " << 4);
   20.67 + *
   20.68 + *  @endcode */
   20.69 +template < typename T,
   20.70 +    typename CharTraits = std::char_traits<T>,
   20.71 +    typename Allocator  = std::allocator<T>
   20.72 +>
   20.73 +class basic_formatter
   20.74 +{
   20.75 +
   20.76 +public:
   20.77 +
   20.78 +    typedef class std::basic_string<
   20.79 +        T,CharTraits,Allocator
   20.80 +    > string;
   20.81 +
   20.82 +    typedef class std::basic_ostringstream<
   20.83 +        T,CharTraits,Allocator
   20.84 +    > stringstream;
   20.85 +
   20.86 +public:
   20.87 +
   20.88 +    basic_formatter() {}
   20.89 +
   20.90 +    /* Allow basic_formatter<T>'s to be used almost interchangeably
   20.91 +     * with std::(w)string or const (w)char* arguments because the
   20.92 +     * conversion c'tor is called implicitly. */
   20.93 +    template <typename TT>
   20.94 +    basic_formatter(const TT& sin)  {
   20.95 +        underlying << sin;
   20.96 +    }
   20.97 +
   20.98 +
   20.99 +    // The problem described here:
  20.100 +    // https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462
  20.101 +    // can also cause trouble here. Apparently, older gcc versions sometimes copy temporaries
  20.102 +    // being bound to const ref& function parameters. Copying streams is not permitted, though.
  20.103 +    // This workaround avoids this by manually specifying a copy ctor.
  20.104 +#if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
  20.105 +    explicit basic_formatter(const basic_formatter& other) {
  20.106 +        underlying << (string)other;
  20.107 +    }
  20.108 +#endif
  20.109 +
  20.110 +
  20.111 +public:
  20.112 +
  20.113 +    operator string () const {
  20.114 +        return underlying.str();
  20.115 +    }
  20.116 +
  20.117 +
  20.118 +    /* note - this is declared const because binding temporaries does only
  20.119 +     * work for const references, so many function prototypes will
  20.120 +     * include const basic_formatter<T>& s but might still want to
  20.121 +     * modify the formatted string without the need for a full copy.*/
  20.122 +    template <typename TToken>
  20.123 +    const basic_formatter& operator << (const TToken& s) const {
  20.124 +        underlying << s;
  20.125 +        return *this;
  20.126 +    }
  20.127 +
  20.128 +    template <typename TToken>
  20.129 +    basic_formatter& operator << (const TToken& s) {
  20.130 +        underlying << s;
  20.131 +        return *this;
  20.132 +    }
  20.133 +
  20.134 +
  20.135 +    // comma operator overloaded as well, choose your preferred way.
  20.136 +    template <typename TToken>
  20.137 +    const basic_formatter& operator, (const TToken& s) const {
  20.138 +        underlying << s;
  20.139 +        return *this;
  20.140 +    }
  20.141 +
  20.142 +    template <typename TToken>
  20.143 +    basic_formatter& operator, (const TToken& s) {
  20.144 +        underlying << s;
  20.145 +        return *this;
  20.146 +    }
  20.147 +
  20.148 +    // Fix for MSVC8
  20.149 +    // See https://sourceforge.net/projects/assimp/forums/forum/817654/topic/4372824
  20.150 +    template <typename TToken>
  20.151 +    basic_formatter& operator, (TToken& s) {
  20.152 +        underlying << s;
  20.153 +        return *this;
  20.154 +    }
  20.155 +
  20.156 +
  20.157 +private:
  20.158 +    mutable stringstream underlying;
  20.159 +};
  20.160 +
  20.161 +
  20.162 +typedef basic_formatter< char > format;
  20.163 +typedef basic_formatter< wchar_t > wformat;
  20.164 +
  20.165 +} // ! namespace Formatter
  20.166 +
  20.167 +} // ! namespace Assimp
  20.168 +
  20.169 +#endif
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/include/miniassimp/ai_assert.h	Mon Jan 28 18:19:26 2019 +0200
    21.3 @@ -0,0 +1,54 @@
    21.4 +/*
    21.5 +---------------------------------------------------------------------------
    21.6 +Open Asset Import Library (assimp)
    21.7 +---------------------------------------------------------------------------
    21.8 +
    21.9 +Copyright (c) 2006-2018, assimp team
   21.10 +
   21.11 +
   21.12 +
   21.13 +All rights reserved.
   21.14 +
   21.15 +Redistribution and use of this software in source and binary forms,
   21.16 +with or without modification, are permitted provided that the following
   21.17 +conditions are met:
   21.18 +
   21.19 +* Redistributions of source code must retain the above
   21.20 +  copyright notice, this list of conditions and the
   21.21 +  following disclaimer.
   21.22 +
   21.23 +* Redistributions in binary form must reproduce the above
   21.24 +  copyright notice, this list of conditions and the
   21.25 +  following disclaimer in the documentation and/or other
   21.26 +  materials provided with the distribution.
   21.27 +
   21.28 +* Neither the name of the assimp team, nor the names of its
   21.29 +  contributors may be used to endorse or promote products
   21.30 +  derived from this software without specific prior
   21.31 +  written permission of the assimp team.
   21.32 +
   21.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   21.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   21.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   21.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   21.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   21.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   21.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   21.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   21.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   21.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   21.44 +---------------------------------------------------------------------------
   21.45 +*/
   21.46 +#pragma once
   21.47 +#ifndef AI_ASSERT_H_INC
   21.48 +#define AI_ASSERT_H_INC
   21.49 +
   21.50 +#ifdef ASSIMP_BUILD_DEBUG
   21.51 +#   include <assert.h>
   21.52 +#   define  ai_assert(expression) assert(expression)
   21.53 +#else
   21.54 +#   define  ai_assert(expression)
   21.55 +#endif // 
   21.56 +
   21.57 +#endif // AI_ASSERT_H_INC
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/include/miniassimp/anim.h	Mon Jan 28 18:19:26 2019 +0200
    22.3 @@ -0,0 +1,577 @@
    22.4 +/*
    22.5 +---------------------------------------------------------------------------
    22.6 +Open Asset Import Library (assimp)
    22.7 +---------------------------------------------------------------------------
    22.8 +
    22.9 +Copyright (c) 2006-2018, assimp team
   22.10 +
   22.11 +
   22.12 +
   22.13 +All rights reserved.
   22.14 +
   22.15 +Redistribution and use of this software in source and binary forms,
   22.16 +with or without modification, are permitted provided that the following
   22.17 +conditions are met:
   22.18 +
   22.19 +* Redistributions of source code must retain the above
   22.20 +  copyright notice, this list of conditions and the
   22.21 +  following disclaimer.
   22.22 +
   22.23 +* Redistributions in binary form must reproduce the above
   22.24 +  copyright notice, this list of conditions and the
   22.25 +  following disclaimer in the documentation and/or other
   22.26 +  materials provided with the distribution.
   22.27 +
   22.28 +* Neither the name of the assimp team, nor the names of its
   22.29 +  contributors may be used to endorse or promote products
   22.30 +  derived from this software without specific prior
   22.31 +  written permission of the assimp team.
   22.32 +
   22.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   22.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   22.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   22.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   22.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   22.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   22.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   22.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   22.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   22.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   22.44 +---------------------------------------------------------------------------
   22.45 +*/
   22.46 +
   22.47 +/** 
   22.48 +  * @file   anim.h
   22.49 +  * @brief  Defines the data structures in which the imported animations
   22.50 +  *         are returned.
   22.51 +  */
   22.52 +#pragma once
   22.53 +#ifndef AI_ANIM_H_INC
   22.54 +#define AI_ANIM_H_INC
   22.55 +
   22.56 +#include <miniassimp/types.h>
   22.57 +#include <miniassimp/quaternion.h>
   22.58 +
   22.59 +#ifdef __cplusplus
   22.60 +extern "C" {
   22.61 +#endif
   22.62 +
   22.63 +// ---------------------------------------------------------------------------
   22.64 +/** A time-value pair specifying a certain 3D vector for the given time. */
   22.65 +struct aiVectorKey
   22.66 +{
   22.67 +    /** The time of this key */
   22.68 +    double mTime;
   22.69 +
   22.70 +    /** The value of this key */
   22.71 +    C_STRUCT aiVector3D mValue;
   22.72 +
   22.73 +#ifdef __cplusplus
   22.74 +
   22.75 +    /// @brief  The default constructor.
   22.76 +    aiVectorKey() AI_NO_EXCEPT
   22.77 +    : mTime( 0.0 )
   22.78 +    , mValue() {
   22.79 +        // empty
   22.80 +    }
   22.81 +
   22.82 +    /// @brief  Construction from a given time and key value.
   22.83 +
   22.84 +    aiVectorKey(double time, const aiVector3D& value)
   22.85 +    : mTime( time )
   22.86 +    , mValue( value ) {
   22.87 +        // empty
   22.88 +    }
   22.89 +
   22.90 +    typedef aiVector3D elem_type;
   22.91 +
   22.92 +    // Comparison operators. For use with std::find();
   22.93 +    bool operator == (const aiVectorKey& rhs) const {
   22.94 +        return rhs.mValue == this->mValue;
   22.95 +    }
   22.96 +    bool operator != (const aiVectorKey& rhs ) const {
   22.97 +        return rhs.mValue != this->mValue;
   22.98 +    }
   22.99 +
  22.100 +    // Relational operators. For use with std::sort();
  22.101 +    bool operator < (const aiVectorKey& rhs ) const {
  22.102 +        return mTime < rhs.mTime;
  22.103 +    }
  22.104 +    bool operator > (const aiVectorKey& rhs ) const {
  22.105 +        return mTime > rhs.mTime;
  22.106 +    }
  22.107 +#endif // __cplusplus
  22.108 +};
  22.109 +
  22.110 +// ---------------------------------------------------------------------------
  22.111 +/** A time-value pair specifying a rotation for the given time.
  22.112 + *  Rotations are expressed with quaternions. */
  22.113 +struct aiQuatKey
  22.114 +{
  22.115 +    /** The time of this key */
  22.116 +    double mTime;
  22.117 +
  22.118 +    /** The value of this key */
  22.119 +    C_STRUCT aiQuaternion mValue;
  22.120 +
  22.121 +#ifdef __cplusplus
  22.122 +    aiQuatKey() AI_NO_EXCEPT
  22.123 +    : mTime( 0.0 )
  22.124 +    , mValue() {
  22.125 +        // empty
  22.126 +    }
  22.127 +
  22.128 +    /** Construction from a given time and key value */
  22.129 +    aiQuatKey(double time, const aiQuaternion& value)
  22.130 +        :   mTime   (time)
  22.131 +        ,   mValue  (value)
  22.132 +    {}
  22.133 +
  22.134 +    typedef aiQuaternion elem_type;
  22.135 +
  22.136 +    // Comparison operators. For use with std::find();
  22.137 +    bool operator == (const aiQuatKey& rhs ) const {
  22.138 +        return rhs.mValue == this->mValue;
  22.139 +    }
  22.140 +    bool operator != (const aiQuatKey& rhs ) const {
  22.141 +        return rhs.mValue != this->mValue;
  22.142 +    }
  22.143 +
  22.144 +    // Relational operators. For use with std::sort();
  22.145 +    bool operator < (const aiQuatKey& rhs ) const {
  22.146 +        return mTime < rhs.mTime;
  22.147 +    }
  22.148 +    bool operator > (const aiQuatKey& rhs ) const {
  22.149 +        return mTime > rhs.mTime;
  22.150 +    }
  22.151 +#endif
  22.152 +};
  22.153 +
  22.154 +// ---------------------------------------------------------------------------
  22.155 +/** Binds a anim-mesh to a specific point in time. */
  22.156 +struct aiMeshKey
  22.157 +{
  22.158 +    /** The time of this key */
  22.159 +    double mTime;
  22.160 +
  22.161 +    /** Index into the aiMesh::mAnimMeshes array of the
  22.162 +     *  mesh corresponding to the #aiMeshAnim hosting this
  22.163 +     *  key frame. The referenced anim mesh is evaluated
  22.164 +     *  according to the rules defined in the docs for #aiAnimMesh.*/
  22.165 +    unsigned int mValue;
  22.166 +
  22.167 +#ifdef __cplusplus
  22.168 +
  22.169 +    aiMeshKey() AI_NO_EXCEPT
  22.170 +    : mTime(0.0)
  22.171 +    , mValue(0)
  22.172 +    {
  22.173 +    }
  22.174 +
  22.175 +    /** Construction from a given time and key value */
  22.176 +    aiMeshKey(double time, const unsigned int value)
  22.177 +        :   mTime   (time)
  22.178 +        ,   mValue  (value)
  22.179 +    {}
  22.180 +
  22.181 +    typedef unsigned int elem_type;
  22.182 +
  22.183 +    // Comparison operators. For use with std::find();
  22.184 +    bool operator == (const aiMeshKey& o) const {
  22.185 +        return o.mValue == this->mValue;
  22.186 +    }
  22.187 +    bool operator != (const aiMeshKey& o) const {
  22.188 +        return o.mValue != this->mValue;
  22.189 +    }
  22.190 +
  22.191 +    // Relational operators. For use with std::sort();
  22.192 +    bool operator < (const aiMeshKey& o) const {
  22.193 +        return mTime < o.mTime;
  22.194 +    }
  22.195 +    bool operator > (const aiMeshKey& o) const {
  22.196 +        return mTime > o.mTime;
  22.197 +    }
  22.198 +
  22.199 +#endif
  22.200 +};
  22.201 +
  22.202 +// ---------------------------------------------------------------------------
  22.203 +/** Binds a morph anim mesh to a specific point in time. */
  22.204 +struct aiMeshMorphKey
  22.205 +{
  22.206 +    /** The time of this key */
  22.207 +    double mTime;
  22.208 +
  22.209 +    /** The values and weights at the time of this key */
  22.210 +    unsigned int *mValues;
  22.211 +    double *mWeights;
  22.212 +
  22.213 +    /** The number of values and weights */
  22.214 +    unsigned int mNumValuesAndWeights;
  22.215 +#ifdef __cplusplus
  22.216 +	aiMeshMorphKey() AI_NO_EXCEPT
  22.217 +		: mTime(0.0)
  22.218 +		, mValues(0)
  22.219 +		, mWeights(0)
  22.220 +		, mNumValuesAndWeights(0)
  22.221 +	{
  22.222 +
  22.223 +	}
  22.224 +
  22.225 +    ~aiMeshMorphKey()
  22.226 +    {
  22.227 +        if (mNumValuesAndWeights && mValues && mWeights) {
  22.228 +            delete [] mValues;
  22.229 +            delete [] mWeights;
  22.230 +        }
  22.231 +    }
  22.232 +#endif
  22.233 +};
  22.234 +
  22.235 +// ---------------------------------------------------------------------------
  22.236 +/** Defines how an animation channel behaves outside the defined time
  22.237 + *  range. This corresponds to aiNodeAnim::mPreState and
  22.238 + *  aiNodeAnim::mPostState.*/
  22.239 +enum aiAnimBehaviour
  22.240 +{
  22.241 +    /** The value from the default node transformation is taken*/
  22.242 +    aiAnimBehaviour_DEFAULT  = 0x0,
  22.243 +
  22.244 +    /** The nearest key value is used without interpolation */
  22.245 +    aiAnimBehaviour_CONSTANT = 0x1,
  22.246 +
  22.247 +    /** The value of the nearest two keys is linearly
  22.248 +     *  extrapolated for the current time value.*/
  22.249 +    aiAnimBehaviour_LINEAR   = 0x2,
  22.250 +
  22.251 +    /** The animation is repeated.
  22.252 +     *
  22.253 +     *  If the animation key go from n to m and the current
  22.254 +     *  time is t, use the value at (t-n) % (|m-n|).*/
  22.255 +    aiAnimBehaviour_REPEAT   = 0x3,
  22.256 +
  22.257 +    /** This value is not used, it is just here to force the
  22.258 +     *  the compiler to map this enum to a 32 Bit integer  */
  22.259 +#ifndef SWIG
  22.260 +    _aiAnimBehaviour_Force32Bit = INT_MAX
  22.261 +#endif
  22.262 +};
  22.263 +
  22.264 +// ---------------------------------------------------------------------------
  22.265 +/** Describes the animation of a single node. The name specifies the
  22.266 + *  bone/node which is affected by this animation channel. The keyframes
  22.267 + *  are given in three separate series of values, one each for position,
  22.268 + *  rotation and scaling. The transformation matrix computed from these
  22.269 + *  values replaces the node's original transformation matrix at a
  22.270 + *  specific time.
  22.271 + *  This means all keys are absolute and not relative to the bone default pose.
  22.272 + *  The order in which the transformations are applied is
  22.273 + *  - as usual - scaling, rotation, translation.
  22.274 + *
  22.275 + *  @note All keys are returned in their correct, chronological order.
  22.276 + *  Duplicate keys don't pass the validation step. Most likely there
  22.277 + *  will be no negative time values, but they are not forbidden also ( so
  22.278 + *  implementations need to cope with them! ) */
  22.279 +struct aiNodeAnim {
  22.280 +    /** The name of the node affected by this animation. The node
  22.281 +     *  must exist and it must be unique.*/
  22.282 +    C_STRUCT aiString mNodeName;
  22.283 +
  22.284 +    /** The number of position keys */
  22.285 +    unsigned int mNumPositionKeys;
  22.286 +
  22.287 +    /** The position keys of this animation channel. Positions are
  22.288 +     * specified as 3D vector. The array is mNumPositionKeys in size.
  22.289 +     *
  22.290 +     * If there are position keys, there will also be at least one
  22.291 +     * scaling and one rotation key.*/
  22.292 +    C_STRUCT aiVectorKey* mPositionKeys;
  22.293 +
  22.294 +    /** The number of rotation keys */
  22.295 +    unsigned int mNumRotationKeys;
  22.296 +
  22.297 +    /** The rotation keys of this animation channel. Rotations are
  22.298 +     *  given as quaternions,  which are 4D vectors. The array is
  22.299 +     *  mNumRotationKeys in size.
  22.300 +     *
  22.301 +     * If there are rotation keys, there will also be at least one
  22.302 +     * scaling and one position key. */
  22.303 +    C_STRUCT aiQuatKey* mRotationKeys;
  22.304 +
  22.305 +    /** The number of scaling keys */
  22.306 +    unsigned int mNumScalingKeys;
  22.307 +
  22.308 +    /** The scaling keys of this animation channel. Scalings are
  22.309 +     *  specified as 3D vector. The array is mNumScalingKeys in size.
  22.310 +     *
  22.311 +     * If there are scaling keys, there will also be at least one
  22.312 +     * position and one rotation key.*/
  22.313 +    C_STRUCT aiVectorKey* mScalingKeys;
  22.314 +
  22.315 +    /** Defines how the animation behaves before the first
  22.316 +     *  key is encountered.
  22.317 +     *
  22.318 +     *  The default value is aiAnimBehaviour_DEFAULT (the original
  22.319 +     *  transformation matrix of the affected node is used).*/
  22.320 +    C_ENUM aiAnimBehaviour mPreState;
  22.321 +
  22.322 +    /** Defines how the animation behaves after the last
  22.323 +     *  key was processed.
  22.324 +     *
  22.325 +     *  The default value is aiAnimBehaviour_DEFAULT (the original
  22.326 +     *  transformation matrix of the affected node is taken).*/
  22.327 +    C_ENUM aiAnimBehaviour mPostState;
  22.328 +
  22.329 +#ifdef __cplusplus
  22.330 +    aiNodeAnim() AI_NO_EXCEPT
  22.331 +    : mNumPositionKeys( 0 )
  22.332 +    , mPositionKeys( 0 )
  22.333 +    , mNumRotationKeys( 0 )
  22.334 +    , mRotationKeys( 0 )
  22.335 +    , mNumScalingKeys( 0 )
  22.336 +    , mScalingKeys( 0 )
  22.337 +    , mPreState( aiAnimBehaviour_DEFAULT )
  22.338 +    , mPostState( aiAnimBehaviour_DEFAULT ) {
  22.339 +         // empty
  22.340 +    }
  22.341 +
  22.342 +    ~aiNodeAnim() {
  22.343 +        delete [] mPositionKeys;
  22.344 +        delete [] mRotationKeys;
  22.345 +        delete [] mScalingKeys;
  22.346 +    }
  22.347 +#endif // __cplusplus
  22.348 +};
  22.349 +
  22.350 +// ---------------------------------------------------------------------------
  22.351 +/** Describes vertex-based animations for a single mesh or a group of
  22.352 + *  meshes. Meshes carry the animation data for each frame in their
  22.353 + *  aiMesh::mAnimMeshes array. The purpose of aiMeshAnim is to
  22.354 + *  define keyframes linking each mesh attachment to a particular
  22.355 + *  point in time. */
  22.356 +struct aiMeshAnim
  22.357 +{
  22.358 +    /** Name of the mesh to be animated. An empty string is not allowed,
  22.359 +     *  animated meshes need to be named (not necessarily uniquely,
  22.360 +     *  the name can basically serve as wild-card to select a group
  22.361 +     *  of meshes with similar animation setup)*/
  22.362 +    C_STRUCT aiString mName;
  22.363 +
  22.364 +    /** Size of the #mKeys array. Must be 1, at least. */
  22.365 +    unsigned int mNumKeys;
  22.366 +
  22.367 +    /** Key frames of the animation. May not be NULL. */
  22.368 +    C_STRUCT aiMeshKey* mKeys;
  22.369 +
  22.370 +#ifdef __cplusplus
  22.371 +
  22.372 +    aiMeshAnim() AI_NO_EXCEPT
  22.373 +        : mNumKeys()
  22.374 +        , mKeys()
  22.375 +    {}
  22.376 +
  22.377 +    ~aiMeshAnim()
  22.378 +    {
  22.379 +        delete[] mKeys;
  22.380 +    }
  22.381 +
  22.382 +#endif
  22.383 +};
  22.384 +
  22.385 +// ---------------------------------------------------------------------------
  22.386 +/** Describes a morphing animation of a given mesh. */
  22.387 +struct aiMeshMorphAnim
  22.388 +{
  22.389 +    /** Name of the mesh to be animated. An empty string is not allowed,
  22.390 +     *  animated meshes need to be named (not necessarily uniquely,
  22.391 +     *  the name can basically serve as wildcard to select a group
  22.392 +     *  of meshes with similar animation setup)*/
  22.393 +    C_STRUCT aiString mName;
  22.394 +
  22.395 +    /** Size of the #mKeys array. Must be 1, at least. */
  22.396 +    unsigned int mNumKeys;
  22.397 +
  22.398 +    /** Key frames of the animation. May not be NULL. */
  22.399 +    C_STRUCT aiMeshMorphKey* mKeys;
  22.400 +
  22.401 +#ifdef __cplusplus
  22.402 +
  22.403 +    aiMeshMorphAnim() AI_NO_EXCEPT
  22.404 +        : mNumKeys()
  22.405 +        , mKeys()
  22.406 +    {}
  22.407 +
  22.408 +    ~aiMeshMorphAnim()
  22.409 +    {
  22.410 +        delete[] mKeys;
  22.411 +    }
  22.412 +
  22.413 +#endif
  22.414 +};
  22.415 +
  22.416 +// ---------------------------------------------------------------------------
  22.417 +/** An animation consists of key-frame data for a number of nodes. For
  22.418 + *  each node affected by the animation a separate series of data is given.*/
  22.419 +struct aiAnimation {
  22.420 +    /** The name of the animation. If the modeling package this data was
  22.421 +     *  exported from does support only a single animation channel, this
  22.422 +     *  name is usually empty (length is zero). */
  22.423 +    C_STRUCT aiString mName;
  22.424 +
  22.425 +    /** Duration of the animation in ticks.  */
  22.426 +    double mDuration;
  22.427 +
  22.428 +    /** Ticks per second. 0 if not specified in the imported file */
  22.429 +    double mTicksPerSecond;
  22.430 +
  22.431 +    /** The number of bone animation channels. Each channel affects
  22.432 +     *  a single node. */
  22.433 +    unsigned int mNumChannels;
  22.434 +
  22.435 +    /** The node animation channels. Each channel affects a single node.
  22.436 +     *  The array is mNumChannels in size. */
  22.437 +    C_STRUCT aiNodeAnim** mChannels;
  22.438 +
  22.439 +
  22.440 +    /** The number of mesh animation channels. Each channel affects
  22.441 +     *  a single mesh and defines vertex-based animation. */
  22.442 +    unsigned int mNumMeshChannels;
  22.443 +
  22.444 +    /** The mesh animation channels. Each channel affects a single mesh.
  22.445 +     *  The array is mNumMeshChannels in size. */
  22.446 +    C_STRUCT aiMeshAnim** mMeshChannels;
  22.447 +
  22.448 +    /** The number of mesh animation channels. Each channel affects
  22.449 +     *  a single mesh and defines morphing animation. */
  22.450 +    unsigned int mNumMorphMeshChannels;
  22.451 +
  22.452 +    /** The morph mesh animation channels. Each channel affects a single mesh.
  22.453 +     *  The array is mNumMorphMeshChannels in size. */
  22.454 +    C_STRUCT aiMeshMorphAnim **mMorphMeshChannels;
  22.455 +
  22.456 +#ifdef __cplusplus
  22.457 +    aiAnimation() AI_NO_EXCEPT
  22.458 +    : mDuration(-1.)
  22.459 +    , mTicksPerSecond(0.)
  22.460 +    , mNumChannels(0)
  22.461 +    , mChannels(0)
  22.462 +    , mNumMeshChannels(0)
  22.463 +    , mMeshChannels(0)
  22.464 +    , mNumMorphMeshChannels(0)
  22.465 +    , mMorphMeshChannels(0) {
  22.466 +        // empty
  22.467 +    }
  22.468 +
  22.469 +    ~aiAnimation() {
  22.470 +        // DO NOT REMOVE THIS ADDITIONAL CHECK
  22.471 +        if ( mNumChannels && mChannels )  {
  22.472 +            for( unsigned int a = 0; a < mNumChannels; a++) {
  22.473 +                delete mChannels[ a ];
  22.474 +            }
  22.475 +
  22.476 +            delete [] mChannels;
  22.477 +        }
  22.478 +        if (mNumMeshChannels && mMeshChannels)  {
  22.479 +            for( unsigned int a = 0; a < mNumMeshChannels; a++) {
  22.480 +                delete mMeshChannels[a];
  22.481 +            }
  22.482 +
  22.483 +            delete [] mMeshChannels;
  22.484 +        }
  22.485 +        if (mNumMorphMeshChannels && mMorphMeshChannels) {
  22.486 +                for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) {
  22.487 +                        delete mMorphMeshChannels[a];
  22.488 +                }
  22.489 +            
  22.490 +            delete [] mMorphMeshChannels;
  22.491 +        }
  22.492 +    }
  22.493 +#endif // __cplusplus
  22.494 +};
  22.495 +
  22.496 +#ifdef __cplusplus
  22.497 +
  22.498 +}
  22.499 +
  22.500 +/// @brief  Some C++ utilities for inter- and extrapolation
  22.501 +namespace Assimp {
  22.502 +
  22.503 +// ---------------------------------------------------------------------------
  22.504 +/** 
  22.505 +  * @brief CPP-API: Utility class to simplify interpolations of various data types.
  22.506 +  *
  22.507 +  *  The type of interpolation is chosen automatically depending on the
  22.508 +  *  types of the arguments. 
  22.509 +  */
  22.510 +template <typename T>
  22.511 +struct Interpolator
  22.512 +{
  22.513 +    // ------------------------------------------------------------------
  22.514 +    /** @brief Get the result of the interpolation between a,b.
  22.515 +     *
  22.516 +     *  The interpolation algorithm depends on the type of the operands.
  22.517 +     *  aiQuaternion's and aiQuatKey's SLERP, the rest does a simple
  22.518 +     *  linear interpolation. */
  22.519 +    void operator () (T& out,const T& a, const T& b, ai_real d) const {
  22.520 +        out = a + (b-a)*d;
  22.521 +    }
  22.522 +}; // ! Interpolator <T>
  22.523 +
  22.524 +//! @cond Never
  22.525 +
  22.526 +template <>
  22.527 +struct Interpolator <aiQuaternion>  {
  22.528 +    void operator () (aiQuaternion& out,const aiQuaternion& a,
  22.529 +        const aiQuaternion& b, ai_real d) const
  22.530 +    {
  22.531 +        aiQuaternion::Interpolate(out,a,b,d);
  22.532 +    }
  22.533 +}; // ! Interpolator <aiQuaternion>
  22.534 +
  22.535 +template <>
  22.536 +struct Interpolator <unsigned int>  {
  22.537 +    void operator () (unsigned int& out,unsigned int a,
  22.538 +        unsigned int b, ai_real d) const
  22.539 +    {
  22.540 +        out = d>0.5f ? b : a;
  22.541 +    }
  22.542 +}; // ! Interpolator <aiQuaternion>
  22.543 +
  22.544 +template <>
  22.545 +struct Interpolator<aiVectorKey>  {
  22.546 +    void operator () (aiVector3D& out,const aiVectorKey& a,
  22.547 +        const aiVectorKey& b, ai_real d) const
  22.548 +    {
  22.549 +        Interpolator<aiVector3D> ipl;
  22.550 +        ipl(out,a.mValue,b.mValue,d);
  22.551 +    }
  22.552 +}; // ! Interpolator <aiVectorKey>
  22.553 +
  22.554 +template <>
  22.555 +struct Interpolator<aiQuatKey>  {
  22.556 +    void operator () (aiQuaternion& out, const aiQuatKey& a,
  22.557 +        const aiQuatKey& b, ai_real d) const
  22.558 +    {
  22.559 +        Interpolator<aiQuaternion> ipl;
  22.560 +        ipl(out,a.mValue,b.mValue,d);
  22.561 +    }
  22.562 +}; // ! Interpolator <aiQuatKey>
  22.563 +
  22.564 +template <>
  22.565 +struct Interpolator<aiMeshKey>     {
  22.566 +    void operator () (unsigned int& out, const aiMeshKey& a,
  22.567 +        const aiMeshKey& b, ai_real d) const
  22.568 +    {
  22.569 +        Interpolator<unsigned int> ipl;
  22.570 +        ipl(out,a.mValue,b.mValue,d);
  22.571 +    }
  22.572 +}; // ! Interpolator <aiQuatKey>
  22.573 +
  22.574 +//! @endcond
  22.575 +
  22.576 +} //  ! end namespace Assimp
  22.577 +
  22.578 +#endif // __cplusplus
  22.579 +
  22.580 +#endif // AI_ANIM_H_INC
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/include/miniassimp/camera.h	Mon Jan 28 18:19:26 2019 +0200
    23.3 @@ -0,0 +1,226 @@
    23.4 +/*
    23.5 +---------------------------------------------------------------------------
    23.6 +Open Asset Import Library (assimp)
    23.7 +---------------------------------------------------------------------------
    23.8 +
    23.9 +Copyright (c) 2006-2018, assimp team
   23.10 +
   23.11 +
   23.12 +
   23.13 +All rights reserved.
   23.14 +
   23.15 +Redistribution and use of this software in source and binary forms,
   23.16 +with or without modification, are permitted provided that the following
   23.17 +conditions are met:
   23.18 +
   23.19 +* Redistributions of source code must retain the above
   23.20 +  copyright notice, this list of conditions and the
   23.21 +  following disclaimer.
   23.22 +
   23.23 +* Redistributions in binary form must reproduce the above
   23.24 +  copyright notice, this list of conditions and the
   23.25 +  following disclaimer in the documentation and/or other
   23.26 +  materials provided with the distribution.
   23.27 +
   23.28 +* Neither the name of the assimp team, nor the names of its
   23.29 +  contributors may be used to endorse or promote products
   23.30 +  derived from this software without specific prior
   23.31 +  written permission of the assimp team.
   23.32 +
   23.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   23.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   23.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   23.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   23.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   23.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   23.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   23.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   23.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   23.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   23.44 +---------------------------------------------------------------------------
   23.45 +*/
   23.46 +
   23.47 +/** @file camera.h
   23.48 + *  @brief Defines the aiCamera data structure
   23.49 + */
   23.50 +
   23.51 +#pragma once
   23.52 +#ifndef AI_CAMERA_H_INC
   23.53 +#define AI_CAMERA_H_INC
   23.54 +
   23.55 +#include "types.h"
   23.56 +
   23.57 +#ifdef __cplusplus
   23.58 +extern "C" {
   23.59 +#endif
   23.60 +
   23.61 +// ---------------------------------------------------------------------------
   23.62 +/** Helper structure to describe a virtual camera.
   23.63 + *
   23.64 + * Cameras have a representation in the node graph and can be animated.
   23.65 + * An important aspect is that the camera itself is also part of the
   23.66 + * scenegraph. This means, any values such as the look-at vector are not
   23.67 + * *absolute*, they're <b>relative</b> to the coordinate system defined
   23.68 + * by the node which corresponds to the camera. This allows for camera
   23.69 + * animations. For static cameras parameters like the 'look-at' or 'up' vectors
   23.70 + * are usually specified directly in aiCamera, but beware, they could also
   23.71 + * be encoded in the node transformation. The following (pseudo)code sample
   23.72 + * shows how to do it: <br><br>
   23.73 + * @code
   23.74 + * // Get the camera matrix for a camera at a specific time
   23.75 + * // if the node hierarchy for the camera does not contain
   23.76 + * // at least one animated node this is a static computation
   23.77 + * get-camera-matrix (node sceneRoot, camera cam) : matrix
   23.78 + * {
   23.79 + *    node   cnd = find-node-for-camera(cam)
   23.80 + *    matrix cmt = identity()
   23.81 + *
   23.82 + *    // as usual - get the absolute camera transformation for this frame
   23.83 + *    for each node nd in hierarchy from sceneRoot to cnd
   23.84 + *      matrix cur
   23.85 + *      if (is-animated(nd))
   23.86 + *         cur = eval-animation(nd)
   23.87 + *      else cur = nd->mTransformation;
   23.88 + *      cmt = mult-matrices( cmt, cur )
   23.89 + *    end for
   23.90 + *
   23.91 + *    // now multiply with the camera's own local transform
   23.92 + *    cam = mult-matrices (cam, get-camera-matrix(cmt) )
   23.93 + * }
   23.94 + * @endcode
   23.95 + *
   23.96 + * @note some file formats (such as 3DS, ASE) export a "target point" -
   23.97 + * the point the camera is looking at (it can even be animated). Assimp
   23.98 + * writes the target point as a subnode of the camera's main node,
   23.99 + * called "<camName>.Target". However this is just additional information
  23.100 + * then the transformation tracks of the camera main node make the
  23.101 + * camera already look in the right direction.
  23.102 + *
  23.103 +*/
  23.104 +struct aiCamera
  23.105 +{
  23.106 +    /** The name of the camera.
  23.107 +     *
  23.108 +     *  There must be a node in the scenegraph with the same name.
  23.109 +     *  This node specifies the position of the camera in the scene
  23.110 +     *  hierarchy and can be animated.
  23.111 +     */
  23.112 +    C_STRUCT aiString mName;
  23.113 +
  23.114 +    /** Position of the camera relative to the coordinate space
  23.115 +     *  defined by the corresponding node.
  23.116 +     *
  23.117 +     *  The default value is 0|0|0.
  23.118 +     */
  23.119 +    C_STRUCT aiVector3D mPosition;
  23.120 +
  23.121 +
  23.122 +    /** 'Up' - vector of the camera coordinate system relative to
  23.123 +     *  the coordinate space defined by the corresponding node.
  23.124 +     *
  23.125 +     *  The 'right' vector of the camera coordinate system is
  23.126 +     *  the cross product of  the up and lookAt vectors.
  23.127 +     *  The default value is 0|1|0. The vector
  23.128 +     *  may be normalized, but it needn't.
  23.129 +     */
  23.130 +    C_STRUCT aiVector3D mUp;
  23.131 +
  23.132 +
  23.133 +    /** 'LookAt' - vector of the camera coordinate system relative to
  23.134 +     *  the coordinate space defined by the corresponding node.
  23.135 +     *
  23.136 +     *  This is the viewing direction of the user.
  23.137 +     *  The default value is 0|0|1. The vector
  23.138 +     *  may be normalized, but it needn't.
  23.139 +     */
  23.140 +    C_STRUCT aiVector3D mLookAt;
  23.141 +
  23.142 +
  23.143 +    /** Half horizontal field of view angle, in radians.
  23.144 +     *
  23.145 +     *  The field of view angle is the angle between the center
  23.146 +     *  line of the screen and the left or right border.
  23.147 +     *  The default value is 1/4PI.
  23.148 +     */
  23.149 +    float mHorizontalFOV;
  23.150 +
  23.151 +    /** Distance of the near clipping plane from the camera.
  23.152 +     *
  23.153 +     * The value may not be 0.f (for arithmetic reasons to prevent
  23.154 +     * a division through zero). The default value is 0.1f.
  23.155 +     */
  23.156 +    float mClipPlaneNear;
  23.157 +
  23.158 +    /** Distance of the far clipping plane from the camera.
  23.159 +     *
  23.160 +     * The far clipping plane must, of course, be further away than the
  23.161 +     * near clipping plane. The default value is 1000.f. The ratio
  23.162 +     * between the near and the far plane should not be too
  23.163 +     * large (between 1000-10000 should be ok) to avoid floating-point
  23.164 +     * inaccuracies which could lead to z-fighting.
  23.165 +     */
  23.166 +    float mClipPlaneFar;
  23.167 +
  23.168 +
  23.169 +    /** Screen aspect ratio.
  23.170 +     *
  23.171 +     * This is the ration between the width and the height of the
  23.172 +     * screen. Typical values are 4/3, 1/2 or 1/1. This value is
  23.173 +     * 0 if the aspect ratio is not defined in the source file.
  23.174 +     * 0 is also the default value.
  23.175 +     */
  23.176 +    float mAspect;
  23.177 +
  23.178 +#ifdef __cplusplus
  23.179 +
  23.180 +    aiCamera() AI_NO_EXCEPT
  23.181 +        : mUp               (0.f,1.f,0.f)
  23.182 +        , mLookAt           (0.f,0.f,1.f)
  23.183 +        , mHorizontalFOV    (0.25f * (float)AI_MATH_PI)
  23.184 +        , mClipPlaneNear    (0.1f)
  23.185 +        , mClipPlaneFar     (1000.f)
  23.186 +        , mAspect           (0.f)
  23.187 +    {}
  23.188 +
  23.189 +    /** @brief Get a *right-handed* camera matrix from me
  23.190 +     *  @param out Camera matrix to be filled
  23.191 +     */
  23.192 +    void GetCameraMatrix (aiMatrix4x4& out) const
  23.193 +    {
  23.194 +        /** todo: test ... should work, but i'm not absolutely sure */
  23.195 +
  23.196 +        /** We don't know whether these vectors are already normalized ...*/
  23.197 +        aiVector3D zaxis = mLookAt;     zaxis.Normalize();
  23.198 +        aiVector3D yaxis = mUp;         yaxis.Normalize();
  23.199 +        aiVector3D xaxis = mUp^mLookAt; xaxis.Normalize();
  23.200 +
  23.201 +        out.a4 = -(xaxis * mPosition);
  23.202 +        out.b4 = -(yaxis * mPosition);
  23.203 +        out.c4 = -(zaxis * mPosition);
  23.204 +
  23.205 +        out.a1 = xaxis.x;
  23.206 +        out.a2 = xaxis.y;
  23.207 +        out.a3 = xaxis.z;
  23.208 +
  23.209 +        out.b1 = yaxis.x;
  23.210 +        out.b2 = yaxis.y;
  23.211 +        out.b3 = yaxis.z;
  23.212 +
  23.213 +        out.c1 = zaxis.x;
  23.214 +        out.c2 = zaxis.y;
  23.215 +        out.c3 = zaxis.z;
  23.216 +
  23.217 +        out.d1 = out.d2 = out.d3 = 0.f;
  23.218 +        out.d4 = 1.f;
  23.219 +    }
  23.220 +
  23.221 +#endif
  23.222 +};
  23.223 +
  23.224 +
  23.225 +#ifdef __cplusplus
  23.226 +}
  23.227 +#endif
  23.228 +
  23.229 +#endif // AI_CAMERA_H_INC
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/include/miniassimp/cfileio.h	Mon Jan 28 18:19:26 2019 +0200
    24.3 @@ -0,0 +1,138 @@
    24.4 +/*
    24.5 +---------------------------------------------------------------------------
    24.6 +Open Asset Import Library (assimp)
    24.7 +---------------------------------------------------------------------------
    24.8 +
    24.9 +Copyright (c) 2006-2018, assimp team
   24.10 +
   24.11 +
   24.12 +
   24.13 +All rights reserved.
   24.14 +
   24.15 +Redistribution and use of this software in source and binary forms,
   24.16 +with or without modification, are permitted provided that the following
   24.17 +conditions are met:
   24.18 +
   24.19 +* Redistributions of source code must retain the above
   24.20 +  copyright notice, this list of conditions and the
   24.21 +  following disclaimer.
   24.22 +
   24.23 +* Redistributions in binary form must reproduce the above
   24.24 +  copyright notice, this list of conditions and the
   24.25 +  following disclaimer in the documentation and/or other
   24.26 +  materials provided with the distribution.
   24.27 +
   24.28 +* Neither the name of the assimp team, nor the names of its
   24.29 +  contributors may be used to endorse or promote products
   24.30 +  derived from this software without specific prior
   24.31 +  written permission of the assimp team.
   24.32 +
   24.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   24.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   24.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   24.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   24.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   24.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   24.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   24.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   24.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   24.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   24.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   24.44 +---------------------------------------------------------------------------
   24.45 +*/
   24.46 +
   24.47 +/** @file cfileio.h
   24.48 + *  @brief Defines generic C routines to access memory-mapped files
   24.49 + */
   24.50 +#pragma once
   24.51 +#ifndef AI_FILEIO_H_INC
   24.52 +#define AI_FILEIO_H_INC
   24.53 +
   24.54 +#include <miniassimp/types.h>
   24.55 +#ifdef __cplusplus
   24.56 +extern "C" {
   24.57 +#endif
   24.58 +struct aiFileIO;
   24.59 +struct aiFile;
   24.60 +
   24.61 +// aiFile callbacks
   24.62 +typedef size_t          (*aiFileWriteProc) (C_STRUCT aiFile*,   const char*, size_t, size_t);
   24.63 +typedef size_t          (*aiFileReadProc)  (C_STRUCT aiFile*,   char*, size_t,size_t);
   24.64 +typedef size_t          (*aiFileTellProc)  (C_STRUCT aiFile*);
   24.65 +typedef void            (*aiFileFlushProc) (C_STRUCT aiFile*);
   24.66 +typedef C_ENUM aiReturn (*aiFileSeek)      (C_STRUCT aiFile*, size_t, C_ENUM aiOrigin);
   24.67 +
   24.68 +// aiFileIO callbacks
   24.69 +typedef C_STRUCT aiFile* (*aiFileOpenProc)  (C_STRUCT aiFileIO*, const char*, const char*);
   24.70 +typedef void             (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*);
   24.71 +
   24.72 +// Represents user-defined data
   24.73 +typedef char* aiUserData;
   24.74 +
   24.75 +// ----------------------------------------------------------------------------------
   24.76 +/** @brief C-API: File system callbacks
   24.77 + *
   24.78 + *  Provided are functions to open and close files. Supply a custom structure to
   24.79 + *  the import function. If you don't, a default implementation is used. Use custom
   24.80 + *  file systems to enable reading from other sources, such as ZIPs
   24.81 + *  or memory locations. */
   24.82 +struct aiFileIO
   24.83 +{
   24.84 +    /** Function used to open a new file
   24.85 +     */
   24.86 +    aiFileOpenProc OpenProc;
   24.87 +
   24.88 +    /** Function used to close an existing file
   24.89 +     */
   24.90 +    aiFileCloseProc CloseProc;
   24.91 +
   24.92 +    /** User-defined, opaque data */
   24.93 +    aiUserData UserData;
   24.94 +};
   24.95 +
   24.96 +// ----------------------------------------------------------------------------------
   24.97 +/** @brief C-API: File callbacks
   24.98 + *
   24.99 + *  Actually, it's a data structure to wrap a set of fXXXX (e.g fopen)
  24.100 + *  replacement functions.
  24.101 + *
  24.102 + *  The default implementation of the functions utilizes the fXXX functions from
  24.103 + *  the CRT. However, you can supply a custom implementation to Assimp by
  24.104 + *  delivering a custom aiFileIO. Use this to enable reading from other sources,
  24.105 + *  such as ZIP archives or memory locations. */
  24.106 +struct aiFile
  24.107 +{
  24.108 +    /** Callback to read from a file */
  24.109 +    aiFileReadProc ReadProc;
  24.110 +
  24.111 +    /** Callback to write to a file */
  24.112 +    aiFileWriteProc WriteProc;
  24.113 +
  24.114 +    /** Callback to retrieve the current position of
  24.115 +     *  the file cursor (ftell())
  24.116 +     */
  24.117 +    aiFileTellProc TellProc;
  24.118 +
  24.119 +    /** Callback to retrieve the size of the file,
  24.120 +     *  in bytes
  24.121 +     */
  24.122 +    aiFileTellProc FileSizeProc;
  24.123 +
  24.124 +    /** Callback to set the current position
  24.125 +     * of the file cursor (fseek())
  24.126 +     */
  24.127 +    aiFileSeek SeekProc;
  24.128 +
  24.129 +    /** Callback to flush the file contents
  24.130 +     */
  24.131 +    aiFileFlushProc FlushProc;
  24.132 +
  24.133 +    /** User-defined, opaque data
  24.134 +     */
  24.135 +    aiUserData UserData;
  24.136 +};
  24.137 +
  24.138 +#ifdef __cplusplus
  24.139 +}
  24.140 +#endif
  24.141 +#endif // AI_FILEIO_H_INC
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/include/miniassimp/cimport.h	Mon Jan 28 18:19:26 2019 +0200
    25.3 @@ -0,0 +1,565 @@
    25.4 +/*
    25.5 +---------------------------------------------------------------------------
    25.6 +Open Asset Import Library (assimp)
    25.7 +---------------------------------------------------------------------------
    25.8 +
    25.9 +Copyright (c) 2006-2018, assimp team
   25.10 +
   25.11 +
   25.12 +
   25.13 +All rights reserved.
   25.14 +
   25.15 +Redistribution and use of this software in source and binary forms,
   25.16 +with or without modification, are permitted provided that the following
   25.17 +conditions are met:
   25.18 +
   25.19 +* Redistributions of source code must retain the above
   25.20 +  copyright notice, this list of conditions and the
   25.21 +  following disclaimer.
   25.22 +
   25.23 +* Redistributions in binary form must reproduce the above
   25.24 +  copyright notice, this list of conditions and the
   25.25 +  following disclaimer in the documentation and/or other
   25.26 +  materials provided with the distribution.
   25.27 +
   25.28 +* Neither the name of the assimp team, nor the names of its
   25.29 +  contributors may be used to endorse or promote products
   25.30 +  derived from this software without specific prior
   25.31 +  written permission of the assimp team.
   25.32 +
   25.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   25.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   25.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   25.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   25.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   25.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   25.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   25.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   25.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   25.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   25.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25.44 +---------------------------------------------------------------------------
   25.45 +*/
   25.46 +
   25.47 +/** @file  cimport.h
   25.48 + *  @brief Defines the C-API to the Open Asset Import Library.
   25.49 + */
   25.50 +#pragma once
   25.51 +#ifndef AI_ASSIMP_H_INC
   25.52 +#define AI_ASSIMP_H_INC
   25.53 +
   25.54 +#include <miniassimp/types.h>
   25.55 +#include "importerdesc.h"
   25.56 +
   25.57 +#ifdef __cplusplus
   25.58 +extern "C" {
   25.59 +#endif
   25.60 +
   25.61 +struct aiScene;  // aiScene.h
   25.62 +struct aiFileIO; // aiFileIO.h
   25.63 +typedef void (*aiLogStreamCallback)(const char* /* message */, char* /* user */);
   25.64 +
   25.65 +// --------------------------------------------------------------------------------
   25.66 +/** C-API: Represents a log stream. A log stream receives all log messages and
   25.67 + *  streams them _somewhere_.
   25.68 + *  @see aiGetPredefinedLogStream
   25.69 + *  @see aiAttachLogStream
   25.70 + *  @see aiDetachLogStream */
   25.71 +// --------------------------------------------------------------------------------
   25.72 +struct aiLogStream
   25.73 +{
   25.74 +    /** callback to be called */
   25.75 +    aiLogStreamCallback callback;
   25.76 +
   25.77 +    /** user data to be passed to the callback */
   25.78 +    char* user;
   25.79 +};
   25.80 +
   25.81 +
   25.82 +// --------------------------------------------------------------------------------
   25.83 +/** C-API: Represents an opaque set of settings to be used during importing.
   25.84 + *  @see aiCreatePropertyStore
   25.85 + *  @see aiReleasePropertyStore
   25.86 + *  @see aiImportFileExWithProperties
   25.87 + *  @see aiSetPropertyInteger
   25.88 + *  @see aiSetPropertyFloat
   25.89 + *  @see aiSetPropertyString
   25.90 + *  @see aiSetPropertyMatrix
   25.91 + */
   25.92 +// --------------------------------------------------------------------------------
   25.93 +struct aiPropertyStore { char sentinel; };
   25.94 +
   25.95 +/** Our own C boolean type */
   25.96 +typedef int aiBool;
   25.97 +
   25.98 +#define AI_FALSE 0
   25.99 +#define AI_TRUE 1
  25.100 +
  25.101 +// --------------------------------------------------------------------------------
  25.102 +/** Reads the given file and returns its content.
  25.103 + *
  25.104 + * If the call succeeds, the imported data is returned in an aiScene structure.
  25.105 + * The data is intended to be read-only, it stays property of the ASSIMP
  25.106 + * library and will be stable until aiReleaseImport() is called. After you're
  25.107 + * done with it, call aiReleaseImport() to free the resources associated with
  25.108 + * this file. If the import fails, NULL is returned instead. Call
  25.109 + * aiGetErrorString() to retrieve a human-readable error text.
  25.110 + * @param pFile Path and filename of the file to be imported,
  25.111 + *   expected to be a null-terminated c-string. NULL is not a valid value.
  25.112 + * @param pFlags Optional post processing steps to be executed after
  25.113 + *   a successful import. Provide a bitwise combination of the
  25.114 + *   #aiPostProcessSteps flags.
  25.115 + * @return Pointer to the imported data or NULL if the import failed.
  25.116 + */
  25.117 +ASSIMP_API const C_STRUCT aiScene* aiImportFile(
  25.118 +    const char* pFile,
  25.119 +    unsigned int pFlags);
  25.120 +
  25.121 +// --------------------------------------------------------------------------------
  25.122 +/** Reads the given file using user-defined I/O functions and returns
  25.123 + *   its content.
  25.124 + *
  25.125 + * If the call succeeds, the imported data is returned in an aiScene structure.
  25.126 + * The data is intended to be read-only, it stays property of the ASSIMP
  25.127 + * library and will be stable until aiReleaseImport() is called. After you're
  25.128 + * done with it, call aiReleaseImport() to free the resources associated with
  25.129 + * this file. If the import fails, NULL is returned instead. Call
  25.130 + * aiGetErrorString() to retrieve a human-readable error text.
  25.131 + * @param pFile Path and filename of the file to be imported,
  25.132 + *   expected to be a null-terminated c-string. NULL is not a valid value.
  25.133 + * @param pFlags Optional post processing steps to be executed after
  25.134 + *   a successful import. Provide a bitwise combination of the
  25.135 + *   #aiPostProcessSteps flags.
  25.136 + * @param pFS aiFileIO structure. Will be used to open the model file itself
  25.137 + *   and any other files the loader needs to open.  Pass NULL to use the default
  25.138 + *   implementation.
  25.139 + * @return Pointer to the imported data or NULL if the import failed.
  25.140 + * @note Include <aiFileIO.h> for the definition of #aiFileIO.
  25.141 + */
  25.142 +ASSIMP_API const C_STRUCT aiScene* aiImportFileEx(
  25.143 +    const char* pFile,
  25.144 +    unsigned int pFlags,
  25.145 +    C_STRUCT aiFileIO* pFS);
  25.146 +
  25.147 +// --------------------------------------------------------------------------------
  25.148 +/** Same as #aiImportFileEx, but adds an extra parameter containing importer settings.
  25.149 + *
  25.150 + * @param pFile Path and filename of the file to be imported,
  25.151 + *   expected to be a null-terminated c-string. NULL is not a valid value.
  25.152 + * @param pFlags Optional post processing steps to be executed after
  25.153 + *   a successful import. Provide a bitwise combination of the
  25.154 + *   #aiPostProcessSteps flags.
  25.155 + * @param pFS aiFileIO structure. Will be used to open the model file itself
  25.156 + *   and any other files the loader needs to open.  Pass NULL to use the default
  25.157 + *   implementation.
  25.158 + * @param pProps #aiPropertyStore instance containing import settings.
  25.159 + * @return Pointer to the imported data or NULL if the import failed.
  25.160 + * @note Include <aiFileIO.h> for the definition of #aiFileIO.
  25.161 + * @see aiImportFileEx
  25.162 + */
  25.163 +ASSIMP_API const C_STRUCT aiScene* aiImportFileExWithProperties(
  25.164 +    const char* pFile,
  25.165 +    unsigned int pFlags,
  25.166 +    C_STRUCT aiFileIO* pFS,
  25.167 +    const C_STRUCT aiPropertyStore* pProps);
  25.168 +
  25.169 +// --------------------------------------------------------------------------------
  25.170 +/** Reads the given file from a given memory buffer,
  25.171 + *
  25.172 + * If the call succeeds, the contents of the file are returned as a pointer to an
  25.173 + * aiScene object. The returned data is intended to be read-only, the importer keeps
  25.174 + * ownership of the data and will destroy it upon destruction. If the import fails,
  25.175 + * NULL is returned.
  25.176 + * A human-readable error description can be retrieved by calling aiGetErrorString().
  25.177 + * @param pBuffer Pointer to the file data
  25.178 + * @param pLength Length of pBuffer, in bytes
  25.179 + * @param pFlags Optional post processing steps to be executed after
  25.180 + *   a successful import. Provide a bitwise combination of the
  25.181 + *   #aiPostProcessSteps flags. If you wish to inspect the imported
  25.182 + *   scene first in order to fine-tune your post-processing setup,
  25.183 + *   consider to use #aiApplyPostProcessing().
  25.184 + * @param pHint An additional hint to the library. If this is a non empty string,
  25.185 + *   the library looks for a loader to support the file extension specified by pHint
  25.186 + *   and passes the file to the first matching loader. If this loader is unable to
  25.187 + *   completely the request, the library continues and tries to determine the file
  25.188 + *   format on its own, a task that may or may not be successful.
  25.189 + *   Check the return value, and you'll know ...
  25.190 + * @return A pointer to the imported data, NULL if the import failed.
  25.191 + *
  25.192 + * @note This is a straightforward way to decode models from memory
  25.193 + * buffers, but it doesn't handle model formats that spread their
  25.194 + * data across multiple files or even directories. Examples include
  25.195 + * OBJ or MD3, which outsource parts of their material info into
  25.196 + * external scripts. If you need full functionality, provide
  25.197 + * a custom IOSystem to make Assimp find these files and use
  25.198 + * the regular aiImportFileEx()/aiImportFileExWithProperties() API.
  25.199 + */
  25.200 +ASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemory(
  25.201 +    const char* pBuffer,
  25.202 +    unsigned int pLength,
  25.203 +    unsigned int pFlags,
  25.204 +    const char* pHint);
  25.205 +
  25.206 +// --------------------------------------------------------------------------------
  25.207 +/** Same as #aiImportFileFromMemory, but adds an extra parameter containing importer settings.
  25.208 + *
  25.209 + * @param pBuffer Pointer to the file data
  25.210 + * @param pLength Length of pBuffer, in bytes
  25.211 + * @param pFlags Optional post processing steps to be executed after
  25.212 + *   a successful import. Provide a bitwise combination of the
  25.213 + *   #aiPostProcessSteps flags. If you wish to inspect the imported
  25.214 + *   scene first in order to fine-tune your post-processing setup,
  25.215 + *   consider to use #aiApplyPostProcessing().
  25.216 + * @param pHint An additional hint to the library. If this is a non empty string,
  25.217 + *   the library looks for a loader to support the file extension specified by pHint
  25.218 + *   and passes the file to the first matching loader. If this loader is unable to
  25.219 + *   completely the request, the library continues and tries to determine the file
  25.220 + *   format on its own, a task that may or may not be successful.
  25.221 + *   Check the return value, and you'll know ...
  25.222 + * @param pProps #aiPropertyStore instance containing import settings.
  25.223 + * @return A pointer to the imported data, NULL if the import failed.
  25.224 + *
  25.225 + * @note This is a straightforward way to decode models from memory
  25.226 + * buffers, but it doesn't handle model formats that spread their
  25.227 + * data across multiple files or even directories. Examples include
  25.228 + * OBJ or MD3, which outsource parts of their material info into
  25.229 + * external scripts. If you need full functionality, provide
  25.230 + * a custom IOSystem to make Assimp find these files and use
  25.231 + * the regular aiImportFileEx()/aiImportFileExWithProperties() API.
  25.232 + * @see aiImportFileFromMemory
  25.233 + */
  25.234 +ASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemoryWithProperties(
  25.235 +    const char* pBuffer,
  25.236 +    unsigned int pLength,
  25.237 +    unsigned int pFlags,
  25.238 +    const char* pHint,
  25.239 +    const C_STRUCT aiPropertyStore* pProps);
  25.240 +
  25.241 +// --------------------------------------------------------------------------------
  25.242 +/** Apply post-processing to an already-imported scene.
  25.243 + *
  25.244 + * This is strictly equivalent to calling #aiImportFile()/#aiImportFileEx with the
  25.245 + * same flags. However, you can use this separate function to inspect the imported
  25.246 + * scene first to fine-tune your post-processing setup.
  25.247 + * @param pScene Scene to work on.
  25.248 + * @param pFlags Provide a bitwise combination of the #aiPostProcessSteps flags.
  25.249 + * @return A pointer to the post-processed data. Post processing is done in-place,
  25.250 + *   meaning this is still the same #aiScene which you passed for pScene. However,
  25.251 + *   _if_ post-processing failed, the scene could now be NULL. That's quite a rare
  25.252 + *   case, post processing steps are not really designed to 'fail'. To be exact,
  25.253 + *   the #aiProcess_ValidateDataStructure flag is currently the only post processing step
  25.254 + *   which can actually cause the scene to be reset to NULL.
  25.255 + */
  25.256 +ASSIMP_API const C_STRUCT aiScene* aiApplyPostProcessing(
  25.257 +    const C_STRUCT aiScene* pScene,
  25.258 +    unsigned int pFlags);
  25.259 +
  25.260 +// --------------------------------------------------------------------------------
  25.261 +/** Get one of the predefine log streams. This is the quick'n'easy solution to
  25.262 + *  access Assimp's log system. Attaching a log stream can slightly reduce Assimp's
  25.263 + *  overall import performance.
  25.264 + *
  25.265 + *  Usage is rather simple (this will stream the log to a file, named log.txt, and
  25.266 + *  the stdout stream of the process:
  25.267 + *  @code
  25.268 + *    struct aiLogStream c;
  25.269 + *    c = aiGetPredefinedLogStream(aiDefaultLogStream_FILE,"log.txt");
  25.270 + *    aiAttachLogStream(&c);
  25.271 + *    c = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);
  25.272 + *    aiAttachLogStream(&c);
  25.273 + *  @endcode
  25.274 + *
  25.275 + *  @param pStreams One of the #aiDefaultLogStream enumerated values.
  25.276 + *  @param file Solely for the #aiDefaultLogStream_FILE flag: specifies the file to write to.
  25.277 + *    Pass NULL for all other flags.
  25.278 + *  @return The log stream. callback is set to NULL if something went wrong.
  25.279 + */
  25.280 +ASSIMP_API C_STRUCT aiLogStream aiGetPredefinedLogStream(
  25.281 +    C_ENUM aiDefaultLogStream pStreams,
  25.282 +    const char* file);
  25.283 +
  25.284 +// --------------------------------------------------------------------------------
  25.285 +/** Attach a custom log stream to the libraries' logging system.
  25.286 + *
  25.287 + *  Attaching a log stream can slightly reduce Assimp's overall import
  25.288 + *  performance. Multiple log-streams can be attached.
  25.289 + *  @param stream Describes the new log stream.
  25.290 + *  @note To ensure proper destruction of the logging system, you need to manually
  25.291 + *    call aiDetachLogStream() on every single log stream you attach.
  25.292 + *    Alternatively (for the lazy folks) #aiDetachAllLogStreams is provided.
  25.293 + */
  25.294 +ASSIMP_API void aiAttachLogStream(
  25.295 +    const C_STRUCT aiLogStream* stream);
  25.296 +
  25.297 +// --------------------------------------------------------------------------------
  25.298 +/** Enable verbose logging. Verbose logging includes debug-related stuff and
  25.299 + *  detailed import statistics. This can have severe impact on import performance
  25.300 + *  and memory consumption. However, it might be useful to find out why a file
  25.301 + *  didn't read correctly.
  25.302 + *  @param d AI_TRUE or AI_FALSE, your decision.
  25.303 + */
  25.304 +ASSIMP_API void aiEnableVerboseLogging(aiBool d);
  25.305 +
  25.306 +// --------------------------------------------------------------------------------
  25.307 +/** Detach a custom log stream from the libraries' logging system.
  25.308 + *
  25.309 + *  This is the counterpart of #aiAttachLogStream. If you attached a stream,
  25.310 + *  don't forget to detach it again.
  25.311 + *  @param stream The log stream to be detached.
  25.312 + *  @return AI_SUCCESS if the log stream has been detached successfully.
  25.313 + *  @see aiDetachAllLogStreams
  25.314 + */
  25.315 +ASSIMP_API C_ENUM aiReturn aiDetachLogStream(
  25.316 +    const C_STRUCT aiLogStream* stream);
  25.317 +
  25.318 +// --------------------------------------------------------------------------------
  25.319 +/** Detach all active log streams from the libraries' logging system.
  25.320 + *  This ensures that the logging system is terminated properly and all
  25.321 + *  resources allocated by it are actually freed. If you attached a stream,
  25.322 + *  don't forget to detach it again.
  25.323 + *  @see aiAttachLogStream
  25.324 + *  @see aiDetachLogStream
  25.325 + */
  25.326 +ASSIMP_API void aiDetachAllLogStreams(void);
  25.327 +
  25.328 +// --------------------------------------------------------------------------------
  25.329 +/** Releases all resources associated with the given import process.
  25.330 + *
  25.331 + * Call this function after you're done with the imported data.
  25.332 + * @param pScene The imported data to release. NULL is a valid value.
  25.333 + */
  25.334 +ASSIMP_API void aiReleaseImport(
  25.335 +    const C_STRUCT aiScene* pScene);
  25.336 +
  25.337 +// --------------------------------------------------------------------------------
  25.338 +/** Returns the error text of the last failed import process.
  25.339 + *
  25.340 + * @return A textual description of the error that occurred at the last
  25.341 + * import process. NULL if there was no error. There can't be an error if you
  25.342 + * got a non-NULL #aiScene from #aiImportFile/#aiImportFileEx/#aiApplyPostProcessing.
  25.343 + */
  25.344 +ASSIMP_API const char* aiGetErrorString(void);
  25.345 +
  25.346 +// --------------------------------------------------------------------------------
  25.347 +/** Returns whether a given file extension is supported by ASSIMP
  25.348 + *
  25.349 + * @param szExtension Extension for which the function queries support for.
  25.350 + * Must include a leading dot '.'. Example: ".3ds", ".md3"
  25.351 + * @return AI_TRUE if the file extension is supported.
  25.352 + */
  25.353 +ASSIMP_API aiBool aiIsExtensionSupported(
  25.354 +    const char* szExtension);
  25.355 +
  25.356 +// --------------------------------------------------------------------------------
  25.357 +/** Get a list of all file extensions supported by ASSIMP.
  25.358 + *
  25.359 + * If a file extension is contained in the list this does, of course, not
  25.360 + * mean that ASSIMP is able to load all files with this extension.
  25.361 + * @param szOut String to receive the extension list.
  25.362 + * Format of the list: "*.3ds;*.obj;*.dae". NULL is not a valid parameter.
  25.363 + */
  25.364 +ASSIMP_API void aiGetExtensionList(
  25.365 +    C_STRUCT aiString* szOut);
  25.366 +
  25.367 +// --------------------------------------------------------------------------------
  25.368 +/** Get the approximated storage required by an imported asset
  25.369 + * @param pIn Input asset.
  25.370 + * @param in Data structure to be filled.
  25.371 + */
  25.372 +ASSIMP_API void aiGetMemoryRequirements(
  25.373 +    const C_STRUCT aiScene* pIn,
  25.374 +    C_STRUCT aiMemoryInfo* in);
  25.375 +
  25.376 +
  25.377 +
  25.378 +// --------------------------------------------------------------------------------
  25.379 +/** Create an empty property store. Property stores are used to collect import
  25.380 + *  settings.
  25.381 + * @return New property store. Property stores need to be manually destroyed using
  25.382 + *   the #aiReleasePropertyStore API function.
  25.383 + */
  25.384 +ASSIMP_API C_STRUCT aiPropertyStore* aiCreatePropertyStore(void);
  25.385 +
  25.386 +// --------------------------------------------------------------------------------
  25.387 +/** Delete a property store.
  25.388 + * @param p Property store to be deleted.
  25.389 + */
  25.390 +ASSIMP_API void aiReleasePropertyStore(C_STRUCT aiPropertyStore* p);
  25.391 +
  25.392 +// --------------------------------------------------------------------------------
  25.393 +/** Set an integer property.
  25.394 + *
  25.395 + *  This is the C-version of #Assimp::Importer::SetPropertyInteger(). In the C
  25.396 + *  interface, properties are always shared by all imports. It is not possible to
  25.397 + *  specify them per import.
  25.398 + *
  25.399 + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.
  25.400 + * @param szName Name of the configuration property to be set. All supported
  25.401 + *   public properties are defined in the config.h header file (AI_CONFIG_XXX).
  25.402 + * @param value New value for the property
  25.403 + */
  25.404 +ASSIMP_API void aiSetImportPropertyInteger(
  25.405 +    C_STRUCT aiPropertyStore* store,
  25.406 +    const char* szName,
  25.407 +    int value);
  25.408 +
  25.409 +// --------------------------------------------------------------------------------
  25.410 +/** Set a floating-point property.
  25.411 + *
  25.412 + *  This is the C-version of #Assimp::Importer::SetPropertyFloat(). In the C
  25.413 + *  interface, properties are always shared by all imports. It is not possible to
  25.414 + *  specify them per import.
  25.415 + *
  25.416 + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.
  25.417 + * @param szName Name of the configuration property to be set. All supported
  25.418 + *   public properties are defined in the config.h header file (AI_CONFIG_XXX).
  25.419 + * @param value New value for the property
  25.420 + */
  25.421 +ASSIMP_API void aiSetImportPropertyFloat(
  25.422 +    C_STRUCT aiPropertyStore* store,
  25.423 +    const char* szName,
  25.424 +    ai_real value);
  25.425 +
  25.426 +// --------------------------------------------------------------------------------
  25.427 +/** Set a string property.
  25.428 + *
  25.429 + *  This is the C-version of #Assimp::Importer::SetPropertyString(). In the C
  25.430 + *  interface, properties are always shared by all imports. It is not possible to
  25.431 + *  specify them per import.
  25.432 + *
  25.433 + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.
  25.434 + * @param szName Name of the configuration property to be set. All supported
  25.435 + *   public properties are defined in the config.h header file (AI_CONFIG_XXX).
  25.436 + * @param st New value for the property
  25.437 + */
  25.438 +ASSIMP_API void aiSetImportPropertyString(
  25.439 +    C_STRUCT aiPropertyStore* store,
  25.440 +    const char* szName,
  25.441 +    const C_STRUCT aiString* st);
  25.442 +
  25.443 +// --------------------------------------------------------------------------------
  25.444 +/** Set a matrix property.
  25.445 + *
  25.446 + *  This is the C-version of #Assimp::Importer::SetPropertyMatrix(). In the C
  25.447 + *  interface, properties are always shared by all imports. It is not possible to
  25.448 + *  specify them per import.
  25.449 + *
  25.450 + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.
  25.451 + * @param szName Name of the configuration property to be set. All supported
  25.452 + *   public properties are defined in the config.h header file (AI_CONFIG_XXX).
  25.453 + * @param mat New value for the property
  25.454 + */
  25.455 +ASSIMP_API void aiSetImportPropertyMatrix(
  25.456 +    C_STRUCT aiPropertyStore* store,
  25.457 +    const char* szName,
  25.458 +    const C_STRUCT aiMatrix4x4* mat);
  25.459 +
  25.460 +// --------------------------------------------------------------------------------
  25.461 +/** Construct a quaternion from a 3x3 rotation matrix.
  25.462 + *  @param quat Receives the output quaternion.
  25.463 + *  @param mat Matrix to 'quaternionize'.
  25.464 + *  @see aiQuaternion(const aiMatrix3x3& pRotMatrix)
  25.465 + */
  25.466 +ASSIMP_API void aiCreateQuaternionFromMatrix(
  25.467 +    C_STRUCT aiQuaternion* quat,
  25.468 +    const C_STRUCT aiMatrix3x3* mat);
  25.469 +
  25.470 +// --------------------------------------------------------------------------------
  25.471 +/** Decompose a transformation matrix into its rotational, translational and
  25.472 + *  scaling components.
  25.473 + *
  25.474 + * @param mat Matrix to decompose
  25.475 + * @param scaling Receives the scaling component
  25.476 + * @param rotation Receives the rotational component
  25.477 + * @param position Receives the translational component.
  25.478 + * @see aiMatrix4x4::Decompose (aiVector3D&, aiQuaternion&, aiVector3D&) const;
  25.479 + */
  25.480 +ASSIMP_API void aiDecomposeMatrix(
  25.481 +    const C_STRUCT aiMatrix4x4* mat,
  25.482 +    C_STRUCT aiVector3D* scaling,
  25.483 +    C_STRUCT aiQuaternion* rotation,
  25.484 +    C_STRUCT aiVector3D* position);
  25.485 +
  25.486 +// --------------------------------------------------------------------------------
  25.487 +/** Transpose a 4x4 matrix.
  25.488 + *  @param mat Pointer to the matrix to be transposed
  25.489 + */
  25.490 +ASSIMP_API void aiTransposeMatrix4(
  25.491 +    C_STRUCT aiMatrix4x4* mat);
  25.492 +
  25.493 +// --------------------------------------------------------------------------------
  25.494 +/** Transpose a 3x3 matrix.
  25.495 + *  @param mat Pointer to the matrix to be transposed
  25.496 + */
  25.497 +ASSIMP_API void aiTransposeMatrix3(
  25.498 +    C_STRUCT aiMatrix3x3* mat);
  25.499 +
  25.500 +// --------------------------------------------------------------------------------
  25.501 +/** Transform a vector by a 3x3 matrix
  25.502 + *  @param vec Vector to be transformed.
  25.503 + *  @param mat Matrix to transform the vector with.
  25.504 + */
  25.505 +ASSIMP_API void aiTransformVecByMatrix3(
  25.506 +    C_STRUCT aiVector3D* vec,
  25.507 +    const C_STRUCT aiMatrix3x3* mat);
  25.508 +
  25.509 +// --------------------------------------------------------------------------------
  25.510 +/** Transform a vector by a 4x4 matrix
  25.511 + *  @param vec Vector to be transformed.
  25.512 + *  @param mat Matrix to transform the vector with.
  25.513 + */
  25.514 +ASSIMP_API void aiTransformVecByMatrix4(
  25.515 +    C_STRUCT aiVector3D* vec,
  25.516 +    const C_STRUCT aiMatrix4x4* mat);
  25.517 +
  25.518 +// --------------------------------------------------------------------------------
  25.519 +/** Multiply two 4x4 matrices.
  25.520 + *  @param dst First factor, receives result.
  25.521 + *  @param src Matrix to be multiplied with 'dst'.
  25.522 + */
  25.523 +ASSIMP_API void aiMultiplyMatrix4(
  25.524 +    C_STRUCT aiMatrix4x4* dst,
  25.525 +    const C_STRUCT aiMatrix4x4* src);
  25.526 +
  25.527 +// --------------------------------------------------------------------------------
  25.528 +/** Multiply two 3x3 matrices.
  25.529 + *  @param dst First factor, receives result.
  25.530 + *  @param src Matrix to be multiplied with 'dst'.
  25.531 + */
  25.532 +ASSIMP_API void aiMultiplyMatrix3(
  25.533 +    C_STRUCT aiMatrix3x3* dst,
  25.534 +    const C_STRUCT aiMatrix3x3* src);
  25.535 +
  25.536 +// --------------------------------------------------------------------------------
  25.537 +/** Get a 3x3 identity matrix.
  25.538 + *  @param mat Matrix to receive its personal identity
  25.539 + */
  25.540 +ASSIMP_API void aiIdentityMatrix3(
  25.541 +    C_STRUCT aiMatrix3x3* mat);
  25.542 +
  25.543 +// --------------------------------------------------------------------------------
  25.544 +/** Get a 4x4 identity matrix.
  25.545 + *  @param mat Matrix to receive its personal identity
  25.546 + */
  25.547 +ASSIMP_API void aiIdentityMatrix4(
  25.548 +    C_STRUCT aiMatrix4x4* mat);
  25.549 +
  25.550 +// --------------------------------------------------------------------------------
  25.551 +/** Returns the number of import file formats available in the current Assimp build.
  25.552 + * Use aiGetImportFormatDescription() to retrieve infos of a specific import format.
  25.553 + */
  25.554 +ASSIMP_API size_t aiGetImportFormatCount(void);
  25.555 +
  25.556 +// --------------------------------------------------------------------------------
  25.557 +/** Returns a description of the nth import file format. Use #aiGetImportFormatCount()
  25.558 + * to learn how many import formats are supported.
  25.559 + * @param pIndex Index of the import format to retrieve information for. Valid range is
  25.560 + *    0 to #aiGetImportFormatCount()
  25.561 + * @return A description of that specific import format. NULL if pIndex is out of range.
  25.562 + */
  25.563 +ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImportFormatDescription( size_t pIndex);
  25.564 +#ifdef __cplusplus
  25.565 +}
  25.566 +#endif
  25.567 +
  25.568 +#endif // AI_ASSIMP_H_INC
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/include/miniassimp/color4.h	Mon Jan 28 18:19:26 2019 +0200
    26.3 @@ -0,0 +1,103 @@
    26.4 +/*
    26.5 +---------------------------------------------------------------------------
    26.6 +Open Asset Import Library (assimp)
    26.7 +---------------------------------------------------------------------------
    26.8 +
    26.9 +Copyright (c) 2006-2018, assimp team
   26.10 +
   26.11 +
   26.12 +
   26.13 +All rights reserved.
   26.14 +
   26.15 +Redistribution and use of this software in source and binary forms,
   26.16 +with or without modification, are permitted provided that the following
   26.17 +conditions are met:
   26.18 +
   26.19 +* Redistributions of source code must retain the above
   26.20 +  copyright notice, this list of conditions and the
   26.21 +  following disclaimer.
   26.22 +
   26.23 +* Redistributions in binary form must reproduce the above
   26.24 +  copyright notice, this list of conditions and the
   26.25 +  following disclaimer in the documentation and/or other
   26.26 +  materials provided with the distribution.
   26.27 +
   26.28 +* Neither the name of the assimp team, nor the names of its
   26.29 +  contributors may be used to endorse or promote products
   26.30 +  derived from this software without specific prior
   26.31 +  written permission of the assimp team.
   26.32 +
   26.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   26.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   26.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   26.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   26.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   26.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   26.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   26.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   26.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   26.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   26.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   26.44 +---------------------------------------------------------------------------
   26.45 +*/
   26.46 +/** @file color4.h
   26.47 + *  @brief RGBA color structure, including operators when compiling in C++
   26.48 + */
   26.49 +#pragma once
   26.50 +#ifndef AI_COLOR4D_H_INC
   26.51 +#define AI_COLOR4D_H_INC
   26.52 +
   26.53 +#include "defs.h"
   26.54 +
   26.55 +#ifdef __cplusplus
   26.56 +
   26.57 +// ----------------------------------------------------------------------------------
   26.58 +/** Represents a color in Red-Green-Blue space including an
   26.59 +*   alpha component. Color values range from 0 to 1. */
   26.60 +// ----------------------------------------------------------------------------------
   26.61 +template <typename TReal>
   26.62 +class aiColor4t
   26.63 +{
   26.64 +public:
   26.65 +    aiColor4t() AI_NO_EXCEPT : r(), g(), b(), a() {}
   26.66 +    aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a)
   26.67 +        : r(_r), g(_g), b(_b), a(_a) {}
   26.68 +    explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}
   26.69 +
   26.70 +public:
   26.71 +    // combined operators
   26.72 +    const aiColor4t& operator += (const aiColor4t& o);
   26.73 +    const aiColor4t& operator -= (const aiColor4t& o);
   26.74 +    const aiColor4t& operator *= (TReal f);
   26.75 +    const aiColor4t& operator /= (TReal f);
   26.76 +
   26.77 +public:
   26.78 +    // comparison
   26.79 +    bool operator == (const aiColor4t& other) const;
   26.80 +    bool operator != (const aiColor4t& other) const;
   26.81 +    bool operator <  (const aiColor4t& other) const;
   26.82 +
   26.83 +    // color tuple access, rgba order
   26.84 +    inline TReal operator[](unsigned int i) const;
   26.85 +    inline TReal& operator[](unsigned int i);
   26.86 +
   26.87 +    /** check whether a color is (close to) black */
   26.88 +    inline bool IsBlack() const;
   26.89 +
   26.90 +public:
   26.91 +
   26.92 +    // Red, green, blue and alpha color values
   26.93 +    TReal r, g, b, a;
   26.94 +};  // !struct aiColor4D
   26.95 +
   26.96 +typedef aiColor4t<ai_real> aiColor4D;
   26.97 +
   26.98 +#else
   26.99 +
  26.100 +struct aiColor4D {
  26.101 +    ai_real r, g, b, a;
  26.102 +};
  26.103 +
  26.104 +#endif // __cplusplus
  26.105 +
  26.106 +#endif // AI_COLOR4D_H_INC
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/include/miniassimp/color4.inl	Mon Jan 28 18:19:26 2019 +0200
    27.3 @@ -0,0 +1,205 @@
    27.4 +/*
    27.5 +---------------------------------------------------------------------------
    27.6 +Open Asset Import Library (assimp)
    27.7 +---------------------------------------------------------------------------
    27.8 +
    27.9 +Copyright (c) 2006-2018, assimp team
   27.10 +
   27.11 +
   27.12 +
   27.13 +All rights reserved.
   27.14 +
   27.15 +Redistribution and use of this software in source and binary forms,
   27.16 +with or without modification, are permitted provided that the following
   27.17 +conditions are met:
   27.18 +
   27.19 +* Redistributions of source code must retain the above
   27.20 +  copyright notice, this list of conditions and the
   27.21 +  following disclaimer.
   27.22 +
   27.23 +* Redistributions in binary form must reproduce the above
   27.24 +  copyright notice, this list of conditions and the
   27.25 +  following disclaimer in the documentation and/or other
   27.26 +  materials provided with the distribution.
   27.27 +
   27.28 +* Neither the name of the assimp team, nor the names of its
   27.29 +  contributors may be used to endorse or promote products
   27.30 +  derived from this software without specific prior
   27.31 +  written permission of the assimp team.
   27.32 +
   27.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   27.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   27.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   27.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   27.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   27.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   27.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   27.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   27.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   27.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   27.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   27.44 +---------------------------------------------------------------------------
   27.45 +*/
   27.46 +
   27.47 +/** @file  color4.inl
   27.48 + *  @brief Inline implementation of aiColor4t<TReal> operators
   27.49 + */
   27.50 +#pragma once
   27.51 +#ifndef AI_COLOR4D_INL_INC
   27.52 +#define AI_COLOR4D_INL_INC
   27.53 +
   27.54 +#ifdef __cplusplus
   27.55 +#include "color4.h"
   27.56 +
   27.57 +// ------------------------------------------------------------------------------------------------
   27.58 +template <typename TReal>
   27.59 +AI_FORCE_INLINE const aiColor4t<TReal>& aiColor4t<TReal>::operator += (const aiColor4t<TReal>& o) {
   27.60 +    r += o.r; g += o.g; b += o.b; a += o.a;
   27.61 +    return *this;
   27.62 +}
   27.63 +// ------------------------------------------------------------------------------------------------
   27.64 +template <typename TReal>
   27.65 +AI_FORCE_INLINE const aiColor4t<TReal>& aiColor4t<TReal>::operator -= (const aiColor4t<TReal>& o) {
   27.66 +    r -= o.r; g -= o.g; b -= o.b; a -= o.a;
   27.67 +    return *this;
   27.68 +}
   27.69 +// ------------------------------------------------------------------------------------------------
   27.70 +template <typename TReal>
   27.71 +AI_FORCE_INLINE const aiColor4t<TReal>& aiColor4t<TReal>::operator *= (TReal f) {
   27.72 +    r *= f; g *= f; b *= f; a *= f;
   27.73 +    return *this;
   27.74 +}
   27.75 +// ------------------------------------------------------------------------------------------------
   27.76 +template <typename TReal>
   27.77 +AI_FORCE_INLINE const aiColor4t<TReal>& aiColor4t<TReal>::operator /= (TReal f) {
   27.78 +    r /= f; g /= f; b /= f; a /= f;
   27.79 +    return *this;
   27.80 +}
   27.81 +// ------------------------------------------------------------------------------------------------
   27.82 +template <typename TReal>
   27.83 +AI_FORCE_INLINE TReal aiColor4t<TReal>::operator[](unsigned int i) const {
   27.84 +    switch ( i ) {
   27.85 +        case 0:
   27.86 +            return r;
   27.87 +        case 1:
   27.88 +            return g;
   27.89 +        case 2:
   27.90 +            return b;
   27.91 +        default:
   27.92 +            break;
   27.93 +    }
   27.94 +    return r;
   27.95 +}
   27.96 +// ------------------------------------------------------------------------------------------------
   27.97 +template <typename TReal>
   27.98 +AI_FORCE_INLINE TReal& aiColor4t<TReal>::operator[](unsigned int i) {
   27.99 +    switch ( i ) {
  27.100 +        case 0:
  27.101 +            return r;
  27.102 +        case 1:
  27.103 +            return g;
  27.104 +        case 2:
  27.105 +            return b;
  27.106 +        default:
  27.107 +            break;
  27.108 +    }
  27.109 +    return r;
  27.110 +}
  27.111 +// ------------------------------------------------------------------------------------------------
  27.112 +template <typename TReal>
  27.113 +AI_FORCE_INLINE bool aiColor4t<TReal>::operator== (const aiColor4t<TReal>& other) const {
  27.114 +    return r == other.r && g == other.g && b == other.b && a == other.a;
  27.115 +}
  27.116 +// ------------------------------------------------------------------------------------------------
  27.117 +template <typename TReal>
  27.118 +AI_FORCE_INLINE bool aiColor4t<TReal>::operator!= (const aiColor4t<TReal>& other) const {
  27.119 +    return r != other.r || g != other.g || b != other.b || a != other.a;
  27.120 +}
  27.121 +// ------------------------------------------------------------------------------------------------
  27.122 +template <typename TReal>
  27.123 +AI_FORCE_INLINE bool aiColor4t<TReal>::operator< (const aiColor4t<TReal>& other) const {
  27.124 +    return r < other.r || (
  27.125 +        r == other.r && (
  27.126 +            g < other.g || (
  27.127 +                g == other.g && (
  27.128 +                    b < other.b || (
  27.129 +                        b == other.b && (
  27.130 +                            a < other.a
  27.131 +                        )
  27.132 +                    )
  27.133 +                )
  27.134 +            )
  27.135 +        )
  27.136 +    );
  27.137 +}
  27.138 +// ------------------------------------------------------------------------------------------------
  27.139 +template <typename TReal>
  27.140 +AI_FORCE_INLINE aiColor4t<TReal> operator + (const aiColor4t<TReal>& v1, const aiColor4t<TReal>& v2)    {
  27.141 +    return aiColor4t<TReal>( v1.r + v2.r, v1.g + v2.g, v1.b + v2.b, v1.a + v2.a);
  27.142 +}
  27.143 +// ------------------------------------------------------------------------------------------------
  27.144 +template <typename TReal>
  27.145 +AI_FORCE_INLINE aiColor4t<TReal> operator - (const aiColor4t<TReal>& v1, const aiColor4t<TReal>& v2)    {
  27.146 +    return aiColor4t<TReal>( v1.r - v2.r, v1.g - v2.g, v1.b - v2.b, v1.a - v2.a);
  27.147 +}
  27.148 +// ------------------------------------------------------------------------------------------------
  27.149 +template <typename TReal>
  27.150 +AI_FORCE_INLINE aiColor4t<TReal> operator * (const aiColor4t<TReal>& v1, const aiColor4t<TReal>& v2)    {
  27.151 +    return aiColor4t<TReal>( v1.r * v2.r, v1.g * v2.g, v1.b * v2.b, v1.a * v2.a);
  27.152 +}
  27.153 +// ------------------------------------------------------------------------------------------------
  27.154 +template <typename TReal>
  27.155 +AI_FORCE_INLINE aiColor4t<TReal> operator / (const aiColor4t<TReal>& v1, const aiColor4t<TReal>& v2)    {
  27.156 +    return aiColor4t<TReal>( v1.r / v2.r, v1.g / v2.g, v1.b / v2.b, v1.a / v2.a);
  27.157 +}
  27.158 +// ------------------------------------------------------------------------------------------------
  27.159 +template <typename TReal>
  27.160 +AI_FORCE_INLINE aiColor4t<TReal> operator * ( TReal f, const aiColor4t<TReal>& v)   {
  27.161 +    return aiColor4t<TReal>( f*v.r, f*v.g, f*v.b, f*v.a);
  27.162 +}
  27.163 +// ------------------------------------------------------------------------------------------------
  27.164 +template <typename TReal>
  27.165 +AI_FORCE_INLINE  aiColor4t<TReal> operator * ( const aiColor4t<TReal>& v, TReal f)  {
  27.166 +    return aiColor4t<TReal>( f*v.r, f*v.g, f*v.b, f*v.a);
  27.167 +}
  27.168 +// ------------------------------------------------------------------------------------------------
  27.169 +template <typename TReal>
  27.170 +AI_FORCE_INLINE  aiColor4t<TReal> operator / ( const aiColor4t<TReal>& v, TReal f)  {
  27.171 +    return v * (1/f);
  27.172 +}
  27.173 +// ------------------------------------------------------------------------------------------------
  27.174 +template <typename TReal>
  27.175 +AI_FORCE_INLINE  aiColor4t<TReal> operator / ( TReal f,const aiColor4t<TReal>& v)   {
  27.176 +    return aiColor4t<TReal>(f,f,f,f)/v;
  27.177 +}
  27.178 +// ------------------------------------------------------------------------------------------------
  27.179 +template <typename TReal>
  27.180 +AI_FORCE_INLINE  aiColor4t<TReal> operator + ( const aiColor4t<TReal>& v, TReal f)  {
  27.181 +    return aiColor4t<TReal>( f+v.r, f+v.g, f+v.b, f+v.a);
  27.182 +}
  27.183 +// ------------------------------------------------------------------------------------------------
  27.184 +template <typename TReal>
  27.185 +AI_FORCE_INLINE  aiColor4t<TReal> operator - ( const aiColor4t<TReal>& v, TReal f)  {
  27.186 +    return aiColor4t<TReal>( v.r-f, v.g-f, v.b-f, v.a-f);
  27.187 +}
  27.188 +// ------------------------------------------------------------------------------------------------
  27.189 +template <typename TReal>
  27.190 +AI_FORCE_INLINE  aiColor4t<TReal> operator + ( TReal f, const aiColor4t<TReal>& v)  {
  27.191 +    return aiColor4t<TReal>( f+v.r, f+v.g, f+v.b, f+v.a);
  27.192 +}
  27.193 +// ------------------------------------------------------------------------------------------------
  27.194 +template <typename TReal>
  27.195 +AI_FORCE_INLINE  aiColor4t<TReal> operator - ( TReal f, const aiColor4t<TReal>& v)  {
  27.196 +    return aiColor4t<TReal>( f-v.r, f-v.g, f-v.b, f-v.a);
  27.197 +}
  27.198 +
  27.199 +// ------------------------------------------------------------------------------------------------
  27.200 +template <typename TReal>
  27.201 +inline bool aiColor4t<TReal> :: IsBlack() const {
  27.202 +    // The alpha component doesn't care here. black is black.
  27.203 +    static const TReal epsilon = 10e-3f;
  27.204 +    return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon;
  27.205 +}
  27.206 +
  27.207 +#endif // __cplusplus
  27.208 +#endif // AI_VECTOR3D_INL_INC
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/include/miniassimp/config.h	Mon Jan 28 18:19:26 2019 +0200
    28.3 @@ -0,0 +1,992 @@
    28.4 +/*
    28.5 +---------------------------------------------------------------------------
    28.6 +Open Asset Import Library (assimp)
    28.7 +---------------------------------------------------------------------------
    28.8 +
    28.9 +Copyright (c) 2006-2018, assimp team
   28.10 +
   28.11 +
   28.12 +All rights reserved.
   28.13 +
   28.14 +Redistribution and use of this software in source and binary forms,
   28.15 +with or without modification, are permitted provided that the following
   28.16 +conditions are met:
   28.17 +
   28.18 +* Redistributions of source code must retain the above
   28.19 +  copyright notice, this list of conditions and the
   28.20 +  following disclaimer.
   28.21 +
   28.22 +* Redistributions in binary form must reproduce the above
   28.23 +  copyright notice, this list of conditions and the
   28.24 +  following disclaimer in the documentation and/or other
   28.25 +  materials provided with the distribution.
   28.26 +
   28.27 +* Neither the name of the assimp team, nor the names of its
   28.28 +  contributors may be used to endorse or promote products
   28.29 +  derived from this software without specific prior
   28.30 +  written permission of the assimp team.
   28.31 +
   28.32 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   28.33 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   28.34 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   28.35 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   28.36 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   28.37 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   28.38 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   28.39 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   28.40 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   28.41 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   28.42 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   28.43 +---------------------------------------------------------------------------
   28.44 +*/
   28.45 +
   28.46 +/** @file config.h
   28.47 + *  @brief Defines constants for configurable properties for the library
   28.48 + *
   28.49 + *  Typically these properties are set via
   28.50 + *  #Assimp::Importer::SetPropertyFloat,
   28.51 + *  #Assimp::Importer::SetPropertyInteger or
   28.52 + *  #Assimp::Importer::SetPropertyString,
   28.53 + *  depending on the data type of a property. All properties have a
   28.54 + *  default value. See the doc for the mentioned methods for more details.
   28.55 + *
   28.56 + *  <br><br>
   28.57 + *  The corresponding functions for use with the plain-c API are:
   28.58 + *  #aiSetImportPropertyInteger,
   28.59 + *  #aiSetImportPropertyFloat,
   28.60 + *  #aiSetImportPropertyString
   28.61 + */
   28.62 +#pragma once
   28.63 +#ifndef AI_CONFIG_H_INC
   28.64 +#define AI_CONFIG_H_INC
   28.65 +
   28.66 +
   28.67 +// ###########################################################################
   28.68 +// LIBRARY SETTINGS
   28.69 +// General, global settings
   28.70 +// ###########################################################################
   28.71 +
   28.72 +// ---------------------------------------------------------------------------
   28.73 +/** @brief Enables time measurements.
   28.74 + *
   28.75 + *  If enabled, measures the time needed for each part of the loading
   28.76 + *  process (i.e. IO time, importing, postprocessing, ..) and dumps
   28.77 + *  these timings to the DefaultLogger. See the @link perf Performance
   28.78 + *  Page@endlink for more information on this topic.
   28.79 + *
   28.80 + * Property type: bool. Default value: false.
   28.81 + */
   28.82 +#define AI_CONFIG_GLOB_MEASURE_TIME  \
   28.83 +    "GLOB_MEASURE_TIME"
   28.84 +
   28.85 +
   28.86 +// ---------------------------------------------------------------------------
   28.87 +/** @brief Global setting to disable generation of skeleton dummy meshes
   28.88 + *
   28.89 + * Skeleton dummy meshes are generated as a visualization aid in cases which
   28.90 + * the input data contains no geometry, but only animation data.
   28.91 + * Property data type: bool. Default value: false
   28.92 + */
   28.93 +// ---------------------------------------------------------------------------
   28.94 +#define AI_CONFIG_IMPORT_NO_SKELETON_MESHES \
   28.95 +    "IMPORT_NO_SKELETON_MESHES"
   28.96 +
   28.97 +
   28.98 +
   28.99 +# if 0 // not implemented yet
  28.100 +// ---------------------------------------------------------------------------
  28.101 +/** @brief Set Assimp's multithreading policy.
  28.102 + *
  28.103 + * This setting is ignored if Assimp was built without boost.thread
  28.104 + * support (ASSIMP_BUILD_NO_THREADING, which is implied by ASSIMP_BUILD_BOOST_WORKAROUND).
  28.105 + * Possible values are: -1 to let Assimp decide what to do, 0 to disable
  28.106 + * multithreading entirely and any number larger than 0 to force a specific
  28.107 + * number of threads. Assimp is always free to ignore this settings, which is
  28.108 + * merely a hint. Usually, the default value (-1) will be fine. However, if
  28.109 + * Assimp is used concurrently from multiple user threads, it might be useful
  28.110 + * to limit each Importer instance to a specific number of cores.
  28.111 + *
  28.112 + * For more information, see the @link threading Threading page@endlink.
  28.113 + * Property type: int, default value: -1.
  28.114 + */
  28.115 +#define AI_CONFIG_GLOB_MULTITHREADING  \
  28.116 +    "GLOB_MULTITHREADING"
  28.117 +#endif
  28.118 +
  28.119 +// ###########################################################################
  28.120 +// POST PROCESSING SETTINGS
  28.121 +// Various stuff to fine-tune the behavior of a specific post processing step.
  28.122 +// ###########################################################################
  28.123 +
  28.124 +
  28.125 +// ---------------------------------------------------------------------------
  28.126 +/** @brief Maximum bone count per mesh for the SplitbyBoneCount step.
  28.127 + *
  28.128 + * Meshes are split until the maximum number of bones is reached. The default
  28.129 + * value is AI_SBBC_DEFAULT_MAX_BONES, which may be altered at
  28.130 + * compile-time.
  28.131 + * Property data type: integer.
  28.132 + */
  28.133 +// ---------------------------------------------------------------------------
  28.134 +#define AI_CONFIG_PP_SBBC_MAX_BONES \
  28.135 +    "PP_SBBC_MAX_BONES"
  28.136 +
  28.137 +
  28.138 +// default limit for bone count
  28.139 +#if (!defined AI_SBBC_DEFAULT_MAX_BONES)
  28.140 +#   define AI_SBBC_DEFAULT_MAX_BONES        60
  28.141 +#endif
  28.142 +
  28.143 +
  28.144 +// ---------------------------------------------------------------------------
  28.145 +/** @brief  Specifies the maximum angle that may be between two vertex tangents
  28.146 + *         that their tangents and bi-tangents are smoothed.
  28.147 + *
  28.148 + * This applies to the CalcTangentSpace-Step. The angle is specified
  28.149 + * in degrees. The maximum value is 175.
  28.150 + * Property type: float. Default value: 45 degrees
  28.151 + */
  28.152 +#define AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE \
  28.153 +    "PP_CT_MAX_SMOOTHING_ANGLE"
  28.154 +
  28.155 +// ---------------------------------------------------------------------------
  28.156 +/** @brief Source UV channel for tangent space computation.
  28.157 + *
  28.158 + * The specified channel must exist or an error will be raised.
  28.159 + * Property type: integer. Default value: 0
  28.160 + */
  28.161 +// ---------------------------------------------------------------------------
  28.162 +#define AI_CONFIG_PP_CT_TEXTURE_CHANNEL_INDEX \
  28.163 +    "PP_CT_TEXTURE_CHANNEL_INDEX"
  28.164 +
  28.165 +// ---------------------------------------------------------------------------
  28.166 +/** @brief  Specifies the maximum angle that may be between two face normals
  28.167 + *          at the same vertex position that their are smoothed together.
  28.168 + *
  28.169 + * Sometimes referred to as 'crease angle'.
  28.170 + * This applies to the GenSmoothNormals-Step. The angle is specified
  28.171 + * in degrees, so 180 is PI. The default value is 175 degrees (all vertex
  28.172 + * normals are smoothed). The maximum value is 175, too. Property type: float.
  28.173 + * Warning: setting this option may cause a severe loss of performance. The
  28.174 + * performance is unaffected if the #AI_CONFIG_FAVOUR_SPEED flag is set but
  28.175 + * the output quality may be reduced.
  28.176 + */
  28.177 +#define AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE \
  28.178 +    "PP_GSN_MAX_SMOOTHING_ANGLE"
  28.179 +
  28.180 +
  28.181 +// ---------------------------------------------------------------------------
  28.182 +/** @brief Sets the colormap (= palette) to be used to decode embedded
  28.183 + *         textures in MDL (Quake or 3DGS) files.
  28.184 + *
  28.185 + * This must be a valid path to a file. The file is 768 (256*3) bytes
  28.186 + * large and contains RGB triplets for each of the 256 palette entries.
  28.187 + * The default value is colormap.lmp. If the file is not found,
  28.188 + * a default palette (from Quake 1) is used.
  28.189 + * Property type: string.
  28.190 + */
  28.191 +#define AI_CONFIG_IMPORT_MDL_COLORMAP       \
  28.192 +    "IMPORT_MDL_COLORMAP"
  28.193 +
  28.194 +// ---------------------------------------------------------------------------
  28.195 +/** @brief Configures the #aiProcess_RemoveRedundantMaterials step to
  28.196 + *  keep materials matching a name in a given list.
  28.197 + *
  28.198 + * This is a list of 1 to n strings, ' ' serves as delimiter character.
  28.199 + * Identifiers containing whitespaces must be enclosed in *single*
  28.200 + * quotation marks. For example:<tt>
  28.201 + * "keep-me and_me_to anotherMaterialToBeKept \'name with whitespace\'"</tt>.
  28.202 + * If a material matches on of these names, it will not be modified or
  28.203 + * removed by the postprocessing step nor will other materials be replaced
  28.204 + * by a reference to it. <br>
  28.205 + * This option might be useful if you are using some magic material names
  28.206 + * to pass additional semantics through the content pipeline. This ensures
  28.207 + * they won't be optimized away, but a general optimization is still
  28.208 + * performed for materials not contained in the list.
  28.209 + * Property type: String. Default value: n/a
  28.210 + * @note Linefeeds, tabs or carriage returns are treated as whitespace.
  28.211 + *   Material names are case sensitive.
  28.212 + */
  28.213 +#define AI_CONFIG_PP_RRM_EXCLUDE_LIST   \
  28.214 +    "PP_RRM_EXCLUDE_LIST"
  28.215 +
  28.216 +// ---------------------------------------------------------------------------
  28.217 +/** @brief Configures the #aiProcess_PreTransformVertices step to
  28.218 + *  keep the scene hierarchy. Meshes are moved to worldspace, but
  28.219 + *  no optimization is performed (read: meshes with equal materials are not
  28.220 + *  joined. The total number of meshes won't change).
  28.221 + *
  28.222 + * This option could be of use for you if the scene hierarchy contains
  28.223 + * important additional information which you intend to parse.
  28.224 + * For rendering, you can still render all meshes in the scene without
  28.225 + * any transformations.
  28.226 + * Property type: bool. Default value: false.
  28.227 + */
  28.228 +#define AI_CONFIG_PP_PTV_KEEP_HIERARCHY     \
  28.229 +    "PP_PTV_KEEP_HIERARCHY"
  28.230 +
  28.231 +// ---------------------------------------------------------------------------
  28.232 +/** @brief Configures the #aiProcess_PreTransformVertices step to normalize
  28.233 + *  all vertex components into the [-1,1] range. That is, a bounding box
  28.234 + *  for the whole scene is computed, the maximum component is taken and all
  28.235 + *  meshes are scaled appropriately (uniformly of course!).
  28.236 + *  This might be useful if you don't know the spatial dimension of the input
  28.237 + *  data*/
  28.238 +#define AI_CONFIG_PP_PTV_NORMALIZE  \
  28.239 +    "PP_PTV_NORMALIZE"
  28.240 +
  28.241 +// ---------------------------------------------------------------------------
  28.242 +/** @brief Configures the #aiProcess_PreTransformVertices step to use
  28.243 + *  a users defined matrix as the scene root node transformation before
  28.244 + *  transforming vertices.
  28.245 + *  Property type: bool. Default value: false.
  28.246 + */
  28.247 +#define AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION    \
  28.248 +    "PP_PTV_ADD_ROOT_TRANSFORMATION"
  28.249 +
  28.250 +// ---------------------------------------------------------------------------
  28.251 +/** @brief Configures the #aiProcess_PreTransformVertices step to use
  28.252 + *  a users defined matrix as the scene root node transformation before
  28.253 + *  transforming vertices. This property correspond to the 'a1' component
  28.254 + *  of the transformation matrix.
  28.255 + *  Property type: aiMatrix4x4.
  28.256 + */
  28.257 +#define AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION    \
  28.258 +    "PP_PTV_ROOT_TRANSFORMATION"
  28.259 +
  28.260 +// ---------------------------------------------------------------------------
  28.261 +/** @brief Configures the #aiProcess_FindDegenerates step to
  28.262 + *  remove degenerated primitives from the import - immediately.
  28.263 + *
  28.264 + * The default behaviour converts degenerated triangles to lines and
  28.265 + * degenerated lines to points. See the documentation to the
  28.266 + * #aiProcess_FindDegenerates step for a detailed example of the various ways
  28.267 + * to get rid of these lines and points if you don't want them.
  28.268 + * Property type: bool. Default value: false.
  28.269 + */
  28.270 +#define AI_CONFIG_PP_FD_REMOVE \
  28.271 +    "PP_FD_REMOVE"
  28.272 +
  28.273 +// ---------------------------------------------------------------------------
  28.274 +/**
  28.275 + *  @brief  Configures the #aiProcess_FindDegenerates to check the area of a
  28.276 + *  trinagle to be greates than e-6. If this is not the case the triangle will
  28.277 + *  be removed if #AI_CONFIG_PP_FD_REMOVE is set to true.
  28.278 + */
  28.279 +#define AI_CONFIG_PP_FD_CHECKAREA \
  28.280 +    "PP_FD_CHECKAREA"
  28.281 +
  28.282 +// ---------------------------------------------------------------------------
  28.283 +/** @brief Configures the #aiProcess_OptimizeGraph step to preserve nodes
  28.284 + * matching a name in a given list.
  28.285 + *
  28.286 + * This is a list of 1 to n strings, ' ' serves as delimiter character.
  28.287 + * Identifiers containing whitespaces must be enclosed in *single*
  28.288 + * quotation marks. For example:<tt>
  28.289 + * "keep-me and_me_to anotherNodeToBeKept \'name with whitespace\'"</tt>.
  28.290 + * If a node matches on of these names, it will not be modified or
  28.291 + * removed by the postprocessing step.<br>
  28.292 + * This option might be useful if you are using some magic node names
  28.293 + * to pass additional semantics through the content pipeline. This ensures
  28.294 + * they won't be optimized away, but a general optimization is still
  28.295 + * performed for nodes not contained in the list.
  28.296 + * Property type: String. Default value: n/a
  28.297 + * @note Linefeeds, tabs or carriage returns are treated as whitespace.
  28.298 + *   Node names are case sensitive.
  28.299 + */
  28.300 +#define AI_CONFIG_PP_OG_EXCLUDE_LIST    \
  28.301 +    "PP_OG_EXCLUDE_LIST"
  28.302 +
  28.303 +// ---------------------------------------------------------------------------
  28.304 +/** @brief  Set the maximum number of triangles in a mesh.
  28.305 + *
  28.306 + * This is used by the "SplitLargeMeshes" PostProcess-Step to determine
  28.307 + * whether a mesh must be split or not.
  28.308 + * @note The default value is AI_SLM_DEFAULT_MAX_TRIANGLES
  28.309 + * Property type: integer.
  28.310 + */
  28.311 +#define AI_CONFIG_PP_SLM_TRIANGLE_LIMIT \
  28.312 +    "PP_SLM_TRIANGLE_LIMIT"
  28.313 +
  28.314 +// default value for AI_CONFIG_PP_SLM_TRIANGLE_LIMIT
  28.315 +#if (!defined AI_SLM_DEFAULT_MAX_TRIANGLES)
  28.316 +#   define AI_SLM_DEFAULT_MAX_TRIANGLES     1000000
  28.317 +#endif
  28.318 +
  28.319 +// ---------------------------------------------------------------------------
  28.320 +/** @brief  Set the maximum number of vertices in a mesh.
  28.321 + *
  28.322 + * This is used by the "SplitLargeMeshes" PostProcess-Step to determine
  28.323 + * whether a mesh must be split or not.
  28.324 + * @note The default value is AI_SLM_DEFAULT_MAX_VERTICES
  28.325 + * Property type: integer.
  28.326 + */
  28.327 +#define AI_CONFIG_PP_SLM_VERTEX_LIMIT \
  28.328 +    "PP_SLM_VERTEX_LIMIT"
  28.329 +
  28.330 +// default value for AI_CONFIG_PP_SLM_VERTEX_LIMIT
  28.331 +#if (!defined AI_SLM_DEFAULT_MAX_VERTICES)
  28.332 +#   define AI_SLM_DEFAULT_MAX_VERTICES      1000000
  28.333 +#endif
  28.334 +
  28.335 +// ---------------------------------------------------------------------------
  28.336 +/** @brief Set the maximum number of bones affecting a single vertex
  28.337 + *
  28.338 + * This is used by the #aiProcess_LimitBoneWeights PostProcess-Step.
  28.339 + * @note The default value is AI_LMW_MAX_WEIGHTS
  28.340 + * Property type: integer.*/
  28.341 +#define AI_CONFIG_PP_LBW_MAX_WEIGHTS    \
  28.342 +    "PP_LBW_MAX_WEIGHTS"
  28.343 +
  28.344 +// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS
  28.345 +#if (!defined AI_LMW_MAX_WEIGHTS)
  28.346 +#   define AI_LMW_MAX_WEIGHTS   0x4
  28.347 +#endif // !! AI_LMW_MAX_WEIGHTS
  28.348 +
  28.349 +// ---------------------------------------------------------------------------
  28.350 +/** @brief Lower the deboning threshold in order to remove more bones.
  28.351 + *
  28.352 + * This is used by the #aiProcess_Debone PostProcess-Step.
  28.353 + * @note The default value is AI_DEBONE_THRESHOLD
  28.354 + * Property type: float.*/
  28.355 +#define AI_CONFIG_PP_DB_THRESHOLD \
  28.356 +    "PP_DB_THRESHOLD"
  28.357 +
  28.358 +// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS
  28.359 +#if (!defined AI_DEBONE_THRESHOLD)
  28.360 +#   define AI_DEBONE_THRESHOLD  1.0f
  28.361 +#endif // !! AI_DEBONE_THRESHOLD
  28.362 +
  28.363 +// ---------------------------------------------------------------------------
  28.364 +/** @brief Require all bones qualify for deboning before removing any
  28.365 + *
  28.366 + * This is used by the #aiProcess_Debone PostProcess-Step.
  28.367 + * @note The default value is 0
  28.368 + * Property type: bool.*/
  28.369 +#define AI_CONFIG_PP_DB_ALL_OR_NONE \
  28.370 +    "PP_DB_ALL_OR_NONE"
  28.371 +
  28.372 +/** @brief Default value for the #AI_CONFIG_PP_ICL_PTCACHE_SIZE property
  28.373 + */
  28.374 +#ifndef PP_ICL_PTCACHE_SIZE
  28.375 +#   define PP_ICL_PTCACHE_SIZE 12
  28.376 +#endif
  28.377 +
  28.378 +// ---------------------------------------------------------------------------
  28.379 +/** @brief Set the size of the post-transform vertex cache to optimize the
  28.380 + *    vertices for. This configures the #aiProcess_ImproveCacheLocality step.
  28.381 + *
  28.382 + * The size is given in vertices. Of course you can't know how the vertex
  28.383 + * format will exactly look like after the import returns, but you can still
  28.384 + * guess what your meshes will probably have.
  28.385 + * @note The default value is #PP_ICL_PTCACHE_SIZE. That results in slight
  28.386 + * performance improvements for most nVidia/AMD cards since 2002.
  28.387 + * Property type: integer.
  28.388 + */
  28.389 +#define AI_CONFIG_PP_ICL_PTCACHE_SIZE   "PP_ICL_PTCACHE_SIZE"
  28.390 +
  28.391 +// ---------------------------------------------------------------------------
  28.392 +/** @brief Enumerates components of the aiScene and aiMesh data structures
  28.393 + *  that can be excluded from the import using the #aiProcess_RemoveComponent step.
  28.394 + *
  28.395 + *  See the documentation to #aiProcess_RemoveComponent for more details.
  28.396 + */
  28.397 +enum aiComponent
  28.398 +{
  28.399 +    /** Normal vectors */
  28.400 +#ifdef SWIG
  28.401 +    aiComponent_NORMALS = 0x2,
  28.402 +#else
  28.403 +    aiComponent_NORMALS = 0x2u,
  28.404 +#endif
  28.405 +
  28.406 +    /** Tangents and bitangents go always together ... */
  28.407 +#ifdef SWIG
  28.408 +    aiComponent_TANGENTS_AND_BITANGENTS = 0x4,
  28.409 +#else
  28.410 +    aiComponent_TANGENTS_AND_BITANGENTS = 0x4u,
  28.411 +#endif
  28.412 +
  28.413 +    /** ALL color sets
  28.414 +     * Use aiComponent_COLORn(N) to specify the N'th set */
  28.415 +    aiComponent_COLORS = 0x8,
  28.416 +
  28.417 +    /** ALL texture UV sets
  28.418 +     * aiComponent_TEXCOORDn(N) to specify the N'th set  */
  28.419 +    aiComponent_TEXCOORDS = 0x10,
  28.420 +
  28.421 +    /** Removes all bone weights from all meshes.
  28.422 +     * The scenegraph nodes corresponding to the bones are NOT removed.
  28.423 +     * use the #aiProcess_OptimizeGraph step to do this */
  28.424 +    aiComponent_BONEWEIGHTS = 0x20,
  28.425 +
  28.426 +    /** Removes all node animations (aiScene::mAnimations).
  28.427 +     * The corresponding scenegraph nodes are NOT removed.
  28.428 +     * use the #aiProcess_OptimizeGraph step to do this */
  28.429 +    aiComponent_ANIMATIONS = 0x40,
  28.430 +
  28.431 +    /** Removes all embedded textures (aiScene::mTextures) */
  28.432 +    aiComponent_TEXTURES = 0x80,
  28.433 +
  28.434 +    /** Removes all light sources (aiScene::mLights).
  28.435 +     * The corresponding scenegraph nodes are NOT removed.
  28.436 +     * use the #aiProcess_OptimizeGraph step to do this */
  28.437 +    aiComponent_LIGHTS = 0x100,
  28.438 +
  28.439 +    /** Removes all cameras (aiScene::mCameras).
  28.440 +     * The corresponding scenegraph nodes are NOT removed.
  28.441 +     * use the #aiProcess_OptimizeGraph step to do this */
  28.442 +    aiComponent_CAMERAS = 0x200,
  28.443 +
  28.444 +    /** Removes all meshes (aiScene::mMeshes). */
  28.445 +    aiComponent_MESHES = 0x400,
  28.446 +
  28.447 +    /** Removes all materials. One default material will
  28.448 +     * be generated, so aiScene::mNumMaterials will be 1. */
  28.449 +    aiComponent_MATERIALS = 0x800,
  28.450 +
  28.451 +
  28.452 +    /** This value is not used. It is just there to force the
  28.453 +     *  compiler to map this enum to a 32 Bit integer. */
  28.454 +#ifndef SWIG
  28.455 +    _aiComponent_Force32Bit = 0x9fffffff
  28.456 +#endif
  28.457 +};
  28.458 +
  28.459 +// Remove a specific color channel 'n'
  28.460 +#define aiComponent_COLORSn(n) (1u << (n+20u))
  28.461 +
  28.462 +// Remove a specific UV channel 'n'
  28.463 +#define aiComponent_TEXCOORDSn(n) (1u << (n+25u))
  28.464 +
  28.465 +// ---------------------------------------------------------------------------
  28.466 +/** @brief Input parameter to the #aiProcess_RemoveComponent step:
  28.467 + *  Specifies the parts of the data structure to be removed.
  28.468 + *
  28.469 + * See the documentation to this step for further details. The property
  28.470 + * is expected to be an integer, a bitwise combination of the
  28.471 + * #aiComponent flags defined above in this header. The default
  28.472 + * value is 0. Important: if no valid mesh is remaining after the
  28.473 + * step has been executed (e.g you thought it was funny to specify ALL
  28.474 + * of the flags defined above) the import FAILS. Mainly because there is
  28.475 + * no data to work on anymore ...
  28.476 + */
  28.477 +#define AI_CONFIG_PP_RVC_FLAGS              \
  28.478 +    "PP_RVC_FLAGS"
  28.479 +
  28.480 +// ---------------------------------------------------------------------------
  28.481 +/** @brief Input parameter to the #aiProcess_SortByPType step:
  28.482 + *  Specifies which primitive types are removed by the step.
  28.483 + *
  28.484 + *  This is a bitwise combination of the aiPrimitiveType flags.
  28.485 + *  Specifying all of them is illegal, of course. A typical use would
  28.486 + *  be to exclude all line and point meshes from the import. This
  28.487 + *  is an integer property, its default value is 0.
  28.488 + */
  28.489 +#define AI_CONFIG_PP_SBP_REMOVE             \
  28.490 +    "PP_SBP_REMOVE"
  28.491 +
  28.492 +// ---------------------------------------------------------------------------
  28.493 +/** @brief Input parameter to the #aiProcess_FindInvalidData step:
  28.494 + *  Specifies the floating-point accuracy for animation values. The step
  28.495 + *  checks for animation tracks where all frame values are absolutely equal
  28.496 + *  and removes them. This tweakable controls the epsilon for floating-point
  28.497 + *  comparisons - two keys are considered equal if the invariant
  28.498 + *  abs(n0-n1)>epsilon holds true for all vector respectively quaternion
  28.499 + *  components. The default value is 0.f - comparisons are exact then.
  28.500 + */
  28.501 +#define AI_CONFIG_PP_FID_ANIM_ACCURACY              \
  28.502 +    "PP_FID_ANIM_ACCURACY"
  28.503 +
  28.504 +// ---------------------------------------------------------------------------
  28.505 +/** @brief Input parameter to the #aiProcess_FindInvalidData step:
  28.506 + *  Set to true to ignore texture coordinates. This may be useful if you have
  28.507 + *  to assign different kind of textures like one for the summer or one for the winter.
  28.508 + */
  28.509 +#define AI_CONFIG_PP_FID_IGNORE_TEXTURECOORDS        \
  28.510 +    "PP_FID_IGNORE_TEXTURECOORDS"
  28.511 +
  28.512 +// TransformUVCoords evaluates UV scalings
  28.513 +#define AI_UVTRAFO_SCALING 0x1
  28.514 +
  28.515 +// TransformUVCoords evaluates UV rotations
  28.516 +#define AI_UVTRAFO_ROTATION 0x2
  28.517 +
  28.518 +// TransformUVCoords evaluates UV translation
  28.519 +#define AI_UVTRAFO_TRANSLATION 0x4
  28.520 +
  28.521 +// Everything baked together -> default value
  28.522 +#define AI_UVTRAFO_ALL (AI_UVTRAFO_SCALING | AI_UVTRAFO_ROTATION | AI_UVTRAFO_TRANSLATION)
  28.523 +
  28.524 +// ---------------------------------------------------------------------------
  28.525 +/** @brief Input parameter to the #aiProcess_TransformUVCoords step:
  28.526 + *  Specifies which UV transformations are evaluated.
  28.527 + *
  28.528 + *  This is a bitwise combination of the AI_UVTRAFO_XXX flags (integer
  28.529 + *  property, of course). By default all transformations are enabled
  28.530 + * (AI_UVTRAFO_ALL).
  28.531 + */
  28.532 +#define AI_CONFIG_PP_TUV_EVALUATE               \
  28.533 +    "PP_TUV_EVALUATE"
  28.534 +
  28.535 +// ---------------------------------------------------------------------------
  28.536 +/** @brief A hint to assimp to favour speed against import quality.
  28.537 + *
  28.538 + * Enabling this option may result in faster loading, but it needn't.
  28.539 + * It represents just a hint to loaders and post-processing steps to use
  28.540 + * faster code paths, if possible.
  28.541 + * This property is expected to be an integer, != 0 stands for true.
  28.542 + * The default value is 0.
  28.543 + */
  28.544 +#define AI_CONFIG_FAVOUR_SPEED              \
  28.545 + "FAVOUR_SPEED"
  28.546 +
  28.547 +
  28.548 +// ###########################################################################
  28.549 +// IMPORTER SETTINGS
  28.550 +// Various stuff to fine-tune the behaviour of specific importer plugins.
  28.551 +// ###########################################################################
  28.552 +
  28.553 +
  28.554 +// ---------------------------------------------------------------------------
  28.555 +/** @brief Set whether the fbx importer will merge all geometry layers present
  28.556 + *    in the source file or take only the first.
  28.557 + *
  28.558 + * The default value is true (1)
  28.559 + * Property type: bool
  28.560 + */
  28.561 +#define AI_CONFIG_IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS \
  28.562 +    "IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS"
  28.563 +
  28.564 +// ---------------------------------------------------------------------------
  28.565 +/** @brief Set whether the fbx importer will read all materials present in the
  28.566 + *    source file or take only the referenced materials.
  28.567 + *
  28.568 + * This is void unless IMPORT_FBX_READ_MATERIALS=1.
  28.569 + *
  28.570 + * The default value is false (0)
  28.571 + * Property type: bool
  28.572 + */
  28.573 +#define AI_CONFIG_IMPORT_FBX_READ_ALL_MATERIALS \
  28.574 +    "IMPORT_FBX_READ_ALL_MATERIALS"
  28.575 +
  28.576 +// ---------------------------------------------------------------------------
  28.577 +/** @brief Set whether the fbx importer will read materials.
  28.578 + *
  28.579 + * The default value is true (1)
  28.580 + * Property type: bool
  28.581 + */
  28.582 +#define AI_CONFIG_IMPORT_FBX_READ_MATERIALS \
  28.583 +    "IMPORT_FBX_READ_MATERIALS"
  28.584 +
  28.585 +// ---------------------------------------------------------------------------
  28.586 +/** @brief Set whether the fbx importer will read embedded textures.
  28.587 + *
  28.588 + * The default value is true (1)
  28.589 + * Property type: bool
  28.590 + */
  28.591 +#define AI_CONFIG_IMPORT_FBX_READ_TEXTURES \
  28.592 +    "IMPORT_FBX_READ_TEXTURES"
  28.593 +
  28.594 +// ---------------------------------------------------------------------------
  28.595 +/** @brief Set whether the fbx importer will read cameras.
  28.596 + *
  28.597 + * The default value is true (1)
  28.598 + * Property type: bool
  28.599 + */
  28.600 +#define AI_CONFIG_IMPORT_FBX_READ_CAMERAS \
  28.601 +    "IMPORT_FBX_READ_CAMERAS"
  28.602 +
  28.603 +// ---------------------------------------------------------------------------
  28.604 +/** @brief Set whether the fbx importer will read light sources.
  28.605 + *
  28.606 + * The default value is true (1)
  28.607 + * Property type: bool
  28.608 + */
  28.609 +#define AI_CONFIG_IMPORT_FBX_READ_LIGHTS \
  28.610 +    "IMPORT_FBX_READ_LIGHTS"
  28.611 +
  28.612 +// ---------------------------------------------------------------------------
  28.613 +/** @brief Set whether the fbx importer will read animations.
  28.614 + *
  28.615 + * The default value is true (1)
  28.616 + * Property type: bool
  28.617 + */
  28.618 +#define AI_CONFIG_IMPORT_FBX_READ_ANIMATIONS \
  28.619 +    "IMPORT_FBX_READ_ANIMATIONS"
  28.620 +
  28.621 +// ---------------------------------------------------------------------------
  28.622 +/** @brief Set whether the fbx importer will act in strict mode in which only
  28.623 + *    FBX 2013 is supported and any other sub formats are rejected. FBX 2013
  28.624 + *    is the primary target for the importer, so this format is best
  28.625 + *    supported and well-tested.
  28.626 + *
  28.627 + * The default value is false (0)
  28.628 + * Property type: bool
  28.629 + */
  28.630 +#define AI_CONFIG_IMPORT_FBX_STRICT_MODE \
  28.631 +    "IMPORT_FBX_STRICT_MODE"
  28.632 +
  28.633 +// ---------------------------------------------------------------------------
  28.634 +/** @brief Set whether the fbx importer will preserve pivot points for
  28.635 + *    transformations (as extra nodes). If set to false, pivots and offsets
  28.636 + *    will be evaluated whenever possible.
  28.637 + *
  28.638 + * The default value is true (1)
  28.639 + * Property type: bool
  28.640 + */
  28.641 +#define AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS \
  28.642 +    "IMPORT_FBX_PRESERVE_PIVOTS"
  28.643 +
  28.644 +// ---------------------------------------------------------------------------
  28.645 +/** @brief Specifies whether the importer will drop empty animation curves or
  28.646 + *    animation curves which match the bind pose transformation over their
  28.647 + *    entire defined range.
  28.648 + *
  28.649 + * The default value is true (1)
  28.650 + * Property type: bool
  28.651 + */
  28.652 +#define AI_CONFIG_IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES \
  28.653 +    "IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES"
  28.654 +
  28.655 +// ---------------------------------------------------------------------------
  28.656 +/** @brief Set whether the fbx importer will use the legacy embedded texture naming.
  28.657 +*
  28.658 +* The default value is false (0)
  28.659 +* Property type: bool
  28.660 +*/
  28.661 +#define AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING \
  28.662 +	"AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING"
  28.663 +	
  28.664 +// ---------------------------------------------------------------------------
  28.665 +/** @brief  Set the vertex animation keyframe to be imported
  28.666 + *
  28.667 + * ASSIMP does not support vertex keyframes (only bone animation is supported).
  28.668 + * The library reads only one frame of models with vertex animations.
  28.669 + * By default this is the first frame.
  28.670 + * \note The default value is 0. This option applies to all importers.
  28.671 + *   However, it is also possible to override the global setting
  28.672 + *   for a specific loader. You can use the AI_CONFIG_IMPORT_XXX_KEYFRAME
  28.673 + *   options (where XXX is a placeholder for the file format for which you
  28.674 + *   want to override the global setting).
  28.675 + * Property type: integer.
  28.676 + */
  28.677 +#define AI_CONFIG_IMPORT_GLOBAL_KEYFRAME    "IMPORT_GLOBAL_KEYFRAME"
  28.678 +
  28.679 +#define AI_CONFIG_IMPORT_MD3_KEYFRAME       "IMPORT_MD3_KEYFRAME"
  28.680 +#define AI_CONFIG_IMPORT_MD2_KEYFRAME       "IMPORT_MD2_KEYFRAME"
  28.681 +#define AI_CONFIG_IMPORT_MDL_KEYFRAME       "IMPORT_MDL_KEYFRAME"
  28.682 +#define AI_CONFIG_IMPORT_MDC_KEYFRAME       "IMPORT_MDC_KEYFRAME"
  28.683 +#define AI_CONFIG_IMPORT_SMD_KEYFRAME       "IMPORT_SMD_KEYFRAME"
  28.684 +#define AI_CONFIG_IMPORT_UNREAL_KEYFRAME    "IMPORT_UNREAL_KEYFRAME"
  28.685 +
  28.686 +// ---------------------------------------------------------------------------
  28.687 +/** Smd load multiple animations
  28.688 + *
  28.689 + *  Property type: bool. Default value: true.
  28.690 + */
  28.691 +#define AI_CONFIG_IMPORT_SMD_LOAD_ANIMATION_LIST "IMPORT_SMD_LOAD_ANIMATION_LIST"
  28.692 +
  28.693 +// ---------------------------------------------------------------------------
  28.694 +/** @brief  Configures the AC loader to collect all surfaces which have the
  28.695 + *    "Backface cull" flag set in separate meshes.
  28.696 + *
  28.697 + *  Property type: bool. Default value: true.
  28.698 + */
  28.699 +#define AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL \
  28.700 +    "IMPORT_AC_SEPARATE_BFCULL"
  28.701 +
  28.702 +// ---------------------------------------------------------------------------
  28.703 +/** @brief  Configures whether the AC loader evaluates subdivision surfaces (
  28.704 + *  indicated by the presence of the 'subdiv' attribute in the file). By
  28.705 + *  default, Assimp performs the subdivision using the standard
  28.706 + *  Catmull-Clark algorithm
  28.707 + *
  28.708 + * * Property type: bool. Default value: true.
  28.709 + */
  28.710 +#define AI_CONFIG_IMPORT_AC_EVAL_SUBDIVISION    \
  28.711 +    "IMPORT_AC_EVAL_SUBDIVISION"
  28.712 +
  28.713 +// ---------------------------------------------------------------------------
  28.714 +/** @brief  Configures the UNREAL 3D loader to separate faces with different
  28.715 + *    surface flags (e.g. two-sided vs. single-sided).
  28.716 + *
  28.717 + * * Property type: bool. Default value: true.
  28.718 + */
  28.719 +#define AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS \
  28.720 +    "UNREAL_HANDLE_FLAGS"
  28.721 +
  28.722 +// ---------------------------------------------------------------------------
  28.723 +/** @brief Configures the terragen import plugin to compute uv's for
  28.724 + *  terrains, if not given. Furthermore a default texture is assigned.
  28.725 + *
  28.726 + * UV coordinates for terrains are so simple to compute that you'll usually
  28.727 + * want to compute them on your own, if you need them. This option is intended
  28.728 + * for model viewers which want to offer an easy way to apply textures to
  28.729 + * terrains.
  28.730 + * * Property type: bool. Default value: false.
  28.731 + */
  28.732 +#define AI_CONFIG_IMPORT_TER_MAKE_UVS \
  28.733 +    "IMPORT_TER_MAKE_UVS"
  28.734 +
  28.735 +// ---------------------------------------------------------------------------
  28.736 +/** @brief  Configures the ASE loader to always reconstruct normal vectors
  28.737 + *  basing on the smoothing groups loaded from the file.
  28.738 + *
  28.739 + * Some ASE files have carry invalid normals, other don't.
  28.740 + * * Property type: bool. Default value: true.
  28.741 + */
  28.742 +#define AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS    \
  28.743 +    "IMPORT_ASE_RECONSTRUCT_NORMALS"
  28.744 +
  28.745 +// ---------------------------------------------------------------------------
  28.746 +/** @brief  Configures the M3D loader to detect and process multi-part
  28.747 + *    Quake player models.
  28.748 + *
  28.749 + * These models usually consist of 3 files, lower.md3, upper.md3 and
  28.750 + * head.md3. If this property is set to true, Assimp will try to load and
  28.751 + * combine all three files if one of them is loaded.
  28.752 + * Property type: bool. Default value: true.
  28.753 + */
  28.754 +#define AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART \
  28.755 +    "IMPORT_MD3_HANDLE_MULTIPART"
  28.756 +
  28.757 +// ---------------------------------------------------------------------------
  28.758 +/** @brief  Tells the MD3 loader which skin files to load.
  28.759 + *
  28.760 + * When loading MD3 files, Assimp checks whether a file
  28.761 + * [md3_file_name]_[skin_name].skin is existing. These files are used by
  28.762 + * Quake III to be able to assign different skins (e.g. red and blue team)
  28.763 + * to models. 'default', 'red', 'blue' are typical skin names.
  28.764 + * Property type: String. Default value: "default".
  28.765 + */
  28.766 +#define AI_CONFIG_IMPORT_MD3_SKIN_NAME \
  28.767 +    "IMPORT_MD3_SKIN_NAME"
  28.768 +
  28.769 +// ---------------------------------------------------------------------------
  28.770 +/** @brief  Specify the Quake 3 shader file to be used for a particular
  28.771 + *  MD3 file. This can also be a search path.
  28.772 + *
  28.773 + * By default Assimp's behaviour is as follows: If a MD3 file
  28.774 + * <tt>any_path/models/any_q3_subdir/model_name/file_name.md3</tt> is
  28.775 + * loaded, the library tries to locate the corresponding shader file in
  28.776 + * <tt>any_path/scripts/model_name.shader</tt>. This property overrides this
  28.777 + * behaviour. It can either specify a full path to the shader to be loaded
  28.778 + * or alternatively the path (relative or absolute) to the directory where
  28.779 + * the shaders for all MD3s to be loaded reside. Assimp attempts to open
  28.780 + * <tt>IMPORT_MD3_SHADER_SRC/model_name.shader</tt> first, <tt>IMPORT_MD3_SHADER_SRC/file_name.shader</tt>
  28.781 + * is the fallback file. Note that IMPORT_MD3_SHADER_SRC should have a terminal (back)slash.
  28.782 + * Property type: String. Default value: n/a.
  28.783 + */
  28.784 +#define AI_CONFIG_IMPORT_MD3_SHADER_SRC \
  28.785 +    "IMPORT_MD3_SHADER_SRC"
  28.786 +
  28.787 +// ---------------------------------------------------------------------------
  28.788 +/** @brief  Configures the LWO loader to load just one layer from the model.
  28.789 + *
  28.790 + * LWO files consist of layers and in some cases it could be useful to load
  28.791 + * only one of them. This property can be either a string - which specifies
  28.792 + * the name of the layer - or an integer - the index of the layer. If the
  28.793 + * property is not set the whole LWO model is loaded. Loading fails if the
  28.794 + * requested layer is not available. The layer index is zero-based and the
  28.795 + * layer name may not be empty.<br>
  28.796 + * Property type: Integer. Default value: all layers are loaded.
  28.797 + */
  28.798 +#define AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY         \
  28.799 +    "IMPORT_LWO_ONE_LAYER_ONLY"
  28.800 +
  28.801 +// ---------------------------------------------------------------------------
  28.802 +/** @brief  Configures the MD5 loader to not load the MD5ANIM file for
  28.803 + *  a MD5MESH file automatically.
  28.804 + *
  28.805 + * The default strategy is to look for a file with the same name but the
  28.806 + * MD5ANIM extension in the same directory. If it is found, it is loaded
  28.807 + * and combined with the MD5MESH file. This configuration option can be
  28.808 + * used to disable this behaviour.
  28.809 + *
  28.810 + * * Property type: bool. Default value: false.
  28.811 + */
  28.812 +#define AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD           \
  28.813 +    "IMPORT_MD5_NO_ANIM_AUTOLOAD"
  28.814 +
  28.815 +// ---------------------------------------------------------------------------
  28.816 +/** @brief Defines the begin of the time range for which the LWS loader
  28.817 + *    evaluates animations and computes aiNodeAnim's.
  28.818 + *
  28.819 + * Assimp provides full conversion of LightWave's envelope system, including
  28.820 + * pre and post conditions. The loader computes linearly subsampled animation
  28.821 + * chanels with the frame rate given in the LWS file. This property defines
  28.822 + * the start time. Note: animation channels are only generated if a node
  28.823 + * has at least one envelope with more tan one key assigned. This property.
  28.824 + * is given in frames, '0' is the first frame. By default, if this property
  28.825 + * is not set, the importer takes the animation start from the input LWS
  28.826 + * file ('FirstFrame' line)<br>
  28.827 + * Property type: Integer. Default value: taken from file.
  28.828 + *
  28.829 + * @see AI_CONFIG_IMPORT_LWS_ANIM_END - end of the imported time range
  28.830 + */
  28.831 +#define AI_CONFIG_IMPORT_LWS_ANIM_START         \
  28.832 +    "IMPORT_LWS_ANIM_START"
  28.833 +#define AI_CONFIG_IMPORT_LWS_ANIM_END           \
  28.834 +    "IMPORT_LWS_ANIM_END"
  28.835 +
  28.836 +// ---------------------------------------------------------------------------
  28.837 +/** @brief Defines the output frame rate of the IRR loader.
  28.838 + *
  28.839 + * IRR animations are difficult to convert for Assimp and there will
  28.840 + * always be a loss of quality. This setting defines how many keys per second
  28.841 + * are returned by the converter.<br>
  28.842 + * Property type: integer. Default value: 100
  28.843 + */
  28.844 +#define AI_CONFIG_IMPORT_IRR_ANIM_FPS               \
  28.845 +    "IMPORT_IRR_ANIM_FPS"
  28.846 +
  28.847 +// ---------------------------------------------------------------------------
  28.848 +/** @brief Ogre Importer will try to find referenced materials from this file.
  28.849 + *
  28.850 + * Ogre meshes reference with material names, this does not tell Assimp the file
  28.851 + * where it is located in. Assimp will try to find the source file in the following
  28.852 + * order: <material-name>.material, <mesh-filename-base>.material and
  28.853 + * lastly the material name defined by this config property.
  28.854 + * <br>
  28.855 + * Property type: String. Default value: Scene.material.
  28.856 + */
  28.857 +#define AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE \
  28.858 +    "IMPORT_OGRE_MATERIAL_FILE"
  28.859 +
  28.860 +// ---------------------------------------------------------------------------
  28.861 +/** @brief Ogre Importer detect the texture usage from its filename.
  28.862 + *
  28.863 + * Ogre material texture units do not define texture type, the textures usage
  28.864 + * depends on the used shader or Ogre's fixed pipeline. If this config property
  28.865 + * is true Assimp will try to detect the type from the textures filename postfix:
  28.866 + * _n, _nrm, _nrml, _normal, _normals and _normalmap for normal map, _s, _spec,
  28.867 + * _specular and _specularmap for specular map, _l, _light, _lightmap, _occ
  28.868 + * and _occlusion for light map, _disp and _displacement for displacement map.
  28.869 + * The matching is case insensitive. Post fix is taken between the last
  28.870 + * underscore and the last period.
  28.871 + * Default behavior is to detect type from lower cased texture unit name by
  28.872 + * matching against: normalmap, specularmap, lightmap and displacementmap.
  28.873 + * For both cases if no match is found aiTextureType_DIFFUSE is used.
  28.874 + * <br>
  28.875 + * Property type: Bool. Default value: false.
  28.876 + */
  28.877 +#define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME \
  28.878 +    "IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME"
  28.879 +
  28.880 + /** @brief Specifies whether the Android JNI asset extraction is supported.
  28.881 +  *
  28.882 +  * Turn on this option if you want to manage assets in native
  28.883 +  * Android application without having to keep the internal directory and asset
  28.884 +  * manager pointer.
  28.885 +  */
  28.886 + #define AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT "AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT"
  28.887 +
  28.888 +// ---------------------------------------------------------------------------
  28.889 +/** @brief Specifies whether the IFC loader skips over IfcSpace elements.
  28.890 + *
  28.891 + * IfcSpace elements (and their geometric representations) are used to
  28.892 + * represent, well, free space in a building storey.<br>
  28.893 + * Property type: Bool. Default value: true.
  28.894 + */
  28.895 +#define AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS "IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS"
  28.896 +
  28.897 +// ---------------------------------------------------------------------------
  28.898 +/** @brief Specifies whether the IFC loader will use its own, custom triangulation
  28.899 + *   algorithm to triangulate wall and floor meshes.
  28.900 + *
  28.901 + * If this property is set to false, walls will be either triangulated by
  28.902 + * #aiProcess_Triangulate or will be passed through as huge polygons with
  28.903 + * faked holes (i.e. holes that are connected with the outer boundary using
  28.904 + * a dummy edge). It is highly recommended to set this property to true
  28.905 + * if you want triangulated data because #aiProcess_Triangulate is known to
  28.906 + * have problems with the kind of polygons that the IFC loader spits out for
  28.907 + * complicated meshes.
  28.908 + * Property type: Bool. Default value: true.
  28.909 + */
  28.910 +#define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION"
  28.911 +
  28.912 +// ---------------------------------------------------------------------------
  28.913 +/** @brief  Set the tessellation conic angle for IFC smoothing curves.
  28.914 + *
  28.915 + * This is used by the IFC importer to determine the tessellation parameter
  28.916 + * for smoothing curves.
  28.917 + * @note The default value is AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE and the
  28.918 + * accepted values are in range [5.0, 120.0].
  28.919 + * Property type: Float.
  28.920 + */
  28.921 +#define AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE "IMPORT_IFC_SMOOTHING_ANGLE"
  28.922 +
  28.923 +// default value for AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE
  28.924 +#if (!defined AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE)
  28.925 +#   define AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE 10.0f
  28.926 +#endif
  28.927 +
  28.928 +// ---------------------------------------------------------------------------
  28.929 +/** @brief  Set the tessellation for IFC cylindrical shapes.
  28.930 + *
  28.931 + * This is used by the IFC importer to determine the tessellation parameter
  28.932 + * for cylindrical shapes, i.e. the number of segments used to approximate a circle.
  28.933 + * @note The default value is AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION and the
  28.934 + * accepted values are in range [3, 180].
  28.935 + * Property type: Integer.
  28.936 + */
  28.937 +#define AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION "IMPORT_IFC_CYLINDRICAL_TESSELLATION"
  28.938 +
  28.939 +// default value for AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION
  28.940 +#if (!defined AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION)
  28.941 +#   define AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION 32
  28.942 +#endif
  28.943 +
  28.944 +// ---------------------------------------------------------------------------
  28.945 +/** @brief Specifies whether the Collada loader will ignore the provided up direction.
  28.946 + *
  28.947 + * If this property is set to true, the up direction provided in the file header will
  28.948 + * be ignored and the file will be loaded as is.
  28.949 + * Property type: Bool. Default value: false.
  28.950 + */
  28.951 +#define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION"
  28.952 +
  28.953 +// ---------------------------------------------------------------------------
  28.954 +/** @brief Specifies whether the Collada loader should use Collada names as node names.
  28.955 + *
  28.956 + * If this property is set to true, the Collada names will be used as the
  28.957 + * node name. The default is to use the id tag (resp. sid tag, if no id tag is present)
  28.958 + * instead.
  28.959 + * Property type: Bool. Default value: false.
  28.960 + */
  28.961 +#define AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES "IMPORT_COLLADA_USE_COLLADA_NAMES"
  28.962 +
  28.963 +// ---------- All the Export defines ------------
  28.964 +
  28.965 +/** @brief Specifies the xfile use double for real values of float
  28.966 + *
  28.967 + * Property type: Bool. Default value: false.
  28.968 + */
  28.969 +
  28.970 +#define AI_CONFIG_EXPORT_XFILE_64BIT "EXPORT_XFILE_64BIT"
  28.971 +
  28.972 +/**
  28.973 + *
  28.974 + */
  28.975 +#define AI_CONFIG_EXPORT_POINT_CLOUDS "EXPORT_POINT_CLOUDS"
  28.976 +
  28.977 +/**
  28.978 + *  @brief  Specifies a gobal key factor for scale, float value
  28.979 + */
  28.980 +#define AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY "GLOBAL_SCALE_FACTOR"
  28.981 +
  28.982 +#if (!defined AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT)
  28.983 +#   define AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT  1.0f
  28.984 +#endif // !! AI_DEBONE_THRESHOLD
  28.985 +
  28.986 +// ---------- All the Build/Compile-time defines ------------
  28.987 +
  28.988 +/** @brief Specifies if double precision is supported inside assimp
  28.989 + *
  28.990 + * Property type: Bool. Default value: undefined.
  28.991 + */
  28.992 +
  28.993 +/* #undef ASSIMP_DOUBLE_PRECISION */
  28.994 +
  28.995 +#endif // !! AI_CONFIG_H_INC
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/include/miniassimp/defs.h	Mon Jan 28 18:19:26 2019 +0200
    29.3 @@ -0,0 +1,295 @@
    29.4 +/*
    29.5 +---------------------------------------------------------------------------
    29.6 +Open Asset Import Library (assimp)
    29.7 +---------------------------------------------------------------------------
    29.8 +
    29.9 +Copyright (c) 2006-2018, assimp team
   29.10 +
   29.11 +
   29.12 +
   29.13 +All rights reserved.
   29.14 +
   29.15 +Redistribution and use of this software in source and binary forms,
   29.16 +with or without modification, are permitted provided that the following
   29.17 +conditions are met:
   29.18 +
   29.19 +* Redistributions of source code must retain the above
   29.20 +  copyright notice, this list of conditions and the
   29.21 +  following disclaimer.
   29.22 +
   29.23 +* Redistributions in binary form must reproduce the above
   29.24 +  copyright notice, this list of conditions and the
   29.25 +  following disclaimer in the documentation and/or other
   29.26 +  materials provided with the distribution.
   29.27 +
   29.28 +* Neither the name of the assimp team, nor the names of its
   29.29 +  contributors may be used to endorse or promote products
   29.30 +  derived from this software without specific prior
   29.31 +  written permission of the assimp team.
   29.32 +
   29.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   29.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   29.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   29.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   29.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   29.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   29.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   29.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   29.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   29.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   29.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   29.44 +---------------------------------------------------------------------------
   29.45 +*/
   29.46 +
   29.47 +/** @file defs.h
   29.48 + *  @brief Assimp build configuration setup. See the notes in the comment
   29.49 + *  blocks to find out how to customize _your_ Assimp build.
   29.50 + */
   29.51 +
   29.52 +#pragma once
   29.53 +#ifndef AI_DEFINES_H_INC
   29.54 +#define AI_DEFINES_H_INC
   29.55 +
   29.56 +#include <miniassimp/config.h>
   29.57 +
   29.58 +//////////////////////////////////////////////////////////////////////////
   29.59 +/* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific
   29.60 + * file format loader. The loader is be excluded from the
   29.61 + * build in this case. 'XX' stands for the most common file
   29.62 + * extension of the file format. E.g.:
   29.63 + * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader.
   29.64 + *
   29.65 + * If you're unsure about that, take a look at the implementation of the
   29.66 + * import plugin you wish to disable. You'll find the right define in the
   29.67 + * first lines of the corresponding unit.
   29.68 + *
   29.69 + * Other (mixed) configuration switches are listed here:
   29.70 + *    ASSIMP_BUILD_NO_COMPRESSED_X
   29.71 + *      - Disable support for compressed X files (zip)
   29.72 + *    ASSIMP_BUILD_NO_COMPRESSED_BLEND
   29.73 + *      - Disable support for compressed Blender files (zip)
   29.74 + *    ASSIMP_BUILD_NO_COMPRESSED_IFC
   29.75 + *      - Disable support for IFCZIP files (unzip)
   29.76 + */
   29.77 +//////////////////////////////////////////////////////////////////////////
   29.78 +
   29.79 +#ifndef ASSIMP_BUILD_NO_COMPRESSED_X
   29.80 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
   29.81 +#endif
   29.82 +
   29.83 +#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
   29.84 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
   29.85 +#endif
   29.86 +
   29.87 +#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
   29.88 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
   29.89 +#   define ASSIMP_BUILD_NEED_UNZIP
   29.90 +#endif
   29.91 +
   29.92 +#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
   29.93 +#   define ASSIMP_BUILD_NEED_Z_INFLATE
   29.94 +#   define ASSIMP_BUILD_NEED_UNZIP
   29.95 +#endif
   29.96 +
   29.97 +//////////////////////////////////////////////////////////////////////////
   29.98 +/* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
   29.99 + * post processing step. This is the current list of process names ('XX'):
  29.100 + * CALCTANGENTS
  29.101 + * JOINVERTICES
  29.102 + * TRIANGULATE
  29.103 + * DROPFACENORMALS
  29.104 + * GENFACENORMALS
  29.105 + * GENVERTEXNORMALS
  29.106 + * REMOVEVC
  29.107 + * SPLITLARGEMESHES
  29.108 + * PRETRANSFORMVERTICES
  29.109 + * LIMITBONEWEIGHTS
  29.110 + * VALIDATEDS
  29.111 + * IMPROVECACHELOCALITY
  29.112 + * FIXINFACINGNORMALS
  29.113 + * REMOVE_REDUNDANTMATERIALS
  29.114 + * OPTIMIZEGRAPH
  29.115 + * SORTBYPTYPE
  29.116 + * FINDINVALIDDATA
  29.117 + * TRANSFORMTEXCOORDS
  29.118 + * GENUVCOORDS
  29.119 + * ENTITYMESHBUILDER
  29.120 + * EMBEDTEXTURES
  29.121 + * MAKELEFTHANDED
  29.122 + * FLIPUVS
  29.123 + * FLIPWINDINGORDER
  29.124 + * OPTIMIZEMESHES
  29.125 + * OPTIMIZEANIMS
  29.126 + * OPTIMIZEGRAPH
  29.127 + * GENENTITYMESHES
  29.128 + * FIXTEXTUREPATHS */
  29.129 +//////////////////////////////////////////////////////////////////////////
  29.130 +
  29.131 +#ifdef _MSC_VER
  29.132 +#   undef ASSIMP_API
  29.133 +
  29.134 +    //////////////////////////////////////////////////////////////////////////
  29.135 +    /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
  29.136 +    //////////////////////////////////////////////////////////////////////////
  29.137 +#   ifdef ASSIMP_BUILD_DLL_EXPORT
  29.138 +#       define ASSIMP_API __declspec(dllexport)
  29.139 +#       define ASSIMP_API_WINONLY __declspec(dllexport)
  29.140 +#       pragma warning (disable : 4251)
  29.141 +
  29.142 +    //////////////////////////////////////////////////////////////////////////
  29.143 +    /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
  29.144 +     * an external DLL under Windows. Default is static linkage. */
  29.145 +    //////////////////////////////////////////////////////////////////////////
  29.146 +#   elif (defined ASSIMP_DLL)
  29.147 +#       define ASSIMP_API __declspec(dllimport)
  29.148 +#       define ASSIMP_API_WINONLY __declspec(dllimport)
  29.149 +#   else
  29.150 +#       define ASSIMP_API
  29.151 +#       define ASSIMP_API_WINONLY
  29.152 +#   endif
  29.153 +
  29.154 +    /* Force the compiler to inline a function, if possible
  29.155 +     */
  29.156 +#   define AI_FORCE_INLINE __forceinline
  29.157 +
  29.158 +    /* Tells the compiler that a function never returns. Used in code analysis
  29.159 +     * to skip dead paths (e.g. after an assertion evaluated to false). */
  29.160 +#   define AI_WONT_RETURN __declspec(noreturn)
  29.161 +
  29.162 +#elif defined(SWIG)
  29.163 +
  29.164 +    /* Do nothing, the relevant defines are all in AssimpSwigPort.i */
  29.165 +
  29.166 +#else
  29.167 +
  29.168 +#   define AI_WONT_RETURN
  29.169 +
  29.170 +#   define ASSIMP_API
  29.171 +#   define ASSIMP_API_WINONLY
  29.172 +#   define AI_FORCE_INLINE inline
  29.173 +#endif // (defined _MSC_VER)
  29.174 +
  29.175 +#ifdef __GNUC__
  29.176 +#   define AI_WONT_RETURN_SUFFIX  __attribute__((noreturn))
  29.177 +#else
  29.178 +#   define AI_WONT_RETURN_SUFFIX
  29.179 +#endif // (defined __clang__)
  29.180 +
  29.181 +#ifdef __cplusplus
  29.182 +    /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
  29.183 +     * in doxydocs.
  29.184 +     */
  29.185 +#   define C_STRUCT
  29.186 +#   define C_ENUM
  29.187 +#else
  29.188 +    //////////////////////////////////////////////////////////////////////////
  29.189 +    /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
  29.190 +     * is defined by Doxygen's preprocessor. The corresponding
  29.191 +     * entries in the DOXYFILE are: */
  29.192 +    //////////////////////////////////////////////////////////////////////////
  29.193 +#if 0
  29.194 +    ENABLE_PREPROCESSING   = YES
  29.195 +    MACRO_EXPANSION        = YES
  29.196 +    EXPAND_ONLY_PREDEF     = YES
  29.197 +    SEARCH_INCLUDES        = YES
  29.198 +    INCLUDE_PATH           =
  29.199 +    INCLUDE_FILE_PATTERNS  =
  29.200 +    PREDEFINED             = ASSIMP_DOXYGEN_BUILD=1
  29.201 +    EXPAND_AS_DEFINED      = C_STRUCT C_ENUM
  29.202 +    SKIP_FUNCTION_MACROS   = YES
  29.203 +#endif
  29.204 +    //////////////////////////////////////////////////////////////////////////
  29.205 +    /* Doxygen gets confused if we use c-struct typedefs to avoid
  29.206 +     * the explicit 'struct' notation. This trick here has the same
  29.207 +     * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
  29.208 +     * to typedef all structs/enums. */
  29.209 +     //////////////////////////////////////////////////////////////////////////
  29.210 +#   if (defined ASSIMP_DOXYGEN_BUILD)
  29.211 +#       define C_STRUCT
  29.212 +#       define C_ENUM
  29.213 +#   else
  29.214 +#       define C_STRUCT struct
  29.215 +#       define C_ENUM   enum
  29.216 +#   endif
  29.217 +#endif
  29.218 +
  29.219 +#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
  29.220 +#error Currently, Borland is unsupported. Feel free to port Assimp.
  29.221 +
  29.222 +// "W8059 Packgröße der Struktur geändert"
  29.223 +
  29.224 +#endif
  29.225 +
  29.226 +
  29.227 +    //////////////////////////////////////////////////////////////////////////
  29.228 +    /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
  29.229 +     * without threading support. The library doesn't utilize
  29.230 +     * threads then and is itself not threadsafe. */
  29.231 +    //////////////////////////////////////////////////////////////////////////
  29.232 +#ifndef ASSIMP_BUILD_SINGLETHREADED
  29.233 +#   define ASSIMP_BUILD_SINGLETHREADED
  29.234 +#endif
  29.235 +
  29.236 +#if defined(_DEBUG) || ! defined(NDEBUG)
  29.237 +#   define ASSIMP_BUILD_DEBUG
  29.238 +#endif
  29.239 +
  29.240 +    //////////////////////////////////////////////////////////////////////////
  29.241 +    /* Define ASSIMP_DOUBLE_PRECISION to compile assimp
  29.242 +     * with double precision support (64-bit). */
  29.243 +    //////////////////////////////////////////////////////////////////////////
  29.244 +
  29.245 +#ifdef ASSIMP_DOUBLE_PRECISION
  29.246 +    typedef double ai_real;
  29.247 +    typedef signed long long int ai_int;
  29.248 +    typedef unsigned long long int ai_uint;
  29.249 +#else // ASSIMP_DOUBLE_PRECISION
  29.250 +    typedef float ai_real;
  29.251 +    typedef signed int ai_int;
  29.252 +    typedef unsigned int ai_uint;
  29.253 +#endif // ASSIMP_DOUBLE_PRECISION
  29.254 +
  29.255 +    //////////////////////////////////////////////////////////////////////////
  29.256 +    /* Useful constants */
  29.257 +    //////////////////////////////////////////////////////////////////////////
  29.258 +
  29.259 +/* This is PI. Hi PI. */
  29.260 +#define AI_MATH_PI          (3.141592653589793238462643383279 )
  29.261 +#define AI_MATH_TWO_PI      (AI_MATH_PI * 2.0)
  29.262 +#define AI_MATH_HALF_PI     (AI_MATH_PI * 0.5)
  29.263 +
  29.264 +/* And this is to avoid endless casts to float */
  29.265 +#define AI_MATH_PI_F        (3.1415926538f)
  29.266 +#define AI_MATH_TWO_PI_F    (AI_MATH_PI_F * 2.0f)
  29.267 +#define AI_MATH_HALF_PI_F   (AI_MATH_PI_F * 0.5f)
  29.268 +
  29.269 +/* Tiny macro to convert from radians to degrees and back */
  29.270 +#define AI_DEG_TO_RAD(x) ((x)*(ai_real)0.0174532925)
  29.271 +#define AI_RAD_TO_DEG(x) ((x)*(ai_real)57.2957795)
  29.272 +
  29.273 +/* Support for big-endian builds */
  29.274 +#if defined(__BYTE_ORDER__)
  29.275 +#   if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  29.276 +#       if !defined(__BIG_ENDIAN__)
  29.277 +#           define __BIG_ENDIAN__
  29.278 +#       endif
  29.279 +#   else /* little endian */
  29.280 +#       if defined (__BIG_ENDIAN__)
  29.281 +#           undef __BIG_ENDIAN__
  29.282 +#       endif
  29.283 +#   endif
  29.284 +#endif
  29.285 +#if defined(__BIG_ENDIAN__)
  29.286 +#   define AI_BUILD_BIG_ENDIAN
  29.287 +#endif
  29.288 +
  29.289 +
  29.290 +/* To avoid running out of memory
  29.291 + * This can be adjusted for specific use cases
  29.292 + * It's NOT a total limit, just a limit for individual allocations
  29.293 + */
  29.294 +#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
  29.295 +
  29.296 +#define AI_NO_EXCEPT
  29.297 +
  29.298 +#endif // !! AI_DEFINES_H_INC
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/include/miniassimp/importerdesc.h	Mon Jan 28 18:19:26 2019 +0200
    30.3 @@ -0,0 +1,146 @@
    30.4 +/*
    30.5 +---------------------------------------------------------------------------
    30.6 +Open Asset Import Library (assimp)
    30.7 +---------------------------------------------------------------------------
    30.8 +
    30.9 +Copyright (c) 2006-2018, assimp team
   30.10 +
   30.11 +
   30.12 +
   30.13 +All rights reserved.
   30.14 +
   30.15 +Redistribution and use of this software in source and binary forms,
   30.16 +with or without modification, are permitted provided that the following
   30.17 +conditions are met:
   30.18 +
   30.19 +* Redistributions of source code must retain the above
   30.20 +  copyright notice, this list of conditions and the
   30.21 +  following disclaimer.
   30.22 +
   30.23 +* Redistributions in binary form must reproduce the above
   30.24 +  copyright notice, this list of conditions and the
   30.25 +  following disclaimer in the documentation and/or other
   30.26 +  materials provided with the distribution.
   30.27 +
   30.28 +* Neither the name of the assimp team, nor the names of its
   30.29 +  contributors may be used to endorse or promote products
   30.30 +  derived from this software without specific prior
   30.31 +  written permission of the assimp team.
   30.32 +
   30.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   30.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   30.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   30.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   30.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   30.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   30.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   30.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   30.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   30.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   30.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   30.44 +---------------------------------------------------------------------------
   30.45 +*/
   30.46 +
   30.47 +/** @file importerdesc.h
   30.48 + *  @brief #aiImporterFlags, aiImporterDesc implementation.
   30.49 + */
   30.50 +#pragma once
   30.51 +#ifndef AI_IMPORTER_DESC_H_INC
   30.52 +#define AI_IMPORTER_DESC_H_INC
   30.53 +
   30.54 +
   30.55 +/** Mixed set of flags for #aiImporterDesc, indicating some features
   30.56 +  *  common to many importers*/
   30.57 +enum aiImporterFlags
   30.58 +{
   30.59 +    /** Indicates that there is a textual encoding of the
   30.60 +     *  file format; and that it is supported.*/
   30.61 +    aiImporterFlags_SupportTextFlavour = 0x1,
   30.62 +
   30.63 +    /** Indicates that there is a binary encoding of the
   30.64 +     *  file format; and that it is supported.*/
   30.65 +    aiImporterFlags_SupportBinaryFlavour = 0x2,
   30.66 +
   30.67 +    /** Indicates that there is a compressed encoding of the
   30.68 +     *  file format; and that it is supported.*/
   30.69 +    aiImporterFlags_SupportCompressedFlavour = 0x4,
   30.70 +
   30.71 +    /** Indicates that the importer reads only a very particular
   30.72 +      * subset of the file format. This happens commonly for
   30.73 +      * declarative or procedural formats which cannot easily
   30.74 +      * be mapped to #aiScene */
   30.75 +    aiImporterFlags_LimitedSupport = 0x8,
   30.76 +
   30.77 +    /** Indicates that the importer is highly experimental and
   30.78 +      * should be used with care. This only happens for trunk
   30.79 +      * (i.e. SVN) versions, experimental code is not included
   30.80 +      * in releases. */
   30.81 +    aiImporterFlags_Experimental = 0x10
   30.82 +};
   30.83 +
   30.84 +
   30.85 +/** Meta information about a particular importer. Importers need to fill
   30.86 + *  this structure, but they can freely decide how talkative they are.
   30.87 + *  A common use case for loader meta info is a user interface
   30.88 + *  in which the user can choose between various import/export file
   30.89 + *  formats. Building such an UI by hand means a lot of maintenance
   30.90 + *  as importers/exporters are added to Assimp, so it might be useful
   30.91 + *  to have a common mechanism to query some rough importer
   30.92 + *  characteristics. */
   30.93 +struct aiImporterDesc
   30.94 +{
   30.95 +    /** Full name of the importer (i.e. Blender3D importer)*/
   30.96 +    const char* mName;
   30.97 +
   30.98 +    /** Original author (left blank if unknown or whole assimp team) */
   30.99 +    const char* mAuthor;
  30.100 +
  30.101 +    /** Current maintainer, left blank if the author maintains */
  30.102 +    const char* mMaintainer;
  30.103 +
  30.104 +    /** Implementation comments, i.e. unimplemented features*/
  30.105 +    const char* mComments;
  30.106 +
  30.107 +    /** These flags indicate some characteristics common to many
  30.108 +        importers. */
  30.109 +    unsigned int mFlags;
  30.110 +
  30.111 +    /** Minimum format version that can be loaded im major.minor format,
  30.112 +        both are set to 0 if there is either no version scheme
  30.113 +        or if the loader doesn't care. */
  30.114 +    unsigned int mMinMajor;
  30.115 +    unsigned int mMinMinor;
  30.116 +
  30.117 +    /** Maximum format version that can be loaded im major.minor format,
  30.118 +        both are set to 0 if there is either no version scheme
  30.119 +        or if the loader doesn't care. Loaders that expect to be
  30.120 +        forward-compatible to potential future format versions should
  30.121 +        indicate  zero, otherwise they should specify the current
  30.122 +        maximum version.*/
  30.123 +    unsigned int mMaxMajor;
  30.124 +    unsigned int mMaxMinor;
  30.125 +
  30.126 +    /** List of file extensions this importer can handle.
  30.127 +        List entries are separated by space characters.
  30.128 +        All entries are lower case without a leading dot (i.e.
  30.129 +        "xml dae" would be a valid value. Note that multiple
  30.130 +        importers may respond to the same file extension -
  30.131 +        assimp calls all importers in the order in which they
  30.132 +        are registered and each importer gets the opportunity
  30.133 +        to load the file until one importer "claims" the file. Apart
  30.134 +        from file extension checks, importers typically use
  30.135 +        other methods to quickly reject files (i.e. magic
  30.136 +        words) so this does not mean that common or generic
  30.137 +        file extensions such as XML would be tediously slow. */
  30.138 +    const char* mFileExtensions;
  30.139 +};
  30.140 +
  30.141 +/** \brief  Returns the Importer description for a given extension.
  30.142 +
  30.143 +Will return a NULL-pointer if no assigned importer desc. was found for the given extension
  30.144 +    \param  extension   [in] The extension to look for
  30.145 +    \return A pointer showing to the ImporterDesc, \see aiImporterDesc.
  30.146 +*/
  30.147 +ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension );
  30.148 +
  30.149 +#endif // AI_IMPORTER_DESC_H_INC
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/include/miniassimp/light.h	Mon Jan 28 18:19:26 2019 +0200
    31.3 @@ -0,0 +1,259 @@
    31.4 +/*
    31.5 +---------------------------------------------------------------------------
    31.6 +Open Asset Import Library (assimp)
    31.7 +---------------------------------------------------------------------------
    31.8 +
    31.9 +Copyright (c) 2006-2018, assimp team
   31.10 +
   31.11 +
   31.12 +
   31.13 +All rights reserved.
   31.14 +
   31.15 +Redistribution and use of this software in source and binary forms,
   31.16 +with or without modification, are permitted provided that the following
   31.17 +conditions are met:
   31.18 +
   31.19 +* Redistributions of source code must retain the above
   31.20 +  copyright notice, this list of conditions and the
   31.21 +  following disclaimer.
   31.22 +
   31.23 +* Redistributions in binary form must reproduce the above
   31.24 +  copyright notice, this list of conditions and the
   31.25 +  following disclaimer in the documentation and/or other
   31.26 +  materials provided with the distribution.
   31.27 +
   31.28 +* Neither the name of the assimp team, nor the names of its
   31.29 +  contributors may be used to endorse or promote products
   31.30 +  derived from this software without specific prior
   31.31 +  written permission of the assimp team.
   31.32 +
   31.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   31.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   31.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   31.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   31.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   31.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   31.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   31.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   31.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   31.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   31.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   31.44 +---------------------------------------------------------------------------
   31.45 +*/
   31.46 +
   31.47 +/** @file light.h
   31.48 + *  @brief Defines the aiLight data structure
   31.49 + */
   31.50 +
   31.51 +#pragma once
   31.52 +#ifndef AI_LIGHT_H_INC
   31.53 +#define AI_LIGHT_H_INC
   31.54 +
   31.55 +#include "types.h"
   31.56 +
   31.57 +#ifdef __cplusplus
   31.58 +extern "C" {
   31.59 +#endif
   31.60 +
   31.61 +// ---------------------------------------------------------------------------
   31.62 +/** Enumerates all supported types of light sources.
   31.63 + */
   31.64 +enum aiLightSourceType
   31.65 +{
   31.66 +    aiLightSource_UNDEFINED     = 0x0,
   31.67 +
   31.68 +    //! A directional light source has a well-defined direction
   31.69 +    //! but is infinitely far away. That's quite a good
   31.70 +    //! approximation for sun light.
   31.71 +    aiLightSource_DIRECTIONAL   = 0x1,
   31.72 +
   31.73 +    //! A point light source has a well-defined position
   31.74 +    //! in space but no direction - it emits light in all
   31.75 +    //! directions. A normal bulb is a point light.
   31.76 +    aiLightSource_POINT         = 0x2,
   31.77 +
   31.78 +    //! A spot light source emits light in a specific
   31.79 +    //! angle. It has a position and a direction it is pointing to.
   31.80 +    //! A good example for a spot light is a light spot in
   31.81 +    //! sport arenas.
   31.82 +    aiLightSource_SPOT          = 0x3,
   31.83 +
   31.84 +    //! The generic light level of the world, including the bounces
   31.85 +    //! of all other light sources.
   31.86 +    //! Typically, there's at most one ambient light in a scene.
   31.87 +    //! This light type doesn't have a valid position, direction, or
   31.88 +    //! other properties, just a color.
   31.89 +    aiLightSource_AMBIENT       = 0x4,
   31.90 +
   31.91 +    //! An area light is a rectangle with predefined size that uniformly
   31.92 +    //! emits light from one of its sides. The position is center of the
   31.93 +    //! rectangle and direction is its normal vector.
   31.94 +    aiLightSource_AREA          = 0x5,
   31.95 +
   31.96 +    /** This value is not used. It is just there to force the
   31.97 +     *  compiler to map this enum to a 32 Bit integer.
   31.98 +     */
   31.99 +#ifndef SWIG
  31.100 +    _aiLightSource_Force32Bit = INT_MAX
  31.101 +#endif
  31.102 +};
  31.103 +
  31.104 +// ---------------------------------------------------------------------------
  31.105 +/** Helper structure to describe a light source.
  31.106 + *
  31.107 + *  Assimp supports multiple sorts of light sources, including
  31.108 + *  directional, point and spot lights. All of them are defined with just
  31.109 + *  a single structure and distinguished by their parameters.
  31.110 + *  Note - some file formats (such as 3DS, ASE) export a "target point" -
  31.111 + *  the point a spot light is looking at (it can even be animated). Assimp
  31.112 + *  writes the target point as a subnode of a spotlights's main node,
  31.113 + *  called "<spotName>.Target". However, this is just additional information
  31.114 + *  then, the transformation tracks of the main node make the
  31.115 + *  spot light already point in the right direction.
  31.116 +*/
  31.117 +struct aiLight
  31.118 +{
  31.119 +    /** The name of the light source.
  31.120 +     *
  31.121 +     *  There must be a node in the scenegraph with the same name.
  31.122 +     *  This node specifies the position of the light in the scene
  31.123 +     *  hierarchy and can be animated.
  31.124 +     */
  31.125 +    C_STRUCT aiString mName;
  31.126 +
  31.127 +    /** The type of the light source.
  31.128 +     *
  31.129 +     * aiLightSource_UNDEFINED is not a valid value for this member.
  31.130 +     */
  31.131 +    C_ENUM aiLightSourceType mType;
  31.132 +
  31.133 +    /** Position of the light source in space. Relative to the
  31.134 +     *  transformation of the node corresponding to the light.
  31.135 +     *
  31.136 +     *  The position is undefined for directional lights.
  31.137 +     */
  31.138 +    C_STRUCT aiVector3D mPosition;
  31.139 +
  31.140 +    /** Direction of the light source in space. Relative to the
  31.141 +     *  transformation of the node corresponding to the light.
  31.142 +     *
  31.143 +     *  The direction is undefined for point lights. The vector
  31.144 +     *  may be normalized, but it needn't.
  31.145 +     */
  31.146 +    C_STRUCT aiVector3D mDirection;
  31.147 +
  31.148 +    /** Up direction of the light source in space. Relative to the
  31.149 +     *  transformation of the node corresponding to the light.
  31.150 +     *
  31.151 +     *  The direction is undefined for point lights. The vector
  31.152 +     *  may be normalized, but it needn't.
  31.153 +     */
  31.154 +    C_STRUCT aiVector3D mUp;
  31.155 +
  31.156 +    /** Constant light attenuation factor.
  31.157 +     *
  31.158 +     *  The intensity of the light source at a given distance 'd' from
  31.159 +     *  the light's position is
  31.160 +     *  @code
  31.161 +     *  Atten = 1/( att0 + att1 * d + att2 * d*d)
  31.162 +     *  @endcode
  31.163 +     *  This member corresponds to the att0 variable in the equation.
  31.164 +     *  Naturally undefined for directional lights.
  31.165 +     */
  31.166 +    float mAttenuationConstant;
  31.167 +
  31.168 +    /** Linear light attenuation factor.
  31.169 +     *
  31.170 +     *  The intensity of the light source at a given distance 'd' from
  31.171 +     *  the light's position is
  31.172 +     *  @code
  31.173 +     *  Atten = 1/( att0 + att1 * d + att2 * d*d)
  31.174 +     *  @endcode
  31.175 +     *  This member corresponds to the att1 variable in the equation.
  31.176 +     *  Naturally undefined for directional lights.
  31.177 +     */
  31.178 +    float mAttenuationLinear;
  31.179 +
  31.180 +    /** Quadratic light attenuation factor.
  31.181 +     *
  31.182 +     *  The intensity of the light source at a given distance 'd' from
  31.183 +     *  the light's position is
  31.184 +     *  @code
  31.185 +     *  Atten = 1/( att0 + att1 * d + att2 * d*d)
  31.186 +     *  @endcode
  31.187 +     *  This member corresponds to the att2 variable in the equation.
  31.188 +     *  Naturally undefined for directional lights.
  31.189 +     */
  31.190 +    float mAttenuationQuadratic;
  31.191 +
  31.192 +    /** Diffuse color of the light source
  31.193 +     *
  31.194 +     *  The diffuse light color is multiplied with the diffuse
  31.195 +     *  material color to obtain the final color that contributes
  31.196 +     *  to the diffuse shading term.
  31.197 +     */
  31.198 +    C_STRUCT aiColor3D mColorDiffuse;
  31.199 +
  31.200 +    /** Specular color of the light source
  31.201 +     *
  31.202 +     *  The specular light color is multiplied with the specular
  31.203 +     *  material color to obtain the final color that contributes
  31.204 +     *  to the specular shading term.
  31.205 +     */
  31.206 +    C_STRUCT aiColor3D mColorSpecular;
  31.207 +
  31.208 +    /** Ambient color of the light source
  31.209 +     *
  31.210 +     *  The ambient light color is multiplied with the ambient
  31.211 +     *  material color to obtain the final color that contributes
  31.212 +     *  to the ambient shading term. Most renderers will ignore
  31.213 +     *  this value it, is just a remaining of the fixed-function pipeline
  31.214 +     *  that is still supported by quite many file formats.
  31.215 +     */
  31.216 +    C_STRUCT aiColor3D mColorAmbient;
  31.217 +
  31.218 +    /** Inner angle of a spot light's light cone.
  31.219 +     *
  31.220 +     *  The spot light has maximum influence on objects inside this
  31.221 +     *  angle. The angle is given in radians. It is 2PI for point
  31.222 +     *  lights and undefined for directional lights.
  31.223 +     */
  31.224 +    float mAngleInnerCone;
  31.225 +
  31.226 +    /** Outer angle of a spot light's light cone.
  31.227 +     *
  31.228 +     *  The spot light does not affect objects outside this angle.
  31.229 +     *  The angle is given in radians. It is 2PI for point lights and
  31.230 +     *  undefined for directional lights. The outer angle must be
  31.231 +     *  greater than or equal to the inner angle.
  31.232 +     *  It is assumed that the application uses a smooth
  31.233 +     *  interpolation between the inner and the outer cone of the
  31.234 +     *  spot light.
  31.235 +     */
  31.236 +    float mAngleOuterCone;
  31.237 +
  31.238 +    /** Size of area light source. */
  31.239 +    C_STRUCT aiVector2D mSize;
  31.240 +
  31.241 +#ifdef __cplusplus
  31.242 +
  31.243 +    aiLight() AI_NO_EXCEPT
  31.244 +        :   mType                 (aiLightSource_UNDEFINED)
  31.245 +        ,   mAttenuationConstant  (0.f)
  31.246 +        ,   mAttenuationLinear    (1.f)
  31.247 +        ,   mAttenuationQuadratic (0.f)
  31.248 +        ,   mAngleInnerCone       ((float)AI_MATH_TWO_PI)
  31.249 +        ,   mAngleOuterCone       ((float)AI_MATH_TWO_PI)
  31.250 +        ,   mSize                 (0.f, 0.f)
  31.251 +    {
  31.252 +    }
  31.253 +
  31.254 +#endif
  31.255 +};
  31.256 +
  31.257 +#ifdef __cplusplus
  31.258 +}
  31.259 +#endif 
  31.260 +
  31.261 +
  31.262 +#endif // !! AI_LIGHT_H_INC
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/include/miniassimp/material.h	Mon Jan 28 18:19:26 2019 +0200
    32.3 @@ -0,0 +1,1576 @@
    32.4 +/*
    32.5 +---------------------------------------------------------------------------
    32.6 +Open Asset Import Library (assimp)
    32.7 +---------------------------------------------------------------------------
    32.8 +
    32.9 +Copyright (c) 2006-2018, assimp team
   32.10 +
   32.11 +
   32.12 +
   32.13 +All rights reserved.
   32.14 +
   32.15 +Redistribution and use of this software in source and binary forms,
   32.16 +with or without modification, are permitted provided that the following
   32.17 +conditions are met:
   32.18 +
   32.19 +* Redistributions of source code must retain the above
   32.20 +  copyright notice, this list of conditions and the
   32.21 +  following disclaimer.
   32.22 +
   32.23 +* Redistributions in binary form must reproduce the above
   32.24 +  copyright notice, this list of conditions and the
   32.25 +  following disclaimer in the documentation and/or other
   32.26 +  materials provided with the distribution.
   32.27 +
   32.28 +* Neither the name of the assimp team, nor the names of its
   32.29 +  contributors may be used to endorse or promote products
   32.30 +  derived from this software without specific prior
   32.31 +  written permission of the assimp team.
   32.32 +
   32.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   32.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   32.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   32.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   32.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   32.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   32.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   32.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   32.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   32.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   32.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   32.44 +---------------------------------------------------------------------------
   32.45 +*/
   32.46 +
   32.47 +/** @file material.h
   32.48 + *  @brief Defines the material system of the library
   32.49 + */
   32.50 +#pragma once
   32.51 +#ifndef AI_MATERIAL_H_INC
   32.52 +#define AI_MATERIAL_H_INC
   32.53 +
   32.54 +#include "types.h"
   32.55 +
   32.56 +#ifdef __cplusplus
   32.57 +extern "C" {
   32.58 +#endif
   32.59 +
   32.60 +// Name for default materials (2nd is used if meshes have UV coords)
   32.61 +#define AI_DEFAULT_MATERIAL_NAME          "DefaultMaterial"
   32.62 +
   32.63 +// ---------------------------------------------------------------------------
   32.64 +/** @brief Defines how the Nth texture of a specific type is combined with
   32.65 + *  the result of all previous layers.
   32.66 + *
   32.67 + *  Example (left: key, right: value): <br>
   32.68 + *  @code
   32.69 + *  DiffColor0     - gray
   32.70 + *  DiffTextureOp0 - aiTextureOpMultiply
   32.71 + *  DiffTexture0   - tex1.png
   32.72 + *  DiffTextureOp0 - aiTextureOpAdd
   32.73 + *  DiffTexture1   - tex2.png
   32.74 + *  @endcode
   32.75 + *  Written as equation, the final diffuse term for a specific pixel would be:
   32.76 + *  @code
   32.77 + *  diffFinal = DiffColor0 * sampleTex(DiffTexture0,UV0) +
   32.78 + *     sampleTex(DiffTexture1,UV0) * diffContrib;
   32.79 + *  @endcode
   32.80 + *  where 'diffContrib' is the intensity of the incoming light for that pixel.
   32.81 + */
   32.82 +enum aiTextureOp
   32.83 +{
   32.84 +    /** T = T1 * T2 */
   32.85 +    aiTextureOp_Multiply = 0x0,
   32.86 +
   32.87 +    /** T = T1 + T2 */
   32.88 +    aiTextureOp_Add = 0x1,
   32.89 +
   32.90 +    /** T = T1 - T2 */
   32.91 +    aiTextureOp_Subtract = 0x2,
   32.92 +
   32.93 +    /** T = T1 / T2 */
   32.94 +    aiTextureOp_Divide = 0x3,
   32.95 +
   32.96 +    /** T = (T1 + T2) - (T1 * T2) */
   32.97 +    aiTextureOp_SmoothAdd = 0x4,
   32.98 +
   32.99 +    /** T = T1 + (T2-0.5) */
  32.100 +    aiTextureOp_SignedAdd = 0x5,
  32.101 +
  32.102 +
  32.103 +#ifndef SWIG
  32.104 +    _aiTextureOp_Force32Bit = INT_MAX
  32.105 +#endif
  32.106 +};
  32.107 +
  32.108 +// ---------------------------------------------------------------------------
  32.109 +/** @brief Defines how UV coordinates outside the [0...1] range are handled.
  32.110 + *
  32.111 + *  Commonly referred to as 'wrapping mode'.
  32.112 + */
  32.113 +enum aiTextureMapMode
  32.114 +{
  32.115 +    /** A texture coordinate u|v is translated to u%1|v%1
  32.116 +     */
  32.117 +    aiTextureMapMode_Wrap = 0x0,
  32.118 +
  32.119 +    /** Texture coordinates outside [0...1]
  32.120 +     *  are clamped to the nearest valid value.
  32.121 +     */
  32.122 +    aiTextureMapMode_Clamp = 0x1,
  32.123 +
  32.124 +    /** If the texture coordinates for a pixel are outside [0...1]
  32.125 +     *  the texture is not applied to that pixel
  32.126 +     */
  32.127 +    aiTextureMapMode_Decal = 0x3,
  32.128 +
  32.129 +    /** A texture coordinate u|v becomes u%1|v%1 if (u-(u%1))%2 is zero and
  32.130 +     *  1-(u%1)|1-(v%1) otherwise
  32.131 +     */
  32.132 +    aiTextureMapMode_Mirror = 0x2,
  32.133 +
  32.134 +#ifndef SWIG
  32.135 +    _aiTextureMapMode_Force32Bit = INT_MAX
  32.136 +#endif
  32.137 +};
  32.138 +
  32.139 +// ---------------------------------------------------------------------------
  32.140 +/** @brief Defines how the mapping coords for a texture are generated.
  32.141 + *
  32.142 + *  Real-time applications typically require full UV coordinates, so the use of
  32.143 + *  the aiProcess_GenUVCoords step is highly recommended. It generates proper
  32.144 + *  UV channels for non-UV mapped objects, as long as an accurate description
  32.145 + *  how the mapping should look like (e.g spherical) is given.
  32.146 + *  See the #AI_MATKEY_MAPPING property for more details.
  32.147 + */
  32.148 +enum aiTextureMapping
  32.149 +{
  32.150 +    /** The mapping coordinates are taken from an UV channel.
  32.151 +     *
  32.152 +     *  The #AI_MATKEY_UVWSRC key specifies from which UV channel
  32.153 +     *  the texture coordinates are to be taken from (remember,
  32.154 +     *  meshes can have more than one UV channel).
  32.155 +    */
  32.156 +    aiTextureMapping_UV = 0x0,
  32.157 +
  32.158 +     /** Spherical mapping */
  32.159 +    aiTextureMapping_SPHERE = 0x1,
  32.160 +
  32.161 +     /** Cylindrical mapping */
  32.162 +    aiTextureMapping_CYLINDER = 0x2,
  32.163 +
  32.164 +     /** Cubic mapping */
  32.165 +    aiTextureMapping_BOX = 0x3,
  32.166 +
  32.167 +     /** Planar mapping */
  32.168 +    aiTextureMapping_PLANE = 0x4,
  32.169 +
  32.170 +     /** Undefined mapping. Have fun. */
  32.171 +    aiTextureMapping_OTHER = 0x5,
  32.172 +
  32.173 +
  32.174 +#ifndef SWIG
  32.175 +    _aiTextureMapping_Force32Bit = INT_MAX
  32.176 +#endif
  32.177 +};
  32.178 +
  32.179 +// ---------------------------------------------------------------------------
  32.180 +/** @brief Defines the purpose of a texture
  32.181 + *
  32.182 + *  This is a very difficult topic. Different 3D packages support different
  32.183 + *  kinds of textures. For very common texture types, such as bumpmaps, the
  32.184 + *  rendering results depend on implementation details in the rendering
  32.185 + *  pipelines of these applications. Assimp loads all texture references from
  32.186 + *  the model file and tries to determine which of the predefined texture
  32.187 + *  types below is the best choice to match the original use of the texture
  32.188 + *  as closely as possible.<br>
  32.189 + *
  32.190 + *  In content pipelines you'll usually define how textures have to be handled,
  32.191 + *  and the artists working on models have to conform to this specification,
  32.192 + *  regardless which 3D tool they're using.
  32.193 + */
  32.194 +enum aiTextureType
  32.195 +{
  32.196 +    /** Dummy value.
  32.197 +     *
  32.198 +     *  No texture, but the value to be used as 'texture semantic'
  32.199 +     *  (#aiMaterialProperty::mSemantic) for all material properties
  32.200 +     *  *not* related to textures.
  32.201 +     */
  32.202 +    aiTextureType_NONE = 0x0,
  32.203 +
  32.204 +
  32.205 +
  32.206 +    /** The texture is combined with the result of the diffuse
  32.207 +     *  lighting equation.
  32.208 +     */
  32.209 +    aiTextureType_DIFFUSE = 0x1,
  32.210 +
  32.211 +    /** The texture is combined with the result of the specular
  32.212 +     *  lighting equation.
  32.213 +     */
  32.214 +    aiTextureType_SPECULAR = 0x2,
  32.215 +
  32.216 +    /** The texture is combined with the result of the ambient
  32.217 +     *  lighting equation.
  32.218 +     */
  32.219 +    aiTextureType_AMBIENT = 0x3,
  32.220 +
  32.221 +    /** The texture is added to the result of the lighting
  32.222 +     *  calculation. It isn't influenced by incoming light.
  32.223 +     */
  32.224 +    aiTextureType_EMISSIVE = 0x4,
  32.225 +
  32.226 +    /** The texture is a height map.
  32.227 +     *
  32.228 +     *  By convention, higher gray-scale values stand for
  32.229 +     *  higher elevations from the base height.
  32.230 +     */
  32.231 +    aiTextureType_HEIGHT = 0x5,
  32.232 +
  32.233 +    /** The texture is a (tangent space) normal-map.
  32.234 +     *
  32.235 +     *  Again, there are several conventions for tangent-space
  32.236 +     *  normal maps. Assimp does (intentionally) not
  32.237 +     *  distinguish here.
  32.238 +     */
  32.239 +    aiTextureType_NORMALS = 0x6,
  32.240 +
  32.241 +    /** The texture defines the glossiness of the material.
  32.242 +     *
  32.243 +     *  The glossiness is in fact the exponent of the specular
  32.244 +     *  (phong) lighting equation. Usually there is a conversion
  32.245 +     *  function defined to map the linear color values in the
  32.246 +     *  texture to a suitable exponent. Have fun.
  32.247 +    */
  32.248 +    aiTextureType_SHININESS = 0x7,
  32.249 +
  32.250 +    /** The texture defines per-pixel opacity.
  32.251 +     *
  32.252 +     *  Usually 'white' means opaque and 'black' means
  32.253 +     *  'transparency'. Or quite the opposite. Have fun.
  32.254 +    */
  32.255 +    aiTextureType_OPACITY = 0x8,
  32.256 +
  32.257 +    /** Displacement texture
  32.258 +     *
  32.259 +     *  The exact purpose and format is application-dependent.
  32.260 +     *  Higher color values stand for higher vertex displacements.
  32.261 +    */
  32.262 +    aiTextureType_DISPLACEMENT = 0x9,
  32.263 +
  32.264 +    /** Lightmap texture (aka Ambient Occlusion)
  32.265 +     *
  32.266 +     *  Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
  32.267 +     *  covered by this material property. The texture contains a
  32.268 +     *  scaling value for the final color value of a pixel. Its
  32.269 +     *  intensity is not affected by incoming light.
  32.270 +    */
  32.271 +    aiTextureType_LIGHTMAP = 0xA,
  32.272 +
  32.273 +    /** Reflection texture
  32.274 +     *
  32.275 +     * Contains the color of a perfect mirror reflection.
  32.276 +     * Rarely used, almost never for real-time applications.
  32.277 +    */
  32.278 +    aiTextureType_REFLECTION = 0xB,
  32.279 +
  32.280 +    /** Unknown texture
  32.281 +     *
  32.282 +     *  A texture reference that does not match any of the definitions
  32.283 +     *  above is considered to be 'unknown'. It is still imported,
  32.284 +     *  but is excluded from any further postprocessing.
  32.285 +    */
  32.286 +    aiTextureType_UNKNOWN = 0xC,
  32.287 +
  32.288 +
  32.289 +#ifndef SWIG
  32.290 +    _aiTextureType_Force32Bit = INT_MAX
  32.291 +#endif
  32.292 +};
  32.293 +
  32.294 +#define AI_TEXTURE_TYPE_MAX  aiTextureType_UNKNOWN
  32.295 +
  32.296 +// ---------------------------------------------------------------------------
  32.297 +/** @brief Defines all shading models supported by the library
  32.298 + *
  32.299 + *  The list of shading modes has been taken from Blender.
  32.300 + *  See Blender documentation for more information. The API does
  32.301 + *  not distinguish between "specular" and "diffuse" shaders (thus the
  32.302 + *  specular term for diffuse shading models like Oren-Nayar remains
  32.303 + *  undefined). <br>
  32.304 + *  Again, this value is just a hint. Assimp tries to select the shader whose
  32.305 + *  most common implementation matches the original rendering results of the
  32.306 + *  3D modeller which wrote a particular model as closely as possible.
  32.307 + */
  32.308 +enum aiShadingMode
  32.309 +{
  32.310 +    /** Flat shading. Shading is done on per-face base,
  32.311 +     *  diffuse only. Also known as 'faceted shading'.
  32.312 +     */
  32.313 +    aiShadingMode_Flat = 0x1,
  32.314 +
  32.315 +    /** Simple Gouraud shading.
  32.316 +     */
  32.317 +    aiShadingMode_Gouraud = 0x2,
  32.318 +
  32.319 +    /** Phong-Shading -
  32.320 +     */
  32.321 +    aiShadingMode_Phong = 0x3,
  32.322 +
  32.323 +    /** Phong-Blinn-Shading
  32.324 +     */
  32.325 +    aiShadingMode_Blinn = 0x4,
  32.326 +
  32.327 +    /** Toon-Shading per pixel
  32.328 +     *
  32.329 +     *  Also known as 'comic' shader.
  32.330 +     */
  32.331 +    aiShadingMode_Toon = 0x5,
  32.332 +
  32.333 +    /** OrenNayar-Shading per pixel
  32.334 +     *
  32.335 +     *  Extension to standard Lambertian shading, taking the
  32.336 +     *  roughness of the material into account
  32.337 +     */
  32.338 +    aiShadingMode_OrenNayar = 0x6,
  32.339 +
  32.340 +    /** Minnaert-Shading per pixel
  32.341 +     *
  32.342 +     *  Extension to standard Lambertian shading, taking the
  32.343 +     *  "darkness" of the material into account
  32.344 +     */
  32.345 +    aiShadingMode_Minnaert = 0x7,
  32.346 +
  32.347 +    /** CookTorrance-Shading per pixel
  32.348 +     *
  32.349 +     *  Special shader for metallic surfaces.
  32.350 +     */
  32.351 +    aiShadingMode_CookTorrance = 0x8,
  32.352 +
  32.353 +    /** No shading at all. Constant light influence of 1.0.
  32.354 +    */
  32.355 +    aiShadingMode_NoShading = 0x9,
  32.356 +
  32.357 +     /** Fresnel shading
  32.358 +     */
  32.359 +    aiShadingMode_Fresnel = 0xa,
  32.360 +
  32.361 +
  32.362 +#ifndef SWIG
  32.363 +    _aiShadingMode_Force32Bit = INT_MAX
  32.364 +#endif
  32.365 +};
  32.366 +
  32.367 +
  32.368 +// ---------------------------------------------------------------------------
  32.369 +/** @brief Defines some mixed flags for a particular texture.
  32.370 + *
  32.371 + *  Usually you'll instruct your cg artists how textures have to look like ...
  32.372 + *  and how they will be processed in your application. However, if you use
  32.373 + *  Assimp for completely generic loading purposes you might also need to
  32.374 + *  process these flags in order to display as many 'unknown' 3D models as
  32.375 + *  possible correctly.
  32.376 + *
  32.377 + *  This corresponds to the #AI_MATKEY_TEXFLAGS property.
  32.378 +*/
  32.379 +enum aiTextureFlags
  32.380 +{
  32.381 +    /** The texture's color values have to be inverted (componentwise 1-n)
  32.382 +     */
  32.383 +    aiTextureFlags_Invert = 0x1,
  32.384 +
  32.385 +    /** Explicit request to the application to process the alpha channel
  32.386 +     *  of the texture.
  32.387 +     *
  32.388 +     *  Mutually exclusive with #aiTextureFlags_IgnoreAlpha. These
  32.389 +     *  flags are set if the library can say for sure that the alpha
  32.390 +     *  channel is used/is not used. If the model format does not
  32.391 +     *  define this, it is left to the application to decide whether
  32.392 +     *  the texture alpha channel - if any - is evaluated or not.
  32.393 +     */
  32.394 +    aiTextureFlags_UseAlpha = 0x2,
  32.395 +
  32.396 +    /** Explicit request to the application to ignore the alpha channel
  32.397 +     *  of the texture.
  32.398 +     *
  32.399 +     *  Mutually exclusive with #aiTextureFlags_UseAlpha.
  32.400 +     */
  32.401 +    aiTextureFlags_IgnoreAlpha = 0x4,
  32.402 +
  32.403 +#ifndef SWIG
  32.404 +      _aiTextureFlags_Force32Bit = INT_MAX
  32.405 +#endif
  32.406 +};
  32.407 +
  32.408 +
  32.409 +// ---------------------------------------------------------------------------
  32.410 +/** @brief Defines alpha-blend flags.
  32.411 + *
  32.412 + *  If you're familiar with OpenGL or D3D, these flags aren't new to you.
  32.413 + *  They define *how* the final color value of a pixel is computed, basing
  32.414 + *  on the previous color at that pixel and the new color value from the
  32.415 + *  material.
  32.416 + *  The blend formula is:
  32.417 + *  @code
  32.418 + *    SourceColor * SourceBlend + DestColor * DestBlend
  32.419 + *  @endcode
  32.420 + *  where DestColor is the previous color in the framebuffer at this
  32.421 + *  position and SourceColor is the material color before the transparency
  32.422 + *  calculation.<br>
  32.423 + *  This corresponds to the #AI_MATKEY_BLEND_FUNC property.
  32.424 +*/
  32.425 +enum aiBlendMode
  32.426 +{
  32.427 +    /**
  32.428 +     *  Formula:
  32.429 +     *  @code
  32.430 +     *  SourceColor*SourceAlpha + DestColor*(1-SourceAlpha)
  32.431 +     *  @endcode
  32.432 +     */
  32.433 +    aiBlendMode_Default = 0x0,
  32.434 +
  32.435 +    /** Additive blending
  32.436 +     *
  32.437 +     *  Formula:
  32.438 +     *  @code
  32.439 +     *  SourceColor*1 + DestColor*1
  32.440 +     *  @endcode
  32.441 +     */
  32.442 +    aiBlendMode_Additive = 0x1,
  32.443 +
  32.444 +    // we don't need more for the moment, but we might need them
  32.445 +    // in future versions ...
  32.446 +
  32.447 +#ifndef SWIG
  32.448 +    _aiBlendMode_Force32Bit = INT_MAX
  32.449 +#endif
  32.450 +};
  32.451 +
  32.452 +
  32.453 +#include "./Compiler/pushpack1.h"
  32.454 +
  32.455 +// ---------------------------------------------------------------------------
  32.456 +/** @brief Defines how an UV channel is transformed.
  32.457 + *
  32.458 + *  This is just a helper structure for the #AI_MATKEY_UVTRANSFORM key.
  32.459 + *  See its documentation for more details.
  32.460 + *
  32.461 + *  Typically you'll want to build a matrix of this information. However,
  32.462 + *  we keep separate scaling/translation/rotation values to make it
  32.463 + *  easier to process and optimize UV transformations internally.
  32.464 + */
  32.465 +struct aiUVTransform
  32.466 +{
  32.467 +    /** Translation on the u and v axes.
  32.468 +     *
  32.469 +     *  The default value is (0|0).
  32.470 +     */
  32.471 +    C_STRUCT aiVector2D mTranslation;
  32.472 +
  32.473 +    /** Scaling on the u and v axes.
  32.474 +     *
  32.475 +     *  The default value is (1|1).
  32.476 +     */
  32.477 +    C_STRUCT aiVector2D mScaling;
  32.478 +
  32.479 +    /** Rotation - in counter-clockwise direction.
  32.480 +     *
  32.481 +     *  The rotation angle is specified in radians. The
  32.482 +     *  rotation center is 0.5f|0.5f. The default value
  32.483 +     *  0.f.
  32.484 +     */
  32.485 +    ai_real mRotation;
  32.486 +
  32.487 +
  32.488 +#ifdef __cplusplus
  32.489 +    aiUVTransform() AI_NO_EXCEPT
  32.490 +        :   mTranslation (0.0,0.0)
  32.491 +        ,   mScaling    (1.0,1.0)
  32.492 +        ,   mRotation   (0.0)
  32.493 +    {
  32.494 +        // nothing to be done here ...
  32.495 +    }
  32.496 +#endif
  32.497 +
  32.498 +};
  32.499 +
  32.500 +#include "./Compiler/poppack1.h"
  32.501 +
  32.502 +//! @cond AI_DOX_INCLUDE_INTERNAL
  32.503 +// ---------------------------------------------------------------------------
  32.504 +/** @brief A very primitive RTTI system for the contents of material
  32.505 + *  properties.
  32.506 + */
  32.507 +enum aiPropertyTypeInfo
  32.508 +{
  32.509 +    /** Array of single-precision (32 Bit) floats
  32.510 +     *
  32.511 +     *  It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
  32.512 +     *  aiMaterial::Get()) to query properties stored in floating-point format.
  32.513 +     *  The material system performs the type conversion automatically.
  32.514 +    */
  32.515 +    aiPTI_Float   = 0x1,
  32.516 +
  32.517 +    /** Array of double-precision (64 Bit) floats
  32.518 +     *
  32.519 +     *  It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
  32.520 +     *  aiMaterial::Get()) to query properties stored in floating-point format.
  32.521 +     *  The material system performs the type conversion automatically.
  32.522 +    */
  32.523 +    aiPTI_Double   = 0x2,
  32.524 +
  32.525 +    /** The material property is an aiString.
  32.526 +     *
  32.527 +     *  Arrays of strings aren't possible, aiGetMaterialString() (or the
  32.528 +     *  C++-API aiMaterial::Get()) *must* be used to query a string property.
  32.529 +    */
  32.530 +    aiPTI_String  = 0x3,
  32.531 +
  32.532 +    /** Array of (32 Bit) integers
  32.533 +     *
  32.534 +     *  It is possible to use aiGetMaterialFloat[Array]() (or the C++-API
  32.535 +     *  aiMaterial::Get()) to query properties stored in integer format.
  32.536 +     *  The material system performs the type conversion automatically.
  32.537 +    */
  32.538 +    aiPTI_Integer = 0x4,
  32.539 +
  32.540 +
  32.541 +    /** Simple binary buffer, content undefined. Not convertible to anything.
  32.542 +    */
  32.543 +    aiPTI_Buffer  = 0x5,
  32.544 +
  32.545 +
  32.546 +     /** This value is not used. It is just there to force the
  32.547 +     *  compiler to map this enum to a 32 Bit integer.
  32.548 +     */
  32.549 +#ifndef SWIG
  32.550 +     _aiPTI_Force32Bit = INT_MAX
  32.551 +#endif
  32.552 +};
  32.553 +
  32.554 +// ---------------------------------------------------------------------------
  32.555 +/** @brief Data structure for a single material property
  32.556 + *
  32.557 + *  As an user, you'll probably never need to deal with this data structure.
  32.558 + *  Just use the provided aiGetMaterialXXX() or aiMaterial::Get() family
  32.559 + *  of functions to query material properties easily. Processing them
  32.560 + *  manually is faster, but it is not the recommended way. It isn't worth
  32.561 + *  the effort. <br>
  32.562 + *  Material property names follow a simple scheme:
  32.563 + *  @code
  32.564 + *    $<name>
  32.565 + *    ?<name>
  32.566 + *       A public property, there must be corresponding AI_MATKEY_XXX define
  32.567 + *       2nd: Public, but ignored by the #aiProcess_RemoveRedundantMaterials
  32.568 + *       post-processing step.
  32.569 + *    ~<name>
  32.570 + *       A temporary property for internal use.
  32.571 + *  @endcode
  32.572 + *  @see aiMaterial
  32.573 + */
  32.574 +struct aiMaterialProperty
  32.575 +{
  32.576 +    /** Specifies the name of the property (key)
  32.577 +     *  Keys are generally case insensitive.
  32.578 +     */
  32.579 +    C_STRUCT aiString mKey;
  32.580 +
  32.581 +    /** Textures: Specifies their exact usage semantic.
  32.582 +     * For non-texture properties, this member is always 0
  32.583 +     * (or, better-said, #aiTextureType_NONE).
  32.584 +     */
  32.585 +    unsigned int mSemantic;
  32.586 +
  32.587 +    /** Textures: Specifies the index of the texture.
  32.588 +     *  For non-texture properties, this member is always 0.
  32.589 +     */
  32.590 +    unsigned int mIndex;
  32.591 +
  32.592 +    /** Size of the buffer mData is pointing to, in bytes.
  32.593 +     *  This value may not be 0.
  32.594 +     */
  32.595 +    unsigned int mDataLength;
  32.596 +
  32.597 +    /** Type information for the property.
  32.598 +     *
  32.599 +     * Defines the data layout inside the data buffer. This is used
  32.600 +     * by the library internally to perform debug checks and to
  32.601 +     * utilize proper type conversions.
  32.602 +     * (It's probably a hacky solution, but it works.)
  32.603 +     */
  32.604 +    C_ENUM aiPropertyTypeInfo mType;
  32.605 +
  32.606 +    /** Binary buffer to hold the property's value.
  32.607 +     * The size of the buffer is always mDataLength.
  32.608 +     */
  32.609 +    char* mData;
  32.610 +
  32.611 +#ifdef __cplusplus
  32.612 +
  32.613 +    aiMaterialProperty() AI_NO_EXCEPT
  32.614 +    : mSemantic( 0 )
  32.615 +    , mIndex( 0 )
  32.616 +    , mDataLength( 0 )
  32.617 +    , mType( aiPTI_Float )
  32.618 +    , mData(0) {
  32.619 +        // empty
  32.620 +    }
  32.621 +
  32.622 +    ~aiMaterialProperty()   {
  32.623 +        delete[] mData;
  32.624 +        mData = 0;
  32.625 +    }
  32.626 +
  32.627 +#endif
  32.628 +};
  32.629 +//! @endcond
  32.630 +
  32.631 +#ifdef __cplusplus
  32.632 +} // We need to leave the "C" block here to allow template member functions
  32.633 +#endif
  32.634 +
  32.635 +// ---------------------------------------------------------------------------
  32.636 +/** @brief Data structure for a material
  32.637 +*
  32.638 +*  Material data is stored using a key-value structure. A single key-value
  32.639 +*  pair is called a 'material property'. C++ users should use the provided
  32.640 +*  member functions of aiMaterial to process material properties, C users
  32.641 +*  have to stick with the aiMaterialGetXXX family of unbound functions.
  32.642 +*  The library defines a set of standard keys (AI_MATKEY_XXX).
  32.643 +*/
  32.644 +#ifdef __cplusplus
  32.645 +struct ASSIMP_API aiMaterial
  32.646 +#else
  32.647 +struct aiMaterial
  32.648 +#endif
  32.649 +{
  32.650 +
  32.651 +#ifdef __cplusplus
  32.652 +
  32.653 +public:
  32.654 +
  32.655 +    aiMaterial();
  32.656 +    ~aiMaterial();
  32.657 +
  32.658 +    // -------------------------------------------------------------------
  32.659 +    /**
  32.660 +      * @brief  Returns the name of the material.
  32.661 +      * @return The name of the material.
  32.662 +      */
  32.663 +    // -------------------------------------------------------------------
  32.664 +    aiString GetName();
  32.665 +
  32.666 +    // -------------------------------------------------------------------
  32.667 +    /** @brief Retrieve an array of Type values with a specific key
  32.668 +     *  from the material
  32.669 +     *
  32.670 +     * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
  32.671 +     * @param type .. set by AI_MATKEY_XXX
  32.672 +     * @param idx .. set by AI_MATKEY_XXX
  32.673 +     * @param pOut Pointer to a buffer to receive the result.
  32.674 +     * @param pMax Specifies the size of the given buffer, in Type's.
  32.675 +     * Receives the number of values (not bytes!) read.
  32.676 +     * NULL is a valid value for this parameter.
  32.677 +     */
  32.678 +    template <typename Type>
  32.679 +    aiReturn Get(const char* pKey,unsigned int type,
  32.680 +        unsigned int idx, Type* pOut, unsigned int* pMax) const;
  32.681 +
  32.682 +    aiReturn Get(const char* pKey,unsigned int type,
  32.683 +        unsigned int idx, int* pOut, unsigned int* pMax) const;
  32.684 +
  32.685 +    aiReturn Get(const char* pKey,unsigned int type,
  32.686 +        unsigned int idx, ai_real* pOut, unsigned int* pMax) const;
  32.687 +
  32.688 +    // -------------------------------------------------------------------
  32.689 +    /** @brief Retrieve a Type value with a specific key
  32.690 +     *  from the material
  32.691 +     *
  32.692 +     * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
  32.693 +    * @param type Specifies the type of the texture to be retrieved (
  32.694 +    *    e.g. diffuse, specular, height map ...)
  32.695 +    * @param idx Index of the texture to be retrieved.
  32.696 +     * @param pOut Reference to receive the output value
  32.697 +     */
  32.698 +    template <typename Type>
  32.699 +    aiReturn Get(const char* pKey,unsigned int type,
  32.700 +        unsigned int idx,Type& pOut) const;
  32.701 +
  32.702 +
  32.703 +    aiReturn Get(const char* pKey,unsigned int type,
  32.704 +        unsigned int idx, int& pOut) const;
  32.705 +
  32.706 +    aiReturn Get(const char* pKey,unsigned int type,
  32.707 +        unsigned int idx, ai_real& pOut) const;
  32.708 +
  32.709 +    aiReturn Get(const char* pKey,unsigned int type,
  32.710 +        unsigned int idx, aiString& pOut) const;
  32.711 +
  32.712 +    aiReturn Get(const char* pKey,unsigned int type,
  32.713 +        unsigned int idx, aiColor3D& pOut) const;
  32.714 +
  32.715 +    aiReturn Get(const char* pKey,unsigned int type,
  32.716 +        unsigned int idx, aiColor4D& pOut) const;
  32.717 +
  32.718 +    aiReturn Get(const char* pKey,unsigned int type,
  32.719 +        unsigned int idx, aiUVTransform& pOut) const;
  32.720 +
  32.721 +    // -------------------------------------------------------------------
  32.722 +    /** Get the number of textures for a particular texture type.
  32.723 +     *  @param type Texture type to check for
  32.724 +     *  @return Number of textures for this type.
  32.725 +     *  @note A texture can be easily queried using #GetTexture() */
  32.726 +    unsigned int GetTextureCount(aiTextureType type) const;
  32.727 +
  32.728 +    // -------------------------------------------------------------------
  32.729 +    /** Helper function to get all parameters pertaining to a
  32.730 +     *  particular texture slot from a material.
  32.731 +     *
  32.732 +     *  This function is provided just for convenience, you could also
  32.733 +     *  read the single material properties manually.
  32.734 +     *  @param type Specifies the type of the texture to be retrieved (
  32.735 +     *    e.g. diffuse, specular, height map ...)
  32.736 +     *  @param index Index of the texture to be retrieved. The function fails
  32.737 +     *    if there is no texture of that type with this index.
  32.738 +     *    #GetTextureCount() can be used to determine the number of textures
  32.739 +     *    per texture type.
  32.740 +     *  @param path Receives the path to the texture.
  32.741 +     *    If the texture is embedded, receives a '*' followed by the id of
  32.742 +     *    the texture (for the textures stored in the corresponding scene) which
  32.743 +     *    can be converted to an int using a function like atoi.
  32.744 +     *    NULL is a valid value.
  32.745 +     *  @param mapping The texture mapping.
  32.746 +     *    NULL is allowed as value.
  32.747 +     *  @param uvindex Receives the UV index of the texture.
  32.748 +     *    NULL is a valid value.
  32.749 +     *  @param blend Receives the blend factor for the texture
  32.750 +     *    NULL is a valid value.
  32.751 +     *  @param op Receives the texture operation to be performed between
  32.752 +     *    this texture and the previous texture. NULL is allowed as value.
  32.753 +     *  @param mapmode Receives the mapping modes to be used for the texture.
  32.754 +     *    The parameter may be NULL but if it is a valid pointer it MUST
  32.755 +     *    point to an array of 3 aiTextureMapMode's (one for each
  32.756 +     *    axis: UVW order (=XYZ)).
  32.757 +     */
  32.758 +    // -------------------------------------------------------------------
  32.759 +    aiReturn GetTexture(aiTextureType type,
  32.760 +        unsigned int  index,
  32.761 +        C_STRUCT aiString* path,
  32.762 +        aiTextureMapping* mapping   = NULL,
  32.763 +        unsigned int* uvindex       = NULL,
  32.764 +        ai_real* blend              = NULL,
  32.765 +        aiTextureOp* op             = NULL,
  32.766 +        aiTextureMapMode* mapmode   = NULL) const;
  32.767 +
  32.768 +
  32.769 +    // Setters
  32.770 +
  32.771 +
  32.772 +    // ------------------------------------------------------------------------------
  32.773 +    /** @brief Add a property with a given key and type info to the material
  32.774 +     *  structure
  32.775 +     *
  32.776 +     *  @param pInput Pointer to input data
  32.777 +     *  @param pSizeInBytes Size of input data
  32.778 +     *  @param pKey Key/Usage of the property (AI_MATKEY_XXX)
  32.779 +     *  @param type Set by the AI_MATKEY_XXX macro
  32.780 +     *  @param index Set by the AI_MATKEY_XXX macro
  32.781 +     *  @param pType Type information hint */
  32.782 +    aiReturn AddBinaryProperty (const void* pInput,
  32.783 +        unsigned int pSizeInBytes,
  32.784 +        const char* pKey,
  32.785 +        unsigned int type ,
  32.786 +        unsigned int index ,
  32.787 +        aiPropertyTypeInfo pType);
  32.788 +
  32.789 +    // ------------------------------------------------------------------------------
  32.790 +    /** @brief Add a string property with a given key and type info to the
  32.791 +     *  material structure
  32.792 +     *
  32.793 +     *  @param pInput Input string
  32.794 +     *  @param pKey Key/Usage of the property (AI_MATKEY_XXX)
  32.795 +     *  @param type Set by the AI_MATKEY_XXX macro
  32.796 +     *  @param index Set by the AI_MATKEY_XXX macro */
  32.797 +    aiReturn AddProperty (const aiString* pInput,
  32.798 +        const char* pKey,
  32.799 +        unsigned int type  = 0,
  32.800 +        unsigned int index = 0);
  32.801 +
  32.802 +    // ------------------------------------------------------------------------------
  32.803 +    /** @brief Add a property with a given key to the material structure
  32.804 +     *  @param pInput Pointer to the input data
  32.805 +     *  @param pNumValues Number of values in the array
  32.806 +     *  @param pKey Key/Usage of the property (AI_MATKEY_XXX)
  32.807 +     *  @param type Set by the AI_MATKEY_XXX macro
  32.808 +     *  @param index Set by the AI_MATKEY_XXX macro  */
  32.809 +    template<class TYPE>
  32.810 +    aiReturn AddProperty (const TYPE* pInput,
  32.811 +        unsigned int pNumValues,
  32.812 +        const char* pKey,
  32.813 +        unsigned int type  = 0,
  32.814 +        unsigned int index = 0);
  32.815 +
  32.816 +    aiReturn AddProperty (const aiVector3D* pInput,
  32.817 +        unsigned int pNumValues,
  32.818 +        const char* pKey,
  32.819 +        unsigned int type  = 0,
  32.820 +        unsigned int index = 0);
  32.821 +
  32.822 +    aiReturn AddProperty (const aiColor3D* pInput,
  32.823 +        unsigned int pNumValues,
  32.824 +        const char* pKey,
  32.825 +        unsigned int type  = 0,
  32.826 +        unsigned int index = 0);
  32.827 +
  32.828 +    aiReturn AddProperty (const aiColor4D* pInput,
  32.829 +        unsigned int pNumValues,
  32.830 +        const char* pKey,
  32.831 +        unsigned int type  = 0,
  32.832 +        unsigned int index = 0);
  32.833 +
  32.834 +    aiReturn AddProperty (const int* pInput,
  32.835 +        unsigned int pNumValues,
  32.836 +        const char* pKey,
  32.837 +        unsigned int type  = 0,
  32.838 +        unsigned int index = 0);
  32.839 +
  32.840 +    aiReturn AddProperty (const float* pInput,
  32.841 +        unsigned int pNumValues,
  32.842 +        const char* pKey,
  32.843 +        unsigned int type  = 0,
  32.844 +        unsigned int index = 0);
  32.845 +
  32.846 +    aiReturn AddProperty (const double* pInput,
  32.847 +        unsigned int pNumValues,
  32.848 +        const char* pKey,
  32.849 +        unsigned int type  = 0,
  32.850 +        unsigned int index = 0);
  32.851 +
  32.852 +    aiReturn AddProperty (const aiUVTransform* pInput,
  32.853 +        unsigned int pNumValues,
  32.854 +        const char* pKey,
  32.855 +        unsigned int type  = 0,
  32.856 +        unsigned int index = 0);
  32.857 +
  32.858 +    // ------------------------------------------------------------------------------
  32.859 +    /** @brief Remove a given key from the list.
  32.860 +     *
  32.861 +     *  The function fails if the key isn't found
  32.862 +     *  @param pKey Key to be deleted
  32.863 +     *  @param type Set by the AI_MATKEY_XXX macro
  32.864 +     *  @param index Set by the AI_MATKEY_XXX macro  */
  32.865 +    aiReturn RemoveProperty (const char* pKey,
  32.866 +        unsigned int type  = 0,
  32.867 +        unsigned int index = 0);
  32.868 +
  32.869 +    // ------------------------------------------------------------------------------
  32.870 +    /** @brief Removes all properties from the material.
  32.871 +     *
  32.872 +     *  The data array remains allocated so adding new properties is quite fast.  */
  32.873 +    void Clear();
  32.874 +
  32.875 +    // ------------------------------------------------------------------------------
  32.876 +    /** Copy the property list of a material
  32.877 +     *  @param pcDest Destination material
  32.878 +     *  @param pcSrc Source material
  32.879 +     */
  32.880 +    static void CopyPropertyList(aiMaterial* pcDest,
  32.881 +        const aiMaterial* pcSrc);
  32.882 +
  32.883 +
  32.884 +#endif
  32.885 +
  32.886 +    /** List of all material properties loaded. */
  32.887 +    C_STRUCT aiMaterialProperty** mProperties;
  32.888 +
  32.889 +    /** Number of properties in the data base */
  32.890 +    unsigned int mNumProperties;
  32.891 +
  32.892 +     /** Storage allocated */
  32.893 +    unsigned int mNumAllocated;
  32.894 +};
  32.895 +
  32.896 +// Go back to extern "C" again
  32.897 +#ifdef __cplusplus
  32.898 +extern "C" {
  32.899 +#endif
  32.900 +
  32.901 +// ---------------------------------------------------------------------------
  32.902 +#define AI_MATKEY_NAME "?mat.name",0,0
  32.903 +#define AI_MATKEY_TWOSIDED "$mat.twosided",0,0
  32.904 +#define AI_MATKEY_SHADING_MODEL "$mat.shadingm",0,0
  32.905 +#define AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe",0,0
  32.906 +#define AI_MATKEY_BLEND_FUNC "$mat.blend",0,0
  32.907 +#define AI_MATKEY_OPACITY "$mat.opacity",0,0
  32.908 +#define AI_MATKEY_BUMPSCALING "$mat.bumpscaling",0,0
  32.909 +#define AI_MATKEY_SHININESS "$mat.shininess",0,0
  32.910 +#define AI_MATKEY_REFLECTIVITY "$mat.reflectivity",0,0
  32.911 +#define AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent",0,0
  32.912 +#define AI_MATKEY_REFRACTI "$mat.refracti",0,0
  32.913 +#define AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse",0,0
  32.914 +#define AI_MATKEY_COLOR_AMBIENT "$clr.ambient",0,0
  32.915 +#define AI_MATKEY_COLOR_SPECULAR "$clr.specular",0,0
  32.916 +#define AI_MATKEY_COLOR_EMISSIVE "$clr.emissive",0,0
  32.917 +#define AI_MATKEY_COLOR_TRANSPARENT "$clr.transparent",0,0
  32.918 +#define AI_MATKEY_COLOR_REFLECTIVE "$clr.reflective",0,0
  32.919 +#define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE "?bg.global",0,0
  32.920 +
  32.921 +// ---------------------------------------------------------------------------
  32.922 +// Pure key names for all texture-related properties
  32.923 +//! @cond MATS_DOC_FULL
  32.924 +#define _AI_MATKEY_TEXTURE_BASE         "$tex.file"
  32.925 +#define _AI_MATKEY_UVWSRC_BASE          "$tex.uvwsrc"
  32.926 +#define _AI_MATKEY_TEXOP_BASE           "$tex.op"
  32.927 +#define _AI_MATKEY_MAPPING_BASE         "$tex.mapping"
  32.928 +#define _AI_MATKEY_TEXBLEND_BASE        "$tex.blend"
  32.929 +#define _AI_MATKEY_MAPPINGMODE_U_BASE   "$tex.mapmodeu"
  32.930 +#define _AI_MATKEY_MAPPINGMODE_V_BASE   "$tex.mapmodev"
  32.931 +#define _AI_MATKEY_TEXMAP_AXIS_BASE     "$tex.mapaxis"
  32.932 +#define _AI_MATKEY_UVTRANSFORM_BASE     "$tex.uvtrafo"
  32.933 +#define _AI_MATKEY_TEXFLAGS_BASE        "$tex.flags"
  32.934 +//! @endcond
  32.935 +
  32.936 +// ---------------------------------------------------------------------------
  32.937 +#define AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE,type,N
  32.938 +
  32.939 +// For backward compatibility and simplicity
  32.940 +//! @cond MATS_DOC_FULL
  32.941 +#define AI_MATKEY_TEXTURE_DIFFUSE(N)    \
  32.942 +    AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE,N)
  32.943 +
  32.944 +#define AI_MATKEY_TEXTURE_SPECULAR(N)   \
  32.945 +    AI_MATKEY_TEXTURE(aiTextureType_SPECULAR,N)
  32.946 +
  32.947 +#define AI_MATKEY_TEXTURE_AMBIENT(N)    \
  32.948 +    AI_MATKEY_TEXTURE(aiTextureType_AMBIENT,N)
  32.949 +
  32.950 +#define AI_MATKEY_TEXTURE_EMISSIVE(N)   \
  32.951 +    AI_MATKEY_TEXTURE(aiTextureType_EMISSIVE,N)
  32.952 +
  32.953 +#define AI_MATKEY_TEXTURE_NORMALS(N)    \
  32.954 +    AI_MATKEY_TEXTURE(aiTextureType_NORMALS,N)
  32.955 +
  32.956 +#define AI_MATKEY_TEXTURE_HEIGHT(N) \
  32.957 +    AI_MATKEY_TEXTURE(aiTextureType_HEIGHT,N)
  32.958 +
  32.959 +#define AI_MATKEY_TEXTURE_SHININESS(N)  \
  32.960 +    AI_MATKEY_TEXTURE(aiTextureType_SHININESS,N)
  32.961 +
  32.962 +#define AI_MATKEY_TEXTURE_OPACITY(N)    \
  32.963 +    AI_MATKEY_TEXTURE(aiTextureType_OPACITY,N)
  32.964 +
  32.965 +#define AI_MATKEY_TEXTURE_DISPLACEMENT(N)   \
  32.966 +    AI_MATKEY_TEXTURE(aiTextureType_DISPLACEMENT,N)
  32.967 +
  32.968 +#define AI_MATKEY_TEXTURE_LIGHTMAP(N)   \
  32.969 +    AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP,N)
  32.970 +
  32.971 +#define AI_MATKEY_TEXTURE_REFLECTION(N) \
  32.972 +    AI_MATKEY_TEXTURE(aiTextureType_REFLECTION,N)
  32.973 +
  32.974 +//! @endcond
  32.975 +
  32.976 +// ---------------------------------------------------------------------------
  32.977 +#define AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE,type,N
  32.978 +
  32.979 +// For backward compatibility and simplicity
  32.980 +//! @cond MATS_DOC_FULL
  32.981 +#define AI_MATKEY_UVWSRC_DIFFUSE(N) \
  32.982 +    AI_MATKEY_UVWSRC(aiTextureType_DIFFUSE,N)
  32.983 +
  32.984 +#define AI_MATKEY_UVWSRC_SPECULAR(N)    \
  32.985 +    AI_MATKEY_UVWSRC(aiTextureType_SPECULAR,N)
  32.986 +
  32.987 +#define AI_MATKEY_UVWSRC_AMBIENT(N) \
  32.988 +    AI_MATKEY_UVWSRC(aiTextureType_AMBIENT,N)
  32.989 +
  32.990 +#define AI_MATKEY_UVWSRC_EMISSIVE(N)    \
  32.991 +    AI_MATKEY_UVWSRC(aiTextureType_EMISSIVE,N)
  32.992 +
  32.993 +#define AI_MATKEY_UVWSRC_NORMALS(N) \
  32.994 +    AI_MATKEY_UVWSRC(aiTextureType_NORMALS,N)
  32.995 +
  32.996 +#define AI_MATKEY_UVWSRC_HEIGHT(N)  \
  32.997 +    AI_MATKEY_UVWSRC(aiTextureType_HEIGHT,N)
  32.998 +
  32.999 +#define AI_MATKEY_UVWSRC_SHININESS(N)   \
 32.1000 +    AI_MATKEY_UVWSRC(aiTextureType_SHININESS,N)
 32.1001 +
 32.1002 +#define AI_MATKEY_UVWSRC_OPACITY(N) \
 32.1003 +    AI_MATKEY_UVWSRC(aiTextureType_OPACITY,N)
 32.1004 +
 32.1005 +#define AI_MATKEY_UVWSRC_DISPLACEMENT(N)    \
 32.1006 +    AI_MATKEY_UVWSRC(aiTextureType_DISPLACEMENT,N)
 32.1007 +
 32.1008 +#define AI_MATKEY_UVWSRC_LIGHTMAP(N)    \
 32.1009 +    AI_MATKEY_UVWSRC(aiTextureType_LIGHTMAP,N)
 32.1010 +
 32.1011 +#define AI_MATKEY_UVWSRC_REFLECTION(N)  \
 32.1012 +    AI_MATKEY_UVWSRC(aiTextureType_REFLECTION,N)
 32.1013 +
 32.1014 +//! @endcond
 32.1015 +// ---------------------------------------------------------------------------
 32.1016 +#define AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE,type,N
 32.1017 +
 32.1018 +// For backward compatibility and simplicity
 32.1019 +//! @cond MATS_DOC_FULL
 32.1020 +#define AI_MATKEY_TEXOP_DIFFUSE(N)  \
 32.1021 +    AI_MATKEY_TEXOP(aiTextureType_DIFFUSE,N)
 32.1022 +
 32.1023 +#define AI_MATKEY_TEXOP_SPECULAR(N) \
 32.1024 +    AI_MATKEY_TEXOP(aiTextureType_SPECULAR,N)
 32.1025 +
 32.1026 +#define AI_MATKEY_TEXOP_AMBIENT(N)  \
 32.1027 +    AI_MATKEY_TEXOP(aiTextureType_AMBIENT,N)
 32.1028 +
 32.1029 +#define AI_MATKEY_TEXOP_EMISSIVE(N) \
 32.1030 +    AI_MATKEY_TEXOP(aiTextureType_EMISSIVE,N)
 32.1031 +
 32.1032 +#define AI_MATKEY_TEXOP_NORMALS(N)  \
 32.1033 +    AI_MATKEY_TEXOP(aiTextureType_NORMALS,N)
 32.1034 +
 32.1035 +#define AI_MATKEY_TEXOP_HEIGHT(N)   \
 32.1036 +    AI_MATKEY_TEXOP(aiTextureType_HEIGHT,N)
 32.1037 +
 32.1038 +#define AI_MATKEY_TEXOP_SHININESS(N)    \
 32.1039 +    AI_MATKEY_TEXOP(aiTextureType_SHININESS,N)
 32.1040 +
 32.1041 +#define AI_MATKEY_TEXOP_OPACITY(N)  \
 32.1042 +    AI_MATKEY_TEXOP(aiTextureType_OPACITY,N)
 32.1043 +
 32.1044 +#define AI_MATKEY_TEXOP_DISPLACEMENT(N) \
 32.1045 +    AI_MATKEY_TEXOP(aiTextureType_DISPLACEMENT,N)
 32.1046 +
 32.1047 +#define AI_MATKEY_TEXOP_LIGHTMAP(N) \
 32.1048 +    AI_MATKEY_TEXOP(aiTextureType_LIGHTMAP,N)
 32.1049 +
 32.1050 +#define AI_MATKEY_TEXOP_REFLECTION(N)   \
 32.1051 +    AI_MATKEY_TEXOP(aiTextureType_REFLECTION,N)
 32.1052 +
 32.1053 +//! @endcond
 32.1054 +// ---------------------------------------------------------------------------
 32.1055 +#define AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE,type,N
 32.1056 +
 32.1057 +// For backward compatibility and simplicity
 32.1058 +//! @cond MATS_DOC_FULL
 32.1059 +#define AI_MATKEY_MAPPING_DIFFUSE(N)    \
 32.1060 +    AI_MATKEY_MAPPING(aiTextureType_DIFFUSE,N)
 32.1061 +
 32.1062 +#define AI_MATKEY_MAPPING_SPECULAR(N)   \
 32.1063 +    AI_MATKEY_MAPPING(aiTextureType_SPECULAR,N)
 32.1064 +
 32.1065 +#define AI_MATKEY_MAPPING_AMBIENT(N)    \
 32.1066 +    AI_MATKEY_MAPPING(aiTextureType_AMBIENT,N)
 32.1067 +
 32.1068 +#define AI_MATKEY_MAPPING_EMISSIVE(N)   \
 32.1069 +    AI_MATKEY_MAPPING(aiTextureType_EMISSIVE,N)
 32.1070 +
 32.1071 +#define AI_MATKEY_MAPPING_NORMALS(N)    \
 32.1072 +    AI_MATKEY_MAPPING(aiTextureType_NORMALS,N)
 32.1073 +
 32.1074 +#define AI_MATKEY_MAPPING_HEIGHT(N) \
 32.1075 +    AI_MATKEY_MAPPING(aiTextureType_HEIGHT,N)
 32.1076 +
 32.1077 +#define AI_MATKEY_MAPPING_SHININESS(N)  \
 32.1078 +    AI_MATKEY_MAPPING(aiTextureType_SHININESS,N)
 32.1079 +
 32.1080 +#define AI_MATKEY_MAPPING_OPACITY(N)    \
 32.1081 +    AI_MATKEY_MAPPING(aiTextureType_OPACITY,N)
 32.1082 +
 32.1083 +#define AI_MATKEY_MAPPING_DISPLACEMENT(N)   \
 32.1084 +    AI_MATKEY_MAPPING(aiTextureType_DISPLACEMENT,N)
 32.1085 +
 32.1086 +#define AI_MATKEY_MAPPING_LIGHTMAP(N)   \
 32.1087 +    AI_MATKEY_MAPPING(aiTextureType_LIGHTMAP,N)
 32.1088 +
 32.1089 +#define AI_MATKEY_MAPPING_REFLECTION(N) \
 32.1090 +    AI_MATKEY_MAPPING(aiTextureType_REFLECTION,N)
 32.1091 +
 32.1092 +//! @endcond
 32.1093 +// ---------------------------------------------------------------------------
 32.1094 +#define AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE,type,N
 32.1095 +
 32.1096 +// For backward compatibility and simplicity
 32.1097 +//! @cond MATS_DOC_FULL
 32.1098 +#define AI_MATKEY_TEXBLEND_DIFFUSE(N)   \
 32.1099 +    AI_MATKEY_TEXBLEND(aiTextureType_DIFFUSE,N)
 32.1100 +
 32.1101 +#define AI_MATKEY_TEXBLEND_SPECULAR(N)  \
 32.1102 +    AI_MATKEY_TEXBLEND(aiTextureType_SPECULAR,N)
 32.1103 +
 32.1104 +#define AI_MATKEY_TEXBLEND_AMBIENT(N)   \
 32.1105 +    AI_MATKEY_TEXBLEND(aiTextureType_AMBIENT,N)
 32.1106 +
 32.1107 +#define AI_MATKEY_TEXBLEND_EMISSIVE(N)  \
 32.1108 +    AI_MATKEY_TEXBLEND(aiTextureType_EMISSIVE,N)
 32.1109 +
 32.1110 +#define AI_MATKEY_TEXBLEND_NORMALS(N)   \
 32.1111 +    AI_MATKEY_TEXBLEND(aiTextureType_NORMALS,N)
 32.1112 +
 32.1113 +#define AI_MATKEY_TEXBLEND_HEIGHT(N)    \
 32.1114 +    AI_MATKEY_TEXBLEND(aiTextureType_HEIGHT,N)
 32.1115 +
 32.1116 +#define AI_MATKEY_TEXBLEND_SHININESS(N) \
 32.1117 +    AI_MATKEY_TEXBLEND(aiTextureType_SHININESS,N)
 32.1118 +
 32.1119 +#define AI_MATKEY_TEXBLEND_OPACITY(N)   \
 32.1120 +    AI_MATKEY_TEXBLEND(aiTextureType_OPACITY,N)
 32.1121 +
 32.1122 +#define AI_MATKEY_TEXBLEND_DISPLACEMENT(N)  \
 32.1123 +    AI_MATKEY_TEXBLEND(aiTextureType_DISPLACEMENT,N)
 32.1124 +
 32.1125 +#define AI_MATKEY_TEXBLEND_LIGHTMAP(N)  \
 32.1126 +    AI_MATKEY_TEXBLEND(aiTextureType_LIGHTMAP,N)
 32.1127 +
 32.1128 +#define AI_MATKEY_TEXBLEND_REFLECTION(N)    \
 32.1129 +    AI_MATKEY_TEXBLEND(aiTextureType_REFLECTION,N)
 32.1130 +
 32.1131 +//! @endcond
 32.1132 +// ---------------------------------------------------------------------------
 32.1133 +#define AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE,type,N
 32.1134 +
 32.1135 +// For backward compatibility and simplicity
 32.1136 +//! @cond MATS_DOC_FULL
 32.1137 +#define AI_MATKEY_MAPPINGMODE_U_DIFFUSE(N)  \
 32.1138 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_DIFFUSE,N)
 32.1139 +
 32.1140 +#define AI_MATKEY_MAPPINGMODE_U_SPECULAR(N) \
 32.1141 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_SPECULAR,N)
 32.1142 +
 32.1143 +#define AI_MATKEY_MAPPINGMODE_U_AMBIENT(N)  \
 32.1144 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_AMBIENT,N)
 32.1145 +
 32.1146 +#define AI_MATKEY_MAPPINGMODE_U_EMISSIVE(N) \
 32.1147 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_EMISSIVE,N)
 32.1148 +
 32.1149 +#define AI_MATKEY_MAPPINGMODE_U_NORMALS(N)  \
 32.1150 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_NORMALS,N)
 32.1151 +
 32.1152 +#define AI_MATKEY_MAPPINGMODE_U_HEIGHT(N)   \
 32.1153 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_HEIGHT,N)
 32.1154 +
 32.1155 +#define AI_MATKEY_MAPPINGMODE_U_SHININESS(N)    \
 32.1156 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_SHININESS,N)
 32.1157 +
 32.1158 +#define AI_MATKEY_MAPPINGMODE_U_OPACITY(N)  \
 32.1159 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_OPACITY,N)
 32.1160 +
 32.1161 +#define AI_MATKEY_MAPPINGMODE_U_DISPLACEMENT(N) \
 32.1162 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_DISPLACEMENT,N)
 32.1163 +
 32.1164 +#define AI_MATKEY_MAPPINGMODE_U_LIGHTMAP(N) \
 32.1165 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_LIGHTMAP,N)
 32.1166 +
 32.1167 +#define AI_MATKEY_MAPPINGMODE_U_REFLECTION(N)   \
 32.1168 +    AI_MATKEY_MAPPINGMODE_U(aiTextureType_REFLECTION,N)
 32.1169 +
 32.1170 +//! @endcond
 32.1171 +// ---------------------------------------------------------------------------
 32.1172 +#define AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE,type,N
 32.1173 +
 32.1174 +// For backward compatibility and simplicity
 32.1175 +//! @cond MATS_DOC_FULL
 32.1176 +#define AI_MATKEY_MAPPINGMODE_V_DIFFUSE(N)  \
 32.1177 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_DIFFUSE,N)
 32.1178 +
 32.1179 +#define AI_MATKEY_MAPPINGMODE_V_SPECULAR(N) \
 32.1180 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_SPECULAR,N)
 32.1181 +
 32.1182 +#define AI_MATKEY_MAPPINGMODE_V_AMBIENT(N)  \
 32.1183 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_AMBIENT,N)
 32.1184 +
 32.1185 +#define AI_MATKEY_MAPPINGMODE_V_EMISSIVE(N) \
 32.1186 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_EMISSIVE,N)
 32.1187 +
 32.1188 +#define AI_MATKEY_MAPPINGMODE_V_NORMALS(N)  \
 32.1189 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_NORMALS,N)
 32.1190 +
 32.1191 +#define AI_MATKEY_MAPPINGMODE_V_HEIGHT(N)   \
 32.1192 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_HEIGHT,N)
 32.1193 +
 32.1194 +#define AI_MATKEY_MAPPINGMODE_V_SHININESS(N)    \
 32.1195 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_SHININESS,N)
 32.1196 +
 32.1197 +#define AI_MATKEY_MAPPINGMODE_V_OPACITY(N)  \
 32.1198 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_OPACITY,N)
 32.1199 +
 32.1200 +#define AI_MATKEY_MAPPINGMODE_V_DISPLACEMENT(N) \
 32.1201 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_DISPLACEMENT,N)
 32.1202 +
 32.1203 +#define AI_MATKEY_MAPPINGMODE_V_LIGHTMAP(N) \
 32.1204 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_LIGHTMAP,N)
 32.1205 +
 32.1206 +#define AI_MATKEY_MAPPINGMODE_V_REFLECTION(N)   \
 32.1207 +    AI_MATKEY_MAPPINGMODE_V(aiTextureType_REFLECTION,N)
 32.1208 +
 32.1209 +//! @endcond
 32.1210 +// ---------------------------------------------------------------------------
 32.1211 +#define AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE,type,N
 32.1212 +
 32.1213 +// For backward compatibility and simplicity
 32.1214 +//! @cond MATS_DOC_FULL
 32.1215 +#define AI_MATKEY_TEXMAP_AXIS_DIFFUSE(N)    \
 32.1216 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_DIFFUSE,N)
 32.1217 +
 32.1218 +#define AI_MATKEY_TEXMAP_AXIS_SPECULAR(N)   \
 32.1219 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_SPECULAR,N)
 32.1220 +
 32.1221 +#define AI_MATKEY_TEXMAP_AXIS_AMBIENT(N)    \
 32.1222 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_AMBIENT,N)
 32.1223 +
 32.1224 +#define AI_MATKEY_TEXMAP_AXIS_EMISSIVE(N)   \
 32.1225 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_EMISSIVE,N)
 32.1226 +
 32.1227 +#define AI_MATKEY_TEXMAP_AXIS_NORMALS(N)    \
 32.1228 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_NORMALS,N)
 32.1229 +
 32.1230 +#define AI_MATKEY_TEXMAP_AXIS_HEIGHT(N) \
 32.1231 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_HEIGHT,N)
 32.1232 +
 32.1233 +#define AI_MATKEY_TEXMAP_AXIS_SHININESS(N)  \
 32.1234 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_SHININESS,N)
 32.1235 +
 32.1236 +#define AI_MATKEY_TEXMAP_AXIS_OPACITY(N)    \
 32.1237 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_OPACITY,N)
 32.1238 +
 32.1239 +#define AI_MATKEY_TEXMAP_AXIS_DISPLACEMENT(N)   \
 32.1240 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_DISPLACEMENT,N)
 32.1241 +
 32.1242 +#define AI_MATKEY_TEXMAP_AXIS_LIGHTMAP(N)   \
 32.1243 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_LIGHTMAP,N)
 32.1244 +
 32.1245 +#define AI_MATKEY_TEXMAP_AXIS_REFLECTION(N) \
 32.1246 +    AI_MATKEY_TEXMAP_AXIS(aiTextureType_REFLECTION,N)
 32.1247 +
 32.1248 +//! @endcond
 32.1249 +// ---------------------------------------------------------------------------
 32.1250 +#define AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE,type,N
 32.1251 +
 32.1252 +// For backward compatibility and simplicity
 32.1253 +//! @cond MATS_DOC_FULL
 32.1254 +#define AI_MATKEY_UVTRANSFORM_DIFFUSE(N)    \
 32.1255 +    AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,N)
 32.1256 +
 32.1257 +#define AI_MATKEY_UVTRANSFORM_SPECULAR(N)   \
 32.1258 +    AI_MATKEY_UVTRANSFORM(aiTextureType_SPECULAR,N)
 32.1259 +
 32.1260 +#define AI_MATKEY_UVTRANSFORM_AMBIENT(N)    \
 32.1261 +    AI_MATKEY_UVTRANSFORM(aiTextureType_AMBIENT,N)
 32.1262 +
 32.1263 +#define AI_MATKEY_UVTRANSFORM_EMISSIVE(N)   \
 32.1264 +    AI_MATKEY_UVTRANSFORM(aiTextureType_EMISSIVE,N)
 32.1265 +
 32.1266 +#define AI_MATKEY_UVTRANSFORM_NORMALS(N)    \
 32.1267 +    AI_MATKEY_UVTRANSFORM(aiTextureType_NORMALS,N)
 32.1268 +
 32.1269 +#define AI_MATKEY_UVTRANSFORM_HEIGHT(N) \
 32.1270 +    AI_MATKEY_UVTRANSFORM(aiTextureType_HEIGHT,N)
 32.1271 +
 32.1272 +#define AI_MATKEY_UVTRANSFORM_SHININESS(N)  \
 32.1273 +    AI_MATKEY_UVTRANSFORM(aiTextureType_SHININESS,N)
 32.1274 +
 32.1275 +#define AI_MATKEY_UVTRANSFORM_OPACITY(N)    \
 32.1276 +    AI_MATKEY_UVTRANSFORM(aiTextureType_OPACITY,N)
 32.1277 +
 32.1278 +#define AI_MATKEY_UVTRANSFORM_DISPLACEMENT(N)   \
 32.1279 +    AI_MATKEY_UVTRANSFORM(aiTextureType_DISPLACEMENT,N)
 32.1280 +
 32.1281 +#define AI_MATKEY_UVTRANSFORM_LIGHTMAP(N)   \
 32.1282 +    AI_MATKEY_UVTRANSFORM(aiTextureType_LIGHTMAP,N)
 32.1283 +
 32.1284 +#define AI_MATKEY_UVTRANSFORM_REFLECTION(N) \
 32.1285 +    AI_MATKEY_UVTRANSFORM(aiTextureType_REFLECTION,N)
 32.1286 +
 32.1287 +#define AI_MATKEY_UVTRANSFORM_UNKNOWN(N)    \
 32.1288 +    AI_MATKEY_UVTRANSFORM(aiTextureType_UNKNOWN,N)
 32.1289 +
 32.1290 +//! @endcond
 32.1291 +// ---------------------------------------------------------------------------
 32.1292 +#define AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE,type,N
 32.1293 +
 32.1294 +// For backward compatibility and simplicity
 32.1295 +//! @cond MATS_DOC_FULL
 32.1296 +#define AI_MATKEY_TEXFLAGS_DIFFUSE(N)   \
 32.1297 +    AI_MATKEY_TEXFLAGS(aiTextureType_DIFFUSE,N)
 32.1298 +
 32.1299 +#define AI_MATKEY_TEXFLAGS_SPECULAR(N)  \
 32.1300 +    AI_MATKEY_TEXFLAGS(aiTextureType_SPECULAR,N)
 32.1301 +
 32.1302 +#define AI_MATKEY_TEXFLAGS_AMBIENT(N)   \
 32.1303 +    AI_MATKEY_TEXFLAGS(aiTextureType_AMBIENT,N)
 32.1304 +
 32.1305 +#define AI_MATKEY_TEXFLAGS_EMISSIVE(N)  \
 32.1306 +    AI_MATKEY_TEXFLAGS(aiTextureType_EMISSIVE,N)
 32.1307 +
 32.1308 +#define AI_MATKEY_TEXFLAGS_NORMALS(N)   \
 32.1309 +    AI_MATKEY_TEXFLAGS(aiTextureType_NORMALS,N)
 32.1310 +
 32.1311 +#define AI_MATKEY_TEXFLAGS_HEIGHT(N)    \
 32.1312 +    AI_MATKEY_TEXFLAGS(aiTextureType_HEIGHT,N)
 32.1313 +
 32.1314 +#define AI_MATKEY_TEXFLAGS_SHININESS(N) \
 32.1315 +    AI_MATKEY_TEXFLAGS(aiTextureType_SHININESS,N)
 32.1316 +
 32.1317 +#define AI_MATKEY_TEXFLAGS_OPACITY(N)   \
 32.1318 +    AI_MATKEY_TEXFLAGS(aiTextureType_OPACITY,N)
 32.1319 +
 32.1320 +#define AI_MATKEY_TEXFLAGS_DISPLACEMENT(N)  \
 32.1321 +    AI_MATKEY_TEXFLAGS(aiTextureType_DISPLACEMENT,N)
 32.1322 +
 32.1323 +#define AI_MATKEY_TEXFLAGS_LIGHTMAP(N)  \
 32.1324 +    AI_MATKEY_TEXFLAGS(aiTextureType_LIGHTMAP,N)
 32.1325 +
 32.1326 +#define AI_MATKEY_TEXFLAGS_REFLECTION(N)    \
 32.1327 +    AI_MATKEY_TEXFLAGS(aiTextureType_REFLECTION,N)
 32.1328 +
 32.1329 +#define AI_MATKEY_TEXFLAGS_UNKNOWN(N)   \
 32.1330 +    AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN,N)
 32.1331 +
 32.1332 +//! @endcond
 32.1333 +//!
 32.1334 +// ---------------------------------------------------------------------------
 32.1335 +/** @brief Retrieve a material property with a specific key from the material
 32.1336 + *
 32.1337 + * @param pMat Pointer to the input material. May not be NULL
 32.1338 + * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
 32.1339 + * @param type Specifies the type of the texture to be retrieved (
 32.1340 + *    e.g. diffuse, specular, height map ...)
 32.1341 + * @param index Index of the texture to be retrieved.
 32.1342 + * @param pPropOut Pointer to receive a pointer to a valid aiMaterialProperty
 32.1343 + *        structure or NULL if the key has not been found. */
 32.1344 +// ---------------------------------------------------------------------------
 32.1345 +ASSIMP_API C_ENUM aiReturn aiGetMaterialProperty(
 32.1346 +    const C_STRUCT aiMaterial* pMat,
 32.1347 +    const char* pKey,
 32.1348 +    unsigned int type,
 32.1349 +    unsigned int  index,
 32.1350 +    const C_STRUCT aiMaterialProperty** pPropOut);
 32.1351 +
 32.1352 +// ---------------------------------------------------------------------------
 32.1353 +/** @brief Retrieve an array of float values with a specific key
 32.1354 + *  from the material
 32.1355 + *
 32.1356 + * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the
 32.1357 + * example reads the #AI_MATKEY_UVTRANSFORM property of the first diffuse texture)
 32.1358 + * @code
 32.1359 + * aiUVTransform trafo;
 32.1360 + * unsigned int max = sizeof(aiUVTransform);
 32.1361 + * if (AI_SUCCESS != aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,0),
 32.1362 + *    (float*)&trafo, &max) || sizeof(aiUVTransform) != max)
 32.1363 + * {
 32.1364 + *   // error handling
 32.1365 + * }
 32.1366 + * @endcode
 32.1367 + *
 32.1368 + * @param pMat Pointer to the input material. May not be NULL
 32.1369 + * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
 32.1370 + * @param pOut Pointer to a buffer to receive the result.
 32.1371 + * @param pMax Specifies the size of the given buffer, in float's.
 32.1372 + *        Receives the number of values (not bytes!) read.
 32.1373 + * @param type (see the code sample above)
 32.1374 + * @param index (see the code sample above)
 32.1375 + * @return Specifies whether the key has been found. If not, the output
 32.1376 + *   arrays remains unmodified and pMax is set to 0.*/
 32.1377 +// ---------------------------------------------------------------------------
 32.1378 +ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(
 32.1379 +    const C_STRUCT aiMaterial* pMat,
 32.1380 +    const char* pKey,
 32.1381 +    unsigned int type,
 32.1382 +    unsigned int index,
 32.1383 +    ai_real* pOut,
 32.1384 +    unsigned int* pMax);
 32.1385 +
 32.1386 +
 32.1387 +#ifdef __cplusplus
 32.1388 +
 32.1389 +// ---------------------------------------------------------------------------
 32.1390 +/** @brief Retrieve a single float property with a specific key from the material.
 32.1391 +*
 32.1392 +* Pass one of the AI_MATKEY_XXX constants for the last three parameters (the
 32.1393 +* example reads the #AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture)
 32.1394 +* @code
 32.1395 +* float specStrength = 1.f; // default value, remains unmodified if we fail.
 32.1396 +* aiGetMaterialFloat(mat, AI_MATKEY_SHININESS_STRENGTH,
 32.1397 +*    (float*)&specStrength);
 32.1398 +* @endcode
 32.1399 +*
 32.1400 +* @param pMat Pointer to the input material. May not be NULL
 32.1401 +* @param pKey Key to search for. One of the AI_MATKEY_XXX constants.
 32.1402 +* @param pOut Receives the output float.
 32.1403 +* @param type (see the code sample above)
 32.1404 +* @param index (see the code sample above)
 32.1405 +* @return Specifies whether the key has been found. If not, the output
 32.1406 +*   float remains unmodified.*/
 32.1407 +// ---------------------------------------------------------------------------
 32.1408 +inline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,
 32.1409 +    const char* pKey,
 32.1410 +    unsigned int type,
 32.1411 +    unsigned int index,
 32.1412 +    ai_real* pOut)
 32.1413 +{
 32.1414 +    return aiGetMaterialFloatArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);
 32.1415 +}
 32.1416 +
 32.1417 +#else
 32.1418 +
 32.1419 +// Use our friend, the C preprocessor
 32.1420 +#define aiGetMaterialFloat (pMat, type, index, pKey, pOut) \
 32.1421 +    aiGetMaterialFloatArray(pMat, type, index, pKey, pOut, NULL)
 32.1422 +
 32.1423 +#endif //!__cplusplus
 32.1424 +
 32.1425 +
 32.1426 +// ---------------------------------------------------------------------------
 32.1427 +/** @brief Retrieve an array of integer values with a specific key
 32.1428 + *  from a material
 32.1429 + *
 32.1430 + * See the sample for aiGetMaterialFloatArray for more information.*/
 32.1431 +ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial* pMat,
 32.1432 +     const char* pKey,
 32.1433 +     unsigned int  type,
 32.1434 +     unsigned int  index,
 32.1435 +     int* pOut,
 32.1436 +     unsigned int* pMax);
 32.1437 +
 32.1438 +
 32.1439 +#ifdef __cplusplus
 32.1440 +
 32.1441 +// ---------------------------------------------------------------------------
 32.1442 +/** @brief Retrieve an integer property with a specific key from a material
 32.1443 + *
 32.1444 + * See the sample for aiGetMaterialFloat for more information.*/
 32.1445 +// ---------------------------------------------------------------------------
 32.1446 +inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial* pMat,
 32.1447 +    const char* pKey,
 32.1448 +    unsigned int type,
 32.1449 +    unsigned int index,
 32.1450 +    int* pOut)
 32.1451 +{
 32.1452 +    return aiGetMaterialIntegerArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);
 32.1453 +}
 32.1454 +
 32.1455 +#else
 32.1456 +
 32.1457 +// use our friend, the C preprocessor
 32.1458 +#define aiGetMaterialInteger (pMat, type, index, pKey, pOut) \
 32.1459 +    aiGetMaterialIntegerArray(pMat, type, index, pKey, pOut, NULL)
 32.1460 +
 32.1461 +#endif //!__cplusplus
 32.1462 +
 32.1463 +
 32.1464 +
 32.1465 +// ---------------------------------------------------------------------------
 32.1466 +/** @brief Retrieve a color value from the material property table
 32.1467 +*
 32.1468 +* See the sample for aiGetMaterialFloat for more information*/
 32.1469 +// ---------------------------------------------------------------------------
 32.1470 +ASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial* pMat,
 32.1471 +    const char* pKey,
 32.1472 +    unsigned int type,
 32.1473 +    unsigned int index,
 32.1474 +    C_STRUCT aiColor4D* pOut);
 32.1475 +
 32.1476 +
 32.1477 +// ---------------------------------------------------------------------------
 32.1478 +/** @brief Retrieve a aiUVTransform value from the material property table
 32.1479 +*
 32.1480 +* See the sample for aiGetMaterialFloat for more information*/
 32.1481 +// ---------------------------------------------------------------------------
 32.1482 +ASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial* pMat,
 32.1483 +    const char* pKey,
 32.1484 +    unsigned int type,
 32.1485 +    unsigned int index,
 32.1486 +    C_STRUCT aiUVTransform* pOut);
 32.1487 +
 32.1488 +
 32.1489 +// ---------------------------------------------------------------------------
 32.1490 +/** @brief Retrieve a string from the material property table
 32.1491 +*
 32.1492 +* See the sample for aiGetMaterialFloat for more information.*/
 32.1493 +// ---------------------------------------------------------------------------
 32.1494 +ASSIMP_API C_ENUM aiReturn aiGetMaterialString(const C_STRUCT aiMaterial* pMat,
 32.1495 +    const char* pKey,
 32.1496 +    unsigned int type,
 32.1497 +    unsigned int index,
 32.1498 +    C_STRUCT aiString* pOut);
 32.1499 +
 32.1500 +// ---------------------------------------------------------------------------
 32.1501 +/** Get the number of textures for a particular texture type.
 32.1502 + *  @param[in] pMat Pointer to the input material. May not be NULL
 32.1503 + *  @param type Texture type to check for
 32.1504 + *  @return Number of textures for this type.
 32.1505 + *  @note A texture can be easily queried using #aiGetMaterialTexture() */
 32.1506 +// ---------------------------------------------------------------------------
 32.1507 +ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMat,
 32.1508 +    C_ENUM aiTextureType type);
 32.1509 +
 32.1510 +// ---------------------------------------------------------------------------
 32.1511 +/** @brief Helper function to get all values pertaining to a particular
 32.1512 + *  texture slot from a material structure.
 32.1513 + *
 32.1514 + *  This function is provided just for convenience. You could also read the
 32.1515 + *  texture by parsing all of its properties manually. This function bundles
 32.1516 + *  all of them in a huge function monster.
 32.1517 + *
 32.1518 + *  @param[in] mat Pointer to the input material. May not be NULL
 32.1519 + *  @param[in] type Specifies the texture stack to read from (e.g. diffuse,
 32.1520 + *     specular, height map ...).
 32.1521 + *  @param[in] index Index of the texture. The function fails if the
 32.1522 + *     requested index is not available for this texture type.
 32.1523 + *     #aiGetMaterialTextureCount() can be used to determine the number of
 32.1524 + *     textures in a particular texture stack.
 32.1525 + *  @param[out] path Receives the output path
 32.1526 + *     If the texture is embedded, receives a '*' followed by the id of
 32.1527 + *     the texture (for the textures stored in the corresponding scene) which
 32.1528 + *     can be converted to an int using a function like atoi.
 32.1529 + *     This parameter must be non-null.
 32.1530 + *  @param mapping The texture mapping mode to be used.
 32.1531 + *      Pass NULL if you're not interested in this information.
 32.1532 + *  @param[out] uvindex For UV-mapped textures: receives the index of the UV
 32.1533 + *      source channel. Unmodified otherwise.
 32.1534 + *      Pass NULL if you're not interested in this information.
 32.1535 + *  @param[out] blend Receives the blend factor for the texture
 32.1536 + *      Pass NULL if you're not interested in this information.
 32.1537 + *  @param[out] op Receives the texture blend operation to be perform between
 32.1538 + *      this texture and the previous texture.
 32.1539 + *      Pass NULL if you're not interested in this information.
 32.1540 + *  @param[out] mapmode Receives the mapping modes to be used for the texture.
 32.1541 + *      Pass NULL if you're not interested in this information. Otherwise,
 32.1542 + *      pass a pointer to an array of two aiTextureMapMode's (one for each
 32.1543 + *      axis, UV order).
 32.1544 + *  @param[out] flags Receives the the texture flags.
 32.1545 + *  @return AI_SUCCESS on success, otherwise something else. Have fun.*/
 32.1546 +// ---------------------------------------------------------------------------
 32.1547 +#ifdef __cplusplus
 32.1548 +ASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
 32.1549 +    aiTextureType type,
 32.1550 +    unsigned int  index,
 32.1551 +    aiString* path,
 32.1552 +    aiTextureMapping* mapping   = NULL,
 32.1553 +    unsigned int* uvindex       = NULL,
 32.1554 +    ai_real* blend              = NULL,
 32.1555 +    aiTextureOp* op             = NULL,
 32.1556 +    aiTextureMapMode* mapmode   = NULL,
 32.1557 +    unsigned int* flags         = NULL);
 32.1558 +#else
 32.1559 +C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
 32.1560 +    C_ENUM aiTextureType type,
 32.1561 +    unsigned int  index,
 32.1562 +    C_STRUCT aiString* path,
 32.1563 +    C_ENUM aiTextureMapping* mapping    /*= NULL*/,
 32.1564 +    unsigned int* uvindex               /*= NULL*/,
 32.1565 +    ai_real* blend                      /*= NULL*/,
 32.1566 +    C_ENUM aiTextureOp* op              /*= NULL*/,
 32.1567 +    C_ENUM aiTextureMapMode* mapmode    /*= NULL*/,
 32.1568 +    unsigned int* flags                 /*= NULL*/);
 32.1569 +#endif // !#ifdef __cplusplus
 32.1570 +
 32.1571 +
 32.1572 +#ifdef __cplusplus
 32.1573 +}
 32.1574 +
 32.1575 +#include "material.inl"
 32.1576 +
 32.1577 +#endif //!__cplusplus
 32.1578 +
 32.1579 +#endif //!!AI_MATERIAL_H_INC
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/include/miniassimp/material.inl	Mon Jan 28 18:19:26 2019 +0200
    33.3 @@ -0,0 +1,390 @@
    33.4 +/*
    33.5 +---------------------------------------------------------------------------
    33.6 +Open Asset Import Library (assimp)
    33.7 +---------------------------------------------------------------------------
    33.8 +
    33.9 +Copyright (c) 2006-2018, assimp team
   33.10 +
   33.11 +
   33.12 +
   33.13 +All rights reserved.
   33.14 +
   33.15 +Redistribution and use of this software in source and binary forms,
   33.16 +with or without modification, are permitted provided that the following
   33.17 +conditions are met:
   33.18 +
   33.19 +* Redistributions of source code must retain the above
   33.20 +  copyright notice, this list of conditions and the
   33.21 +  following disclaimer.
   33.22 +
   33.23 +* Redistributions in binary form must reproduce the above
   33.24 +  copyright notice, this list of conditions and the
   33.25 +  following disclaimer in the documentation and/or other
   33.26 +  materials provided with the distribution.
   33.27 +
   33.28 +* Neither the name of the assimp team, nor the names of its
   33.29 +  contributors may be used to endorse or promote products
   33.30 +  derived from this software without specific prior
   33.31 +  written permission of the assimp team.
   33.32 +
   33.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   33.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   33.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   33.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   33.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   33.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   33.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   33.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   33.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   33.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   33.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   33.44 +---------------------------------------------------------------------------
   33.45 +*/
   33.46 +
   33.47 +/** @file material.inl
   33.48 + *  @brief Defines the C++ getters for the material system
   33.49 + */
   33.50 +
   33.51 +#pragma once
   33.52 +#ifndef AI_MATERIAL_INL_INC
   33.53 +#define AI_MATERIAL_INL_INC
   33.54 +
   33.55 +// ---------------------------------------------------------------------------
   33.56 +inline aiPropertyTypeInfo ai_real_to_property_type_info(float)
   33.57 +{
   33.58 +	return aiPTI_Float;
   33.59 +}
   33.60 +
   33.61 +inline aiPropertyTypeInfo ai_real_to_property_type_info(double)
   33.62 +{
   33.63 +	return aiPTI_Double;
   33.64 +}
   33.65 +// ---------------------------------------------------------------------------
   33.66 +
   33.67 +//! @cond never
   33.68 +
   33.69 +// ---------------------------------------------------------------------------
   33.70 +inline aiReturn aiMaterial::GetTexture( aiTextureType type,
   33.71 +   unsigned int  index,
   33.72 +   C_STRUCT aiString* path,
   33.73 +   aiTextureMapping* mapping    /*= NULL*/,
   33.74 +   unsigned int* uvindex        /*= NULL*/,
   33.75 +   ai_real* blend               /*= NULL*/,
   33.76 +   aiTextureOp* op              /*= NULL*/,
   33.77 +   aiTextureMapMode* mapmode    /*= NULL*/) const
   33.78 +{
   33.79 +    return ::aiGetMaterialTexture(this,type,index,path,mapping,uvindex,blend,op,mapmode);
   33.80 +}
   33.81 +
   33.82 +// ---------------------------------------------------------------------------
   33.83 +inline unsigned int aiMaterial::GetTextureCount(aiTextureType type) const
   33.84 +{
   33.85 +    return ::aiGetMaterialTextureCount(this,type);
   33.86 +}
   33.87 +
   33.88 +// ---------------------------------------------------------------------------
   33.89 +template <typename Type>
   33.90 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
   33.91 +    unsigned int idx, Type* pOut,
   33.92 +    unsigned int* pMax) const
   33.93 +{
   33.94 +    unsigned int iNum = pMax ? *pMax : 1;
   33.95 +
   33.96 +    const aiMaterialProperty* prop;
   33.97 +    const aiReturn ret = ::aiGetMaterialProperty(this,pKey,type,idx,
   33.98 +        (const aiMaterialProperty**)&prop);
   33.99 +    if ( AI_SUCCESS == ret )    {
  33.100 +
  33.101 +        if (prop->mDataLength < sizeof(Type)*iNum) {
  33.102 +            return AI_FAILURE;
  33.103 +        }
  33.104 +
  33.105 +        if (prop->mType != aiPTI_Buffer) {
  33.106 +            return AI_FAILURE;
  33.107 +        }
  33.108 +
  33.109 +        iNum = std::min((size_t)iNum,prop->mDataLength / sizeof(Type));
  33.110 +        ::memcpy(pOut,prop->mData,iNum * sizeof(Type));
  33.111 +        if (pMax) {
  33.112 +            *pMax = iNum;
  33.113 +        }
  33.114 +    }
  33.115 +    return ret;
  33.116 +}
  33.117 +
  33.118 +// ---------------------------------------------------------------------------
  33.119 +template <typename Type>
  33.120 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.121 +    unsigned int idx,Type& pOut) const
  33.122 +{
  33.123 +    const aiMaterialProperty* prop;
  33.124 +    const aiReturn ret = ::aiGetMaterialProperty(this,pKey,type,idx,
  33.125 +        (const aiMaterialProperty**)&prop);
  33.126 +    if ( AI_SUCCESS == ret ) {
  33.127 +
  33.128 +        if (prop->mDataLength < sizeof(Type)) {
  33.129 +            return AI_FAILURE;
  33.130 +        }
  33.131 +
  33.132 +        if (prop->mType != aiPTI_Buffer) {
  33.133 +            return AI_FAILURE;
  33.134 +        }
  33.135 +
  33.136 +        ::memcpy( &pOut, prop->mData, sizeof( Type ) );
  33.137 +    }
  33.138 +    return ret;
  33.139 +}
  33.140 +
  33.141 +// ---------------------------------------------------------------------------
  33.142 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.143 +    unsigned int idx,ai_real* pOut,
  33.144 +    unsigned int* pMax) const
  33.145 +{
  33.146 +    return ::aiGetMaterialFloatArray(this,pKey,type,idx,pOut,pMax);
  33.147 +}
  33.148 +// ---------------------------------------------------------------------------
  33.149 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.150 +    unsigned int idx,int* pOut,
  33.151 +    unsigned int* pMax) const
  33.152 +{
  33.153 +    return ::aiGetMaterialIntegerArray(this,pKey,type,idx,pOut,pMax);
  33.154 +}
  33.155 +// ---------------------------------------------------------------------------
  33.156 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.157 +    unsigned int idx,ai_real& pOut) const
  33.158 +{
  33.159 +    return aiGetMaterialFloat(this,pKey,type,idx,&pOut);
  33.160 +}
  33.161 +// ---------------------------------------------------------------------------
  33.162 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.163 +    unsigned int idx,int& pOut) const
  33.164 +{
  33.165 +    return aiGetMaterialInteger(this,pKey,type,idx,&pOut);
  33.166 +}
  33.167 +// ---------------------------------------------------------------------------
  33.168 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.169 +    unsigned int idx,aiColor4D& pOut) const
  33.170 +{
  33.171 +    return aiGetMaterialColor(this,pKey,type,idx,&pOut);
  33.172 +}
  33.173 +// ---------------------------------------------------------------------------
  33.174 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.175 +    unsigned int idx,aiColor3D& pOut) const
  33.176 +{
  33.177 +    aiColor4D c;
  33.178 +    const aiReturn ret = aiGetMaterialColor(this,pKey,type,idx,&c);
  33.179 +    pOut = aiColor3D(c.r,c.g,c.b);
  33.180 +    return ret;
  33.181 +}
  33.182 +// ---------------------------------------------------------------------------
  33.183 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.184 +    unsigned int idx,aiString& pOut) const
  33.185 +{
  33.186 +    return aiGetMaterialString(this,pKey,type,idx,&pOut);
  33.187 +}
  33.188 +// ---------------------------------------------------------------------------
  33.189 +inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
  33.190 +    unsigned int idx,aiUVTransform& pOut) const
  33.191 +{
  33.192 +    return aiGetMaterialUVTransform(this,pKey,type,idx,&pOut);
  33.193 +}
  33.194 +
  33.195 +
  33.196 +// ---------------------------------------------------------------------------
  33.197 +template<class TYPE>
  33.198 +aiReturn aiMaterial::AddProperty (const TYPE* pInput,
  33.199 +    const unsigned int pNumValues,
  33.200 +    const char* pKey,
  33.201 +    unsigned int type,
  33.202 +    unsigned int index)
  33.203 +{
  33.204 +    return AddBinaryProperty((const void*)pInput,
  33.205 +        pNumValues * sizeof(TYPE),
  33.206 +        pKey,type,index,aiPTI_Buffer);
  33.207 +}
  33.208 +
  33.209 +// ---------------------------------------------------------------------------
  33.210 +inline aiReturn aiMaterial::AddProperty(const float* pInput,
  33.211 +    const unsigned int pNumValues,
  33.212 +    const char* pKey,
  33.213 +    unsigned int type,
  33.214 +    unsigned int index)
  33.215 +{
  33.216 +    return AddBinaryProperty((const void*)pInput,
  33.217 +        pNumValues * sizeof(float),
  33.218 +        pKey,type,index,aiPTI_Float);
  33.219 +}
  33.220 +
  33.221 +// ---------------------------------------------------------------------------
  33.222 +inline aiReturn aiMaterial::AddProperty(const double* pInput,
  33.223 +    const unsigned int pNumValues,
  33.224 +    const char* pKey,
  33.225 +    unsigned int type,
  33.226 +    unsigned int index)
  33.227 +{
  33.228 +    return AddBinaryProperty((const void*)pInput,
  33.229 +        pNumValues * sizeof(double),
  33.230 +        pKey,type,index,aiPTI_Double);
  33.231 +}
  33.232 +
  33.233 +// ---------------------------------------------------------------------------
  33.234 +inline aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput,
  33.235 +    const unsigned int pNumValues,
  33.236 +    const char* pKey,
  33.237 +    unsigned int type,
  33.238 +    unsigned int index)
  33.239 +{
  33.240 +    return AddBinaryProperty((const void*)pInput,
  33.241 +        pNumValues * sizeof(aiUVTransform),
  33.242 +        pKey,type,index,ai_real_to_property_type_info(pInput->mRotation));
  33.243 +}
  33.244 +
  33.245 +// ---------------------------------------------------------------------------
  33.246 +inline aiReturn aiMaterial::AddProperty(const aiColor4D* pInput,
  33.247 +    const unsigned int pNumValues,
  33.248 +    const char* pKey,
  33.249 +    unsigned int type,
  33.250 +    unsigned int index)
  33.251 +{
  33.252 +    return AddBinaryProperty((const void*)pInput,
  33.253 +        pNumValues * sizeof(aiColor4D),
  33.254 +        pKey,type,index,ai_real_to_property_type_info(pInput->a));
  33.255 +}
  33.256 +
  33.257 +// ---------------------------------------------------------------------------
  33.258 +inline aiReturn aiMaterial::AddProperty(const aiColor3D* pInput,
  33.259 +    const unsigned int pNumValues,
  33.260 +    const char* pKey,
  33.261 +    unsigned int type,
  33.262 +    unsigned int index)
  33.263 +{
  33.264 +    return AddBinaryProperty((const void*)pInput,
  33.265 +        pNumValues * sizeof(aiColor3D),
  33.266 +        pKey,type,index,ai_real_to_property_type_info(pInput->b));
  33.267 +}
  33.268 +
  33.269 +// ---------------------------------------------------------------------------
  33.270 +inline aiReturn aiMaterial::AddProperty(const aiVector3D* pInput,
  33.271 +    const unsigned int pNumValues,
  33.272 +    const char* pKey,
  33.273 +    unsigned int type,
  33.274 +    unsigned int index)
  33.275 +{
  33.276 +    return AddBinaryProperty((const void*)pInput,
  33.277 +        pNumValues * sizeof(aiVector3D),
  33.278 +        pKey,type,index,ai_real_to_property_type_info(pInput->x));
  33.279 +}
  33.280 +
  33.281 +// ---------------------------------------------------------------------------
  33.282 +inline aiReturn aiMaterial::AddProperty(const int* pInput,
  33.283 +    const unsigned int pNumValues,
  33.284 +    const char* pKey,
  33.285 +    unsigned int type,
  33.286 +    unsigned int index)
  33.287 +{
  33.288 +    return AddBinaryProperty((const void*)pInput,
  33.289 +        pNumValues * sizeof(int),
  33.290 +        pKey,type,index,aiPTI_Integer);
  33.291 +}
  33.292 +
  33.293 +
  33.294 +// ---------------------------------------------------------------------------
  33.295 +// The template specializations below are for backwards compatibility.
  33.296 +// The recommended way to add material properties is using the non-template
  33.297 +// overloads.
  33.298 +// ---------------------------------------------------------------------------
  33.299 +
  33.300 +// ---------------------------------------------------------------------------
  33.301 +template<>
  33.302 +inline aiReturn aiMaterial::AddProperty<float>(const float* pInput,
  33.303 +    const unsigned int pNumValues,
  33.304 +    const char* pKey,
  33.305 +    unsigned int type,
  33.306 +    unsigned int index)
  33.307 +{
  33.308 +    return AddBinaryProperty((const void*)pInput,
  33.309 +        pNumValues * sizeof(float),
  33.310 +        pKey,type,index,aiPTI_Float);
  33.311 +}
  33.312 +
  33.313 +// ---------------------------------------------------------------------------
  33.314 +template<>
  33.315 +inline aiReturn aiMaterial::AddProperty<double>(const double* pInput,
  33.316 +    const unsigned int pNumValues,
  33.317 +    const char* pKey,
  33.318 +    unsigned int type,
  33.319 +    unsigned int index)
  33.320 +{
  33.321 +    return AddBinaryProperty((const void*)pInput,
  33.322 +        pNumValues * sizeof(double),
  33.323 +        pKey,type,index,aiPTI_Double);
  33.324 +}
  33.325 +
  33.326 +// ---------------------------------------------------------------------------
  33.327 +template<>
  33.328 +inline aiReturn aiMaterial::AddProperty<aiUVTransform>(const aiUVTransform* pInput,
  33.329 +    const unsigned int pNumValues,
  33.330 +    const char* pKey,
  33.331 +    unsigned int type,
  33.332 +    unsigned int index)
  33.333 +{
  33.334 +    return AddBinaryProperty((const void*)pInput,
  33.335 +        pNumValues * sizeof(aiUVTransform),
  33.336 +        pKey,type,index,aiPTI_Float);
  33.337 +}
  33.338 +
  33.339 +// ---------------------------------------------------------------------------
  33.340 +template<>
  33.341 +inline aiReturn aiMaterial::AddProperty<aiColor4D>(const aiColor4D* pInput,
  33.342 +    const unsigned int pNumValues,
  33.343 +    const char* pKey,
  33.344 +    unsigned int type,
  33.345 +    unsigned int index)
  33.346 +{
  33.347 +    return AddBinaryProperty((const void*)pInput,
  33.348 +        pNumValues * sizeof(aiColor4D),
  33.349 +        pKey,type,index,aiPTI_Float);
  33.350 +}
  33.351 +
  33.352 +// ---------------------------------------------------------------------------
  33.353 +template<>
  33.354 +inline aiReturn aiMaterial::AddProperty<aiColor3D>(const aiColor3D* pInput,
  33.355 +    const unsigned int pNumValues,
  33.356 +    const char* pKey,
  33.357 +    unsigned int type,
  33.358 +    unsigned int index)
  33.359 +{
  33.360 +    return AddBinaryProperty((const void*)pInput,
  33.361 +        pNumValues * sizeof(aiColor3D),
  33.362 +        pKey,type,index,aiPTI_Float);
  33.363 +}
  33.364 +
  33.365 +// ---------------------------------------------------------------------------
  33.366 +template<>
  33.367 +inline aiReturn aiMaterial::AddProperty<aiVector3D>(const aiVector3D* pInput,
  33.368 +    const unsigned int pNumValues,
  33.369 +    const char* pKey,
  33.370 +    unsigned int type,
  33.371 +    unsigned int index)
  33.372 +{
  33.373 +    return AddBinaryProperty((const void*)pInput,
  33.374 +        pNumValues * sizeof(aiVector3D),
  33.375 +        pKey,type,index,aiPTI_Float);
  33.376 +}
  33.377 +
  33.378 +// ---------------------------------------------------------------------------
  33.379 +template<>
  33.380 +inline aiReturn aiMaterial::AddProperty<int>(const int* pInput,
  33.381 +    const unsigned int pNumValues,
  33.382 +    const char* pKey,
  33.383 +    unsigned int type,
  33.384 +    unsigned int index)
  33.385 +{
  33.386 +    return AddBinaryProperty((const void*)pInput,
  33.387 +        pNumValues * sizeof(int),
  33.388 +        pKey,type,index,aiPTI_Integer);
  33.389 +}
  33.390 +
  33.391 +//! @endcond
  33.392 +
  33.393 +#endif //! AI_MATERIAL_INL_INC
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/include/miniassimp/matrix3x3.h	Mon Jan 28 18:19:26 2019 +0200
    34.3 @@ -0,0 +1,183 @@
    34.4 +/*
    34.5 +---------------------------------------------------------------------------
    34.6 +Open Asset Import Library (assimp)
    34.7 +---------------------------------------------------------------------------
    34.8 +
    34.9 +Copyright (c) 2006-2018, assimp team
   34.10 +
   34.11 +
   34.12 +
   34.13 +All rights reserved.
   34.14 +
   34.15 +Redistribution and use of this software in source and binary forms,
   34.16 +with or without modification, are permitted provided that the following
   34.17 +conditions are met:
   34.18 +
   34.19 +* Redistributions of source code must retain the above
   34.20 +  copyright notice, this list of conditions and the
   34.21 +  following disclaimer.
   34.22 +
   34.23 +* Redistributions in binary form must reproduce the above
   34.24 +  copyright notice, this list of conditions and the
   34.25 +  following disclaimer in the documentation and/or other
   34.26 +  materials provided with the distribution.
   34.27 +
   34.28 +* Neither the name of the assimp team, nor the names of its
   34.29 +  contributors may be used to endorse or promote products
   34.30 +  derived from this software without specific prior
   34.31 +  written permission of the assimp team.
   34.32 +
   34.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   34.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   34.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   34.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   34.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   34.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   34.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   34.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   34.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   34.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   34.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   34.44 +---------------------------------------------------------------------------
   34.45 +*/
   34.46 +
   34.47 +/** @file matrix3x3.h
   34.48 + *  @brief Definition of a 3x3 matrix, including operators when compiling in C++
   34.49 + */
   34.50 +#pragma once
   34.51 +#ifndef AI_MATRIX3X3_H_INC
   34.52 +#define AI_MATRIX3X3_H_INC
   34.53 +
   34.54 +#include "defs.h"
   34.55 +
   34.56 +#ifdef __cplusplus
   34.57 +
   34.58 +template <typename T> class aiMatrix4x4t;
   34.59 +template <typename T> class aiVector2t;
   34.60 +
   34.61 +// ---------------------------------------------------------------------------
   34.62 +/** @brief Represents a row-major 3x3 matrix
   34.63 + *
   34.64 + *  There's much confusion about matrix layouts (column vs. row order).
   34.65 + *  This is *always* a row-major matrix. Not even with the
   34.66 + *  #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect
   34.67 + *  matrix order - it just affects the handedness of the coordinate system
   34.68 + *  defined thereby.
   34.69 + */
   34.70 +template <typename TReal>
   34.71 +class aiMatrix3x3t
   34.72 +{
   34.73 +public:
   34.74 +
   34.75 +    aiMatrix3x3t() AI_NO_EXCEPT :
   34.76 +        a1(static_cast<TReal>(1.0f)), a2(), a3(),
   34.77 +        b1(), b2(static_cast<TReal>(1.0f)), b3(),
   34.78 +        c1(), c2(), c3(static_cast<TReal>(1.0f)) {}
   34.79 +
   34.80 +    aiMatrix3x3t (  TReal _a1, TReal _a2, TReal _a3,
   34.81 +                    TReal _b1, TReal _b2, TReal _b3,
   34.82 +                    TReal _c1, TReal _c2, TReal _c3) :
   34.83 +        a1(_a1), a2(_a2), a3(_a3),
   34.84 +        b1(_b1), b2(_b2), b3(_b3),
   34.85 +        c1(_c1), c2(_c2), c3(_c3)
   34.86 +    {}
   34.87 +
   34.88 +public:
   34.89 +
   34.90 +    // matrix multiplication.
   34.91 +    aiMatrix3x3t& operator *= (const aiMatrix3x3t& m);
   34.92 +    aiMatrix3x3t  operator  * (const aiMatrix3x3t& m) const;
   34.93 +
   34.94 +    // array access operators
   34.95 +    TReal* operator[]       (unsigned int p_iIndex);
   34.96 +    const TReal* operator[] (unsigned int p_iIndex) const;
   34.97 +
   34.98 +    // comparison operators
   34.99 +    bool operator== (const aiMatrix4x4t<TReal>& m) const;
  34.100 +    bool operator!= (const aiMatrix4x4t<TReal>& m) const;
  34.101 +
  34.102 +    bool Equal(const aiMatrix4x4t<TReal>& m, TReal epsilon = 1e-6) const;
  34.103 +
  34.104 +    template <typename TOther>
  34.105 +    operator aiMatrix3x3t<TOther> () const;
  34.106 +
  34.107 +public:
  34.108 +
  34.109 +    // -------------------------------------------------------------------
  34.110 +    /** @brief Construction from a 4x4 matrix. The remaining parts
  34.111 +     *  of the matrix are ignored.
  34.112 +     */
  34.113 +    explicit aiMatrix3x3t( const aiMatrix4x4t<TReal>& pMatrix);
  34.114 +
  34.115 +    // -------------------------------------------------------------------
  34.116 +    /** @brief Transpose the matrix
  34.117 +     */
  34.118 +    aiMatrix3x3t& Transpose();
  34.119 +
  34.120 +    // -------------------------------------------------------------------
  34.121 +    /** @brief Invert the matrix.
  34.122 +     *  If the matrix is not invertible all elements are set to qnan.
  34.123 +     *  Beware, use (f != f) to check whether a TReal f is qnan.
  34.124 +     */
  34.125 +    aiMatrix3x3t& Inverse();
  34.126 +    TReal Determinant() const;
  34.127 +
  34.128 +public:
  34.129 +    // -------------------------------------------------------------------
  34.130 +    /** @brief Returns a rotation matrix for a rotation around z
  34.131 +     *  @param a Rotation angle, in radians
  34.132 +     *  @param out Receives the output matrix
  34.133 +     *  @return Reference to the output matrix
  34.134 +     */
  34.135 +    static aiMatrix3x3t& RotationZ(TReal a, aiMatrix3x3t& out);
  34.136 +
  34.137 +    // -------------------------------------------------------------------
  34.138 +    /** @brief Returns a rotation matrix for a rotation around
  34.139 +     *    an arbitrary axis.
  34.140 +     *
  34.141 +     *  @param a Rotation angle, in radians
  34.142 +     *  @param axis Axis to rotate around
  34.143 +     *  @param out To be filled
  34.144 +     */
  34.145 +    static aiMatrix3x3t& Rotation( TReal a,
  34.146 +        const aiVector3t<TReal>& axis, aiMatrix3x3t& out);
  34.147 +
  34.148 +    // -------------------------------------------------------------------
  34.149 +    /** @brief Returns a translation matrix
  34.150 +     *  @param v Translation vector
  34.151 +     *  @param out Receives the output matrix
  34.152 +     *  @return Reference to the output matrix
  34.153 +     */
  34.154 +    static aiMatrix3x3t& Translation( const aiVector2t<TReal>& v, aiMatrix3x3t& out);
  34.155 +
  34.156 +    // -------------------------------------------------------------------
  34.157 +    /** @brief A function for creating a rotation matrix that rotates a
  34.158 +     *  vector called "from" into another vector called "to".
  34.159 +     * Input : from[3], to[3] which both must be *normalized* non-zero vectors
  34.160 +     * Output: mtx[3][3] -- a 3x3 matrix in column-major form
  34.161 +     * Authors: Tomas Möller, John Hughes
  34.162 +     *          "Efficiently Building a Matrix to Rotate One Vector to Another"
  34.163 +     *          Journal of Graphics Tools, 4(4):1-4, 1999
  34.164 +     */
  34.165 +    static aiMatrix3x3t& FromToMatrix(const aiVector3t<TReal>& from,
  34.166 +        const aiVector3t<TReal>& to, aiMatrix3x3t& out);
  34.167 +
  34.168 +public:
  34.169 +    TReal a1, a2, a3;
  34.170 +    TReal b1, b2, b3;
  34.171 +    TReal c1, c2, c3;
  34.172 +};
  34.173 +
  34.174 +typedef aiMatrix3x3t<ai_real> aiMatrix3x3;
  34.175 +
  34.176 +#else
  34.177 +
  34.178 +struct aiMatrix3x3 {
  34.179 +    ai_real a1, a2, a3;
  34.180 +    ai_real b1, b2, b3;
  34.181 +    ai_real c1, c2, c3;
  34.182 +};
  34.183 +
  34.184 +#endif // __cplusplus
  34.185 +
  34.186 +#endif // AI_MATRIX3X3_H_INC
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/include/miniassimp/matrix3x3.inl	Mon Jan 28 18:19:26 2019 +0200
    35.3 @@ -0,0 +1,357 @@
    35.4 +/*
    35.5 +---------------------------------------------------------------------------
    35.6 +Open Asset Import Library (assimp)
    35.7 +---------------------------------------------------------------------------
    35.8 +
    35.9 +Copyright (c) 2006-2018, assimp team
   35.10 +
   35.11 +
   35.12 +
   35.13 +All rights reserved.
   35.14 +
   35.15 +Redistribution and use of this software in source and binary forms,
   35.16 +with or without modification, are permitted provided that the following
   35.17 +conditions are met:
   35.18 +
   35.19 +* Redistributions of source code must retain the above
   35.20 +  copyright notice, this list of conditions and the
   35.21 +  following disclaimer.
   35.22 +
   35.23 +* Redistributions in binary form must reproduce the above
   35.24 +  copyright notice, this list of conditions and the
   35.25 +  following disclaimer in the documentation and/or other
   35.26 +  materials provided with the distribution.
   35.27 +
   35.28 +* Neither the name of the assimp team, nor the names of its
   35.29 +  contributors may be used to endorse or promote products
   35.30 +  derived from this software without specific prior
   35.31 +  written permission of the assimp team.
   35.32 +
   35.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   35.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   35.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   35.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   35.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   35.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   35.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   35.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   35.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   35.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   35.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   35.44 +---------------------------------------------------------------------------
   35.45 +*/
   35.46 +
   35.47 +/** @file matrix3x3.inl
   35.48 + *  @brief Inline implementation of the 3x3 matrix operators
   35.49 + */
   35.50 +#pragma once
   35.51 +#ifndef AI_MATRIX3X3_INL_INC
   35.52 +#define AI_MATRIX3X3_INL_INC
   35.53 +
   35.54 +#ifdef __cplusplus
   35.55 +#include "matrix3x3.h"
   35.56 +
   35.57 +#include "matrix4x4.h"
   35.58 +#include <algorithm>
   35.59 +#include <cmath>
   35.60 +#include <limits>
   35.61 +
   35.62 +// ------------------------------------------------------------------------------------------------
   35.63 +// Construction from a 4x4 matrix. The remaining parts of the matrix are ignored.
   35.64 +template <typename TReal>
   35.65 +inline aiMatrix3x3t<TReal>::aiMatrix3x3t( const aiMatrix4x4t<TReal>& pMatrix)
   35.66 +{
   35.67 +    a1 = pMatrix.a1; a2 = pMatrix.a2; a3 = pMatrix.a3;
   35.68 +    b1 = pMatrix.b1; b2 = pMatrix.b2; b3 = pMatrix.b3;
   35.69 +    c1 = pMatrix.c1; c2 = pMatrix.c2; c3 = pMatrix.c3;
   35.70 +}
   35.71 +
   35.72 +// ------------------------------------------------------------------------------------------------
   35.73 +template <typename TReal>
   35.74 +inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::operator *= (const aiMatrix3x3t<TReal>& m)
   35.75 +{
   35.76 +    *this = aiMatrix3x3t<TReal>(m.a1 * a1 + m.b1 * a2 + m.c1 * a3,
   35.77 +        m.a2 * a1 + m.b2 * a2 + m.c2 * a3,
   35.78 +        m.a3 * a1 + m.b3 * a2 + m.c3 * a3,
   35.79 +        m.a1 * b1 + m.b1 * b2 + m.c1 * b3,
   35.80 +        m.a2 * b1 + m.b2 * b2 + m.c2 * b3,
   35.81 +        m.a3 * b1 + m.b3 * b2 + m.c3 * b3,
   35.82 +        m.a1 * c1 + m.b1 * c2 + m.c1 * c3,
   35.83 +        m.a2 * c1 + m.b2 * c2 + m.c2 * c3,
   35.84 +        m.a3 * c1 + m.b3 * c2 + m.c3 * c3);
   35.85 +    return *this;
   35.86 +}
   35.87 +
   35.88 +// ------------------------------------------------------------------------------------------------
   35.89 +template <typename TReal>
   35.90 +template <typename TOther>
   35.91 +aiMatrix3x3t<TReal>::operator aiMatrix3x3t<TOther> () const
   35.92 +{
   35.93 +    return aiMatrix3x3t<TOther>(static_cast<TOther>(a1),static_cast<TOther>(a2),static_cast<TOther>(a3),
   35.94 +        static_cast<TOther>(b1),static_cast<TOther>(b2),static_cast<TOther>(b3),
   35.95 +        static_cast<TOther>(c1),static_cast<TOther>(c2),static_cast<TOther>(c3));
   35.96 +}
   35.97 +
   35.98 +// ------------------------------------------------------------------------------------------------
   35.99 +template <typename TReal>
  35.100 +inline aiMatrix3x3t<TReal> aiMatrix3x3t<TReal>::operator* (const aiMatrix3x3t<TReal>& m) const
  35.101 +{
  35.102 +    aiMatrix3x3t<TReal> temp( *this);
  35.103 +    temp *= m;
  35.104 +    return temp;
  35.105 +}
  35.106 +
  35.107 +// ------------------------------------------------------------------------------------------------
  35.108 +template <typename TReal>
  35.109 +inline TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) {
  35.110 +    switch ( p_iIndex ) {
  35.111 +        case 0:
  35.112 +            return &a1;
  35.113 +        case 1:
  35.114 +            return &b1;
  35.115 +        case 2:
  35.116 +            return &c1;
  35.117 +        default:
  35.118 +            break;
  35.119 +    }
  35.120 +    return &a1;
  35.121 +}
  35.122 +
  35.123 +// ------------------------------------------------------------------------------------------------
  35.124 +template <typename TReal>
  35.125 +inline const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const {
  35.126 +    switch ( p_iIndex ) {
  35.127 +        case 0:
  35.128 +            return &a1;
  35.129 +        case 1:
  35.130 +            return &b1;
  35.131 +        case 2:
  35.132 +            return &c1;
  35.133 +        default:
  35.134 +            break;
  35.135 +    }
  35.136 +    return &a1;
  35.137 +}
  35.138 +
  35.139 +// ------------------------------------------------------------------------------------------------
  35.140 +template <typename TReal>
  35.141 +inline bool aiMatrix3x3t<TReal>::operator== (const aiMatrix4x4t<TReal>& m) const
  35.142 +{
  35.143 +    return a1 == m.a1 && a2 == m.a2 && a3 == m.a3 &&
  35.144 +           b1 == m.b1 && b2 == m.b2 && b3 == m.b3 &&
  35.145 +           c1 == m.c1 && c2 == m.c2 && c3 == m.c3;
  35.146 +}
  35.147 +
  35.148 +// ------------------------------------------------------------------------------------------------
  35.149 +template <typename TReal>
  35.150 +inline bool aiMatrix3x3t<TReal>::operator!= (const aiMatrix4x4t<TReal>& m) const
  35.151 +{
  35.152 +    return !(*this == m);
  35.153 +}
  35.154 +
  35.155 +// ---------------------------------------------------------------------------
  35.156 +template<typename TReal>
  35.157 +inline bool aiMatrix3x3t<TReal>::Equal(const aiMatrix4x4t<TReal>& m, TReal epsilon) const {
  35.158 +    return
  35.159 +        std::abs(a1 - m.a1) <= epsilon &&
  35.160 +        std::abs(a2 - m.a2) <= epsilon &&
  35.161 +        std::abs(a3 - m.a3) <= epsilon &&
  35.162 +        std::abs(b1 - m.b1) <= epsilon &&
  35.163 +        std::abs(b2 - m.b2) <= epsilon &&
  35.164 +        std::abs(b3 - m.b3) <= epsilon &&
  35.165 +        std::abs(c1 - m.c1) <= epsilon &&
  35.166 +        std::abs(c2 - m.c2) <= epsilon &&
  35.167 +        std::abs(c3 - m.c3) <= epsilon;
  35.168 +}
  35.169 +
  35.170 +// ------------------------------------------------------------------------------------------------
  35.171 +template <typename TReal>
  35.172 +inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::Transpose()
  35.173 +{
  35.174 +    // (TReal&) don't remove, GCC complains cause of packed fields
  35.175 +    std::swap( (TReal&)a2, (TReal&)b1);
  35.176 +    std::swap( (TReal&)a3, (TReal&)c1);
  35.177 +    std::swap( (TReal&)b3, (TReal&)c2);
  35.178 +    return *this;
  35.179 +}
  35.180 +
  35.181 +// ----------------------------------------------------------------------------------------
  35.182 +template <typename TReal>
  35.183 +inline TReal aiMatrix3x3t<TReal>::Determinant() const
  35.184 +{
  35.185 +    return a1*b2*c3 - a1*b3*c2 + a2*b3*c1 - a2*b1*c3 + a3*b1*c2 - a3*b2*c1;
  35.186 +}
  35.187 +
  35.188 +// ----------------------------------------------------------------------------------------
  35.189 +template <typename TReal>
  35.190 +inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::Inverse()
  35.191 +{
  35.192 +    // Compute the reciprocal determinant
  35.193 +    TReal det = Determinant();
  35.194 +    if(det == static_cast<TReal>(0.0))
  35.195 +    {
  35.196 +        // Matrix not invertible. Setting all elements to nan is not really
  35.197 +        // correct in a mathematical sense; but at least qnans are easy to
  35.198 +        // spot. XXX we might throw an exception instead, which would
  35.199 +        // be even much better to spot :/.
  35.200 +        const TReal nan = std::numeric_limits<TReal>::quiet_NaN();
  35.201 +        *this = aiMatrix3x3t<TReal>( nan,nan,nan,nan,nan,nan,nan,nan,nan);
  35.202 +
  35.203 +        return *this;
  35.204 +    }
  35.205 +
  35.206 +    TReal invdet = static_cast<TReal>(1.0) / det;
  35.207 +
  35.208 +    aiMatrix3x3t<TReal> res;
  35.209 +    res.a1 = invdet  * (b2 * c3 - b3 * c2);
  35.210 +    res.a2 = -invdet * (a2 * c3 - a3 * c2);
  35.211 +    res.a3 = invdet  * (a2 * b3 - a3 * b2);
  35.212 +    res.b1 = -invdet * (b1 * c3 - b3 * c1);
  35.213 +    res.b2 = invdet  * (a1 * c3 - a3 * c1);
  35.214 +    res.b3 = -invdet * (a1 * b3 - a3 * b1);
  35.215 +    res.c1 = invdet  * (b1 * c2 - b2 * c1);
  35.216 +    res.c2 = -invdet * (a1 * c2 - a2 * c1);
  35.217 +    res.c3 = invdet  * (a1 * b2 - a2 * b1);
  35.218 +    *this = res;
  35.219 +
  35.220 +    return *this;
  35.221 +}
  35.222 +
  35.223 +// ------------------------------------------------------------------------------------------------
  35.224 +template <typename TReal>
  35.225 +inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::RotationZ(TReal a, aiMatrix3x3t<TReal>& out)
  35.226 +{
  35.227 +    out.a1 = out.b2 = std::cos(a);
  35.228 +    out.b1 = std::sin(a);
  35.229 +    out.a2 = - out.b1;
  35.230 +
  35.231 +    out.a3 = out.b3 = out.c1 = out.c2 = 0.f;
  35.232 +    out.c3 = 1.f;
  35.233 +
  35.234 +    return out;
  35.235 +}
  35.236 +
  35.237 +// ------------------------------------------------------------------------------------------------
  35.238 +// Returns a rotation matrix for a rotation around an arbitrary axis.
  35.239 +template <typename TReal>
  35.240 +inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::Rotation( TReal a, const aiVector3t<TReal>& axis, aiMatrix3x3t<TReal>& out)
  35.241 +{
  35.242 +  TReal c = std::cos( a), s = std::sin( a), t = 1 - c;
  35.243 +  TReal x = axis.x, y = axis.y, z = axis.z;
  35.244 +
  35.245 +  // Many thanks to MathWorld and Wikipedia
  35.246 +  out.a1 = t*x*x + c;   out.a2 = t*x*y - s*z; out.a3 = t*x*z + s*y;
  35.247 +  out.b1 = t*x*y + s*z; out.b2 = t*y*y + c;   out.b3 = t*y*z - s*x;
  35.248 +  out.c1 = t*x*z - s*y; out.c2 = t*y*z + s*x; out.c3 = t*z*z + c;
  35.249 +
  35.250 +  return out;
  35.251 +}
  35.252 +
  35.253 +// ------------------------------------------------------------------------------------------------
  35.254 +template <typename TReal>
  35.255 +inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::Translation( const aiVector2t<TReal>& v, aiMatrix3x3t<TReal>& out)
  35.256 +{
  35.257 +    out = aiMatrix3x3t<TReal>();
  35.258 +    out.a3 = v.x;
  35.259 +    out.b3 = v.y;
  35.260 +    return out;
  35.261 +}
  35.262 +
  35.263 +// ----------------------------------------------------------------------------------------
  35.264 +/** A function for creating a rotation matrix that rotates a vector called
  35.265 + * "from" into another vector called "to".
  35.266 + * Input : from[3], to[3] which both must be *normalized* non-zero vectors
  35.267 + * Output: mtx[3][3] -- a 3x3 matrix in colum-major form
  35.268 + * Authors: Tomas Möller, John Hughes
  35.269 + *          "Efficiently Building a Matrix to Rotate One Vector to Another"
  35.270 + *          Journal of Graphics Tools, 4(4):1-4, 1999
  35.271 + */
  35.272 +// ----------------------------------------------------------------------------------------
  35.273 +template <typename TReal>
  35.274 +inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::FromToMatrix(const aiVector3t<TReal>& from,
  35.275 +    const aiVector3t<TReal>& to, aiMatrix3x3t<TReal>& mtx)
  35.276 +{
  35.277 +    const TReal e = from * to;
  35.278 +    const TReal f = (e < 0)? -e:e;
  35.279 +
  35.280 +    if (f > static_cast<TReal>(1.0) - static_cast<TReal>(0.00001))     /* "from" and "to"-vector almost parallel */
  35.281 +    {
  35.282 +        aiVector3D u,v;     /* temporary storage vectors */
  35.283 +        aiVector3D x;       /* vector most nearly orthogonal to "from" */
  35.284 +
  35.285 +        x.x = (from.x > 0.0)? from.x : -from.x;
  35.286 +        x.y = (from.y > 0.0)? from.y : -from.y;
  35.287 +        x.z = (from.z > 0.0)? from.z : -from.z;
  35.288 +
  35.289 +        if (x.x < x.y)
  35.290 +        {
  35.291 +            if (x.x < x.z)
  35.292 +            {
  35.293 +                x.x = static_cast<TReal>(1.0);
  35.294 +                x.y = x.z = static_cast<TReal>(0.0);
  35.295 +            }
  35.296 +            else
  35.297 +            {
  35.298 +                x.z = static_cast<TReal>(1.0);
  35.299 +                x.x = x.y = static_cast<TReal>(0.0);
  35.300 +            }
  35.301 +        }
  35.302 +        else
  35.303 +        {
  35.304 +            if (x.y < x.z)
  35.305 +            {
  35.306 +                x.y = static_cast<TReal>(1.0);
  35.307 +                x.x = x.z = static_cast<TReal>(0.0);
  35.308 +            }
  35.309 +            else
  35.310 +            {
  35.311 +                x.z = static_cast<TReal>(1.0);
  35.312 +                x.x = x.y = static_cast<TReal>(0.0);
  35.313 +            }
  35.314 +        }
  35.315 +
  35.316 +        u.x = x.x - from.x; u.y = x.y - from.y; u.z = x.z - from.z;
  35.317 +        v.x = x.x - to.x;   v.y = x.y - to.y;   v.z = x.z - to.z;
  35.318 +
  35.319 +        const TReal c1_ = static_cast<TReal>(2.0) / (u * u);
  35.320 +        const TReal c2_ = static_cast<TReal>(2.0) / (v * v);
  35.321 +        const TReal c3_ = c1_ * c2_  * (u * v);
  35.322 +
  35.323 +        for (unsigned int i = 0; i < 3; i++)
  35.324 +        {
  35.325 +            for (unsigned int j = 0; j < 3; j++)
  35.326 +            {
  35.327 +                mtx[i][j] =  - c1_ * u[i] * u[j] - c2_ * v[i] * v[j]
  35.328 +                    + c3_ * v[i] * u[j];
  35.329 +            }
  35.330 +            mtx[i][i] += static_cast<TReal>(1.0);
  35.331 +        }
  35.332 +    }
  35.333 +    else  /* the most common case, unless "from"="to", or "from"=-"to" */
  35.334 +    {
  35.335 +        const aiVector3D v = from ^ to;
  35.336 +        /* ... use this hand optimized version (9 mults less) */
  35.337 +        const TReal h = static_cast<TReal>(1.0)/(static_cast<TReal>(1.0) + e);      /* optimization by Gottfried Chen */
  35.338 +        const TReal hvx = h * v.x;
  35.339 +        const TReal hvz = h * v.z;
  35.340 +        const TReal hvxy = hvx * v.y;
  35.341 +        const TReal hvxz = hvx * v.z;
  35.342 +        const TReal hvyz = hvz * v.y;
  35.343 +        mtx[0][0] = e + hvx * v.x;
  35.344 +        mtx[0][1] = hvxy - v.z;
  35.345 +        mtx[0][2] = hvxz + v.y;
  35.346 +
  35.347 +        mtx[1][0] = hvxy + v.z;
  35.348 +        mtx[1][1] = e + h * v.y * v.y;
  35.349 +        mtx[1][2] = hvyz - v.x;
  35.350 +
  35.351 +        mtx[2][0] = hvxz - v.y;
  35.352 +        mtx[2][1] = hvyz + v.x;
  35.353 +        mtx[2][2] = e + hvz * v.z;
  35.354 +    }
  35.355 +    return mtx;
  35.356 +}
  35.357 +
  35.358 +
  35.359 +#endif // __cplusplus
  35.360 +#endif // AI_MATRIX3X3_INL_INC
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/include/miniassimp/matrix4x4.h	Mon Jan 28 18:19:26 2019 +0200
    36.3 @@ -0,0 +1,280 @@
    36.4 +/*
    36.5 +---------------------------------------------------------------------------
    36.6 +Open Asset Import Library (assimp)
    36.7 +---------------------------------------------------------------------------
    36.8 +
    36.9 +Copyright (c) 2006-2018, assimp team
   36.10 +
   36.11 +
   36.12 +
   36.13 +All rights reserved.
   36.14 +
   36.15 +Redistribution and use of this software in source and binary forms,
   36.16 +with or without modification, are permitted provided that the following
   36.17 +conditions are met:
   36.18 +
   36.19 +* Redistributions of source code must retain the above
   36.20 +  copyright notice, this list of conditions and the
   36.21 +  following disclaimer.
   36.22 +
   36.23 +* Redistributions in binary form must reproduce the above
   36.24 +  copyright notice, this list of conditions and the
   36.25 +  following disclaimer in the documentation and/or other
   36.26 +  materials provided with the distribution.
   36.27 +
   36.28 +* Neither the name of the assimp team, nor the names of its
   36.29 +  contributors may be used to endorse or promote products
   36.30 +  derived from this software without specific prior
   36.31 +  written permission of the assimp team.
   36.32 +
   36.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   36.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   36.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   36.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   36.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   36.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   36.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   36.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   36.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   36.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   36.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   36.44 +---------------------------------------------------------------------------
   36.45 +*/
   36.46 +/** @file matrix4x4.h
   36.47 + *  @brief 4x4 matrix structure, including operators when compiling in C++
   36.48 + */
   36.49 +#pragma once
   36.50 +#ifndef AI_MATRIX4X4_H_INC
   36.51 +#define AI_MATRIX4X4_H_INC
   36.52 +
   36.53 +#include "vector3.h"
   36.54 +#include "defs.h"
   36.55 +
   36.56 +#ifdef __cplusplus
   36.57 +
   36.58 +template<typename TReal> class aiMatrix3x3t;
   36.59 +template<typename TReal> class aiQuaterniont;
   36.60 +
   36.61 +// ---------------------------------------------------------------------------
   36.62 +/** @brief Represents a row-major 4x4 matrix, use this for homogeneous
   36.63 + *   coordinates.
   36.64 + *
   36.65 + *  There's much confusion about matrix layouts (column vs. row order).
   36.66 + *  This is *always* a row-major matrix. Not even with the
   36.67 + *  #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect
   36.68 + *  matrix order - it just affects the handedness of the coordinate system
   36.69 + *  defined thereby.
   36.70 + */
   36.71 +template<typename TReal>
   36.72 +class aiMatrix4x4t
   36.73 +{
   36.74 +public:
   36.75 +
   36.76 +    /** set to identity */
   36.77 +    aiMatrix4x4t() AI_NO_EXCEPT;
   36.78 +
   36.79 +    /** construction from single values */
   36.80 +    aiMatrix4x4t (  TReal _a1, TReal _a2, TReal _a3, TReal _a4,
   36.81 +                    TReal _b1, TReal _b2, TReal _b3, TReal _b4,
   36.82 +                    TReal _c1, TReal _c2, TReal _c3, TReal _c4,
   36.83 +                    TReal _d1, TReal _d2, TReal _d3, TReal _d4);
   36.84 +
   36.85 +
   36.86 +    /** construction from 3x3 matrix, remaining elements are set to identity */
   36.87 +    explicit aiMatrix4x4t( const aiMatrix3x3t<TReal>& m);
   36.88 +
   36.89 +    /** construction from position, rotation and scaling components
   36.90 +     * @param scaling The scaling for the x,y,z axes
   36.91 +     * @param rotation The rotation as a hamilton quaternion
   36.92 +     * @param position The position for the x,y,z axes
   36.93 +     */
   36.94 +    aiMatrix4x4t(const aiVector3t<TReal>& scaling, const aiQuaterniont<TReal>& rotation,
   36.95 +        const aiVector3t<TReal>& position);
   36.96 +
   36.97 +public:
   36.98 +
   36.99 +    // array access operators
  36.100 +	/** @fn TReal* operator[] (unsigned int p_iIndex)
  36.101 +	 *  @param [in] p_iIndex - index of the row.
  36.102 +	 *  @return pointer to pointed row.
  36.103 +	 */
  36.104 +    TReal* operator[]       (unsigned int p_iIndex);
  36.105 +
  36.106 +	/** @fn const TReal* operator[] (unsigned int p_iIndex) const
  36.107 +	 *  @overload TReal* operator[] (unsigned int p_iIndex)
  36.108 +	 */
  36.109 +    const TReal* operator[] (unsigned int p_iIndex) const;
  36.110 +
  36.111 +    // comparison operators
  36.112 +    bool operator== (const aiMatrix4x4t& m) const;
  36.113 +    bool operator!= (const aiMatrix4x4t& m) const;
  36.114 +
  36.115 +    bool Equal(const aiMatrix4x4t& m, TReal epsilon = 1e-6) const;
  36.116 +
  36.117 +    // matrix multiplication.
  36.118 +    aiMatrix4x4t& operator *= (const aiMatrix4x4t& m);
  36.119 +    aiMatrix4x4t  operator *  (const aiMatrix4x4t& m) const;
  36.120 +    aiMatrix4x4t operator * (const TReal& aFloat) const;
  36.121 +    aiMatrix4x4t operator + (const aiMatrix4x4t& aMatrix) const;
  36.122 +
  36.123 +    template <typename TOther>
  36.124 +    operator aiMatrix4x4t<TOther> () const;
  36.125 +
  36.126 +public:
  36.127 +
  36.128 +    // -------------------------------------------------------------------
  36.129 +    /** @brief Transpose the matrix */
  36.130 +    aiMatrix4x4t& Transpose();
  36.131 +
  36.132 +    // -------------------------------------------------------------------
  36.133 +    /** @brief Invert the matrix.
  36.134 +     *  If the matrix is not invertible all elements are set to qnan.
  36.135 +     *  Beware, use (f != f) to check whether a TReal f is qnan.
  36.136 +     */
  36.137 +    aiMatrix4x4t& Inverse();
  36.138 +    TReal Determinant() const;
  36.139 +
  36.140 +
  36.141 +    // -------------------------------------------------------------------
  36.142 +    /** @brief Returns true of the matrix is the identity matrix.
  36.143 +     *  The check is performed against a not so small epsilon.
  36.144 +     */
  36.145 +    inline bool IsIdentity() const;
  36.146 +
  36.147 +    // -------------------------------------------------------------------
  36.148 +    /** @brief Decompose a trafo matrix into its original components
  36.149 +     *  @param scaling Receives the output scaling for the x,y,z axes
  36.150 +     *  @param rotation Receives the output rotation as a hamilton
  36.151 +     *   quaternion
  36.152 +     *  @param position Receives the output position for the x,y,z axes
  36.153 +     */
  36.154 +    void Decompose (aiVector3t<TReal>& scaling, aiQuaterniont<TReal>& rotation,
  36.155 +        aiVector3t<TReal>& position) const;
  36.156 +
  36.157 +	// -------------------------------------------------------------------
  36.158 +	/** @fn void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotation, aiVector3t<TReal>& pPosition) const
  36.159 +     *  @brief Decompose a trafo matrix into its original components.
  36.160 +     * Thx to good FAQ at http://www.gamedev.ru/code/articles/faq_matrix_quat
  36.161 +     *  @param [out] pScaling - Receives the output scaling for the x,y,z axes.
  36.162 +     *  @param [out] pRotation - Receives the output rotation as a Euler angles.
  36.163 +     *  @param [out] pPosition - Receives the output position for the x,y,z axes.
  36.164 +     */
  36.165 +    void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotation, aiVector3t<TReal>& pPosition) const;
  36.166 +
  36.167 +	// -------------------------------------------------------------------
  36.168 +	/** @fn void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotationAxis, TReal& pRotationAngle, aiVector3t<TReal>& pPosition) const
  36.169 +     *  @brief Decompose a trafo matrix into its original components
  36.170 +	 * Thx to good FAQ at http://www.gamedev.ru/code/articles/faq_matrix_quat
  36.171 +     *  @param [out] pScaling - Receives the output scaling for the x,y,z axes.
  36.172 +     *  @param [out] pRotationAxis - Receives the output rotation axis.
  36.173 +	 *  @param [out] pRotationAngle - Receives the output rotation angle for @ref pRotationAxis.
  36.174 +     *  @param [out] pPosition - Receives the output position for the x,y,z axes.
  36.175 +     */
  36.176 +    void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotationAxis, TReal& pRotationAngle, aiVector3t<TReal>& pPosition) const;
  36.177 +
  36.178 +    // -------------------------------------------------------------------
  36.179 +    /** @brief Decompose a trafo matrix with no scaling into its
  36.180 +     *    original components
  36.181 +     *  @param rotation Receives the output rotation as a hamilton
  36.182 +     *    quaternion
  36.183 +     *  @param position Receives the output position for the x,y,z axes
  36.184 +     */
  36.185 +    void DecomposeNoScaling (aiQuaterniont<TReal>& rotation,
  36.186 +        aiVector3t<TReal>& position) const;
  36.187 +
  36.188 +
  36.189 +    // -------------------------------------------------------------------
  36.190 +    /** @brief Creates a trafo matrix from a set of euler angles
  36.191 +     *  @param x Rotation angle for the x-axis, in radians
  36.192 +     *  @param y Rotation angle for the y-axis, in radians
  36.193 +     *  @param z Rotation angle for the z-axis, in radians
  36.194 +     */
  36.195 +    aiMatrix4x4t& FromEulerAnglesXYZ(TReal x, TReal y, TReal z);
  36.196 +    aiMatrix4x4t& FromEulerAnglesXYZ(const aiVector3t<TReal>& blubb);
  36.197 +
  36.198 +public:
  36.199 +    // -------------------------------------------------------------------
  36.200 +    /** @brief Returns a rotation matrix for a rotation around the x axis
  36.201 +     *  @param a Rotation angle, in radians
  36.202 +     *  @param out Receives the output matrix
  36.203 +     *  @return Reference to the output matrix
  36.204 +     */
  36.205 +    static aiMatrix4x4t& RotationX(TReal a, aiMatrix4x4t& out);
  36.206 +
  36.207 +    // -------------------------------------------------------------------
  36.208 +    /** @brief Returns a rotation matrix for a rotation around the y axis
  36.209 +     *  @param a Rotation angle, in radians
  36.210 +     *  @param out Receives the output matrix
  36.211 +     *  @return Reference to the output matrix
  36.212 +     */
  36.213 +    static aiMatrix4x4t& RotationY(TReal a, aiMatrix4x4t& out);
  36.214 +
  36.215 +    // -------------------------------------------------------------------
  36.216 +    /** @brief Returns a rotation matrix for a rotation around the z axis
  36.217 +     *  @param a Rotation angle, in radians
  36.218 +     *  @param out Receives the output matrix
  36.219 +     *  @return Reference to the output matrix
  36.220 +     */
  36.221 +    static aiMatrix4x4t& RotationZ(TReal a, aiMatrix4x4t& out);
  36.222 +
  36.223 +    // -------------------------------------------------------------------
  36.224 +    /** Returns a rotation matrix for a rotation around an arbitrary axis.
  36.225 +     *  @param a Rotation angle, in radians
  36.226 +     *  @param axis Rotation axis, should be a normalized vector.
  36.227 +     *  @param out Receives the output matrix
  36.228 +     *  @return Reference to the output matrix
  36.229 +     */
  36.230 +    static aiMatrix4x4t& Rotation(TReal a, const aiVector3t<TReal>& axis,
  36.231 +            aiMatrix4x4t& out);
  36.232 +
  36.233 +    // -------------------------------------------------------------------
  36.234 +    /** @brief Returns a translation matrix
  36.235 +     *  @param v Translation vector
  36.236 +     *  @param out Receives the output matrix
  36.237 +     *  @return Reference to the output matrix
  36.238 +     */
  36.239 +    static aiMatrix4x4t& Translation( const aiVector3t<TReal>& v, 
  36.240 +            aiMatrix4x4t& out);
  36.241 +
  36.242 +    // -------------------------------------------------------------------
  36.243 +    /** @brief Returns a scaling matrix
  36.244 +     *  @param v Scaling vector
  36.245 +     *  @param out Receives the output matrix
  36.246 +     *  @return Reference to the output matrix
  36.247 +     */
  36.248 +    static aiMatrix4x4t& Scaling( const aiVector3t<TReal>& v, aiMatrix4x4t& out);
  36.249 +
  36.250 +    // -------------------------------------------------------------------
  36.251 +    /** @brief A function for creating a rotation matrix that rotates a
  36.252 +     *  vector called "from" into another vector called "to".
  36.253 +     * Input : from[3], to[3] which both must be *normalized* non-zero vectors
  36.254 +     * Output: mtx[3][3] -- a 3x3 matrix in column-major form
  36.255 +     * Authors: Tomas Mueller, John Hughes
  36.256 +     *          "Efficiently Building a Matrix to Rotate One Vector to Another"
  36.257 +     *          Journal of Graphics Tools, 4(4):1-4, 1999
  36.258 +     */
  36.259 +    static aiMatrix4x4t& FromToMatrix(const aiVector3t<TReal>& from,
  36.260 +            const aiVector3t<TReal>& to, aiMatrix4x4t& out);
  36.261 +
  36.262 +public:
  36.263 +    TReal a1, a2, a3, a4;
  36.264 +    TReal b1, b2, b3, b4;
  36.265 +    TReal c1, c2, c3, c4;
  36.266 +    TReal d1, d2, d3, d4;
  36.267 +};
  36.268 +
  36.269 +typedef aiMatrix4x4t<ai_real> aiMatrix4x4;
  36.270 +
  36.271 +#else
  36.272 +
  36.273 +struct aiMatrix4x4 {
  36.274 +    ai_real a1, a2, a3, a4;
  36.275 +    ai_real b1, b2, b3, b4;
  36.276 +    ai_real c1, c2, c3, c4;
  36.277 +    ai_real d1, d2, d3, d4;
  36.278 +};
  36.279 +
  36.280 +
  36.281 +#endif // __cplusplus
  36.282 +
  36.283 +#endif // AI_MATRIX4X4_H_INC
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/include/miniassimp/matrix4x4.inl	Mon Jan 28 18:19:26 2019 +0200
    37.3 @@ -0,0 +1,686 @@
    37.4 +/*
    37.5 +---------------------------------------------------------------------------
    37.6 +Open Asset Import Library (assimp)
    37.7 +---------------------------------------------------------------------------
    37.8 +
    37.9 +Copyright (c) 2006-2018, assimp team
   37.10 +
   37.11 +
   37.12 +
   37.13 +All rights reserved.
   37.14 +
   37.15 +Redistribution and use of this software in source and binary forms,
   37.16 +with or without modification, are permitted provided that the following
   37.17 +conditions are met:
   37.18 +
   37.19 +* Redistributions of source code must retain the above
   37.20 +  copyright notice, this list of conditions and the
   37.21 +  following disclaimer.
   37.22 +
   37.23 +* Redistributions in binary form must reproduce the above
   37.24 +  copyright notice, this list of conditions and the
   37.25 +  following disclaimer in the documentation and/or other
   37.26 +  materials provided with the distribution.
   37.27 +
   37.28 +* Neither the name of the assimp team, nor the names of its
   37.29 +  contributors may be used to endorse or promote products
   37.30 +  derived from this software without specific prior
   37.31 +  written permission of the assimp team.
   37.32 +
   37.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   37.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   37.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   37.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   37.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   37.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   37.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   37.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   37.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   37.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   37.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   37.44 +---------------------------------------------------------------------------
   37.45 +*/
   37.46 +
   37.47 +/** @file matrix4x4.inl
   37.48 + *  @brief Inline implementation of the 4x4 matrix operators
   37.49 + */
   37.50 +#pragma once
   37.51 +#ifndef AI_MATRIX4X4_INL_INC
   37.52 +#define AI_MATRIX4X4_INL_INC
   37.53 +
   37.54 +#ifdef __cplusplus
   37.55 +
   37.56 +#include "matrix4x4.h"
   37.57 +#include "matrix3x3.h"
   37.58 +#include "quaternion.h"
   37.59 +
   37.60 +#include <algorithm>
   37.61 +#include <limits>
   37.62 +#include <cmath>
   37.63 +
   37.64 +// ----------------------------------------------------------------------------------------
   37.65 +template <typename TReal>
   37.66 +aiMatrix4x4t<TReal>::aiMatrix4x4t() AI_NO_EXCEPT :
   37.67 +    a1(1.0f), a2(), a3(), a4(),
   37.68 +    b1(), b2(1.0f), b3(), b4(),
   37.69 +    c1(), c2(), c3(1.0f), c4(),
   37.70 +    d1(), d2(), d3(), d4(1.0f)
   37.71 +{
   37.72 +
   37.73 +}
   37.74 +
   37.75 +// ----------------------------------------------------------------------------------------
   37.76 +template <typename TReal>
   37.77 +aiMatrix4x4t<TReal>::aiMatrix4x4t (TReal _a1, TReal _a2, TReal _a3, TReal _a4,
   37.78 +              TReal _b1, TReal _b2, TReal _b3, TReal _b4,
   37.79 +              TReal _c1, TReal _c2, TReal _c3, TReal _c4,
   37.80 +              TReal _d1, TReal _d2, TReal _d3, TReal _d4) :
   37.81 +    a1(_a1), a2(_a2), a3(_a3), a4(_a4),
   37.82 +    b1(_b1), b2(_b2), b3(_b3), b4(_b4),
   37.83 +    c1(_c1), c2(_c2), c3(_c3), c4(_c4),
   37.84 +    d1(_d1), d2(_d2), d3(_d3), d4(_d4)
   37.85 +{
   37.86 +
   37.87 +}
   37.88 +
   37.89 +// ------------------------------------------------------------------------------------------------
   37.90 +template <typename TReal>
   37.91 +template <typename TOther>
   37.92 +aiMatrix4x4t<TReal>::operator aiMatrix4x4t<TOther> () const
   37.93 +{
   37.94 +    return aiMatrix4x4t<TOther>(static_cast<TOther>(a1),static_cast<TOther>(a2),static_cast<TOther>(a3),static_cast<TOther>(a4),
   37.95 +        static_cast<TOther>(b1),static_cast<TOther>(b2),static_cast<TOther>(b3),static_cast<TOther>(b4),
   37.96 +        static_cast<TOther>(c1),static_cast<TOther>(c2),static_cast<TOther>(c3),static_cast<TOther>(c4),
   37.97 +        static_cast<TOther>(d1),static_cast<TOther>(d2),static_cast<TOther>(d3),static_cast<TOther>(d4));
   37.98 +}
   37.99 +
  37.100 +
  37.101 +// ----------------------------------------------------------------------------------------
  37.102 +template <typename TReal>
  37.103 +inline aiMatrix4x4t<TReal>::aiMatrix4x4t (const aiMatrix3x3t<TReal>& m)
  37.104 +{
  37.105 +    a1 = m.a1; a2 = m.a2; a3 = m.a3; a4 = static_cast<TReal>(0.0);
  37.106 +    b1 = m.b1; b2 = m.b2; b3 = m.b3; b4 = static_cast<TReal>(0.0);
  37.107 +    c1 = m.c1; c2 = m.c2; c3 = m.c3; c4 = static_cast<TReal>(0.0);
  37.108 +    d1 = static_cast<TReal>(0.0); d2 = static_cast<TReal>(0.0); d3 = static_cast<TReal>(0.0); d4 = static_cast<TReal>(1.0);
  37.109 +}
  37.110 +
  37.111 +// ----------------------------------------------------------------------------------------
  37.112 +template <typename TReal>
  37.113 +inline aiMatrix4x4t<TReal>::aiMatrix4x4t (const aiVector3t<TReal>& scaling, const aiQuaterniont<TReal>& rotation, const aiVector3t<TReal>& position)
  37.114 +{
  37.115 +    // build a 3x3 rotation matrix
  37.116 +    aiMatrix3x3t<TReal> m = rotation.GetMatrix();
  37.117 +
  37.118 +    a1 = m.a1 * scaling.x;
  37.119 +    a2 = m.a2 * scaling.x;
  37.120 +    a3 = m.a3 * scaling.x;
  37.121 +    a4 = position.x;
  37.122 +
  37.123 +    b1 = m.b1 * scaling.y;
  37.124 +    b2 = m.b2 * scaling.y;
  37.125 +    b3 = m.b3 * scaling.y;
  37.126 +    b4 = position.y;
  37.127 +
  37.128 +    c1 = m.c1 * scaling.z;
  37.129 +    c2 = m.c2 * scaling.z;
  37.130 +    c3 = m.c3 * scaling.z;
  37.131 +    c4= position.z;
  37.132 +
  37.133 +    d1 = static_cast<TReal>(0.0);
  37.134 +    d2 = static_cast<TReal>(0.0);
  37.135 +    d3 = static_cast<TReal>(0.0);
  37.136 +    d4 = static_cast<TReal>(1.0);
  37.137 +}
  37.138 +
  37.139 +// ----------------------------------------------------------------------------------------
  37.140 +template <typename TReal>
  37.141 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::operator *= (const aiMatrix4x4t<TReal>& m)
  37.142 +{
  37.143 +    *this = aiMatrix4x4t<TReal>(
  37.144 +        m.a1 * a1 + m.b1 * a2 + m.c1 * a3 + m.d1 * a4,
  37.145 +        m.a2 * a1 + m.b2 * a2 + m.c2 * a3 + m.d2 * a4,
  37.146 +        m.a3 * a1 + m.b3 * a2 + m.c3 * a3 + m.d3 * a4,
  37.147 +        m.a4 * a1 + m.b4 * a2 + m.c4 * a3 + m.d4 * a4,
  37.148 +        m.a1 * b1 + m.b1 * b2 + m.c1 * b3 + m.d1 * b4,
  37.149 +        m.a2 * b1 + m.b2 * b2 + m.c2 * b3 + m.d2 * b4,
  37.150 +        m.a3 * b1 + m.b3 * b2 + m.c3 * b3 + m.d3 * b4,
  37.151 +        m.a4 * b1 + m.b4 * b2 + m.c4 * b3 + m.d4 * b4,
  37.152 +        m.a1 * c1 + m.b1 * c2 + m.c1 * c3 + m.d1 * c4,
  37.153 +        m.a2 * c1 + m.b2 * c2 + m.c2 * c3 + m.d2 * c4,
  37.154 +        m.a3 * c1 + m.b3 * c2 + m.c3 * c3 + m.d3 * c4,
  37.155 +        m.a4 * c1 + m.b4 * c2 + m.c4 * c3 + m.d4 * c4,
  37.156 +        m.a1 * d1 + m.b1 * d2 + m.c1 * d3 + m.d1 * d4,
  37.157 +        m.a2 * d1 + m.b2 * d2 + m.c2 * d3 + m.d2 * d4,
  37.158 +        m.a3 * d1 + m.b3 * d2 + m.c3 * d3 + m.d3 * d4,
  37.159 +        m.a4 * d1 + m.b4 * d2 + m.c4 * d3 + m.d4 * d4);
  37.160 +    return *this;
  37.161 +}
  37.162 +
  37.163 +// ----------------------------------------------------------------------------------------
  37.164 +template <typename TReal>
  37.165 +inline aiMatrix4x4t<TReal> aiMatrix4x4t<TReal>::operator* (const TReal& aFloat) const
  37.166 +{
  37.167 +    aiMatrix4x4t<TReal> temp(
  37.168 +        a1 * aFloat,
  37.169 +        a2 * aFloat,
  37.170 +        a3 * aFloat,
  37.171 +        a4 * aFloat,
  37.172 +        b1 * aFloat,
  37.173 +        b2 * aFloat,
  37.174 +        b3 * aFloat,
  37.175 +        b4 * aFloat,
  37.176 +        c1 * aFloat,
  37.177 +        c2 * aFloat,
  37.178 +        c3 * aFloat,
  37.179 +        c4 * aFloat,
  37.180 +        d1 * aFloat,
  37.181 +        d2 * aFloat,
  37.182 +        d3 * aFloat,
  37.183 +        d4 * aFloat);
  37.184 +    return temp;
  37.185 +}
  37.186 +
  37.187 +// ----------------------------------------------------------------------------------------
  37.188 +template <typename TReal>
  37.189 +inline aiMatrix4x4t<TReal> aiMatrix4x4t<TReal>::operator+ (const aiMatrix4x4t<TReal>& m) const
  37.190 +{
  37.191 +    aiMatrix4x4t<TReal> temp(
  37.192 +        m.a1 + a1,
  37.193 +        m.a2 + a2,
  37.194 +        m.a3 + a3,
  37.195 +        m.a4 + a4,
  37.196 +        m.b1 + b1,
  37.197 +        m.b2 + b2,
  37.198 +        m.b3 + b3,
  37.199 +        m.b4 + b4,
  37.200 +        m.c1 + c1,
  37.201 +        m.c2 + c2,
  37.202 +        m.c3 + c3,
  37.203 +        m.c4 + c4,
  37.204 +        m.d1 + d1,
  37.205 +        m.d2 + d2,
  37.206 +        m.d3 + d3,
  37.207 +        m.d4 + d4);
  37.208 +    return temp;
  37.209 +}
  37.210 +
  37.211 +// ----------------------------------------------------------------------------------------
  37.212 +template <typename TReal>
  37.213 +inline aiMatrix4x4t<TReal> aiMatrix4x4t<TReal>::operator* (const aiMatrix4x4t<TReal>& m) const
  37.214 +{
  37.215 +    aiMatrix4x4t<TReal> temp( *this);
  37.216 +    temp *= m;
  37.217 +    return temp;
  37.218 +}
  37.219 +
  37.220 +
  37.221 +// ----------------------------------------------------------------------------------------
  37.222 +template <typename TReal>
  37.223 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Transpose()
  37.224 +{
  37.225 +    // (TReal&) don't remove, GCC complains cause of packed fields
  37.226 +    std::swap( (TReal&)b1, (TReal&)a2);
  37.227 +    std::swap( (TReal&)c1, (TReal&)a3);
  37.228 +    std::swap( (TReal&)c2, (TReal&)b3);
  37.229 +    std::swap( (TReal&)d1, (TReal&)a4);
  37.230 +    std::swap( (TReal&)d2, (TReal&)b4);
  37.231 +    std::swap( (TReal&)d3, (TReal&)c4);
  37.232 +    return *this;
  37.233 +}
  37.234 +
  37.235 +
  37.236 +// ----------------------------------------------------------------------------------------
  37.237 +template <typename TReal>
  37.238 +inline TReal aiMatrix4x4t<TReal>::Determinant() const
  37.239 +{
  37.240 +    return a1*b2*c3*d4 - a1*b2*c4*d3 + a1*b3*c4*d2 - a1*b3*c2*d4
  37.241 +        + a1*b4*c2*d3 - a1*b4*c3*d2 - a2*b3*c4*d1 + a2*b3*c1*d4
  37.242 +        - a2*b4*c1*d3 + a2*b4*c3*d1 - a2*b1*c3*d4 + a2*b1*c4*d3
  37.243 +        + a3*b4*c1*d2 - a3*b4*c2*d1 + a3*b1*c2*d4 - a3*b1*c4*d2
  37.244 +        + a3*b2*c4*d1 - a3*b2*c1*d4 - a4*b1*c2*d3 + a4*b1*c3*d2
  37.245 +        - a4*b2*c3*d1 + a4*b2*c1*d3 - a4*b3*c1*d2 + a4*b3*c2*d1;
  37.246 +}
  37.247 +
  37.248 +// ----------------------------------------------------------------------------------------
  37.249 +template <typename TReal>
  37.250 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Inverse()
  37.251 +{
  37.252 +    // Compute the reciprocal determinant
  37.253 +    const TReal det = Determinant();
  37.254 +    if(det == static_cast<TReal>(0.0))
  37.255 +    {
  37.256 +        // Matrix not invertible. Setting all elements to nan is not really
  37.257 +        // correct in a mathematical sense but it is easy to debug for the
  37.258 +        // programmer.
  37.259 +        const TReal nan = std::numeric_limits<TReal>::quiet_NaN();
  37.260 +        *this = aiMatrix4x4t<TReal>(
  37.261 +            nan,nan,nan,nan,
  37.262 +            nan,nan,nan,nan,
  37.263 +            nan,nan,nan,nan,
  37.264 +            nan,nan,nan,nan);
  37.265 +
  37.266 +        return *this;
  37.267 +    }
  37.268 +
  37.269 +    const TReal invdet = static_cast<TReal>(1.0) / det;
  37.270 +
  37.271 +    aiMatrix4x4t<TReal> res;
  37.272 +    res.a1 = invdet  * (b2 * (c3 * d4 - c4 * d3) + b3 * (c4 * d2 - c2 * d4) + b4 * (c2 * d3 - c3 * d2));
  37.273 +    res.a2 = -invdet * (a2 * (c3 * d4 - c4 * d3) + a3 * (c4 * d2 - c2 * d4) + a4 * (c2 * d3 - c3 * d2));
  37.274 +    res.a3 = invdet  * (a2 * (b3 * d4 - b4 * d3) + a3 * (b4 * d2 - b2 * d4) + a4 * (b2 * d3 - b3 * d2));
  37.275 +    res.a4 = -invdet * (a2 * (b3 * c4 - b4 * c3) + a3 * (b4 * c2 - b2 * c4) + a4 * (b2 * c3 - b3 * c2));
  37.276 +    res.b1 = -invdet * (b1 * (c3 * d4 - c4 * d3) + b3 * (c4 * d1 - c1 * d4) + b4 * (c1 * d3 - c3 * d1));
  37.277 +    res.b2 = invdet  * (a1 * (c3 * d4 - c4 * d3) + a3 * (c4 * d1 - c1 * d4) + a4 * (c1 * d3 - c3 * d1));
  37.278 +    res.b3 = -invdet * (a1 * (b3 * d4 - b4 * d3) + a3 * (b4 * d1 - b1 * d4) + a4 * (b1 * d3 - b3 * d1));
  37.279 +    res.b4 = invdet  * (a1 * (b3 * c4 - b4 * c3) + a3 * (b4 * c1 - b1 * c4) + a4 * (b1 * c3 - b3 * c1));
  37.280 +    res.c1 = invdet  * (b1 * (c2 * d4 - c4 * d2) + b2 * (c4 * d1 - c1 * d4) + b4 * (c1 * d2 - c2 * d1));
  37.281 +    res.c2 = -invdet * (a1 * (c2 * d4 - c4 * d2) + a2 * (c4 * d1 - c1 * d4) + a4 * (c1 * d2 - c2 * d1));
  37.282 +    res.c3 = invdet  * (a1 * (b2 * d4 - b4 * d2) + a2 * (b4 * d1 - b1 * d4) + a4 * (b1 * d2 - b2 * d1));
  37.283 +    res.c4 = -invdet * (a1 * (b2 * c4 - b4 * c2) + a2 * (b4 * c1 - b1 * c4) + a4 * (b1 * c2 - b2 * c1));
  37.284 +    res.d1 = -invdet * (b1 * (c2 * d3 - c3 * d2) + b2 * (c3 * d1 - c1 * d3) + b3 * (c1 * d2 - c2 * d1));
  37.285 +    res.d2 = invdet  * (a1 * (c2 * d3 - c3 * d2) + a2 * (c3 * d1 - c1 * d3) + a3 * (c1 * d2 - c2 * d1));
  37.286 +    res.d3 = -invdet * (a1 * (b2 * d3 - b3 * d2) + a2 * (b3 * d1 - b1 * d3) + a3 * (b1 * d2 - b2 * d1));
  37.287 +    res.d4 = invdet  * (a1 * (b2 * c3 - b3 * c2) + a2 * (b3 * c1 - b1 * c3) + a3 * (b1 * c2 - b2 * c1));
  37.288 +    *this = res;
  37.289 +
  37.290 +    return *this;
  37.291 +}
  37.292 +
  37.293 +// ----------------------------------------------------------------------------------------
  37.294 +template <typename TReal>
  37.295 +inline TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) {
  37.296 +    if (p_iIndex > 3) {
  37.297 +        return NULL;
  37.298 +    }
  37.299 +    switch ( p_iIndex ) {
  37.300 +        case 0:
  37.301 +            return &a1;
  37.302 +        case 1:
  37.303 +            return &b1;
  37.304 +        case 2:
  37.305 +            return &c1;
  37.306 +        case 3:
  37.307 +            return &d1;
  37.308 +        default:
  37.309 +            break;
  37.310 +    }
  37.311 +    return &a1;
  37.312 +}
  37.313 +
  37.314 +// ----------------------------------------------------------------------------------------
  37.315 +template <typename TReal>
  37.316 +inline const TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) const {
  37.317 +    if (p_iIndex > 3) {
  37.318 +        return NULL;
  37.319 +    }
  37.320 +
  37.321 +    switch ( p_iIndex ) {
  37.322 +        case 0:
  37.323 +            return &a1;
  37.324 +        case 1:
  37.325 +            return &b1;
  37.326 +        case 2:
  37.327 +            return &c1;
  37.328 +        case 3:
  37.329 +            return &d1;
  37.330 +        default:
  37.331 +            break;
  37.332 +    }
  37.333 +    return &a1;
  37.334 +}
  37.335 +
  37.336 +// ----------------------------------------------------------------------------------------
  37.337 +template <typename TReal>
  37.338 +inline bool aiMatrix4x4t<TReal>::operator== (const aiMatrix4x4t<TReal>& m) const
  37.339 +{
  37.340 +    return (a1 == m.a1 && a2 == m.a2 && a3 == m.a3 && a4 == m.a4 &&
  37.341 +            b1 == m.b1 && b2 == m.b2 && b3 == m.b3 && b4 == m.b4 &&
  37.342 +            c1 == m.c1 && c2 == m.c2 && c3 == m.c3 && c4 == m.c4 &&
  37.343 +            d1 == m.d1 && d2 == m.d2 && d3 == m.d3 && d4 == m.d4);
  37.344 +}
  37.345 +
  37.346 +// ----------------------------------------------------------------------------------------
  37.347 +template <typename TReal>
  37.348 +inline bool aiMatrix4x4t<TReal>::operator!= (const aiMatrix4x4t<TReal>& m) const
  37.349 +{
  37.350 +    return !(*this == m);
  37.351 +}
  37.352 +
  37.353 +// ---------------------------------------------------------------------------
  37.354 +template<typename TReal>
  37.355 +inline bool aiMatrix4x4t<TReal>::Equal(const aiMatrix4x4t<TReal>& m, TReal epsilon) const {
  37.356 +    return
  37.357 +        std::abs(a1 - m.a1) <= epsilon &&
  37.358 +        std::abs(a2 - m.a2) <= epsilon &&
  37.359 +        std::abs(a3 - m.a3) <= epsilon &&
  37.360 +        std::abs(a4 - m.a4) <= epsilon &&
  37.361 +        std::abs(b1 - m.b1) <= epsilon &&
  37.362 +        std::abs(b2 - m.b2) <= epsilon &&
  37.363 +        std::abs(b3 - m.b3) <= epsilon &&
  37.364 +        std::abs(b4 - m.b4) <= epsilon &&
  37.365 +        std::abs(c1 - m.c1) <= epsilon &&
  37.366 +        std::abs(c2 - m.c2) <= epsilon &&
  37.367 +        std::abs(c3 - m.c3) <= epsilon &&
  37.368 +        std::abs(c4 - m.c4) <= epsilon &&
  37.369 +        std::abs(d1 - m.d1) <= epsilon &&
  37.370 +        std::abs(d2 - m.d2) <= epsilon &&
  37.371 +        std::abs(d3 - m.d3) <= epsilon &&
  37.372 +        std::abs(d4 - m.d4) <= epsilon;
  37.373 +}
  37.374 +
  37.375 +// ----------------------------------------------------------------------------------------
  37.376 +
  37.377 +#define ASSIMP_MATRIX4_4_DECOMPOSE_PART		\
  37.378 +	const aiMatrix4x4t<TReal>& _this = *this;/* Create alias for conveniance. */ \
  37.379 +	\
  37.380 +	/* extract translation */ \
  37.381 +	pPosition.x = _this[0][3]; \
  37.382 +	pPosition.y = _this[1][3]; \
  37.383 +	pPosition.z = _this[2][3]; \
  37.384 +	\
  37.385 +	/* extract the columns of the matrix. */ \
  37.386 +	aiVector3t<TReal> vCols[3] = { \
  37.387 +		aiVector3t<TReal>(_this[0][0],_this[1][0],_this[2][0]), \
  37.388 +		aiVector3t<TReal>(_this[0][1],_this[1][1],_this[2][1]), \
  37.389 +		aiVector3t<TReal>(_this[0][2],_this[1][2],_this[2][2]) \
  37.390 +	}; \
  37.391 +	\
  37.392 +	/* extract the scaling factors */ \
  37.393 +	pScaling.x = vCols[0].Length(); \
  37.394 +	pScaling.y = vCols[1].Length(); \
  37.395 +	pScaling.z = vCols[2].Length(); \
  37.396 +	\
  37.397 +	/* and the sign of the scaling */ \
  37.398 +	if (Determinant() < 0) pScaling = -pScaling; \
  37.399 +	\
  37.400 +	/* and remove all scaling from the matrix */ \
  37.401 +	if(pScaling.x) vCols[0] /= pScaling.x; \
  37.402 +	if(pScaling.y) vCols[1] /= pScaling.y; \
  37.403 +	if(pScaling.z) vCols[2] /= pScaling.z; \
  37.404 +	\
  37.405 +	do {} while(false)
  37.406 +
  37.407 +
  37.408 +
  37.409 +
  37.410 +template <typename TReal>
  37.411 +inline void aiMatrix4x4t<TReal>::Decompose (aiVector3t<TReal>& pScaling, aiQuaterniont<TReal>& pRotation,
  37.412 +    aiVector3t<TReal>& pPosition) const
  37.413 +{
  37.414 +	ASSIMP_MATRIX4_4_DECOMPOSE_PART;
  37.415 +
  37.416 +    // build a 3x3 rotation matrix
  37.417 +    aiMatrix3x3t<TReal> m(vCols[0].x,vCols[1].x,vCols[2].x,
  37.418 +        vCols[0].y,vCols[1].y,vCols[2].y,
  37.419 +        vCols[0].z,vCols[1].z,vCols[2].z);
  37.420 +
  37.421 +    // and generate the rotation quaternion from it
  37.422 +    pRotation = aiQuaterniont<TReal>(m);
  37.423 +}
  37.424 +
  37.425 +template <typename TReal>
  37.426 +inline void aiMatrix4x4t<TReal>::Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotation, aiVector3t<TReal>& pPosition) const
  37.427 +{
  37.428 +	ASSIMP_MATRIX4_4_DECOMPOSE_PART;
  37.429 +
  37.430 +    /*
  37.431 +    assuming a right-handed coordinate system
  37.432 +    and post-multiplication of column vectors,
  37.433 +    the rotation matrix for an euler XYZ rotation is M = Rz * Ry * Rx.
  37.434 +    combining gives:
  37.435 +    
  37.436 +        |  CE  BDE-AF  ADE+BF  0  |
  37.437 +    M = |  CF  BDF+AE  ADF-BE  0  |
  37.438 +        |  -D    CB      AC    0  |
  37.439 +        |   0     0       0    1  |
  37.440 +
  37.441 +    where
  37.442 +	A = cos(angle_x), B = sin(angle_x);
  37.443 +	C = cos(angle_y), D = sin(angle_y);
  37.444 +	E = cos(angle_z), F = sin(angle_z);
  37.445 +	*/
  37.446 +
  37.447 +	// Use a small epsilon to solve floating-point inaccuracies
  37.448 +    const TReal epsilon = 10e-3f;
  37.449 +
  37.450 +	pRotation.y  = std::asin(-vCols[0].z);// D. Angle around oY.
  37.451 +
  37.452 +	TReal C = std::cos(pRotation.y);
  37.453 +
  37.454 +	if(std::fabs(C) > epsilon)
  37.455 +	{
  37.456 +		// Finding angle around oX.
  37.457 +		TReal tan_x = vCols[2].z / C;// A
  37.458 +		TReal tan_y = vCols[1].z / C;// B
  37.459 +
  37.460 +		pRotation.x = std::atan2(tan_y, tan_x);
  37.461 +		// Finding angle around oZ.
  37.462 +		tan_x = vCols[0].x / C;// E
  37.463 +		tan_y = vCols[0].y / C;// F
  37.464 +		pRotation.z = std::atan2(tan_y, tan_x);
  37.465 +	}
  37.466 +	else
  37.467 +	{// oY is fixed.
  37.468 +		pRotation.x = 0;// Set angle around oX to 0. => A == 1, B == 0, C == 0, D == 1.
  37.469 +
  37.470 +		// And finding angle around oZ.
  37.471 +		TReal tan_x =  vCols[1].y;// BDF+AE => E
  37.472 +		TReal tan_y = -vCols[1].x;// BDE-AF => F
  37.473 +
  37.474 +		pRotation.z = std::atan2(tan_y, tan_x);
  37.475 +	}
  37.476 +}
  37.477 +
  37.478 +#undef ASSIMP_MATRIX4_4_DECOMPOSE_PART
  37.479 +
  37.480 +template <typename TReal>
  37.481 +inline void aiMatrix4x4t<TReal>::Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotationAxis, TReal& pRotationAngle,
  37.482 +											aiVector3t<TReal>& pPosition) const
  37.483 +{
  37.484 +aiQuaterniont<TReal> pRotation;
  37.485 +
  37.486 +	Decompose(pScaling, pRotation, pPosition);
  37.487 +	pRotation.Normalize();
  37.488 +
  37.489 +	TReal angle_cos = pRotation.w;
  37.490 +	TReal angle_sin = std::sqrt(1.0f - angle_cos * angle_cos);
  37.491 +
  37.492 +	pRotationAngle = std::acos(angle_cos) * 2;
  37.493 +
  37.494 +	// Use a small epsilon to solve floating-point inaccuracies
  37.495 +    const TReal epsilon = 10e-3f;
  37.496 +
  37.497 +	if(std::fabs(angle_sin) < epsilon) angle_sin = 1;
  37.498 +
  37.499 +	pRotationAxis.x = pRotation.x / angle_sin;
  37.500 +	pRotationAxis.y = pRotation.y / angle_sin;
  37.501 +	pRotationAxis.z = pRotation.z / angle_sin;
  37.502 +}
  37.503 +
  37.504 +// ----------------------------------------------------------------------------------------
  37.505 +template <typename TReal>
  37.506 +inline void aiMatrix4x4t<TReal>::DecomposeNoScaling (aiQuaterniont<TReal>& rotation,
  37.507 +    aiVector3t<TReal>& position) const
  37.508 +{
  37.509 +    const aiMatrix4x4t<TReal>& _this = *this;
  37.510 +
  37.511 +    // extract translation
  37.512 +    position.x = _this[0][3];
  37.513 +    position.y = _this[1][3];
  37.514 +    position.z = _this[2][3];
  37.515 +
  37.516 +    // extract rotation
  37.517 +    rotation = aiQuaterniont<TReal>((aiMatrix3x3t<TReal>)_this);
  37.518 +}
  37.519 +
  37.520 +// ----------------------------------------------------------------------------------------
  37.521 +template <typename TReal>
  37.522 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::FromEulerAnglesXYZ(const aiVector3t<TReal>& blubb)
  37.523 +{
  37.524 +    return FromEulerAnglesXYZ(blubb.x,blubb.y,blubb.z);
  37.525 +}
  37.526 +
  37.527 +// ----------------------------------------------------------------------------------------
  37.528 +template <typename TReal>
  37.529 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::FromEulerAnglesXYZ(TReal x, TReal y, TReal z)
  37.530 +{
  37.531 +    aiMatrix4x4t<TReal>& _this = *this;
  37.532 +
  37.533 +    TReal cx = std::cos(x);
  37.534 +    TReal sx = std::sin(x);
  37.535 +    TReal cy = std::cos(y);
  37.536 +    TReal sy = std::sin(y);
  37.537 +    TReal cz = std::cos(z);
  37.538 +    TReal sz = std::sin(z);
  37.539 +
  37.540 +    // mz*my*mx
  37.541 +    _this.a1 = cz * cy;
  37.542 +    _this.a2 = cz * sy * sx - sz * cx;
  37.543 +    _this.a3 = sz * sx + cz * sy * cx;
  37.544 +
  37.545 +    _this.b1 = sz * cy;
  37.546 +    _this.b2 = cz * cx + sz * sy * sx;
  37.547 +    _this.b3 = sz * sy * cx - cz * sx;
  37.548 +
  37.549 +    _this.c1 = -sy;
  37.550 +    _this.c2 = cy * sx;
  37.551 +    _this.c3 = cy * cx;
  37.552 +
  37.553 +    return *this;
  37.554 +}
  37.555 +
  37.556 +// ----------------------------------------------------------------------------------------
  37.557 +template <typename TReal>
  37.558 +inline bool aiMatrix4x4t<TReal>::IsIdentity() const
  37.559 +{
  37.560 +    // Use a small epsilon to solve floating-point inaccuracies
  37.561 +    const static TReal epsilon = 10e-3f;
  37.562 +
  37.563 +    return (a2 <= epsilon && a2 >= -epsilon &&
  37.564 +            a3 <= epsilon && a3 >= -epsilon &&
  37.565 +            a4 <= epsilon && a4 >= -epsilon &&
  37.566 +            b1 <= epsilon && b1 >= -epsilon &&
  37.567 +            b3 <= epsilon && b3 >= -epsilon &&
  37.568 +            b4 <= epsilon && b4 >= -epsilon &&
  37.569 +            c1 <= epsilon && c1 >= -epsilon &&
  37.570 +            c2 <= epsilon && c2 >= -epsilon &&
  37.571 +            c4 <= epsilon && c4 >= -epsilon &&
  37.572 +            d1 <= epsilon && d1 >= -epsilon &&
  37.573 +            d2 <= epsilon && d2 >= -epsilon &&
  37.574 +            d3 <= epsilon && d3 >= -epsilon &&
  37.575 +            a1 <= 1.f+epsilon && a1 >= 1.f-epsilon &&
  37.576 +            b2 <= 1.f+epsilon && b2 >= 1.f-epsilon &&
  37.577 +            c3 <= 1.f+epsilon && c3 >= 1.f-epsilon &&
  37.578 +            d4 <= 1.f+epsilon && d4 >= 1.f-epsilon);
  37.579 +}
  37.580 +
  37.581 +// ----------------------------------------------------------------------------------------
  37.582 +template <typename TReal>
  37.583 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::RotationX(TReal a, aiMatrix4x4t<TReal>& out)
  37.584 +{
  37.585 +    /*
  37.586 +         |  1  0       0       0 |
  37.587 +     M = |  0  cos(A) -sin(A)  0 |
  37.588 +         |  0  sin(A)  cos(A)  0 |
  37.589 +         |  0  0       0       1 |  */
  37.590 +    out = aiMatrix4x4t<TReal>();
  37.591 +    out.b2 = out.c3 = std::cos(a);
  37.592 +    out.b3 = -(out.c2 = std::sin(a));
  37.593 +    return out;
  37.594 +}
  37.595 +
  37.596 +// ----------------------------------------------------------------------------------------
  37.597 +template <typename TReal>
  37.598 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::RotationY(TReal a, aiMatrix4x4t<TReal>& out)
  37.599 +{
  37.600 +    /*
  37.601 +         |  cos(A)  0   sin(A)  0 |
  37.602 +     M = |  0       1   0       0 |
  37.603 +         | -sin(A)  0   cos(A)  0 |
  37.604 +         |  0       0   0       1 |
  37.605 +        */
  37.606 +    out = aiMatrix4x4t<TReal>();
  37.607 +    out.a1 = out.c3 = std::cos(a);
  37.608 +    out.c1 = -(out.a3 = std::sin(a));
  37.609 +    return out;
  37.610 +}
  37.611 +
  37.612 +// ----------------------------------------------------------------------------------------
  37.613 +template <typename TReal>
  37.614 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::RotationZ(TReal a, aiMatrix4x4t<TReal>& out)
  37.615 +{
  37.616 +    /*
  37.617 +         |  cos(A)  -sin(A)   0   0 |
  37.618 +     M = |  sin(A)   cos(A)   0   0 |
  37.619 +         |  0        0        1   0 |
  37.620 +         |  0        0        0   1 |   */
  37.621 +    out = aiMatrix4x4t<TReal>();
  37.622 +    out.a1 = out.b2 = std::cos(a);
  37.623 +    out.a2 = -(out.b1 = std::sin(a));
  37.624 +    return out;
  37.625 +}
  37.626 +
  37.627 +// ----------------------------------------------------------------------------------------
  37.628 +// Returns a rotation matrix for a rotation around an arbitrary axis.
  37.629 +template <typename TReal>
  37.630 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Rotation( TReal a, const aiVector3t<TReal>& axis, aiMatrix4x4t<TReal>& out)
  37.631 +{
  37.632 +  TReal c = std::cos( a), s = std::sin( a), t = 1 - c;
  37.633 +  TReal x = axis.x, y = axis.y, z = axis.z;
  37.634 +
  37.635 +  // Many thanks to MathWorld and Wikipedia
  37.636 +  out.a1 = t*x*x + c;   out.a2 = t*x*y - s*z; out.a3 = t*x*z + s*y;
  37.637 +  out.b1 = t*x*y + s*z; out.b2 = t*y*y + c;   out.b3 = t*y*z - s*x;
  37.638 +  out.c1 = t*x*z - s*y; out.c2 = t*y*z + s*x; out.c3 = t*z*z + c;
  37.639 +  out.a4 = out.b4 = out.c4 = static_cast<TReal>(0.0);
  37.640 +  out.d1 = out.d2 = out.d3 = static_cast<TReal>(0.0);
  37.641 +  out.d4 = static_cast<TReal>(1.0);
  37.642 +
  37.643 +  return out;
  37.644 +}
  37.645 +
  37.646 +// ----------------------------------------------------------------------------------------
  37.647 +template <typename TReal>
  37.648 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Translation( const aiVector3t<TReal>& v, aiMatrix4x4t<TReal>& out)
  37.649 +{
  37.650 +    out = aiMatrix4x4t<TReal>();
  37.651 +    out.a4 = v.x;
  37.652 +    out.b4 = v.y;
  37.653 +    out.c4 = v.z;
  37.654 +    return out;
  37.655 +}
  37.656 +
  37.657 +// ----------------------------------------------------------------------------------------
  37.658 +template <typename TReal>
  37.659 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Scaling( const aiVector3t<TReal>& v, aiMatrix4x4t<TReal>& out)
  37.660 +{
  37.661 +    out = aiMatrix4x4t<TReal>();
  37.662 +    out.a1 = v.x;
  37.663 +    out.b2 = v.y;
  37.664 +    out.c3 = v.z;
  37.665 +    return out;
  37.666 +}
  37.667 +
  37.668 +// ----------------------------------------------------------------------------------------
  37.669 +/** A function for creating a rotation matrix that rotates a vector called
  37.670 + * "from" into another vector called "to".
  37.671 + * Input : from[3], to[3] which both must be *normalized* non-zero vectors
  37.672 + * Output: mtx[3][3] -- a 3x3 matrix in colum-major form
  37.673 + * Authors: Tomas Möller, John Hughes
  37.674 + *          "Efficiently Building a Matrix to Rotate One Vector to Another"
  37.675 + *          Journal of Graphics Tools, 4(4):1-4, 1999
  37.676 + */
  37.677 +// ----------------------------------------------------------------------------------------
  37.678 +template <typename TReal>
  37.679 +inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::FromToMatrix(const aiVector3t<TReal>& from,
  37.680 +    const aiVector3t<TReal>& to, aiMatrix4x4t<TReal>& mtx)
  37.681 +{
  37.682 +    aiMatrix3x3t<TReal> m3;
  37.683 +    aiMatrix3x3t<TReal>::FromToMatrix(from,to,m3);
  37.684 +    mtx = aiMatrix4x4t<TReal>(m3);
  37.685 +    return mtx;
  37.686 +}
  37.687 +
  37.688 +#endif // __cplusplus
  37.689 +#endif // AI_MATRIX4X4_INL_INC
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/include/miniassimp/mesh.h	Mon Jan 28 18:19:26 2019 +0200
    38.3 @@ -0,0 +1,852 @@
    38.4 +/*
    38.5 +---------------------------------------------------------------------------
    38.6 +Open Asset Import Library (assimp)
    38.7 +---------------------------------------------------------------------------
    38.8 +
    38.9 +Copyright (c) 2006-2018, assimp team
   38.10 +
   38.11 +
   38.12 +All rights reserved.
   38.13 +
   38.14 +Redistribution and use of this software in source and binary forms,
   38.15 +with or without modification, are permitted provided that the following
   38.16 +conditions are met:
   38.17 +
   38.18 +* Redistributions of source code must retain the above
   38.19 +  copyright notice, this list of conditions and the
   38.20 +  following disclaimer.
   38.21 +
   38.22 +* Redistributions in binary form must reproduce the above
   38.23 +  copyright notice, this list of conditions and the
   38.24 +  following disclaimer in the documentation and/or other
   38.25 +  materials provided with the distribution.
   38.26 +
   38.27 +* Neither the name of the assimp team, nor the names of its
   38.28 +  contributors may be used to endorse or promote products
   38.29 +  derived from this software without specific prior
   38.30 +  written permission of the assimp team.
   38.31 +
   38.32 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   38.33 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   38.34 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   38.35 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   38.36 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   38.37 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   38.38 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   38.39 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   38.40 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   38.41 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   38.42 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   38.43 +---------------------------------------------------------------------------
   38.44 +*/
   38.45 +
   38.46 +/** @file mesh.h
   38.47 + *  @brief Declares the data structures in which the imported geometry is
   38.48 +    returned by ASSIMP: aiMesh, aiFace and aiBone data structures.
   38.49 + */
   38.50 +#pragma once
   38.51 +#ifndef AI_MESH_H_INC
   38.52 +#define AI_MESH_H_INC
   38.53 +
   38.54 +#include "types.h"
   38.55 +
   38.56 +#ifdef __cplusplus
   38.57 +extern "C" {
   38.58 +#endif
   38.59 +
   38.60 +// ---------------------------------------------------------------------------
   38.61 +// Limits. These values are required to match the settings Assimp was
   38.62 +// compiled against. Therefore, do not redefine them unless you build the
   38.63 +// library from source using the same definitions.
   38.64 +// ---------------------------------------------------------------------------
   38.65 +
   38.66 +/** @def AI_MAX_FACE_INDICES
   38.67 + *  Maximum number of indices per face (polygon). */
   38.68 +
   38.69 +#ifndef AI_MAX_FACE_INDICES
   38.70 +#   define AI_MAX_FACE_INDICES 0x7fff
   38.71 +#endif
   38.72 +
   38.73 +/** @def AI_MAX_BONE_WEIGHTS
   38.74 + *  Maximum number of indices per face (polygon). */
   38.75 +
   38.76 +#ifndef AI_MAX_BONE_WEIGHTS
   38.77 +#   define AI_MAX_BONE_WEIGHTS 0x7fffffff
   38.78 +#endif
   38.79 +
   38.80 +/** @def AI_MAX_VERTICES
   38.81 + *  Maximum number of vertices per mesh.  */
   38.82 +
   38.83 +#ifndef AI_MAX_VERTICES
   38.84 +#   define AI_MAX_VERTICES 0x7fffffff
   38.85 +#endif
   38.86 +
   38.87 +/** @def AI_MAX_FACES
   38.88 + *  Maximum number of faces per mesh. */
   38.89 +
   38.90 +#ifndef AI_MAX_FACES
   38.91 +#   define AI_MAX_FACES 0x7fffffff
   38.92 +#endif
   38.93 +
   38.94 +/** @def AI_MAX_NUMBER_OF_COLOR_SETS
   38.95 + *  Supported number of vertex color sets per mesh. */
   38.96 +
   38.97 +#ifndef AI_MAX_NUMBER_OF_COLOR_SETS
   38.98 +#   define AI_MAX_NUMBER_OF_COLOR_SETS 0x8
   38.99 +#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS
  38.100 +
  38.101 +/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS
  38.102 + *  Supported number of texture coord sets (UV(W) channels) per mesh */
  38.103 +
  38.104 +#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS
  38.105 +#   define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8
  38.106 +#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS
  38.107 +
  38.108 +// ---------------------------------------------------------------------------
  38.109 +/** @brief A single face in a mesh, referring to multiple vertices.
  38.110 + *
  38.111 + * If mNumIndices is 3, we call the face 'triangle', for mNumIndices > 3
  38.112 + * it's called 'polygon' (hey, that's just a definition!).
  38.113 + * <br>
  38.114 + * aiMesh::mPrimitiveTypes can be queried to quickly examine which types of
  38.115 + * primitive are actually present in a mesh. The #aiProcess_SortByPType flag
  38.116 + * executes a special post-processing algorithm which splits meshes with
  38.117 + * *different* primitive types mixed up (e.g. lines and triangles) in several
  38.118 + * 'clean' submeshes. Furthermore there is a configuration option (
  38.119 + * #AI_CONFIG_PP_SBP_REMOVE) to force #aiProcess_SortByPType to remove
  38.120 + * specific kinds of primitives from the imported scene, completely and forever.
  38.121 + * In many cases you'll probably want to set this setting to
  38.122 + * @code
  38.123 + * aiPrimitiveType_LINE|aiPrimitiveType_POINT
  38.124 + * @endcode
  38.125 + * Together with the #aiProcess_Triangulate flag you can then be sure that
  38.126 + * #aiFace::mNumIndices is always 3.
  38.127 + * @note Take a look at the @link data Data Structures page @endlink for
  38.128 + * more information on the layout and winding order of a face.
  38.129 + */
  38.130 +struct aiFace
  38.131 +{
  38.132 +    //! Number of indices defining this face.
  38.133 +    //! The maximum value for this member is #AI_MAX_FACE_INDICES.
  38.134 +    unsigned int mNumIndices;
  38.135 +
  38.136 +    //! Pointer to the indices array. Size of the array is given in numIndices.
  38.137 +    unsigned int* mIndices;
  38.138 +
  38.139 +#ifdef __cplusplus
  38.140 +
  38.141 +    //! Default constructor
  38.142 +    aiFace() AI_NO_EXCEPT
  38.143 +    : mNumIndices( 0 )
  38.144 +    , mIndices( 0 ) {
  38.145 +        // empty
  38.146 +    }
  38.147 +
  38.148 +    //! Default destructor. Delete the index array
  38.149 +    ~aiFace()
  38.150 +    {
  38.151 +        delete [] mIndices;
  38.152 +    }
  38.153 +
  38.154 +    //! Copy constructor. Copy the index array
  38.155 +    aiFace( const aiFace& o)
  38.156 +    : mNumIndices(0)
  38.157 +    , mIndices( 0 ) {
  38.158 +        *this = o;
  38.159 +    }
  38.160 +
  38.161 +    //! Assignment operator. Copy the index array
  38.162 +    aiFace& operator = ( const aiFace& o) {
  38.163 +        if (&o == this) {
  38.164 +            return *this;
  38.165 +        }
  38.166 +
  38.167 +        delete[] mIndices;
  38.168 +        mNumIndices = o.mNumIndices;
  38.169 +        if (mNumIndices) {
  38.170 +            mIndices = new unsigned int[mNumIndices];
  38.171 +            ::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));
  38.172 +        } else {
  38.173 +            mIndices = 0;
  38.174 +        }
  38.175 +
  38.176 +        return *this;
  38.177 +    }
  38.178 +
  38.179 +    //! Comparison operator. Checks whether the index array
  38.180 +    //! of two faces is identical
  38.181 +    bool operator== (const aiFace& o) const {
  38.182 +        if (mIndices == o.mIndices) {
  38.183 +            return true;
  38.184 +        }
  38.185 +
  38.186 +        if (0 != mIndices && mNumIndices != o.mNumIndices) {
  38.187 +            return false;
  38.188 +        }
  38.189 +
  38.190 +        if (0 == mIndices) {
  38.191 +            return false;
  38.192 +        }
  38.193 +
  38.194 +        for (unsigned int i = 0; i < this->mNumIndices; ++i) {
  38.195 +            if (mIndices[i] != o.mIndices[i]) {
  38.196 +                return false;
  38.197 +            }
  38.198 +        }
  38.199 +
  38.200 +        return true;
  38.201 +    }
  38.202 +
  38.203 +    //! Inverse comparison operator. Checks whether the index
  38.204 +    //! array of two faces is NOT identical
  38.205 +    bool operator != (const aiFace& o) const {
  38.206 +        return !(*this == o);
  38.207 +    }
  38.208 +#endif // __cplusplus
  38.209 +}; // struct aiFace
  38.210 +
  38.211 +
  38.212 +// ---------------------------------------------------------------------------
  38.213 +/** @brief A single influence of a bone on a vertex.
  38.214 + */
  38.215 +struct aiVertexWeight {
  38.216 +    //! Index of the vertex which is influenced by the bone.
  38.217 +    unsigned int mVertexId;
  38.218 +
  38.219 +    //! The strength of the influence in the range (0...1).
  38.220 +    //! The influence from all bones at one vertex amounts to 1.
  38.221 +    float mWeight;
  38.222 +
  38.223 +#ifdef __cplusplus
  38.224 +
  38.225 +    //! Default constructor
  38.226 +    aiVertexWeight() AI_NO_EXCEPT
  38.227 +    : mVertexId(0)
  38.228 +    , mWeight(0.0f) {
  38.229 +        // empty
  38.230 +    }
  38.231 +
  38.232 +    //! Initialization from a given index and vertex weight factor
  38.233 +    //! \param pID ID
  38.234 +    //! \param pWeight Vertex weight factor
  38.235 +    aiVertexWeight( unsigned int pID, float pWeight )
  38.236 +    : mVertexId( pID )
  38.237 +    , mWeight( pWeight ) {
  38.238 +        // empty
  38.239 +    }
  38.240 +
  38.241 +    bool operator == ( const aiVertexWeight &rhs ) const {
  38.242 +        return ( mVertexId == rhs.mVertexId && mWeight == rhs.mWeight );
  38.243 +    }
  38.244 +
  38.245 +    bool operator != ( const aiVertexWeight &rhs ) const {
  38.246 +        return ( *this == rhs );
  38.247 +    }
  38.248 +
  38.249 +#endif // __cplusplus
  38.250 +};
  38.251 +
  38.252 +
  38.253 +// ---------------------------------------------------------------------------
  38.254 +/** @brief A single bone of a mesh.
  38.255 + *
  38.256 + *  A bone has a name by which it can be found in the frame hierarchy and by
  38.257 + *  which it can be addressed by animations. In addition it has a number of
  38.258 + *  influences on vertices, and a matrix relating the mesh position to the
  38.259 + *  position of the bone at the time of binding.
  38.260 + */
  38.261 +struct aiBone {
  38.262 +    //! The name of the bone.
  38.263 +    C_STRUCT aiString mName;
  38.264 +
  38.265 +    //! The number of vertices affected by this bone.
  38.266 +    //! The maximum value for this member is #AI_MAX_BONE_WEIGHTS.
  38.267 +    unsigned int mNumWeights;
  38.268 +
  38.269 +    //! The influence weights of this bone, by vertex index.
  38.270 +    C_STRUCT aiVertexWeight* mWeights;
  38.271 +
  38.272 +    /** Matrix that transforms from bone space to mesh space in bind pose.
  38.273 +     *
  38.274 +     * This matrix describes the position of the mesh
  38.275 +     * in the local space of this bone when the skeleton was bound.
  38.276 +     * Thus it can be used directly to determine a desired vertex position,
  38.277 +     * given the world-space transform of the bone when animated,
  38.278 +     * and the position of the vertex in mesh space.
  38.279 +     *
  38.280 +     * It is sometimes called an inverse-bind matrix,
  38.281 +     * or inverse bind pose matrix.
  38.282 +     */
  38.283 +    C_STRUCT aiMatrix4x4 mOffsetMatrix;
  38.284 +
  38.285 +#ifdef __cplusplus
  38.286 +
  38.287 +    //! Default constructor
  38.288 +    aiBone() AI_NO_EXCEPT
  38.289 +    : mName()
  38.290 +    , mNumWeights( 0 )
  38.291 +    , mWeights( 0 )
  38.292 +    , mOffsetMatrix() {
  38.293 +        // empty
  38.294 +    }
  38.295 +
  38.296 +    //! Copy constructor
  38.297 +    aiBone(const aiBone& other)
  38.298 +    : mName( other.mName )
  38.299 +    , mNumWeights( other.mNumWeights )
  38.300 +    , mWeights(0)
  38.301 +    , mOffsetMatrix( other.mOffsetMatrix ) {
  38.302 +        if (other.mWeights && other.mNumWeights) {
  38.303 +            mWeights = new aiVertexWeight[mNumWeights];
  38.304 +            ::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
  38.305 +        }
  38.306 +    }
  38.307 +
  38.308 +
  38.309 +    //! Assignment operator
  38.310 +    aiBone &operator=(const aiBone& other) {
  38.311 +        if (this == &other) {
  38.312 +            return *this;
  38.313 +        }
  38.314 +
  38.315 +        mName         = other.mName;
  38.316 +        mNumWeights   = other.mNumWeights;
  38.317 +        mOffsetMatrix = other.mOffsetMatrix;
  38.318 +
  38.319 +        if (other.mWeights && other.mNumWeights)
  38.320 +        {
  38.321 +            if (mWeights) {
  38.322 +                delete[] mWeights;
  38.323 +            }
  38.324 +
  38.325 +            mWeights = new aiVertexWeight[mNumWeights];
  38.326 +            ::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
  38.327 +        }
  38.328 +
  38.329 +        return *this;
  38.330 +    }
  38.331 +
  38.332 +    bool operator == ( const aiBone &rhs ) const {
  38.333 +        if ( mName != rhs.mName || mNumWeights != rhs.mNumWeights ) {
  38.334 +            return false;
  38.335 +        }
  38.336 +
  38.337 +        for ( size_t i = 0; i < mNumWeights; ++i ) {
  38.338 +            if ( mWeights[ i ] != rhs.mWeights[ i ] ) {
  38.339 +                return false;
  38.340 +            }
  38.341 +        }
  38.342 +
  38.343 +        return true;
  38.344 +    }
  38.345 +    //! Destructor - deletes the array of vertex weights
  38.346 +    ~aiBone() {
  38.347 +        delete [] mWeights;
  38.348 +    }
  38.349 +#endif // __cplusplus
  38.350 +};
  38.351 +
  38.352 +
  38.353 +// ---------------------------------------------------------------------------
  38.354 +/** @brief Enumerates the types of geometric primitives supported by Assimp.
  38.355 + *
  38.356 + *  @see aiFace Face data structure
  38.357 + *  @see aiProcess_SortByPType Per-primitive sorting of meshes
  38.358 + *  @see aiProcess_Triangulate Automatic triangulation
  38.359 + *  @see AI_CONFIG_PP_SBP_REMOVE Removal of specific primitive types.
  38.360 + */
  38.361 +enum aiPrimitiveType
  38.362 +{
  38.363 +    /** A point primitive.
  38.364 +     *
  38.365 +     * This is just a single vertex in the virtual world,
  38.366 +     * #aiFace contains just one index for such a primitive.
  38.367 +     */
  38.368 +    aiPrimitiveType_POINT       = 0x1,
  38.369 +
  38.370 +    /** A line primitive.
  38.371 +     *
  38.372 +     * This is a line defined through a start and an end position.
  38.373 +     * #aiFace contains exactly two indices for such a primitive.
  38.374 +     */
  38.375 +    aiPrimitiveType_LINE        = 0x2,
  38.376 +
  38.377 +    /** A triangular primitive.
  38.378 +     *
  38.379 +     * A triangle consists of three indices.
  38.380 +     */
  38.381 +    aiPrimitiveType_TRIANGLE    = 0x4,
  38.382 +
  38.383 +    /** A higher-level polygon with more than 3 edges.
  38.384 +     *
  38.385 +     * A triangle is a polygon, but polygon in this context means
  38.386 +     * "all polygons that are not triangles". The "Triangulate"-Step
  38.387 +     * is provided for your convenience, it splits all polygons in
  38.388 +     * triangles (which are much easier to handle).
  38.389 +     */
  38.390 +    aiPrimitiveType_POLYGON     = 0x8,
  38.391 +
  38.392 +
  38.393 +    /** This value is not used. It is just here to force the
  38.394 +     *  compiler to map this enum to a 32 Bit integer.
  38.395 +     */
  38.396 +#ifndef SWIG
  38.397 +    _aiPrimitiveType_Force32Bit = INT_MAX
  38.398 +#endif
  38.399 +}; //! enum aiPrimitiveType
  38.400 +
  38.401 +// Get the #aiPrimitiveType flag for a specific number of face indices
  38.402 +#define AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) \
  38.403 +    ((n) > 3 ? aiPrimitiveType_POLYGON : (aiPrimitiveType)(1u << ((n)-1)))
  38.404 +
  38.405 +
  38.406 +
  38.407 +// ---------------------------------------------------------------------------
  38.408 +/** @brief An AnimMesh is an attachment to an #aiMesh stores per-vertex
  38.409 + *  animations for a particular frame.
  38.410 + *
  38.411 + *  You may think of an #aiAnimMesh as a `patch` for the host mesh, which
  38.412 + *  replaces only certain vertex data streams at a particular time.
  38.413 + *  Each mesh stores n attached attached meshes (#aiMesh::mAnimMeshes).
  38.414 + *  The actual relationship between the time line and anim meshes is
  38.415 + *  established by #aiMeshAnim, which references singular mesh attachments
  38.416 + *  by their ID and binds them to a time offset.
  38.417 +*/
  38.418 +struct aiAnimMesh
  38.419 +{
  38.420 +    /**Anim Mesh name */
  38.421 +    C_STRUCT aiString mName;
  38.422 +
  38.423 +    /** Replacement for aiMesh::mVertices. If this array is non-NULL,
  38.424 +     *  it *must* contain mNumVertices entries. The corresponding
  38.425 +     *  array in the host mesh must be non-NULL as well - animation
  38.426 +     *  meshes may neither add or nor remove vertex components (if
  38.427 +     *  a replacement array is NULL and the corresponding source
  38.428 +     *  array is not, the source data is taken instead)*/
  38.429 +    C_STRUCT aiVector3D* mVertices;
  38.430 +
  38.431 +    /** Replacement for aiMesh::mNormals.  */
  38.432 +    C_STRUCT aiVector3D* mNormals;
  38.433 +
  38.434 +    /** Replacement for aiMesh::mTangents. */
  38.435 +    C_STRUCT aiVector3D* mTangents;
  38.436 +
  38.437 +    /** Replacement for aiMesh::mBitangents. */
  38.438 +    C_STRUCT aiVector3D* mBitangents;
  38.439 +
  38.440 +    /** Replacement for aiMesh::mColors */
  38.441 +    C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
  38.442 +
  38.443 +    /** Replacement for aiMesh::mTextureCoords */
  38.444 +    C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
  38.445 +
  38.446 +    /** The number of vertices in the aiAnimMesh, and thus the length of all
  38.447 +     * the member arrays.
  38.448 +     *
  38.449 +     * This has always the same value as the mNumVertices property in the
  38.450 +     * corresponding aiMesh. It is duplicated here merely to make the length
  38.451 +     * of the member arrays accessible even if the aiMesh is not known, e.g.
  38.452 +     * from language bindings.
  38.453 +     */
  38.454 +    unsigned int mNumVertices;
  38.455 +    
  38.456 +    /** 
  38.457 +     * Weight of the AnimMesh. 
  38.458 +     */
  38.459 +    float mWeight;
  38.460 +
  38.461 +#ifdef __cplusplus
  38.462 +
  38.463 +    aiAnimMesh() AI_NO_EXCEPT
  38.464 +        : mVertices( 0 )
  38.465 +        , mNormals(0)
  38.466 +        , mTangents(0)
  38.467 +        , mBitangents(0)
  38.468 +        , mColors()
  38.469 +        , mTextureCoords()
  38.470 +        , mNumVertices( 0 )
  38.471 +        , mWeight( 0.0f )
  38.472 +    {
  38.473 +        // fixme consider moving this to the ctor initializer list as well
  38.474 +        for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++){
  38.475 +            mTextureCoords[a] = NULL;
  38.476 +        }
  38.477 +        for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
  38.478 +            mColors[a] = NULL;
  38.479 +        }
  38.480 +    }
  38.481 +
  38.482 +    ~aiAnimMesh()
  38.483 +    {
  38.484 +        delete [] mVertices;
  38.485 +        delete [] mNormals;
  38.486 +        delete [] mTangents;
  38.487 +        delete [] mBitangents;
  38.488 +        for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
  38.489 +            delete [] mTextureCoords[a];
  38.490 +        }
  38.491 +        for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
  38.492 +            delete [] mColors[a];
  38.493 +        }
  38.494 +    }
  38.495 +
  38.496 +    /** Check whether the anim mesh overrides the vertex positions
  38.497 +     *  of its host mesh*/
  38.498 +    bool HasPositions() const {
  38.499 +        return mVertices != NULL;
  38.500 +    }
  38.501 +
  38.502 +    /** Check whether the anim mesh overrides the vertex normals
  38.503 +     *  of its host mesh*/
  38.504 +    bool HasNormals() const {
  38.505 +        return mNormals != NULL;
  38.506 +    }
  38.507 +
  38.508 +    /** Check whether the anim mesh overrides the vertex tangents
  38.509 +     *  and bitangents of its host mesh. As for aiMesh,
  38.510 +     *  tangents and bitangents always go together. */
  38.511 +    bool HasTangentsAndBitangents() const {
  38.512 +        return mTangents != NULL;
  38.513 +    }
  38.514 +
  38.515 +    /** Check whether the anim mesh overrides a particular
  38.516 +     * set of vertex colors on his host mesh.
  38.517 +     *  @param pIndex 0<index<AI_MAX_NUMBER_OF_COLOR_SETS */
  38.518 +    bool HasVertexColors( unsigned int pIndex) const    {
  38.519 +        return pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS ? false : mColors[pIndex] != NULL;
  38.520 +    }
  38.521 +
  38.522 +    /** Check whether the anim mesh overrides a particular
  38.523 +     * set of texture coordinates on his host mesh.
  38.524 +     *  @param pIndex 0<index<AI_MAX_NUMBER_OF_TEXTURECOORDS */
  38.525 +    bool HasTextureCoords( unsigned int pIndex) const   {
  38.526 +        return pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? false : mTextureCoords[pIndex] != NULL;
  38.527 +    }
  38.528 +
  38.529 +#endif
  38.530 +};
  38.531 +
  38.532 +// ---------------------------------------------------------------------------
  38.533 +/** @brief Enumerates the methods of mesh morphing supported by Assimp.
  38.534 + */
  38.535 +enum aiMorphingMethod
  38.536 +{
  38.537 +    /** Interpolation between morph targets */
  38.538 +    aiMorphingMethod_VERTEX_BLEND       = 0x1,
  38.539 +
  38.540 +    /** Normalized morphing between morph targets  */
  38.541 +    aiMorphingMethod_MORPH_NORMALIZED   = 0x2,
  38.542 +
  38.543 +    /** Relative morphing between morph targets  */
  38.544 +    aiMorphingMethod_MORPH_RELATIVE     = 0x3,
  38.545 +
  38.546 +    /** This value is not used. It is just here to force the
  38.547 +     *  compiler to map this enum to a 32 Bit integer.
  38.548 +     */
  38.549 +#ifndef SWIG
  38.550 +    _aiMorphingMethod_Force32Bit = INT_MAX
  38.551 +#endif
  38.552 +}; //! enum aiMorphingMethod
  38.553 +
  38.554 +// ---------------------------------------------------------------------------
  38.555 +/** @brief A mesh represents a geometry or model with a single material.
  38.556 +*
  38.557 +* It usually consists of a number of vertices and a series of primitives/faces
  38.558 +* referencing the vertices. In addition there might be a series of bones, each
  38.559 +* of them addressing a number of vertices with a certain weight. Vertex data
  38.560 +* is presented in channels with each channel containing a single per-vertex
  38.561 +* information such as a set of texture coords or a normal vector.
  38.562 +* If a data pointer is non-null, the corresponding data stream is present.
  38.563 +* From C++-programs you can also use the comfort functions Has*() to
  38.564 +* test for the presence of various data streams.
  38.565 +*
  38.566 +* A Mesh uses only a single material which is referenced by a material ID.
  38.567 +* @note The mPositions member is usually not optional. However, vertex positions
  38.568 +* *could* be missing if the #AI_SCENE_FLAGS_INCOMPLETE flag is set in
  38.569 +* @code
  38.570 +* aiScene::mFlags
  38.571 +* @endcode
  38.572 +*/
  38.573 +struct aiMesh
  38.574 +{
  38.575 +    /** Bitwise combination of the members of the #aiPrimitiveType enum.
  38.576 +     * This specifies which types of primitives are present in the mesh.
  38.577 +     * The "SortByPrimitiveType"-Step can be used to make sure the
  38.578 +     * output meshes consist of one primitive type each.
  38.579 +     */
  38.580 +    unsigned int mPrimitiveTypes;
  38.581 +
  38.582 +    /** The number of vertices in this mesh.
  38.583 +    * This is also the size of all of the per-vertex data arrays.
  38.584 +    * The maximum value for this member is #AI_MAX_VERTICES.
  38.585 +    */
  38.586 +    unsigned int mNumVertices;
  38.587 +
  38.588 +    /** The number of primitives (triangles, polygons, lines) in this  mesh.
  38.589 +    * This is also the size of the mFaces array.
  38.590 +    * The maximum value for this member is #AI_MAX_FACES.
  38.591 +    */
  38.592 +    unsigned int mNumFaces;
  38.593 +
  38.594 +    /** Vertex positions.
  38.595 +    * This array is always present in a mesh. The array is
  38.596 +    * mNumVertices in size.
  38.597 +    */
  38.598 +    C_STRUCT aiVector3D* mVertices;
  38.599 +
  38.600 +    /** Vertex normals.
  38.601 +    * The array contains normalized vectors, NULL if not present.
  38.602 +    * The array is mNumVertices in size. Normals are undefined for
  38.603 +    * point and line primitives. A mesh consisting of points and
  38.604 +    * lines only may not have normal vectors. Meshes with mixed
  38.605 +    * primitive types (i.e. lines and triangles) may have normals,
  38.606 +    * but the normals for vertices that are only referenced by
  38.607 +    * point or line primitives are undefined and set to QNaN (WARN:
  38.608 +    * qNaN compares to inequal to *everything*, even to qNaN itself.
  38.609 +    * Using code like this to check whether a field is qnan is:
  38.610 +    * @code
  38.611 +    * #define IS_QNAN(f) (f != f)
  38.612 +    * @endcode
  38.613 +    * still dangerous because even 1.f == 1.f could evaluate to false! (
  38.614 +    * remember the subtleties of IEEE754 artithmetics). Use stuff like
  38.615 +    * @c fpclassify instead.
  38.616 +    * @note Normal vectors computed by Assimp are always unit-length.
  38.617 +    * However, this needn't apply for normals that have been taken
  38.618 +    *   directly from the model file.
  38.619 +    */
  38.620 +    C_STRUCT aiVector3D* mNormals;
  38.621 +
  38.622 +    /** Vertex tangents.
  38.623 +    * The tangent of a vertex points in the direction of the positive
  38.624 +    * X texture axis. The array contains normalized vectors, NULL if
  38.625 +    * not present. The array is mNumVertices in size. A mesh consisting
  38.626 +    * of points and lines only may not have normal vectors. Meshes with
  38.627 +    * mixed primitive types (i.e. lines and triangles) may have
  38.628 +    * normals, but the normals for vertices that are only referenced by
  38.629 +    * point or line primitives are undefined and set to qNaN.  See
  38.630 +    * the #mNormals member for a detailed discussion of qNaNs.
  38.631 +    * @note If the mesh contains tangents, it automatically also
  38.632 +    * contains bitangents.
  38.633 +    */
  38.634 +    C_STRUCT aiVector3D* mTangents;
  38.635 +
  38.636 +    /** Vertex bitangents.
  38.637 +    * The bitangent of a vertex points in the direction of the positive
  38.638 +    * Y texture axis. The array contains normalized vectors, NULL if not
  38.639 +    * present. The array is mNumVertices in size.
  38.640 +    * @note If the mesh contains tangents, it automatically also contains
  38.641 +    * bitangents.
  38.642 +    */
  38.643 +    C_STRUCT aiVector3D* mBitangents;
  38.644 +
  38.645 +    /** Vertex color sets.
  38.646 +    * A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex
  38.647 +    * colors per vertex. NULL if not present. Each array is
  38.648 +    * mNumVertices in size if present.
  38.649 +    */
  38.650 +    C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
  38.651 +
  38.652 +    /** Vertex texture coords, also known as UV channels.
  38.653 +    * A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per
  38.654 +    * vertex. NULL if not present. The array is mNumVertices in size.
  38.655 +    */
  38.656 +    C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
  38.657 +
  38.658 +    /** Specifies the number of components for a given UV channel.
  38.659 +    * Up to three channels are supported (UVW, for accessing volume
  38.660 +    * or cube maps). If the value is 2 for a given channel n, the
  38.661 +    * component p.z of mTextureCoords[n][p] is set to 0.0f.
  38.662 +    * If the value is 1 for a given channel, p.y is set to 0.0f, too.
  38.663 +    * @note 4D coords are not supported
  38.664 +    */
  38.665 +    unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
  38.666 +
  38.667 +    /** The faces the mesh is constructed from.
  38.668 +    * Each face refers to a number of vertices by their indices.
  38.669 +    * This array is always present in a mesh, its size is given
  38.670 +    * in mNumFaces. If the #AI_SCENE_FLAGS_NON_VERBOSE_FORMAT
  38.671 +    * is NOT set each face references an unique set of vertices.
  38.672 +    */
  38.673 +    C_STRUCT aiFace* mFaces;
  38.674 +
  38.675 +    /** The number of bones this mesh contains.
  38.676 +    * Can be 0, in which case the mBones array is NULL.
  38.677 +    */
  38.678 +    unsigned int mNumBones;
  38.679 +
  38.680 +    /** The bones of this mesh.
  38.681 +    * A bone consists of a name by which it can be found in the
  38.682 +    * frame hierarchy and a set of vertex weights.
  38.683 +    */
  38.684 +    C_STRUCT aiBone** mBones;
  38.685 +
  38.686 +    /** The material used by this mesh.
  38.687 +     * A mesh uses only a single material. If an imported model uses
  38.688 +     * multiple materials, the import splits up the mesh. Use this value
  38.689 +     * as index into the scene's material list.
  38.690 +     */
  38.691 +    unsigned int mMaterialIndex;
  38.692 +
  38.693 +    /** Name of the mesh. Meshes can be named, but this is not a
  38.694 +     *  requirement and leaving this field empty is totally fine.
  38.695 +     *  There are mainly three uses for mesh names:
  38.696 +     *   - some formats name nodes and meshes independently.
  38.697 +     *   - importers tend to split meshes up to meet the
  38.698 +     *      one-material-per-mesh requirement. Assigning
  38.699 +     *      the same (dummy) name to each of the result meshes
  38.700 +     *      aids the caller at recovering the original mesh
  38.701 +     *      partitioning.
  38.702 +     *   - Vertex animations refer to meshes by their names.
  38.703 +     **/
  38.704 +    C_STRUCT aiString mName;
  38.705 +
  38.706 +
  38.707 +    /** The number of attachment meshes. Note! Currently only works with Collada loader. */
  38.708 +    unsigned int mNumAnimMeshes;
  38.709 +
  38.710 +    /** Attachment meshes for this mesh, for vertex-based animation.
  38.711 +     *  Attachment meshes carry replacement data for some of the
  38.712 +     *  mesh'es vertex components (usually positions, normals).
  38.713 +     *  Note! Currently only works with Collada loader.*/
  38.714 +    C_STRUCT aiAnimMesh** mAnimMeshes;
  38.715 +
  38.716 +    /** 
  38.717 +     *  Method of morphing when animeshes are specified. 
  38.718 +     */
  38.719 +    unsigned int mMethod;
  38.720 +	
  38.721 +#ifdef __cplusplus
  38.722 +
  38.723 +    //! Default constructor. Initializes all members to 0
  38.724 +    aiMesh() AI_NO_EXCEPT
  38.725 +    : mPrimitiveTypes( 0 )
  38.726 +    , mNumVertices( 0 )
  38.727 +    , mNumFaces( 0 )
  38.728 +    , mVertices( 0 )
  38.729 +    , mNormals(0)
  38.730 +    , mTangents(0)
  38.731 +    , mBitangents(0)
  38.732 +    , mColors()
  38.733 +    , mTextureCoords()
  38.734 +    , mNumUVComponents()
  38.735 +    , mFaces(0)
  38.736 +    , mNumBones( 0 )
  38.737 +    , mBones(0)
  38.738 +    , mMaterialIndex( 0 )
  38.739 +    , mNumAnimMeshes( 0 )
  38.740 +    , mAnimMeshes(0)
  38.741 +    , mMethod( 0 ) {
  38.742 +        for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) {
  38.743 +            mNumUVComponents[a] = 0;
  38.744 +            mTextureCoords[a] = 0;
  38.745 +        }
  38.746 +
  38.747 +        for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a) {
  38.748 +            mColors[a] = 0;
  38.749 +        }
  38.750 +    }
  38.751 +
  38.752 +    //! Deletes all storage allocated for the mesh
  38.753 +    ~aiMesh() {
  38.754 +        delete [] mVertices;
  38.755 +        delete [] mNormals;
  38.756 +        delete [] mTangents;
  38.757 +        delete [] mBitangents;
  38.758 +        for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
  38.759 +            delete [] mTextureCoords[a];
  38.760 +        }
  38.761 +        for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
  38.762 +            delete [] mColors[a];
  38.763 +        }
  38.764 +
  38.765 +        // DO NOT REMOVE THIS ADDITIONAL CHECK
  38.766 +        if (mNumBones && mBones)    {
  38.767 +            for( unsigned int a = 0; a < mNumBones; a++) {
  38.768 +                delete mBones[a];
  38.769 +            }
  38.770 +            delete [] mBones;
  38.771 +        }
  38.772 +
  38.773 +        if (mNumAnimMeshes && mAnimMeshes)  {
  38.774 +            for( unsigned int a = 0; a < mNumAnimMeshes; a++) {
  38.775 +                delete mAnimMeshes[a];
  38.776 +            }
  38.777 +            delete [] mAnimMeshes;
  38.778 +        }
  38.779 +
  38.780 +        delete [] mFaces;
  38.781 +    }
  38.782 +
  38.783 +    //! Check whether the mesh contains positions. Provided no special
  38.784 +    //! scene flags are set, this will always be true
  38.785 +    bool HasPositions() const
  38.786 +        { return mVertices != 0 && mNumVertices > 0; }
  38.787 +
  38.788 +    //! Check whether the mesh contains faces. If no special scene flags
  38.789 +    //! are set this should always return true
  38.790 +    bool HasFaces() const
  38.791 +        { return mFaces != 0 && mNumFaces > 0; }
  38.792 +
  38.793 +    //! Check whether the mesh contains normal vectors
  38.794 +    bool HasNormals() const
  38.795 +        { return mNormals != 0 && mNumVertices > 0; }
  38.796 +
  38.797 +    //! Check whether the mesh contains tangent and bitangent vectors
  38.798 +    //! It is not possible that it contains tangents and no bitangents
  38.799 +    //! (or the other way round). The existence of one of them
  38.800 +    //! implies that the second is there, too.
  38.801 +    bool HasTangentsAndBitangents() const
  38.802 +        { return mTangents != 0 && mBitangents != 0 && mNumVertices > 0; }
  38.803 +
  38.804 +    //! Check whether the mesh contains a vertex color set
  38.805 +    //! \param pIndex Index of the vertex color set
  38.806 +    bool HasVertexColors( unsigned int pIndex) const {
  38.807 +        if (pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS) {
  38.808 +            return false;
  38.809 +        } else {
  38.810 +            return mColors[pIndex] != 0 && mNumVertices > 0;
  38.811 +        }
  38.812 +    }
  38.813 +
  38.814 +    //! Check whether the mesh contains a texture coordinate set
  38.815 +    //! \param pIndex Index of the texture coordinates set
  38.816 +    bool HasTextureCoords( unsigned int pIndex) const {
  38.817 +        if (pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
  38.818 +            return false;
  38.819 +        } else {
  38.820 +            return mTextureCoords[pIndex] != 0 && mNumVertices > 0;
  38.821 +        }
  38.822 +    }
  38.823 +
  38.824 +    //! Get the number of UV channels the mesh contains
  38.825 +    unsigned int GetNumUVChannels() const {
  38.826 +        unsigned int n( 0 );
  38.827 +        while (n < AI_MAX_NUMBER_OF_TEXTURECOORDS && mTextureCoords[n]) {
  38.828 +            ++n;
  38.829 +        }
  38.830 +
  38.831 +        return n;
  38.832 +    }
  38.833 +
  38.834 +    //! Get the number of vertex color channels the mesh contains
  38.835 +    unsigned int GetNumColorChannels() const {
  38.836 +        unsigned int n(0);
  38.837 +        while (n < AI_MAX_NUMBER_OF_COLOR_SETS && mColors[n]) {
  38.838 +            ++n;
  38.839 +        }
  38.840 +        return n;
  38.841 +    }
  38.842 +
  38.843 +    //! Check whether the mesh contains bones
  38.844 +    bool HasBones() const {
  38.845 +        return mBones != 0 && mNumBones > 0;
  38.846 +    }
  38.847 +
  38.848 +#endif // __cplusplus
  38.849 +};
  38.850 +
  38.851 +#ifdef __cplusplus
  38.852 +}
  38.853 +#endif //! extern "C"
  38.854 +#endif // AI_MESH_H_INC
  38.855 +
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/include/miniassimp/metadata.h	Mon Jan 28 18:19:26 2019 +0200
    39.3 @@ -0,0 +1,380 @@
    39.4 +/*
    39.5 +---------------------------------------------------------------------------
    39.6 +Open Asset Import Library (assimp)
    39.7 +---------------------------------------------------------------------------
    39.8 +
    39.9 +Copyright (c) 2006-2018, assimp team
   39.10 +
   39.11 +
   39.12 +
   39.13 +All rights reserved.
   39.14 +
   39.15 +Redistribution and use of this software in source and binary forms,
   39.16 +with or without modification, are permitted provided that the following
   39.17 +conditions are met:
   39.18 +
   39.19 +* Redistributions of source code must retain the above
   39.20 +  copyright notice, this list of conditions and the
   39.21 +  following disclaimer.
   39.22 +
   39.23 +* Redistributions in binary form must reproduce the above
   39.24 +  copyright notice, this list of conditions and the
   39.25 +  following disclaimer in the documentation and/or other
   39.26 +  materials provided with the distribution.
   39.27 +
   39.28 +* Neither the name of the assimp team, nor the names of its
   39.29 +  contributors may be used to endorse or promote products
   39.30 +  derived from this software without specific prior
   39.31 +  written permission of the assimp team.
   39.32 +
   39.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   39.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   39.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   39.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   39.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   39.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   39.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   39.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   39.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   39.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   39.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   39.44 +---------------------------------------------------------------------------
   39.45 +*/
   39.46 +
   39.47 +/** @file metadata.h
   39.48 + *  @brief Defines the data structures for holding node meta information.
   39.49 + */
   39.50 +#pragma once
   39.51 +#ifndef AI_METADATA_H_INC
   39.52 +#define AI_METADATA_H_INC
   39.53 +
   39.54 +#if defined(_MSC_VER) && (_MSC_VER <= 1500)
   39.55 +#  include "Compiler/pstdint.h"
   39.56 +#else
   39.57 +#  include <inttypes.h>
   39.58 +#endif
   39.59 +
   39.60 +// -------------------------------------------------------------------------------
   39.61 +/**
   39.62 +  * Enum used to distinguish data types
   39.63 +  */
   39.64 + // -------------------------------------------------------------------------------
   39.65 +typedef enum aiMetadataType {
   39.66 +    AI_BOOL       = 0,
   39.67 +    AI_INT32      = 1,
   39.68 +    AI_UINT64     = 2,
   39.69 +    AI_FLOAT      = 3,
   39.70 +    AI_DOUBLE     = 4,
   39.71 +    AI_AISTRING   = 5,
   39.72 +    AI_AIVECTOR3D = 6,
   39.73 +    AI_META_MAX   = 7,
   39.74 +
   39.75 +#ifndef SWIG
   39.76 +    FORCE_32BIT = INT_MAX
   39.77 +#endif
   39.78 +} aiMetadataType;
   39.79 +
   39.80 +// -------------------------------------------------------------------------------
   39.81 +/**
   39.82 +  * Metadata entry
   39.83 +  *
   39.84 +  * The type field uniquely identifies the underlying type of the data field
   39.85 +  */
   39.86 + // -------------------------------------------------------------------------------
   39.87 +struct aiMetadataEntry {
   39.88 +    aiMetadataType mType;
   39.89 +    void* mData;
   39.90 +};
   39.91 +
   39.92 +#ifdef __cplusplus
   39.93 +
   39.94 +#include <string>
   39.95 +
   39.96 +// -------------------------------------------------------------------------------
   39.97 +/**
   39.98 +  * Helper functions to get the aiType enum entry for a type
   39.99 +  */
  39.100 + // -------------------------------------------------------------------------------
  39.101 +
  39.102 +inline aiMetadataType GetAiType( bool )       { return AI_BOOL; }
  39.103 +inline aiMetadataType GetAiType( int32_t )    { return AI_INT32; }
  39.104 +inline aiMetadataType GetAiType( uint64_t )   { return AI_UINT64; }
  39.105 +inline aiMetadataType GetAiType( float )      { return AI_FLOAT; }
  39.106 +inline aiMetadataType GetAiType( double )     { return AI_DOUBLE; }
  39.107 +inline aiMetadataType GetAiType( const aiString & )   { return AI_AISTRING; }
  39.108 +inline aiMetadataType GetAiType( const aiVector3D & ) { return AI_AIVECTOR3D; }
  39.109 +
  39.110 +#endif // __cplusplus
  39.111 +
  39.112 +// -------------------------------------------------------------------------------
  39.113 +/**
  39.114 +  * Container for holding metadata.
  39.115 +  *
  39.116 +  * Metadata is a key-value store using string keys and values.
  39.117 +  */
  39.118 + // -------------------------------------------------------------------------------
  39.119 +struct aiMetadata {
  39.120 +    /** Length of the mKeys and mValues arrays, respectively */
  39.121 +    unsigned int mNumProperties;
  39.122 +
  39.123 +    /** Arrays of keys, may not be NULL. Entries in this array may not be NULL as well. */
  39.124 +    C_STRUCT aiString* mKeys;
  39.125 +
  39.126 +    /** Arrays of values, may not be NULL. Entries in this array may be NULL if the
  39.127 +      * corresponding property key has no assigned value. */
  39.128 +    C_STRUCT aiMetadataEntry* mValues;
  39.129 +
  39.130 +#ifdef __cplusplus
  39.131 +
  39.132 +    /** 
  39.133 +     *  @brief  The default constructor, set all members to zero by default.
  39.134 +     */
  39.135 +    aiMetadata() AI_NO_EXCEPT
  39.136 +    : mNumProperties(0)
  39.137 +    , mKeys(0)
  39.138 +    , mValues(0) {
  39.139 +        // empty
  39.140 +    }
  39.141 +
  39.142 +    aiMetadata( const aiMetadata &rhs )
  39.143 +    : mNumProperties( rhs.mNumProperties )
  39.144 +    , mKeys( 0 )
  39.145 +    , mValues( 0 ) {
  39.146 +        mKeys = new aiString[ mNumProperties ];
  39.147 +        for ( size_t i = 0; i < static_cast<size_t>( mNumProperties ); ++i ) {
  39.148 +            mKeys[ i ] = rhs.mKeys[ i ];
  39.149 +        }
  39.150 +        mValues = new aiMetadataEntry[ mNumProperties ];
  39.151 +        for ( size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i ) {
  39.152 +            mValues[ i ].mType = rhs.mValues[ i ].mType;
  39.153 +            switch ( rhs.mValues[ i ].mType ) {
  39.154 +            case AI_BOOL:
  39.155 +                mValues[ i ].mData = new bool;
  39.156 +                ::memcpy( mValues[ i ].mData, rhs.mValues[ i ].mData, sizeof(bool) );
  39.157 +                break;
  39.158 +            case AI_INT32: {
  39.159 +                int32_t v;
  39.160 +                ::memcpy( &v, rhs.mValues[ i ].mData, sizeof( int32_t ) );
  39.161 +                mValues[ i ].mData = new int32_t( v );
  39.162 +                }
  39.163 +                break;
  39.164 +            case AI_UINT64: {
  39.165 +                    uint64_t v;
  39.166 +                    ::memcpy( &v, rhs.mValues[ i ].mData, sizeof( uint64_t ) );
  39.167 +                    mValues[ i ].mData = new  uint64_t( v );
  39.168 +                }
  39.169 +                break;
  39.170 +            case AI_FLOAT: {
  39.171 +                    float v;
  39.172 +                    ::memcpy( &v, rhs.mValues[ i ].mData, sizeof( float ) );
  39.173 +                    mValues[ i ].mData = new float( v );
  39.174 +                }
  39.175 +                break;
  39.176 +            case AI_DOUBLE: {
  39.177 +                    double v;
  39.178 +                    ::memcpy( &v, rhs.mValues[ i ].mData, sizeof( double ) );
  39.179 +                    mValues[ i ].mData = new double( v );
  39.180 +                }
  39.181 +                break;
  39.182 +            case AI_AISTRING: {
  39.183 +                    aiString v;
  39.184 +                    rhs.Get<aiString>( mKeys[ i ], v );
  39.185 +                    mValues[ i ].mData = new aiString( v );
  39.186 +                }
  39.187 +                break;
  39.188 +            case AI_AIVECTOR3D: {
  39.189 +                    aiVector3D v;
  39.190 +                    rhs.Get<aiVector3D>( mKeys[ i ], v );
  39.191 +                    mValues[ i ].mData = new aiVector3D( v );
  39.192 +                }
  39.193 +                break;
  39.194 +#ifndef SWIG
  39.195 +            case FORCE_32BIT:
  39.196 +#endif
  39.197 +            default:
  39.198 +                break;
  39.199 +            }
  39.200 +
  39.201 +        }
  39.202 +    }
  39.203 +
  39.204 +    /** 
  39.205 +     *  @brief The destructor.
  39.206 +     */
  39.207 +    ~aiMetadata() {
  39.208 +        delete [] mKeys;
  39.209 +        mKeys = 0;
  39.210 +        if (mValues) {
  39.211 +            // Delete each metadata entry
  39.212 +            for (unsigned i=0; i<mNumProperties; ++i) {
  39.213 +                void* data = mValues[i].mData;
  39.214 +                switch (mValues[i].mType) {
  39.215 +                case AI_BOOL:
  39.216 +                    delete static_cast< bool* >( data );
  39.217 +                    break;
  39.218 +                case AI_INT32:
  39.219 +                    delete static_cast< int32_t* >( data );
  39.220 +                    break;
  39.221 +                case AI_UINT64:
  39.222 +                    delete static_cast< uint64_t* >( data );
  39.223 +                    break;
  39.224 +                case AI_FLOAT:
  39.225 +                    delete static_cast< float* >( data );
  39.226 +                    break;
  39.227 +                case AI_DOUBLE:
  39.228 +                    delete static_cast< double* >( data );
  39.229 +                    break;
  39.230 +                case AI_AISTRING:
  39.231 +                    delete static_cast< aiString* >( data );
  39.232 +                    break;
  39.233 +                case AI_AIVECTOR3D:
  39.234 +                    delete static_cast< aiVector3D* >( data );
  39.235 +                    break;
  39.236 +#ifndef SWIG
  39.237 +                case FORCE_32BIT:
  39.238 +#endif
  39.239 +                default:
  39.240 +                    break;
  39.241 +                }
  39.242 +            }
  39.243 +
  39.244 +            // Delete the metadata array
  39.245 +            delete [] mValues;
  39.246 +            mValues = 0;
  39.247 +        }
  39.248 +    }
  39.249 +
  39.250 +    /**
  39.251 +     *  @brief Allocates property fields + keys.
  39.252 +     *  @param  numProperties   Number of requested properties.
  39.253 +     */
  39.254 +    static inline
  39.255 +    aiMetadata *Alloc( unsigned int numProperties ) {
  39.256 +        if ( 0 == numProperties ) {
  39.257 +            return 0;
  39.258 +        }
  39.259 +
  39.260 +        aiMetadata *data = new aiMetadata;
  39.261 +        data->mNumProperties = numProperties;
  39.262 +        data->mKeys = new aiString[ data->mNumProperties ]();
  39.263 +        data->mValues = new aiMetadataEntry[ data->mNumProperties ]();
  39.264 +
  39.265 +        return data;
  39.266 +    }
  39.267 +
  39.268 +    /**
  39.269 +     *  @brief Deallocates property fields + keys.
  39.270 +     */
  39.271 +    static inline
  39.272 +    void Dealloc( aiMetadata *metadata ) {
  39.273 +        delete metadata;
  39.274 +    }
  39.275 +
  39.276 +	template<typename T>
  39.277 +	inline
  39.278 +    void Add(const std::string& key, const T& value) {
  39.279 +		aiString* new_keys = new aiString[mNumProperties + 1];
  39.280 +		aiMetadataEntry* new_values = new aiMetadataEntry[mNumProperties + 1];
  39.281 +
  39.282 +		for(unsigned int i = 0; i < mNumProperties; ++i)
  39.283 +		{
  39.284 +			new_keys[i] = mKeys[i];
  39.285 +			new_values[i] = mValues[i];
  39.286 +		}
  39.287 +
  39.288 +		delete mKeys;
  39.289 +		delete mValues;
  39.290 +
  39.291 +		mKeys = new_keys;
  39.292 +		mValues = new_values;
  39.293 +
  39.294 +		mNumProperties++;
  39.295 +
  39.296 +		Set(mNumProperties - 1, key, value);
  39.297 +	}
  39.298 +
  39.299 +    template<typename T>
  39.300 +    inline 
  39.301 +    bool Set( unsigned index, const std::string& key, const T& value ) {
  39.302 +        // In range assertion
  39.303 +        if ( index >= mNumProperties ) {
  39.304 +            return false;
  39.305 +        }
  39.306 +
  39.307 +        // Ensure that we have a valid key.
  39.308 +        if ( key.empty() ) {
  39.309 +            return false;
  39.310 +        }
  39.311 +
  39.312 +        // Set metadata key
  39.313 +        mKeys[index] = key;
  39.314 +
  39.315 +        // Set metadata type
  39.316 +        mValues[index].mType = GetAiType(value);
  39.317 +        // Copy the given value to the dynamic storage
  39.318 +        mValues[index].mData = new T(value);
  39.319 +
  39.320 +        return true;
  39.321 +    }
  39.322 +
  39.323 +    template<typename T>
  39.324 +    inline 
  39.325 +    bool Get( unsigned index, T& value ) const {
  39.326 +        // In range assertion
  39.327 +        if ( index >= mNumProperties ) {
  39.328 +            return false;
  39.329 +        }
  39.330 +
  39.331 +        // Return false if the output data type does
  39.332 +        // not match the found value's data type
  39.333 +        if ( GetAiType( value ) != mValues[ index ].mType ) {
  39.334 +            return false;
  39.335 +        }
  39.336 +
  39.337 +        // Otherwise, output the found value and
  39.338 +        // return true
  39.339 +        value = *static_cast<T*>(mValues[index].mData);
  39.340 +
  39.341 +        return true;
  39.342 +    }
  39.343 +
  39.344 +    template<typename T>
  39.345 +    inline 
  39.346 +    bool Get( const aiString& key, T& value ) const {
  39.347 +        // Search for the given key
  39.348 +        for ( unsigned int i = 0; i < mNumProperties; ++i ) {
  39.349 +            if ( mKeys[ i ] == key ) {
  39.350 +                return Get( i, value );
  39.351 +            }
  39.352 +        }
  39.353 +        return false;
  39.354 +    }
  39.355 +
  39.356 +    template<typename T>
  39.357 +    inline
  39.358 +    bool Get( const std::string& key, T& value ) const {
  39.359 +        return Get(aiString(key), value);
  39.360 +    }
  39.361 +
  39.362 +	/// Return metadata entry for analyzing it by user.
  39.363 +	/// \param [in] pIndex - index of the entry.
  39.364 +	/// \param [out] pKey - pointer to the key value.
  39.365 +	/// \param [out] pEntry - pointer to the entry: type and value.
  39.366 +	/// \return false - if pIndex is out of range, else - true.
  39.367 +	inline
  39.368 +    bool Get(size_t index, const aiString*& key, const aiMetadataEntry*& entry) const {
  39.369 +        if ( index >= mNumProperties ) {
  39.370 +            return false;
  39.371 +        }
  39.372 +
  39.373 +		key = &mKeys[index];
  39.374 +		entry = &mValues[index];
  39.375 +
  39.376 +		return true;
  39.377 +	}
  39.378 +
  39.379 +#endif // __cplusplus
  39.380 +
  39.381 +};
  39.382 +
  39.383 +#endif // AI_METADATA_H_INC
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/include/miniassimp/postprocess.h	Mon Jan 28 18:19:26 2019 +0200
    40.3 @@ -0,0 +1,679 @@
    40.4 +/*
    40.5 +Open Asset Import Library (assimp)
    40.6 +----------------------------------------------------------------------
    40.7 +
    40.8 +Copyright (c) 2006-2018, assimp team
    40.9 +
   40.10 +
   40.11 +All rights reserved.
   40.12 +
   40.13 +Redistribution and use of this software in source and binary forms,
   40.14 +with or without modification, are permitted provided that the
   40.15 +following conditions are met:
   40.16 +
   40.17 +* Redistributions of source code must retain the above
   40.18 +  copyright notice, this list of conditions and the
   40.19 +  following disclaimer.
   40.20 +
   40.21 +* Redistributions in binary form must reproduce the above
   40.22 +  copyright notice, this list of conditions and the
   40.23 +  following disclaimer in the documentation and/or other
   40.24 +  materials provided with the distribution.
   40.25 +
   40.26 +* Neither the name of the assimp team, nor the names of its
   40.27 +  contributors may be used to endorse or promote products
   40.28 +  derived from this software without specific prior
   40.29 +  written permission of the assimp team.
   40.30 +
   40.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   40.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   40.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   40.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   40.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   40.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   40.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   40.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   40.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   40.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   40.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   40.42 +
   40.43 +----------------------------------------------------------------------
   40.44 +*/
   40.45 +
   40.46 +/** @file postprocess.h
   40.47 + *  @brief Definitions for import post processing steps
   40.48 + */
   40.49 +#pragma once
   40.50 +#ifndef AI_POSTPROCESS_H_INC
   40.51 +#define AI_POSTPROCESS_H_INC
   40.52 +
   40.53 +#include "types.h"
   40.54 +
   40.55 +#ifdef __cplusplus
   40.56 +extern "C" {
   40.57 +#endif
   40.58 +
   40.59 +// -----------------------------------------------------------------------------------
   40.60 +/** @enum  aiPostProcessSteps
   40.61 + *  @brief Defines the flags for all possible post processing steps.
   40.62 + *
   40.63 + *  @note Some steps are influenced by properties set on the Assimp::Importer itself
   40.64 + *
   40.65 + *  @see Assimp::Importer::ReadFile()
   40.66 + *  @see Assimp::Importer::SetPropertyInteger()
   40.67 + *  @see aiImportFile
   40.68 + *  @see aiImportFileEx
   40.69 + */
   40.70 +// -----------------------------------------------------------------------------------
   40.71 +enum aiPostProcessSteps
   40.72 +{
   40.73 +
   40.74 +    // -------------------------------------------------------------------------
   40.75 +    /** <hr>Calculates the tangents and bitangents for the imported meshes.
   40.76 +     *
   40.77 +     * Does nothing if a mesh does not have normals. You might want this post
   40.78 +     * processing step to be executed if you plan to use tangent space calculations
   40.79 +     * such as normal mapping  applied to the meshes. There's an importer property,
   40.80 +     * <tt>#AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE</tt>, which allows you to specify
   40.81 +     * a maximum smoothing angle for the algorithm. However, usually you'll
   40.82 +     * want to leave it at the default value.
   40.83 +     */
   40.84 +    aiProcess_CalcTangentSpace = 0x1,
   40.85 +
   40.86 +    // -------------------------------------------------------------------------
   40.87 +    /** <hr>Identifies and joins identical vertex data sets within all
   40.88 +     *  imported meshes.
   40.89 +     *
   40.90 +     * After this step is run, each mesh contains unique vertices,
   40.91 +     * so a vertex may be used by multiple faces. You usually want
   40.92 +     * to use this post processing step. If your application deals with
   40.93 +     * indexed geometry, this step is compulsory or you'll just waste rendering
   40.94 +     * time. <b>If this flag is not specified</b>, no vertices are referenced by
   40.95 +     * more than one face and <b>no index buffer is required</b> for rendering.
   40.96 +     */
   40.97 +    aiProcess_JoinIdenticalVertices = 0x2,
   40.98 +
   40.99 +    // -------------------------------------------------------------------------
  40.100 +    /** <hr>Converts all the imported data to a left-handed coordinate space.
  40.101 +     *
  40.102 +     * By default the data is returned in a right-handed coordinate space (which
  40.103 +     * OpenGL prefers). In this space, +X points to the right,
  40.104 +     * +Z points towards the viewer, and +Y points upwards. In the DirectX
  40.105 +     * coordinate space +X points to the right, +Y points upwards, and +Z points
  40.106 +     * away from the viewer.
  40.107 +     *
  40.108 +     * You'll probably want to consider this flag if you use Direct3D for
  40.109 +     * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this
  40.110 +     * setting and bundles all conversions typically required for D3D-based
  40.111 +     * applications.
  40.112 +     */
  40.113 +    aiProcess_MakeLeftHanded = 0x4,
  40.114 +
  40.115 +    // -------------------------------------------------------------------------
  40.116 +    /** <hr>Triangulates all faces of all meshes.
  40.117 +     *
  40.118 +     * By default the imported mesh data might contain faces with more than 3
  40.119 +     * indices. For rendering you'll usually want all faces to be triangles.
  40.120 +     * This post processing step splits up faces with more than 3 indices into
  40.121 +     * triangles. Line and point primitives are *not* modified! If you want
  40.122 +     * 'triangles only' with no other kinds of primitives, try the following
  40.123 +     * solution:
  40.124 +     * <ul>
  40.125 +     * <li>Specify both #aiProcess_Triangulate and #aiProcess_SortByPType </li>
  40.126 +     * <li>Ignore all point and line meshes when you process assimp's output</li>
  40.127 +     * </ul>
  40.128 +     */
  40.129 +    aiProcess_Triangulate = 0x8,
  40.130 +
  40.131 +    // -------------------------------------------------------------------------
  40.132 +    /** <hr>Removes some parts of the data structure (animations, materials,
  40.133 +     *  light sources, cameras, textures, vertex components).
  40.134 +     *
  40.135 +     * The  components to be removed are specified in a separate
  40.136 +     * importer property, <tt>#AI_CONFIG_PP_RVC_FLAGS</tt>. This is quite useful
  40.137 +     * if you don't need all parts of the output structure. Vertex colors
  40.138 +     * are rarely used today for example... Calling this step to remove unneeded
  40.139 +     * data from the pipeline as early as possible results in increased
  40.140 +     * performance and a more optimized output data structure.
  40.141 +     * This step is also useful if you want to force Assimp to recompute
  40.142 +     * normals or tangents. The corresponding steps don't recompute them if
  40.143 +     * they're already there (loaded from the source asset). By using this
  40.144 +     * step you can make sure they are NOT there.
  40.145 +     *
  40.146 +     * This flag is a poor one, mainly because its purpose is usually
  40.147 +     * misunderstood. Consider the following case: a 3D model has been exported
  40.148 +     * from a CAD app, and it has per-face vertex colors. Vertex positions can't be
  40.149 +     * shared, thus the #aiProcess_JoinIdenticalVertices step fails to
  40.150 +     * optimize the data because of these nasty little vertex colors.
  40.151 +     * Most apps don't even process them, so it's all for nothing. By using
  40.152 +     * this step, unneeded components are excluded as early as possible
  40.153 +     * thus opening more room for internal optimizations.
  40.154 +     */
  40.155 +    aiProcess_RemoveComponent = 0x10,
  40.156 +
  40.157 +    // -------------------------------------------------------------------------
  40.158 +    /** <hr>Generates normals for all faces of all meshes.
  40.159 +     *
  40.160 +     * This is ignored if normals are already there at the time this flag
  40.161 +     * is evaluated. Model importers try to load them from the source file, so
  40.162 +     * they're usually already there. Face normals are shared between all points
  40.163 +     * of a single face, so a single point can have multiple normals, which
  40.164 +     * forces the library to duplicate vertices in some cases.
  40.165 +     * #aiProcess_JoinIdenticalVertices is *senseless* then.
  40.166 +     *
  40.167 +     * This flag may not be specified together with #aiProcess_GenSmoothNormals.
  40.168 +     */
  40.169 +    aiProcess_GenNormals = 0x20,
  40.170 +
  40.171 +    // -------------------------------------------------------------------------
  40.172 +    /** <hr>Generates smooth normals for all vertices in the mesh.
  40.173 +    *
  40.174 +    * This is ignored if normals are already there at the time this flag
  40.175 +    * is evaluated. Model importers try to load them from the source file, so
  40.176 +    * they're usually already there.
  40.177 +    *
  40.178 +    * This flag may not be specified together with
  40.179 +    * #aiProcess_GenNormals. There's a importer property,
  40.180 +    * <tt>#AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE</tt> which allows you to specify
  40.181 +    * an angle maximum for the normal smoothing algorithm. Normals exceeding
  40.182 +    * this limit are not smoothed, resulting in a 'hard' seam between two faces.
  40.183 +    * Using a decent angle here (e.g. 80 degrees) results in very good visual
  40.184 +    * appearance.
  40.185 +    */
  40.186 +    aiProcess_GenSmoothNormals = 0x40,
  40.187 +
  40.188 +    // -------------------------------------------------------------------------
  40.189 +    /** <hr>Splits large meshes into smaller sub-meshes.
  40.190 +    *
  40.191 +    * This is quite useful for real-time rendering, where the number of triangles
  40.192 +    * which can be maximally processed in a single draw-call is limited
  40.193 +    * by the video driver/hardware. The maximum vertex buffer is usually limited
  40.194 +    * too. Both requirements can be met with this step: you may specify both a
  40.195 +    * triangle and vertex limit for a single mesh.
  40.196 +    *
  40.197 +    * The split limits can (and should!) be set through the
  40.198 +    * <tt>#AI_CONFIG_PP_SLM_VERTEX_LIMIT</tt> and <tt>#AI_CONFIG_PP_SLM_TRIANGLE_LIMIT</tt>
  40.199 +    * importer properties. The default values are <tt>#AI_SLM_DEFAULT_MAX_VERTICES</tt> and
  40.200 +    * <tt>#AI_SLM_DEFAULT_MAX_TRIANGLES</tt>.
  40.201 +    *
  40.202 +    * Note that splitting is generally a time-consuming task, but only if there's
  40.203 +    * something to split. The use of this step is recommended for most users.
  40.204 +    */
  40.205 +    aiProcess_SplitLargeMeshes = 0x80,
  40.206 +
  40.207 +    // -------------------------------------------------------------------------
  40.208 +    /** <hr>Removes the node graph and pre-transforms all vertices with
  40.209 +    * the local transformation matrices of their nodes.
  40.210 +    *
  40.211 +    * The output scene still contains nodes, however there is only a
  40.212 +    * root node with children, each one referencing only one mesh,
  40.213 +    * and each mesh referencing one material. For rendering, you can
  40.214 +    * simply render all meshes in order - you don't need to pay
  40.215 +    * attention to local transformations and the node hierarchy.
  40.216 +    * Animations are removed during this step.
  40.217 +    * This step is intended for applications without a scenegraph.
  40.218 +    * The step CAN cause some problems: if e.g. a mesh of the asset
  40.219 +    * contains normals and another, using the same material index, does not,
  40.220 +    * they will be brought together, but the first meshes's part of
  40.221 +    * the normal list is zeroed. However, these artifacts are rare.
  40.222 +    * @note The <tt>#AI_CONFIG_PP_PTV_NORMALIZE</tt> configuration property
  40.223 +    * can be set to normalize the scene's spatial dimension to the -1...1
  40.224 +    * range.
  40.225 +    */
  40.226 +    aiProcess_PreTransformVertices = 0x100,
  40.227 +
  40.228 +    // -------------------------------------------------------------------------
  40.229 +    /** <hr>Limits the number of bones simultaneously affecting a single vertex
  40.230 +    *  to a maximum value.
  40.231 +    *
  40.232 +    * If any vertex is affected by more than the maximum number of bones, the least
  40.233 +    * important vertex weights are removed and the remaining vertex weights are
  40.234 +    * renormalized so that the weights still sum up to 1.
  40.235 +    * The default bone weight limit is 4 (defined as <tt>#AI_LMW_MAX_WEIGHTS</tt> in
  40.236 +    * config.h), but you can use the <tt>#AI_CONFIG_PP_LBW_MAX_WEIGHTS</tt> importer
  40.237 +    * property to supply your own limit to the post processing step.
  40.238 +    *
  40.239 +    * If you intend to perform the skinning in hardware, this post processing
  40.240 +    * step might be of interest to you.
  40.241 +    */
  40.242 +    aiProcess_LimitBoneWeights = 0x200,
  40.243 +
  40.244 +    // -------------------------------------------------------------------------
  40.245 +    /** <hr>Validates the imported scene data structure.
  40.246 +     * This makes sure that all indices are valid, all animations and
  40.247 +     * bones are linked correctly, all material references are correct .. etc.
  40.248 +     *
  40.249 +     * It is recommended that you capture Assimp's log output if you use this flag,
  40.250 +     * so you can easily find out what's wrong if a file fails the
  40.251 +     * validation. The validator is quite strict and will find *all*
  40.252 +     * inconsistencies in the data structure... It is recommended that plugin
  40.253 +     * developers use it to debug their loaders. There are two types of
  40.254 +     * validation failures:
  40.255 +     * <ul>
  40.256 +     * <li>Error: There's something wrong with the imported data. Further
  40.257 +     *   postprocessing is not possible and the data is not usable at all.
  40.258 +     *   The import fails. #Importer::GetErrorString() or #aiGetErrorString()
  40.259 +     *   carry the error message around.</li>
  40.260 +     * <li>Warning: There are some minor issues (e.g. 1000000 animation
  40.261 +     *   keyframes with the same time), but further postprocessing and use
  40.262 +     *   of the data structure is still safe. Warning details are written
  40.263 +     *   to the log file, <tt>#AI_SCENE_FLAGS_VALIDATION_WARNING</tt> is set
  40.264 +     *   in #aiScene::mFlags</li>
  40.265 +     * </ul>
  40.266 +     *
  40.267 +     * This post-processing step is not time-consuming. Its use is not
  40.268 +     * compulsory, but recommended.
  40.269 +    */
  40.270 +    aiProcess_ValidateDataStructure = 0x400,
  40.271 +
  40.272 +    // -------------------------------------------------------------------------
  40.273 +    /** <hr>Reorders triangles for better vertex cache locality.
  40.274 +     *
  40.275 +     * The step tries to improve the ACMR (average post-transform vertex cache
  40.276 +     * miss ratio) for all meshes. The implementation runs in O(n) and is
  40.277 +     * roughly based on the 'tipsify' algorithm (see <a href="
  40.278 +     * http://www.cs.princeton.edu/gfx/pubs/Sander_2007_%3ETR/tipsy.pdf">this
  40.279 +     * paper</a>).
  40.280 +     *
  40.281 +     * If you intend to render huge models in hardware, this step might
  40.282 +     * be of interest to you. The <tt>#AI_CONFIG_PP_ICL_PTCACHE_SIZE</tt>
  40.283 +     * importer property can be used to fine-tune the cache optimization.
  40.284 +     */
  40.285 +    aiProcess_ImproveCacheLocality = 0x800,
  40.286 +
  40.287 +    // -------------------------------------------------------------------------
  40.288 +    /** <hr>Searches for redundant/unreferenced materials and removes them.
  40.289 +     *
  40.290 +     * This is especially useful in combination with the
  40.291 +     * #aiProcess_PreTransformVertices and #aiProcess_OptimizeMeshes flags.
  40.292 +     * Both join small meshes with equal characteristics, but they can't do
  40.293 +     * their work if two meshes have different materials. Because several
  40.294 +     * material settings are lost during Assimp's import filters,
  40.295 +     * (and because many exporters don't check for redundant materials), huge
  40.296 +     * models often have materials which are are defined several times with
  40.297 +     * exactly the same settings.
  40.298 +     *
  40.299 +     * Several material settings not contributing to the final appearance of
  40.300 +     * a surface are ignored in all comparisons (e.g. the material name).
  40.301 +     * So, if you're passing additional information through the
  40.302 +     * content pipeline (probably using *magic* material names), don't
  40.303 +     * specify this flag. Alternatively take a look at the
  40.304 +     * <tt>#AI_CONFIG_PP_RRM_EXCLUDE_LIST</tt> importer property.
  40.305 +     */
  40.306 +    aiProcess_RemoveRedundantMaterials = 0x1000,
  40.307 +
  40.308 +    // -------------------------------------------------------------------------
  40.309 +    /** <hr>This step tries to determine which meshes have normal vectors
  40.310 +     * that are facing inwards and inverts them.
  40.311 +     *
  40.312 +     * The algorithm is simple but effective:
  40.313 +     * the bounding box of all vertices + their normals is compared against
  40.314 +     * the volume of the bounding box of all vertices without their normals.
  40.315 +     * This works well for most objects, problems might occur with planar
  40.316 +     * surfaces. However, the step tries to filter such cases.
  40.317 +     * The step inverts all in-facing normals. Generally it is recommended
  40.318 +     * to enable this step, although the result is not always correct.
  40.319 +    */
  40.320 +    aiProcess_FixInfacingNormals = 0x2000,
  40.321 +
  40.322 +    // -------------------------------------------------------------------------
  40.323 +    /** <hr>This step splits meshes with more than one primitive type in
  40.324 +     *  homogeneous sub-meshes.
  40.325 +     *
  40.326 +     *  The step is executed after the triangulation step. After the step
  40.327 +     *  returns, just one bit is set in aiMesh::mPrimitiveTypes. This is
  40.328 +     *  especially useful for real-time rendering where point and line
  40.329 +     *  primitives are often ignored or rendered separately.
  40.330 +     *  You can use the <tt>#AI_CONFIG_PP_SBP_REMOVE</tt> importer property to
  40.331 +     *  specify which primitive types you need. This can be used to easily
  40.332 +     *  exclude lines and points, which are rarely used, from the import.
  40.333 +    */
  40.334 +    aiProcess_SortByPType = 0x8000,
  40.335 +
  40.336 +    // -------------------------------------------------------------------------
  40.337 +    /** <hr>This step searches all meshes for degenerate primitives and
  40.338 +     *  converts them to proper lines or points.
  40.339 +     *
  40.340 +     * A face is 'degenerate' if one or more of its points are identical.
  40.341 +     * To have the degenerate stuff not only detected and collapsed but
  40.342 +     * removed, try one of the following procedures:
  40.343 +     * <br><b>1.</b> (if you support lines and points for rendering but don't
  40.344 +     *    want the degenerates)<br>
  40.345 +     * <ul>
  40.346 +     *   <li>Specify the #aiProcess_FindDegenerates flag.
  40.347 +     *   </li>
  40.348 +     *   <li>Set the <tt>#AI_CONFIG_PP_FD_REMOVE</tt> importer property to
  40.349 +     *       1. This will cause the step to remove degenerate triangles from the
  40.350 +     *       import as soon as they're detected. They won't pass any further
  40.351 +     *       pipeline steps.
  40.352 +     *   </li>
  40.353 +     * </ul>
  40.354 +     * <br><b>2.</b>(if you don't support lines and points at all)<br>
  40.355 +     * <ul>
  40.356 +     *   <li>Specify the #aiProcess_FindDegenerates flag.
  40.357 +     *   </li>
  40.358 +     *   <li>Specify the #aiProcess_SortByPType flag. This moves line and
  40.359 +     *     point primitives to separate meshes.
  40.360 +     *   </li>
  40.361 +     *   <li>Set the <tt>#AI_CONFIG_PP_SBP_REMOVE</tt> importer property to
  40.362 +     *       @code aiPrimitiveType_POINTS | aiPrimitiveType_LINES
  40.363 +     *       @endcode to cause SortByPType to reject point
  40.364 +     *       and line meshes from the scene.
  40.365 +     *   </li>
  40.366 +     * </ul>
  40.367 +     *
  40.368 +     * This step also removes very small triangles with a surface area smaller
  40.369 +     * than 10^-6. If you rely on having these small triangles, or notice holes
  40.370 +     * in your model, set the property <tt>#AI_CONFIG_PP_FD_CHECKAREA</tt> to
  40.371 +     * false.
  40.372 +     * @note Degenerate polygons are not necessarily evil and that's why
  40.373 +     * they're not removed by default. There are several file formats which
  40.374 +     * don't support lines or points, and some exporters bypass the
  40.375 +     * format specification and write them as degenerate triangles instead.
  40.376 +    */
  40.377 +    aiProcess_FindDegenerates = 0x10000,
  40.378 +
  40.379 +    // -------------------------------------------------------------------------
  40.380 +    /** <hr>This step searches all meshes for invalid data, such as zeroed
  40.381 +     *  normal vectors or invalid UV coords and removes/fixes them. This is
  40.382 +     *  intended to get rid of some common exporter errors.
  40.383 +     *
  40.384 +     * This is especially useful for normals. If they are invalid, and
  40.385 +     * the step recognizes this, they will be removed and can later
  40.386 +     * be recomputed, i.e. by the #aiProcess_GenSmoothNormals flag.<br>
  40.387 +     * The step will also remove meshes that are infinitely small and reduce
  40.388 +     * animation tracks consisting of hundreds if redundant keys to a single
  40.389 +     * key. The <tt>AI_CONFIG_PP_FID_ANIM_ACCURACY</tt> config property decides
  40.390 +     * the accuracy of the check for duplicate animation tracks.
  40.391 +    */
  40.392 +    aiProcess_FindInvalidData = 0x20000,
  40.393 +
  40.394 +    // -------------------------------------------------------------------------
  40.395 +    /** <hr>This step converts non-UV mappings (such as spherical or
  40.396 +     *  cylindrical mapping) to proper texture coordinate channels.
  40.397 +     *
  40.398 +     * Most applications will support UV mapping only, so you will
  40.399 +     * probably want to specify this step in every case. Note that Assimp is not
  40.400 +     * always able to match the original mapping implementation of the
  40.401 +     * 3D app which produced a model perfectly. It's always better to let the
  40.402 +     * modelling app compute the UV channels - 3ds max, Maya, Blender,
  40.403 +     * LightWave, and Modo do this for example.
  40.404 +     *
  40.405 +     * @note If this step is not requested, you'll need to process the
  40.406 +     * <tt>#AI_MATKEY_MAPPING</tt> material property in order to display all assets
  40.407 +     * properly.
  40.408 +     */
  40.409 +    aiProcess_GenUVCoords = 0x40000,
  40.410 +
  40.411 +    // -------------------------------------------------------------------------
  40.412 +    /** <hr>This step applies per-texture UV transformations and bakes
  40.413 +     *  them into stand-alone vtexture coordinate channels.
  40.414 +     *
  40.415 +     * UV transformations are specified per-texture - see the
  40.416 +     * <tt>#AI_MATKEY_UVTRANSFORM</tt> material key for more information.
  40.417 +     * This step processes all textures with
  40.418 +     * transformed input UV coordinates and generates a new (pre-transformed) UV channel
  40.419 +     * which replaces the old channel. Most applications won't support UV
  40.420 +     * transformations, so you will probably want to specify this step.
  40.421 +     *
  40.422 +     * @note UV transformations are usually implemented in real-time apps by
  40.423 +     * transforming texture coordinates at vertex shader stage with a 3x3
  40.424 +     * (homogenous) transformation matrix.
  40.425 +    */
  40.426 +    aiProcess_TransformUVCoords = 0x80000,
  40.427 +
  40.428 +    // -------------------------------------------------------------------------
  40.429 +    /** <hr>This step searches for duplicate meshes and replaces them
  40.430 +     *  with references to the first mesh.
  40.431 +     *
  40.432 +     *  This step takes a while, so don't use it if speed is a concern.
  40.433 +     *  Its main purpose is to workaround the fact that many export
  40.434 +     *  file formats don't support instanced meshes, so exporters need to
  40.435 +     *  duplicate meshes. This step removes the duplicates again. Please
  40.436 +     *  note that Assimp does not currently support per-node material
  40.437 +     *  assignment to meshes, which means that identical meshes with
  40.438 +     *  different materials are currently *not* joined, although this is
  40.439 +     *  planned for future versions.
  40.440 +     */
  40.441 +    aiProcess_FindInstances = 0x100000,
  40.442 +
  40.443 +    // -------------------------------------------------------------------------
  40.444 +    /** <hr>A postprocessing step to reduce the number of meshes.
  40.445 +     *
  40.446 +     *  This will, in fact, reduce the number of draw calls.
  40.447 +     *
  40.448 +     *  This is a very effective optimization and is recommended to be used
  40.449 +     *  together with #aiProcess_OptimizeGraph, if possible. The flag is fully
  40.450 +     *  compatible with both #aiProcess_SplitLargeMeshes and #aiProcess_SortByPType.
  40.451 +    */
  40.452 +    aiProcess_OptimizeMeshes  = 0x200000,
  40.453 +
  40.454 +
  40.455 +    // -------------------------------------------------------------------------
  40.456 +    /** <hr>A postprocessing step to optimize the scene hierarchy.
  40.457 +     *
  40.458 +     *  Nodes without animations, bones, lights or cameras assigned are
  40.459 +     *  collapsed and joined.
  40.460 +     *
  40.461 +     *  Node names can be lost during this step. If you use special 'tag nodes'
  40.462 +     *  to pass additional information through your content pipeline, use the
  40.463 +     *  <tt>#AI_CONFIG_PP_OG_EXCLUDE_LIST</tt> importer property to specify a
  40.464 +     *  list of node names you want to be kept. Nodes matching one of the names
  40.465 +     *  in this list won't be touched or modified.
  40.466 +     *
  40.467 +     *  Use this flag with caution. Most simple files will be collapsed to a
  40.468 +     *  single node, so complex hierarchies are usually completely lost. This is not
  40.469 +     *  useful for editor environments, but probably a very effective
  40.470 +     *  optimization if you just want to get the model data, convert it to your
  40.471 +     *  own format, and render it as fast as possible.
  40.472 +     *
  40.473 +     *  This flag is designed to be used with #aiProcess_OptimizeMeshes for best
  40.474 +     *  results.
  40.475 +     *
  40.476 +     *  @note 'Crappy' scenes with thousands of extremely small meshes packed
  40.477 +     *  in deeply nested nodes exist for almost all file formats.
  40.478 +     *  #aiProcess_OptimizeMeshes in combination with #aiProcess_OptimizeGraph
  40.479 +     *  usually fixes them all and makes them renderable.
  40.480 +    */
  40.481 +    aiProcess_OptimizeGraph  = 0x400000,
  40.482 +
  40.483 +    // -------------------------------------------------------------------------
  40.484 +    /** <hr>This step flips all UV coordinates along the y-axis and adjusts
  40.485 +     * material settings and bitangents accordingly.
  40.486 +     *
  40.487 +     * <b>Output UV coordinate system:</b>
  40.488 +     * @code
  40.489 +     * 0y|0y ---------- 1x|0y
  40.490 +     * |                 |
  40.491 +     * |                 |
  40.492 +     * |                 |
  40.493 +     * 0x|1y ---------- 1x|1y
  40.494 +     * @endcode
  40.495 +     *
  40.496 +     * You'll probably want to consider this flag if you use Direct3D for
  40.497 +     * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this
  40.498 +     * setting and bundles all conversions typically required for D3D-based
  40.499 +     * applications.
  40.500 +    */
  40.501 +    aiProcess_FlipUVs = 0x800000,
  40.502 +
  40.503 +    // -------------------------------------------------------------------------
  40.504 +    /** <hr>This step adjusts the output face winding order to be CW.
  40.505 +     *
  40.506 +     * The default face winding order is counter clockwise (CCW).
  40.507 +     *
  40.508 +     * <b>Output face order:</b>
  40.509 +     * @code
  40.510 +     *       x2
  40.511 +     *
  40.512 +     *                         x0
  40.513 +     *  x1
  40.514 +     * @endcode
  40.515 +    */
  40.516 +    aiProcess_FlipWindingOrder  = 0x1000000,
  40.517 +
  40.518 +    // -------------------------------------------------------------------------
  40.519 +    /** <hr>This step splits meshes with many bones into sub-meshes so that each
  40.520 +     * su-bmesh has fewer or as many bones as a given limit.
  40.521 +    */
  40.522 +    aiProcess_SplitByBoneCount  = 0x2000000,
  40.523 +
  40.524 +    // -------------------------------------------------------------------------
  40.525 +    /** <hr>This step removes bones losslessly or according to some threshold.
  40.526 +     *
  40.527 +     *  In some cases (i.e. formats that require it) exporters are forced to
  40.528 +     *  assign dummy bone weights to otherwise static meshes assigned to
  40.529 +     *  animated meshes. Full, weight-based skinning is expensive while
  40.530 +     *  animating nodes is extremely cheap, so this step is offered to clean up
  40.531 +     *  the data in that regard.
  40.532 +     *
  40.533 +     *  Use <tt>#AI_CONFIG_PP_DB_THRESHOLD</tt> to control this.
  40.534 +     *  Use <tt>#AI_CONFIG_PP_DB_ALL_OR_NONE</tt> if you want bones removed if and
  40.535 +     *  only if all bones within the scene qualify for removal.
  40.536 +    */
  40.537 +    aiProcess_Debone  = 0x4000000,
  40.538 +
  40.539 +    // -------------------------------------------------------------------------
  40.540 +    /** <hr>This step will perform a global scale of the model.
  40.541 +    *
  40.542 +    *  Some importers are providing a mechanism to define a scaling unit for the
  40.543 +    *  model. This post processing step can be used to do so. You need to get the
  40.544 +    *  global scaling from your importer settings like in FBX. Use the flag
  40.545 +    *  AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY from the global property table to configure this.
  40.546 +    *
  40.547 +    *  Use <tt>#AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY</tt> to setup the global scaing factor.
  40.548 +    */
  40.549 +    aiProcess_GlobalScale = 0x8000000,
  40.550 +
  40.551 +    // -------------------------------------------------------------------------
  40.552 +    /** <hr>A postprocessing step to embed of textures.
  40.553 +     *
  40.554 +     *  This will remove external data dependencies for textures.
  40.555 +     *  If a texture's file does not exist at the specified path
  40.556 +     *  (due, for instance, to an absolute path generated on another system),
  40.557 +     *  it will check if a file with the same name exists at the root folder
  40.558 +     *  of the imported model. And if so, it uses that.
  40.559 +     */
  40.560 +    aiProcess_EmbedTextures  = 0x10000000,
  40.561 +        
  40.562 +    // aiProcess_GenEntityMeshes = 0x100000,
  40.563 +    // aiProcess_OptimizeAnimations = 0x200000
  40.564 +    // aiProcess_FixTexturePaths = 0x200000
  40.565 +
  40.566 +
  40.567 +    aiProcess_ForceGenNormals = 0x20000000,
  40.568 +
  40.569 +    // -------------------------------------------------------------------------
  40.570 +    /** <hr>Drops normals for all faces of all meshes.
  40.571 +     *
  40.572 +     * This is ignored if no normals are present.
  40.573 +     * Face normals are shared between all points of a single face,
  40.574 +     * so a single point can have multiple normals, which
  40.575 +     * forces the library to duplicate vertices in some cases.
  40.576 +     * #aiProcess_JoinIdenticalVertices is *senseless* then.
  40.577 +     * This process gives sense back to aiProcess_JoinIdenticalVertices
  40.578 +     */
  40.579 +    aiProcess_DropNormals = 0x40000000,
  40.580 +};
  40.581 +
  40.582 +
  40.583 +// ---------------------------------------------------------------------------------------
  40.584 +/** @def aiProcess_ConvertToLeftHanded
  40.585 + *  @brief Shortcut flag for Direct3D-based applications.
  40.586 + *
  40.587 + *  Supersedes the #aiProcess_MakeLeftHanded and #aiProcess_FlipUVs and
  40.588 + *  #aiProcess_FlipWindingOrder flags.
  40.589 + *  The output data matches Direct3D's conventions: left-handed geometry, upper-left
  40.590 + *  origin for UV coordinates and finally clockwise face order, suitable for CCW culling.
  40.591 + *
  40.592 + *  @deprecated
  40.593 + */
  40.594 +#define aiProcess_ConvertToLeftHanded ( \
  40.595 +    aiProcess_MakeLeftHanded     | \
  40.596 +    aiProcess_FlipUVs            | \
  40.597 +    aiProcess_FlipWindingOrder   | \
  40.598 +    0 )
  40.599 +
  40.600 +
  40.601 +// ---------------------------------------------------------------------------------------
  40.602 +/** @def aiProcessPreset_TargetRealtime_Fast
  40.603 + *  @brief Default postprocess configuration optimizing the data for real-time rendering.
  40.604 + *
  40.605 + *  Applications would want to use this preset to load models on end-user PCs,
  40.606 + *  maybe for direct use in game.
  40.607 + *
  40.608 + * If you're using DirectX, don't forget to combine this value with
  40.609 + * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
  40.610 + * in your application apply the #aiProcess_TransformUVCoords step, too.
  40.611 + *  @note Please take the time to read the docs for the steps enabled by this preset.
  40.612 + *  Some of them offer further configurable properties, while some of them might not be of
  40.613 + *  use for you so it might be better to not specify them.
  40.614 + */
  40.615 +#define aiProcessPreset_TargetRealtime_Fast ( \
  40.616 +    aiProcess_CalcTangentSpace      |  \
  40.617 +    aiProcess_GenNormals            |  \
  40.618 +    aiProcess_JoinIdenticalVertices |  \
  40.619 +    aiProcess_Triangulate           |  \
  40.620 +    aiProcess_GenUVCoords           |  \
  40.621 +    aiProcess_SortByPType           |  \
  40.622 +    0 )
  40.623 +
  40.624 + // ---------------------------------------------------------------------------------------
  40.625 + /** @def aiProcessPreset_TargetRealtime_Quality
  40.626 +  *  @brief Default postprocess configuration optimizing the data for real-time rendering.
  40.627 +  *
  40.628 +  *  Unlike #aiProcessPreset_TargetRealtime_Fast, this configuration
  40.629 +  *  performs some extra optimizations to improve rendering speed and
  40.630 +  *  to minimize memory usage. It could be a good choice for a level editor
  40.631 +  *  environment where import speed is not so important.
  40.632 +  *
  40.633 +  *  If you're using DirectX, don't forget to combine this value with
  40.634 +  *  the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
  40.635 +  *  in your application apply the #aiProcess_TransformUVCoords step, too.
  40.636 +  *  @note Please take the time to read the docs for the steps enabled by this preset.
  40.637 +  *  Some of them offer further configurable properties, while some of them might not be
  40.638 +  *  of use for you so it might be better to not specify them.
  40.639 +  */
  40.640 +#define aiProcessPreset_TargetRealtime_Quality ( \
  40.641 +    aiProcess_CalcTangentSpace              |  \
  40.642 +    aiProcess_GenSmoothNormals              |  \
  40.643 +    aiProcess_JoinIdenticalVertices         |  \
  40.644 +    aiProcess_ImproveCacheLocality          |  \
  40.645 +    aiProcess_LimitBoneWeights              |  \
  40.646 +    aiProcess_RemoveRedundantMaterials      |  \
  40.647 +    aiProcess_SplitLargeMeshes              |  \
  40.648 +    aiProcess_Triangulate                   |  \
  40.649 +    aiProcess_GenUVCoords                   |  \
  40.650 +    aiProcess_SortByPType                   |  \
  40.651 +    aiProcess_FindDegenerates               |  \
  40.652 +    aiProcess_FindInvalidData               |  \
  40.653 +    0 )
  40.654 +
  40.655 + // ---------------------------------------------------------------------------------------
  40.656 + /** @def aiProcessPreset_TargetRealtime_MaxQuality
  40.657 +  *  @brief Default postprocess configuration optimizing the data for real-time rendering.
  40.658 +  *
  40.659 +  *  This preset enables almost every optimization step to achieve perfectly
  40.660 +  *  optimized data. It's your choice for level editor environments where import speed
  40.661 +  *  is not important.
  40.662 +  *
  40.663 +  *  If you're using DirectX, don't forget to combine this value with
  40.664 +  *  the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
  40.665 +  *  in your application, apply the #aiProcess_TransformUVCoords step, too.
  40.666 +  *  @note Please take the time to read the docs for the steps enabled by this preset.
  40.667 +  *  Some of them offer further configurable properties, while some of them might not be
  40.668 +  *  of use for you so it might be better to not specify them.
  40.669 +  */
  40.670 +#define aiProcessPreset_TargetRealtime_MaxQuality ( \
  40.671 +    aiProcessPreset_TargetRealtime_Quality   |  \
  40.672 +    aiProcess_FindInstances                  |  \
  40.673 +    aiProcess_ValidateDataStructure          |  \
  40.674 +    aiProcess_OptimizeMeshes                 |  \
  40.675 +    0 )
  40.676 +
  40.677 +
  40.678 +#ifdef __cplusplus
  40.679 +} // end of extern "C"
  40.680 +#endif
  40.681 +
  40.682 +#endif // AI_POSTPROCESS_H_INC
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/include/miniassimp/quaternion.h	Mon Jan 28 18:19:26 2019 +0200
    41.3 @@ -0,0 +1,130 @@
    41.4 +/*
    41.5 +Open Asset Import Library (assimp)
    41.6 +----------------------------------------------------------------------
    41.7 +
    41.8 +Copyright (c) 2006-2018, assimp team
    41.9 +
   41.10 +
   41.11 +All rights reserved.
   41.12 +
   41.13 +Redistribution and use of this software in source and binary forms,
   41.14 +with or without modification, are permitted provided that the
   41.15 +following conditions are met:
   41.16 +
   41.17 +* Redistributions of source code must retain the above
   41.18 +  copyright notice, this list of conditions and the
   41.19 +  following disclaimer.
   41.20 +
   41.21 +* Redistributions in binary form must reproduce the above
   41.22 +  copyright notice, this list of conditions and the
   41.23 +  following disclaimer in the documentation and/or other
   41.24 +  materials provided with the distribution.
   41.25 +
   41.26 +* Neither the name of the assimp team, nor the names of its
   41.27 +  contributors may be used to endorse or promote products
   41.28 +  derived from this software without specific prior
   41.29 +  written permission of the assimp team.
   41.30 +
   41.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   41.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   41.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   41.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   41.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   41.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   41.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   41.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   41.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   41.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   41.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   41.42 +
   41.43 +----------------------------------------------------------------------
   41.44 +*/
   41.45 +
   41.46 +/** @file quaternion.h
   41.47 + *  @brief Quaternion structure, including operators when compiling in C++
   41.48 + */
   41.49 +#pragma once
   41.50 +#ifndef AI_QUATERNION_H_INC
   41.51 +#define AI_QUATERNION_H_INC
   41.52 +
   41.53 +#ifdef __cplusplus
   41.54 +
   41.55 +#include "defs.h"
   41.56 +
   41.57 +template <typename TReal> class aiVector3t;
   41.58 +template <typename TReal> class aiMatrix3x3t;
   41.59 +
   41.60 +// ---------------------------------------------------------------------------
   41.61 +/** Represents a quaternion in a 4D vector. */
   41.62 +template <typename TReal>
   41.63 +class aiQuaterniont
   41.64 +{
   41.65 +public:
   41.66 +    aiQuaterniont() AI_NO_EXCEPT : w(1.0), x(), y(), z() {}
   41.67 +    aiQuaterniont(TReal pw, TReal px, TReal py, TReal pz)
   41.68 +        : w(pw), x(px), y(py), z(pz) {}
   41.69 +
   41.70 +    /** Construct from rotation matrix. Result is undefined if the matrix is not orthonormal. */
   41.71 +    explicit aiQuaterniont( const aiMatrix3x3t<TReal>& pRotMatrix);
   41.72 +
   41.73 +    /** Construct from euler angles */
   41.74 +    aiQuaterniont( TReal rotx, TReal roty, TReal rotz);
   41.75 +
   41.76 +    /** Construct from an axis-angle pair */
   41.77 +    aiQuaterniont( aiVector3t<TReal> axis, TReal angle);
   41.78 +
   41.79 +    /** Construct from a normalized quaternion stored in a vec3 */
   41.80 +    explicit aiQuaterniont( aiVector3t<TReal> normalized);
   41.81 +
   41.82 +    /** Returns a matrix representation of the quaternion */
   41.83 +    aiMatrix3x3t<TReal> GetMatrix() const;
   41.84 +
   41.85 +public:
   41.86 +
   41.87 +    bool operator== (const aiQuaterniont& o) const;
   41.88 +    bool operator!= (const aiQuaterniont& o) const;
   41.89 +
   41.90 +    bool Equal(const aiQuaterniont& o, TReal epsilon = 1e-6) const;
   41.91 +
   41.92 +public:
   41.93 +
   41.94 +    /** Normalize the quaternion */
   41.95 +    aiQuaterniont& Normalize();
   41.96 +
   41.97 +    /** Compute quaternion conjugate */
   41.98 +    aiQuaterniont& Conjugate ();
   41.99 +
  41.100 +    /** Rotate a point by this quaternion */
  41.101 +    aiVector3t<TReal> Rotate (const aiVector3t<TReal>& in);
  41.102 +
  41.103 +    /** Multiply two quaternions */
  41.104 +    aiQuaterniont operator* (const aiQuaterniont& two) const;
  41.105 +
  41.106 +public:
  41.107 +
  41.108 +    /** Performs a spherical interpolation between two quaternions and writes the result into the third.
  41.109 +     * @param pOut Target object to received the interpolated rotation.
  41.110 +     * @param pStart Start rotation of the interpolation at factor == 0.
  41.111 +     * @param pEnd End rotation, factor == 1.
  41.112 +     * @param pFactor Interpolation factor between 0 and 1. Values outside of this range yield undefined results.
  41.113 +     */
  41.114 +    static void Interpolate( aiQuaterniont& pOut, const aiQuaterniont& pStart,
  41.115 +        const aiQuaterniont& pEnd, TReal pFactor);
  41.116 +
  41.117 +public:
  41.118 +
  41.119 +    //! w,x,y,z components of the quaternion
  41.120 +    TReal w, x, y, z;
  41.121 +} ;
  41.122 +
  41.123 +typedef aiQuaterniont<ai_real> aiQuaternion;
  41.124 +
  41.125 +#else
  41.126 +
  41.127 +struct aiQuaternion {
  41.128 +    ai_real w, x, y, z;
  41.129 +};
  41.130 +
  41.131 +#endif
  41.132 +
  41.133 +#endif // AI_QUATERNION_H_INC
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/include/miniassimp/quaternion.inl	Mon Jan 28 18:19:26 2019 +0200
    42.3 @@ -0,0 +1,286 @@
    42.4 +/*
    42.5 +---------------------------------------------------------------------------
    42.6 +Open Asset Import Library (assimp)
    42.7 +---------------------------------------------------------------------------
    42.8 +
    42.9 +Copyright (c) 2006-2018, assimp team
   42.10 +
   42.11 +
   42.12 +
   42.13 +All rights reserved.
   42.14 +
   42.15 +Redistribution and use of this software in source and binary forms,
   42.16 +with or without modification, are permitted provided that the following
   42.17 +conditions are met:
   42.18 +
   42.19 +* Redistributions of source code must retain the above
   42.20 +  copyright notice, this list of conditions and the
   42.21 +  following disclaimer.
   42.22 +
   42.23 +* Redistributions in binary form must reproduce the above
   42.24 +  copyright notice, this list of conditions and the
   42.25 +  following disclaimer in the documentation and/or other
   42.26 +  materials provided with the distribution.
   42.27 +
   42.28 +* Neither the name of the assimp team, nor the names of its
   42.29 +  contributors may be used to endorse or promote products
   42.30 +  derived from this software without specific prior
   42.31 +  written permission of the assimp team.
   42.32 +
   42.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   42.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   42.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   42.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   42.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   42.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   42.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   42.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   42.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   42.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   42.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   42.44 +---------------------------------------------------------------------------
   42.45 +*/
   42.46 +
   42.47 +/** @file  quaternion.inl
   42.48 + *  @brief Inline implementation of aiQuaterniont<TReal> operators
   42.49 + */
   42.50 +#pragma once
   42.51 +#ifndef AI_QUATERNION_INL_INC
   42.52 +#define AI_QUATERNION_INL_INC
   42.53 +
   42.54 +#ifdef __cplusplus
   42.55 +#include "quaternion.h"
   42.56 +
   42.57 +#include <cmath>
   42.58 +
   42.59 +// ---------------------------------------------------------------------------
   42.60 +template<typename TReal>
   42.61 +bool aiQuaterniont<TReal>::operator== (const aiQuaterniont& o) const
   42.62 +{
   42.63 +    return x == o.x && y == o.y && z == o.z && w == o.w;
   42.64 +}
   42.65 +
   42.66 +// ---------------------------------------------------------------------------
   42.67 +template<typename TReal>
   42.68 +bool aiQuaterniont<TReal>::operator!= (const aiQuaterniont& o) const
   42.69 +{
   42.70 +    return !(*this == o);
   42.71 +}
   42.72 +
   42.73 +// ---------------------------------------------------------------------------
   42.74 +template<typename TReal>
   42.75 +inline bool aiQuaterniont<TReal>::Equal(const aiQuaterniont& o, TReal epsilon) const {
   42.76 +    return
   42.77 +        std::abs(x - o.x) <= epsilon &&
   42.78 +        std::abs(y - o.y) <= epsilon &&
   42.79 +        std::abs(z - o.z) <= epsilon &&
   42.80 +        std::abs(w - o.w) <= epsilon;
   42.81 +}
   42.82 +
   42.83 +// ---------------------------------------------------------------------------
   42.84 +// Constructs a quaternion from a rotation matrix
   42.85 +template<typename TReal>
   42.86 +inline aiQuaterniont<TReal>::aiQuaterniont( const aiMatrix3x3t<TReal> &pRotMatrix)
   42.87 +{
   42.88 +    TReal t = pRotMatrix.a1 + pRotMatrix.b2 + pRotMatrix.c3;
   42.89 +
   42.90 +    // large enough
   42.91 +    if( t > static_cast<TReal>(0))
   42.92 +    {
   42.93 +        TReal s = std::sqrt(1 + t) * static_cast<TReal>(2.0);
   42.94 +        x = (pRotMatrix.c2 - pRotMatrix.b3) / s;
   42.95 +        y = (pRotMatrix.a3 - pRotMatrix.c1) / s;
   42.96 +        z = (pRotMatrix.b1 - pRotMatrix.a2) / s;
   42.97 +        w = static_cast<TReal>(0.25) * s;
   42.98 +    } // else we have to check several cases
   42.99 +    else if( pRotMatrix.a1 > pRotMatrix.b2 && pRotMatrix.a1 > pRotMatrix.c3 )
  42.100 +    {
  42.101 +        // Column 0:
  42.102 +        TReal s = std::sqrt( static_cast<TReal>(1.0) + pRotMatrix.a1 - pRotMatrix.b2 - pRotMatrix.c3) * static_cast<TReal>(2.0);
  42.103 +        x = static_cast<TReal>(0.25) * s;
  42.104 +        y = (pRotMatrix.b1 + pRotMatrix.a2) / s;
  42.105 +        z = (pRotMatrix.a3 + pRotMatrix.c1) / s;
  42.106 +        w = (pRotMatrix.c2 - pRotMatrix.b3) / s;
  42.107 +    }
  42.108 +    else if( pRotMatrix.b2 > pRotMatrix.c3)
  42.109 +    {
  42.110 +        // Column 1:
  42.111 +        TReal s = std::sqrt( static_cast<TReal>(1.0) + pRotMatrix.b2 - pRotMatrix.a1 - pRotMatrix.c3) * static_cast<TReal>(2.0);
  42.112 +        x = (pRotMatrix.b1 + pRotMatrix.a2) / s;
  42.113 +        y = static_cast<TReal>(0.25) * s;
  42.114 +        z = (pRotMatrix.c2 + pRotMatrix.b3) / s;
  42.115 +        w = (pRotMatrix.a3 - pRotMatrix.c1) / s;
  42.116 +    } else
  42.117 +    {
  42.118 +        // Column 2:
  42.119 +        TReal s = std::sqrt( static_cast<TReal>(1.0) + pRotMatrix.c3 - pRotMatrix.a1 - pRotMatrix.b2) * static_cast<TReal>(2.0);
  42.120 +        x = (pRotMatrix.a3 + pRotMatrix.c1) / s;
  42.121 +        y = (pRotMatrix.c2 + pRotMatrix.b3) / s;
  42.122 +        z = static_cast<TReal>(0.25) * s;
  42.123 +        w = (pRotMatrix.b1 - pRotMatrix.a2) / s;
  42.124 +    }
  42.125 +}
  42.126 +
  42.127 +// ---------------------------------------------------------------------------
  42.128 +// Construction from euler angles
  42.129 +template<typename TReal>
  42.130 +inline aiQuaterniont<TReal>::aiQuaterniont( TReal fPitch, TReal fYaw, TReal fRoll )
  42.131 +{
  42.132 +    const TReal fSinPitch(std::sin(fPitch*static_cast<TReal>(0.5)));
  42.133 +    const TReal fCosPitch(std::cos(fPitch*static_cast<TReal>(0.5)));
  42.134 +    const TReal fSinYaw(std::sin(fYaw*static_cast<TReal>(0.5)));
  42.135 +    const TReal fCosYaw(std::cos(fYaw*static_cast<TReal>(0.5)));
  42.136 +    const TReal fSinRoll(std::sin(fRoll*static_cast<TReal>(0.5)));
  42.137 +    const TReal fCosRoll(std::cos(fRoll*static_cast<TReal>(0.5)));
  42.138 +    const TReal fCosPitchCosYaw(fCosPitch*fCosYaw);
  42.139 +    const TReal fSinPitchSinYaw(fSinPitch*fSinYaw);
  42.140 +    x = fSinRoll * fCosPitchCosYaw     - fCosRoll * fSinPitchSinYaw;
  42.141 +    y = fCosRoll * fSinPitch * fCosYaw + fSinRoll * fCosPitch * fSinYaw;
  42.142 +    z = fCosRoll * fCosPitch * fSinYaw - fSinRoll * fSinPitch * fCosYaw;
  42.143 +    w = fCosRoll * fCosPitchCosYaw     + fSinRoll * fSinPitchSinYaw;
  42.144 +}
  42.145 +
  42.146 +// ---------------------------------------------------------------------------
  42.147 +// Returns a matrix representation of the quaternion
  42.148 +template<typename TReal>
  42.149 +inline aiMatrix3x3t<TReal> aiQuaterniont<TReal>::GetMatrix() const
  42.150 +{
  42.151 +    aiMatrix3x3t<TReal> resMatrix;
  42.152 +    resMatrix.a1 = static_cast<TReal>(1.0) - static_cast<TReal>(2.0) * (y * y + z * z);
  42.153 +    resMatrix.a2 = static_cast<TReal>(2.0) * (x * y - z * w);
  42.154 +    resMatrix.a3 = static_cast<TReal>(2.0) * (x * z + y * w);
  42.155 +    resMatrix.b1 = static_cast<TReal>(2.0) * (x * y + z * w);
  42.156 +    resMatrix.b2 = static_cast<TReal>(1.0) - static_cast<TReal>(2.0) * (x * x + z * z);
  42.157 +    resMatrix.b3 = static_cast<TReal>(2.0) * (y * z - x * w);
  42.158 +    resMatrix.c1 = static_cast<TReal>(2.0) * (x * z - y * w);
  42.159 +    resMatrix.c2 = static_cast<TReal>(2.0) * (y * z + x * w);
  42.160 +    resMatrix.c3 = static_cast<TReal>(1.0) - static_cast<TReal>(2.0) * (x * x + y * y);
  42.161 +
  42.162 +    return resMatrix;
  42.163 +}
  42.164 +
  42.165 +// ---------------------------------------------------------------------------
  42.166 +// Construction from an axis-angle pair
  42.167 +template<typename TReal>
  42.168 +inline aiQuaterniont<TReal>::aiQuaterniont( aiVector3t<TReal> axis, TReal angle)
  42.169 +{
  42.170 +    axis.Normalize();
  42.171 +
  42.172 +    const TReal sin_a = std::sin( angle / 2 );
  42.173 +    const TReal cos_a = std::cos( angle / 2 );
  42.174 +    x    = axis.x * sin_a;
  42.175 +    y    = axis.y * sin_a;
  42.176 +    z    = axis.z * sin_a;
  42.177 +    w    = cos_a;
  42.178 +}
  42.179 +// ---------------------------------------------------------------------------
  42.180 +// Construction from am existing, normalized quaternion
  42.181 +template<typename TReal>
  42.182 +inline aiQuaterniont<TReal>::aiQuaterniont( aiVector3t<TReal> normalized)
  42.183 +{
  42.184 +    x = normalized.x;
  42.185 +    y = normalized.y;
  42.186 +    z = normalized.z;
  42.187 +
  42.188 +    const TReal t = static_cast<TReal>(1.0) - (x*x) - (y*y) - (z*z);
  42.189 +
  42.190 +    if (t < static_cast<TReal>(0.0)) {
  42.191 +        w = static_cast<TReal>(0.0);
  42.192 +    }
  42.193 +    else w = std::sqrt (t);
  42.194 +}
  42.195 +
  42.196 +// ---------------------------------------------------------------------------
  42.197 +// Performs a spherical interpolation between two quaternions
  42.198 +// Implementation adopted from the gmtl project. All others I found on the net fail in some cases.
  42.199 +// Congrats, gmtl!
  42.200 +template<typename TReal>
  42.201 +inline void aiQuaterniont<TReal>::Interpolate( aiQuaterniont& pOut, const aiQuaterniont& pStart, const aiQuaterniont& pEnd, TReal pFactor)
  42.202 +{
  42.203 +    // calc cosine theta
  42.204 +    TReal cosom = pStart.x * pEnd.x + pStart.y * pEnd.y + pStart.z * pEnd.z + pStart.w * pEnd.w;
  42.205 +
  42.206 +    // adjust signs (if necessary)
  42.207 +    aiQuaterniont end = pEnd;
  42.208 +    if( cosom < static_cast<TReal>(0.0))
  42.209 +    {
  42.210 +        cosom = -cosom;
  42.211 +        end.x = -end.x;   // Reverse all signs
  42.212 +        end.y = -end.y;
  42.213 +        end.z = -end.z;
  42.214 +        end.w = -end.w;
  42.215 +    }
  42.216 +
  42.217 +    // Calculate coefficients
  42.218 +    TReal sclp, sclq;
  42.219 +    if( (static_cast<TReal>(1.0) - cosom) > static_cast<TReal>(0.0001)) // 0.0001 -> some epsillon
  42.220 +    {
  42.221 +        // Standard case (slerp)
  42.222 +        TReal omega, sinom;
  42.223 +        omega = std::acos( cosom); // extract theta from dot product's cos theta
  42.224 +        sinom = std::sin( omega);
  42.225 +        sclp  = std::sin( (static_cast<TReal>(1.0) - pFactor) * omega) / sinom;
  42.226 +        sclq  = std::sin( pFactor * omega) / sinom;
  42.227 +    } else
  42.228 +    {
  42.229 +        // Very close, do linear interp (because it's faster)
  42.230 +        sclp = static_cast<TReal>(1.0) - pFactor;
  42.231 +        sclq = pFactor;
  42.232 +    }
  42.233 +
  42.234 +    pOut.x = sclp * pStart.x + sclq * end.x;
  42.235 +    pOut.y = sclp * pStart.y + sclq * end.y;
  42.236 +    pOut.z = sclp * pStart.z + sclq * end.z;
  42.237 +    pOut.w = sclp * pStart.w + sclq * end.w;
  42.238 +}
  42.239 +
  42.240 +// ---------------------------------------------------------------------------
  42.241 +template<typename TReal>
  42.242 +inline aiQuaterniont<TReal>& aiQuaterniont<TReal>::Normalize()
  42.243 +{
  42.244 +    // compute the magnitude and divide through it
  42.245 +    const TReal mag = std::sqrt(x*x + y*y + z*z + w*w);
  42.246 +    if (mag)
  42.247 +    {
  42.248 +        const TReal invMag = static_cast<TReal>(1.0)/mag;
  42.249 +        x *= invMag;
  42.250 +        y *= invMag;
  42.251 +        z *= invMag;
  42.252 +        w *= invMag;
  42.253 +    }
  42.254 +    return *this;
  42.255 +}
  42.256 +
  42.257 +// ---------------------------------------------------------------------------
  42.258 +template<typename TReal>
  42.259 +inline aiQuaterniont<TReal> aiQuaterniont<TReal>::operator* (const aiQuaterniont& t) const
  42.260 +{
  42.261 +    return aiQuaterniont(w*t.w - x*t.x - y*t.y - z*t.z,
  42.262 +        w*t.x + x*t.w + y*t.z - z*t.y,
  42.263 +        w*t.y + y*t.w + z*t.x - x*t.z,
  42.264 +        w*t.z + z*t.w + x*t.y - y*t.x);
  42.265 +}
  42.266 +
  42.267 +// ---------------------------------------------------------------------------
  42.268 +template<typename TReal>
  42.269 +inline aiQuaterniont<TReal>& aiQuaterniont<TReal>::Conjugate ()
  42.270 +{
  42.271 +    x = -x;
  42.272 +    y = -y;
  42.273 +    z = -z;
  42.274 +    return *this;
  42.275 +}
  42.276 +
  42.277 +// ---------------------------------------------------------------------------
  42.278 +template<typename TReal>
  42.279 +inline aiVector3t<TReal> aiQuaterniont<TReal>::Rotate (const aiVector3t<TReal>& v)
  42.280 +{
  42.281 +    aiQuaterniont q2(0.f,v.x,v.y,v.z), q = *this, qinv = q;
  42.282 +    qinv.Conjugate();
  42.283 +
  42.284 +    q = q*q2*qinv;
  42.285 +    return aiVector3t<TReal>(q.x,q.y,q.z);
  42.286 +}
  42.287 +
  42.288 +#endif
  42.289 +#endif // AI_QUATERNION_INL_INC
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/include/miniassimp/scene.h	Mon Jan 28 18:19:26 2019 +0200
    43.3 @@ -0,0 +1,407 @@
    43.4 +/*
    43.5 +---------------------------------------------------------------------------
    43.6 +Open Asset Import Library (assimp)
    43.7 +---------------------------------------------------------------------------
    43.8 +
    43.9 +Copyright (c) 2006-2018, assimp team
   43.10 +
   43.11 +
   43.12 +
   43.13 +All rights reserved.
   43.14 +
   43.15 +Redistribution and use of this software in source and binary forms,
   43.16 +with or without modification, are permitted provided that the following
   43.17 +conditions are met:
   43.18 +
   43.19 +* Redistributions of source code must retain the above
   43.20 +  copyright notice, this list of conditions and the
   43.21 +  following disclaimer.
   43.22 +
   43.23 +* Redistributions in binary form must reproduce the above
   43.24 +  copyright notice, this list of conditions and the
   43.25 +  following disclaimer in the documentation and/or other
   43.26 +  materials provided with the distribution.
   43.27 +
   43.28 +* Neither the name of the assimp team, nor the names of its
   43.29 +  contributors may be used to endorse or promote products
   43.30 +  derived from this software without specific prior
   43.31 +  written permission of the assimp team.
   43.32 +
   43.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   43.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   43.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   43.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   43.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   43.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   43.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   43.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   43.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   43.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   43.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   43.44 +---------------------------------------------------------------------------
   43.45 +*/
   43.46 +
   43.47 +/** @file scene.h
   43.48 + *  @brief Defines the data structures in which the imported scene is returned.
   43.49 + */
   43.50 +#pragma once
   43.51 +#ifndef AI_SCENE_H_INC
   43.52 +#define AI_SCENE_H_INC
   43.53 +
   43.54 +#include "types.h"
   43.55 +#include "texture.h"
   43.56 +#include "mesh.h"
   43.57 +#include "light.h"
   43.58 +#include "camera.h"
   43.59 +#include "material.h"
   43.60 +#include "anim.h"
   43.61 +#include "metadata.h"
   43.62 +
   43.63 +#ifdef __cplusplus
   43.64 +extern "C" {
   43.65 +#endif
   43.66 +
   43.67 +// -------------------------------------------------------------------------------
   43.68 +/** 
   43.69 + * A node in the imported hierarchy.
   43.70 + *
   43.71 + * Each node has name, a parent node (except for the root node),
   43.72 + * a transformation relative to its parent and possibly several child nodes.
   43.73 + * Simple file formats don't support hierarchical structures - for these formats
   43.74 + * the imported scene does consist of only a single root node without children.
   43.75 + */
   43.76 +// -------------------------------------------------------------------------------
   43.77 +struct ASSIMP_API aiNode
   43.78 +{
   43.79 +    /** The name of the node.
   43.80 +     *
   43.81 +     * The name might be empty (length of zero) but all nodes which
   43.82 +     * need to be referenced by either bones or animations are named.
   43.83 +     * Multiple nodes may have the same name, except for nodes which are referenced
   43.84 +     * by bones (see #aiBone and #aiMesh::mBones). Their names *must* be unique.
   43.85 +     *
   43.86 +     * Cameras and lights reference a specific node by name - if there
   43.87 +     * are multiple nodes with this name, they are assigned to each of them.
   43.88 +     * <br>
   43.89 +     * There are no limitations with regard to the characters contained in
   43.90 +     * the name string as it is usually taken directly from the source file.
   43.91 +     *
   43.92 +     * Implementations should be able to handle tokens such as whitespace, tabs,
   43.93 +     * line feeds, quotation marks, ampersands etc.
   43.94 +     *
   43.95 +     * Sometimes assimp introduces new nodes not present in the source file
   43.96 +     * into the hierarchy (usually out of necessity because sometimes the
   43.97 +     * source hierarchy format is simply not compatible). Their names are
   43.98 +     * surrounded by @verbatim <> @endverbatim e.g.
   43.99 +     *  @verbatim<DummyRootNode> @endverbatim.
  43.100 +     */
  43.101 +    C_STRUCT aiString mName;
  43.102 +
  43.103 +    /** The transformation relative to the node's parent. */
  43.104 +    C_STRUCT aiMatrix4x4 mTransformation;
  43.105 +
  43.106 +    /** Parent node. NULL if this node is the root node. */
  43.107 +    C_STRUCT aiNode* mParent;
  43.108 +
  43.109 +    /** The number of child nodes of this node. */
  43.110 +    unsigned int mNumChildren;
  43.111 +
  43.112 +    /** The child nodes of this node. NULL if mNumChildren is 0. */
  43.113 +    C_STRUCT aiNode** mChildren;
  43.114 +
  43.115 +    /** The number of meshes of this node. */
  43.116 +    unsigned int mNumMeshes;
  43.117 +
  43.118 +    /** The meshes of this node. Each entry is an index into the
  43.119 +      * mesh list of the #aiScene.
  43.120 +      */
  43.121 +    unsigned int* mMeshes;
  43.122 +
  43.123 +    /** Metadata associated with this node or NULL if there is no metadata.
  43.124 +      *  Whether any metadata is generated depends on the source file format. See the
  43.125 +      * @link importer_notes @endlink page for more information on every source file
  43.126 +      * format. Importers that don't document any metadata don't write any.
  43.127 +      */
  43.128 +    C_STRUCT aiMetadata* mMetaData;
  43.129 +
  43.130 +#ifdef __cplusplus
  43.131 +    /** Constructor */
  43.132 +    aiNode();
  43.133 +
  43.134 +    /** Construction from a specific name */
  43.135 +    explicit aiNode(const std::string& name);
  43.136 +
  43.137 +    /** Destructor */
  43.138 +    ~aiNode();
  43.139 +
  43.140 +    /** Searches for a node with a specific name, beginning at this
  43.141 +     *  nodes. Normally you will call this method on the root node
  43.142 +     *  of the scene.
  43.143 +     *
  43.144 +     *  @param name Name to search for
  43.145 +     *  @return NULL or a valid Node if the search was successful.
  43.146 +     */
  43.147 +    inline 
  43.148 +    const aiNode* FindNode(const aiString& name) const {
  43.149 +        return FindNode(name.data);
  43.150 +    }
  43.151 +
  43.152 +    inline 
  43.153 +    aiNode* FindNode(const aiString& name) {
  43.154 +        return FindNode(name.data);
  43.155 +    }
  43.156 +
  43.157 +    const aiNode* FindNode(const char* name) const;
  43.158 +
  43.159 +    aiNode* FindNode(const char* name);
  43.160 +
  43.161 +    /**
  43.162 +     * @brief   Will add new children.
  43.163 +     * @param   numChildren  Number of children to add.
  43.164 +     * @param   children     The array with pointers showing to the children.
  43.165 +     */
  43.166 +    void addChildren(unsigned int numChildren, aiNode **children);
  43.167 +#endif // __cplusplus
  43.168 +};
  43.169 +
  43.170 +// -------------------------------------------------------------------------------
  43.171 +/**
  43.172 + * Specifies that the scene data structure that was imported is not complete.
  43.173 + * This flag bypasses some internal validations and allows the import
  43.174 + * of animation skeletons, material libraries or camera animation paths
  43.175 + * using Assimp. Most applications won't support such data.
  43.176 + */
  43.177 +#define AI_SCENE_FLAGS_INCOMPLETE   0x1
  43.178 +
  43.179 +/**
  43.180 + * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS)
  43.181 + * if the validation is successful. In a validated scene you can be sure that
  43.182 + * any cross references in the data structure (e.g. vertex indices) are valid.
  43.183 + */
  43.184 +#define AI_SCENE_FLAGS_VALIDATED    0x2
  43.185 +
  43.186 +/**
  43.187 + * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS)
  43.188 + * if the validation is successful but some issues have been found.
  43.189 + * This can for example mean that a texture that does not exist is referenced
  43.190 + * by a material or that the bone weights for a vertex don't sum to 1.0 ... .
  43.191 + * In most cases you should still be able to use the import. This flag could
  43.192 + * be useful for applications which don't capture Assimp's log output.
  43.193 + */
  43.194 +#define AI_SCENE_FLAGS_VALIDATION_WARNING   0x4
  43.195 +
  43.196 +/**
  43.197 + * This flag is currently only set by the aiProcess_JoinIdenticalVertices step.
  43.198 + * It indicates that the vertices of the output meshes aren't in the internal
  43.199 + * verbose format anymore. In the verbose format all vertices are unique,
  43.200 + * no vertex is ever referenced by more than one face.
  43.201 + */
  43.202 +#define AI_SCENE_FLAGS_NON_VERBOSE_FORMAT   0x8
  43.203 +
  43.204 + /**
  43.205 + * Denotes pure height-map terrain data. Pure terrains usually consist of quads,
  43.206 + * sometimes triangles, in a regular grid. The x,y coordinates of all vertex
  43.207 + * positions refer to the x,y coordinates on the terrain height map, the z-axis
  43.208 + * stores the elevation at a specific point.
  43.209 + *
  43.210 + * TER (Terragen) and HMP (3D Game Studio) are height map formats.
  43.211 + * @note Assimp is probably not the best choice for loading *huge* terrains -
  43.212 + * fully triangulated data takes extremely much free store and should be avoided
  43.213 + * as long as possible (typically you'll do the triangulation when you actually
  43.214 + * need to render it).
  43.215 + */
  43.216 +#define AI_SCENE_FLAGS_TERRAIN 0x10
  43.217 +
  43.218 + /**
  43.219 + * Specifies that the scene data can be shared between structures. For example:
  43.220 + * one vertex in few faces. \ref AI_SCENE_FLAGS_NON_VERBOSE_FORMAT can not be
  43.221 + * used for this because \ref AI_SCENE_FLAGS_NON_VERBOSE_FORMAT has internal
  43.222 + * meaning about postprocessing steps.
  43.223 + */
  43.224 +#define AI_SCENE_FLAGS_ALLOW_SHARED			0x20
  43.225 +
  43.226 +// -------------------------------------------------------------------------------
  43.227 +/** The root structure of the imported data.
  43.228 + *
  43.229 + *  Everything that was imported from the given file can be accessed from here.
  43.230 + *  Objects of this class are generally maintained and owned by Assimp, not
  43.231 + *  by the caller. You shouldn't want to instance it, nor should you ever try to
  43.232 + *  delete a given scene on your own.
  43.233 + */
  43.234 +// -------------------------------------------------------------------------------
  43.235 +struct aiScene
  43.236 +{
  43.237 +    /** Any combination of the AI_SCENE_FLAGS_XXX flags. By default
  43.238 +    * this value is 0, no flags are set. Most applications will
  43.239 +    * want to reject all scenes with the AI_SCENE_FLAGS_INCOMPLETE
  43.240 +    * bit set.
  43.241 +    */
  43.242 +    unsigned int mFlags;
  43.243 +
  43.244 +    /** The root node of the hierarchy.
  43.245 +    *
  43.246 +    * There will always be at least the root node if the import
  43.247 +    * was successful (and no special flags have been set).
  43.248 +    * Presence of further nodes depends on the format and content
  43.249 +    * of the imported file.
  43.250 +    */
  43.251 +    C_STRUCT aiNode* mRootNode;
  43.252 +
  43.253 +    /** The number of meshes in the scene. */
  43.254 +    unsigned int mNumMeshes;
  43.255 +
  43.256 +    /** The array of meshes.
  43.257 +    *
  43.258 +    * Use the indices given in the aiNode structure to access
  43.259 +    * this array. The array is mNumMeshes in size. If the
  43.260 +    * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always
  43.261 +    * be at least ONE material.
  43.262 +    */
  43.263 +    C_STRUCT aiMesh** mMeshes;
  43.264 +
  43.265 +    /** The number of materials in the scene. */
  43.266 +    unsigned int mNumMaterials;
  43.267 +
  43.268 +    /** The array of materials.
  43.269 +    *
  43.270 +    * Use the index given in each aiMesh structure to access this
  43.271 +    * array. The array is mNumMaterials in size. If the
  43.272 +    * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always
  43.273 +    * be at least ONE material.
  43.274 +    */
  43.275 +    C_STRUCT aiMaterial** mMaterials;
  43.276 +
  43.277 +    /** The number of animations in the scene. */
  43.278 +    unsigned int mNumAnimations;
  43.279 +
  43.280 +    /** The array of animations.
  43.281 +    *
  43.282 +    * All animations imported from the given file are listed here.
  43.283 +    * The array is mNumAnimations in size.
  43.284 +    */
  43.285 +    C_STRUCT aiAnimation** mAnimations;
  43.286 +
  43.287 +    /** The number of textures embedded into the file */
  43.288 +    unsigned int mNumTextures;
  43.289 +
  43.290 +    /** The array of embedded textures.
  43.291 +    *
  43.292 +    * Not many file formats embed their textures into the file.
  43.293 +    * An example is Quake's MDL format (which is also used by
  43.294 +    * some GameStudio versions)
  43.295 +    */
  43.296 +    C_STRUCT aiTexture** mTextures;
  43.297 +
  43.298 +    /** The number of light sources in the scene. Light sources
  43.299 +    * are fully optional, in most cases this attribute will be 0
  43.300 +        */
  43.301 +    unsigned int mNumLights;
  43.302 +
  43.303 +    /** The array of light sources.
  43.304 +    *
  43.305 +    * All light sources imported from the given file are
  43.306 +    * listed here. The array is mNumLights in size.
  43.307 +    */
  43.308 +    C_STRUCT aiLight** mLights;
  43.309 +
  43.310 +    /** The number of cameras in the scene. Cameras
  43.311 +    * are fully optional, in most cases this attribute will be 0
  43.312 +        */
  43.313 +    unsigned int mNumCameras;
  43.314 +
  43.315 +    /** The array of cameras.
  43.316 +    *
  43.317 +    * All cameras imported from the given file are listed here.
  43.318 +    * The array is mNumCameras in size. The first camera in the
  43.319 +    * array (if existing) is the default camera view into
  43.320 +    * the scene.
  43.321 +    */
  43.322 +    C_STRUCT aiCamera** mCameras;
  43.323 +
  43.324 +    /**
  43.325 +     *  @brief  The global metadata assigned to the scene itself.
  43.326 +     *
  43.327 +     *  This data contains global metadata which belongs to the scene like 
  43.328 +     *  unit-conversions, versions, vendors or other model-specific data. This 
  43.329 +     *  can be used to store format-specific metadata as well.
  43.330 +     */
  43.331 +    C_STRUCT aiMetadata* mMetaData;
  43.332 +
  43.333 +
  43.334 +#ifdef __cplusplus
  43.335 +
  43.336 +    //! Default constructor - set everything to 0/NULL
  43.337 +    ASSIMP_API aiScene();
  43.338 +
  43.339 +    //! Destructor
  43.340 +    ASSIMP_API ~aiScene();
  43.341 +
  43.342 +    //! Check whether the scene contains meshes
  43.343 +    //! Unless no special scene flags are set this will always be true.
  43.344 +    inline bool HasMeshes() const { 
  43.345 +        return mMeshes != NULL && mNumMeshes > 0; 
  43.346 +    }
  43.347 +
  43.348 +    //! Check whether the scene contains materials
  43.349 +    //! Unless no special scene flags are set this will always be true.
  43.350 +    inline bool HasMaterials() const { 
  43.351 +        return mMaterials != NULL && mNumMaterials > 0; 
  43.352 +    }
  43.353 +
  43.354 +    //! Check whether the scene contains lights
  43.355 +    inline bool HasLights() const { 
  43.356 +        return mLights != NULL && mNumLights > 0; 
  43.357 +    }
  43.358 +
  43.359 +    //! Check whether the scene contains textures
  43.360 +    inline bool HasTextures() const {
  43.361 +        return mTextures != NULL && mNumTextures > 0; 
  43.362 +    }
  43.363 +
  43.364 +    //! Check whether the scene contains cameras
  43.365 +    inline bool HasCameras() const {
  43.366 +        return mCameras != NULL && mNumCameras > 0; 
  43.367 +    }
  43.368 +
  43.369 +    //! Check whether the scene contains animations
  43.370 +    inline bool HasAnimations() const { 
  43.371 +        return mAnimations != NULL && mNumAnimations > 0; 
  43.372 +    }
  43.373 +
  43.374 +    //! Returns a short filename from a full path
  43.375 +    static const char* GetShortFilename(const char* filename) {
  43.376 +        const char* lastSlash = strrchr(filename, '/');
  43.377 +        if (lastSlash == 0) {
  43.378 +            lastSlash = strrchr(filename, '\\');
  43.379 +        }
  43.380 +        const char* shortFilename = lastSlash != 0 ? lastSlash + 1 : filename;
  43.381 +        return shortFilename;
  43.382 +    }
  43.383 +
  43.384 +    //! Returns an embedded texture
  43.385 +    const aiTexture* GetEmbeddedTexture(const char* filename) const {
  43.386 +        const char* shortFilename = GetShortFilename(filename);
  43.387 +        for (unsigned int i = 0; i < mNumTextures; i++) {
  43.388 +            const char* shortTextureFilename = GetShortFilename(mTextures[i]->mFilename.C_Str());
  43.389 +            if (strcmp(shortTextureFilename, shortFilename) == 0) {
  43.390 +                return mTextures[i];
  43.391 +            }
  43.392 +        }
  43.393 +        return 0;
  43.394 +    }
  43.395 +#endif // __cplusplus
  43.396 +
  43.397 +    /**  Internal data, do not touch */
  43.398 +#ifdef __cplusplus
  43.399 +    void* mPrivate;
  43.400 +#else
  43.401 +    char* mPrivate;
  43.402 +#endif
  43.403 +
  43.404 +};
  43.405 +
  43.406 +#ifdef __cplusplus
  43.407 +} //! namespace Assimp
  43.408 +#endif
  43.409 +
  43.410 +#endif // AI_SCENE_H_INC
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/include/miniassimp/texture.h	Mon Jan 28 18:19:26 2019 +0200
    44.3 @@ -0,0 +1,227 @@
    44.4 +/*
    44.5 +---------------------------------------------------------------------------
    44.6 +Open Asset Import Library (assimp)
    44.7 +---------------------------------------------------------------------------
    44.8 +
    44.9 +Copyright (c) 2006-2018, assimp team
   44.10 +
   44.11 +
   44.12 +
   44.13 +All rights reserved.
   44.14 +
   44.15 +Redistribution and use of this software in source and binary forms,
   44.16 +with or without modification, are permitted provided that the following
   44.17 +conditions are met:
   44.18 +
   44.19 +* Redistributions of source code must retain the above
   44.20 +  copyright notice, this list of conditions and the
   44.21 +  following disclaimer.
   44.22 +
   44.23 +* Redistributions in binary form must reproduce the above
   44.24 +  copyright notice, this list of conditions and the
   44.25 +  following disclaimer in the documentation and/or other
   44.26 +  materials provided with the distribution.
   44.27 +
   44.28 +* Neither the name of the assimp team, nor the names of its
   44.29 +  contributors may be used to endorse or promote products
   44.30 +  derived from this software without specific prior
   44.31 +  written permission of the assimp team.
   44.32 +
   44.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   44.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   44.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   44.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   44.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   44.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   44.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   44.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   44.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   44.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   44.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   44.44 +---------------------------------------------------------------------------
   44.45 +*/
   44.46 +
   44.47 +/** @file texture.h
   44.48 + *  @brief Defines texture helper structures for the library
   44.49 + *
   44.50 + * Used for file formats which embed their textures into the model file.
   44.51 + * Supported are both normal textures, which are stored as uncompressed
   44.52 + * pixels, and "compressed" textures, which are stored in a file format
   44.53 + * such as PNG or TGA.
   44.54 + */
   44.55 +#pragma once
   44.56 +#ifndef AI_TEXTURE_H_INC
   44.57 +#define AI_TEXTURE_H_INC
   44.58 +
   44.59 +#include "types.h"
   44.60 +
   44.61 +#ifdef __cplusplus
   44.62 +extern "C" {
   44.63 +#endif
   44.64 +
   44.65 +
   44.66 +// --------------------------------------------------------------------------------
   44.67 +
   44.68 +/** \def AI_EMBEDDED_TEXNAME_PREFIX
   44.69 + * \ref AI_MAKE_EMBEDDED_TEXNAME
   44.70 + */
   44.71 +#ifndef AI_EMBEDDED_TEXNAME_PREFIX
   44.72 +#   define AI_EMBEDDED_TEXNAME_PREFIX	"*"
   44.73 +#endif
   44.74 +
   44.75 +/** @def AI_MAKE_EMBEDDED_TEXNAME
   44.76 + *  Used to build the reserved path name used by the material system to
   44.77 + *  reference textures that are embedded into their corresponding
   44.78 + *  model files. The parameter specifies the index of the texture
   44.79 + *  (zero-based, in the aiScene::mTextures array)
   44.80 + */
   44.81 +#if (!defined AI_MAKE_EMBEDDED_TEXNAME)
   44.82 +#   define AI_MAKE_EMBEDDED_TEXNAME(_n_) AI_EMBEDDED_TEXNAME_PREFIX # _n_
   44.83 +#endif
   44.84 +
   44.85 +
   44.86 +#include "./Compiler/pushpack1.h"
   44.87 +
   44.88 +// --------------------------------------------------------------------------------
   44.89 +/** @brief Helper structure to represent a texel in a ARGB8888 format
   44.90 +*
   44.91 +*  Used by aiTexture.
   44.92 +*/
   44.93 +struct aiTexel
   44.94 +{
   44.95 +    unsigned char b,g,r,a;
   44.96 +
   44.97 +#ifdef __cplusplus
   44.98 +    //! Comparison operator
   44.99 +    bool operator== (const aiTexel& other) const
  44.100 +    {
  44.101 +        return b == other.b && r == other.r &&
  44.102 +               g == other.g && a == other.a;
  44.103 +    }
  44.104 +
  44.105 +    //! Inverse comparison operator
  44.106 +    bool operator!= (const aiTexel& other) const
  44.107 +    {
  44.108 +        return b != other.b || r != other.r ||
  44.109 +               g != other.g || a != other.a;
  44.110 +    }
  44.111 +
  44.112 +    //! Conversion to a floating-point 4d color
  44.113 +    operator aiColor4D() const
  44.114 +    {
  44.115 +        return aiColor4D(r/255.f,g/255.f,b/255.f,a/255.f);
  44.116 +    }
  44.117 +#endif // __cplusplus
  44.118 +
  44.119 +} PACK_STRUCT;
  44.120 +
  44.121 +#include "./Compiler/poppack1.h"
  44.122 +
  44.123 +#define HINTMAXTEXTURELEN 9
  44.124 +
  44.125 +// --------------------------------------------------------------------------------
  44.126 +/** Helper structure to describe an embedded texture
  44.127 + *
  44.128 + * Normally textures are contained in external files but some file formats embed
  44.129 + * them directly in the model file. There are two types of embedded textures:
  44.130 + * 1. Uncompressed textures. The color data is given in an uncompressed format.
  44.131 + * 2. Compressed textures stored in a file format like png or jpg. The raw file
  44.132 + * bytes are given so the application must utilize an image decoder (e.g. DevIL) to
  44.133 + * get access to the actual color data.
  44.134 + *
  44.135 + * Embedded textures are referenced from materials using strings like "*0", "*1", etc.
  44.136 + * as the texture paths (a single asterisk character followed by the
  44.137 + * zero-based index of the texture in the aiScene::mTextures array).
  44.138 + */
  44.139 +struct aiTexture {
  44.140 +    /** Width of the texture, in pixels
  44.141 +     *
  44.142 +     * If mHeight is zero the texture is compressed in a format
  44.143 +     * like JPEG. In this case mWidth specifies the size of the
  44.144 +     * memory area pcData is pointing to, in bytes.
  44.145 +     */
  44.146 +    unsigned int mWidth;
  44.147 +
  44.148 +    /** Height of the texture, in pixels
  44.149 +     *
  44.150 +     * If this value is zero, pcData points to an compressed texture
  44.151 +     * in any format (e.g. JPEG).
  44.152 +     */
  44.153 +    unsigned int mHeight;
  44.154 +
  44.155 +    /** A hint from the loader to make it easier for applications
  44.156 +     *  to determine the type of embedded textures.
  44.157 +     *
  44.158 +     * If mHeight != 0 this member is show how data is packed. Hint will consist of
  44.159 +     * two parts: channel order and channel bitness (count of the bits for every
  44.160 +     * color channel). For simple parsing by the viewer it's better to not omit
  44.161 +     * absent color channel and just use 0 for bitness. For example:
  44.162 +     * 1. Image contain RGBA and 8 bit per channel, achFormatHint == "rgba8888";
  44.163 +     * 2. Image contain ARGB and 8 bit per channel, achFormatHint == "argb8888";
  44.164 +     * 3. Image contain RGB and 5 bit for R and B channels and 6 bit for G channel, achFormatHint == "rgba5650";
  44.165 +     * 4. One color image with B channel and 1 bit for it, achFormatHint == "rgba0010";
  44.166 +     * If mHeight == 0 then achFormatHint is set set to '\\0\\0\\0\\0' if the loader has no additional
  44.167 +     * information about the texture file format used OR the
  44.168 +     * file extension of the format without a trailing dot. If there
  44.169 +     * are multiple file extensions for a format, the shortest
  44.170 +     * extension is chosen (JPEG maps to 'jpg', not to 'jpeg').
  44.171 +     * E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'.  All characters are lower-case.
  44.172 +     * The fourth character will always be '\\0'.
  44.173 +     */
  44.174 +    char achFormatHint[ HINTMAXTEXTURELEN ];// 8 for string + 1 for terminator.
  44.175 +
  44.176 +    /** Data of the texture.
  44.177 +     *
  44.178 +     * Points to an array of mWidth * mHeight aiTexel's.
  44.179 +     * The format of the texture data is always ARGB8888 to
  44.180 +     * make the implementation for user of the library as easy
  44.181 +     * as possible. If mHeight = 0 this is a pointer to a memory
  44.182 +     * buffer of size mWidth containing the compressed texture
  44.183 +     * data. Good luck, have fun!
  44.184 +     */
  44.185 +    C_STRUCT aiTexel* pcData;
  44.186 +
  44.187 +    /** Texture original filename
  44.188 +    *
  44.189 +    * Used to get the texture reference
  44.190 +    */
  44.191 +    C_STRUCT aiString mFilename;
  44.192 +
  44.193 +#ifdef __cplusplus
  44.194 +
  44.195 +    //! For compressed textures (mHeight == 0): compare the
  44.196 +    //! format hint against a given string.
  44.197 +    //! @param s Input string. 3 characters are maximally processed.
  44.198 +    //!        Example values: "jpg", "png"
  44.199 +    //! @return true if the given string matches the format hint
  44.200 +    bool CheckFormat(const char* s) const {
  44.201 +        if (0 == s) {
  44.202 +            return false;
  44.203 +        }
  44.204 +
  44.205 +		return (0 == ::strncmp(achFormatHint, s, sizeof(achFormatHint)));
  44.206 +    }
  44.207 +
  44.208 +    // Construction
  44.209 +    aiTexture() AI_NO_EXCEPT
  44.210 +    : mWidth(0)
  44.211 +    , mHeight(0)
  44.212 +    , pcData(0)
  44.213 +    , mFilename() {
  44.214 +        achFormatHint[0] = achFormatHint[1] = 0;
  44.215 +        achFormatHint[2] = achFormatHint[3] = 0;
  44.216 +    }
  44.217 +
  44.218 +    // Destruction
  44.219 +    ~aiTexture () {
  44.220 +        delete[] pcData;
  44.221 +    }
  44.222 +#endif
  44.223 +};
  44.224 +
  44.225 +
  44.226 +#ifdef __cplusplus
  44.227 +}
  44.228 +#endif
  44.229 +
  44.230 +#endif // AI_TEXTURE_H_INC
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/include/miniassimp/types.h	Mon Jan 28 18:19:26 2019 +0200
    45.3 @@ -0,0 +1,529 @@
    45.4 +/*
    45.5 +---------------------------------------------------------------------------
    45.6 +Open Asset Import Library (assimp)
    45.7 +---------------------------------------------------------------------------
    45.8 +
    45.9 +Copyright (c) 2006-2018, assimp team
   45.10 +
   45.11 +
   45.12 +
   45.13 +All rights reserved.
   45.14 +
   45.15 +Redistribution and use of this software in source and binary forms,
   45.16 +with or without modification, are permitted provided that the following
   45.17 +conditions are met:
   45.18 +
   45.19 +* Redistributions of source code must retain the above
   45.20 +  copyright notice, this list of conditions and the
   45.21 +  following disclaimer.
   45.22 +
   45.23 +* Redistributions in binary form must reproduce the above
   45.24 +  copyright notice, this list of conditions and the
   45.25 +  following disclaimer in the documentation and/or other
   45.26 +  materials provided with the distribution.
   45.27 +
   45.28 +* Neither the name of the assimp team, nor the names of its
   45.29 +  contributors may be used to endorse or promote products
   45.30 +  derived from this software without specific prior
   45.31 +  written permission of the assimp team.
   45.32 +
   45.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   45.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   45.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   45.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   45.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   45.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   45.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   45.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   45.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   45.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   45.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   45.44 +---------------------------------------------------------------------------
   45.45 +*/
   45.46 +
   45.47 +/** @file types.h
   45.48 + *  Basic data types and primitives, such as vectors or colors.
   45.49 + */
   45.50 +#pragma once
   45.51 +#ifndef AI_TYPES_H_INC
   45.52 +#define AI_TYPES_H_INC
   45.53 +
   45.54 +// Some runtime headers
   45.55 +#include <sys/types.h>
   45.56 +#include <stddef.h>
   45.57 +#include <string.h>
   45.58 +#include <limits.h>
   45.59 +
   45.60 +// Our compile configuration
   45.61 +#include "defs.h"
   45.62 +
   45.63 +// Some types moved to separate header due to size of operators
   45.64 +#include "vector3.h"
   45.65 +#include "vector2.h"
   45.66 +#include "color4.h"
   45.67 +#include "matrix3x3.h"
   45.68 +#include "matrix4x4.h"
   45.69 +#include "quaternion.h"
   45.70 +
   45.71 +#ifdef __cplusplus
   45.72 +#include <cstring>
   45.73 +#include <new>      // for std::nothrow_t
   45.74 +#include <string>   // for aiString::Set(const std::string&)
   45.75 +
   45.76 +namespace Assimp    {
   45.77 +    //! @cond never
   45.78 +namespace Intern        {
   45.79 +    // --------------------------------------------------------------------
   45.80 +    /** @brief Internal helper class to utilize our internal new/delete
   45.81 +     *    routines for allocating object of this and derived classes.
   45.82 +     *
   45.83 +     * By doing this you can safely share class objects between Assimp
   45.84 +     * and the application - it works even over DLL boundaries. A good
   45.85 +     * example is the #IOSystem where the application allocates its custom
   45.86 +     * #IOSystem, then calls #Importer::SetIOSystem(). When the Importer
   45.87 +     * destructs, Assimp calls operator delete on the stored #IOSystem.
   45.88 +     * If it lies on a different heap than Assimp is working with,
   45.89 +     * the application is determined to crash.
   45.90 +     */
   45.91 +    // --------------------------------------------------------------------
   45.92 +#ifndef SWIG
   45.93 +    struct ASSIMP_API AllocateFromAssimpHeap    {
   45.94 +        // http://www.gotw.ca/publications/mill15.htm
   45.95 +
   45.96 +        // new/delete overload
   45.97 +        void *operator new    ( size_t num_bytes) /* throw( std::bad_alloc ) */;
   45.98 +        void *operator new    ( size_t num_bytes, const std::nothrow_t& ) throw();
   45.99 +        void  operator delete ( void* data);
  45.100 +
  45.101 +        // array new/delete overload
  45.102 +        void *operator new[]    ( size_t num_bytes) /* throw( std::bad_alloc ) */;
  45.103 +        void *operator new[]    ( size_t num_bytes, const std::nothrow_t& )  throw();
  45.104 +        void  operator delete[] ( void* data);
  45.105 +
  45.106 +    }; // struct AllocateFromAssimpHeap
  45.107 +#endif
  45.108 +} // namespace Intern
  45.109 +    //! @endcond
  45.110 +} // namespace Assimp
  45.111 +
  45.112 +extern "C" {
  45.113 +#endif
  45.114 +
  45.115 +/** Maximum dimension for strings, ASSIMP strings are zero terminated. */
  45.116 +#ifdef __cplusplus
  45.117 +    static const size_t MAXLEN = 1024;
  45.118 +#else
  45.119 +#   define MAXLEN 1024
  45.120 +#endif
  45.121 +
  45.122 +// ----------------------------------------------------------------------------------
  45.123 +/** Represents a plane in a three-dimensional, euclidean space
  45.124 +*/
  45.125 +struct aiPlane {
  45.126 +#ifdef __cplusplus
  45.127 +    aiPlane () AI_NO_EXCEPT : a(0.f), b(0.f), c(0.f), d(0.f) {}
  45.128 +    aiPlane (ai_real _a, ai_real _b, ai_real _c, ai_real _d)
  45.129 +        : a(_a), b(_b), c(_c), d(_d) {}
  45.130 +
  45.131 +    aiPlane (const aiPlane& o) : a(o.a), b(o.b), c(o.c), d(o.d) {}
  45.132 +
  45.133 +#endif // !__cplusplus
  45.134 +
  45.135 +    //! Plane equation
  45.136 +    ai_real a,b,c,d;
  45.137 +}; // !struct aiPlane
  45.138 +
  45.139 +// ----------------------------------------------------------------------------------
  45.140 +/** Represents a ray
  45.141 +*/
  45.142 +struct aiRay {
  45.143 +#ifdef __cplusplus
  45.144 +    aiRay () AI_NO_EXCEPT {}
  45.145 +    aiRay (const aiVector3D& _pos, const aiVector3D& _dir)
  45.146 +        : pos(_pos), dir(_dir) {}
  45.147 +
  45.148 +    aiRay (const aiRay& o) : pos (o.pos), dir (o.dir) {}
  45.149 +
  45.150 +#endif // !__cplusplus
  45.151 +
  45.152 +    //! Position and direction of the ray
  45.153 +    C_STRUCT aiVector3D pos, dir;
  45.154 +}; // !struct aiRay
  45.155 +
  45.156 +// ----------------------------------------------------------------------------------
  45.157 +/** Represents a color in Red-Green-Blue space.
  45.158 +*/
  45.159 +struct aiColor3D
  45.160 +{
  45.161 +#ifdef __cplusplus
  45.162 +    aiColor3D () AI_NO_EXCEPT : r(0.0f), g(0.0f), b(0.0f) {}
  45.163 +    aiColor3D (ai_real _r, ai_real _g, ai_real _b) : r(_r), g(_g), b(_b) {}
  45.164 +    explicit aiColor3D (ai_real _r) : r(_r), g(_r), b(_r) {}
  45.165 +    aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {}
  45.166 +
  45.167 +    /** Component-wise comparison */
  45.168 +    // TODO: add epsilon?
  45.169 +    bool operator == (const aiColor3D& other) const
  45.170 +        {return r == other.r && g == other.g && b == other.b;}
  45.171 +
  45.172 +    /** Component-wise inverse comparison */
  45.173 +    // TODO: add epsilon?
  45.174 +    bool operator != (const aiColor3D& other) const
  45.175 +        {return r != other.r || g != other.g || b != other.b;}
  45.176 +
  45.177 +    /** Component-wise comparison */
  45.178 +    // TODO: add epsilon?
  45.179 +    bool operator < (const aiColor3D& other) const {
  45.180 +        return r < other.r || ( r == other.r && (g < other.g || (g == other.g && b < other.b ) ) );
  45.181 +    }
  45.182 +
  45.183 +    /** Component-wise addition */
  45.184 +    aiColor3D operator+(const aiColor3D& c) const {
  45.185 +        return aiColor3D(r+c.r,g+c.g,b+c.b);
  45.186 +    }
  45.187 +
  45.188 +    /** Component-wise subtraction */
  45.189 +    aiColor3D operator-(const aiColor3D& c) const {
  45.190 +        return aiColor3D(r-c.r,g-c.g,b-c.b);
  45.191 +    }
  45.192 +
  45.193 +    /** Component-wise multiplication */
  45.194 +    aiColor3D operator*(const aiColor3D& c) const {
  45.195 +        return aiColor3D(r*c.r,g*c.g,b*c.b);
  45.196 +    }
  45.197 +
  45.198 +    /** Multiply with a scalar */
  45.199 +    aiColor3D operator*(ai_real f) const {
  45.200 +        return aiColor3D(r*f,g*f,b*f);
  45.201 +    }
  45.202 +
  45.203 +    /** Access a specific color component */
  45.204 +    ai_real operator[](unsigned int i) const {
  45.205 +        return *(&r + i);
  45.206 +    }
  45.207 +
  45.208 +    /** Access a specific color component */
  45.209 +    ai_real& operator[](unsigned int i) {
  45.210 +        if ( 0 == i ) {
  45.211 +            return r;
  45.212 +        } else if ( 1 == i ) {
  45.213 +            return g;
  45.214 +        } else if ( 2 == i ) {
  45.215 +            return b;
  45.216 +        }
  45.217 +        return r;
  45.218 +    }
  45.219 +
  45.220 +    /** Check whether a color is black */
  45.221 +    bool IsBlack() const {
  45.222 +        static const ai_real epsilon = ai_real(10e-3);
  45.223 +        return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon;
  45.224 +    }
  45.225 +
  45.226 +#endif // !__cplusplus
  45.227 +
  45.228 +    //! Red, green and blue color values
  45.229 +    ai_real r, g, b;
  45.230 +};  // !struct aiColor3D
  45.231 +
  45.232 +// ----------------------------------------------------------------------------------
  45.233 +/** Represents an UTF-8 string, zero byte terminated.
  45.234 + *
  45.235 + *  The character set of an aiString is explicitly defined to be UTF-8. This Unicode
  45.236 + *  transformation was chosen in the belief that most strings in 3d files are limited
  45.237 + *  to ASCII, thus the character set needed to be strictly ASCII compatible.
  45.238 + *
  45.239 + *  Most text file loaders provide proper Unicode input file handling, special unicode
  45.240 + *  characters are correctly transcoded to UTF8 and are kept throughout the libraries'
  45.241 + *  import pipeline.
  45.242 + *
  45.243 + *  For most applications, it will be absolutely sufficient to interpret the
  45.244 + *  aiString as ASCII data and work with it as one would work with a plain char*.
  45.245 + *  Windows users in need of proper support for i.e asian characters can use the
  45.246 + *  MultiByteToWideChar(), WideCharToMultiByte() WinAPI functionality to convert the
  45.247 + *  UTF-8 strings to their working character set (i.e. MBCS, WideChar).
  45.248 + *
  45.249 + *  We use this representation instead of std::string to be C-compatible. The
  45.250 + *  (binary) length of such a string is limited to MAXLEN characters (including the
  45.251 + *  the terminating zero).
  45.252 +*/
  45.253 +struct aiString
  45.254 +{
  45.255 +#ifdef __cplusplus
  45.256 +    /** Default constructor, the string is set to have zero length */
  45.257 +    aiString() AI_NO_EXCEPT
  45.258 +    : length( 0 ) {
  45.259 +        data[0] = '\0';
  45.260 +
  45.261 +#ifdef ASSIMP_BUILD_DEBUG
  45.262 +        // Debug build: overwrite the string on its full length with ESC (27)
  45.263 +        memset(data+1,27,MAXLEN-1);
  45.264 +#endif
  45.265 +    }
  45.266 +
  45.267 +    /** Copy constructor */
  45.268 +    aiString(const aiString& rOther) :
  45.269 +        length(rOther.length)
  45.270 +    {
  45.271 +        // Crop the string to the maximum length
  45.272 +        length = length>=MAXLEN?MAXLEN-1:length;
  45.273 +        memcpy( data, rOther.data, length);
  45.274 +        data[length] = '\0';
  45.275 +    }
  45.276 +
  45.277 +    /** Constructor from std::string */
  45.278 +    explicit aiString(const std::string& pString) :
  45.279 +        length(pString.length())
  45.280 +    {
  45.281 +        length = length>=MAXLEN?MAXLEN-1:length;
  45.282 +        memcpy( data, pString.c_str(), length);
  45.283 +        data[length] = '\0';
  45.284 +    }
  45.285 +
  45.286 +    /** Copy a std::string to the aiString */
  45.287 +    void Set( const std::string& pString) {
  45.288 +        if( pString.length() > MAXLEN - 1) {
  45.289 +            return;
  45.290 +        }
  45.291 +        length = pString.length();
  45.292 +        memcpy( data, pString.c_str(), length);
  45.293 +        data[length] = 0;
  45.294 +    }
  45.295 +
  45.296 +    /** Copy a const char* to the aiString */
  45.297 +    void Set( const char* sz) {
  45.298 +        const size_t len = ::strlen(sz);
  45.299 +        if( len > MAXLEN - 1) {
  45.300 +            return;
  45.301 +        }
  45.302 +        length = len;
  45.303 +        memcpy( data, sz, len);
  45.304 +        data[len] = 0;
  45.305 +    }
  45.306 +
  45.307 +
  45.308 +    /** Assignment operator */
  45.309 +    aiString& operator = (const aiString &rOther) {
  45.310 +        if (this == &rOther) {
  45.311 +            return *this;
  45.312 +        }
  45.313 +
  45.314 +        length = rOther.length;;
  45.315 +        memcpy( data, rOther.data, length);
  45.316 +        data[length] = '\0';
  45.317 +        return *this;
  45.318 +    }
  45.319 +
  45.320 +
  45.321 +    /** Assign a const char* to the string */
  45.322 +    aiString& operator = (const char* sz) {
  45.323 +        Set(sz);
  45.324 +        return *this;
  45.325 +    }
  45.326 +
  45.327 +    /** Assign a cstd::string to the string */
  45.328 +    aiString& operator = ( const std::string& pString) {
  45.329 +        Set(pString);
  45.330 +        return *this;
  45.331 +    }
  45.332 +
  45.333 +    /** Comparison operator */
  45.334 +    bool operator==(const aiString& other) const {
  45.335 +        return  (length == other.length && 0 == memcmp(data,other.data,length));
  45.336 +    }
  45.337 +
  45.338 +    /** Inverse comparison operator */
  45.339 +    bool operator!=(const aiString& other) const {
  45.340 +        return  (length != other.length || 0 != memcmp(data,other.data,length));
  45.341 +    }
  45.342 +
  45.343 +    /** Append a string to the string */
  45.344 +    void Append (const char* app)   {
  45.345 +        const size_t len = ::strlen(app);
  45.346 +        if (!len) {
  45.347 +            return;
  45.348 +        }
  45.349 +        if (length + len >= MAXLEN) {
  45.350 +            return;
  45.351 +        }
  45.352 +
  45.353 +        memcpy(&data[length],app,len+1);
  45.354 +        length += len;
  45.355 +    }
  45.356 +
  45.357 +    /** Clear the string - reset its length to zero */
  45.358 +    void Clear ()   {
  45.359 +        length  = 0;
  45.360 +        data[0] = '\0';
  45.361 +
  45.362 +#ifdef ASSIMP_BUILD_DEBUG
  45.363 +        // Debug build: overwrite the string on its full length with ESC (27)
  45.364 +        memset(data+1,27,MAXLEN-1);
  45.365 +#endif
  45.366 +    }
  45.367 +
  45.368 +    /** Returns a pointer to the underlying zero-terminated array of characters */
  45.369 +    const char* C_Str() const {
  45.370 +        return data;
  45.371 +    }
  45.372 +
  45.373 +#endif // !__cplusplus
  45.374 +
  45.375 +    /** Binary length of the string excluding the terminal 0. This is NOT the
  45.376 +     *  logical length of strings containing UTF-8 multi-byte sequences! It's
  45.377 +     *  the number of bytes from the beginning of the string to its end.*/
  45.378 +    size_t length;
  45.379 +
  45.380 +    /** String buffer. Size limit is MAXLEN */
  45.381 +    char data[MAXLEN];
  45.382 +} ;  // !struct aiString
  45.383 +
  45.384 +
  45.385 +// ----------------------------------------------------------------------------------
  45.386 +/** Standard return type for some library functions.
  45.387 + * Rarely used, and if, mostly in the C API.
  45.388 + */
  45.389 +typedef enum aiReturn
  45.390 +{
  45.391 +    /** Indicates that a function was successful */
  45.392 +    aiReturn_SUCCESS = 0x0,
  45.393 +
  45.394 +    /** Indicates that a function failed */
  45.395 +    aiReturn_FAILURE = -0x1,
  45.396 +
  45.397 +    /** Indicates that not enough memory was available
  45.398 +     * to perform the requested operation
  45.399 +     */
  45.400 +    aiReturn_OUTOFMEMORY = -0x3,
  45.401 +
  45.402 +    /** @cond never
  45.403 +     *  Force 32-bit size enum
  45.404 +     */
  45.405 +    _AI_ENFORCE_ENUM_SIZE = 0x7fffffff
  45.406 +
  45.407 +    /// @endcond
  45.408 +} aiReturn;  // !enum aiReturn
  45.409 +
  45.410 +// just for backwards compatibility, don't use these constants anymore
  45.411 +#define AI_SUCCESS     aiReturn_SUCCESS
  45.412 +#define AI_FAILURE     aiReturn_FAILURE
  45.413 +#define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY
  45.414 +
  45.415 +// ----------------------------------------------------------------------------------
  45.416 +/** Seek origins (for the virtual file system API).
  45.417 + *  Much cooler than using SEEK_SET, SEEK_CUR or SEEK_END.
  45.418 + */
  45.419 +enum aiOrigin
  45.420 +{
  45.421 +    /** Beginning of the file */
  45.422 +    aiOrigin_SET = 0x0,
  45.423 +
  45.424 +    /** Current position of the file pointer */
  45.425 +    aiOrigin_CUR = 0x1,
  45.426 +
  45.427 +    /** End of the file, offsets must be negative */
  45.428 +    aiOrigin_END = 0x2,
  45.429 +
  45.430 +    /**  @cond never
  45.431 +     *   Force 32-bit size enum
  45.432 +     */
  45.433 +    _AI_ORIGIN_ENFORCE_ENUM_SIZE = 0x7fffffff
  45.434 +
  45.435 +    /// @endcond
  45.436 +}; // !enum aiOrigin
  45.437 +
  45.438 +// ----------------------------------------------------------------------------------
  45.439 +/** @brief Enumerates predefined log streaming destinations.
  45.440 + *  Logging to these streams can be enabled with a single call to
  45.441 + *   #LogStream::createDefaultStream.
  45.442 + */
  45.443 +enum aiDefaultLogStream
  45.444 +{
  45.445 +    /** Stream the log to a file */
  45.446 +    aiDefaultLogStream_FILE = 0x1,
  45.447 +
  45.448 +    /** Stream the log to std::cout */
  45.449 +    aiDefaultLogStream_STDOUT = 0x2,
  45.450 +
  45.451 +    /** Stream the log to std::cerr */
  45.452 +    aiDefaultLogStream_STDERR = 0x4,
  45.453 +
  45.454 +    /** MSVC only: Stream the log the the debugger
  45.455 +     * (this relies on OutputDebugString from the Win32 SDK)
  45.456 +     */
  45.457 +    aiDefaultLogStream_DEBUGGER = 0x8,
  45.458 +
  45.459 +    /** @cond never
  45.460 +     *  Force 32-bit size enum
  45.461 +     */
  45.462 +    _AI_DLS_ENFORCE_ENUM_SIZE = 0x7fffffff
  45.463 +    /// @endcond
  45.464 +}; // !enum aiDefaultLogStream
  45.465 +
  45.466 +// just for backwards compatibility, don't use these constants anymore
  45.467 +#define DLS_FILE     aiDefaultLogStream_FILE
  45.468 +#define DLS_STDOUT   aiDefaultLogStream_STDOUT
  45.469 +#define DLS_STDERR   aiDefaultLogStream_STDERR
  45.470 +#define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER
  45.471 +
  45.472 +// ----------------------------------------------------------------------------------
  45.473 +/** Stores the memory requirements for different components (e.g. meshes, materials,
  45.474 + *  animations) of an import. All sizes are in bytes.
  45.475 + *  @see Importer::GetMemoryRequirements()
  45.476 +*/
  45.477 +struct aiMemoryInfo
  45.478 +{
  45.479 +#ifdef __cplusplus
  45.480 +
  45.481 +    /** Default constructor */
  45.482 +    aiMemoryInfo() AI_NO_EXCEPT
  45.483 +        : textures   (0)
  45.484 +        , materials  (0)
  45.485 +        , meshes     (0)
  45.486 +        , nodes      (0)
  45.487 +        , animations (0)
  45.488 +        , cameras    (0)
  45.489 +        , lights     (0)
  45.490 +        , total      (0)
  45.491 +    {}
  45.492 +
  45.493 +#endif
  45.494 +
  45.495 +    /** Storage allocated for texture data */
  45.496 +    unsigned int textures;
  45.497 +
  45.498 +    /** Storage allocated for material data  */
  45.499 +    unsigned int materials;
  45.500 +
  45.501 +    /** Storage allocated for mesh data */
  45.502 +    unsigned int meshes;
  45.503 +
  45.504 +    /** Storage allocated for node data */
  45.505 +    unsigned int nodes;
  45.506 +
  45.507 +    /** Storage allocated for animation data */
  45.508 +    unsigned int animations;
  45.509 +
  45.510 +    /** Storage allocated for camera data */
  45.511 +    unsigned int cameras;
  45.512 +
  45.513 +    /** Storage allocated for light data */
  45.514 +    unsigned int lights;
  45.515 +
  45.516 +    /** Total storage allocated for the full import. */
  45.517 +    unsigned int total;
  45.518 +}; // !struct aiMemoryInfo
  45.519 +
  45.520 +#ifdef __cplusplus
  45.521 +}
  45.522 +#endif //!  __cplusplus
  45.523 +
  45.524 +// Include implementation files
  45.525 +#include "vector2.inl"
  45.526 +#include "vector3.inl"
  45.527 +#include "color4.inl"
  45.528 +#include "quaternion.inl"
  45.529 +#include "matrix3x3.inl"
  45.530 +#include "matrix4x4.inl"
  45.531 +
  45.532 +#endif // AI_TYPES_H_INC
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/include/miniassimp/vector2.h	Mon Jan 28 18:19:26 2019 +0200
    46.3 @@ -0,0 +1,106 @@
    46.4 +/*
    46.5 +---------------------------------------------------------------------------
    46.6 +Open Asset Import Library (assimp)
    46.7 +---------------------------------------------------------------------------
    46.8 +
    46.9 +Copyright (c) 2006-2018, assimp team
   46.10 +
   46.11 +
   46.12 +
   46.13 +All rights reserved.
   46.14 +
   46.15 +Redistribution and use of this software in source and binary forms,
   46.16 +with or without modification, are permitted provided that the following
   46.17 +conditions are met:
   46.18 +
   46.19 +* Redistributions of source code must retain the above
   46.20 +  copyright notice, this list of conditions and the
   46.21 +  following disclaimer.
   46.22 +
   46.23 +* Redistributions in binary form must reproduce the above
   46.24 +  copyright notice, this list of conditions and the
   46.25 +  following disclaimer in the documentation and/or other
   46.26 +  materials provided with the distribution.
   46.27 +
   46.28 +* Neither the name of the assimp team, nor the names of its
   46.29 +  contributors may be used to endorse or promote products
   46.30 +  derived from this software without specific prior
   46.31 +  written permission of the assimp team.
   46.32 +
   46.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   46.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   46.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   46.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   46.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   46.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   46.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   46.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   46.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   46.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   46.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   46.44 +---------------------------------------------------------------------------
   46.45 +*/
   46.46 +/** @file vector2.h
   46.47 + *  @brief 2D vector structure, including operators when compiling in C++
   46.48 + */
   46.49 +#pragma once
   46.50 +#ifndef AI_VECTOR2D_H_INC
   46.51 +#define AI_VECTOR2D_H_INC
   46.52 +
   46.53 +#ifdef __cplusplus
   46.54 +#   include <cmath>
   46.55 +#else
   46.56 +#   include <math.h>
   46.57 +#endif
   46.58 +
   46.59 +#include "defs.h"
   46.60 +
   46.61 +// ----------------------------------------------------------------------------------
   46.62 +/** Represents a two-dimensional vector.
   46.63 + */
   46.64 +
   46.65 +#ifdef __cplusplus
   46.66 +template <typename TReal>
   46.67 +class aiVector2t {
   46.68 +public:
   46.69 +    aiVector2t () : x(), y() {}
   46.70 +    aiVector2t (TReal _x, TReal _y) : x(_x), y(_y) {}
   46.71 +    explicit aiVector2t (TReal _xyz) : x(_xyz), y(_xyz) {}
   46.72 +
   46.73 +    void Set( TReal pX, TReal pY);
   46.74 +    TReal SquareLength() const ;
   46.75 +    TReal Length() const ;
   46.76 +    aiVector2t& Normalize();
   46.77 +
   46.78 +    const aiVector2t& operator += (const aiVector2t& o);
   46.79 +    const aiVector2t& operator -= (const aiVector2t& o);
   46.80 +    const aiVector2t& operator *= (TReal f);
   46.81 +    const aiVector2t& operator /= (TReal f);
   46.82 +
   46.83 +    TReal operator[](unsigned int i) const;
   46.84 +
   46.85 +    bool operator== (const aiVector2t& other) const;
   46.86 +    bool operator!= (const aiVector2t& other) const;
   46.87 +
   46.88 +    bool Equal(const aiVector2t& other, TReal epsilon = 1e-6) const;
   46.89 +
   46.90 +    aiVector2t& operator= (TReal f);
   46.91 +    const aiVector2t SymMul(const aiVector2t& o);
   46.92 +
   46.93 +    template <typename TOther>
   46.94 +    operator aiVector2t<TOther> () const;
   46.95 +
   46.96 +    TReal x, y;
   46.97 +};
   46.98 +
   46.99 +typedef aiVector2t<ai_real> aiVector2D;
  46.100 +
  46.101 +#else
  46.102 +
  46.103 +struct aiVector2D {
  46.104 +    ai_real x, y;
  46.105 +};
  46.106 +
  46.107 +#endif // __cplusplus
  46.108 +
  46.109 +#endif // AI_VECTOR2D_H_INC
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/include/miniassimp/vector2.inl	Mon Jan 28 18:19:26 2019 +0200
    47.3 @@ -0,0 +1,244 @@
    47.4 +/*
    47.5 +---------------------------------------------------------------------------
    47.6 +Open Asset Import Library (assimp)
    47.7 +---------------------------------------------------------------------------
    47.8 +
    47.9 +Copyright (c) 2006-2018, assimp team
   47.10 +
   47.11 +
   47.12 +
   47.13 +All rights reserved.
   47.14 +
   47.15 +Redistribution and use of this software in source and binary forms,
   47.16 +with or without modification, are permitted provided that the following
   47.17 +conditions are met:
   47.18 +
   47.19 +* Redistributions of source code must retain the above
   47.20 +  copyright notice, this list of conditions and the
   47.21 +  following disclaimer.
   47.22 +
   47.23 +* Redistributions in binary form must reproduce the above
   47.24 +  copyright notice, this list of conditions and the
   47.25 +  following disclaimer in the documentation and/or other
   47.26 +  materials provided with the distribution.
   47.27 +
   47.28 +* Neither the name of the assimp team, nor the names of its
   47.29 +  contributors may be used to endorse or promote products
   47.30 +  derived from this software without specific prior
   47.31 +  written permission of the assimp team.
   47.32 +
   47.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   47.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   47.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   47.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   47.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   47.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   47.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   47.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   47.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   47.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   47.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   47.44 +---------------------------------------------------------------------------
   47.45 +*/
   47.46 +
   47.47 +/** @file  vector2.inl
   47.48 + *  @brief Inline implementation of aiVector2t<TReal> operators
   47.49 + */
   47.50 +#pragma once
   47.51 +#ifndef AI_VECTOR2D_INL_INC
   47.52 +#define AI_VECTOR2D_INL_INC
   47.53 +
   47.54 +#ifdef __cplusplus
   47.55 +#include "vector2.h"
   47.56 +
   47.57 +#include <cmath>
   47.58 +
   47.59 +// ------------------------------------------------------------------------------------------------
   47.60 +template <typename TReal>
   47.61 +template <typename TOther>
   47.62 +aiVector2t<TReal>::operator aiVector2t<TOther> () const {
   47.63 +    return aiVector2t<TOther>(static_cast<TOther>(x),static_cast<TOther>(y));
   47.64 +}
   47.65 +// ------------------------------------------------------------------------------------------------
   47.66 +template <typename TReal>
   47.67 +inline
   47.68 +void aiVector2t<TReal>::Set( TReal pX, TReal pY) {
   47.69 +    x = pX; y = pY;
   47.70 +}
   47.71 +
   47.72 +// ------------------------------------------------------------------------------------------------
   47.73 +template <typename TReal>
   47.74 +inline
   47.75 +TReal aiVector2t<TReal>::SquareLength() const {
   47.76 +    return x*x + y*y;
   47.77 +}
   47.78 +
   47.79 +// ------------------------------------------------------------------------------------------------
   47.80 +template <typename TReal>
   47.81 +inline
   47.82 +TReal aiVector2t<TReal>::Length() const {
   47.83 +    return std::sqrt( SquareLength());
   47.84 +}
   47.85 +
   47.86 +// ------------------------------------------------------------------------------------------------
   47.87 +template <typename TReal>
   47.88 +inline
   47.89 +aiVector2t<TReal>& aiVector2t<TReal>::Normalize() {
   47.90 +    *this /= Length();
   47.91 +    return *this;
   47.92 +}
   47.93 +
   47.94 +// ------------------------------------------------------------------------------------------------
   47.95 +template <typename TReal>
   47.96 +inline
   47.97 +const aiVector2t<TReal>& aiVector2t<TReal>::operator += (const aiVector2t& o) {
   47.98 +    x += o.x; y += o.y;
   47.99 +    return *this;
  47.100 +}
  47.101 +
  47.102 +// ------------------------------------------------------------------------------------------------
  47.103 +template <typename TReal>
  47.104 +inline
  47.105 +const aiVector2t<TReal>& aiVector2t<TReal>::operator -= (const aiVector2t& o) {
  47.106 +    x -= o.x; y -= o.y;
  47.107 +    return *this;
  47.108 +}
  47.109 +
  47.110 +// ------------------------------------------------------------------------------------------------
  47.111 +template <typename TReal>
  47.112 +inline
  47.113 +const aiVector2t<TReal>& aiVector2t<TReal>::operator *= (TReal f) {
  47.114 +    x *= f; y *= f;
  47.115 +    return *this;
  47.116 +}
  47.117 +
  47.118 +// ------------------------------------------------------------------------------------------------
  47.119 +template <typename TReal>
  47.120 +inline
  47.121 +const aiVector2t<TReal>& aiVector2t<TReal>::operator /= (TReal f) {
  47.122 +    x /= f; y /= f;
  47.123 +    return *this;
  47.124 +}
  47.125 +
  47.126 +// ------------------------------------------------------------------------------------------------
  47.127 +template <typename TReal>
  47.128 +inline
  47.129 +TReal aiVector2t<TReal>::operator[](unsigned int i) const {
  47.130 +	switch (i) {
  47.131 +		case 0:
  47.132 +			return x;
  47.133 +		case 1:
  47.134 +			return y;
  47.135 +		default:
  47.136 +			break;
  47.137 +
  47.138 +    }
  47.139 +    return x;
  47.140 +}
  47.141 +
  47.142 +// ------------------------------------------------------------------------------------------------
  47.143 +template <typename TReal>
  47.144 +inline
  47.145 +bool aiVector2t<TReal>::operator== (const aiVector2t& other) const {
  47.146 +    return x == other.x && y == other.y;
  47.147 +}
  47.148 +
  47.149 +// ------------------------------------------------------------------------------------------------
  47.150 +template <typename TReal>
  47.151 +inline
  47.152 +bool aiVector2t<TReal>::operator!= (const aiVector2t& other) const {
  47.153 +    return x != other.x || y != other.y;
  47.154 +}
  47.155 +
  47.156 +// ---------------------------------------------------------------------------
  47.157 +template<typename TReal>
  47.158 +inline
  47.159 +bool aiVector2t<TReal>::Equal(const aiVector2t& other, TReal epsilon) const {
  47.160 +    return
  47.161 +        std::abs(x - other.x) <= epsilon &&
  47.162 +        std::abs(y - other.y) <= epsilon;
  47.163 +}
  47.164 +
  47.165 +// ------------------------------------------------------------------------------------------------
  47.166 +template <typename TReal>
  47.167 +inline
  47.168 +aiVector2t<TReal>& aiVector2t<TReal>::operator= (TReal f)   {
  47.169 +    x = y = f;
  47.170 +    return *this;
  47.171 +}
  47.172 +
  47.173 +// ------------------------------------------------------------------------------------------------
  47.174 +template <typename TReal>
  47.175 +inline
  47.176 +const aiVector2t<TReal> aiVector2t<TReal>::SymMul(const aiVector2t& o) {
  47.177 +    return aiVector2t(x*o.x,y*o.y);
  47.178 +}
  47.179 +
  47.180 +
  47.181 +// ------------------------------------------------------------------------------------------------
  47.182 +// symmetric addition
  47.183 +template <typename TReal>
  47.184 +inline
  47.185 +aiVector2t<TReal> operator + (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2) {
  47.186 +    return aiVector2t<TReal>( v1.x + v2.x, v1.y + v2.y);
  47.187 +}
  47.188 +
  47.189 +// ------------------------------------------------------------------------------------------------
  47.190 +// symmetric subtraction
  47.191 +template <typename TReal>
  47.192 +inline 
  47.193 +aiVector2t<TReal> operator - (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2) {
  47.194 +    return aiVector2t<TReal>( v1.x - v2.x, v1.y - v2.y);
  47.195 +}
  47.196 +
  47.197 +// ------------------------------------------------------------------------------------------------
  47.198 +// scalar product
  47.199 +template <typename TReal>
  47.200 +inline 
  47.201 +TReal operator * (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2) {
  47.202 +    return v1.x*v2.x + v1.y*v2.y;
  47.203 +}
  47.204 +
  47.205 +// ------------------------------------------------------------------------------------------------
  47.206 +// scalar multiplication
  47.207 +template <typename TReal>
  47.208 +inline 
  47.209 +aiVector2t<TReal> operator * ( TReal f, const aiVector2t<TReal>& v) {
  47.210 +    return aiVector2t<TReal>( f*v.x, f*v.y);
  47.211 +}
  47.212 +
  47.213 +// ------------------------------------------------------------------------------------------------
  47.214 +// and the other way around
  47.215 +template <typename TReal>
  47.216 +inline 
  47.217 +aiVector2t<TReal> operator * ( const aiVector2t<TReal>& v, TReal f) {
  47.218 +    return aiVector2t<TReal>( f*v.x, f*v.y);
  47.219 +}
  47.220 +
  47.221 +// ------------------------------------------------------------------------------------------------
  47.222 +// scalar division
  47.223 +template <typename TReal>
  47.224 +inline 
  47.225 +aiVector2t<TReal> operator / ( const aiVector2t<TReal>& v, TReal f) {
  47.226 +    return v * (1/f);
  47.227 +}
  47.228 +
  47.229 +// ------------------------------------------------------------------------------------------------
  47.230 +// vector division
  47.231 +template <typename TReal>
  47.232 +inline 
  47.233 +aiVector2t<TReal> operator / ( const aiVector2t<TReal>& v, const aiVector2t<TReal>& v2) {
  47.234 +    return aiVector2t<TReal>(v.x / v2.x,v.y / v2.y);
  47.235 +}
  47.236 +
  47.237 +// ------------------------------------------------------------------------------------------------
  47.238 +// vector negation
  47.239 +template <typename TReal>
  47.240 +inline 
  47.241 +aiVector2t<TReal> operator - ( const aiVector2t<TReal>& v) {
  47.242 +    return aiVector2t<TReal>( -v.x, -v.y);
  47.243 +}
  47.244 +
  47.245 +#endif
  47.246 +
  47.247 +#endif // AI_VECTOR2D_INL_INC
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/include/miniassimp/vector3.h	Mon Jan 28 18:19:26 2019 +0200
    48.3 @@ -0,0 +1,145 @@
    48.4 +/*
    48.5 +---------------------------------------------------------------------------
    48.6 +Open Asset Import Library (assimp)
    48.7 +---------------------------------------------------------------------------
    48.8 +
    48.9 +Copyright (c) 2006-2018, assimp team
   48.10 +
   48.11 +
   48.12 +
   48.13 +All rights reserved.
   48.14 +
   48.15 +Redistribution and use of this software in source and binary forms,
   48.16 +with or without modification, are permitted provided that the following
   48.17 +conditions are met:
   48.18 +
   48.19 +* Redistributions of source code must retain the above
   48.20 +  copyright notice, this list of conditions and the
   48.21 +  following disclaimer.
   48.22 +
   48.23 +* Redistributions in binary form must reproduce the above
   48.24 +  copyright notice, this list of conditions and the
   48.25 +  following disclaimer in the documentation and/or other
   48.26 +  materials provided with the distribution.
   48.27 +
   48.28 +* Neither the name of the assimp team, nor the names of its
   48.29 +  contributors may be used to endorse or promote products
   48.30 +  derived from this software without specific prior
   48.31 +  written permission of the assimp team.
   48.32 +
   48.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   48.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   48.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   48.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   48.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   48.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   48.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   48.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   48.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   48.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   48.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   48.44 +---------------------------------------------------------------------------
   48.45 +*/
   48.46 +/** @file vector3.h
   48.47 + *  @brief 3D vector structure, including operators when compiling in C++
   48.48 + */
   48.49 +#pragma once
   48.50 +#ifndef AI_VECTOR3D_H_INC
   48.51 +#define AI_VECTOR3D_H_INC
   48.52 +
   48.53 +#ifdef __cplusplus
   48.54 +#   include <cmath>
   48.55 +#else
   48.56 +#   include <math.h>
   48.57 +#endif
   48.58 +
   48.59 +#include "defs.h"
   48.60 +
   48.61 +#ifdef __cplusplus
   48.62 +
   48.63 +template<typename TReal> class aiMatrix3x3t;
   48.64 +template<typename TReal> class aiMatrix4x4t;
   48.65 +
   48.66 +// ---------------------------------------------------------------------------
   48.67 +/** Represents a three-dimensional vector. */
   48.68 +template <typename TReal>
   48.69 +class aiVector3t
   48.70 +{
   48.71 +public:
   48.72 +    aiVector3t() AI_NO_EXCEPT : x(), y(), z() {}
   48.73 +    aiVector3t(TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {}
   48.74 +    explicit aiVector3t (TReal _xyz ) : x(_xyz), y(_xyz), z(_xyz) {}
   48.75 +
   48.76 +public:
   48.77 +
   48.78 +    // combined operators
   48.79 +    const aiVector3t& operator += (const aiVector3t& o);
   48.80 +    const aiVector3t& operator -= (const aiVector3t& o);
   48.81 +    const aiVector3t& operator *= (TReal f);
   48.82 +    const aiVector3t& operator /= (TReal f);
   48.83 +
   48.84 +    // transform vector by matrix
   48.85 +    aiVector3t& operator *= (const aiMatrix3x3t<TReal>& mat);
   48.86 +    aiVector3t& operator *= (const aiMatrix4x4t<TReal>& mat);
   48.87 +
   48.88 +    // access a single element
   48.89 +    TReal operator[](unsigned int i) const;
   48.90 +    TReal& operator[](unsigned int i);
   48.91 +
   48.92 +    // comparison
   48.93 +    bool operator== (const aiVector3t& other) const;
   48.94 +    bool operator!= (const aiVector3t& other) const;
   48.95 +    bool operator < (const aiVector3t& other) const;
   48.96 +
   48.97 +    bool Equal(const aiVector3t& other, TReal epsilon = 1e-6) const;
   48.98 +
   48.99 +    template <typename TOther>
  48.100 +    operator aiVector3t<TOther> () const;
  48.101 +
  48.102 +public:
  48.103 +    /** @brief Set the components of a vector
  48.104 +     *  @param pX X component
  48.105 +     *  @param pY Y component
  48.106 +     *  @param pZ Z component  */
  48.107 +    void Set( TReal pX, TReal pY, TReal pZ);
  48.108 +
  48.109 +    /** @brief Get the squared length of the vector
  48.110 +     *  @return Square length */
  48.111 +    TReal SquareLength() const;
  48.112 +
  48.113 +    /** @brief Get the length of the vector
  48.114 +     *  @return length */
  48.115 +    TReal Length() const;
  48.116 +
  48.117 +
  48.118 +    /** @brief Normalize the vector */
  48.119 +    aiVector3t& Normalize();
  48.120 +
  48.121 +    /** @brief Normalize the vector with extra check for zero vectors */
  48.122 +    aiVector3t& NormalizeSafe();
  48.123 +
  48.124 +    /** @brief Componentwise multiplication of two vectors
  48.125 +     *
  48.126 +     *  Note that vec*vec yields the dot product.
  48.127 +     *  @param o Second factor */
  48.128 +    const aiVector3t SymMul(const aiVector3t& o);
  48.129 +
  48.130 +    TReal x, y, z;
  48.131 +};
  48.132 +
  48.133 +
  48.134 +typedef aiVector3t<ai_real> aiVector3D;
  48.135 +
  48.136 +#else
  48.137 +
  48.138 +struct aiVector3D {
  48.139 +    ai_real x, y, z;
  48.140 +};
  48.141 +
  48.142 +#endif // __cplusplus
  48.143 +
  48.144 +#ifdef __cplusplus
  48.145 +
  48.146 +#endif // __cplusplus
  48.147 +
  48.148 +#endif // AI_VECTOR3D_H_INC
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/include/miniassimp/vector3.inl	Mon Jan 28 18:19:26 2019 +0200
    49.3 @@ -0,0 +1,309 @@
    49.4 +/*
    49.5 +---------------------------------------------------------------------------
    49.6 +Open Asset Import Library (assimp)
    49.7 +---------------------------------------------------------------------------
    49.8 +
    49.9 +Copyright (c) 2006-2018, assimp team
   49.10 +
   49.11 +
   49.12 +
   49.13 +All rights reserved.
   49.14 +
   49.15 +Redistribution and use of this software in source and binary forms,
   49.16 +with or without modification, are permitted provided that the following
   49.17 +conditions are met:
   49.18 +
   49.19 +* Redistributions of source code must retain the above
   49.20 +  copyright notice, this list of conditions and the
   49.21 +  following disclaimer.
   49.22 +
   49.23 +* Redistributions in binary form must reproduce the above
   49.24 +  copyright notice, this list of conditions and the
   49.25 +  following disclaimer in the documentation and/or other
   49.26 +  materials provided with the distribution.
   49.27 +
   49.28 +* Neither the name of the assimp team, nor the names of its
   49.29 +  contributors may be used to endorse or promote products
   49.30 +  derived from this software without specific prior
   49.31 +  written permission of the assimp team.
   49.32 +
   49.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   49.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   49.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   49.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   49.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   49.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   49.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   49.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   49.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   49.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   49.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   49.44 +---------------------------------------------------------------------------
   49.45 +*/
   49.46 +
   49.47 +/** @file  vector3.inl
   49.48 + *  @brief Inline implementation of aiVector3t<TReal> operators
   49.49 + */
   49.50 +#pragma once
   49.51 +#ifndef AI_VECTOR3D_INL_INC
   49.52 +#define AI_VECTOR3D_INL_INC
   49.53 +
   49.54 +#ifdef __cplusplus
   49.55 +#include "vector3.h"
   49.56 +
   49.57 +#include <cmath>
   49.58 +
   49.59 +// ------------------------------------------------------------------------------------------------
   49.60 +/** Transformation of a vector by a 3x3 matrix */
   49.61 +template <typename TReal>
   49.62 +AI_FORCE_INLINE
   49.63 +aiVector3t<TReal> operator * (const aiMatrix3x3t<TReal>& pMatrix, const aiVector3t<TReal>& pVector) {
   49.64 +    aiVector3t<TReal> res;
   49.65 +    res.x = pMatrix.a1 * pVector.x + pMatrix.a2 * pVector.y + pMatrix.a3 * pVector.z;
   49.66 +    res.y = pMatrix.b1 * pVector.x + pMatrix.b2 * pVector.y + pMatrix.b3 * pVector.z;
   49.67 +    res.z = pMatrix.c1 * pVector.x + pMatrix.c2 * pVector.y + pMatrix.c3 * pVector.z;
   49.68 +    return res;
   49.69 +}
   49.70 +
   49.71 +// ------------------------------------------------------------------------------------------------
   49.72 +/** Transformation of a vector by a 4x4 matrix */
   49.73 +template <typename TReal>
   49.74 +AI_FORCE_INLINE
   49.75 +aiVector3t<TReal> operator * (const aiMatrix4x4t<TReal>& pMatrix, const aiVector3t<TReal>& pVector) {
   49.76 +    aiVector3t<TReal> res;
   49.77 +    res.x = pMatrix.a1 * pVector.x + pMatrix.a2 * pVector.y + pMatrix.a3 * pVector.z + pMatrix.a4;
   49.78 +    res.y = pMatrix.b1 * pVector.x + pMatrix.b2 * pVector.y + pMatrix.b3 * pVector.z + pMatrix.b4;
   49.79 +    res.z = pMatrix.c1 * pVector.x + pMatrix.c2 * pVector.y + pMatrix.c3 * pVector.z + pMatrix.c4;
   49.80 +    return res;
   49.81 +}
   49.82 +// ------------------------------------------------------------------------------------------------
   49.83 +template <typename TReal>
   49.84 +template <typename TOther>
   49.85 +aiVector3t<TReal>::operator aiVector3t<TOther> () const {
   49.86 +    return aiVector3t<TOther>(static_cast<TOther>(x),static_cast<TOther>(y),static_cast<TOther>(z));
   49.87 +}
   49.88 +// ------------------------------------------------------------------------------------------------
   49.89 +template <typename TReal>
   49.90 +AI_FORCE_INLINE
   49.91 +void aiVector3t<TReal>::Set( TReal pX, TReal pY, TReal pZ) {
   49.92 +    x = pX;
   49.93 +    y = pY;
   49.94 +    z = pZ;
   49.95 +}
   49.96 +// ------------------------------------------------------------------------------------------------
   49.97 +template <typename TReal>
   49.98 +AI_FORCE_INLINE
   49.99 +TReal aiVector3t<TReal>::SquareLength() const {
  49.100 +    return x*x + y*y + z*z;
  49.101 +}
  49.102 +// ------------------------------------------------------------------------------------------------
  49.103 +template <typename TReal>
  49.104 +AI_FORCE_INLINE
  49.105 +TReal aiVector3t<TReal>::Length() const {
  49.106 +    return std::sqrt( SquareLength());
  49.107 +}
  49.108 +// ------------------------------------------------------------------------------------------------
  49.109 +template <typename TReal>
  49.110 +AI_FORCE_INLINE
  49.111 +aiVector3t<TReal>& aiVector3t<TReal>::Normalize() {
  49.112 +    *this /= Length();
  49.113 +
  49.114 +    return *this;
  49.115 +}
  49.116 +// ------------------------------------------------------------------------------------------------
  49.117 +template <typename TReal>
  49.118 +AI_FORCE_INLINE
  49.119 +aiVector3t<TReal>& aiVector3t<TReal>::NormalizeSafe() {
  49.120 +    TReal len = Length();
  49.121 +    if ( len > static_cast< TReal >( 0 ) ) {
  49.122 +        *this /= len;
  49.123 +    }
  49.124 +    return *this;
  49.125 +}
  49.126 +// ------------------------------------------------------------------------------------------------
  49.127 +template <typename TReal>
  49.128 +AI_FORCE_INLINE
  49.129 +const aiVector3t<TReal>& aiVector3t<TReal>::operator += (const aiVector3t<TReal>& o) {
  49.130 +    x += o.x;
  49.131 +    y += o.y;
  49.132 +    z += o.z;
  49.133 +
  49.134 +    return *this;
  49.135 +}
  49.136 +// ------------------------------------------------------------------------------------------------
  49.137 +template <typename TReal>
  49.138 +AI_FORCE_INLINE
  49.139 +const aiVector3t<TReal>& aiVector3t<TReal>::operator -= (const aiVector3t<TReal>& o) {
  49.140 +    x -= o.x;
  49.141 +    y -= o.y;
  49.142 +    z -= o.z;
  49.143 +
  49.144 +    return *this;
  49.145 +}
  49.146 +// ------------------------------------------------------------------------------------------------
  49.147 +template <typename TReal>
  49.148 +AI_FORCE_INLINE
  49.149 +const aiVector3t<TReal>& aiVector3t<TReal>::operator *= (TReal f) {
  49.150 +    x *= f;
  49.151 +    y *= f;
  49.152 +    z *= f;
  49.153 +
  49.154 +    return *this;
  49.155 +}
  49.156 +// ------------------------------------------------------------------------------------------------
  49.157 +template <typename TReal>
  49.158 +AI_FORCE_INLINE
  49.159 +const aiVector3t<TReal>& aiVector3t<TReal>::operator /= (TReal f) {
  49.160 +    const TReal invF = (TReal) 1.0 / f;
  49.161 +    x *= invF;
  49.162 +    y *= invF;
  49.163 +    z *= invF;
  49.164 +
  49.165 +    return *this;
  49.166 +}
  49.167 +// ------------------------------------------------------------------------------------------------
  49.168 +template <typename TReal>
  49.169 +AI_FORCE_INLINE
  49.170 +aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatrix3x3t<TReal>& mat){
  49.171 +    return (*this =  mat * (*this));
  49.172 +}
  49.173 +// ------------------------------------------------------------------------------------------------
  49.174 +template <typename TReal>
  49.175 +AI_FORCE_INLINE
  49.176 +aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatrix4x4t<TReal>& mat){
  49.177 +    return (*this = mat * (*this));
  49.178 +}
  49.179 +// ------------------------------------------------------------------------------------------------
  49.180 +template <typename TReal>
  49.181 +AI_FORCE_INLINE
  49.182 +TReal aiVector3t<TReal>::operator[](unsigned int i) const {
  49.183 +    switch (i) {
  49.184 +        case 0:
  49.185 +            return x;
  49.186 +        case 1:
  49.187 +            return y;
  49.188 +        case 2:
  49.189 +            return z;
  49.190 +        default:
  49.191 +            break;
  49.192 +    }
  49.193 +    return x;
  49.194 +}
  49.195 +// ------------------------------------------------------------------------------------------------
  49.196 +template <typename TReal>
  49.197 +AI_FORCE_INLINE
  49.198 +TReal& aiVector3t<TReal>::operator[](unsigned int i) {
  49.199 +//    return *(&x + i);
  49.200 +    switch (i) {
  49.201 +        case 0:
  49.202 +            return x;
  49.203 +        case 1:
  49.204 +            return y;
  49.205 +        case 2:
  49.206 +            return z;
  49.207 +        default:
  49.208 +            break;
  49.209 +    }
  49.210 +    return x;
  49.211 +}
  49.212 +// ------------------------------------------------------------------------------------------------
  49.213 +template <typename TReal>
  49.214 +AI_FORCE_INLINE
  49.215 +bool aiVector3t<TReal>::operator== (const aiVector3t<TReal>& other) const {
  49.216 +    return x == other.x && y == other.y && z == other.z;
  49.217 +}
  49.218 +// ------------------------------------------------------------------------------------------------
  49.219 +template <typename TReal>
  49.220 +AI_FORCE_INLINE
  49.221 +bool aiVector3t<TReal>::operator!= (const aiVector3t<TReal>& other) const {
  49.222 +    return x != other.x || y != other.y || z != other.z;
  49.223 +}
  49.224 +// ---------------------------------------------------------------------------
  49.225 +template<typename TReal>
  49.226 +AI_FORCE_INLINE
  49.227 +bool aiVector3t<TReal>::Equal(const aiVector3t<TReal>& other, TReal epsilon) const {
  49.228 +    return
  49.229 +        std::abs(x - other.x) <= epsilon &&
  49.230 +        std::abs(y - other.y) <= epsilon &&
  49.231 +        std::abs(z - other.z) <= epsilon;
  49.232 +}
  49.233 +// ------------------------------------------------------------------------------------------------
  49.234 +template <typename TReal>
  49.235 +AI_FORCE_INLINE
  49.236 +bool aiVector3t<TReal>::operator < (const aiVector3t<TReal>& other) const {
  49.237 +    return x != other.x ? x < other.x : y != other.y ? y < other.y : z < other.z;
  49.238 +}
  49.239 +// ------------------------------------------------------------------------------------------------
  49.240 +template <typename TReal>
  49.241 +AI_FORCE_INLINE
  49.242 +const aiVector3t<TReal> aiVector3t<TReal>::SymMul(const aiVector3t<TReal>& o) {
  49.243 +    return aiVector3t<TReal>(x*o.x,y*o.y,z*o.z);
  49.244 +}
  49.245 +// ------------------------------------------------------------------------------------------------
  49.246 +// symmetric addition
  49.247 +template <typename TReal>
  49.248 +AI_FORCE_INLINE
  49.249 +aiVector3t<TReal> operator + (const aiVector3t<TReal>& v1, const aiVector3t<TReal>& v2) {
  49.250 +    return aiVector3t<TReal>( v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
  49.251 +}
  49.252 +// ------------------------------------------------------------------------------------------------
  49.253 +// symmetric subtraction
  49.254 +template <typename TReal>
  49.255 +AI_FORCE_INLINE
  49.256 +aiVector3t<TReal> operator - (const aiVector3t<TReal>& v1, const aiVector3t<TReal>& v2) {
  49.257 +    return aiVector3t<TReal>( v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
  49.258 +}
  49.259 +// ------------------------------------------------------------------------------------------------
  49.260 +// scalar product
  49.261 +template <typename TReal>
  49.262 +AI_FORCE_INLINE
  49.263 +TReal operator * (const aiVector3t<TReal>& v1, const aiVector3t<TReal>& v2) {
  49.264 +    return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
  49.265 +}
  49.266 +// ------------------------------------------------------------------------------------------------
  49.267 +// scalar multiplication
  49.268 +template <typename TReal>
  49.269 +AI_FORCE_INLINE
  49.270 +aiVector3t<TReal> operator * ( TReal f, const aiVector3t<TReal>& v) {
  49.271 +    return aiVector3t<TReal>( f*v.x, f*v.y, f*v.z);
  49.272 +}
  49.273 +// ------------------------------------------------------------------------------------------------
  49.274 +// and the other way around
  49.275 +template <typename TReal>
  49.276 +AI_FORCE_INLINE
  49.277 +aiVector3t<TReal> operator * ( const aiVector3t<TReal>& v, TReal f) {
  49.278 +    return aiVector3t<TReal>( f*v.x, f*v.y, f*v.z);
  49.279 +}
  49.280 +// ------------------------------------------------------------------------------------------------
  49.281 +// scalar division
  49.282 +template <typename TReal>
  49.283 +AI_FORCE_INLINE
  49.284 +aiVector3t<TReal> operator / ( const aiVector3t<TReal>& v, TReal f) {
  49.285 +    return v * (1/f);
  49.286 +}
  49.287 +// ------------------------------------------------------------------------------------------------
  49.288 +// vector division
  49.289 +template <typename TReal>
  49.290 +AI_FORCE_INLINE
  49.291 +aiVector3t<TReal> operator / ( const aiVector3t<TReal>& v, const aiVector3t<TReal>& v2) {
  49.292 +    return aiVector3t<TReal>(v.x / v2.x,v.y / v2.y,v.z / v2.z);
  49.293 +}
  49.294 +// ------------------------------------------------------------------------------------------------
  49.295 +// cross product
  49.296 +template<typename TReal>
  49.297 +AI_FORCE_INLINE
  49.298 +aiVector3t<TReal> operator ^ ( const aiVector3t<TReal>& v1, const aiVector3t<TReal>& v2) {
  49.299 +    return aiVector3t<TReal>( v1.y*v2.z - v1.z*v2.y, v1.z*v2.x - v1.x*v2.z, v1.x*v2.y - v1.y*v2.x);
  49.300 +}
  49.301 +// ------------------------------------------------------------------------------------------------
  49.302 +// vector negation
  49.303 +template<typename TReal>
  49.304 +AI_FORCE_INLINE
  49.305 +aiVector3t<TReal> operator - ( const aiVector3t<TReal>& v) {
  49.306 +    return aiVector3t<TReal>( -v.x, -v.y, -v.z);
  49.307 +}
  49.308 +
  49.309 +// ------------------------------------------------------------------------------------------------
  49.310 +
  49.311 +#endif // __cplusplus
  49.312 +#endif // AI_VECTOR3D_INL_INC
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/src/Assimp.cpp	Mon Jan 28 18:19:26 2019 +0200
    50.3 @@ -0,0 +1,695 @@
    50.4 +/*
    50.5 +---------------------------------------------------------------------------
    50.6 +Open Asset Import Library (assimp)
    50.7 +---------------------------------------------------------------------------
    50.8 +
    50.9 +Copyright (c) 2006-2018, assimp team
   50.10 +
   50.11 +
   50.12 +
   50.13 +All rights reserved.
   50.14 +
   50.15 +Redistribution and use of this software in source and binary forms,
   50.16 +with or without modification, are permitted provided that the following
   50.17 +conditions are met:
   50.18 +
   50.19 +* Redistributions of source code must retain the above
   50.20 +  copyright notice, this list of conditions and the
   50.21 +  following disclaimer.
   50.22 +
   50.23 +* Redistributions in binary form must reproduce the above
   50.24 +  copyright notice, this list of conditions and the
   50.25 +  following disclaimer in the documentation and/or other
   50.26 +  materials provided with the distribution.
   50.27 +
   50.28 +* Neither the name of the assimp team, nor the names of its
   50.29 +  contributors may be used to endorse or promote products
   50.30 +  derived from this software without specific prior
   50.31 +  written permission of the assimp team.
   50.32 +
   50.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   50.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   50.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   50.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   50.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   50.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   50.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   50.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   50.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   50.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   50.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   50.44 +---------------------------------------------------------------------------
   50.45 +*/
   50.46 +/** @file  Assimp.cpp
   50.47 + *  @brief Implementation of the Plain-C API
   50.48 + */
   50.49 +
   50.50 +#include <miniassimp/cimport.h>
   50.51 +#include <miniassimp/LogStream.hpp>
   50.52 +#include <miniassimp/DefaultLogger.hpp>
   50.53 +#include <miniassimp/Importer.hpp>
   50.54 +#include <miniassimp/importerdesc.h>
   50.55 +#include <miniassimp/scene.h>
   50.56 +#include <miniassimp/GenericProperty.h>
   50.57 +#include <miniassimp/Exceptional.h>
   50.58 +#include <miniassimp/BaseImporter.h>
   50.59 +
   50.60 +#include "CInterfaceIOWrapper.h"
   50.61 +#include "Importer.h"
   50.62 +#include "ScenePrivate.h"
   50.63 +
   50.64 +#include <list>
   50.65 +
   50.66 +// ------------------------------------------------------------------------------------------------
   50.67 +#ifndef ASSIMP_BUILD_SINGLETHREADED
   50.68 +#   include <thread>
   50.69 +#   include <mutex>
   50.70 +#endif
   50.71 +// ------------------------------------------------------------------------------------------------
   50.72 +using namespace Assimp;
   50.73 +
   50.74 +namespace Assimp {
   50.75 +    // underlying structure for aiPropertyStore
   50.76 +    typedef BatchLoader::PropertyMap PropertyMap;
   50.77 +
   50.78 +    /** Stores the LogStream objects for all active C log streams */
   50.79 +    struct mpred {
   50.80 +        bool operator  () (const aiLogStream& s0, const aiLogStream& s1) const  {
   50.81 +            return s0.callback<s1.callback&&s0.user<s1.user;
   50.82 +        }
   50.83 +    };
   50.84 +    typedef std::map<aiLogStream, Assimp::LogStream*, mpred> LogStreamMap;
   50.85 +
   50.86 +    /** Stores the LogStream objects allocated by #aiGetPredefinedLogStream */
   50.87 +    typedef std::list<Assimp::LogStream*> PredefLogStreamMap;
   50.88 +
   50.89 +    /** Local storage of all active log streams */
   50.90 +    static LogStreamMap gActiveLogStreams;
   50.91 +
   50.92 +    /** Local storage of LogStreams allocated by #aiGetPredefinedLogStream */
   50.93 +    static PredefLogStreamMap gPredefinedStreams;
   50.94 +
   50.95 +    /** Error message of the last failed import process */
   50.96 +    static std::string gLastErrorString;
   50.97 +
   50.98 +    /** Verbose logging active or not? */
   50.99 +    static aiBool gVerboseLogging = false;
  50.100 +
  50.101 +    /** will return all registered importers. */
  50.102 +    void GetImporterInstanceList(std::vector< BaseImporter* >& out);
  50.103 +
  50.104 +    /** will delete all registered importers. */
  50.105 +    void DeleteImporterInstanceList(std::vector< BaseImporter* >& out);
  50.106 +} // namespace assimp
  50.107 +
  50.108 +
  50.109 +#ifndef ASSIMP_BUILD_SINGLETHREADED
  50.110 +/** Global mutex to manage the access to the log-stream map */
  50.111 +static std::mutex gLogStreamMutex;
  50.112 +#endif
  50.113 +
  50.114 +// ------------------------------------------------------------------------------------------------
  50.115 +// Custom LogStream implementation for the C-API
  50.116 +class LogToCallbackRedirector : public LogStream {
  50.117 +public:
  50.118 +    explicit LogToCallbackRedirector(const aiLogStream& s)
  50.119 +    : stream (s)    {
  50.120 +        ai_assert(NULL != s.callback);
  50.121 +    }
  50.122 +
  50.123 +    ~LogToCallbackRedirector()  {
  50.124 +#ifndef ASSIMP_BUILD_SINGLETHREADED
  50.125 +        std::lock_guard<std::mutex> lock(gLogStreamMutex);
  50.126 +#endif
  50.127 +        // (HACK) Check whether the 'stream.user' pointer points to a
  50.128 +        // custom LogStream allocated by #aiGetPredefinedLogStream.
  50.129 +        // In this case, we need to delete it, too. Of course, this
  50.130 +        // might cause strange problems, but the chance is quite low.
  50.131 +
  50.132 +        PredefLogStreamMap::iterator it = std::find(gPredefinedStreams.begin(),
  50.133 +            gPredefinedStreams.end(), (Assimp::LogStream*)stream.user);
  50.134 +
  50.135 +        if (it != gPredefinedStreams.end()) {
  50.136 +            delete *it;
  50.137 +            gPredefinedStreams.erase(it);
  50.138 +        }
  50.139 +    }
  50.140 +
  50.141 +    /** @copydoc LogStream::write */
  50.142 +    void write(const char* message) {
  50.143 +        stream.callback(message,stream.user);
  50.144 +    }
  50.145 +
  50.146 +private:
  50.147 +    aiLogStream stream;
  50.148 +};
  50.149 +
  50.150 +// ------------------------------------------------------------------------------------------------
  50.151 +void ReportSceneNotFoundError() {
  50.152 +    ASSIMP_LOG_ERROR("Unable to find the Assimp::Importer for this aiScene. "
  50.153 +        "The C-API does not accept scenes produced by the C++ API and vice versa");
  50.154 +
  50.155 +    ai_assert(false);
  50.156 +}
  50.157 +
  50.158 +// ------------------------------------------------------------------------------------------------
  50.159 +// Reads the given file and returns its content.
  50.160 +const aiScene* aiImportFile( const char* pFile, unsigned int pFlags) {
  50.161 +    return aiImportFileEx(pFile,pFlags,NULL);
  50.162 +}
  50.163 +
  50.164 +// ------------------------------------------------------------------------------------------------
  50.165 +const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags,  aiFileIO* pFS) {
  50.166 +    return aiImportFileExWithProperties(pFile, pFlags, pFS, NULL);
  50.167 +}
  50.168 +
  50.169 +// ------------------------------------------------------------------------------------------------
  50.170 +const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags, 
  50.171 +        aiFileIO* pFS, const aiPropertyStore* props) {
  50.172 +    ai_assert(NULL != pFile);
  50.173 +
  50.174 +    const aiScene* scene = NULL;
  50.175 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.176 +
  50.177 +    // create an Importer for this file
  50.178 +    Assimp::Importer* imp = new Assimp::Importer();
  50.179 +
  50.180 +    // copy properties
  50.181 +    if(props) {
  50.182 +        const PropertyMap* pp = reinterpret_cast<const PropertyMap*>(props);
  50.183 +        ImporterPimpl* pimpl = imp->Pimpl();
  50.184 +        pimpl->mIntProperties = pp->ints;
  50.185 +        pimpl->mFloatProperties = pp->floats;
  50.186 +        pimpl->mStringProperties = pp->strings;
  50.187 +        pimpl->mMatrixProperties = pp->matrices;
  50.188 +    }
  50.189 +    // setup a custom IO system if necessary
  50.190 +    if (pFS) {
  50.191 +        imp->SetIOHandler( new CIOSystemWrapper (pFS) );
  50.192 +    }
  50.193 +
  50.194 +    // and have it read the file
  50.195 +    scene = imp->ReadFile( pFile, pFlags);
  50.196 +
  50.197 +    // if succeeded, store the importer in the scene and keep it alive
  50.198 +    if( scene)  {
  50.199 +        ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) );
  50.200 +        priv->mOrigImporter = imp;
  50.201 +    } else {
  50.202 +        // if failed, extract error code and destroy the import
  50.203 +        gLastErrorString = imp->GetErrorString();
  50.204 +        delete imp;
  50.205 +    }
  50.206 +
  50.207 +    // return imported data. If the import failed the pointer is NULL anyways
  50.208 +    ASSIMP_END_EXCEPTION_REGION(const aiScene*);
  50.209 +    
  50.210 +    return scene;
  50.211 +}
  50.212 +
  50.213 +// ------------------------------------------------------------------------------------------------
  50.214 +const aiScene* aiImportFileFromMemory(
  50.215 +    const char* pBuffer,
  50.216 +    unsigned int pLength,
  50.217 +    unsigned int pFlags,
  50.218 +    const char* pHint)
  50.219 +{
  50.220 +    return aiImportFileFromMemoryWithProperties(pBuffer, pLength, pFlags, pHint, NULL);
  50.221 +}
  50.222 +
  50.223 +// ------------------------------------------------------------------------------------------------
  50.224 +const aiScene* aiImportFileFromMemoryWithProperties(
  50.225 +    const char* pBuffer,
  50.226 +    unsigned int pLength,
  50.227 +    unsigned int pFlags,
  50.228 +    const char* pHint,
  50.229 +    const aiPropertyStore* props)
  50.230 +{
  50.231 +    ai_assert( NULL != pBuffer );
  50.232 +    ai_assert( 0 != pLength );
  50.233 +
  50.234 +    const aiScene* scene = NULL;
  50.235 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.236 +
  50.237 +    // create an Importer for this file
  50.238 +    Assimp::Importer* imp = new Assimp::Importer();
  50.239 +
  50.240 +    // copy properties
  50.241 +    if(props) {
  50.242 +        const PropertyMap* pp = reinterpret_cast<const PropertyMap*>(props);
  50.243 +        ImporterPimpl* pimpl = imp->Pimpl();
  50.244 +        pimpl->mIntProperties = pp->ints;
  50.245 +        pimpl->mFloatProperties = pp->floats;
  50.246 +        pimpl->mStringProperties = pp->strings;
  50.247 +        pimpl->mMatrixProperties = pp->matrices;
  50.248 +    }
  50.249 +
  50.250 +    // and have it read the file from the memory buffer
  50.251 +    scene = imp->ReadFileFromMemory( pBuffer, pLength, pFlags,pHint);
  50.252 +
  50.253 +    // if succeeded, store the importer in the scene and keep it alive
  50.254 +    if( scene)  {
  50.255 +         ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) );
  50.256 +         priv->mOrigImporter = imp;
  50.257 +    }
  50.258 +    else    {
  50.259 +        // if failed, extract error code and destroy the import
  50.260 +        gLastErrorString = imp->GetErrorString();
  50.261 +        delete imp;
  50.262 +    }
  50.263 +    // return imported data. If the import failed the pointer is NULL anyways
  50.264 +    ASSIMP_END_EXCEPTION_REGION(const aiScene*);
  50.265 +    return scene;
  50.266 +}
  50.267 +
  50.268 +// ------------------------------------------------------------------------------------------------
  50.269 +// Releases all resources associated with the given import process.
  50.270 +void aiReleaseImport( const aiScene* pScene)
  50.271 +{
  50.272 +    if (!pScene) {
  50.273 +        return;
  50.274 +    }
  50.275 +
  50.276 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.277 +
  50.278 +    // find the importer associated with this data
  50.279 +    const ScenePrivateData* priv = ScenePriv(pScene);
  50.280 +    if( !priv || !priv->mOrigImporter)  {
  50.281 +        delete pScene;
  50.282 +    }
  50.283 +    else {
  50.284 +        // deleting the Importer also deletes the scene
  50.285 +        // Note: the reason that this is not written as 'delete priv->mOrigImporter'
  50.286 +        // is a suspected bug in gcc 4.4+ (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52339)
  50.287 +        Importer* importer = priv->mOrigImporter;
  50.288 +        delete importer;
  50.289 +    }
  50.290 +
  50.291 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.292 +}
  50.293 +
  50.294 +// ------------------------------------------------------------------------------------------------
  50.295 +ASSIMP_API const aiScene* aiApplyPostProcessing(const aiScene* pScene,
  50.296 +    unsigned int pFlags)
  50.297 +{
  50.298 +    const aiScene* sc = NULL;
  50.299 +
  50.300 +
  50.301 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.302 +
  50.303 +    // find the importer associated with this data
  50.304 +    const ScenePrivateData* priv = ScenePriv(pScene);
  50.305 +    if( !priv || !priv->mOrigImporter)  {
  50.306 +        ReportSceneNotFoundError();
  50.307 +        return NULL;
  50.308 +    }
  50.309 +
  50.310 +    sc = priv->mOrigImporter->ApplyPostProcessing(pFlags);
  50.311 +
  50.312 +    if (!sc) {
  50.313 +        aiReleaseImport(pScene);
  50.314 +        return NULL;
  50.315 +    }
  50.316 +
  50.317 +    ASSIMP_END_EXCEPTION_REGION(const aiScene*);
  50.318 +    return sc;
  50.319 +}
  50.320 +
  50.321 +// ------------------------------------------------------------------------------------------------
  50.322 +ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene,
  50.323 +                                                           BaseProcess* process,
  50.324 +                                                           bool requestValidation ) {
  50.325 +    const aiScene* sc( NULL );
  50.326 +
  50.327 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.328 +
  50.329 +    // find the importer associated with this data
  50.330 +    const ScenePrivateData* priv = ScenePriv( scene );
  50.331 +    if ( NULL == priv || NULL == priv->mOrigImporter ) {
  50.332 +        ReportSceneNotFoundError();
  50.333 +        return NULL;
  50.334 +    }
  50.335 +
  50.336 +    sc = priv->mOrigImporter->ApplyCustomizedPostProcessing( process, requestValidation );
  50.337 +
  50.338 +    if ( !sc ) {
  50.339 +        aiReleaseImport( scene );
  50.340 +        return NULL;
  50.341 +    }
  50.342 +
  50.343 +    ASSIMP_END_EXCEPTION_REGION( const aiScene* );
  50.344 +
  50.345 +    return sc;
  50.346 +}
  50.347 +
  50.348 +// ------------------------------------------------------------------------------------------------
  50.349 +void CallbackToLogRedirector (const char* msg, char* dt)
  50.350 +{
  50.351 +    ai_assert( NULL != msg );
  50.352 +    ai_assert( NULL != dt );
  50.353 +    LogStream* s = (LogStream*)dt;
  50.354 +
  50.355 +    s->write(msg);
  50.356 +}
  50.357 +
  50.358 +// ------------------------------------------------------------------------------------------------
  50.359 +ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const char* file)
  50.360 +{
  50.361 +    aiLogStream sout;
  50.362 +
  50.363 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.364 +    LogStream* stream = LogStream::createDefaultStream(pStream,file);
  50.365 +    if (!stream) {
  50.366 +        sout.callback = NULL;
  50.367 +        sout.user = NULL;
  50.368 +    }
  50.369 +    else {
  50.370 +        sout.callback = &CallbackToLogRedirector;
  50.371 +        sout.user = (char*)stream;
  50.372 +    }
  50.373 +    gPredefinedStreams.push_back(stream);
  50.374 +    ASSIMP_END_EXCEPTION_REGION(aiLogStream);
  50.375 +    return sout;
  50.376 +}
  50.377 +
  50.378 +// ------------------------------------------------------------------------------------------------
  50.379 +ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
  50.380 +{
  50.381 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.382 +
  50.383 +#ifndef ASSIMP_BUILD_SINGLETHREADED
  50.384 +    std::lock_guard<std::mutex> lock(gLogStreamMutex);
  50.385 +#endif
  50.386 +
  50.387 +    LogStream* lg = new LogToCallbackRedirector(*stream);
  50.388 +    gActiveLogStreams[*stream] = lg;
  50.389 +
  50.390 +    if (DefaultLogger::isNullLogger()) {
  50.391 +        DefaultLogger::create(NULL,(gVerboseLogging == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
  50.392 +    }
  50.393 +    DefaultLogger::get()->attachStream(lg);
  50.394 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.395 +}
  50.396 +
  50.397 +// ------------------------------------------------------------------------------------------------
  50.398 +ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
  50.399 +{
  50.400 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.401 +
  50.402 +#ifndef ASSIMP_BUILD_SINGLETHREADED
  50.403 +    std::lock_guard<std::mutex> lock(gLogStreamMutex);
  50.404 +#endif
  50.405 +    // find the log-stream associated with this data
  50.406 +    LogStreamMap::iterator it = gActiveLogStreams.find( *stream);
  50.407 +    // it should be there... else the user is playing fools with us
  50.408 +    if( it == gActiveLogStreams.end())  {
  50.409 +        return AI_FAILURE;
  50.410 +    }
  50.411 +    DefaultLogger::get()->detatchStream( it->second );
  50.412 +    delete it->second;
  50.413 +
  50.414 +    gActiveLogStreams.erase( it);
  50.415 +
  50.416 +    if (gActiveLogStreams.empty()) {
  50.417 +        DefaultLogger::kill();
  50.418 +    }
  50.419 +    ASSIMP_END_EXCEPTION_REGION(aiReturn);
  50.420 +    return AI_SUCCESS;
  50.421 +}
  50.422 +
  50.423 +// ------------------------------------------------------------------------------------------------
  50.424 +ASSIMP_API void aiDetachAllLogStreams(void)
  50.425 +{
  50.426 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.427 +#ifndef ASSIMP_BUILD_SINGLETHREADED
  50.428 +    std::lock_guard<std::mutex> lock(gLogStreamMutex);
  50.429 +#endif
  50.430 +    Logger *logger( DefaultLogger::get() );
  50.431 +    if ( NULL == logger ) {
  50.432 +        return;
  50.433 +    }
  50.434 +
  50.435 +    for (LogStreamMap::iterator it = gActiveLogStreams.begin(); it != gActiveLogStreams.end(); ++it) {
  50.436 +        logger->detatchStream( it->second );
  50.437 +        delete it->second;
  50.438 +    }
  50.439 +    gActiveLogStreams.clear();
  50.440 +    DefaultLogger::kill();
  50.441 +
  50.442 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.443 +}
  50.444 +
  50.445 +// ------------------------------------------------------------------------------------------------
  50.446 +ASSIMP_API void aiEnableVerboseLogging(aiBool d)
  50.447 +{
  50.448 +    if (!DefaultLogger::isNullLogger()) {
  50.449 +        DefaultLogger::get()->setLogSeverity((d == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
  50.450 +    }
  50.451 +    gVerboseLogging = d;
  50.452 +}
  50.453 +
  50.454 +// ------------------------------------------------------------------------------------------------
  50.455 +// Returns the error text of the last failed import process.
  50.456 +const char* aiGetErrorString()
  50.457 +{
  50.458 +    return gLastErrorString.c_str();
  50.459 +}
  50.460 +
  50.461 +// -----------------------------------------------------------------------------------------------
  50.462 +// Return the description of a importer given its index
  50.463 +const aiImporterDesc* aiGetImportFormatDescription( size_t pIndex)
  50.464 +{
  50.465 +    return Importer().GetImporterInfo(pIndex);
  50.466 +}
  50.467 +
  50.468 +// -----------------------------------------------------------------------------------------------
  50.469 +// Return the number of importers
  50.470 +size_t aiGetImportFormatCount(void)
  50.471 +{
  50.472 +    return Importer().GetImporterCount();
  50.473 +}
  50.474 +
  50.475 +// ------------------------------------------------------------------------------------------------
  50.476 +// Returns the error text of the last failed import process.
  50.477 +aiBool aiIsExtensionSupported(const char* szExtension)
  50.478 +{
  50.479 +    ai_assert(NULL != szExtension);
  50.480 +    aiBool candoit=AI_FALSE;
  50.481 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.482 +
  50.483 +    // FIXME: no need to create a temporary Importer instance just for that ..
  50.484 +    Assimp::Importer tmp;
  50.485 +    candoit = tmp.IsExtensionSupported(std::string(szExtension)) ? AI_TRUE : AI_FALSE;
  50.486 +
  50.487 +    ASSIMP_END_EXCEPTION_REGION(aiBool);
  50.488 +    return candoit;
  50.489 +}
  50.490 +
  50.491 +// ------------------------------------------------------------------------------------------------
  50.492 +// Get a list of all file extensions supported by ASSIMP
  50.493 +void aiGetExtensionList(aiString* szOut)
  50.494 +{
  50.495 +    ai_assert(NULL != szOut);
  50.496 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.497 +
  50.498 +    // FIXME: no need to create a temporary Importer instance just for that ..
  50.499 +    Assimp::Importer tmp;
  50.500 +    tmp.GetExtensionList(*szOut);
  50.501 +
  50.502 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.503 +}
  50.504 +
  50.505 +// ------------------------------------------------------------------------------------------------
  50.506 +// Get the memory requirements for a particular import.
  50.507 +void aiGetMemoryRequirements(const C_STRUCT aiScene* pIn,
  50.508 +    C_STRUCT aiMemoryInfo* in)
  50.509 +{
  50.510 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.511 +
  50.512 +    // find the importer associated with this data
  50.513 +    const ScenePrivateData* priv = ScenePriv(pIn);
  50.514 +    if( !priv || !priv->mOrigImporter)  {
  50.515 +        ReportSceneNotFoundError();
  50.516 +        return;
  50.517 +    }
  50.518 +
  50.519 +    return priv->mOrigImporter->GetMemoryRequirements(*in);
  50.520 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.521 +}
  50.522 +
  50.523 +// ------------------------------------------------------------------------------------------------
  50.524 +ASSIMP_API aiPropertyStore* aiCreatePropertyStore(void)
  50.525 +{
  50.526 +    return reinterpret_cast<aiPropertyStore*>( new PropertyMap() );
  50.527 +}
  50.528 +
  50.529 +// ------------------------------------------------------------------------------------------------
  50.530 +ASSIMP_API void aiReleasePropertyStore(aiPropertyStore* p)
  50.531 +{
  50.532 +    delete reinterpret_cast<PropertyMap*>(p);
  50.533 +}
  50.534 +
  50.535 +// ------------------------------------------------------------------------------------------------
  50.536 +// Importer::SetPropertyInteger
  50.537 +ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szName, int value)
  50.538 +{
  50.539 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.540 +    PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
  50.541 +    SetGenericProperty<int>(pp->ints,szName,value);
  50.542 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.543 +}
  50.544 +
  50.545 +// ------------------------------------------------------------------------------------------------
  50.546 +// Importer::SetPropertyFloat
  50.547 +ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, ai_real value)
  50.548 +{
  50.549 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.550 +    PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
  50.551 +    SetGenericProperty<ai_real>(pp->floats,szName,value);
  50.552 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.553 +}
  50.554 +
  50.555 +// ------------------------------------------------------------------------------------------------
  50.556 +// Importer::SetPropertyString
  50.557 +ASSIMP_API void aiSetImportPropertyString(aiPropertyStore* p, const char* szName,
  50.558 +    const C_STRUCT aiString* st)
  50.559 +{
  50.560 +    if (!st) {
  50.561 +        return;
  50.562 +    }
  50.563 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.564 +    PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
  50.565 +    SetGenericProperty<std::string>(pp->strings,szName,std::string(st->C_Str()));
  50.566 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.567 +}
  50.568 +
  50.569 +// ------------------------------------------------------------------------------------------------
  50.570 +// Importer::SetPropertyMatrix
  50.571 +ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore* p, const char* szName,
  50.572 +    const C_STRUCT aiMatrix4x4* mat)
  50.573 +{
  50.574 +    if (!mat) {
  50.575 +        return;
  50.576 +    }
  50.577 +    ASSIMP_BEGIN_EXCEPTION_REGION();
  50.578 +    PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
  50.579 +    SetGenericProperty<aiMatrix4x4>(pp->matrices,szName,*mat);
  50.580 +    ASSIMP_END_EXCEPTION_REGION(void);
  50.581 +}
  50.582 +
  50.583 +// ------------------------------------------------------------------------------------------------
  50.584 +// Rotation matrix to quaternion
  50.585 +ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
  50.586 +{
  50.587 +    ai_assert( NULL != quat );
  50.588 +    ai_assert( NULL != mat );
  50.589 +    *quat = aiQuaternion(*mat);
  50.590 +}
  50.591 +
  50.592 +// ------------------------------------------------------------------------------------------------
  50.593 +// Matrix decomposition
  50.594 +ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4* mat,aiVector3D* scaling,
  50.595 +    aiQuaternion* rotation,
  50.596 +    aiVector3D* position)
  50.597 +{
  50.598 +    ai_assert( NULL != rotation );
  50.599 +    ai_assert( NULL != position );
  50.600 +    ai_assert( NULL != scaling );
  50.601 +    ai_assert( NULL != mat );
  50.602 +    mat->Decompose(*scaling,*rotation,*position);
  50.603 +}
  50.604 +
  50.605 +// ------------------------------------------------------------------------------------------------
  50.606 +// Matrix transpose
  50.607 +ASSIMP_API void aiTransposeMatrix3(aiMatrix3x3* mat)
  50.608 +{
  50.609 +    ai_assert(NULL != mat);
  50.610 +    mat->Transpose();
  50.611 +}
  50.612 +
  50.613 +// ------------------------------------------------------------------------------------------------
  50.614 +ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
  50.615 +{
  50.616 +    ai_assert(NULL != mat);
  50.617 +    mat->Transpose();
  50.618 +}
  50.619 +
  50.620 +// ------------------------------------------------------------------------------------------------
  50.621 +// Vector transformation
  50.622 +ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
  50.623 +    const aiMatrix3x3* mat)
  50.624 +{
  50.625 +    ai_assert( NULL != mat );
  50.626 +    ai_assert( NULL != vec);
  50.627 +    *vec *= (*mat);
  50.628 +}
  50.629 +
  50.630 +// ------------------------------------------------------------------------------------------------
  50.631 +ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec,
  50.632 +    const aiMatrix4x4* mat)
  50.633 +{
  50.634 +    ai_assert( NULL != mat );
  50.635 +    ai_assert( NULL != vec );
  50.636 +
  50.637 +    *vec *= (*mat);
  50.638 +}
  50.639 +
  50.640 +// ------------------------------------------------------------------------------------------------
  50.641 +// Matrix multiplication
  50.642 +ASSIMP_API void aiMultiplyMatrix4(
  50.643 +    aiMatrix4x4* dst,
  50.644 +    const aiMatrix4x4* src)
  50.645 +{
  50.646 +    ai_assert( NULL != dst );
  50.647 +    ai_assert( NULL != src );
  50.648 +    *dst = (*dst) * (*src);
  50.649 +}
  50.650 +
  50.651 +// ------------------------------------------------------------------------------------------------
  50.652 +ASSIMP_API void aiMultiplyMatrix3(
  50.653 +    aiMatrix3x3* dst,
  50.654 +    const aiMatrix3x3* src)
  50.655 +{
  50.656 +    ai_assert( NULL != dst );
  50.657 +    ai_assert( NULL != src );
  50.658 +    *dst = (*dst) * (*src);
  50.659 +}
  50.660 +
  50.661 +// ------------------------------------------------------------------------------------------------
  50.662 +// Matrix identity
  50.663 +ASSIMP_API void aiIdentityMatrix3(
  50.664 +    aiMatrix3x3* mat)
  50.665 +{
  50.666 +    ai_assert(NULL != mat);
  50.667 +    *mat = aiMatrix3x3();
  50.668 +}
  50.669 +
  50.670 +// ------------------------------------------------------------------------------------------------
  50.671 +ASSIMP_API void aiIdentityMatrix4(
  50.672 +    aiMatrix4x4* mat)
  50.673 +{
  50.674 +    ai_assert(NULL != mat);
  50.675 +    *mat = aiMatrix4x4();
  50.676 +}
  50.677 +
  50.678 +// ------------------------------------------------------------------------------------------------
  50.679 +ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extension ) {
  50.680 +    if( NULL == extension ) {
  50.681 +        return NULL;
  50.682 +    }
  50.683 +    const aiImporterDesc *desc( NULL );
  50.684 +    std::vector< BaseImporter* > out;
  50.685 +    GetImporterInstanceList( out );
  50.686 +    for( size_t i = 0; i < out.size(); ++i ) {
  50.687 +        if( 0 == strncmp( out[ i ]->GetInfo()->mFileExtensions, extension, strlen( extension ) ) ) {
  50.688 +            desc = out[ i ]->GetInfo();
  50.689 +            break;
  50.690 +        }
  50.691 +    }
  50.692 +
  50.693 +    DeleteImporterInstanceList(out);
  50.694 +
  50.695 +    return desc;
  50.696 +}
  50.697 +
  50.698 +// ------------------------------------------------------------------------------------------------
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/src/CInterfaceIOWrapper.cpp	Mon Jan 28 18:19:26 2019 +0200
    51.3 @@ -0,0 +1,136 @@
    51.4 +/*
    51.5 +---------------------------------------------------------------------------
    51.6 +Open Asset Import Library (assimp)
    51.7 +---------------------------------------------------------------------------
    51.8 +
    51.9 +Copyright (c) 2006-2018, assimp team
   51.10 +
   51.11 +
   51.12 +
   51.13 +All rights reserved.
   51.14 +
   51.15 +Redistribution and use of this software in source and binary forms,
   51.16 +with or without modification, are permitted provided that the following
   51.17 +conditions are met:
   51.18 +
   51.19 +* Redistributions of source code must retain the above
   51.20 +  copyright notice, this list of conditions and the
   51.21 +  following disclaimer.
   51.22 +
   51.23 +* Redistributions in binary form must reproduce the above
   51.24 +  copyright notice, this list of conditions and the
   51.25 +  following disclaimer in the documentation and/or other
   51.26 +  materials provided with the distribution.
   51.27 +
   51.28 +* Neither the name of the assimp team, nor the names of its
   51.29 +  contributors may be used to endorse or promote products
   51.30 +  derived from this software without specific prior
   51.31 +  written permission of the assimp team.
   51.32 +
   51.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   51.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   51.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   51.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   51.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   51.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   51.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   51.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   51.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   51.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   51.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   51.44 +---------------------------------------------------------------------------
   51.45 +*/
   51.46 +
   51.47 +/** @file aiFileIO -> IOSystem wrapper*/
   51.48 +
   51.49 +#include "CInterfaceIOWrapper.h"
   51.50 +
   51.51 +namespace Assimp    {
   51.52 +
   51.53 +CIOStreamWrapper::~CIOStreamWrapper(void)
   51.54 +{
   51.55 +    /* Various places depend on this destructor to close the file */
   51.56 +    if (mFile) {
   51.57 +        mIO->mFileSystem->CloseProc(mIO->mFileSystem, mFile);
   51.58 +        mFile = 0;
   51.59 +    }
   51.60 +}
   51.61 +
   51.62 +// ...................................................................
   51.63 +size_t CIOStreamWrapper::Read(void* pvBuffer,
   51.64 +    size_t pSize,
   51.65 +    size_t pCount
   51.66 +){
   51.67 +    // need to typecast here as C has no void*
   51.68 +    return mFile->ReadProc(mFile,(char*)pvBuffer,pSize,pCount);
   51.69 +}
   51.70 +
   51.71 +// ...................................................................
   51.72 +size_t CIOStreamWrapper::Write(const void* pvBuffer,
   51.73 +    size_t pSize,
   51.74 +    size_t pCount
   51.75 +){
   51.76 +    // need to typecast here as C has no void*
   51.77 +    return mFile->WriteProc(mFile,(const char*)pvBuffer,pSize,pCount);
   51.78 +}
   51.79 +
   51.80 +// ...................................................................
   51.81 +aiReturn CIOStreamWrapper::Seek(size_t pOffset,
   51.82 +    aiOrigin pOrigin
   51.83 +){
   51.84 +    return mFile->SeekProc(mFile,pOffset,pOrigin);
   51.85 +}
   51.86 +
   51.87 +// ...................................................................
   51.88 +size_t CIOStreamWrapper::Tell(void) const {
   51.89 +    return mFile->TellProc(mFile);
   51.90 +}
   51.91 +
   51.92 +// ...................................................................
   51.93 +size_t CIOStreamWrapper::FileSize() const {
   51.94 +    return mFile->FileSizeProc(mFile);
   51.95 +}
   51.96 +
   51.97 +// ...................................................................
   51.98 +void CIOStreamWrapper::Flush () {
   51.99 +    return mFile->FlushProc(mFile);
  51.100 +}
  51.101 +
  51.102 +// ------------------------------------------------------------------------------------------------
  51.103 +// Custom IOStream implementation for the C-API
  51.104 +bool CIOSystemWrapper::Exists( const char* pFile) const {
  51.105 +    aiFile* p = mFileSystem->OpenProc(mFileSystem,pFile,"rb");
  51.106 +    if (p){
  51.107 +        mFileSystem->CloseProc(mFileSystem,p);
  51.108 +        return true;
  51.109 +    }
  51.110 +    return false;
  51.111 +}
  51.112 +
  51.113 +// ...................................................................
  51.114 +char CIOSystemWrapper::getOsSeparator() const {
  51.115 +#ifndef _WIN32
  51.116 +    return '/';
  51.117 +#else
  51.118 +    return '\\';
  51.119 +#endif
  51.120 +}
  51.121 +
  51.122 +// ...................................................................
  51.123 +IOStream* CIOSystemWrapper::Open(const char* pFile,const char* pMode) {
  51.124 +    aiFile* p = mFileSystem->OpenProc(mFileSystem,pFile,pMode);
  51.125 +    if (!p) {
  51.126 +        return NULL;
  51.127 +    }
  51.128 +    return new CIOStreamWrapper(p, this);
  51.129 +}
  51.130 +
  51.131 +// ...................................................................
  51.132 +void CIOSystemWrapper::Close( IOStream* pFile) {
  51.133 +    if (!pFile) {
  51.134 +        return;
  51.135 +    }
  51.136 +    delete pFile;
  51.137 +}
  51.138 +
  51.139 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/src/CInterfaceIOWrapper.h	Mon Jan 28 18:19:26 2019 +0200
    52.3 @@ -0,0 +1,99 @@
    52.4 +/*
    52.5 +---------------------------------------------------------------------------
    52.6 +Open Asset Import Library (assimp)
    52.7 +---------------------------------------------------------------------------
    52.8 +
    52.9 +Copyright (c) 2006-2018, assimp team
   52.10 +
   52.11 +
   52.12 +
   52.13 +All rights reserved.
   52.14 +
   52.15 +Redistribution and use of this software in source and binary forms,
   52.16 +with or without modification, are permitted provided that the following
   52.17 +conditions are met:
   52.18 +
   52.19 +* Redistributions of source code must retain the above
   52.20 +  copyright notice, this list of conditions and the
   52.21 +  following disclaimer.
   52.22 +
   52.23 +* Redistributions in binary form must reproduce the above
   52.24 +  copyright notice, this list of conditions and the
   52.25 +  following disclaimer in the documentation and/or other
   52.26 +  materials provided with the distribution.
   52.27 +
   52.28 +* Neither the name of the assimp team, nor the names of its
   52.29 +  contributors may be used to endorse or promote products
   52.30 +  derived from this software without specific prior
   52.31 +  written permission of the assimp team.
   52.32 +
   52.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   52.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   52.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   52.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   52.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   52.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   52.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   52.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   52.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   52.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   52.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   52.44 +---------------------------------------------------------------------------
   52.45 +*/
   52.46 +
   52.47 +/** @file aiFileIO -> IOSystem wrapper*/
   52.48 +
   52.49 +#ifndef AI_CIOSYSTEM_H_INCLUDED
   52.50 +#define AI_CIOSYSTEM_H_INCLUDED
   52.51 +
   52.52 +#include <miniassimp/cfileio.h>
   52.53 +#include <miniassimp/IOStream.hpp>
   52.54 +#include <miniassimp/IOSystem.hpp>
   52.55 +
   52.56 +namespace Assimp    {
   52.57 +
   52.58 +class CIOSystemWrapper;
   52.59 +
   52.60 +// ------------------------------------------------------------------------------------------------
   52.61 +// Custom IOStream implementation for the C-API
   52.62 +class CIOStreamWrapper : public IOStream
   52.63 +{
   52.64 +public:
   52.65 +    explicit CIOStreamWrapper(aiFile* pFile, CIOSystemWrapper* io)
   52.66 +        : mFile(pFile),
   52.67 +        mIO(io)
   52.68 +    {}
   52.69 +    ~CIOStreamWrapper(void);
   52.70 +
   52.71 +    size_t Read(void* pvBuffer, size_t pSize, size_t pCount);
   52.72 +    size_t Write(const void* pvBuffer, size_t pSize, size_t pCount);
   52.73 +    aiReturn Seek(size_t pOffset, aiOrigin pOrigin);
   52.74 +    size_t Tell(void) const;
   52.75 +    size_t FileSize() const;
   52.76 +    void Flush();
   52.77 +
   52.78 +private:
   52.79 +    aiFile* mFile;
   52.80 +    CIOSystemWrapper* mIO;
   52.81 +};
   52.82 +
   52.83 +class CIOSystemWrapper : public IOSystem
   52.84 +{
   52.85 +    friend class CIOStreamWrapper;
   52.86 +public:
   52.87 +    explicit CIOSystemWrapper(aiFileIO* pFile)
   52.88 +        : mFileSystem(pFile)
   52.89 +    {}
   52.90 +
   52.91 +    bool Exists( const char* pFile) const;
   52.92 +    char getOsSeparator() const;
   52.93 +    IOStream* Open(const char* pFile,const char* pMode = "rb");
   52.94 +    void Close( IOStream* pFile);
   52.95 +private:
   52.96 +    aiFileIO* mFileSystem;
   52.97 +};
   52.98 +
   52.99 +}
  52.100 +
  52.101 +#endif
  52.102 +
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/src/Importer.h	Mon Jan 28 18:19:26 2019 +0200
    53.3 @@ -0,0 +1,247 @@
    53.4 +/*
    53.5 +Open Asset Import Library (assimp)
    53.6 +----------------------------------------------------------------------
    53.7 +
    53.8 +Copyright (c) 2006-2018, assimp team
    53.9 +
   53.10 +
   53.11 +All rights reserved.
   53.12 +
   53.13 +Redistribution and use of this software in source and binary forms,
   53.14 +with or without modification, are permitted provided that the
   53.15 +following conditions are met:
   53.16 +
   53.17 +* Redistributions of source code must retain the above
   53.18 +  copyright notice, this list of conditions and the
   53.19 +  following disclaimer.
   53.20 +
   53.21 +* Redistributions in binary form must reproduce the above
   53.22 +  copyright notice, this list of conditions and the
   53.23 +  following disclaimer in the documentation and/or other
   53.24 +  materials provided with the distribution.
   53.25 +
   53.26 +* Neither the name of the assimp team, nor the names of its
   53.27 +  contributors may be used to endorse or promote products
   53.28 +  derived from this software without specific prior
   53.29 +  written permission of the assimp team.
   53.30 +
   53.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   53.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   53.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   53.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   53.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   53.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   53.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   53.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   53.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   53.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   53.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   53.42 +
   53.43 +----------------------------------------------------------------------
   53.44 +*/
   53.45 +
   53.46 +/** @file Importer.h mostly internal stuff for use by #Assimp::Importer */
   53.47 +#pragma once
   53.48 +#ifndef INCLUDED_AI_IMPORTER_H
   53.49 +#define INCLUDED_AI_IMPORTER_H
   53.50 +
   53.51 +#include <map>
   53.52 +#include <vector>
   53.53 +#include <string>
   53.54 +#include <miniassimp/matrix4x4.h>
   53.55 +
   53.56 +struct aiScene;
   53.57 +
   53.58 +namespace Assimp    {
   53.59 +    class ProgressHandler;
   53.60 +    class IOSystem;
   53.61 +    class BaseImporter;
   53.62 +    class BaseProcess;
   53.63 +    class SharedPostProcessInfo;
   53.64 +
   53.65 +
   53.66 +//! @cond never
   53.67 +// ---------------------------------------------------------------------------
   53.68 +/** @brief Internal PIMPL implementation for Assimp::Importer
   53.69 + *
   53.70 + *  Using this idiom here allows us to drop the dependency from
   53.71 + *  std::vector and std::map in the public headers. Furthermore we are dropping
   53.72 + *  any STL interface problems caused by mismatching STL settings. All
   53.73 + *  size calculation are now done by us, not the app heap. */
   53.74 +class ImporterPimpl {
   53.75 +public:
   53.76 +    // Data type to store the key hash
   53.77 +    typedef unsigned int KeyType;
   53.78 +
   53.79 +    // typedefs for our four configuration maps.
   53.80 +    // We don't need more, so there is no need for a generic solution
   53.81 +    typedef std::map<KeyType, int> IntPropertyMap;
   53.82 +    typedef std::map<KeyType, ai_real> FloatPropertyMap;
   53.83 +    typedef std::map<KeyType, std::string> StringPropertyMap;
   53.84 +    typedef std::map<KeyType, aiMatrix4x4> MatrixPropertyMap;
   53.85 +
   53.86 +    /** IO handler to use for all file accesses. */
   53.87 +    IOSystem* mIOHandler;
   53.88 +    bool mIsDefaultHandler;
   53.89 +
   53.90 +    /** Progress handler for feedback. */
   53.91 +    ProgressHandler* mProgressHandler;
   53.92 +    bool mIsDefaultProgressHandler;
   53.93 +
   53.94 +    /** Format-specific importer worker objects - one for each format we can read.*/
   53.95 +    std::vector< BaseImporter* > mImporter;
   53.96 +
   53.97 +    /** Post processing steps we can apply at the imported data. */
   53.98 +    std::vector< BaseProcess* > mPostProcessingSteps;
   53.99 +
  53.100 +    /** The imported data, if ReadFile() was successful, NULL otherwise. */
  53.101 +    aiScene* mScene;
  53.102 +
  53.103 +    /** The error description, if there was one. */
  53.104 +    std::string mErrorString;
  53.105 +
  53.106 +    /** List of integer properties */
  53.107 +    IntPropertyMap mIntProperties;
  53.108 +
  53.109 +    /** List of floating-point properties */
  53.110 +    FloatPropertyMap mFloatProperties;
  53.111 +
  53.112 +    /** List of string properties */
  53.113 +    StringPropertyMap mStringProperties;
  53.114 +
  53.115 +    /** List of Matrix properties */
  53.116 +    MatrixPropertyMap mMatrixProperties;
  53.117 +
  53.118 +    /** Used for testing - extra verbose mode causes the ValidateDataStructure-Step
  53.119 +     *  to be executed before and after every single post-process step */
  53.120 +    bool bExtraVerbose;
  53.121 +
  53.122 +    /** Used by post-process steps to share data */
  53.123 +    SharedPostProcessInfo* mPPShared;
  53.124 +
  53.125 +    /// The default class constructor.
  53.126 +    ImporterPimpl() AI_NO_EXCEPT;
  53.127 +};
  53.128 +
  53.129 +inline
  53.130 +ImporterPimpl::ImporterPimpl() AI_NO_EXCEPT
  53.131 +: mIOHandler( 0 )
  53.132 +, mIsDefaultHandler( false )
  53.133 +, mProgressHandler( 0 )
  53.134 +, mIsDefaultProgressHandler( false )
  53.135 +, mImporter()
  53.136 +, mPostProcessingSteps()
  53.137 +, mScene( 0 )
  53.138 +, mErrorString()
  53.139 +, mIntProperties()
  53.140 +, mFloatProperties()
  53.141 +, mStringProperties()
  53.142 +, mMatrixProperties()
  53.143 +, bExtraVerbose( false )
  53.144 +, mPPShared( 0 ) {
  53.145 +    // empty
  53.146 +}
  53.147 +//! @endcond
  53.148 +
  53.149 +
  53.150 +struct BatchData;
  53.151 +
  53.152 +// ---------------------------------------------------------------------------
  53.153 +/** FOR IMPORTER PLUGINS ONLY: A helper class to the pleasure of importers
  53.154 + *  that need to load many external meshes recursively.
  53.155 + *
  53.156 + *  The class uses several threads to load these meshes (or at least it
  53.157 + *  could, this has not yet been implemented at the moment).
  53.158 + *
  53.159 + *  @note The class may not be used by more than one thread*/
  53.160 +class ASSIMP_API BatchLoader
  53.161 +{
  53.162 +    // friend of Importer
  53.163 +
  53.164 +public:
  53.165 +    //! @cond never
  53.166 +    // -------------------------------------------------------------------
  53.167 +    /** Wraps a full list of configuration properties for an importer.
  53.168 +     *  Properties can be set using SetGenericProperty */
  53.169 +    struct PropertyMap
  53.170 +    {
  53.171 +        ImporterPimpl::IntPropertyMap     ints;
  53.172 +        ImporterPimpl::FloatPropertyMap   floats;
  53.173 +        ImporterPimpl::StringPropertyMap  strings;
  53.174 +        ImporterPimpl::MatrixPropertyMap  matrices;
  53.175 +
  53.176 +        bool operator == (const PropertyMap& prop) const {
  53.177 +            // fixme: really isocpp? gcc complains
  53.178 +            return ints == prop.ints && floats == prop.floats && strings == prop.strings && matrices == prop.matrices;
  53.179 +        }
  53.180 +
  53.181 +        bool empty () const {
  53.182 +            return ints.empty() && floats.empty() && strings.empty() && matrices.empty();
  53.183 +        }
  53.184 +    };
  53.185 +    //! @endcond
  53.186 +
  53.187 +public:
  53.188 +    // -------------------------------------------------------------------
  53.189 +    /** Construct a batch loader from a given IO system to be used
  53.190 +     *  to access external files 
  53.191 +     */
  53.192 +    explicit BatchLoader(IOSystem* pIO, bool validate = false );
  53.193 +
  53.194 +    // -------------------------------------------------------------------
  53.195 +    /** The class destructor.
  53.196 +     */
  53.197 +    ~BatchLoader();
  53.198 +
  53.199 +    // -------------------------------------------------------------------
  53.200 +    /** Sets the validation step. True for enable validation during postprocess.
  53.201 +     *  @param  enable  True for validation.
  53.202 +     */
  53.203 +    void setValidation( bool enabled );
  53.204 +    
  53.205 +    // -------------------------------------------------------------------
  53.206 +    /** Returns the current validation step.
  53.207 +     *  @return The current validation step.
  53.208 +     */
  53.209 +    bool getValidation() const;
  53.210 +    
  53.211 +    // -------------------------------------------------------------------
  53.212 +    /** Add a new file to the list of files to be loaded.
  53.213 +     *  @param file File to be loaded
  53.214 +     *  @param steps Post-processing steps to be executed on the file
  53.215 +     *  @param map Optional configuration properties
  53.216 +     *  @return 'Load request channel' - an unique ID that can later
  53.217 +     *    be used to access the imported file data.
  53.218 +     *  @see GetImport */
  53.219 +    unsigned int AddLoadRequest (
  53.220 +        const std::string& file,
  53.221 +        unsigned int steps = 0,
  53.222 +        const PropertyMap* map = NULL
  53.223 +        );
  53.224 +
  53.225 +    // -------------------------------------------------------------------
  53.226 +    /** Get an imported scene.
  53.227 +     *  This polls the import from the internal request list.
  53.228 +     *  If an import is requested several times, this function
  53.229 +     *  can be called several times, too.
  53.230 +     *
  53.231 +     *  @param which LRWC returned by AddLoadRequest().
  53.232 +     *  @return NULL if there is no scene with this file name
  53.233 +     *  in the queue of the scene hasn't been loaded yet. */
  53.234 +    aiScene* GetImport(
  53.235 +        unsigned int which
  53.236 +        );
  53.237 +
  53.238 +    // -------------------------------------------------------------------
  53.239 +    /** Waits until all scenes have been loaded. This returns
  53.240 +     *  immediately if no scenes are queued.*/
  53.241 +    void LoadAll();
  53.242 +
  53.243 +private:
  53.244 +    // No need to have that in the public API ...
  53.245 +    BatchData *m_data;
  53.246 +};
  53.247 +
  53.248 +} // Namespace Assimp
  53.249 +
  53.250 +#endif // INCLUDED_AI_IMPORTER_H
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/src/ScenePrivate.h	Mon Jan 28 18:19:26 2019 +0200
    54.3 @@ -0,0 +1,105 @@
    54.4 +/*
    54.5 +Open Asset Import Library (assimp)
    54.6 +----------------------------------------------------------------------
    54.7 +
    54.8 +Copyright (c) 2006-2018, assimp team
    54.9 +
   54.10 +
   54.11 +All rights reserved.
   54.12 +
   54.13 +Redistribution and use of this software in source and binary forms,
   54.14 +with or without modification, are permitted provided that the
   54.15 +following conditions are met:
   54.16 +
   54.17 +* Redistributions of source code must retain the above
   54.18 +  copyright notice, this list of conditions and the
   54.19 +  following disclaimer.
   54.20 +
   54.21 +* Redistributions in binary form must reproduce the above
   54.22 +  copyright notice, this list of conditions and the
   54.23 +  following disclaimer in the documentation and/or other
   54.24 +  materials provided with the distribution.
   54.25 +
   54.26 +* Neither the name of the assimp team, nor the names of its
   54.27 +  contributors may be used to endorse or promote products
   54.28 +  derived from this software without specific prior
   54.29 +  written permission of the assimp team.
   54.30 +
   54.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   54.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   54.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   54.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   54.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   54.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   54.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   54.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   54.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   54.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   54.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   54.42 +
   54.43 +----------------------------------------------------------------------
   54.44 +*/
   54.45 +
   54.46 +/** @file Stuff to deal with aiScene::mPrivate
   54.47 + */
   54.48 +#pragma once
   54.49 +#ifndef AI_SCENEPRIVATE_H_INCLUDED
   54.50 +#define AI_SCENEPRIVATE_H_INCLUDED
   54.51 +
   54.52 +#include <miniassimp/ai_assert.h>
   54.53 +#include <miniassimp/scene.h>
   54.54 +
   54.55 +namespace Assimp {
   54.56 +
   54.57 +// Forward declarations
   54.58 +class Importer;
   54.59 +
   54.60 +struct ScenePrivateData {
   54.61 +    //  The struct constructor.
   54.62 +    ScenePrivateData() AI_NO_EXCEPT;
   54.63 +
   54.64 +    // Importer that originally loaded the scene though the C-API
   54.65 +    // If set, this object is owned by this private data instance.
   54.66 +    Assimp::Importer* mOrigImporter;
   54.67 +
   54.68 +    // List of post-processing steps already applied to the scene.
   54.69 +    unsigned int mPPStepsApplied;
   54.70 +
   54.71 +    // true if the scene is a copy made with aiCopyScene()
   54.72 +    // or the corresponding C++ API. This means that user code
   54.73 +    // may have made modifications to it, so mPPStepsApplied
   54.74 +    // and mOrigImporter are no longer safe to rely on and only
   54.75 +    // serve informative purposes.
   54.76 +    bool mIsCopy;
   54.77 +};
   54.78 +
   54.79 +inline
   54.80 +ScenePrivateData::ScenePrivateData() AI_NO_EXCEPT
   54.81 +: mOrigImporter( 0 )
   54.82 +, mPPStepsApplied( 0 )
   54.83 +, mIsCopy( false ) {
   54.84 +    // empty
   54.85 +}
   54.86 +
   54.87 +// Access private data stored in the scene
   54.88 +inline
   54.89 +ScenePrivateData* ScenePriv(aiScene* in) {
   54.90 +    ai_assert( 0 != in );
   54.91 +    if ( 0 == in ) {
   54.92 +        return 0;
   54.93 +    }
   54.94 +    return static_cast<ScenePrivateData*>(in->mPrivate);
   54.95 +}
   54.96 +
   54.97 +inline
   54.98 +const ScenePrivateData* ScenePriv(const aiScene* in) {
   54.99 +    ai_assert( 0 != in );
  54.100 +    if ( 0 == in ) {
  54.101 +        return 0;
  54.102 +    }
  54.103 +    return static_cast<const ScenePrivateData*>(in->mPrivate);
  54.104 +}
  54.105 +
  54.106 +} // Namespace Assimp
  54.107 +
  54.108 +#endif // AI_SCENEPRIVATE_H_INCLUDED