├── .gitignore ├── CMakeLists.txt ├── README.md ├── assets ├── testfile.frag └── testfile.vert ├── build.emscripten └── index.html ├── lib └── assimp │ ├── LICENSE │ ├── include │ └── assimp │ │ ├── .editorconfig │ │ ├── Compiler │ │ ├── poppack1.h │ │ ├── pstdint.h │ │ └── pushpack1.h │ │ ├── DefaultLogger.hpp │ │ ├── Exporter.hpp │ │ ├── IOStream.hpp │ │ ├── IOSystem.hpp │ │ ├── Importer.hpp │ │ ├── LogStream.hpp │ │ ├── Logger.hpp │ │ ├── NullLogger.hpp │ │ ├── ProgressHandler.hpp │ │ ├── ai_assert.h │ │ ├── anim.h │ │ ├── camera.h │ │ ├── cexport.h │ │ ├── cfileio.h │ │ ├── cimport.h │ │ ├── color4.h │ │ ├── color4.inl │ │ ├── config.h │ │ ├── defs.h │ │ ├── importerdesc.h │ │ ├── light.h │ │ ├── material.h │ │ ├── material.inl │ │ ├── matrix3x3.h │ │ ├── matrix3x3.inl │ │ ├── matrix4x4.h │ │ ├── matrix4x4.inl │ │ ├── mesh.h │ │ ├── metadata.h │ │ ├── port │ │ └── AndroidJNI │ │ │ └── AndroidJNIIOSystem.h │ │ ├── postprocess.h │ │ ├── quaternion.h │ │ ├── quaternion.inl │ │ ├── scene.h │ │ ├── texture.h │ │ ├── types.h │ │ ├── vector2.h │ │ ├── vector2.inl │ │ ├── vector3.h │ │ ├── vector3.inl │ │ └── version.h │ └── lib-js │ └── libassimp.so └── src ├── Application.cpp └── Application.h /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | emtest/ 3 | build.emscripten/*.js 4 | build.emscripten/*.data 5 | CMakeLists.txt.user 6 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | cmake_policy(SET CMP0015 NEW) 3 | 4 | project(emtest) 5 | 6 | set(CMAKE_VERBOSE_MAKEFILE on) 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build.emscripten) 8 | 9 | include_directories("lib/assimp/include") 10 | 11 | link_directories("lib/assimp/lib-js") 12 | link_libraries("assimp") 13 | 14 | file(GLOB_RECURSE CORE_HDR src/*.h) 15 | file(GLOB_RECURSE CORE_SRC src/*.cpp) 16 | 17 | # 18 | # Trying usual cmake project compiler execution 19 | # 20 | 21 | add_definitions("-std=c++11") 22 | add_executable(client ${CORE_SRC} ${CORE_HDR}) 23 | 24 | set_target_properties(client PROPERTIES LINK_FLAGS "-s DEMANGLE_SUPPORT=1 --preload-file ${CMAKE_SOURCE_DIR}/assets --bind") 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Minimal CMake-driven Emscripten project 2 | 3 | The purpose of this project is to create a very basic minimal CMake project able to compile C++ program using emscripten with the following features enabled: 4 | * Linking to external C++ library crosscompiled to JS file 5 | * Using bindings created via Embind 6 | * Preloading assets files 7 | 8 | ## How to use 9 | 1. Create build directory ```build``` and go there 10 | 2. Run cmake specifying toolchain file ```CMAKE_TOOLCHAIN_FILE=path/to/emscripten/emscripten/version/cmake/Modules/Platform/Emscripten.cmake``` 11 | 3. Run ```make``` 12 | 13 | Compiled file called ```client.js``` along with the preloaded assets in file ```client.data``` will be put into ```build.emscripten``` directory. Check if it works by opening ```build.emscripten/index.html``` in browser. 14 | -------------------------------------------------------------------------------- /assets/testfile.frag: -------------------------------------------------------------------------------- 1 | fragment shader hello -------------------------------------------------------------------------------- /assets/testfile.vert: -------------------------------------------------------------------------------- 1 | vertex shader hello -------------------------------------------------------------------------------- /build.emscripten/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EM Test 6 | 7 | 8 | 9 | Check browser console. 10 | 11 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /lib/assimp/LICENSE: -------------------------------------------------------------------------------- 1 | Open Asset Import Library (assimp) 2 | 3 | Copyright (c) 2006-2015, assimp team 4 | All rights reserved. 5 | 6 | Redistribution and use of this software in source and binary forms, 7 | with or without modification, are permitted provided that the 8 | following conditions are met: 9 | 10 | * Redistributions of source code must retain the above 11 | copyright notice, this list of conditions and the 12 | following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer in the documentation and/or other 17 | materials provided with the distribution. 18 | 19 | * Neither the name of the assimp team, nor the names of its 20 | contributors may be used to endorse or promote products 21 | derived from this software without specific prior 22 | written permission of the assimp team. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | 37 | 38 | ****************************************************************************** 39 | 40 | AN EXCEPTION applies to all files in the ./test/models-nonbsd folder. 41 | These are 3d models for testing purposes, from various free sources 42 | on the internet. They are - unless otherwise stated - copyright of 43 | their respective creators, which may impose additional requirements 44 | on the use of their work. For any of these models, see 45 | .source.txt for more legal information. Contact us if you 46 | are a copyright holder and believe that we credited you inproperly or 47 | if you don't want your files to appear in the repository. 48 | 49 | 50 | ****************************************************************************** 51 | 52 | Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors 53 | http://code.google.com/p/poly2tri/ 54 | 55 | All rights reserved. 56 | Redistribution and use in source and binary forms, with or without modification, 57 | are permitted provided that the following conditions are met: 58 | 59 | * Redistributions of source code must retain the above copyright notice, 60 | this list of conditions and the following disclaimer. 61 | * Redistributions in binary form must reproduce the above copyright notice, 62 | this list of conditions and the following disclaimer in the documentation 63 | and/or other materials provided with the distribution. 64 | * Neither the name of Poly2Tri nor the names of its contributors may be 65 | used to endorse or promote products derived from this software without specific 66 | prior written permission. 67 | 68 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 69 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 70 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 71 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 72 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 73 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 74 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 75 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 76 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 77 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 78 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/.editorconfig: -------------------------------------------------------------------------------- 1 | # See for details 2 | 3 | [*.{h,hpp,inl}] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | indent_size = 4 8 | indent_style = space 9 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/Compiler/poppack1.h: -------------------------------------------------------------------------------- 1 | 2 | // =============================================================================== 3 | // May be included multiple times - resets structure packing to the defaults 4 | // for all supported compilers. Reverts the changes made by #include 5 | // 6 | // Currently this works on the following compilers: 7 | // MSVC 7,8,9 8 | // GCC 9 | // BORLAND (complains about 'pack state changed but not reverted', but works) 10 | // =============================================================================== 11 | 12 | #ifndef AI_PUSHPACK_IS_DEFINED 13 | # error pushpack1.h must be included after poppack1.h 14 | #endif 15 | 16 | // reset packing to the original value 17 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 18 | # pragma pack( pop ) 19 | #endif 20 | #undef PACK_STRUCT 21 | 22 | #undef AI_PUSHPACK_IS_DEFINED 23 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/Compiler/pushpack1.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | // =============================================================================== 4 | // May be included multiple times - sets structure packing to 1 5 | // for all supported compilers. #include reverts the changes. 6 | // 7 | // Currently this works on the following compilers: 8 | // MSVC 7,8,9 9 | // GCC 10 | // BORLAND (complains about 'pack state changed but not reverted', but works) 11 | // Clang 12 | // 13 | // 14 | // USAGE: 15 | // 16 | // struct StructToBePacked { 17 | // } PACK_STRUCT; 18 | // 19 | // =============================================================================== 20 | 21 | #ifdef AI_PUSHPACK_IS_DEFINED 22 | # error poppack1.h must be included after pushpack1.h 23 | #endif 24 | 25 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 26 | # pragma pack(push,1) 27 | # define PACK_STRUCT 28 | #elif defined( __GNUC__ ) 29 | # if !defined(HOST_MINGW) 30 | # define PACK_STRUCT __attribute__((__packed__)) 31 | # else 32 | # define PACK_STRUCT __attribute__((gcc_struct, __packed__)) 33 | # endif 34 | #else 35 | # error Compiler not supported 36 | #endif 37 | 38 | #if defined(_MSC_VER) 39 | 40 | // C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop 41 | # pragma warning (disable : 4103) 42 | #endif 43 | 44 | #define AI_PUSHPACK_IS_DEFINED 45 | 46 | 47 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/DefaultLogger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2016, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | /** @file DefaultLogger.hpp 41 | */ 42 | 43 | #ifndef INCLUDED_AI_DEFAULTLOGGER 44 | #define INCLUDED_AI_DEFAULTLOGGER 45 | 46 | #include "Logger.hpp" 47 | #include "LogStream.hpp" 48 | #include "NullLogger.hpp" 49 | #include 50 | 51 | namespace Assimp { 52 | // ------------------------------------------------------------------------------------ 53 | class IOStream; 54 | struct LogStreamInfo; 55 | 56 | /** default name of logfile */ 57 | #define ASSIMP_DEFAULT_LOG_NAME "AssimpLog.txt" 58 | 59 | // ------------------------------------------------------------------------------------ 60 | /** @brief CPP-API: Primary logging facility of Assimp. 61 | * 62 | * The library stores its primary #Logger as a static member of this class. 63 | * #get() returns this primary logger. By default the underlying implementation is 64 | * just a #NullLogger which rejects all log messages. By calling #create(), logging 65 | * is turned on. To capture the log output multiple log streams (#LogStream) can be 66 | * attach to the logger. Some default streams for common streaming locations (such as 67 | * a file, std::cout, OutputDebugString()) are also provided. 68 | * 69 | * If you wish to customize the logging at an even deeper level supply your own 70 | * implementation of #Logger to #set(). 71 | * @note The whole logging stuff causes a small extra overhead for all imports. */ 72 | class ASSIMP_API DefaultLogger : 73 | public Logger { 74 | 75 | public: 76 | 77 | // ---------------------------------------------------------------------- 78 | /** @brief Creates a logging instance. 79 | * @param name Name for log file. Only valid in combination 80 | * with the aiDefaultLogStream_FILE flag. 81 | * @param severity Log severity, VERBOSE turns on debug messages 82 | * @param defStreams Default log streams to be attached. Any bitwise 83 | * combination of the aiDefaultLogStream enumerated values. 84 | * If #aiDefaultLogStream_FILE is specified but an empty string is 85 | * passed for 'name', no log file is created at all. 86 | * @param io IOSystem to be used to open external files (such as the 87 | * log file). Pass NULL to rely on the default implementation. 88 | * This replaces the default #NullLogger with a #DefaultLogger instance. */ 89 | static Logger *create(const char* name = ASSIMP_DEFAULT_LOG_NAME, 90 | LogSeverity severity = NORMAL, 91 | unsigned int defStreams = aiDefaultLogStream_DEBUGGER | aiDefaultLogStream_FILE, 92 | IOSystem* io = NULL); 93 | 94 | // ---------------------------------------------------------------------- 95 | /** @brief Setup a custom #Logger implementation. 96 | * 97 | * Use this if the provided #DefaultLogger class doesn't fit into 98 | * your needs. If the provided message formatting is OK for you, 99 | * it's much easier to use #create() and to attach your own custom 100 | * output streams to it. 101 | * @param logger Pass NULL to setup a default NullLogger*/ 102 | static void set (Logger *logger); 103 | 104 | // ---------------------------------------------------------------------- 105 | /** @brief Getter for singleton instance 106 | * @return Only instance. This is never null, but it could be a 107 | * NullLogger. Use isNullLogger to check this.*/ 108 | static Logger *get(); 109 | 110 | // ---------------------------------------------------------------------- 111 | /** @brief Return whether a #NullLogger is currently active 112 | * @return true if the current logger is a #NullLogger. 113 | * Use create() or set() to setup a logger that does actually do 114 | * something else than just rejecting all log messages. */ 115 | static bool isNullLogger(); 116 | 117 | // ---------------------------------------------------------------------- 118 | /** @brief Kills the current singleton logger and replaces it with a 119 | * #NullLogger instance. */ 120 | static void kill(); 121 | 122 | // ---------------------------------------------------------------------- 123 | /** @copydoc Logger::attachStream */ 124 | bool attachStream(LogStream *pStream, 125 | unsigned int severity); 126 | 127 | // ---------------------------------------------------------------------- 128 | /** @copydoc Logger::detatchStream */ 129 | bool detatchStream(LogStream *pStream, 130 | unsigned int severity); 131 | 132 | 133 | private: 134 | 135 | // ---------------------------------------------------------------------- 136 | /** @briefPrivate construction for internal use by create(). 137 | * @param severity Logging granularity */ 138 | explicit DefaultLogger(LogSeverity severity); 139 | 140 | // ---------------------------------------------------------------------- 141 | /** @briefDestructor */ 142 | ~DefaultLogger(); 143 | 144 | private: 145 | 146 | /** @brief Logs debug infos, only been written when severity level VERBOSE is set */ 147 | void OnDebug(const char* message); 148 | 149 | /** @brief Logs an info message */ 150 | void OnInfo(const char* message); 151 | 152 | /** @brief Logs a warning message */ 153 | void OnWarn(const char* message); 154 | 155 | /** @brief Logs an error message */ 156 | void OnError(const char* message); 157 | 158 | // ---------------------------------------------------------------------- 159 | /** @brief Writes a message to all streams */ 160 | void WriteToStreams(const char* message, ErrorSeverity ErrorSev ); 161 | 162 | // ---------------------------------------------------------------------- 163 | /** @brief Returns the thread id. 164 | * @note This is an OS specific feature, if not supported, a 165 | * zero will be returned. 166 | */ 167 | unsigned int GetThreadID(); 168 | 169 | private: 170 | // Aliases for stream container 171 | typedef std::vector StreamArray; 172 | typedef std::vector::iterator StreamIt; 173 | typedef std::vector::const_iterator ConstStreamIt; 174 | 175 | //! only logging instance 176 | static Logger *m_pLogger; 177 | static NullLogger s_pNullLogger; 178 | 179 | //! Attached streams 180 | StreamArray m_StreamArray; 181 | 182 | bool noRepeatMsg; 183 | char lastMsg[MAX_LOG_MESSAGE_LENGTH*2]; 184 | size_t lastLen; 185 | }; 186 | // ------------------------------------------------------------------------------------ 187 | 188 | } // Namespace Assimp 189 | 190 | #endif // !! INCLUDED_AI_DEFAULTLOGGER 191 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/IOStream.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | /** @file IOStream.hpp 42 | * @brief File I/O wrappers for C++. 43 | */ 44 | 45 | #ifndef AI_IOSTREAM_H_INC 46 | #define AI_IOSTREAM_H_INC 47 | 48 | #include "types.h" 49 | 50 | #ifndef __cplusplus 51 | # error This header requires C++ to be used. aiFileIO.h is the \ 52 | corresponding C interface. 53 | #endif 54 | 55 | namespace Assimp { 56 | 57 | // ---------------------------------------------------------------------------------- 58 | /** @brief CPP-API: Class to handle file I/O for C++ 59 | * 60 | * Derive an own implementation from this interface to provide custom IO handling 61 | * to the Importer. If you implement this interface, be sure to also provide an 62 | * implementation for IOSystem that creates instances of your custom IO class. 63 | */ 64 | class ASSIMP_API IOStream 65 | #ifndef SWIG 66 | : public Intern::AllocateFromAssimpHeap 67 | #endif 68 | { 69 | protected: 70 | /** Constructor protected, use IOSystem::Open() to create an instance. */ 71 | IOStream(void); 72 | 73 | public: 74 | // ------------------------------------------------------------------- 75 | /** @brief Destructor. Deleting the object closes the underlying file, 76 | * alternatively you may use IOSystem::Close() to release the file. 77 | */ 78 | virtual ~IOStream(); 79 | 80 | // ------------------------------------------------------------------- 81 | /** @brief Read from the file 82 | * 83 | * See fread() for more details 84 | * This fails for write-only files */ 85 | virtual size_t Read(void* pvBuffer, 86 | size_t pSize, 87 | size_t pCount) = 0; 88 | 89 | // ------------------------------------------------------------------- 90 | /** @brief Write to the file 91 | * 92 | * See fwrite() for more details 93 | * This fails for read-only files */ 94 | virtual size_t Write(const void* pvBuffer, 95 | size_t pSize, 96 | size_t pCount) = 0; 97 | 98 | // ------------------------------------------------------------------- 99 | /** @brief Set the read/write cursor of the file 100 | * 101 | * Note that the offset is _negative_ for aiOrigin_END. 102 | * See fseek() for more details */ 103 | virtual aiReturn Seek(size_t pOffset, 104 | aiOrigin pOrigin) = 0; 105 | 106 | // ------------------------------------------------------------------- 107 | /** @brief Get the current position of the read/write cursor 108 | * 109 | * See ftell() for more details */ 110 | virtual size_t Tell() const = 0; 111 | 112 | // ------------------------------------------------------------------- 113 | /** @brief Returns filesize 114 | * Returns the filesize. */ 115 | virtual size_t FileSize() const = 0; 116 | 117 | // ------------------------------------------------------------------- 118 | /** @brief Flush the contents of the file buffer (for writers) 119 | * See fflush() for more details. 120 | */ 121 | virtual void Flush() = 0; 122 | }; //! class IOStream 123 | 124 | // ---------------------------------------------------------------------------------- 125 | inline IOStream::IOStream() 126 | { 127 | // empty 128 | } 129 | 130 | // ---------------------------------------------------------------------------------- 131 | inline IOStream::~IOStream() 132 | { 133 | // empty 134 | } 135 | // ---------------------------------------------------------------------------------- 136 | } //!namespace Assimp 137 | 138 | #endif //!!AI_IOSTREAM_H_INC 139 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/IOSystem.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file IOSystem.hpp 43 | * @brief File system wrapper for C++. Inherit this class to supply 44 | * custom file handling logic to the Import library. 45 | */ 46 | 47 | #ifndef AI_IOSYSTEM_H_INC 48 | #define AI_IOSYSTEM_H_INC 49 | 50 | #ifndef __cplusplus 51 | # error This header requires C++ to be used. aiFileIO.h is the \ 52 | corresponding C interface. 53 | #endif 54 | 55 | #include "types.h" 56 | 57 | #include 58 | 59 | namespace Assimp { 60 | class IOStream; 61 | 62 | // --------------------------------------------------------------------------- 63 | /** @brief CPP-API: Interface to the file system. 64 | * 65 | * Derive an own implementation from this interface to supply custom file handling 66 | * to the importer library. If you implement this interface, you also want to 67 | * supply a custom implementation for IOStream. 68 | * 69 | * @see Importer::SetIOHandler() */ 70 | class ASSIMP_API IOSystem 71 | #ifndef SWIG 72 | : public Intern::AllocateFromAssimpHeap 73 | #endif 74 | { 75 | public: 76 | 77 | // ------------------------------------------------------------------- 78 | /** @brief Default constructor. 79 | * 80 | * Create an instance of your derived class and assign it to an 81 | * #Assimp::Importer instance by calling Importer::SetIOHandler(). 82 | */ 83 | IOSystem(); 84 | 85 | // ------------------------------------------------------------------- 86 | /** @brief Virtual destructor. 87 | * 88 | * It is safe to be called from within DLL Assimp, we're constructed 89 | * on Assimp's heap. 90 | */ 91 | virtual ~IOSystem(); 92 | 93 | 94 | public: 95 | 96 | // ------------------------------------------------------------------- 97 | /** @brief For backward compatibility 98 | * @see Exists(const char*) 99 | */ 100 | AI_FORCE_INLINE bool Exists( const std::string& pFile) const; 101 | 102 | // ------------------------------------------------------------------- 103 | /** @brief Tests for the existence of a file at the given path. 104 | * 105 | * @param pFile Path to the file 106 | * @return true if there is a file with this path, else false. 107 | */ 108 | virtual bool Exists( const char* pFile) const = 0; 109 | 110 | // ------------------------------------------------------------------- 111 | /** @brief Returns the system specific directory separator 112 | * @return System specific directory separator 113 | */ 114 | virtual char getOsSeparator() const = 0; 115 | 116 | // ------------------------------------------------------------------- 117 | /** @brief Open a new file with a given path. 118 | * 119 | * When the access to the file is finished, call Close() to release 120 | * all associated resources (or the virtual dtor of the IOStream). 121 | * 122 | * @param pFile Path to the file 123 | * @param pMode Desired file I/O mode. Required are: "wb", "w", "wt", 124 | * "rb", "r", "rt". 125 | * 126 | * @return New IOStream interface allowing the lib to access 127 | * the underlying file. 128 | * @note When implementing this class to provide custom IO handling, 129 | * you probably have to supply an own implementation of IOStream as well. 130 | */ 131 | virtual IOStream* Open(const char* pFile, 132 | const char* pMode = "rb") = 0; 133 | 134 | // ------------------------------------------------------------------- 135 | /** @brief For backward compatibility 136 | * @see Open(const char*, const char*) 137 | */ 138 | inline IOStream* Open(const std::string& pFile, 139 | const std::string& pMode = std::string("rb")); 140 | 141 | // ------------------------------------------------------------------- 142 | /** @brief Closes the given file and releases all resources 143 | * associated with it. 144 | * @param pFile The file instance previously created by Open(). 145 | */ 146 | virtual void Close( IOStream* pFile) = 0; 147 | 148 | // ------------------------------------------------------------------- 149 | /** @brief Compares two paths and check whether the point to 150 | * identical files. 151 | * 152 | * The dummy implementation of this virtual member performs a 153 | * case-insensitive comparison of the given strings. The default IO 154 | * system implementation uses OS mechanisms to convert relative into 155 | * absolute paths, so the result can be trusted. 156 | * @param one First file 157 | * @param second Second file 158 | * @return true if the paths point to the same file. The file needn't 159 | * be existing, however. 160 | */ 161 | virtual bool ComparePaths (const char* one, 162 | const char* second) const; 163 | 164 | // ------------------------------------------------------------------- 165 | /** @brief For backward compatibility 166 | * @see ComparePaths(const char*, const char*) 167 | */ 168 | inline bool ComparePaths (const std::string& one, 169 | const std::string& second) const; 170 | 171 | // ------------------------------------------------------------------- 172 | /** @brief Pushes a new directory onto the directory stack. 173 | * @param path Path to push onto the stack. 174 | * @return True, when push was successful, false if path is empty. 175 | */ 176 | virtual bool PushDirectory( const std::string &path ); 177 | 178 | // ------------------------------------------------------------------- 179 | /** @brief Returns the top directory from the stack. 180 | * @return The directory on the top of the stack. 181 | * Returns empty when no directory was pushed to the stack. 182 | */ 183 | virtual const std::string &CurrentDirectory() const; 184 | 185 | // ------------------------------------------------------------------- 186 | /** @brief Returns the number of directories stored on the stack. 187 | * @return The number of directories of the stack. 188 | */ 189 | virtual size_t StackSize() const; 190 | 191 | // ------------------------------------------------------------------- 192 | /** @brief Pops the top directory from the stack. 193 | * @return True, when a directory was on the stack. False if no 194 | * directory was on the stack. 195 | */ 196 | virtual bool PopDirectory(); 197 | 198 | private: 199 | std::vector m_pathStack; 200 | }; 201 | 202 | // ---------------------------------------------------------------------------- 203 | AI_FORCE_INLINE IOSystem::IOSystem() : 204 | m_pathStack() 205 | { 206 | // empty 207 | } 208 | 209 | // ---------------------------------------------------------------------------- 210 | AI_FORCE_INLINE IOSystem::~IOSystem() 211 | { 212 | // empty 213 | } 214 | 215 | // ---------------------------------------------------------------------------- 216 | // For compatibility, the interface of some functions taking a std::string was 217 | // changed to const char* to avoid crashes between binary incompatible STL 218 | // versions. This code her is inlined, so it shouldn't cause any problems. 219 | // ---------------------------------------------------------------------------- 220 | 221 | // ---------------------------------------------------------------------------- 222 | AI_FORCE_INLINE IOStream* IOSystem::Open(const std::string& pFile, 223 | const std::string& pMode) 224 | { 225 | // NOTE: 226 | // For compatibility, interface was changed to const char* to 227 | // avoid crashes between binary incompatible STL versions 228 | return Open(pFile.c_str(),pMode.c_str()); 229 | } 230 | 231 | // ---------------------------------------------------------------------------- 232 | AI_FORCE_INLINE bool IOSystem::Exists( const std::string& pFile) const 233 | { 234 | // NOTE: 235 | // For compatibility, interface was changed to const char* to 236 | // avoid crashes between binary incompatible STL versions 237 | return Exists(pFile.c_str()); 238 | } 239 | 240 | // ---------------------------------------------------------------------------- 241 | inline bool IOSystem::ComparePaths (const std::string& one, 242 | const std::string& second) const 243 | { 244 | // NOTE: 245 | // For compatibility, interface was changed to const char* to 246 | // avoid crashes between binary incompatible STL versions 247 | return ComparePaths(one.c_str(),second.c_str()); 248 | } 249 | 250 | // ---------------------------------------------------------------------------- 251 | inline bool IOSystem::PushDirectory( const std::string &path ) { 252 | if ( path.empty() ) { 253 | return false; 254 | } 255 | 256 | m_pathStack.push_back( path ); 257 | 258 | return true; 259 | } 260 | 261 | // ---------------------------------------------------------------------------- 262 | inline const std::string &IOSystem::CurrentDirectory() const { 263 | if ( m_pathStack.empty() ) { 264 | static const std::string Dummy(""); 265 | return Dummy; 266 | } 267 | return m_pathStack[ m_pathStack.size()-1 ]; 268 | } 269 | 270 | // ---------------------------------------------------------------------------- 271 | inline size_t IOSystem::StackSize() const { 272 | return m_pathStack.size(); 273 | } 274 | 275 | // ---------------------------------------------------------------------------- 276 | inline bool IOSystem::PopDirectory() { 277 | if ( m_pathStack.empty() ) { 278 | return false; 279 | } 280 | 281 | m_pathStack.pop_back(); 282 | 283 | return true; 284 | } 285 | 286 | // ---------------------------------------------------------------------------- 287 | 288 | } //!ns Assimp 289 | 290 | #endif //AI_IOSYSTEM_H_INC 291 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/LogStream.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2016, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | 41 | /** @file LogStream.hpp 42 | * @brief Abstract base class 'LogStream', representing an output log stream. 43 | */ 44 | #ifndef INCLUDED_AI_LOGSTREAM_H 45 | #define INCLUDED_AI_LOGSTREAM_H 46 | #include "types.h" 47 | namespace Assimp { 48 | class IOSystem; 49 | 50 | // ------------------------------------------------------------------------------------ 51 | /** @brief CPP-API: Abstract interface for log stream implementations. 52 | * 53 | * Several default implementations are provided, see #aiDefaultLogStream for more 54 | * details. Writing your own implementation of LogStream is just necessary if these 55 | * are not enough for your purpose. */ 56 | class ASSIMP_API LogStream 57 | #ifndef SWIG 58 | : public Intern::AllocateFromAssimpHeap 59 | #endif 60 | { 61 | protected: 62 | /** @brief Default constructor */ 63 | LogStream() { 64 | } 65 | public: 66 | /** @brief Virtual destructor */ 67 | virtual ~LogStream() { 68 | } 69 | 70 | // ------------------------------------------------------------------- 71 | /** @brief Overwrite this for your own output methods 72 | * 73 | * Log messages *may* consist of multiple lines and you shouldn't 74 | * expect a consistent formatting. If you want custom formatting 75 | * (e.g. generate HTML), supply a custom instance of Logger to 76 | * #DefaultLogger:set(). Usually you can *expect* that a log message 77 | * is exactly one line and terminated with a single \n character. 78 | * @param message Message to be written */ 79 | virtual void write(const char* message) = 0; 80 | 81 | // ------------------------------------------------------------------- 82 | /** @brief Creates a default log stream 83 | * @param streams Type of the default stream 84 | * @param name For aiDefaultLogStream_FILE: name of the output file 85 | * @param io For aiDefaultLogStream_FILE: IOSystem to be used to open the output 86 | * file. Pass NULL for the default implementation. 87 | * @return New LogStream instance. */ 88 | static LogStream* createDefaultStream(aiDefaultLogStream stream, 89 | const char* name = "AssimpLog.txt", 90 | IOSystem* io = NULL); 91 | 92 | }; // !class LogStream 93 | // ------------------------------------------------------------------------------------ 94 | } // Namespace Assimp 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/Logger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2016, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | 41 | /** @file Logger.hpp 42 | * @brief Abstract base class 'Logger', base of the logging system. 43 | */ 44 | #ifndef INCLUDED_AI_LOGGER_H 45 | #define INCLUDED_AI_LOGGER_H 46 | 47 | #include "types.h" 48 | namespace Assimp { 49 | class LogStream; 50 | 51 | // Maximum length of a log message. Longer messages are rejected. 52 | #define MAX_LOG_MESSAGE_LENGTH 1024u 53 | 54 | // ---------------------------------------------------------------------------------- 55 | /** @brief CPP-API: Abstract interface for logger implementations. 56 | * Assimp provides a default implementation and uses it for almost all 57 | * logging stuff ('DefaultLogger'). This class defines just basic logging 58 | * behaviour and is not of interest for you. Instead, take a look at #DefaultLogger. */ 59 | class ASSIMP_API Logger 60 | #ifndef SWIG 61 | : public Intern::AllocateFromAssimpHeap 62 | #endif 63 | { 64 | public: 65 | 66 | // ---------------------------------------------------------------------- 67 | /** @enum LogSeverity 68 | * @brief Log severity to describe the granularity of logging. 69 | */ 70 | enum LogSeverity 71 | { 72 | NORMAL, //!< Normal granularity of logging 73 | VERBOSE //!< Debug infos will be logged, too 74 | }; 75 | 76 | // ---------------------------------------------------------------------- 77 | /** @enum ErrorSeverity 78 | * @brief Description for severity of a log message. 79 | * 80 | * Every LogStream has a bitwise combination of these flags. 81 | * A LogStream doesn't receive any messages of a specific type 82 | * if it doesn't specify the corresponding ErrorSeverity flag. 83 | */ 84 | enum ErrorSeverity 85 | { 86 | Debugging = 1, //!< Debug log message 87 | Info = 2, //!< Info log message 88 | Warn = 4, //!< Warn log message 89 | Err = 8 //!< Error log message 90 | }; 91 | 92 | public: 93 | 94 | /** @brief Virtual destructor */ 95 | virtual ~Logger(); 96 | 97 | // ---------------------------------------------------------------------- 98 | /** @brief Writes a debug message 99 | * @param message Debug message*/ 100 | void debug(const char* message); 101 | inline void debug(const std::string &message); 102 | 103 | // ---------------------------------------------------------------------- 104 | /** @brief Writes a info message 105 | * @param message Info message*/ 106 | void info(const char* message); 107 | inline void info(const std::string &message); 108 | 109 | // ---------------------------------------------------------------------- 110 | /** @brief Writes a warning message 111 | * @param message Warn message*/ 112 | void warn(const char* message); 113 | inline void warn(const std::string &message); 114 | 115 | // ---------------------------------------------------------------------- 116 | /** @brief Writes an error message 117 | * @param message Error message*/ 118 | void error(const char* message); 119 | inline void error(const std::string &message); 120 | 121 | // ---------------------------------------------------------------------- 122 | /** @brief Set a new log severity. 123 | * @param log_severity New severity for logging*/ 124 | void setLogSeverity(LogSeverity log_severity); 125 | 126 | // ---------------------------------------------------------------------- 127 | /** @brief Get the current log severity*/ 128 | LogSeverity getLogSeverity() const; 129 | 130 | // ---------------------------------------------------------------------- 131 | /** @brief Attach a new log-stream 132 | * 133 | * The logger takes ownership of the stream and is responsible 134 | * for its destruction (which is done using ::delete when the logger 135 | * itself is destroyed). Call detachStream to detach a stream and to 136 | * gain ownership of it again. 137 | * @param pStream Log-stream to attach 138 | * @param severity Message filter, specified which types of log 139 | * messages are dispatched to the stream. Provide a bitwise 140 | * combination of the ErrorSeverity flags. 141 | * @return true if the stream has been attached, false otherwise.*/ 142 | virtual bool attachStream(LogStream *pStream, 143 | unsigned int severity = Debugging | Err | Warn | Info) = 0; 144 | 145 | // ---------------------------------------------------------------------- 146 | /** @brief Detach a still attached stream from the logger (or 147 | * modify the filter flags bits) 148 | * @param pStream Log-stream instance for detaching 149 | * @param severity Provide a bitwise combination of the ErrorSeverity 150 | * flags. This value is &~ed with the current flags of the stream, 151 | * if the result is 0 the stream is detached from the Logger and 152 | * the caller retakes the possession of the stream. 153 | * @return true if the stream has been detached, false otherwise.*/ 154 | virtual bool detatchStream(LogStream *pStream, 155 | unsigned int severity = Debugging | Err | Warn | Info) = 0; 156 | 157 | protected: 158 | 159 | /** Default constructor */ 160 | Logger(); 161 | 162 | /** Construction with a given log severity */ 163 | explicit Logger(LogSeverity severity); 164 | 165 | // ---------------------------------------------------------------------- 166 | /** @brief Called as a request to write a specific debug message 167 | * @param message Debug message. Never longer than 168 | * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0'). 169 | * @note The message string is only valid until the scope of 170 | * the function is left. 171 | */ 172 | virtual void OnDebug(const char* message)= 0; 173 | 174 | // ---------------------------------------------------------------------- 175 | /** @brief Called as a request to write a specific info message 176 | * @param message Info message. Never longer than 177 | * MAX_LOG_MESSAGE_LENGTH characters (ecxluding the '0'). 178 | * @note The message string is only valid until the scope of 179 | * the function is left. 180 | */ 181 | virtual void OnInfo(const char* message) = 0; 182 | 183 | // ---------------------------------------------------------------------- 184 | /** @brief Called as a request to write a specific warn message 185 | * @param message Warn message. Never longer than 186 | * MAX_LOG_MESSAGE_LENGTH characters (exluding the '0'). 187 | * @note The message string is only valid until the scope of 188 | * the function is left. 189 | */ 190 | virtual void OnWarn(const char* essage) = 0; 191 | 192 | // ---------------------------------------------------------------------- 193 | /** @brief Called as a request to write a specific error message 194 | * @param message Error message. Never longer than 195 | * MAX_LOG_MESSAGE_LENGTH characters (exluding the '0'). 196 | * @note The message string is only valid until the scope of 197 | * the function is left. 198 | */ 199 | virtual void OnError(const char* message) = 0; 200 | 201 | protected: 202 | 203 | //! Logger severity 204 | LogSeverity m_Severity; 205 | }; 206 | 207 | // ---------------------------------------------------------------------------------- 208 | // Default constructor 209 | inline Logger::Logger() { 210 | setLogSeverity(NORMAL); 211 | } 212 | 213 | // ---------------------------------------------------------------------------------- 214 | // Virtual destructor 215 | inline Logger::~Logger() 216 | { 217 | } 218 | 219 | // ---------------------------------------------------------------------------------- 220 | // Construction with given logging severity 221 | inline Logger::Logger(LogSeverity severity) { 222 | setLogSeverity(severity); 223 | } 224 | 225 | // ---------------------------------------------------------------------------------- 226 | // Log severity setter 227 | inline void Logger::setLogSeverity(LogSeverity log_severity){ 228 | m_Severity = log_severity; 229 | } 230 | 231 | // ---------------------------------------------------------------------------------- 232 | // Log severity getter 233 | inline Logger::LogSeverity Logger::getLogSeverity() const { 234 | return m_Severity; 235 | } 236 | 237 | // ---------------------------------------------------------------------------------- 238 | inline void Logger::debug(const std::string &message) 239 | { 240 | return debug(message.c_str()); 241 | } 242 | 243 | // ---------------------------------------------------------------------------------- 244 | inline void Logger::error(const std::string &message) 245 | { 246 | return error(message.c_str()); 247 | } 248 | 249 | // ---------------------------------------------------------------------------------- 250 | inline void Logger::warn(const std::string &message) 251 | { 252 | return warn(message.c_str()); 253 | } 254 | 255 | // ---------------------------------------------------------------------------------- 256 | inline void Logger::info(const std::string &message) 257 | { 258 | return info(message.c_str()); 259 | } 260 | 261 | // ---------------------------------------------------------------------------------- 262 | 263 | } // Namespace Assimp 264 | 265 | #endif // !! INCLUDED_AI_LOGGER_H 266 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/NullLogger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2016, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | 41 | /** @file NullLogger.hpp 42 | * @brief Dummy logger 43 | */ 44 | 45 | #ifndef INCLUDED_AI_NULLLOGGER_H 46 | #define INCLUDED_AI_NULLLOGGER_H 47 | 48 | #include "Logger.hpp" 49 | namespace Assimp { 50 | // --------------------------------------------------------------------------- 51 | /** @brief CPP-API: Empty logging implementation. 52 | * 53 | * Does nothing! Used by default if the application hasn't requested a 54 | * custom logger via #DefaultLogger::set() or #DefaultLogger::create(); */ 55 | class ASSIMP_API NullLogger 56 | : public Logger { 57 | 58 | public: 59 | 60 | /** @brief Logs a debug message */ 61 | void OnDebug(const char* message) { 62 | (void)message; //this avoids compiler warnings 63 | } 64 | 65 | /** @brief Logs an info message */ 66 | void OnInfo(const char* message) { 67 | (void)message; //this avoids compiler warnings 68 | } 69 | 70 | /** @brief Logs a warning message */ 71 | void OnWarn(const char* message) { 72 | (void)message; //this avoids compiler warnings 73 | } 74 | 75 | /** @brief Logs an error message */ 76 | void OnError(const char* message) { 77 | (void)message; //this avoids compiler warnings 78 | } 79 | 80 | /** @brief Detach a still attached stream from logger */ 81 | bool attachStream(LogStream *pStream, unsigned int severity) { 82 | (void)pStream; (void)severity; //this avoids compiler warnings 83 | return false; 84 | } 85 | 86 | /** @brief Detach a still attached stream from logger */ 87 | bool detatchStream(LogStream *pStream, unsigned int severity) { 88 | (void)pStream; (void)severity; //this avoids compiler warnings 89 | return false; 90 | } 91 | 92 | private: 93 | }; 94 | } 95 | #endif // !! AI_NULLLOGGER_H_INCLUDED 96 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/ProgressHandler.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2016, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | 41 | /** @file ProgressHandler.hpp 42 | * @brief Abstract base class 'ProgressHandler'. 43 | */ 44 | #ifndef INCLUDED_AI_PROGRESSHANDLER_H 45 | #define INCLUDED_AI_PROGRESSHANDLER_H 46 | #include "types.h" 47 | namespace Assimp { 48 | 49 | // ------------------------------------------------------------------------------------ 50 | /** @brief CPP-API: Abstract interface for custom progress report receivers. 51 | * 52 | * Each #Importer instance maintains its own #ProgressHandler. The default 53 | * implementation provided by Assimp doesn't do anything at all. */ 54 | class ASSIMP_API ProgressHandler 55 | #ifndef SWIG 56 | : public Intern::AllocateFromAssimpHeap 57 | #endif 58 | { 59 | protected: 60 | /** @brief Default constructor */ 61 | ProgressHandler () { 62 | } 63 | public: 64 | /** @brief Virtual destructor */ 65 | virtual ~ProgressHandler () { 66 | } 67 | 68 | // ------------------------------------------------------------------- 69 | /** @brief Progress callback. 70 | * @param percentage An estimate of the current loading progress, 71 | * in percent. Or -1.f if such an estimate is not available. 72 | * 73 | * There are restriction on what you may do from within your 74 | * implementation of this method: no exceptions may be thrown and no 75 | * non-const #Importer methods may be called. It is 76 | * not generally possible to predict the number of callbacks 77 | * fired during a single import. 78 | * 79 | * @return Return false to abort loading at the next possible 80 | * occasion (loaders and Assimp are generally allowed to perform 81 | * all needed cleanup tasks prior to returning control to the 82 | * caller). If the loading is aborted, #Importer::ReadFile() 83 | * returns always NULL. 84 | * */ 85 | virtual bool Update(float percentage = -1.f) = 0; 86 | 87 | // ------------------------------------------------------------------- 88 | /** @brief Progress callback for file loading steps 89 | * @param numberOfSteps The number of total post-processing 90 | * steps 91 | * @param currentStep The index of the current post-processing 92 | * step that will run, or equal to numberOfSteps if all of 93 | * them has finished. This number is always strictly monotone 94 | * increasing, although not necessarily linearly. 95 | * 96 | * @note This is currently only used at the start and the end 97 | * of the file parsing. 98 | * */ 99 | virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { 100 | float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f; 101 | Update( f * 0.5f ); 102 | } 103 | 104 | // ------------------------------------------------------------------- 105 | /** @brief Progress callback for post-processing steps 106 | * @param numberOfSteps The number of total post-processing 107 | * steps 108 | * @param currentStep The index of the current post-processing 109 | * step that will run, or equal to numberOfSteps if all of 110 | * them has finished. This number is always strictly monotone 111 | * increasing, although not necessarily linearly. 112 | * */ 113 | virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) { 114 | float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f; 115 | Update( f * 0.5f + 0.5f ); 116 | } 117 | 118 | }; // !class ProgressHandler 119 | // ------------------------------------------------------------------------------------ 120 | } // Namespace Assimp 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/ai_assert.h: -------------------------------------------------------------------------------- 1 | /** @file ai_assert.h 2 | */ 3 | #ifndef AI_DEBUG_H_INC 4 | #define AI_DEBUG_H_INC 5 | 6 | #ifdef ASSIMP_BUILD_DEBUG 7 | # include 8 | # define ai_assert(expression) assert(expression) 9 | #else 10 | # define ai_assert(expression) 11 | #endif 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/camera.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file camera.h 43 | * @brief Defines the aiCamera data structure 44 | */ 45 | 46 | #ifndef AI_CAMERA_H_INC 47 | #define AI_CAMERA_H_INC 48 | 49 | #include "types.h" 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | // --------------------------------------------------------------------------- 56 | /** Helper structure to describe a virtual camera. 57 | * 58 | * Cameras have a representation in the node graph and can be animated. 59 | * An important aspect is that the camera itself is also part of the 60 | * scenegraph. This means, any values such as the look-at vector are not 61 | * *absolute*, they're relative to the coordinate system defined 62 | * by the node which corresponds to the camera. This allows for camera 63 | * animations. For static cameras parameters like the 'look-at' or 'up' vectors 64 | * are usually specified directly in aiCamera, but beware, they could also 65 | * be encoded in the node transformation. The following (pseudo)code sample 66 | * shows how to do it:

67 | * @code 68 | * // Get the camera matrix for a camera at a specific time 69 | * // if the node hierarchy for the camera does not contain 70 | * // at least one animated node this is a static computation 71 | * get-camera-matrix (node sceneRoot, camera cam) : matrix 72 | * { 73 | * node cnd = find-node-for-camera(cam) 74 | * matrix cmt = identity() 75 | * 76 | * // as usual - get the absolute camera transformation for this frame 77 | * for each node nd in hierarchy from sceneRoot to cnd 78 | * matrix cur 79 | * if (is-animated(nd)) 80 | * cur = eval-animation(nd) 81 | * else cur = nd->mTransformation; 82 | * cmt = mult-matrices( cmt, cur ) 83 | * end for 84 | * 85 | * // now multiply with the camera's own local transform 86 | * cam = mult-matrices (cam, get-camera-matrix(cmt) ) 87 | * } 88 | * @endcode 89 | * 90 | * @note some file formats (such as 3DS, ASE) export a "target point" - 91 | * the point the camera is looking at (it can even be animated). Assimp 92 | * writes the target point as a subnode of the camera's main node, 93 | * called ".Target". However this is just additional information 94 | * then the transformation tracks of the camera main node make the 95 | * camera already look in the right direction. 96 | * 97 | */ 98 | struct aiCamera 99 | { 100 | /** The name of the camera. 101 | * 102 | * There must be a node in the scenegraph with the same name. 103 | * This node specifies the position of the camera in the scene 104 | * hierarchy and can be animated. 105 | */ 106 | C_STRUCT aiString mName; 107 | 108 | /** Position of the camera relative to the coordinate space 109 | * defined by the corresponding node. 110 | * 111 | * The default value is 0|0|0. 112 | */ 113 | C_STRUCT aiVector3D mPosition; 114 | 115 | 116 | /** 'Up' - vector of the camera coordinate system relative to 117 | * the coordinate space defined by the corresponding node. 118 | * 119 | * The 'right' vector of the camera coordinate system is 120 | * the cross product of the up and lookAt vectors. 121 | * The default value is 0|1|0. The vector 122 | * may be normalized, but it needn't. 123 | */ 124 | C_STRUCT aiVector3D mUp; 125 | 126 | 127 | /** 'LookAt' - vector of the camera coordinate system relative to 128 | * the coordinate space defined by the corresponding node. 129 | * 130 | * This is the viewing direction of the user. 131 | * The default value is 0|0|1. The vector 132 | * may be normalized, but it needn't. 133 | */ 134 | C_STRUCT aiVector3D mLookAt; 135 | 136 | 137 | /** Half horizontal field of view angle, in radians. 138 | * 139 | * The field of view angle is the angle between the center 140 | * line of the screen and the left or right border. 141 | * The default value is 1/4PI. 142 | */ 143 | float mHorizontalFOV; 144 | 145 | /** Distance of the near clipping plane from the camera. 146 | * 147 | * The value may not be 0.f (for arithmetic reasons to prevent 148 | * a division through zero). The default value is 0.1f. 149 | */ 150 | float mClipPlaneNear; 151 | 152 | /** Distance of the far clipping plane from the camera. 153 | * 154 | * The far clipping plane must, of course, be further away than the 155 | * near clipping plane. The default value is 1000.f. The ratio 156 | * between the near and the far plane should not be too 157 | * large (between 1000-10000 should be ok) to avoid floating-point 158 | * inaccuracies which could lead to z-fighting. 159 | */ 160 | float mClipPlaneFar; 161 | 162 | 163 | /** Screen aspect ratio. 164 | * 165 | * This is the ration between the width and the height of the 166 | * screen. Typical values are 4/3, 1/2 or 1/1. This value is 167 | * 0 if the aspect ratio is not defined in the source file. 168 | * 0 is also the default value. 169 | */ 170 | float mAspect; 171 | 172 | #ifdef __cplusplus 173 | 174 | aiCamera() 175 | : mUp (0.f,1.f,0.f) 176 | , mLookAt (0.f,0.f,1.f) 177 | , mHorizontalFOV (0.25f * (float)AI_MATH_PI) 178 | , mClipPlaneNear (0.1f) 179 | , mClipPlaneFar (1000.f) 180 | , mAspect (0.f) 181 | {} 182 | 183 | /** @brief Get a *right-handed* camera matrix from me 184 | * @param out Camera matrix to be filled 185 | */ 186 | void GetCameraMatrix (aiMatrix4x4& out) const 187 | { 188 | /** todo: test ... should work, but i'm not absolutely sure */ 189 | 190 | /** We don't know whether these vectors are already normalized ...*/ 191 | aiVector3D zaxis = mLookAt; zaxis.Normalize(); 192 | aiVector3D yaxis = mUp; yaxis.Normalize(); 193 | aiVector3D xaxis = mUp^mLookAt; xaxis.Normalize(); 194 | 195 | out.a4 = -(xaxis * mPosition); 196 | out.b4 = -(yaxis * mPosition); 197 | out.c4 = -(zaxis * mPosition); 198 | 199 | out.a1 = xaxis.x; 200 | out.a2 = xaxis.y; 201 | out.a3 = xaxis.z; 202 | 203 | out.b1 = yaxis.x; 204 | out.b2 = yaxis.y; 205 | out.b3 = yaxis.z; 206 | 207 | out.c1 = zaxis.x; 208 | out.c2 = zaxis.y; 209 | out.c3 = zaxis.z; 210 | 211 | out.d1 = out.d2 = out.d3 = 0.f; 212 | out.d4 = 1.f; 213 | } 214 | 215 | #endif 216 | }; 217 | 218 | 219 | #ifdef __cplusplus 220 | } 221 | #endif 222 | 223 | #endif // AI_CAMERA_H_INC 224 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/cexport.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2011, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file cexport.h 43 | * @brief Defines the C-API for the Assimp export interface 44 | */ 45 | #ifndef AI_EXPORT_H_INC 46 | #define AI_EXPORT_H_INC 47 | 48 | #ifndef ASSIMP_BUILD_NO_EXPORT 49 | 50 | #include "types.h" 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | struct aiScene; // aiScene.h 57 | struct aiFileIO; // aiFileIO.h 58 | 59 | // -------------------------------------------------------------------------------- 60 | /** Describes an file format which Assimp can export to. Use #aiGetExportFormatCount() to 61 | * learn how many export formats the current Assimp build supports and #aiGetExportFormatDescription() 62 | * to retrieve a description of an export format option. 63 | */ 64 | struct aiExportFormatDesc 65 | { 66 | /// a short string ID to uniquely identify the export format. Use this ID string to 67 | /// specify which file format you want to export to when calling #aiExportScene(). 68 | /// Example: "dae" or "obj" 69 | const char* id; 70 | 71 | /// A short description of the file format to present to users. Useful if you want 72 | /// to allow the user to select an export format. 73 | const char* description; 74 | 75 | /// Recommended file extension for the exported file in lower case. 76 | const char* fileExtension; 77 | }; 78 | 79 | 80 | // -------------------------------------------------------------------------------- 81 | /** Returns the number of export file formats available in the current Assimp build. 82 | * Use aiGetExportFormatDescription() to retrieve infos of a specific export format. 83 | */ 84 | ASSIMP_API size_t aiGetExportFormatCount(void); 85 | 86 | 87 | // -------------------------------------------------------------------------------- 88 | /** Returns a description of the nth export file format. Use #aiGetExportFormatCount() 89 | * to learn how many export formats are supported. The description must be released by 90 | * calling aiReleaseExportFormatDescription afterwards. 91 | * @param pIndex Index of the export format to retrieve information for. Valid range is 92 | * 0 to #aiGetExportFormatCount() 93 | * @return A description of that specific export format. NULL if pIndex is out of range. 94 | */ 95 | ASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex); 96 | 97 | // -------------------------------------------------------------------------------- 98 | /** Release a description of the nth export file format. Must be returned by 99 | * aiGetExportFormatDescription 100 | * @param desc Pointer to the description 101 | */ 102 | ASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatDesc *desc ); 103 | 104 | // -------------------------------------------------------------------------------- 105 | /** Create a modifiable copy of a scene. 106 | * This is useful to import files via Assimp, change their topology and 107 | * export them again. Since the scene returned by the various importer functions 108 | * is const, a modifiable copy is needed. 109 | * @param pIn Valid scene to be copied 110 | * @param pOut Receives a modifyable copy of the scene. Use aiFreeScene() to 111 | * delete it again. 112 | */ 113 | ASSIMP_API void aiCopyScene(const C_STRUCT aiScene* pIn, 114 | C_STRUCT aiScene** pOut); 115 | 116 | 117 | // -------------------------------------------------------------------------------- 118 | /** Frees a scene copy created using aiCopyScene() */ 119 | ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn); 120 | 121 | // -------------------------------------------------------------------------------- 122 | /** Exports the given scene to a chosen file format and writes the result file(s) to disk. 123 | * @param pScene The scene to export. Stays in possession of the caller, is not changed by the function. 124 | * The scene is expected to conform to Assimp's Importer output format as specified 125 | * in the @link data Data Structures Page @endlink. In short, this means the model data 126 | * should use a right-handed coordinate systems, face winding should be counter-clockwise 127 | * and the UV coordinate origin is assumed to be in the upper left. If your input data 128 | * uses different conventions, have a look at the last parameter. 129 | * @param pFormatId ID string to specify to which format you want to export to. Use 130 | * aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available. 131 | * @param pFileName Output file to write 132 | * @param pPreprocessing Accepts any choice of the #aiPostProcessSteps enumerated 133 | * flags, but in reality only a subset of them makes sense here. Specifying 134 | * 'preprocessing' flags is useful if the input scene does not conform to 135 | * Assimp's default conventions as specified in the @link data Data Structures Page @endlink. 136 | * In short, this means the geometry data should use a right-handed coordinate systems, face 137 | * winding should be counter-clockwise and the UV coordinate origin is assumed to be in 138 | * the upper left. The #aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and 139 | * #aiProcess_FlipWindingOrder flags are used in the import side to allow users 140 | * to have those defaults automatically adapted to their conventions. Specifying those flags 141 | * for exporting has the opposite effect, respectively. Some other of the 142 | * #aiPostProcessSteps enumerated values may be useful as well, but you'll need 143 | * to try out what their effect on the exported file is. Many formats impose 144 | * their own restrictions on the structure of the geometry stored therein, 145 | * so some preprocessing may have little or no effect at all, or may be 146 | * redundant as exporters would apply them anyhow. A good example 147 | * is triangulation - whilst you can enforce it by specifying 148 | * the #aiProcess_Triangulate flag, most export formats support only 149 | * triangulate data so they would run the step anyway. 150 | * 151 | * If assimp detects that the input scene was directly taken from the importer side of 152 | * the library (i.e. not copied using aiCopyScene and potetially modified afterwards), 153 | * any postprocessing steps already applied to the scene will not be applied again, unless 154 | * they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and 155 | * #aiProcess_FlipWindingOrder). 156 | * @return a status code indicating the result of the export 157 | * @note Use aiCopyScene() to get a modifiable copy of a previously 158 | * imported scene. 159 | */ 160 | ASSIMP_API aiReturn aiExportScene( const C_STRUCT aiScene* pScene, 161 | const char* pFormatId, 162 | const char* pFileName, 163 | unsigned int pPreprocessing); 164 | 165 | 166 | // -------------------------------------------------------------------------------- 167 | /** Exports the given scene to a chosen file format using custom IO logic supplied by you. 168 | * @param pScene The scene to export. Stays in possession of the caller, is not changed by the function. 169 | * @param pFormatId ID string to specify to which format you want to export to. Use 170 | * aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available. 171 | * @param pFileName Output file to write 172 | * @param pIO custom IO implementation to be used. Use this if you use your own storage methods. 173 | * If none is supplied, a default implementation using standard file IO is used. Note that 174 | * #aiExportSceneToBlob is provided as convenience function to export to memory buffers. 175 | * @param pPreprocessing Please see the documentation for #aiExportScene 176 | * @return a status code indicating the result of the export 177 | * @note Include for the definition of #aiFileIO. 178 | * @note Use aiCopyScene() to get a modifiable copy of a previously 179 | * imported scene. 180 | */ 181 | ASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene, 182 | const char* pFormatId, 183 | const char* pFileName, 184 | C_STRUCT aiFileIO* pIO, 185 | unsigned int pPreprocessing ); 186 | 187 | 188 | // -------------------------------------------------------------------------------- 189 | /** Describes a blob of exported scene data. Use #aiExportSceneToBlob() to create a blob containing an 190 | * exported scene. The memory referred by this structure is owned by Assimp. 191 | * to free its resources. Don't try to free the memory on your side - it will crash for most build configurations 192 | * due to conflicting heaps. 193 | * 194 | * Blobs can be nested - each blob may reference another blob, which may in turn reference another blob and so on. 195 | * This is used when exporters write more than one output file for a given #aiScene. See the remarks for 196 | * #aiExportDataBlob::name for more information. 197 | */ 198 | struct aiExportDataBlob 199 | { 200 | /// Size of the data in bytes 201 | size_t size; 202 | 203 | /// The data. 204 | void* data; 205 | 206 | /** Name of the blob. An empty string always 207 | indicates the first (and primary) blob, 208 | which contains the actual file data. 209 | Any other blobs are auxiliary files produced 210 | by exporters (i.e. material files). Existence 211 | of such files depends on the file format. Most 212 | formats don't split assets across multiple files. 213 | 214 | If used, blob names usually contain the file 215 | extension that should be used when writing 216 | the data to disc. 217 | */ 218 | C_STRUCT aiString name; 219 | 220 | /** Pointer to the next blob in the chain or NULL if there is none. */ 221 | C_STRUCT aiExportDataBlob * next; 222 | 223 | #ifdef __cplusplus 224 | /// Default constructor 225 | aiExportDataBlob() { size = 0; data = next = NULL; } 226 | /// Releases the data 227 | ~aiExportDataBlob() { delete [] static_cast( data ); delete next; } 228 | 229 | private: 230 | // no copying 231 | aiExportDataBlob(const aiExportDataBlob& ); 232 | aiExportDataBlob& operator= (const aiExportDataBlob& ); 233 | #endif // __cplusplus 234 | }; 235 | 236 | // -------------------------------------------------------------------------------- 237 | /** Exports the given scene to a chosen file format. Returns the exported data as a binary blob which 238 | * you can write into a file or something. When you're done with the data, use #aiReleaseExportBlob() 239 | * to free the resources associated with the export. 240 | * @param pScene The scene to export. Stays in possession of the caller, is not changed by the function. 241 | * @param pFormatId ID string to specify to which format you want to export to. Use 242 | * #aiGetExportFormatCount() / #aiGetExportFormatDescription() to learn which export formats are available. 243 | * @param pPreprocessing Please see the documentation for #aiExportScene 244 | * @return the exported data or NULL in case of error 245 | */ 246 | ASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const C_STRUCT aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing ); 247 | 248 | 249 | // -------------------------------------------------------------------------------- 250 | /** Releases the memory associated with the given exported data. Use this function to free a data blob 251 | * returned by aiExportScene(). 252 | * @param pData the data blob returned by #aiExportSceneToBlob 253 | */ 254 | ASSIMP_API void aiReleaseExportBlob( const C_STRUCT aiExportDataBlob* pData ); 255 | 256 | #ifdef __cplusplus 257 | } 258 | #endif 259 | 260 | #endif // ASSIMP_BUILD_NO_EXPORT 261 | #endif // AI_EXPORT_H_INC 262 | 263 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/cfileio.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file cfileio.h 43 | * @brief Defines generic C routines to access memory-mapped files 44 | */ 45 | #ifndef AI_FILEIO_H_INC 46 | #define AI_FILEIO_H_INC 47 | 48 | #include "types.h" 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | struct aiFileIO; 53 | struct aiFile; 54 | 55 | // aiFile callbacks 56 | typedef size_t (*aiFileWriteProc) (C_STRUCT aiFile*, const char*, size_t, size_t); 57 | typedef size_t (*aiFileReadProc) (C_STRUCT aiFile*, char*, size_t,size_t); 58 | typedef size_t (*aiFileTellProc) (C_STRUCT aiFile*); 59 | typedef void (*aiFileFlushProc) (C_STRUCT aiFile*); 60 | typedef aiReturn (*aiFileSeek)(C_STRUCT aiFile*, size_t, aiOrigin); 61 | 62 | // aiFileIO callbacks 63 | typedef aiFile* (*aiFileOpenProc) (C_STRUCT aiFileIO*, const char*, const char*); 64 | typedef void (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*); 65 | 66 | // Represents user-defined data 67 | typedef char* aiUserData; 68 | 69 | // ---------------------------------------------------------------------------------- 70 | /** @brief C-API: File system callbacks 71 | * 72 | * Provided are functions to open and close files. Supply a custom structure to 73 | * the import function. If you don't, a default implementation is used. Use custom 74 | * file systems to enable reading from other sources, such as ZIPs 75 | * or memory locations. */ 76 | struct aiFileIO 77 | { 78 | /** Function used to open a new file 79 | */ 80 | aiFileOpenProc OpenProc; 81 | 82 | /** Function used to close an existing file 83 | */ 84 | aiFileCloseProc CloseProc; 85 | 86 | /** User-defined, opaque data */ 87 | aiUserData UserData; 88 | }; 89 | 90 | // ---------------------------------------------------------------------------------- 91 | /** @brief C-API: File callbacks 92 | * 93 | * Actually, it's a data structure to wrap a set of fXXXX (e.g fopen) 94 | * replacement functions. 95 | * 96 | * The default implementation of the functions utilizes the fXXX functions from 97 | * the CRT. However, you can supply a custom implementation to Assimp by 98 | * delivering a custom aiFileIO. Use this to enable reading from other sources, 99 | * such as ZIP archives or memory locations. */ 100 | struct aiFile 101 | { 102 | /** Callback to read from a file */ 103 | aiFileReadProc ReadProc; 104 | 105 | /** Callback to write to a file */ 106 | aiFileWriteProc WriteProc; 107 | 108 | /** Callback to retrieve the current position of 109 | * the file cursor (ftell()) 110 | */ 111 | aiFileTellProc TellProc; 112 | 113 | /** Callback to retrieve the size of the file, 114 | * in bytes 115 | */ 116 | aiFileTellProc FileSizeProc; 117 | 118 | /** Callback to set the current position 119 | * of the file cursor (fseek()) 120 | */ 121 | aiFileSeek SeekProc; 122 | 123 | /** Callback to flush the file contents 124 | */ 125 | aiFileFlushProc FlushProc; 126 | 127 | /** User-defined, opaque data 128 | */ 129 | aiUserData UserData; 130 | }; 131 | 132 | #ifdef __cplusplus 133 | } 134 | #endif 135 | #endif // AI_FILEIO_H_INC 136 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/color4.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | /** @file color4.h 42 | * @brief RGBA color structure, including operators when compiling in C++ 43 | */ 44 | #ifndef AI_COLOR4D_H_INC 45 | #define AI_COLOR4D_H_INC 46 | 47 | #include "./Compiler/pushpack1.h" 48 | 49 | #ifdef __cplusplus 50 | 51 | // ---------------------------------------------------------------------------------- 52 | /** Represents a color in Red-Green-Blue space including an 53 | * alpha component. Color values range from 0 to 1. */ 54 | // ---------------------------------------------------------------------------------- 55 | template 56 | class aiColor4t 57 | { 58 | public: 59 | aiColor4t () : r(), g(), b(), a() {} 60 | aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a) 61 | : r(_r), g(_g), b(_b), a(_a) {} 62 | explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {} 63 | aiColor4t (const aiColor4t& o) 64 | : r(o.r), g(o.g), b(o.b), a(o.a) {} 65 | 66 | public: 67 | // combined operators 68 | const aiColor4t& operator += (const aiColor4t& o); 69 | const aiColor4t& operator -= (const aiColor4t& o); 70 | const aiColor4t& operator *= (TReal f); 71 | const aiColor4t& operator /= (TReal f); 72 | 73 | public: 74 | // comparison 75 | bool operator == (const aiColor4t& other) const; 76 | bool operator != (const aiColor4t& other) const; 77 | bool operator < (const aiColor4t& other) const; 78 | 79 | // color tuple access, rgba order 80 | inline TReal operator[](unsigned int i) const; 81 | inline TReal& operator[](unsigned int i); 82 | 83 | /** check whether a color is (close to) black */ 84 | inline bool IsBlack() const; 85 | 86 | public: 87 | 88 | // Red, green, blue and alpha color values 89 | TReal r, g, b, a; 90 | } PACK_STRUCT; // !struct aiColor4D 91 | 92 | typedef aiColor4t aiColor4D; 93 | 94 | #else 95 | 96 | struct aiColor4D { 97 | float r, g, b, a; 98 | } PACK_STRUCT; 99 | 100 | #endif // __cplusplus 101 | 102 | #include "./Compiler/poppack1.h" 103 | 104 | #endif // AI_COLOR4D_H_INC 105 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/color4.inl: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file color4.inl 43 | * @brief Inline implementation of aiColor4t operators 44 | */ 45 | #ifndef AI_COLOR4D_INL_INC 46 | #define AI_COLOR4D_INL_INC 47 | 48 | #ifdef __cplusplus 49 | #include "color4.h" 50 | 51 | // ------------------------------------------------------------------------------------------------ 52 | template 53 | AI_FORCE_INLINE const aiColor4t& aiColor4t::operator += (const aiColor4t& o) { 54 | r += o.r; g += o.g; b += o.b; a += o.a; 55 | return *this; 56 | } 57 | // ------------------------------------------------------------------------------------------------ 58 | template 59 | AI_FORCE_INLINE const aiColor4t& aiColor4t::operator -= (const aiColor4t& o) { 60 | r -= o.r; g -= o.g; b -= o.b; a -= o.a; 61 | return *this; 62 | } 63 | // ------------------------------------------------------------------------------------------------ 64 | template 65 | AI_FORCE_INLINE const aiColor4t& aiColor4t::operator *= (TReal f) { 66 | r *= f; g *= f; b *= f; a *= f; 67 | return *this; 68 | } 69 | // ------------------------------------------------------------------------------------------------ 70 | template 71 | AI_FORCE_INLINE const aiColor4t& aiColor4t::operator /= (TReal f) { 72 | r /= f; g /= f; b /= f; a /= f; 73 | return *this; 74 | } 75 | // ------------------------------------------------------------------------------------------------ 76 | template 77 | AI_FORCE_INLINE TReal aiColor4t::operator[](unsigned int i) const { 78 | return *(&r + i); 79 | } 80 | // ------------------------------------------------------------------------------------------------ 81 | template 82 | AI_FORCE_INLINE TReal& aiColor4t::operator[](unsigned int i) { 83 | return *(&r + i); 84 | } 85 | // ------------------------------------------------------------------------------------------------ 86 | template 87 | AI_FORCE_INLINE bool aiColor4t::operator== (const aiColor4t& other) const { 88 | return r == other.r && g == other.g && b == other.b && a == other.a; 89 | } 90 | // ------------------------------------------------------------------------------------------------ 91 | template 92 | AI_FORCE_INLINE bool aiColor4t::operator!= (const aiColor4t& other) const { 93 | return r != other.r || g != other.g || b != other.b || a != other.a; 94 | } 95 | // ------------------------------------------------------------------------------------------------ 96 | template 97 | AI_FORCE_INLINE bool aiColor4t::operator< (const aiColor4t& other) const { 98 | return r < other.r || ( 99 | r == other.r && ( 100 | g < other.g || ( 101 | g == other.g && ( 102 | b < other.b || ( 103 | b == other.b && ( 104 | a < other.a 105 | ) 106 | ) 107 | ) 108 | ) 109 | ) 110 | ); 111 | } 112 | // ------------------------------------------------------------------------------------------------ 113 | template 114 | AI_FORCE_INLINE aiColor4t operator + (const aiColor4t& v1, const aiColor4t& v2) { 115 | return aiColor4t( v1.r + v2.r, v1.g + v2.g, v1.b + v2.b, v1.a + v2.a); 116 | } 117 | // ------------------------------------------------------------------------------------------------ 118 | template 119 | AI_FORCE_INLINE aiColor4t operator - (const aiColor4t& v1, const aiColor4t& v2) { 120 | return aiColor4t( v1.r - v2.r, v1.g - v2.g, v1.b - v2.b, v1.a - v2.a); 121 | } 122 | // ------------------------------------------------------------------------------------------------ 123 | template 124 | AI_FORCE_INLINE aiColor4t operator * (const aiColor4t& v1, const aiColor4t& v2) { 125 | return aiColor4t( v1.r * v2.r, v1.g * v2.g, v1.b * v2.b, v1.a * v2.a); 126 | } 127 | // ------------------------------------------------------------------------------------------------ 128 | template 129 | AI_FORCE_INLINE aiColor4t operator / (const aiColor4t& v1, const aiColor4t& v2) { 130 | return aiColor4t( v1.r / v2.r, v1.g / v2.g, v1.b / v2.b, v1.a / v2.a); 131 | } 132 | // ------------------------------------------------------------------------------------------------ 133 | template 134 | AI_FORCE_INLINE aiColor4t operator * ( TReal f, const aiColor4t& v) { 135 | return aiColor4t( f*v.r, f*v.g, f*v.b, f*v.a); 136 | } 137 | // ------------------------------------------------------------------------------------------------ 138 | template 139 | AI_FORCE_INLINE aiColor4t operator * ( const aiColor4t& v, TReal f) { 140 | return aiColor4t( f*v.r, f*v.g, f*v.b, f*v.a); 141 | } 142 | // ------------------------------------------------------------------------------------------------ 143 | template 144 | AI_FORCE_INLINE aiColor4t operator / ( const aiColor4t& v, TReal f) { 145 | return v * (1/f); 146 | } 147 | // ------------------------------------------------------------------------------------------------ 148 | template 149 | AI_FORCE_INLINE aiColor4t operator / ( TReal f,const aiColor4t& v) { 150 | return aiColor4t(f,f,f,f)/v; 151 | } 152 | // ------------------------------------------------------------------------------------------------ 153 | template 154 | AI_FORCE_INLINE aiColor4t operator + ( const aiColor4t& v, TReal f) { 155 | return aiColor4t( f+v.r, f+v.g, f+v.b, f+v.a); 156 | } 157 | // ------------------------------------------------------------------------------------------------ 158 | template 159 | AI_FORCE_INLINE aiColor4t operator - ( const aiColor4t& v, TReal f) { 160 | return aiColor4t( v.r-f, v.g-f, v.b-f, v.a-f); 161 | } 162 | // ------------------------------------------------------------------------------------------------ 163 | template 164 | AI_FORCE_INLINE aiColor4t operator + ( TReal f, const aiColor4t& v) { 165 | return aiColor4t( f+v.r, f+v.g, f+v.b, f+v.a); 166 | } 167 | // ------------------------------------------------------------------------------------------------ 168 | template 169 | AI_FORCE_INLINE aiColor4t operator - ( TReal f, const aiColor4t& v) { 170 | return aiColor4t( f-v.r, f-v.g, f-v.b, f-v.a); 171 | } 172 | 173 | // ------------------------------------------------------------------------------------------------ 174 | template 175 | inline bool aiColor4t :: IsBlack() const { 176 | // The alpha component doesn't care here. black is black. 177 | static const TReal epsilon = 10e-3f; 178 | return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon; 179 | } 180 | 181 | #endif // __cplusplus 182 | #endif // AI_VECTOR3D_INL_INC 183 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file defs.h 43 | * @brief Assimp build configuration setup. See the notes in the comment 44 | * blocks to find out how to customize _your_ Assimp build. 45 | */ 46 | 47 | #ifndef INCLUDED_AI_DEFINES_H 48 | #define INCLUDED_AI_DEFINES_H 49 | 50 | ////////////////////////////////////////////////////////////////////////// 51 | /* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific 52 | * file format loader. The loader is be excluded from the 53 | * build in this case. 'XX' stands for the most common file 54 | * extension of the file format. E.g.: 55 | * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader. 56 | * 57 | * If you're unsure about that, take a look at the implementation of the 58 | * import plugin you wish to disable. You'll find the right define in the 59 | * first lines of the corresponding unit. 60 | * 61 | * Other (mixed) configuration switches are listed here: 62 | * ASSIMP_BUILD_NO_COMPRESSED_X 63 | * - Disable support for compressed X files (zip) 64 | * ASSIMP_BUILD_NO_COMPRESSED_BLEND 65 | * - Disable support for compressed Blender files (zip) 66 | * ASSIMP_BUILD_NO_COMPRESSED_IFC 67 | * - Disable support for IFCZIP files (unzip) 68 | */ 69 | ////////////////////////////////////////////////////////////////////////// 70 | 71 | #ifndef ASSIMP_BUILD_NO_COMPRESSED_X 72 | # define ASSIMP_BUILD_NEED_Z_INFLATE 73 | #endif 74 | 75 | #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND 76 | # define ASSIMP_BUILD_NEED_Z_INFLATE 77 | #endif 78 | 79 | #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC 80 | # define ASSIMP_BUILD_NEED_Z_INFLATE 81 | # define ASSIMP_BUILD_NEED_UNZIP 82 | #endif 83 | 84 | #ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER 85 | # define ASSIMP_BUILD_NEED_Z_INFLATE 86 | # define ASSIMP_BUILD_NEED_UNZIP 87 | #endif 88 | 89 | ////////////////////////////////////////////////////////////////////////// 90 | /* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific 91 | * post processing step. This is the current list of process names ('XX'): 92 | * CALCTANGENTS 93 | * JOINVERTICES 94 | * TRIANGULATE 95 | * GENFACENORMALS 96 | * GENVERTEXNORMALS 97 | * REMOVEVC 98 | * SPLITLARGEMESHES 99 | * PRETRANSFORMVERTICES 100 | * LIMITBONEWEIGHTS 101 | * VALIDATEDS 102 | * IMPROVECACHELOCALITY 103 | * FIXINFACINGNORMALS 104 | * REMOVE_REDUNDANTMATERIALS 105 | * OPTIMIZEGRAPH 106 | * SORTBYPTYPE 107 | * FINDINVALIDDATA 108 | * TRANSFORMTEXCOORDS 109 | * GENUVCOORDS 110 | * ENTITYMESHBUILDER 111 | * MAKELEFTHANDED 112 | * FLIPUVS 113 | * FLIPWINDINGORDER 114 | * OPTIMIZEMESHES 115 | * OPTIMIZEANIMS 116 | * OPTIMIZEGRAPH 117 | * GENENTITYMESHES 118 | * FIXTEXTUREPATHS */ 119 | ////////////////////////////////////////////////////////////////////////// 120 | 121 | #ifdef _MSC_VER 122 | # undef ASSIMP_API 123 | 124 | ////////////////////////////////////////////////////////////////////////// 125 | /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */ 126 | ////////////////////////////////////////////////////////////////////////// 127 | # ifdef ASSIMP_BUILD_DLL_EXPORT 128 | # define ASSIMP_API __declspec(dllexport) 129 | # define ASSIMP_API_WINONLY __declspec(dllexport) 130 | # pragma warning (disable : 4251) 131 | 132 | ////////////////////////////////////////////////////////////////////////// 133 | /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in 134 | * an external DLL under Windows. Default is static linkage. */ 135 | ////////////////////////////////////////////////////////////////////////// 136 | # elif (defined ASSIMP_DLL) 137 | # define ASSIMP_API __declspec(dllimport) 138 | # define ASSIMP_API_WINONLY __declspec(dllimport) 139 | # else 140 | # define ASSIMP_API 141 | # define ASSIMP_API_WINONLY 142 | # endif 143 | 144 | /* Force the compiler to inline a function, if possible 145 | */ 146 | # define AI_FORCE_INLINE __forceinline 147 | 148 | /* Tells the compiler that a function never returns. Used in code analysis 149 | * to skip dead paths (e.g. after an assertion evaluated to false). */ 150 | # define AI_WONT_RETURN __declspec(noreturn) 151 | 152 | #elif defined(SWIG) 153 | 154 | /* Do nothing, the relevant defines are all in AssimpSwigPort.i */ 155 | 156 | #else 157 | 158 | # define AI_WONT_RETURN 159 | 160 | # define ASSIMP_API __attribute__ ((visibility("default"))) 161 | # define ASSIMP_API_WINONLY 162 | # define AI_FORCE_INLINE inline 163 | #endif // (defined _MSC_VER) 164 | 165 | #ifdef __GNUC__ 166 | # define AI_WONT_RETURN_SUFFIX __attribute__((noreturn)) 167 | #else 168 | # define AI_WONT_RETURN_SUFFIX 169 | #endif // (defined __clang__) 170 | 171 | #ifdef __cplusplus 172 | /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up 173 | * in doxydocs. 174 | */ 175 | # define C_STRUCT 176 | # define C_ENUM 177 | #else 178 | ////////////////////////////////////////////////////////////////////////// 179 | /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD 180 | * is defined by Doxygen's preprocessor. The corresponding 181 | * entries in the DOXYFILE are: */ 182 | ////////////////////////////////////////////////////////////////////////// 183 | #if 0 184 | ENABLE_PREPROCESSING = YES 185 | MACRO_EXPANSION = YES 186 | EXPAND_ONLY_PREDEF = YES 187 | SEARCH_INCLUDES = YES 188 | INCLUDE_PATH = 189 | INCLUDE_FILE_PATTERNS = 190 | PREDEFINED = ASSIMP_DOXYGEN_BUILD=1 191 | EXPAND_AS_DEFINED = C_STRUCT C_ENUM 192 | SKIP_FUNCTION_MACROS = YES 193 | #endif 194 | ////////////////////////////////////////////////////////////////////////// 195 | /* Doxygen gets confused if we use c-struct typedefs to avoid 196 | * the explicit 'struct' notation. This trick here has the same 197 | * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need 198 | * to typedef all structs/enums. */ 199 | ////////////////////////////////////////////////////////////////////////// 200 | # if (defined ASSIMP_DOXYGEN_BUILD) 201 | # define C_STRUCT 202 | # define C_ENUM 203 | # else 204 | # define C_STRUCT struct 205 | # define C_ENUM enum 206 | # endif 207 | #endif 208 | 209 | #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__)) 210 | #error Currently, Borland is unsupported. Feel free to port Assimp. 211 | 212 | // "W8059 Packgr��e der Struktur ge�ndert" 213 | 214 | #endif 215 | ////////////////////////////////////////////////////////////////////////// 216 | /* Define 'ASSIMP_BUILD_BOOST_WORKAROUND' to compile assimp 217 | * without boost. This is done by using a few workaround 218 | * classes and brings some limitations (e.g. some logging won't be done, 219 | * the library won't utilize threads or be threadsafe at all). 220 | * This implies the 'ASSIMP_BUILD_SINGLETHREADED' setting. */ 221 | ////////////////////////////////////////////////////////////////////////// 222 | #ifdef ASSIMP_BUILD_BOOST_WORKAROUND 223 | 224 | // threading support requires boost 225 | #ifndef ASSIMP_BUILD_SINGLETHREADED 226 | # define ASSIMP_BUILD_SINGLETHREADED 227 | #endif 228 | 229 | #endif // !! ASSIMP_BUILD_BOOST_WORKAROUND 230 | 231 | ////////////////////////////////////////////////////////////////////////// 232 | /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp 233 | * without threading support. The library doesn't utilize 234 | * threads then and is itself not threadsafe. 235 | * If this flag is specified boost::threads is *not* required. */ 236 | ////////////////////////////////////////////////////////////////////////// 237 | #ifndef ASSIMP_BUILD_SINGLETHREADED 238 | # define ASSIMP_BUILD_SINGLETHREADED 239 | #endif 240 | 241 | #if defined(_DEBUG) || ! defined(NDEBUG) 242 | # define ASSIMP_BUILD_DEBUG 243 | #endif 244 | 245 | ////////////////////////////////////////////////////////////////////////// 246 | /* Useful constants */ 247 | ////////////////////////////////////////////////////////////////////////// 248 | 249 | /* This is PI. Hi PI. */ 250 | #define AI_MATH_PI (3.141592653589793238462643383279 ) 251 | #define AI_MATH_TWO_PI (AI_MATH_PI * 2.0) 252 | #define AI_MATH_HALF_PI (AI_MATH_PI * 0.5) 253 | 254 | /* And this is to avoid endless casts to float */ 255 | #define AI_MATH_PI_F (3.1415926538f) 256 | #define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f) 257 | #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f) 258 | 259 | /* Tiny macro to convert from radians to degrees and back */ 260 | #define AI_DEG_TO_RAD(x) ((x)*0.0174532925f) 261 | #define AI_RAD_TO_DEG(x) ((x)*57.2957795f) 262 | 263 | /* Support for big-endian builds */ 264 | #if defined(__BYTE_ORDER__) 265 | # if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 266 | # if !defined(__BIG_ENDIAN__) 267 | # define __BIG_ENDIAN__ 268 | # endif 269 | # else /* little endian */ 270 | # if defined (__BIG_ENDIAN__) 271 | # undef __BIG_ENDIAN__ 272 | # endif 273 | # endif 274 | #endif 275 | #if defined(__BIG_ENDIAN__) 276 | # define AI_BUILD_BIG_ENDIAN 277 | #endif 278 | 279 | 280 | /* To avoid running out of memory 281 | * This can be adjusted for specific use cases 282 | * It's NOT a total limit, just a limit for individual allocations 283 | */ 284 | #define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type)) 285 | 286 | 287 | #endif // !! INCLUDED_AI_DEFINES_H 288 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/importerdesc.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file importerdesc.h 43 | * @brief #aiImporterFlags, aiImporterDesc implementation. 44 | */ 45 | #ifndef INCLUDED_AI_IMPORTER_DESC_H 46 | #define INCLUDED_AI_IMPORTER_DESC_H 47 | 48 | 49 | /** Mixed set of flags for #aiImporterDesc, indicating some features 50 | * common to many importers*/ 51 | enum aiImporterFlags 52 | { 53 | /** Indicates that there is a textual encoding of the 54 | * file format; and that it is supported.*/ 55 | aiImporterFlags_SupportTextFlavour = 0x1, 56 | 57 | /** Indicates that there is a binary encoding of the 58 | * file format; and that it is supported.*/ 59 | aiImporterFlags_SupportBinaryFlavour = 0x2, 60 | 61 | /** Indicates that there is a compressed encoding of the 62 | * file format; and that it is supported.*/ 63 | aiImporterFlags_SupportCompressedFlavour = 0x4, 64 | 65 | /** Indicates that the importer reads only a very particular 66 | * subset of the file format. This happens commonly for 67 | * declarative or procedural formats which cannot easily 68 | * be mapped to #aiScene */ 69 | aiImporterFlags_LimitedSupport = 0x8, 70 | 71 | /** Indicates that the importer is highly experimental and 72 | * should be used with care. This only happens for trunk 73 | * (i.e. SVN) versions, experimental code is not included 74 | * in releases. */ 75 | aiImporterFlags_Experimental = 0x10 76 | }; 77 | 78 | 79 | /** Meta information about a particular importer. Importers need to fill 80 | * this structure, but they can freely decide how talkative they are. 81 | * A common use case for loader meta info is a user interface 82 | * in which the user can choose between various import/export file 83 | * formats. Building such an UI by hand means a lot of maintenance 84 | * as importers/exporters are added to Assimp, so it might be useful 85 | * to have a common mechanism to query some rough importer 86 | * characteristics. */ 87 | struct aiImporterDesc 88 | { 89 | /** Full name of the importer (i.e. Blender3D importer)*/ 90 | const char* mName; 91 | 92 | /** Original author (left blank if unknown or whole assimp team) */ 93 | const char* mAuthor; 94 | 95 | /** Current maintainer, left blank if the author maintains */ 96 | const char* mMaintainer; 97 | 98 | /** Implementation comments, i.e. unimplemented features*/ 99 | const char* mComments; 100 | 101 | /** These flags indicate some characteristics common to many 102 | importers. */ 103 | unsigned int mFlags; 104 | 105 | /** Minimum format version that can be loaded im major.minor format, 106 | both are set to 0 if there is either no version scheme 107 | or if the loader doesn't care. */ 108 | unsigned int mMinMajor; 109 | unsigned int mMinMinor; 110 | 111 | /** Maximum format version that can be loaded im major.minor format, 112 | both are set to 0 if there is either no version scheme 113 | or if the loader doesn't care. Loaders that expect to be 114 | forward-compatible to potential future format versions should 115 | indicate zero, otherwise they should specify the current 116 | maximum version.*/ 117 | unsigned int mMaxMajor; 118 | unsigned int mMaxMinor; 119 | 120 | /** List of file extensions this importer can handle. 121 | List entries are separated by space characters. 122 | All entries are lower case without a leading dot (i.e. 123 | "xml dae" would be a valid value. Note that multiple 124 | importers may respond to the same file extension - 125 | assimp calls all importers in the order in which they 126 | are registered and each importer gets the opportunity 127 | to load the file until one importer "claims" the file. Apart 128 | from file extension checks, importers typically use 129 | other methods to quickly reject files (i.e. magic 130 | words) so this does not mean that common or generic 131 | file extensions such as XML would be tediously slow. */ 132 | const char* mFileExtensions; 133 | }; 134 | 135 | /** \brief Returns the Importer description for a given extension. 136 | 137 | Will return a NULL-pointer if no assigned importer desc. was found for the given extension 138 | \param extension [in] The extension to look for 139 | \return A pointer showing to the ImporterDesc, \see aiImporterDesc. 140 | */ 141 | ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension ); 142 | 143 | #endif 144 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/light.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file light.h 43 | * @brief Defines the aiLight data structure 44 | */ 45 | 46 | #ifndef __AI_LIGHT_H_INC__ 47 | #define __AI_LIGHT_H_INC__ 48 | 49 | #include "types.h" 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | // --------------------------------------------------------------------------- 56 | /** Enumerates all supported types of light sources. 57 | */ 58 | enum aiLightSourceType 59 | { 60 | aiLightSource_UNDEFINED = 0x0, 61 | 62 | //! A directional light source has a well-defined direction 63 | //! but is infinitely far away. That's quite a good 64 | //! approximation for sun light. 65 | aiLightSource_DIRECTIONAL = 0x1, 66 | 67 | //! A point light source has a well-defined position 68 | //! in space but no direction - it emits light in all 69 | //! directions. A normal bulb is a point light. 70 | aiLightSource_POINT = 0x2, 71 | 72 | //! A spot light source emits light in a specific 73 | //! angle. It has a position and a direction it is pointing to. 74 | //! A good example for a spot light is a light spot in 75 | //! sport arenas. 76 | aiLightSource_SPOT = 0x3, 77 | 78 | //! The generic light level of the world, including the bounces 79 | //! of all other lightsources. 80 | //! Typically, there's at most one ambient light in a scene. 81 | //! This light type doesn't have a valid position, direction, or 82 | //! other properties, just a color. 83 | aiLightSource_AMBIENT = 0x4, 84 | 85 | 86 | /** This value is not used. It is just there to force the 87 | * compiler to map this enum to a 32 Bit integer. 88 | */ 89 | #ifndef SWIG 90 | _aiLightSource_Force32Bit = INT_MAX 91 | #endif 92 | }; 93 | 94 | // --------------------------------------------------------------------------- 95 | /** Helper structure to describe a light source. 96 | * 97 | * Assimp supports multiple sorts of light sources, including 98 | * directional, point and spot lights. All of them are defined with just 99 | * a single structure and distinguished by their parameters. 100 | * Note - some file formats (such as 3DS, ASE) export a "target point" - 101 | * the point a spot light is looking at (it can even be animated). Assimp 102 | * writes the target point as a subnode of a spotlights's main node, 103 | * called ".Target". However, this is just additional information 104 | * then, the transformation tracks of the main node make the 105 | * spot light already point in the right direction. 106 | */ 107 | struct aiLight 108 | { 109 | /** The name of the light source. 110 | * 111 | * There must be a node in the scenegraph with the same name. 112 | * This node specifies the position of the light in the scene 113 | * hierarchy and can be animated. 114 | */ 115 | C_STRUCT aiString mName; 116 | 117 | /** The type of the light source. 118 | * 119 | * aiLightSource_UNDEFINED is not a valid value for this member. 120 | */ 121 | C_ENUM aiLightSourceType mType; 122 | 123 | /** Position of the light source in space. Relative to the 124 | * transformation of the node corresponding to the light. 125 | * 126 | * The position is undefined for directional lights. 127 | */ 128 | C_STRUCT aiVector3D mPosition; 129 | 130 | /** Direction of the light source in space. Relative to the 131 | * transformation of the node corresponding to the light. 132 | * 133 | * The direction is undefined for point lights. The vector 134 | * may be normalized, but it needn't. 135 | */ 136 | C_STRUCT aiVector3D mDirection; 137 | 138 | /** Constant light attenuation factor. 139 | * 140 | * The intensity of the light source at a given distance 'd' from 141 | * the light's position is 142 | * @code 143 | * Atten = 1/( att0 + att1 * d + att2 * d*d) 144 | * @endcode 145 | * This member corresponds to the att0 variable in the equation. 146 | * Naturally undefined for directional lights. 147 | */ 148 | float mAttenuationConstant; 149 | 150 | /** Linear light attenuation factor. 151 | * 152 | * The intensity of the light source at a given distance 'd' from 153 | * the light's position is 154 | * @code 155 | * Atten = 1/( att0 + att1 * d + att2 * d*d) 156 | * @endcode 157 | * This member corresponds to the att1 variable in the equation. 158 | * Naturally undefined for directional lights. 159 | */ 160 | float mAttenuationLinear; 161 | 162 | /** Quadratic light attenuation factor. 163 | * 164 | * The intensity of the light source at a given distance 'd' from 165 | * the light's position is 166 | * @code 167 | * Atten = 1/( att0 + att1 * d + att2 * d*d) 168 | * @endcode 169 | * This member corresponds to the att2 variable in the equation. 170 | * Naturally undefined for directional lights. 171 | */ 172 | float mAttenuationQuadratic; 173 | 174 | /** Diffuse color of the light source 175 | * 176 | * The diffuse light color is multiplied with the diffuse 177 | * material color to obtain the final color that contributes 178 | * to the diffuse shading term. 179 | */ 180 | C_STRUCT aiColor3D mColorDiffuse; 181 | 182 | /** Specular color of the light source 183 | * 184 | * The specular light color is multiplied with the specular 185 | * material color to obtain the final color that contributes 186 | * to the specular shading term. 187 | */ 188 | C_STRUCT aiColor3D mColorSpecular; 189 | 190 | /** Ambient color of the light source 191 | * 192 | * The ambient light color is multiplied with the ambient 193 | * material color to obtain the final color that contributes 194 | * to the ambient shading term. Most renderers will ignore 195 | * this value it, is just a remaining of the fixed-function pipeline 196 | * that is still supported by quite many file formats. 197 | */ 198 | C_STRUCT aiColor3D mColorAmbient; 199 | 200 | /** Inner angle of a spot light's light cone. 201 | * 202 | * The spot light has maximum influence on objects inside this 203 | * angle. The angle is given in radians. It is 2PI for point 204 | * lights and undefined for directional lights. 205 | */ 206 | float mAngleInnerCone; 207 | 208 | /** Outer angle of a spot light's light cone. 209 | * 210 | * The spot light does not affect objects outside this angle. 211 | * The angle is given in radians. It is 2PI for point lights and 212 | * undefined for directional lights. The outer angle must be 213 | * greater than or equal to the inner angle. 214 | * It is assumed that the application uses a smooth 215 | * interpolation between the inner and the outer cone of the 216 | * spot light. 217 | */ 218 | float mAngleOuterCone; 219 | 220 | #ifdef __cplusplus 221 | 222 | aiLight() 223 | : mType (aiLightSource_UNDEFINED) 224 | , mAttenuationConstant (0.f) 225 | , mAttenuationLinear (1.f) 226 | , mAttenuationQuadratic (0.f) 227 | , mAngleInnerCone ((float)AI_MATH_TWO_PI) 228 | , mAngleOuterCone ((float)AI_MATH_TWO_PI) 229 | { 230 | } 231 | 232 | #endif 233 | }; 234 | 235 | #ifdef __cplusplus 236 | } 237 | #endif 238 | 239 | 240 | #endif // !! __AI_LIGHT_H_INC__ 241 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/material.inl: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file material.inl 43 | * @brief Defines the C++ getters for the material system 44 | */ 45 | 46 | #ifndef AI_MATERIAL_INL_INC 47 | #define AI_MATERIAL_INL_INC 48 | 49 | //! @cond never 50 | 51 | // --------------------------------------------------------------------------- 52 | inline aiReturn aiMaterial::GetTexture( aiTextureType type, 53 | unsigned int index, 54 | C_STRUCT aiString* path, 55 | aiTextureMapping* mapping /*= NULL*/, 56 | unsigned int* uvindex /*= NULL*/, 57 | float* blend /*= NULL*/, 58 | aiTextureOp* op /*= NULL*/, 59 | aiTextureMapMode* mapmode /*= NULL*/) const 60 | { 61 | return ::aiGetMaterialTexture(this,type,index,path,mapping,uvindex,blend,op,mapmode); 62 | } 63 | 64 | // --------------------------------------------------------------------------- 65 | inline unsigned int aiMaterial::GetTextureCount(aiTextureType type) const 66 | { 67 | return ::aiGetMaterialTextureCount(this,type); 68 | } 69 | 70 | // --------------------------------------------------------------------------- 71 | template 72 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 73 | unsigned int idx, Type* pOut, 74 | unsigned int* pMax) const 75 | { 76 | unsigned int iNum = pMax ? *pMax : 1; 77 | 78 | const aiMaterialProperty* prop; 79 | const aiReturn ret = ::aiGetMaterialProperty(this,pKey,type,idx, 80 | (const aiMaterialProperty**)&prop); 81 | if ( AI_SUCCESS == ret ) { 82 | 83 | if (prop->mDataLength < sizeof(Type)*iNum) { 84 | return AI_FAILURE; 85 | } 86 | 87 | if (prop->mType != aiPTI_Buffer) { 88 | return AI_FAILURE; 89 | } 90 | 91 | iNum = std::min((size_t)iNum,prop->mDataLength / sizeof(Type)); 92 | ::memcpy(pOut,prop->mData,iNum * sizeof(Type)); 93 | if (pMax) { 94 | *pMax = iNum; 95 | } 96 | } 97 | return ret; 98 | } 99 | 100 | // --------------------------------------------------------------------------- 101 | template 102 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 103 | unsigned int idx,Type& pOut) const 104 | { 105 | const aiMaterialProperty* prop; 106 | const aiReturn ret = ::aiGetMaterialProperty(this,pKey,type,idx, 107 | (const aiMaterialProperty**)&prop); 108 | if ( AI_SUCCESS == ret ) { 109 | 110 | if (prop->mDataLength < sizeof(Type)) { 111 | return AI_FAILURE; 112 | } 113 | 114 | if (prop->mType != aiPTI_Buffer) { 115 | return AI_FAILURE; 116 | } 117 | 118 | ::memcpy(&pOut,prop->mData,sizeof(Type)); 119 | } 120 | return ret; 121 | } 122 | 123 | // --------------------------------------------------------------------------- 124 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 125 | unsigned int idx,float* pOut, 126 | unsigned int* pMax) const 127 | { 128 | return ::aiGetMaterialFloatArray(this,pKey,type,idx,pOut,pMax); 129 | } 130 | // --------------------------------------------------------------------------- 131 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 132 | unsigned int idx,int* pOut, 133 | unsigned int* pMax) const 134 | { 135 | return ::aiGetMaterialIntegerArray(this,pKey,type,idx,pOut,pMax); 136 | } 137 | // --------------------------------------------------------------------------- 138 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 139 | unsigned int idx,float& pOut) const 140 | { 141 | return aiGetMaterialFloat(this,pKey,type,idx,&pOut); 142 | } 143 | // --------------------------------------------------------------------------- 144 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 145 | unsigned int idx,int& pOut) const 146 | { 147 | return aiGetMaterialInteger(this,pKey,type,idx,&pOut); 148 | } 149 | // --------------------------------------------------------------------------- 150 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 151 | unsigned int idx,aiColor4D& pOut) const 152 | { 153 | return aiGetMaterialColor(this,pKey,type,idx,&pOut); 154 | } 155 | // --------------------------------------------------------------------------- 156 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 157 | unsigned int idx,aiColor3D& pOut) const 158 | { 159 | aiColor4D c; 160 | const aiReturn ret = aiGetMaterialColor(this,pKey,type,idx,&c); 161 | pOut = aiColor3D(c.r,c.g,c.b); 162 | return ret; 163 | } 164 | // --------------------------------------------------------------------------- 165 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 166 | unsigned int idx,aiString& pOut) const 167 | { 168 | return aiGetMaterialString(this,pKey,type,idx,&pOut); 169 | } 170 | // --------------------------------------------------------------------------- 171 | inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, 172 | unsigned int idx,aiUVTransform& pOut) const 173 | { 174 | return aiGetMaterialUVTransform(this,pKey,type,idx,&pOut); 175 | } 176 | 177 | 178 | // --------------------------------------------------------------------------- 179 | template 180 | aiReturn aiMaterial::AddProperty (const TYPE* pInput, 181 | const unsigned int pNumValues, 182 | const char* pKey, 183 | unsigned int type, 184 | unsigned int index) 185 | { 186 | return AddBinaryProperty((const void*)pInput, 187 | pNumValues * sizeof(TYPE), 188 | pKey,type,index,aiPTI_Buffer); 189 | } 190 | 191 | // --------------------------------------------------------------------------- 192 | inline aiReturn aiMaterial::AddProperty(const float* pInput, 193 | const unsigned int pNumValues, 194 | const char* pKey, 195 | unsigned int type, 196 | unsigned int index) 197 | { 198 | return AddBinaryProperty((const void*)pInput, 199 | pNumValues * sizeof(float), 200 | pKey,type,index,aiPTI_Float); 201 | } 202 | 203 | // --------------------------------------------------------------------------- 204 | inline aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, 205 | const unsigned int pNumValues, 206 | const char* pKey, 207 | unsigned int type, 208 | unsigned int index) 209 | { 210 | return AddBinaryProperty((const void*)pInput, 211 | pNumValues * sizeof(aiUVTransform), 212 | pKey,type,index,aiPTI_Float); 213 | } 214 | 215 | // --------------------------------------------------------------------------- 216 | inline aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, 217 | const unsigned int pNumValues, 218 | const char* pKey, 219 | unsigned int type, 220 | unsigned int index) 221 | { 222 | return AddBinaryProperty((const void*)pInput, 223 | pNumValues * sizeof(aiColor4D), 224 | pKey,type,index,aiPTI_Float); 225 | } 226 | 227 | // --------------------------------------------------------------------------- 228 | inline aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, 229 | const unsigned int pNumValues, 230 | const char* pKey, 231 | unsigned int type, 232 | unsigned int index) 233 | { 234 | return AddBinaryProperty((const void*)pInput, 235 | pNumValues * sizeof(aiColor3D), 236 | pKey,type,index,aiPTI_Float); 237 | } 238 | 239 | // --------------------------------------------------------------------------- 240 | inline aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, 241 | const unsigned int pNumValues, 242 | const char* pKey, 243 | unsigned int type, 244 | unsigned int index) 245 | { 246 | return AddBinaryProperty((const void*)pInput, 247 | pNumValues * sizeof(aiVector3D), 248 | pKey,type,index,aiPTI_Float); 249 | } 250 | 251 | // --------------------------------------------------------------------------- 252 | inline aiReturn aiMaterial::AddProperty(const int* pInput, 253 | const unsigned int pNumValues, 254 | const char* pKey, 255 | unsigned int type, 256 | unsigned int index) 257 | { 258 | return AddBinaryProperty((const void*)pInput, 259 | pNumValues * sizeof(int), 260 | pKey,type,index,aiPTI_Integer); 261 | } 262 | 263 | 264 | // --------------------------------------------------------------------------- 265 | // The template specializations below are for backwards compatibility. 266 | // The recommended way to add material properties is using the non-template 267 | // overloads. 268 | // --------------------------------------------------------------------------- 269 | 270 | // --------------------------------------------------------------------------- 271 | template<> 272 | inline aiReturn aiMaterial::AddProperty(const float* pInput, 273 | const unsigned int pNumValues, 274 | const char* pKey, 275 | unsigned int type, 276 | unsigned int index) 277 | { 278 | return AddBinaryProperty((const void*)pInput, 279 | pNumValues * sizeof(float), 280 | pKey,type,index,aiPTI_Float); 281 | } 282 | 283 | // --------------------------------------------------------------------------- 284 | template<> 285 | inline aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, 286 | const unsigned int pNumValues, 287 | const char* pKey, 288 | unsigned int type, 289 | unsigned int index) 290 | { 291 | return AddBinaryProperty((const void*)pInput, 292 | pNumValues * sizeof(aiUVTransform), 293 | pKey,type,index,aiPTI_Float); 294 | } 295 | 296 | // --------------------------------------------------------------------------- 297 | template<> 298 | inline aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, 299 | const unsigned int pNumValues, 300 | const char* pKey, 301 | unsigned int type, 302 | unsigned int index) 303 | { 304 | return AddBinaryProperty((const void*)pInput, 305 | pNumValues * sizeof(aiColor4D), 306 | pKey,type,index,aiPTI_Float); 307 | } 308 | 309 | // --------------------------------------------------------------------------- 310 | template<> 311 | inline aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, 312 | const unsigned int pNumValues, 313 | const char* pKey, 314 | unsigned int type, 315 | unsigned int index) 316 | { 317 | return AddBinaryProperty((const void*)pInput, 318 | pNumValues * sizeof(aiColor3D), 319 | pKey,type,index,aiPTI_Float); 320 | } 321 | 322 | // --------------------------------------------------------------------------- 323 | template<> 324 | inline aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, 325 | const unsigned int pNumValues, 326 | const char* pKey, 327 | unsigned int type, 328 | unsigned int index) 329 | { 330 | return AddBinaryProperty((const void*)pInput, 331 | pNumValues * sizeof(aiVector3D), 332 | pKey,type,index,aiPTI_Float); 333 | } 334 | 335 | // --------------------------------------------------------------------------- 336 | template<> 337 | inline aiReturn aiMaterial::AddProperty(const int* pInput, 338 | const unsigned int pNumValues, 339 | const char* pKey, 340 | unsigned int type, 341 | unsigned int index) 342 | { 343 | return AddBinaryProperty((const void*)pInput, 344 | pNumValues * sizeof(int), 345 | pKey,type,index,aiPTI_Integer); 346 | } 347 | 348 | //! @endcond 349 | 350 | #endif //! AI_MATERIAL_INL_INC 351 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/matrix3x3.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file matrix3x3.h 43 | * @brief Definition of a 3x3 matrix, including operators when compiling in C++ 44 | */ 45 | #ifndef AI_MATRIX3x3_H_INC 46 | #define AI_MATRIX3x3_H_INC 47 | 48 | #include "./Compiler/pushpack1.h" 49 | 50 | #ifdef __cplusplus 51 | 52 | template class aiMatrix4x4t; 53 | template class aiVector2t; 54 | 55 | // --------------------------------------------------------------------------- 56 | /** @brief Represents a row-major 3x3 matrix 57 | * 58 | * There's much confusion about matrix layouts (column vs. row order). 59 | * This is *always* a row-major matrix. Not even with the 60 | * #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect 61 | * matrix order - it just affects the handedness of the coordinate system 62 | * defined thereby. 63 | */ 64 | template 65 | class aiMatrix3x3t 66 | { 67 | public: 68 | 69 | aiMatrix3x3t () : 70 | a1(static_cast(1.0f)), a2(), a3(), 71 | b1(), b2(static_cast(1.0f)), b3(), 72 | c1(), c2(), c3(static_cast(1.0f)) {} 73 | 74 | aiMatrix3x3t ( TReal _a1, TReal _a2, TReal _a3, 75 | TReal _b1, TReal _b2, TReal _b3, 76 | TReal _c1, TReal _c2, TReal _c3) : 77 | a1(_a1), a2(_a2), a3(_a3), 78 | b1(_b1), b2(_b2), b3(_b3), 79 | c1(_c1), c2(_c2), c3(_c3) 80 | {} 81 | 82 | public: 83 | 84 | // matrix multiplication. 85 | aiMatrix3x3t& operator *= (const aiMatrix3x3t& m); 86 | aiMatrix3x3t operator * (const aiMatrix3x3t& m) const; 87 | 88 | // array access operators 89 | TReal* operator[] (unsigned int p_iIndex); 90 | const TReal* operator[] (unsigned int p_iIndex) const; 91 | 92 | // comparison operators 93 | bool operator== (const aiMatrix4x4t& m) const; 94 | bool operator!= (const aiMatrix4x4t& m) const; 95 | 96 | bool Equal(const aiMatrix4x4t& m, TReal epsilon = 1e-6) const; 97 | 98 | template 99 | operator aiMatrix3x3t () const; 100 | 101 | public: 102 | 103 | // ------------------------------------------------------------------- 104 | /** @brief Construction from a 4x4 matrix. The remaining parts 105 | * of the matrix are ignored. 106 | */ 107 | explicit aiMatrix3x3t( const aiMatrix4x4t& pMatrix); 108 | 109 | // ------------------------------------------------------------------- 110 | /** @brief Transpose the matrix 111 | */ 112 | aiMatrix3x3t& Transpose(); 113 | 114 | // ------------------------------------------------------------------- 115 | /** @brief Invert the matrix. 116 | * If the matrix is not invertible all elements are set to qnan. 117 | * Beware, use (f != f) to check whether a TReal f is qnan. 118 | */ 119 | aiMatrix3x3t& Inverse(); 120 | TReal Determinant() const; 121 | 122 | public: 123 | // ------------------------------------------------------------------- 124 | /** @brief Returns a rotation matrix for a rotation around z 125 | * @param a Rotation angle, in radians 126 | * @param out Receives the output matrix 127 | * @return Reference to the output matrix 128 | */ 129 | static aiMatrix3x3t& RotationZ(TReal a, aiMatrix3x3t& out); 130 | 131 | // ------------------------------------------------------------------- 132 | /** @brief Returns a rotation matrix for a rotation around 133 | * an arbitrary axis. 134 | * 135 | * @param a Rotation angle, in radians 136 | * @param axis Axis to rotate around 137 | * @param out To be filled 138 | */ 139 | static aiMatrix3x3t& Rotation( TReal a, 140 | const aiVector3t& axis, aiMatrix3x3t& out); 141 | 142 | // ------------------------------------------------------------------- 143 | /** @brief Returns a translation matrix 144 | * @param v Translation vector 145 | * @param out Receives the output matrix 146 | * @return Reference to the output matrix 147 | */ 148 | static aiMatrix3x3t& Translation( const aiVector2t& v, aiMatrix3x3t& out); 149 | 150 | // ------------------------------------------------------------------- 151 | /** @brief A function for creating a rotation matrix that rotates a 152 | * vector called "from" into another vector called "to". 153 | * Input : from[3], to[3] which both must be *normalized* non-zero vectors 154 | * Output: mtx[3][3] -- a 3x3 matrix in colum-major form 155 | * Authors: Tomas M�ller, John Hughes 156 | * "Efficiently Building a Matrix to Rotate One Vector to Another" 157 | * Journal of Graphics Tools, 4(4):1-4, 1999 158 | */ 159 | static aiMatrix3x3t& FromToMatrix(const aiVector3t& from, 160 | const aiVector3t& to, aiMatrix3x3t& out); 161 | 162 | public: 163 | 164 | 165 | TReal a1, a2, a3; 166 | TReal b1, b2, b3; 167 | TReal c1, c2, c3; 168 | } PACK_STRUCT; 169 | 170 | typedef aiMatrix3x3t aiMatrix3x3; 171 | 172 | #else 173 | 174 | struct aiMatrix3x3 { 175 | 176 | float a1, a2, a3; 177 | float b1, b2, b3; 178 | float c1, c2, c3; 179 | } PACK_STRUCT; 180 | 181 | #endif 182 | 183 | #include "./Compiler/poppack1.h" 184 | 185 | #endif // AI_MATRIX3x3_H_INC 186 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/matrix4x4.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | /** @file matrix4x4.h 42 | * @brief 4x4 matrix structure, including operators when compiling in C++ 43 | */ 44 | #ifndef AI_MATRIX4X4_H_INC 45 | #define AI_MATRIX4X4_H_INC 46 | 47 | #include "vector3.h" 48 | #include "./Compiler/pushpack1.h" 49 | 50 | #ifdef __cplusplus 51 | 52 | template class aiMatrix3x3t; 53 | template class aiQuaterniont; 54 | 55 | // --------------------------------------------------------------------------- 56 | /** @brief Represents a row-major 4x4 matrix, use this for homogeneous 57 | * coordinates. 58 | * 59 | * There's much confusion about matrix layouts (column vs. row order). 60 | * This is *always* a row-major matrix. Not even with the 61 | * #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect 62 | * matrix order - it just affects the handedness of the coordinate system 63 | * defined thereby. 64 | */ 65 | template 66 | class aiMatrix4x4t 67 | { 68 | public: 69 | 70 | /** set to identity */ 71 | aiMatrix4x4t (); 72 | 73 | /** construction from single values */ 74 | aiMatrix4x4t ( TReal _a1, TReal _a2, TReal _a3, TReal _a4, 75 | TReal _b1, TReal _b2, TReal _b3, TReal _b4, 76 | TReal _c1, TReal _c2, TReal _c3, TReal _c4, 77 | TReal _d1, TReal _d2, TReal _d3, TReal _d4); 78 | 79 | 80 | /** construction from 3x3 matrix, remaining elements are set to identity */ 81 | explicit aiMatrix4x4t( const aiMatrix3x3t& m); 82 | 83 | /** construction from position, rotation and scaling components 84 | * @param scaling The scaling for the x,y,z axes 85 | * @param rotation The rotation as a hamilton quaternion 86 | * @param position The position for the x,y,z axes 87 | */ 88 | aiMatrix4x4t(const aiVector3t& scaling, const aiQuaterniont& rotation, 89 | const aiVector3t& position); 90 | 91 | public: 92 | 93 | // array access operators 94 | TReal* operator[] (unsigned int p_iIndex); 95 | const TReal* operator[] (unsigned int p_iIndex) const; 96 | 97 | // comparison operators 98 | bool operator== (const aiMatrix4x4t& m) const; 99 | bool operator!= (const aiMatrix4x4t& m) const; 100 | 101 | bool Equal(const aiMatrix4x4t& m, TReal epsilon = 1e-6) const; 102 | 103 | // matrix multiplication. 104 | aiMatrix4x4t& operator *= (const aiMatrix4x4t& m); 105 | aiMatrix4x4t operator * (const aiMatrix4x4t& m) const; 106 | 107 | template 108 | operator aiMatrix4x4t () const; 109 | 110 | public: 111 | 112 | // ------------------------------------------------------------------- 113 | /** @brief Transpose the matrix */ 114 | aiMatrix4x4t& Transpose(); 115 | 116 | // ------------------------------------------------------------------- 117 | /** @brief Invert the matrix. 118 | * If the matrix is not invertible all elements are set to qnan. 119 | * Beware, use (f != f) to check whether a TReal f is qnan. 120 | */ 121 | aiMatrix4x4t& Inverse(); 122 | TReal Determinant() const; 123 | 124 | 125 | // ------------------------------------------------------------------- 126 | /** @brief Returns true of the matrix is the identity matrix. 127 | * The check is performed against a not so small epsilon. 128 | */ 129 | inline bool IsIdentity() const; 130 | 131 | // ------------------------------------------------------------------- 132 | /** @brief Decompose a trafo matrix into its original components 133 | * @param scaling Receives the output scaling for the x,y,z axes 134 | * @param rotation Receives the output rotation as a hamilton 135 | * quaternion 136 | * @param position Receives the output position for the x,y,z axes 137 | */ 138 | void Decompose (aiVector3t& scaling, aiQuaterniont& rotation, 139 | aiVector3t& position) const; 140 | 141 | // ------------------------------------------------------------------- 142 | /** @brief Decompose a trafo matrix with no scaling into its 143 | * original components 144 | * @param rotation Receives the output rotation as a hamilton 145 | * quaternion 146 | * @param position Receives the output position for the x,y,z axes 147 | */ 148 | void DecomposeNoScaling (aiQuaterniont& rotation, 149 | aiVector3t& position) const; 150 | 151 | 152 | // ------------------------------------------------------------------- 153 | /** @brief Creates a trafo matrix from a set of euler angles 154 | * @param x Rotation angle for the x-axis, in radians 155 | * @param y Rotation angle for the y-axis, in radians 156 | * @param z Rotation angle for the z-axis, in radians 157 | */ 158 | aiMatrix4x4t& FromEulerAnglesXYZ(TReal x, TReal y, TReal z); 159 | aiMatrix4x4t& FromEulerAnglesXYZ(const aiVector3t& blubb); 160 | 161 | public: 162 | // ------------------------------------------------------------------- 163 | /** @brief Returns a rotation matrix for a rotation around the x axis 164 | * @param a Rotation angle, in radians 165 | * @param out Receives the output matrix 166 | * @return Reference to the output matrix 167 | */ 168 | static aiMatrix4x4t& RotationX(TReal a, aiMatrix4x4t& out); 169 | 170 | // ------------------------------------------------------------------- 171 | /** @brief Returns a rotation matrix for a rotation around the y axis 172 | * @param a Rotation angle, in radians 173 | * @param out Receives the output matrix 174 | * @return Reference to the output matrix 175 | */ 176 | static aiMatrix4x4t& RotationY(TReal a, aiMatrix4x4t& out); 177 | 178 | // ------------------------------------------------------------------- 179 | /** @brief Returns a rotation matrix for a rotation around the z axis 180 | * @param a Rotation angle, in radians 181 | * @param out Receives the output matrix 182 | * @return Reference to the output matrix 183 | */ 184 | static aiMatrix4x4t& RotationZ(TReal a, aiMatrix4x4t& out); 185 | 186 | // ------------------------------------------------------------------- 187 | /** Returns a rotation matrix for a rotation around an arbitrary axis. 188 | * @param a Rotation angle, in radians 189 | * @param axis Rotation axis, should be a normalized vector. 190 | * @param out Receives the output matrix 191 | * @return Reference to the output matrix 192 | */ 193 | static aiMatrix4x4t& Rotation(TReal a, const aiVector3t& axis, 194 | aiMatrix4x4t& out); 195 | 196 | // ------------------------------------------------------------------- 197 | /** @brief Returns a translation matrix 198 | * @param v Translation vector 199 | * @param out Receives the output matrix 200 | * @return Reference to the output matrix 201 | */ 202 | static aiMatrix4x4t& Translation( const aiVector3t& v, aiMatrix4x4t& out); 203 | 204 | // ------------------------------------------------------------------- 205 | /** @brief Returns a scaling matrix 206 | * @param v Scaling vector 207 | * @param out Receives the output matrix 208 | * @return Reference to the output matrix 209 | */ 210 | static aiMatrix4x4t& Scaling( const aiVector3t& v, aiMatrix4x4t& out); 211 | 212 | // ------------------------------------------------------------------- 213 | /** @brief A function for creating a rotation matrix that rotates a 214 | * vector called "from" into another vector called "to". 215 | * Input : from[3], to[3] which both must be *normalized* non-zero vectors 216 | * Output: mtx[3][3] -- a 3x3 matrix in colum-major form 217 | * Authors: Tomas M�ller, John Hughes 218 | * "Efficiently Building a Matrix to Rotate One Vector to Another" 219 | * Journal of Graphics Tools, 4(4):1-4, 1999 220 | */ 221 | static aiMatrix4x4t& FromToMatrix(const aiVector3t& from, 222 | const aiVector3t& to, aiMatrix4x4t& out); 223 | 224 | public: 225 | 226 | TReal a1, a2, a3, a4; 227 | TReal b1, b2, b3, b4; 228 | TReal c1, c2, c3, c4; 229 | TReal d1, d2, d3, d4; 230 | 231 | } PACK_STRUCT; 232 | 233 | typedef aiMatrix4x4t aiMatrix4x4; 234 | 235 | #else 236 | 237 | struct aiMatrix4x4 { 238 | float a1, a2, a3, a4; 239 | float b1, b2, b3, b4; 240 | float c1, c2, c3, c4; 241 | float d1, d2, d3, d4; 242 | }; 243 | 244 | 245 | #endif // __cplusplus 246 | 247 | #include "./Compiler/poppack1.h" 248 | 249 | #endif // AI_MATRIX4X4_H_INC 250 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/metadata.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file metadata.h 43 | * @brief Defines the data structures for holding node meta information. 44 | */ 45 | #ifndef __AI_METADATA_H_INC__ 46 | #define __AI_METADATA_H_INC__ 47 | 48 | #include 49 | 50 | #if defined(_MSC_VER) && (_MSC_VER <= 1500) 51 | #include "Compiler/pstdint.h" 52 | #else 53 | #include 54 | #include 55 | #endif 56 | 57 | 58 | 59 | // ------------------------------------------------------------------------------- 60 | /** 61 | * Enum used to distinguish data types 62 | */ 63 | // ------------------------------------------------------------------------------- 64 | typedef enum aiMetadataType 65 | { 66 | AI_BOOL = 0, 67 | AI_INT = 1, 68 | AI_UINT64 = 2, 69 | AI_FLOAT = 3, 70 | AI_AISTRING = 4, 71 | AI_AIVECTOR3D = 5, 72 | 73 | #ifndef SWIG 74 | FORCE_32BIT = INT_MAX 75 | #endif 76 | } aiMetadataType; 77 | 78 | 79 | 80 | // ------------------------------------------------------------------------------- 81 | /** 82 | * Metadata entry 83 | * 84 | * The type field uniquely identifies the underlying type of the data field 85 | */ 86 | // ------------------------------------------------------------------------------- 87 | struct aiMetadataEntry 88 | { 89 | aiMetadataType mType; 90 | void* mData; 91 | }; 92 | 93 | 94 | 95 | #ifdef __cplusplus 96 | 97 | #include 98 | 99 | 100 | 101 | // ------------------------------------------------------------------------------- 102 | /** 103 | * Helper functions to get the aiType enum entry for a type 104 | */ 105 | // ------------------------------------------------------------------------------- 106 | inline aiMetadataType GetAiType( bool ) { return AI_BOOL; } 107 | inline aiMetadataType GetAiType( int ) { return AI_INT; } 108 | inline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; } 109 | inline aiMetadataType GetAiType( float ) { return AI_FLOAT; } 110 | inline aiMetadataType GetAiType( aiString ) { return AI_AISTRING; } 111 | inline aiMetadataType GetAiType( aiVector3D ) { return AI_AIVECTOR3D; } 112 | 113 | 114 | 115 | #endif 116 | 117 | 118 | 119 | // ------------------------------------------------------------------------------- 120 | /** 121 | * Container for holding metadata. 122 | * 123 | * Metadata is a key-value store using string keys and values. 124 | */ 125 | // ------------------------------------------------------------------------------- 126 | struct aiMetadata 127 | { 128 | /** Length of the mKeys and mValues arrays, respectively */ 129 | unsigned int mNumProperties; 130 | 131 | /** Arrays of keys, may not be NULL. Entries in this array may not be NULL as well. */ 132 | C_STRUCT aiString* mKeys; 133 | 134 | /** Arrays of values, may not be NULL. Entries in this array may be NULL if the 135 | * corresponding property key has no assigned value. */ 136 | C_STRUCT aiMetadataEntry* mValues; 137 | 138 | #ifdef __cplusplus 139 | 140 | /** Constructor */ 141 | aiMetadata() 142 | // set all members to zero by default 143 | : mNumProperties(0) 144 | , mKeys(NULL) 145 | , mValues(NULL) 146 | {} 147 | 148 | 149 | /** Destructor */ 150 | ~aiMetadata() 151 | { 152 | delete[] mKeys; 153 | mKeys = NULL; 154 | if (mValues) 155 | { 156 | // Delete each metadata entry 157 | for (unsigned i=0; i(data); 164 | break; 165 | case AI_INT: 166 | delete static_cast(data); 167 | break; 168 | case AI_UINT64: 169 | delete static_cast(data); 170 | break; 171 | case AI_FLOAT: 172 | delete static_cast(data); 173 | break; 174 | case AI_AISTRING: 175 | delete static_cast(data); 176 | break; 177 | case AI_AIVECTOR3D: 178 | delete static_cast(data); 179 | break; 180 | default: 181 | assert(false); 182 | break; 183 | } 184 | } 185 | 186 | // Delete the metadata array 187 | delete [] mValues; 188 | mValues = NULL; 189 | } 190 | } 191 | 192 | 193 | 194 | template 195 | inline void Set( unsigned index, const std::string& key, const T& value ) 196 | { 197 | // In range assertion 198 | assert(index < mNumProperties); 199 | 200 | // Set metadata key 201 | mKeys[index] = key; 202 | 203 | // Set metadata type 204 | mValues[index].mType = GetAiType(value); 205 | // Copy the given value to the dynamic storage 206 | mValues[index].mData = new T(value); 207 | } 208 | 209 | template 210 | inline bool Get( unsigned index, T& value ) 211 | { 212 | // In range assertion 213 | assert(index < mNumProperties); 214 | 215 | // Return false if the output data type does 216 | // not match the found value's data type 217 | if ( GetAiType( value ) != mValues[ index ].mType ) { 218 | return false; 219 | } 220 | 221 | // Otherwise, output the found value and 222 | // return true 223 | value = *static_cast(mValues[index].mData); 224 | return true; 225 | } 226 | 227 | template 228 | inline bool Get( const aiString& key, T& value ) 229 | { 230 | // Search for the given key 231 | for (unsigned i=0; i 238 | inline bool Get( const std::string& key, T& value ) { 239 | return Get(aiString(key), value); 240 | } 241 | 242 | #endif // __cplusplus 243 | 244 | }; 245 | 246 | #endif // __AI_METADATA_H_INC__ 247 | 248 | 249 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2012, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | 41 | /** @file Android implementation of IOSystem using the standard C file functions. 42 | * Aimed to ease the acces to android assets */ 43 | 44 | #if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) 45 | #ifndef AI_ANDROIDJNIIOSYSTEM_H_INC 46 | #define AI_ANDROIDJNIIOSYSTEM_H_INC 47 | 48 | #include "../code/DefaultIOSystem.h" 49 | #include 50 | #include 51 | #include 52 | 53 | namespace Assimp { 54 | 55 | // --------------------------------------------------------------------------- 56 | /** Android extension to DefaultIOSystem using the standard C file functions */ 57 | class AndroidJNIIOSystem : public DefaultIOSystem 58 | { 59 | public: 60 | 61 | /** Initialize android activity data */ 62 | std::string mApkWorkspacePath; 63 | AAssetManager* mApkAssetManager; 64 | 65 | /** Constructor. */ 66 | AndroidJNIIOSystem(ANativeActivity* activity); 67 | 68 | /** Destructor. */ 69 | ~AndroidJNIIOSystem(); 70 | 71 | // ------------------------------------------------------------------- 72 | /** Tests for the existence of a file at the given path. */ 73 | bool Exists( const char* pFile) const; 74 | 75 | // ------------------------------------------------------------------- 76 | /** Opens a file at the given path, with given mode */ 77 | IOStream* Open( const char* strFile, const char* strMode); 78 | 79 | // ------------------------------------------------------------------------------------------------ 80 | // Inits Android extractor 81 | void AndroidActivityInit(ANativeActivity* activity); 82 | 83 | // ------------------------------------------------------------------------------------------------ 84 | // Extracts android asset 85 | bool AndroidExtractAsset(std::string name); 86 | 87 | }; 88 | 89 | } //!ns Assimp 90 | 91 | #endif //AI_ANDROIDJNIIOSYSTEM_H_INC 92 | #endif //__ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) 93 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/quaternion.h: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2016, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | 41 | /** @file quaternion.h 42 | * @brief Quaternion structure, including operators when compiling in C++ 43 | */ 44 | #ifndef AI_QUATERNION_H_INC 45 | #define AI_QUATERNION_H_INC 46 | 47 | #ifdef __cplusplus 48 | 49 | template class aiVector3t; 50 | template class aiMatrix3x3t; 51 | 52 | // --------------------------------------------------------------------------- 53 | /** Represents a quaternion in a 4D vector. */ 54 | template 55 | class aiQuaterniont 56 | { 57 | public: 58 | aiQuaterniont() : w(1.0), x(), y(), z() {} 59 | aiQuaterniont(TReal pw, TReal px, TReal py, TReal pz) 60 | : w(pw), x(px), y(py), z(pz) {} 61 | 62 | /** Construct from rotation matrix. Result is undefined if the matrix is not orthonormal. */ 63 | explicit aiQuaterniont( const aiMatrix3x3t& pRotMatrix); 64 | 65 | /** Construct from euler angles */ 66 | aiQuaterniont( TReal rotx, TReal roty, TReal rotz); 67 | 68 | /** Construct from an axis-angle pair */ 69 | aiQuaterniont( aiVector3t axis, TReal angle); 70 | 71 | /** Construct from a normalized quaternion stored in a vec3 */ 72 | explicit aiQuaterniont( aiVector3t normalized); 73 | 74 | /** Returns a matrix representation of the quaternion */ 75 | aiMatrix3x3t GetMatrix() const; 76 | 77 | public: 78 | 79 | bool operator== (const aiQuaterniont& o) const; 80 | bool operator!= (const aiQuaterniont& o) const; 81 | 82 | bool Equal(const aiQuaterniont& o, TReal epsilon = 1e-6) const; 83 | 84 | public: 85 | 86 | /** Normalize the quaternion */ 87 | aiQuaterniont& Normalize(); 88 | 89 | /** Compute quaternion conjugate */ 90 | aiQuaterniont& Conjugate (); 91 | 92 | /** Rotate a point by this quaternion */ 93 | aiVector3t Rotate (const aiVector3t& in); 94 | 95 | /** Multiply two quaternions */ 96 | aiQuaterniont operator* (const aiQuaterniont& two) const; 97 | 98 | public: 99 | 100 | /** Performs a spherical interpolation between two quaternions and writes the result into the third. 101 | * @param pOut Target object to received the interpolated rotation. 102 | * @param pStart Start rotation of the interpolation at factor == 0. 103 | * @param pEnd End rotation, factor == 1. 104 | * @param pFactor Interpolation factor between 0 and 1. Values outside of this range yield undefined results. 105 | */ 106 | static void Interpolate( aiQuaterniont& pOut, const aiQuaterniont& pStart, 107 | const aiQuaterniont& pEnd, TReal pFactor); 108 | 109 | public: 110 | 111 | //! w,x,y,z components of the quaternion 112 | TReal w, x, y, z; 113 | } ; 114 | 115 | typedef aiQuaterniont aiQuaternion; 116 | 117 | #else 118 | 119 | struct aiQuaternion { 120 | float w, x, y, z; 121 | }; 122 | 123 | #endif 124 | 125 | 126 | #endif // AI_QUATERNION_H_INC 127 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/quaternion.inl: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file quaternion.inl 43 | * @brief Inline implementation of aiQuaterniont operators 44 | */ 45 | #ifndef AI_QUATERNION_INL_INC 46 | #define AI_QUATERNION_INL_INC 47 | 48 | #ifdef __cplusplus 49 | #include "quaternion.h" 50 | 51 | #include 52 | 53 | // --------------------------------------------------------------------------- 54 | template 55 | bool aiQuaterniont::operator== (const aiQuaterniont& o) const 56 | { 57 | return x == o.x && y == o.y && z == o.z && w == o.w; 58 | } 59 | 60 | // --------------------------------------------------------------------------- 61 | template 62 | bool aiQuaterniont::operator!= (const aiQuaterniont& o) const 63 | { 64 | return !(*this == o); 65 | } 66 | 67 | // --------------------------------------------------------------------------- 68 | template 69 | inline bool aiQuaterniont::Equal(const aiQuaterniont& o, TReal epsilon) const { 70 | return 71 | std::abs(x - o.x) <= epsilon && 72 | std::abs(y - o.y) <= epsilon && 73 | std::abs(z - o.z) <= epsilon && 74 | std::abs(w - o.w) <= epsilon; 75 | } 76 | 77 | // --------------------------------------------------------------------------- 78 | // Constructs a quaternion from a rotation matrix 79 | template 80 | inline aiQuaterniont::aiQuaterniont( const aiMatrix3x3t &pRotMatrix) 81 | { 82 | TReal t = pRotMatrix.a1 + pRotMatrix.b2 + pRotMatrix.c3; 83 | 84 | // large enough 85 | if( t > static_cast(0)) 86 | { 87 | TReal s = std::sqrt(1 + t) * static_cast(2.0); 88 | x = (pRotMatrix.c2 - pRotMatrix.b3) / s; 89 | y = (pRotMatrix.a3 - pRotMatrix.c1) / s; 90 | z = (pRotMatrix.b1 - pRotMatrix.a2) / s; 91 | w = static_cast(0.25) * s; 92 | } // else we have to check several cases 93 | else if( pRotMatrix.a1 > pRotMatrix.b2 && pRotMatrix.a1 > pRotMatrix.c3 ) 94 | { 95 | // Column 0: 96 | TReal s = std::sqrt( static_cast(1.0) + pRotMatrix.a1 - pRotMatrix.b2 - pRotMatrix.c3) * static_cast(2.0); 97 | x = static_cast(0.25) * s; 98 | y = (pRotMatrix.b1 + pRotMatrix.a2) / s; 99 | z = (pRotMatrix.a3 + pRotMatrix.c1) / s; 100 | w = (pRotMatrix.c2 - pRotMatrix.b3) / s; 101 | } 102 | else if( pRotMatrix.b2 > pRotMatrix.c3) 103 | { 104 | // Column 1: 105 | TReal s = std::sqrt( static_cast(1.0) + pRotMatrix.b2 - pRotMatrix.a1 - pRotMatrix.c3) * static_cast(2.0); 106 | x = (pRotMatrix.b1 + pRotMatrix.a2) / s; 107 | y = static_cast(0.25) * s; 108 | z = (pRotMatrix.c2 + pRotMatrix.b3) / s; 109 | w = (pRotMatrix.a3 - pRotMatrix.c1) / s; 110 | } else 111 | { 112 | // Column 2: 113 | TReal s = std::sqrt( static_cast(1.0) + pRotMatrix.c3 - pRotMatrix.a1 - pRotMatrix.b2) * static_cast(2.0); 114 | x = (pRotMatrix.a3 + pRotMatrix.c1) / s; 115 | y = (pRotMatrix.c2 + pRotMatrix.b3) / s; 116 | z = static_cast(0.25) * s; 117 | w = (pRotMatrix.b1 - pRotMatrix.a2) / s; 118 | } 119 | } 120 | 121 | // --------------------------------------------------------------------------- 122 | // Construction from euler angles 123 | template 124 | inline aiQuaterniont::aiQuaterniont( TReal fPitch, TReal fYaw, TReal fRoll ) 125 | { 126 | const TReal fSinPitch(std::sin(fPitch*static_cast(0.5))); 127 | const TReal fCosPitch(std::cos(fPitch*static_cast(0.5))); 128 | const TReal fSinYaw(std::sin(fYaw*static_cast(0.5))); 129 | const TReal fCosYaw(std::cos(fYaw*static_cast(0.5))); 130 | const TReal fSinRoll(std::sin(fRoll*static_cast(0.5))); 131 | const TReal fCosRoll(std::cos(fRoll*static_cast(0.5))); 132 | const TReal fCosPitchCosYaw(fCosPitch*fCosYaw); 133 | const TReal fSinPitchSinYaw(fSinPitch*fSinYaw); 134 | x = fSinRoll * fCosPitchCosYaw - fCosRoll * fSinPitchSinYaw; 135 | y = fCosRoll * fSinPitch * fCosYaw + fSinRoll * fCosPitch * fSinYaw; 136 | z = fCosRoll * fCosPitch * fSinYaw - fSinRoll * fSinPitch * fCosYaw; 137 | w = fCosRoll * fCosPitchCosYaw + fSinRoll * fSinPitchSinYaw; 138 | } 139 | 140 | // --------------------------------------------------------------------------- 141 | // Returns a matrix representation of the quaternion 142 | template 143 | inline aiMatrix3x3t aiQuaterniont::GetMatrix() const 144 | { 145 | aiMatrix3x3t resMatrix; 146 | resMatrix.a1 = static_cast(1.0) - static_cast(2.0) * (y * y + z * z); 147 | resMatrix.a2 = static_cast(2.0) * (x * y - z * w); 148 | resMatrix.a3 = static_cast(2.0) * (x * z + y * w); 149 | resMatrix.b1 = static_cast(2.0) * (x * y + z * w); 150 | resMatrix.b2 = static_cast(1.0) - static_cast(2.0) * (x * x + z * z); 151 | resMatrix.b3 = static_cast(2.0) * (y * z - x * w); 152 | resMatrix.c1 = static_cast(2.0) * (x * z - y * w); 153 | resMatrix.c2 = static_cast(2.0) * (y * z + x * w); 154 | resMatrix.c3 = static_cast(1.0) - static_cast(2.0) * (x * x + y * y); 155 | 156 | return resMatrix; 157 | } 158 | 159 | // --------------------------------------------------------------------------- 160 | // Construction from an axis-angle pair 161 | template 162 | inline aiQuaterniont::aiQuaterniont( aiVector3t axis, TReal angle) 163 | { 164 | axis.Normalize(); 165 | 166 | const TReal sin_a = std::sin( angle / 2 ); 167 | const TReal cos_a = std::cos( angle / 2 ); 168 | x = axis.x * sin_a; 169 | y = axis.y * sin_a; 170 | z = axis.z * sin_a; 171 | w = cos_a; 172 | } 173 | // --------------------------------------------------------------------------- 174 | // Construction from am existing, normalized quaternion 175 | template 176 | inline aiQuaterniont::aiQuaterniont( aiVector3t normalized) 177 | { 178 | x = normalized.x; 179 | y = normalized.y; 180 | z = normalized.z; 181 | 182 | const TReal t = static_cast(1.0) - (x*x) - (y*y) - (z*z); 183 | 184 | if (t < static_cast(0.0)) { 185 | w = static_cast(0.0); 186 | } 187 | else w = std::sqrt (t); 188 | } 189 | 190 | // --------------------------------------------------------------------------- 191 | // Performs a spherical interpolation between two quaternions 192 | // Implementation adopted from the gmtl project. All others I found on the net fail in some cases. 193 | // Congrats, gmtl! 194 | template 195 | inline void aiQuaterniont::Interpolate( aiQuaterniont& pOut, const aiQuaterniont& pStart, const aiQuaterniont& pEnd, TReal pFactor) 196 | { 197 | // calc cosine theta 198 | TReal cosom = pStart.x * pEnd.x + pStart.y * pEnd.y + pStart.z * pEnd.z + pStart.w * pEnd.w; 199 | 200 | // adjust signs (if necessary) 201 | aiQuaterniont end = pEnd; 202 | if( cosom < static_cast(0.0)) 203 | { 204 | cosom = -cosom; 205 | end.x = -end.x; // Reverse all signs 206 | end.y = -end.y; 207 | end.z = -end.z; 208 | end.w = -end.w; 209 | } 210 | 211 | // Calculate coefficients 212 | TReal sclp, sclq; 213 | if( (static_cast(1.0) - cosom) > static_cast(0.0001)) // 0.0001 -> some epsillon 214 | { 215 | // Standard case (slerp) 216 | TReal omega, sinom; 217 | omega = std::acos( cosom); // extract theta from dot product's cos theta 218 | sinom = std::sin( omega); 219 | sclp = std::sin( (static_cast(1.0) - pFactor) * omega) / sinom; 220 | sclq = std::sin( pFactor * omega) / sinom; 221 | } else 222 | { 223 | // Very close, do linear interp (because it's faster) 224 | sclp = static_cast(1.0) - pFactor; 225 | sclq = pFactor; 226 | } 227 | 228 | pOut.x = sclp * pStart.x + sclq * end.x; 229 | pOut.y = sclp * pStart.y + sclq * end.y; 230 | pOut.z = sclp * pStart.z + sclq * end.z; 231 | pOut.w = sclp * pStart.w + sclq * end.w; 232 | } 233 | 234 | // --------------------------------------------------------------------------- 235 | template 236 | inline aiQuaterniont& aiQuaterniont::Normalize() 237 | { 238 | // compute the magnitude and divide through it 239 | const TReal mag = std::sqrt(x*x + y*y + z*z + w*w); 240 | if (mag) 241 | { 242 | const TReal invMag = static_cast(1.0)/mag; 243 | x *= invMag; 244 | y *= invMag; 245 | z *= invMag; 246 | w *= invMag; 247 | } 248 | return *this; 249 | } 250 | 251 | // --------------------------------------------------------------------------- 252 | template 253 | inline aiQuaterniont aiQuaterniont::operator* (const aiQuaterniont& t) const 254 | { 255 | return aiQuaterniont(w*t.w - x*t.x - y*t.y - z*t.z, 256 | w*t.x + x*t.w + y*t.z - z*t.y, 257 | w*t.y + y*t.w + z*t.x - x*t.z, 258 | w*t.z + z*t.w + x*t.y - y*t.x); 259 | } 260 | 261 | // --------------------------------------------------------------------------- 262 | template 263 | inline aiQuaterniont& aiQuaterniont::Conjugate () 264 | { 265 | x = -x; 266 | y = -y; 267 | z = -z; 268 | return *this; 269 | } 270 | 271 | // --------------------------------------------------------------------------- 272 | template 273 | inline aiVector3t aiQuaterniont::Rotate (const aiVector3t& v) 274 | { 275 | aiQuaterniont q2(0.f,v.x,v.y,v.z), q = *this, qinv = q; 276 | qinv.Conjugate(); 277 | 278 | q = q*q2*qinv; 279 | return aiVector3t(q.x,q.y,q.z); 280 | } 281 | 282 | #endif 283 | #endif 284 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file texture.h 43 | * @brief Defines texture helper structures for the library 44 | * 45 | * Used for file formats which embed their textures into the model file. 46 | * Supported are both normal textures, which are stored as uncompressed 47 | * pixels, and "compressed" textures, which are stored in a file format 48 | * such as PNG or TGA. 49 | */ 50 | 51 | #ifndef AI_TEXTURE_H_INC 52 | #define AI_TEXTURE_H_INC 53 | 54 | #include "types.h" 55 | 56 | #ifdef __cplusplus 57 | extern "C" { 58 | #endif 59 | 60 | 61 | // -------------------------------------------------------------------------------- 62 | /** @def AI_MAKE_EMBEDDED_TEXNAME 63 | * Used to build the reserved path name used by the material system to 64 | * reference textures that are embedded into their corresponding 65 | * model files. The parameter specifies the index of the texture 66 | * (zero-based, in the aiScene::mTextures array) 67 | */ 68 | #if (!defined AI_MAKE_EMBEDDED_TEXNAME) 69 | # define AI_MAKE_EMBEDDED_TEXNAME(_n_) "*" # _n_ 70 | #endif 71 | 72 | 73 | #include "./Compiler/pushpack1.h" 74 | 75 | // -------------------------------------------------------------------------------- 76 | /** @brief Helper structure to represent a texel in a ARGB8888 format 77 | * 78 | * Used by aiTexture. 79 | */ 80 | struct aiTexel 81 | { 82 | unsigned char b,g,r,a; 83 | 84 | #ifdef __cplusplus 85 | //! Comparison operator 86 | bool operator== (const aiTexel& other) const 87 | { 88 | return b == other.b && r == other.r && 89 | g == other.g && a == other.a; 90 | } 91 | 92 | //! Inverse comparison operator 93 | bool operator!= (const aiTexel& other) const 94 | { 95 | return b != other.b || r != other.r || 96 | g != other.g || a != other.a; 97 | } 98 | 99 | //! Conversion to a floating-point 4d color 100 | operator aiColor4D() const 101 | { 102 | return aiColor4D(r/255.f,g/255.f,b/255.f,a/255.f); 103 | } 104 | #endif // __cplusplus 105 | 106 | } PACK_STRUCT; 107 | 108 | #include "./Compiler/poppack1.h" 109 | 110 | // -------------------------------------------------------------------------------- 111 | /** Helper structure to describe an embedded texture 112 | * 113 | * Normally textures are contained in external files but some file formats embed 114 | * them directly in the model file. There are two types of embedded textures: 115 | * 1. Uncompressed textures. The color data is given in an uncompressed format. 116 | * 2. Compressed textures stored in a file format like png or jpg. The raw file 117 | * bytes are given so the application must utilize an image decoder (e.g. DevIL) to 118 | * get access to the actual color data. 119 | * 120 | * Embedded textures are referenced from materials using strings like "*0", "*1", etc. 121 | * as the texture paths (a single asterisk character followed by the 122 | * zero-based index of the texture in the aiScene::mTextures array). 123 | */ 124 | struct aiTexture 125 | { 126 | /** Width of the texture, in pixels 127 | * 128 | * If mHeight is zero the texture is compressed in a format 129 | * like JPEG. In this case mWidth specifies the size of the 130 | * memory area pcData is pointing to, in bytes. 131 | */ 132 | unsigned int mWidth; 133 | 134 | /** Height of the texture, in pixels 135 | * 136 | * If this value is zero, pcData points to an compressed texture 137 | * in any format (e.g. JPEG). 138 | */ 139 | unsigned int mHeight; 140 | 141 | /** A hint from the loader to make it easier for applications 142 | * to determine the type of embedded compressed textures. 143 | * 144 | * If mHeight != 0 this member is undefined. Otherwise it 145 | * is set set to '\\0\\0\\0\\0' if the loader has no additional 146 | * information about the texture file format used OR the 147 | * file extension of the format without a trailing dot. If there 148 | * are multiple file extensions for a format, the shortest 149 | * extension is chosen (JPEG maps to 'jpg', not to 'jpeg'). 150 | * E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'. All characters are lower-case. 151 | * The fourth character will always be '\\0'. 152 | */ 153 | char achFormatHint[4]; 154 | 155 | /** Data of the texture. 156 | * 157 | * Points to an array of mWidth * mHeight aiTexel's. 158 | * The format of the texture data is always ARGB8888 to 159 | * make the implementation for user of the library as easy 160 | * as possible. If mHeight = 0 this is a pointer to a memory 161 | * buffer of size mWidth containing the compressed texture 162 | * data. Good luck, have fun! 163 | */ 164 | C_STRUCT aiTexel* pcData; 165 | 166 | #ifdef __cplusplus 167 | 168 | //! For compressed textures (mHeight == 0): compare the 169 | //! format hint against a given string. 170 | //! @param s Input string. 3 characters are maximally processed. 171 | //! Example values: "jpg", "png" 172 | //! @return true if the given string matches the format hint 173 | bool CheckFormat(const char* s) const 174 | { 175 | return (0 == ::strncmp(achFormatHint,s,3)); 176 | } 177 | 178 | // Construction 179 | aiTexture () 180 | : mWidth (0) 181 | , mHeight (0) 182 | , pcData (NULL) 183 | { 184 | achFormatHint[0] = achFormatHint[1] = 0; 185 | achFormatHint[2] = achFormatHint[3] = 0; 186 | } 187 | 188 | // Destruction 189 | ~aiTexture () 190 | { 191 | delete[] pcData; 192 | } 193 | #endif 194 | }; 195 | 196 | 197 | #ifdef __cplusplus 198 | } 199 | #endif 200 | 201 | #endif // AI_TEXTURE_H_INC 202 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/vector2.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | /** @file vector2.h 42 | * @brief 2D vector structure, including operators when compiling in C++ 43 | */ 44 | #ifndef AI_VECTOR2D_H_INC 45 | #define AI_VECTOR2D_H_INC 46 | 47 | #ifdef __cplusplus 48 | # include 49 | #else 50 | # include 51 | #endif 52 | 53 | #include "./Compiler/pushpack1.h" 54 | 55 | // ---------------------------------------------------------------------------------- 56 | /** Represents a two-dimensional vector. 57 | */ 58 | 59 | #ifdef __cplusplus 60 | template 61 | class aiVector2t 62 | { 63 | public: 64 | 65 | aiVector2t () : x(), y() {} 66 | aiVector2t (TReal _x, TReal _y) : x(_x), y(_y) {} 67 | explicit aiVector2t (TReal _xyz) : x(_xyz), y(_xyz) {} 68 | aiVector2t (const aiVector2t& o) : x(o.x), y(o.y) {} 69 | 70 | public: 71 | 72 | void Set( TReal pX, TReal pY); 73 | TReal SquareLength() const ; 74 | TReal Length() const ; 75 | aiVector2t& Normalize(); 76 | 77 | public: 78 | 79 | const aiVector2t& operator += (const aiVector2t& o); 80 | const aiVector2t& operator -= (const aiVector2t& o); 81 | const aiVector2t& operator *= (TReal f); 82 | const aiVector2t& operator /= (TReal f); 83 | 84 | TReal operator[](unsigned int i) const; 85 | TReal& operator[](unsigned int i); 86 | 87 | bool operator== (const aiVector2t& other) const; 88 | bool operator!= (const aiVector2t& other) const; 89 | 90 | bool Equal(const aiVector2t& other, TReal epsilon = 1e-6) const; 91 | 92 | aiVector2t& operator= (TReal f); 93 | const aiVector2t SymMul(const aiVector2t& o); 94 | 95 | template 96 | operator aiVector2t () const; 97 | 98 | TReal x, y; 99 | } PACK_STRUCT; 100 | 101 | typedef aiVector2t aiVector2D; 102 | 103 | #else 104 | 105 | struct aiVector2D { 106 | float x,y; 107 | }; 108 | 109 | #endif // __cplusplus 110 | 111 | #include "./Compiler/poppack1.h" 112 | 113 | #endif // AI_VECTOR2D_H_INC 114 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/vector2.inl: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file vector2.inl 43 | * @brief Inline implementation of aiVector2t operators 44 | */ 45 | #ifndef AI_VECTOR2D_INL_INC 46 | #define AI_VECTOR2D_INL_INC 47 | 48 | #ifdef __cplusplus 49 | #include "vector2.h" 50 | 51 | #include 52 | 53 | // ------------------------------------------------------------------------------------------------ 54 | template 55 | template 56 | aiVector2t::operator aiVector2t () const { 57 | return aiVector2t(static_cast(x),static_cast(y)); 58 | } 59 | // ------------------------------------------------------------------------------------------------ 60 | template 61 | void aiVector2t::Set( TReal pX, TReal pY) { 62 | x = pX; y = pY; 63 | } 64 | 65 | // ------------------------------------------------------------------------------------------------ 66 | template 67 | TReal aiVector2t::SquareLength() const { 68 | return x*x + y*y; 69 | } 70 | 71 | // ------------------------------------------------------------------------------------------------ 72 | template 73 | TReal aiVector2t::Length() const { 74 | return std::sqrt( SquareLength()); 75 | } 76 | 77 | // ------------------------------------------------------------------------------------------------ 78 | template 79 | aiVector2t& aiVector2t::Normalize() { 80 | *this /= Length(); 81 | return *this; 82 | } 83 | 84 | // ------------------------------------------------------------------------------------------------ 85 | template 86 | const aiVector2t& aiVector2t::operator += (const aiVector2t& o) { 87 | x += o.x; y += o.y; 88 | return *this; 89 | } 90 | 91 | // ------------------------------------------------------------------------------------------------ 92 | template 93 | const aiVector2t& aiVector2t::operator -= (const aiVector2t& o) { 94 | x -= o.x; y -= o.y; 95 | return *this; 96 | } 97 | 98 | // ------------------------------------------------------------------------------------------------ 99 | template 100 | const aiVector2t& aiVector2t::operator *= (TReal f) { 101 | x *= f; y *= f; 102 | return *this; 103 | } 104 | 105 | // ------------------------------------------------------------------------------------------------ 106 | template 107 | const aiVector2t& aiVector2t::operator /= (TReal f) { 108 | x /= f; y /= f; 109 | return *this; 110 | } 111 | 112 | // ------------------------------------------------------------------------------------------------ 113 | template 114 | TReal aiVector2t::operator[](unsigned int i) const { 115 | return *(&x + i); 116 | } 117 | 118 | // ------------------------------------------------------------------------------------------------ 119 | template 120 | TReal& aiVector2t::operator[](unsigned int i) { 121 | return *(&x + i); 122 | } 123 | 124 | // ------------------------------------------------------------------------------------------------ 125 | template 126 | bool aiVector2t::operator== (const aiVector2t& other) const { 127 | return x == other.x && y == other.y; 128 | } 129 | 130 | // ------------------------------------------------------------------------------------------------ 131 | template 132 | bool aiVector2t::operator!= (const aiVector2t& other) const { 133 | return x != other.x || y != other.y; 134 | } 135 | 136 | // --------------------------------------------------------------------------- 137 | template 138 | bool aiVector2t::Equal(const aiVector2t& other, TReal epsilon) const { 139 | return 140 | std::abs(x - other.x) <= epsilon && 141 | std::abs(y - other.y) <= epsilon; 142 | } 143 | 144 | // ------------------------------------------------------------------------------------------------ 145 | template 146 | aiVector2t& aiVector2t::operator= (TReal f) { 147 | x = y = f; 148 | return *this; 149 | } 150 | 151 | // ------------------------------------------------------------------------------------------------ 152 | template 153 | const aiVector2t aiVector2t::SymMul(const aiVector2t& o) { 154 | return aiVector2t(x*o.x,y*o.y); 155 | } 156 | 157 | 158 | // ------------------------------------------------------------------------------------------------ 159 | // symmetric addition 160 | template 161 | inline aiVector2t operator + (const aiVector2t& v1, const aiVector2t& v2) 162 | { 163 | return aiVector2t( v1.x + v2.x, v1.y + v2.y); 164 | } 165 | 166 | // ------------------------------------------------------------------------------------------------ 167 | // symmetric subtraction 168 | template 169 | inline aiVector2t operator - (const aiVector2t& v1, const aiVector2t& v2) 170 | { 171 | return aiVector2t( v1.x - v2.x, v1.y - v2.y); 172 | } 173 | 174 | // ------------------------------------------------------------------------------------------------ 175 | // scalar product 176 | template 177 | inline TReal operator * (const aiVector2t& v1, const aiVector2t& v2) 178 | { 179 | return v1.x*v2.x + v1.y*v2.y; 180 | } 181 | 182 | // ------------------------------------------------------------------------------------------------ 183 | // scalar multiplication 184 | template 185 | inline aiVector2t operator * ( TReal f, const aiVector2t& v) 186 | { 187 | return aiVector2t( f*v.x, f*v.y); 188 | } 189 | 190 | // ------------------------------------------------------------------------------------------------ 191 | // and the other way around 192 | template 193 | inline aiVector2t operator * ( const aiVector2t& v, TReal f) 194 | { 195 | return aiVector2t( f*v.x, f*v.y); 196 | } 197 | 198 | // ------------------------------------------------------------------------------------------------ 199 | // scalar division 200 | template 201 | inline aiVector2t operator / ( const aiVector2t& v, TReal f) 202 | { 203 | 204 | return v * (1/f); 205 | } 206 | 207 | // ------------------------------------------------------------------------------------------------ 208 | // vector division 209 | template 210 | inline aiVector2t operator / ( const aiVector2t& v, const aiVector2t& v2) 211 | { 212 | return aiVector2t(v.x / v2.x,v.y / v2.y); 213 | } 214 | 215 | // ------------------------------------------------------------------------------------------------ 216 | // vector negation 217 | template 218 | inline aiVector2t operator - ( const aiVector2t& v) 219 | { 220 | return aiVector2t( -v.x, -v.y); 221 | } 222 | 223 | #endif 224 | #endif 225 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/vector3.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | /** @file vector3.h 42 | * @brief 3D vector structure, including operators when compiling in C++ 43 | */ 44 | #ifndef AI_VECTOR3D_H_INC 45 | #define AI_VECTOR3D_H_INC 46 | 47 | #ifdef __cplusplus 48 | # include 49 | #else 50 | # include 51 | #endif 52 | 53 | #include "./Compiler/pushpack1.h" 54 | 55 | #ifdef __cplusplus 56 | 57 | template class aiMatrix3x3t; 58 | template class aiMatrix4x4t; 59 | 60 | // --------------------------------------------------------------------------- 61 | /** Represents a three-dimensional vector. */ 62 | template 63 | class aiVector3t 64 | { 65 | public: 66 | 67 | aiVector3t () : x(), y(), z() {} 68 | aiVector3t (TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {} 69 | explicit aiVector3t (TReal _xyz) : x(_xyz), y(_xyz), z(_xyz) {} 70 | aiVector3t (const aiVector3t& o) : x(o.x), y(o.y), z(o.z) {} 71 | 72 | public: 73 | 74 | // combined operators 75 | const aiVector3t& operator += (const aiVector3t& o); 76 | const aiVector3t& operator -= (const aiVector3t& o); 77 | const aiVector3t& operator *= (TReal f); 78 | const aiVector3t& operator /= (TReal f); 79 | 80 | // transform vector by matrix 81 | aiVector3t& operator *= (const aiMatrix3x3t& mat); 82 | aiVector3t& operator *= (const aiMatrix4x4t& mat); 83 | 84 | // access a single element 85 | TReal operator[](unsigned int i) const; 86 | TReal& operator[](unsigned int i); 87 | 88 | // comparison 89 | bool operator== (const aiVector3t& other) const; 90 | bool operator!= (const aiVector3t& other) const; 91 | bool operator < (const aiVector3t& other) const; 92 | 93 | bool Equal(const aiVector3t& other, TReal epsilon = 1e-6) const; 94 | 95 | template 96 | operator aiVector3t () const; 97 | 98 | public: 99 | 100 | /** @brief Set the components of a vector 101 | * @param pX X component 102 | * @param pY Y component 103 | * @param pZ Z component */ 104 | void Set( TReal pX, TReal pY, TReal pZ); 105 | 106 | /** @brief Get the squared length of the vector 107 | * @return Square length */ 108 | TReal SquareLength() const; 109 | 110 | 111 | /** @brief Get the length of the vector 112 | * @return length */ 113 | TReal Length() const; 114 | 115 | 116 | /** @brief Normalize the vector */ 117 | aiVector3t& Normalize(); 118 | 119 | /** @brief Normalize the vector with extra check for zero vectors */ 120 | aiVector3t& NormalizeSafe(); 121 | 122 | /** @brief Componentwise multiplication of two vectors 123 | * 124 | * Note that vec*vec yields the dot product. 125 | * @param o Second factor */ 126 | const aiVector3t SymMul(const aiVector3t& o); 127 | 128 | TReal x, y, z; 129 | } PACK_STRUCT; 130 | 131 | 132 | typedef aiVector3t aiVector3D; 133 | 134 | #else 135 | 136 | struct aiVector3D { 137 | 138 | float x,y,z; 139 | } PACK_STRUCT; 140 | 141 | #endif // __cplusplus 142 | 143 | #include "./Compiler/poppack1.h" 144 | 145 | #ifdef __cplusplus 146 | 147 | 148 | 149 | #endif // __cplusplus 150 | 151 | #endif // AI_VECTOR3D_H_INC 152 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/vector3.inl: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file vector3.inl 43 | * @brief Inline implementation of aiVector3t operators 44 | */ 45 | #ifndef AI_VECTOR3D_INL_INC 46 | #define AI_VECTOR3D_INL_INC 47 | 48 | #ifdef __cplusplus 49 | #include "vector3.h" 50 | 51 | #include 52 | 53 | // ------------------------------------------------------------------------------------------------ 54 | /** Transformation of a vector by a 3x3 matrix */ 55 | template 56 | inline aiVector3t operator * (const aiMatrix3x3t& pMatrix, const aiVector3t& pVector) 57 | { 58 | aiVector3t res; 59 | res.x = pMatrix.a1 * pVector.x + pMatrix.a2 * pVector.y + pMatrix.a3 * pVector.z; 60 | res.y = pMatrix.b1 * pVector.x + pMatrix.b2 * pVector.y + pMatrix.b3 * pVector.z; 61 | res.z = pMatrix.c1 * pVector.x + pMatrix.c2 * pVector.y + pMatrix.c3 * pVector.z; 62 | return res; 63 | } 64 | 65 | // ------------------------------------------------------------------------------------------------ 66 | /** Transformation of a vector by a 4x4 matrix */ 67 | template 68 | inline aiVector3t operator * (const aiMatrix4x4t& pMatrix, const aiVector3t& pVector) 69 | { 70 | aiVector3t res; 71 | res.x = pMatrix.a1 * pVector.x + pMatrix.a2 * pVector.y + pMatrix.a3 * pVector.z + pMatrix.a4; 72 | res.y = pMatrix.b1 * pVector.x + pMatrix.b2 * pVector.y + pMatrix.b3 * pVector.z + pMatrix.b4; 73 | res.z = pMatrix.c1 * pVector.x + pMatrix.c2 * pVector.y + pMatrix.c3 * pVector.z + pMatrix.c4; 74 | return res; 75 | } 76 | // ------------------------------------------------------------------------------------------------ 77 | template 78 | template 79 | aiVector3t::operator aiVector3t () const { 80 | return aiVector3t(static_cast(x),static_cast(y),static_cast(z)); 81 | } 82 | // ------------------------------------------------------------------------------------------------ 83 | template 84 | AI_FORCE_INLINE void aiVector3t::Set( TReal pX, TReal pY, TReal pZ) { 85 | x = pX; y = pY; z = pZ; 86 | } 87 | // ------------------------------------------------------------------------------------------------ 88 | template 89 | AI_FORCE_INLINE TReal aiVector3t::SquareLength() const { 90 | return x*x + y*y + z*z; 91 | } 92 | // ------------------------------------------------------------------------------------------------ 93 | template 94 | AI_FORCE_INLINE TReal aiVector3t::Length() const { 95 | return std::sqrt( SquareLength()); 96 | } 97 | // ------------------------------------------------------------------------------------------------ 98 | template 99 | AI_FORCE_INLINE aiVector3t& aiVector3t::Normalize() { 100 | *this /= Length(); return *this; 101 | } 102 | // ------------------------------------------------------------------------------------------------ 103 | template 104 | AI_FORCE_INLINE aiVector3t& aiVector3t::NormalizeSafe() { 105 | TReal len = Length(); 106 | if (len > static_cast(0)) 107 | *this /= len; 108 | return *this; 109 | } 110 | // ------------------------------------------------------------------------------------------------ 111 | template 112 | AI_FORCE_INLINE const aiVector3t& aiVector3t::operator += (const aiVector3t& o) { 113 | x += o.x; y += o.y; z += o.z; return *this; 114 | } 115 | // ------------------------------------------------------------------------------------------------ 116 | template 117 | AI_FORCE_INLINE const aiVector3t& aiVector3t::operator -= (const aiVector3t& o) { 118 | x -= o.x; y -= o.y; z -= o.z; return *this; 119 | } 120 | // ------------------------------------------------------------------------------------------------ 121 | template 122 | AI_FORCE_INLINE const aiVector3t& aiVector3t::operator *= (TReal f) { 123 | x *= f; y *= f; z *= f; return *this; 124 | } 125 | // ------------------------------------------------------------------------------------------------ 126 | template 127 | AI_FORCE_INLINE const aiVector3t& aiVector3t::operator /= (TReal f) { 128 | x /= f; y /= f; z /= f; return *this; 129 | } 130 | // ------------------------------------------------------------------------------------------------ 131 | template 132 | AI_FORCE_INLINE aiVector3t& aiVector3t::operator *= (const aiMatrix3x3t& mat){ 133 | return(*this = mat * (*this)); 134 | } 135 | // ------------------------------------------------------------------------------------------------ 136 | template 137 | AI_FORCE_INLINE aiVector3t& aiVector3t::operator *= (const aiMatrix4x4t& mat){ 138 | return(*this = mat * (*this)); 139 | } 140 | // ------------------------------------------------------------------------------------------------ 141 | template 142 | AI_FORCE_INLINE TReal aiVector3t::operator[](unsigned int i) const { 143 | return *(&x + i); 144 | } 145 | // ------------------------------------------------------------------------------------------------ 146 | template 147 | AI_FORCE_INLINE TReal& aiVector3t::operator[](unsigned int i) { 148 | return *(&x + i); 149 | } 150 | // ------------------------------------------------------------------------------------------------ 151 | template 152 | AI_FORCE_INLINE bool aiVector3t::operator== (const aiVector3t& other) const { 153 | return x == other.x && y == other.y && z == other.z; 154 | } 155 | // ------------------------------------------------------------------------------------------------ 156 | template 157 | AI_FORCE_INLINE bool aiVector3t::operator!= (const aiVector3t& other) const { 158 | return x != other.x || y != other.y || z != other.z; 159 | } 160 | // --------------------------------------------------------------------------- 161 | template 162 | AI_FORCE_INLINE bool aiVector3t::Equal(const aiVector3t& other, TReal epsilon) const { 163 | return 164 | std::abs(x - other.x) <= epsilon && 165 | std::abs(y - other.y) <= epsilon && 166 | std::abs(z - other.z) <= epsilon; 167 | } 168 | // ------------------------------------------------------------------------------------------------ 169 | template 170 | AI_FORCE_INLINE bool aiVector3t::operator < (const aiVector3t& other) const { 171 | return x != other.x ? x < other.x : y != other.y ? y < other.y : z < other.z; 172 | } 173 | // ------------------------------------------------------------------------------------------------ 174 | template 175 | AI_FORCE_INLINE const aiVector3t aiVector3t::SymMul(const aiVector3t& o) { 176 | return aiVector3t(x*o.x,y*o.y,z*o.z); 177 | } 178 | // ------------------------------------------------------------------------------------------------ 179 | // symmetric addition 180 | template 181 | AI_FORCE_INLINE aiVector3t operator + (const aiVector3t& v1, const aiVector3t& v2) { 182 | return aiVector3t( v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); 183 | } 184 | // ------------------------------------------------------------------------------------------------ 185 | // symmetric subtraction 186 | template 187 | AI_FORCE_INLINE aiVector3t operator - (const aiVector3t& v1, const aiVector3t& v2) { 188 | return aiVector3t( v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); 189 | } 190 | // ------------------------------------------------------------------------------------------------ 191 | // scalar product 192 | template 193 | AI_FORCE_INLINE TReal operator * (const aiVector3t& v1, const aiVector3t& v2) { 194 | return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z; 195 | } 196 | // ------------------------------------------------------------------------------------------------ 197 | // scalar multiplication 198 | template 199 | AI_FORCE_INLINE aiVector3t operator * ( TReal f, const aiVector3t& v) { 200 | return aiVector3t( f*v.x, f*v.y, f*v.z); 201 | } 202 | // ------------------------------------------------------------------------------------------------ 203 | // and the other way around 204 | template 205 | AI_FORCE_INLINE aiVector3t operator * ( const aiVector3t& v, TReal f) { 206 | return aiVector3t( f*v.x, f*v.y, f*v.z); 207 | } 208 | // ------------------------------------------------------------------------------------------------ 209 | // scalar division 210 | template 211 | AI_FORCE_INLINE aiVector3t operator / ( const aiVector3t& v, TReal f) { 212 | return v * (1/f); 213 | } 214 | // ------------------------------------------------------------------------------------------------ 215 | // vector division 216 | template 217 | AI_FORCE_INLINE aiVector3t operator / ( const aiVector3t& v, const aiVector3t& v2) { 218 | return aiVector3t(v.x / v2.x,v.y / v2.y,v.z / v2.z); 219 | } 220 | // ------------------------------------------------------------------------------------------------ 221 | // cross product 222 | template 223 | AI_FORCE_INLINE aiVector3t operator ^ ( const aiVector3t& v1, const aiVector3t& v2) { 224 | return aiVector3t( v1.y*v2.z - v1.z*v2.y, v1.z*v2.x - v1.x*v2.z, v1.x*v2.y - v1.y*v2.x); 225 | } 226 | // ------------------------------------------------------------------------------------------------ 227 | // vector negation 228 | template 229 | AI_FORCE_INLINE aiVector3t operator - ( const aiVector3t& v) { 230 | return aiVector3t( -v.x, -v.y, -v.z); 231 | } 232 | 233 | // ------------------------------------------------------------------------------------------------ 234 | 235 | #endif // __cplusplus 236 | #endif // AI_VECTOR3D_INL_INC 237 | -------------------------------------------------------------------------------- /lib/assimp/include/assimp/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2016, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /** @file version.h 43 | * @brief Functions to query the version of the Assimp runtime, check 44 | * compile flags, ... 45 | */ 46 | #ifndef INCLUDED_AI_VERSION_H 47 | #define INCLUDED_AI_VERSION_H 48 | 49 | #include "defs.h" 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | // --------------------------------------------------------------------------- 56 | /** @brief Returns a string with legal copyright and licensing information 57 | * about Assimp. The string may include multiple lines. 58 | * @return Pointer to static string. 59 | */ 60 | ASSIMP_API const char* aiGetLegalString (void); 61 | 62 | // --------------------------------------------------------------------------- 63 | /** @brief Returns the current minor version number of Assimp. 64 | * @return Minor version of the Assimp runtime the application was 65 | * linked/built against 66 | */ 67 | ASSIMP_API unsigned int aiGetVersionMinor (void); 68 | 69 | // --------------------------------------------------------------------------- 70 | /** @brief Returns the current major version number of Assimp. 71 | * @return Major version of the Assimp runtime the application was 72 | * linked/built against 73 | */ 74 | ASSIMP_API unsigned int aiGetVersionMajor (void); 75 | 76 | // --------------------------------------------------------------------------- 77 | /** @brief Returns the repository revision of the Assimp runtime. 78 | * @return SVN Repository revision number of the Assimp runtime the 79 | * application was linked/built against. 80 | */ 81 | ASSIMP_API unsigned int aiGetVersionRevision (void); 82 | 83 | //! Assimp was compiled as a shared object (Windows: DLL) 84 | #define ASSIMP_CFLAGS_SHARED 0x1 85 | //! Assimp was compiled against STLport 86 | #define ASSIMP_CFLAGS_STLPORT 0x2 87 | //! Assimp was compiled as a debug build 88 | #define ASSIMP_CFLAGS_DEBUG 0x4 89 | 90 | //! Assimp was compiled with ASSIMP_BUILD_BOOST_WORKAROUND defined 91 | #define ASSIMP_CFLAGS_NOBOOST 0x8 92 | //! Assimp was compiled with ASSIMP_BUILD_SINGLETHREADED defined 93 | #define ASSIMP_CFLAGS_SINGLETHREADED 0x10 94 | 95 | // --------------------------------------------------------------------------- 96 | /** @brief Returns assimp's compile flags 97 | * @return Any bitwise combination of the ASSIMP_CFLAGS_xxx constants. 98 | */ 99 | ASSIMP_API unsigned int aiGetCompileFlags (void); 100 | 101 | #ifdef __cplusplus 102 | } // end extern "C" 103 | #endif 104 | 105 | #endif // !! #ifndef INCLUDED_AI_VERSION_H 106 | -------------------------------------------------------------------------------- /lib/assimp/lib-js/libassimp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adevaykin/minimal-cmake-emscripten-project/97de429e84eb4d83072bdc84997ad07c7b82e4ad/lib/assimp/lib-js/libassimp.so -------------------------------------------------------------------------------- /src/Application.cpp: -------------------------------------------------------------------------------- 1 | #include "Application.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | void Application::Initialize() { 10 | std::cout << "Initializing application." << std::endl; 11 | Assimp::Importer importer; // For test purpose 12 | } 13 | 14 | void Application::SayHello() { 15 | std::cout << "Hello!" << std::endl; 16 | } 17 | -------------------------------------------------------------------------------- /src/Application.h: -------------------------------------------------------------------------------- 1 | #ifndef APPLICATION_H 2 | #define APPLICATION_H 3 | 4 | #include 5 | #include 6 | 7 | namespace e = emscripten; 8 | 9 | class Application { 10 | public: 11 | void Initialize(); 12 | void SayHello(); 13 | }; 14 | 15 | EMSCRIPTEN_BINDINGS(EMTest) { 16 | e::class_("Application") 17 | .constructor() 18 | .function("Initialize", &Application::Initialize) 19 | .function("SayHello", &Application::SayHello); 20 | } 21 | 22 | #endif 23 | --------------------------------------------------------------------------------