diff options
Diffstat (limited to 'src/3rdparty/assimp/include/assimp')
46 files changed, 1890 insertions, 676 deletions
diff --git a/src/3rdparty/assimp/include/assimp/Compiler/pushpack1.h b/src/3rdparty/assimp/include/assimp/Compiler/pushpack1.h index 73973c50d..94ee1e474 100644 --- a/src/3rdparty/assimp/include/assimp/Compiler/pushpack1.h +++ b/src/3rdparty/assimp/include/assimp/Compiler/pushpack1.h @@ -36,11 +36,8 @@ #endif #if defined(_MSC_VER) - // C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop # pragma warning (disable : 4103) #endif #define AI_PUSHPACK_IS_DEFINED - - diff --git a/src/3rdparty/assimp/include/assimp/DefaultIOStream.h b/src/3rdparty/assimp/include/assimp/DefaultIOStream.h new file mode 100644 index 000000000..3668b27ec --- /dev/null +++ b/src/3rdparty/assimp/include/assimp/DefaultIOStream.h @@ -0,0 +1,141 @@ +/* +Open Asset Import Library (assimp) +---------------------------------------------------------------------- + +Copyright (c) 2006-2017, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the +following conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- +*/ + +/** @file Default file I/O using fXXX()-family of functions */ +#ifndef AI_DEFAULTIOSTREAM_H_INC +#define AI_DEFAULTIOSTREAM_H_INC + +#include <stdio.h> +#include <assimp/IOStream.hpp> +#include <assimp/importerdesc.h> +#include <assimp/Defines.h> + +namespace Assimp { + +// ---------------------------------------------------------------------------------- +//! @class DefaultIOStream +//! @brief Default IO implementation, use standard IO operations +//! @note An instance of this class can exist without a valid file handle +//! attached to it. All calls fail, but the instance can nevertheless be +//! used with no restrictions. +class ASSIMP_API DefaultIOStream : public IOStream +{ + friend class DefaultIOSystem; +#if __ANDROID__ +# if __ANDROID_API__ > 9 +# if defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) + friend class AndroidJNIIOSystem; +# endif // defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) +# endif // __ANDROID_API__ > 9 +#endif // __ANDROID__ + +protected: + DefaultIOStream(); + DefaultIOStream(FILE* pFile, const std::string &strFilename); + +public: + /** Destructor public to allow simple deletion to close the file. */ + ~DefaultIOStream (); + + // ------------------------------------------------------------------- + /// Read from stream + size_t Read(void* pvBuffer, + size_t pSize, + size_t pCount); + + + // ------------------------------------------------------------------- + /// Write to stream + size_t Write(const void* pvBuffer, + size_t pSize, + size_t pCount); + + // ------------------------------------------------------------------- + /// Seek specific position + aiReturn Seek(size_t pOffset, + aiOrigin pOrigin); + + // ------------------------------------------------------------------- + /// Get current seek position + size_t Tell() const; + + // ------------------------------------------------------------------- + /// Get size of file + size_t FileSize() const; + + // ------------------------------------------------------------------- + /// Flush file contents + void Flush(); + +private: + // File data-structure, using clib + FILE* mFile; + // Filename + std::string mFilename; + + // Cached file size + mutable size_t mCachedSize; +}; + +// ---------------------------------------------------------------------------------- +inline DefaultIOStream::DefaultIOStream () : + mFile (NULL), + mFilename (""), + mCachedSize(SIZE_MAX) +{ + // empty +} + +// ---------------------------------------------------------------------------------- +inline DefaultIOStream::DefaultIOStream (FILE* pFile, + const std::string &strFilename) : + mFile(pFile), + mFilename(strFilename), + mCachedSize(SIZE_MAX) +{ + // empty +} +// ---------------------------------------------------------------------------------- + +} // ns assimp + +#endif //!!AI_DEFAULTIOSTREAM_H_INC + diff --git a/src/3rdparty/assimp/include/assimp/DefaultIOSystem.h b/src/3rdparty/assimp/include/assimp/DefaultIOSystem.h new file mode 100644 index 000000000..d7cf031cf --- /dev/null +++ b/src/3rdparty/assimp/include/assimp/DefaultIOSystem.h @@ -0,0 +1,99 @@ +/* +Open Asset Import Library (assimp) +---------------------------------------------------------------------- + +Copyright (c) 2006-2017, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the +following conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- +*/ + +/** @file Default implementation of IOSystem using the standard C file functions */ +#ifndef AI_DEFAULTIOSYSTEM_H_INC +#define AI_DEFAULTIOSYSTEM_H_INC + +#include <assimp/IOSystem.hpp> + +namespace Assimp { + +// --------------------------------------------------------------------------- +/** Default implementation of IOSystem using the standard C file functions */ +class ASSIMP_API DefaultIOSystem : public IOSystem +{ +public: + /** Constructor. */ + DefaultIOSystem(); + + /** Destructor. */ + ~DefaultIOSystem(); + + // ------------------------------------------------------------------- + /** Tests for the existence of a file at the given path. */ + bool Exists( const char* pFile) const; + + // ------------------------------------------------------------------- + /** Returns the directory separator. */ + char getOsSeparator() const; + + // ------------------------------------------------------------------- + /** Open a new file with a given path. */ + IOStream* Open( const char* pFile, const char* pMode = "rb"); + + // ------------------------------------------------------------------- + /** Closes the given file and releases all resources associated with it. */ + void Close( IOStream* pFile); + + // ------------------------------------------------------------------- + /** Compare two paths */ + bool ComparePaths (const char* one, const char* second) const; + + /** @brief get the file name of a full filepath + * example: /tmp/archive.tar.gz -> archive.tar.gz + */ + static std::string fileName( const std::string &path ); + + /** @brief get the complete base name of a full filepath + * example: /tmp/archive.tar.gz -> archive.tar + */ + static std::string completeBaseName( const std::string &path); + + /** @brief get the path of a full filepath + * example: /tmp/archive.tar.gz -> /tmp/ + */ + static std::string absolutePath( const std::string &path); +}; + +} //!ns Assimp + +#endif //AI_DEFAULTIOSYSTEM_H_INC diff --git a/src/3rdparty/assimp/include/assimp/DefaultLogger.hpp b/src/3rdparty/assimp/include/assimp/DefaultLogger.hpp index 52574d5ea..4f1a7e1f4 100644 --- a/src/3rdparty/assimp/include/assimp/DefaultLogger.hpp +++ b/src/3rdparty/assimp/include/assimp/DefaultLogger.hpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/src/3rdparty/assimp/include/assimp/Defines.h b/src/3rdparty/assimp/include/assimp/Defines.h new file mode 100644 index 000000000..15e1d83c2 --- /dev/null +++ b/src/3rdparty/assimp/include/assimp/Defines.h @@ -0,0 +1,49 @@ +/* +Open Asset Import Library (assimp) +---------------------------------------------------------------------- + +Copyright (c) 2006-2012, assimp team +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the +following conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- +*/ + +// We need those constants, workaround for any platforms where nobody defined them yet +#if (!defined SIZE_MAX) +# define SIZE_MAX (~((size_t)0)) +#endif + +#if (!defined UINT_MAX) +# define UINT_MAX (~((unsigned int)0)) +#endif + diff --git a/src/3rdparty/assimp/include/assimp/Exporter.hpp b/src/3rdparty/assimp/include/assimp/Exporter.hpp index 079060f4b..c6a6f684a 100644 --- a/src/3rdparty/assimp/include/assimp/Exporter.hpp +++ b/src/3rdparty/assimp/include/assimp/Exporter.hpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2011, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file Exporter.hpp * @brief Defines the CPP-API for the Assimp export interface */ +#pragma once #ifndef AI_EXPORT_HPP_INC #define AI_EXPORT_HPP_INC @@ -50,17 +52,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "cexport.h" #include <map> -namespace Assimp { - class ExporterPimpl; - class IOSystem; - +namespace Assimp { + +class ExporterPimpl; +class IOSystem; // ---------------------------------------------------------------------------------- /** CPP-API: The Exporter class forms an C++ interface to the export functionality * of the Open Asset Import Library. Note that the export interface is available * only if Assimp has been built with ASSIMP_BUILD_NO_EXPORT not defined. * - * The interface is modelled after the importer interface and mostly + * The interface is modeled after the importer interface and mostly * symmetric. The same rules for threading etc. apply. * * In a nutshell, there are two export interfaces: #Export, which writes the @@ -73,17 +75,10 @@ namespace Assimp { * #ExportToBlob is especially useful if you intend to work * with the data in-memory. */ - class ASSIMP_API ExportProperties; -class ASSIMP_API Exporter - // TODO: causes good ol' base class has no dll interface warning -//#ifdef __cplusplus -// : public boost::noncopyable -//#endif // __cplusplus -{ +class ASSIMP_API Exporter { public: - /** Function pointer type of a Export worker function */ typedef void (*fpExportFunc)(const char*, IOSystem*, const aiScene*, const ExportProperties*); @@ -96,7 +91,7 @@ public: // Worker function to do the actual exporting fpExportFunc mExportFunction; - // Postprocessing steps to be executed PRIOR to invoking mExportFunction + // Post-processing steps to be executed PRIOR to invoking mExportFunction unsigned int mEnforcePP; // Constructor to fill all entries @@ -121,14 +116,10 @@ public: public: - - Exporter(); ~Exporter(); public: - - // ------------------------------------------------------------------- /** Supplies a custom IO handler to the exporter to use to open and * access files. @@ -162,8 +153,6 @@ public: * @return true by default */ bool IsDefaultIOHandler() const; - - // ------------------------------------------------------------------- /** Exports the given scene to a chosen file format. Returns the exported * data as a binary blob which you can write into a file or something. @@ -182,9 +171,8 @@ public: * Any IO handlers set via #SetIOHandler are ignored here. * @note Use aiCopyScene() to get a modifiable copy of a previously * imported scene. */ - const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL); - inline const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const std::string& pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL); - + const aiExportDataBlob* ExportToBlob(const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* = NULL); + const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const std::string& pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL); // ------------------------------------------------------------------- /** Convenience function to export directly to a file. Use @@ -212,16 +200,15 @@ public: * triangulate data so they would run the step even if it wasn't requested. * * If assimp detects that the input scene was directly taken from the importer side of - * the library (i.e. not copied using aiCopyScene and potetially modified afterwards), - * any postprocessing steps already applied to the scene will not be applied again, unless - * they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and + * the library (i.e. not copied using aiCopyScene and potentially modified afterwards), + * any post-processing steps already applied to the scene will not be applied again, unless + * they show non-idempotent behavior (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and * #aiProcess_FlipWindingOrder). * @return AI_SUCCESS if everything was fine. * @note Use aiCopyScene() to get a modifiable copy of a previously * imported scene.*/ aiReturn Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL); - inline aiReturn Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL); - + aiReturn Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL); // ------------------------------------------------------------------- /** Returns an error description of an error that occurred in #Export @@ -235,30 +222,26 @@ public: * following methods is called: #Export, #ExportToBlob, #FreeBlob */ const char* GetErrorString() const; - // ------------------------------------------------------------------- /** Return the blob obtained from the last call to #ExportToBlob */ const aiExportDataBlob* GetBlob() const; - // ------------------------------------------------------------------- /** Orphan the blob from the last call to #ExportToBlob. This means * the caller takes ownership and is thus responsible for calling * the C API function #aiReleaseExportBlob to release it. */ const aiExportDataBlob* GetOrphanedBlob() const; - // ------------------------------------------------------------------- /** Frees the current blob. * * The function does nothing if no blob has previously been * previously produced via #ExportToBlob. #FreeBlob is called * automatically by the destructor. The only reason to call - * it manually would be to reclain as much storage as possible + * it manually would be to reclaim as much storage as possible * without giving up the #Exporter instance yet. */ void FreeBlob( ); - // ------------------------------------------------------------------- /** Returns the number of export file formats available in the current * Assimp build. Use #Exporter::GetExportFormatDescription to @@ -269,13 +252,12 @@ public: **/ size_t GetExportFormatCount() const; - // ------------------------------------------------------------------- /** Returns a description of the nth export file format. Use # * #Exporter::GetExportFormatCount to learn how many export * formats are supported. * - * The returned pointer is of static storage duration iff the + * The returned pointer is of static storage duration if the * pIndex pertains to a built-in exporter (i.e. one not registered * via #RegistrerExporter). It is restricted to the life-time of the * #Exporter instance otherwise. @@ -286,7 +268,6 @@ public: * NULL if pIndex is out of range. */ const aiExportFormatDesc* GetExportFormatDescription( size_t pIndex ) const; - // ------------------------------------------------------------------- /** Register a custom exporter. Custom export formats are limited to * to the current #Exporter instance and do not affect the @@ -300,11 +281,10 @@ public: * occupied by another format. */ aiReturn RegisterExporter(const ExportFormatEntry& desc); - // ------------------------------------------------------------------- /** Remove an export format previously registered with #RegisterExporter * from the #Exporter instance (this can also be used to drop - * builtin exporters because those are implicitly registered + * built-in exporters because those are implicitly registered * using #RegisterExporter). * @param id Format id to be unregistered, this refers to the * 'id' field of #aiExportFormatDesc. @@ -312,16 +292,12 @@ public: * has no effect.*/ void UnregisterExporter(const char* id); - protected: - // Just because we don't want you to know how we're hacking around. ExporterPimpl* pimpl; }; - -class ASSIMP_API ExportProperties -{ +class ASSIMP_API ExportProperties { public: // Data type to store the key hash typedef unsigned int KeyType; @@ -329,16 +305,14 @@ public: // typedefs for our four configuration maps. // We don't need more, so there is no need for a generic solution typedef std::map<KeyType, int> IntPropertyMap; - typedef std::map<KeyType, float> FloatPropertyMap; + typedef std::map<KeyType, ai_real> FloatPropertyMap; typedef std::map<KeyType, std::string> StringPropertyMap; typedef std::map<KeyType, aiMatrix4x4> MatrixPropertyMap; public: - /** Standard constructor * @see ExportProperties() */ - ExportProperties(); // ------------------------------------------------------------------- @@ -379,7 +353,7 @@ public: /** Set a floating-point configuration property. * @see SetPropertyInteger() */ - bool SetPropertyFloat(const char* szName, float fValue); + bool SetPropertyFloat(const char* szName, ai_real fValue); // ------------------------------------------------------------------- /** Set a string configuration property. @@ -424,8 +398,8 @@ public: /** Get a floating-point configuration property * @see GetPropertyInteger() */ - float GetPropertyFloat(const char* szName, - float fErrorReturn = 10e10f) const; + ai_real GetPropertyFloat(const char* szName, + ai_real fErrorReturn = 10e10f) const; // ------------------------------------------------------------------- /** Get a string configuration property @@ -486,19 +460,24 @@ protected: MatrixPropertyMap mMatrixProperties; }; - // ---------------------------------------------------------------------------------- -inline const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const std::string& pFormatId,unsigned int pPreprocessing, const ExportProperties* pProperties) +inline +const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const std::string& pFormatId, + unsigned int pPreprocessing, const ExportProperties* pProperties) { return ExportToBlob(pScene,pFormatId.c_str(),pPreprocessing, pProperties); } // ---------------------------------------------------------------------------------- -inline aiReturn Exporter :: Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing, const ExportProperties* pProperties) +inline +aiReturn Exporter :: Export( const aiScene* pScene, const std::string& pFormatId, + const std::string& pPath, unsigned int pPreprocessing, + const ExportProperties* pProperties) { return Export(pScene,pFormatId.c_str(),pPath.c_str(),pPreprocessing, pProperties); } } // namespace Assimp + #endif // ASSIMP_BUILD_NO_EXPORT #endif // AI_EXPORT_HPP_INC diff --git a/src/3rdparty/assimp/include/assimp/IOStream.hpp b/src/3rdparty/assimp/include/assimp/IOStream.hpp index 6cc231b3d..ce5907a47 100644 --- a/src/3rdparty/assimp/include/assimp/IOStream.hpp +++ b/src/3rdparty/assimp/include/assimp/IOStream.hpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief File I/O wrappers for C++. */ +#pragma once #ifndef AI_IOSTREAM_H_INC #define AI_IOSTREAM_H_INC diff --git a/src/3rdparty/assimp/include/assimp/IOSystem.hpp b/src/3rdparty/assimp/include/assimp/IOSystem.hpp index abd7e5837..f4fbb6023 100644 --- a/src/3rdparty/assimp/include/assimp/IOSystem.hpp +++ b/src/3rdparty/assimp/include/assimp/IOSystem.hpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -44,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * custom file handling logic to the Import library. */ +#pragma once #ifndef AI_IOSYSTEM_H_INC #define AI_IOSYSTEM_H_INC @@ -54,10 +56,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "types.h" +#ifdef _WIN32 +# include <direct.h> +# include <stdlib.h> +# include <stdio.h> +#else +# include <sys/stat.h> +# include <sys/types.h> +# include <unistd.h> +#endif // _WIN32 + #include <vector> namespace Assimp { -class IOStream; + + class IOStream; // --------------------------------------------------------------------------- /** @brief CPP-API: Interface to the file system. @@ -66,7 +79,8 @@ class IOStream; * to the importer library. If you implement this interface, you also want to * supply a custom implementation for IOStream. * - * @see Importer::SetIOHandler() */ + * @see Importer::SetIOHandler() + */ class ASSIMP_API IOSystem #ifndef SWIG : public Intern::AllocateFromAssimpHeap @@ -195,20 +209,37 @@ public: */ virtual bool PopDirectory(); + // ------------------------------------------------------------------- + /** @brief CReates an new directory at the given path. + * @param path [in] The path to create. + * @return True, when a directory was created. False if the directory + * cannot be created. + */ + virtual bool CreateDirectory( const std::string &path ); + + // ------------------------------------------------------------------- + /** @brief Will change the current directory to the given path. + * @param path [in] The path to change to. + * @return True, when the directory has changed successfully. + */ + virtual bool ChangeDirectory( const std::string &path ); + + virtual bool DeleteFile( const std::string &file ); + private: std::vector<std::string> m_pathStack; }; // ---------------------------------------------------------------------------- -AI_FORCE_INLINE IOSystem::IOSystem() : - m_pathStack() -{ +AI_FORCE_INLINE +IOSystem::IOSystem() +: m_pathStack() { // empty } // ---------------------------------------------------------------------------- -AI_FORCE_INLINE IOSystem::~IOSystem() -{ +AI_FORCE_INLINE +IOSystem::~IOSystem() { // empty } @@ -219,9 +250,8 @@ AI_FORCE_INLINE IOSystem::~IOSystem() // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- -AI_FORCE_INLINE IOStream* IOSystem::Open(const std::string& pFile, - const std::string& pMode) -{ +AI_FORCE_INLINE +IOStream* IOSystem::Open(const std::string& pFile, const std::string& pMode) { // NOTE: // For compatibility, interface was changed to const char* to // avoid crashes between binary incompatible STL versions @@ -229,8 +259,8 @@ AI_FORCE_INLINE IOStream* IOSystem::Open(const std::string& pFile, } // ---------------------------------------------------------------------------- -AI_FORCE_INLINE bool IOSystem::Exists( const std::string& pFile) const -{ +AI_FORCE_INLINE +bool IOSystem::Exists( const std::string& pFile) const { // NOTE: // For compatibility, interface was changed to const char* to // avoid crashes between binary incompatible STL versions @@ -238,9 +268,8 @@ AI_FORCE_INLINE bool IOSystem::Exists( const std::string& pFile) const } // ---------------------------------------------------------------------------- -inline bool IOSystem::ComparePaths (const std::string& one, - const std::string& second) const -{ +AI_FORCE_INLINE +bool IOSystem::ComparePaths (const std::string& one, const std::string& second) const { // NOTE: // For compatibility, interface was changed to const char* to // avoid crashes between binary incompatible STL versions @@ -248,7 +277,8 @@ inline bool IOSystem::ComparePaths (const std::string& one, } // ---------------------------------------------------------------------------- -inline bool IOSystem::PushDirectory( const std::string &path ) { +AI_FORCE_INLINE +bool IOSystem::PushDirectory( const std::string &path ) { if ( path.empty() ) { return false; } @@ -259,7 +289,8 @@ inline bool IOSystem::PushDirectory( const std::string &path ) { } // ---------------------------------------------------------------------------- -inline const std::string &IOSystem::CurrentDirectory() const { +AI_FORCE_INLINE +const std::string &IOSystem::CurrentDirectory() const { if ( m_pathStack.empty() ) { static const std::string Dummy(""); return Dummy; @@ -268,12 +299,14 @@ inline const std::string &IOSystem::CurrentDirectory() const { } // ---------------------------------------------------------------------------- -inline size_t IOSystem::StackSize() const { +AI_FORCE_INLINE +size_t IOSystem::StackSize() const { return m_pathStack.size(); } // ---------------------------------------------------------------------------- -inline bool IOSystem::PopDirectory() { +AI_FORCE_INLINE +bool IOSystem::PopDirectory() { if ( m_pathStack.empty() ) { return false; } @@ -284,7 +317,43 @@ inline bool IOSystem::PopDirectory() { } // ---------------------------------------------------------------------------- +AI_FORCE_INLINE +bool IOSystem::CreateDirectory( const std::string &path ) { + if ( path.empty() ) { + return false; + } + +#ifdef _WIN32 + return 0 != ::_mkdir( path.c_str() ); +#else + return 0 != ::mkdir( path.c_str(), 0777 ); +#endif // _WIN32 +} + +// ---------------------------------------------------------------------------- +AI_FORCE_INLINE +bool IOSystem::ChangeDirectory( const std::string &path ) { + if ( path.empty() ) { + return false; + } + +#ifdef _WIN32 + return 0 != ::_chdir( path.c_str() ); +#else + return 0 != ::chdir( path.c_str() ); +#endif // _WIN32 +} + +// ---------------------------------------------------------------------------- +AI_FORCE_INLINE +bool IOSystem::DeleteFile( const std::string &file ) { + if ( file.empty() ) { + return false; + } + const int retCode( ::remove( file.c_str() ) ); + return ( 0 == retCode ); +} } //!ns Assimp #endif //AI_IOSYSTEM_H_INC diff --git a/src/3rdparty/assimp/include/assimp/Importer.hpp b/src/3rdparty/assimp/include/assimp/Importer.hpp index 4c01367ed..f42a2deaf 100644 --- a/src/3rdparty/assimp/include/assimp/Importer.hpp +++ b/src/3rdparty/assimp/include/assimp/Importer.hpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,22 +43,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file Importer.hpp * @brief Defines the C++-API to the Open Asset Import Library. */ -#ifndef INCLUDED_AI_ASSIMP_HPP -#define INCLUDED_AI_ASSIMP_HPP +#pragma once +#ifndef AI_ASSIMP_HPP_INC +#define AI_ASSIMP_HPP_INC #ifndef __cplusplus # error This header requires C++ to be used. Use assimp.h for plain C. -#endif +#endif // __cplusplus // Public ASSIMP data structures -#include "types.h" -#include "config.h" +#include <assimp/types.h> namespace Assimp { // ======================================================================= // Public interface to Assimp class Importer; - class Exporter; // export.hpp class IOStream; class IOSystem; class ProgressHandler; @@ -76,7 +76,6 @@ namespace Assimp { // ======================================================================= // Holy stuff, only for members of the high council of the Jedi. class ImporterPimpl; - class ExporterPimpl; // export.hpp } //! namespace Assimp #define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff @@ -118,7 +117,7 @@ public: /** * @brief The upper limit for hints. */ - static const unsigned int MaxLenHint = 200; + static const unsigned int MaxLenHint = 200; public: @@ -192,7 +191,6 @@ public: */ aiReturn UnregisterPPStep(BaseProcess* pImp); - // ------------------------------------------------------------------- /** Set an integer configuration property. * @param szName Name of the property. All supported properties @@ -223,7 +221,7 @@ public: /** Set a floating-point configuration property. * @see SetPropertyInteger() */ - bool SetPropertyFloat(const char* szName, float fValue); + bool SetPropertyFloat(const char* szName, ai_real fValue); // ------------------------------------------------------------------- /** Set a string configuration property. @@ -268,8 +266,8 @@ public: /** Get a floating-point configuration property * @see GetPropertyInteger() */ - float GetPropertyFloat(const char* szName, - float fErrorReturn = 10e10f) const; + ai_real GetPropertyFloat(const char* szName, + ai_real fErrorReturn = 10e10) const; // ------------------------------------------------------------------- /** Get a string configuration property @@ -291,10 +289,10 @@ public: // ------------------------------------------------------------------- /** Supplies a custom IO handler to the importer to use to open and - * access files. If you need the importer to use custion IO logic to + * access files. If you need the importer to use custom IO logic to * access the files, you need to provide a custom implementation of * IOSystem and IOFile to the importer. Then create an instance of - * your custion IOSystem implementation and supply it by this function. + * your custom IOSystem implementation and supply it by this function. * * The Importer takes ownership of the object and will destroy it * afterwards. The previously assigned handler will be deleted. @@ -356,7 +354,7 @@ public: bool IsDefaultProgressHandler() const; // ------------------------------------------------------------------- - /** @brief Check whether a given set of postprocessing flags + /** @brief Check whether a given set of post-processing flags * is supported. * * Some flags are mutually exclusive, others are probably @@ -516,9 +514,6 @@ public: * It will work as well for static linkage with Assimp.*/ aiScene* GetOrphanedScene(); - - - // ------------------------------------------------------------------- /** Returns whether a given file extension is supported by ASSIMP. * @@ -557,7 +552,7 @@ public: inline void GetExtensionList(std::string& szOut) const; // ------------------------------------------------------------------- - /** Get the number of importrs currently registered with Assimp. */ + /** Get the number of importers currently registered with Assimp. */ size_t GetImporterCount() const; // ------------------------------------------------------------------- @@ -600,9 +595,6 @@ public: * @return (size_t)-1 if no importer is found */ size_t GetImporterIndex (const char* szExtension) const; - - - // ------------------------------------------------------------------- /** Returns the storage allocated by ASSIMP to hold the scene data * in memory. @@ -623,7 +615,6 @@ public: * intended for use in production environments. */ void SetExtraVerbose(bool bDo); - // ------------------------------------------------------------------- /** Private, do not use. */ ImporterPimpl* Pimpl() { return pimpl; } @@ -658,4 +649,5 @@ AI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtensi } } // !namespace Assimp -#endif // INCLUDED_AI_ASSIMP_HPP + +#endif // AI_ASSIMP_HPP_INC diff --git a/src/3rdparty/assimp/include/assimp/LogStream.hpp b/src/3rdparty/assimp/include/assimp/LogStream.hpp index 477fe5321..1052f1fda 100644 --- a/src/3rdparty/assimp/include/assimp/LogStream.hpp +++ b/src/3rdparty/assimp/include/assimp/LogStream.hpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -43,8 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef INCLUDED_AI_LOGSTREAM_H #define INCLUDED_AI_LOGSTREAM_H + #include "types.h" + namespace Assimp { + class IOSystem; // ------------------------------------------------------------------------------------ @@ -60,12 +64,11 @@ class ASSIMP_API LogStream { protected: /** @brief Default constructor */ - LogStream() { - } + LogStream(); + public: /** @brief Virtual destructor */ - virtual ~LogStream() { - } + virtual ~LogStream(); // ------------------------------------------------------------------- /** @brief Overwrite this for your own output methods @@ -90,6 +93,17 @@ public: IOSystem* io = NULL); }; // !class LogStream + +inline +LogStream::LogStream() { + // empty +} + +inline +LogStream::~LogStream() { + // empty +} + // ------------------------------------------------------------------------------------ } // Namespace Assimp diff --git a/src/3rdparty/assimp/include/assimp/Logger.hpp b/src/3rdparty/assimp/include/assimp/Logger.hpp index 7f355b5bf..0875b6d7d 100644 --- a/src/3rdparty/assimp/include/assimp/Logger.hpp +++ b/src/3rdparty/assimp/include/assimp/Logger.hpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -45,7 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define INCLUDED_AI_LOGGER_H #include "types.h" -namespace Assimp { + +namespace Assimp { + class LogStream; // Maximum length of a log message. Longer messages are rejected. diff --git a/src/3rdparty/assimp/include/assimp/NullLogger.hpp b/src/3rdparty/assimp/include/assimp/NullLogger.hpp index 64b59a4a0..191db1aaa 100644 --- a/src/3rdparty/assimp/include/assimp/NullLogger.hpp +++ b/src/3rdparty/assimp/include/assimp/NullLogger.hpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -46,7 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define INCLUDED_AI_NULLLOGGER_H #include "Logger.hpp" -namespace Assimp { + +namespace Assimp { + // --------------------------------------------------------------------------- /** @brief CPP-API: Empty logging implementation. * diff --git a/src/3rdparty/assimp/include/assimp/ProgressHandler.hpp b/src/3rdparty/assimp/include/assimp/ProgressHandler.hpp index 8b069c82e..2c5b2f4c5 100644 --- a/src/3rdparty/assimp/include/assimp/ProgressHandler.hpp +++ b/src/3rdparty/assimp/include/assimp/ProgressHandler.hpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -41,9 +42,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file ProgressHandler.hpp * @brief Abstract base class 'ProgressHandler'. */ -#ifndef INCLUDED_AI_PROGRESSHANDLER_H -#define INCLUDED_AI_PROGRESSHANDLER_H +#pragma once +#ifndef AI_PROGRESSHANDLER_H_INC +#define AI_PROGRESSHANDLER_H_INC + #include "types.h" + namespace Assimp { // ------------------------------------------------------------------------------------ @@ -119,4 +123,4 @@ public: // ------------------------------------------------------------------------------------ } // Namespace Assimp -#endif +#endif // AI_PROGRESSHANDLER_H_INC diff --git a/src/3rdparty/assimp/include/assimp/SceneCombiner.h b/src/3rdparty/assimp/include/assimp/SceneCombiner.h new file mode 100644 index 000000000..aa57406b9 --- /dev/null +++ b/src/3rdparty/assimp/include/assimp/SceneCombiner.h @@ -0,0 +1,400 @@ +/* +Open Asset Import Library (assimp) +---------------------------------------------------------------------- + +Copyright (c) 2006-2017, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the +following conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- +*/ + +/** @file Declares a helper class, "SceneCombiner" providing various + * utilities to merge scenes. + */ +#ifndef AI_SCENE_COMBINER_H_INC +#define AI_SCENE_COMBINER_H_INC + +#include <assimp/ai_assert.h> +#include <assimp/types.h> +#include <assimp/Defines.h> +#include <stddef.h> +#include <set> +#include <list> +#include <stdint.h> + +#include <vector> + +struct aiScene; +struct aiNode; +struct aiMaterial; +struct aiTexture; +struct aiCamera; +struct aiLight; +struct aiMetadata; +struct aiBone; +struct aiMesh; +struct aiAnimation; +struct aiNodeAnim; + +namespace Assimp { + +// --------------------------------------------------------------------------- +/** \brief Helper data structure for SceneCombiner. + * + * Describes to which node a scene must be attached to. + */ +struct AttachmentInfo +{ + AttachmentInfo() + : scene (NULL) + , attachToNode (NULL) + {} + + AttachmentInfo(aiScene* _scene, aiNode* _attachToNode) + : scene (_scene) + , attachToNode (_attachToNode) + {} + + aiScene* scene; + aiNode* attachToNode; +}; + +// --------------------------------------------------------------------------- +struct NodeAttachmentInfo +{ + NodeAttachmentInfo() + : node (NULL) + , attachToNode (NULL) + , resolved (false) + , src_idx (SIZE_MAX) + {} + + NodeAttachmentInfo(aiNode* _scene, aiNode* _attachToNode,size_t idx) + : node (_scene) + , attachToNode (_attachToNode) + , resolved (false) + , src_idx (idx) + {} + + aiNode* node; + aiNode* attachToNode; + bool resolved; + size_t src_idx; +}; + +// --------------------------------------------------------------------------- +/** @def AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES + * Generate unique names for all named scene items + */ +#define AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES 0x1 + +/** @def AI_INT_MERGE_SCENE_GEN_UNIQUE_MATNAMES + * Generate unique names for materials, too. + * This is not absolutely required to pass the validation. + */ +#define AI_INT_MERGE_SCENE_GEN_UNIQUE_MATNAMES 0x2 + +/** @def AI_INT_MERGE_SCENE_DUPLICATES_DEEP_CPY + * Use deep copies of duplicate scenes + */ +#define AI_INT_MERGE_SCENE_DUPLICATES_DEEP_CPY 0x4 + +/** @def AI_INT_MERGE_SCENE_RESOLVE_CROSS_ATTACHMENTS + * If attachment nodes are not found in the given master scene, + * search the other imported scenes for them in an any order. + */ +#define AI_INT_MERGE_SCENE_RESOLVE_CROSS_ATTACHMENTS 0x8 + +/** @def AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES_IF_NECESSARY + * Can be combined with AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES. + * Unique names are generated, but only if this is absolutely + * required to avoid name conflicts. + */ +#define AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES_IF_NECESSARY 0x10 + +typedef std::pair<aiBone*,unsigned int> BoneSrcIndex; + +// --------------------------------------------------------------------------- +/** @brief Helper data structure for SceneCombiner::MergeBones. + */ +struct BoneWithHash : public std::pair<uint32_t,aiString*> { + std::vector<BoneSrcIndex> pSrcBones; +}; + +// --------------------------------------------------------------------------- +/** @brief Utility for SceneCombiner + */ +struct SceneHelper +{ + SceneHelper () + : scene (NULL) + , idlen (0) + { + id[0] = 0; + } + + explicit SceneHelper (aiScene* _scene) + : scene (_scene) + , idlen (0) + { + id[0] = 0; + } + + AI_FORCE_INLINE aiScene* operator-> () const + { + return scene; + } + + // scene we're working on + aiScene* scene; + + // prefix to be added to all identifiers in the scene ... + char id [32]; + + // and its strlen() + unsigned int idlen; + + // hash table to quickly check whether a name is contained in the scene + std::set<unsigned int> hashes; +}; + +// --------------------------------------------------------------------------- +/** \brief Static helper class providing various utilities to merge two + * scenes. It is intended as internal utility and NOT for use by + * applications. + * + * The class is currently being used by various postprocessing steps + * and loaders (ie. LWS). + */ +class ASSIMP_API SceneCombiner { + // class cannot be instanced + SceneCombiner() { + // empty + } + + ~SceneCombiner() { + // empty + } + +public: + // ------------------------------------------------------------------- + /** Merges two or more scenes. + * + * @param dest Receives a pointer to the destination scene. If the + * pointer doesn't point to NULL when the function is called, the + * existing scene is cleared and refilled. + * @param src Non-empty list of scenes to be merged. The function + * deletes the input scenes afterwards. There may be duplicate scenes. + * @param flags Combination of the AI_INT_MERGE_SCENE flags defined above + */ + static void MergeScenes(aiScene** dest,std::vector<aiScene*>& src, + unsigned int flags = 0); + + // ------------------------------------------------------------------- + /** Merges two or more scenes and attaches all scenes to a specific + * position in the node graph of the master scene. + * + * @param dest Receives a pointer to the destination scene. If the + * pointer doesn't point to NULL when the function is called, the + * existing scene is cleared and refilled. + * @param master Master scene. It will be deleted afterwards. All + * other scenes will be inserted in its node graph. + * @param src Non-empty list of scenes to be merged along with their + * corresponding attachment points in the master scene. The function + * deletes the input scenes afterwards. There may be duplicate scenes. + * @param flags Combination of the AI_INT_MERGE_SCENE flags defined above + */ + static void MergeScenes(aiScene** dest, aiScene* master, + std::vector<AttachmentInfo>& src, + unsigned int flags = 0); + + // ------------------------------------------------------------------- + /** Merges two or more meshes + * + * The meshes should have equal vertex formats. Only components + * that are provided by ALL meshes will be present in the output mesh. + * An exception is made for VColors - they are set to black. The + * meshes should have the same material indices, too. The output + * material index is always the material index of the first mesh. + * + * @param dest Destination mesh. Must be empty. + * @param flags Currently no parameters + * @param begin First mesh to be processed + * @param end Points to the mesh after the last mesh to be processed + */ + static void MergeMeshes(aiMesh** dest,unsigned int flags, + std::vector<aiMesh*>::const_iterator begin, + std::vector<aiMesh*>::const_iterator end); + + // ------------------------------------------------------------------- + /** Merges two or more bones + * + * @param out Mesh to receive the output bone list + * @param flags Currently no parameters + * @param begin First mesh to be processed + * @param end Points to the mesh after the last mesh to be processed + */ + static void MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator it, + std::vector<aiMesh*>::const_iterator end); + + // ------------------------------------------------------------------- + /** Merges two or more materials + * + * The materials should be complementary as much as possible. In case + * of a property present in different materials, the first occurrence + * is used. + * + * @param dest Destination material. Must be empty. + * @param begin First material to be processed + * @param end Points to the material after the last material to be processed + */ + static void MergeMaterials(aiMaterial** dest, + std::vector<aiMaterial*>::const_iterator begin, + std::vector<aiMaterial*>::const_iterator end); + + // ------------------------------------------------------------------- + /** Builds a list of uniquely named bones in a mesh list + * + * @param asBones Receives the output list + * @param it First mesh to be processed + * @param end Last mesh to be processed + */ + static void BuildUniqueBoneList(std::list<BoneWithHash>& asBones, + std::vector<aiMesh*>::const_iterator it, + std::vector<aiMesh*>::const_iterator end); + + // ------------------------------------------------------------------- + /** Add a name prefix to all nodes in a scene. + * + * @param Current node. This function is called recursively. + * @param prefix Prefix to be added to all nodes + * @param len STring length + */ + static void AddNodePrefixes(aiNode* node, const char* prefix, + unsigned int len); + + // ------------------------------------------------------------------- + /** Add an offset to all mesh indices in a node graph + * + * @param Current node. This function is called recursively. + * @param offset Offset to be added to all mesh indices + */ + static void OffsetNodeMeshIndices (aiNode* node, unsigned int offset); + + // ------------------------------------------------------------------- + /** Attach a list of node graphs to well-defined nodes in a master + * graph. This is a helper for MergeScenes() + * + * @param master Master scene + * @param srcList List of source scenes along with their attachment + * points. If an attachment point is NULL (or does not exist in + * the master graph), a scene is attached to the root of the master + * graph (as an additional child node) + * @duplicates List of duplicates. If elem[n] == n the scene is not + * a duplicate. Otherwise elem[n] links scene n to its first occurrence. + */ + static void AttachToGraph ( aiScene* master, + std::vector<NodeAttachmentInfo>& srcList); + + static void AttachToGraph (aiNode* attach, + std::vector<NodeAttachmentInfo>& srcList); + + + // ------------------------------------------------------------------- + /** Get a deep copy of a scene + * + * @param dest Receives a pointer to the destination scene + * @param src Source scene - remains unmodified. + */ + static void CopyScene(aiScene** dest,const aiScene* source,bool allocate = true); + + + // ------------------------------------------------------------------- + /** Get a flat copy of a scene + * + * Only the first hierarchy layer is copied. All pointer members of + * aiScene are shared by source and destination scene. If the + * pointer doesn't point to NULL when the function is called, the + * existing scene is cleared and refilled. + * @param dest Receives a pointer to the destination scene + * @param src Source scene - remains unmodified. + */ + static void CopySceneFlat(aiScene** dest,const aiScene* source); + + + // ------------------------------------------------------------------- + /** Get a deep copy of a mesh + * + * @param dest Receives a pointer to the destination mesh + * @param src Source mesh - remains unmodified. + */ + static void Copy (aiMesh** dest, const aiMesh* src); + + // similar to Copy(): + static void Copy (aiMaterial** dest, const aiMaterial* src); + static void Copy (aiTexture** dest, const aiTexture* src); + static void Copy (aiAnimation** dest, const aiAnimation* src); + static void Copy (aiCamera** dest, const aiCamera* src); + static void Copy (aiBone** dest, const aiBone* src); + static void Copy (aiLight** dest, const aiLight* src); + static void Copy (aiNodeAnim** dest, const aiNodeAnim* src); + static void Copy (aiMetadata** dest, const aiMetadata* src); + + // recursive, of course + static void Copy (aiNode** dest, const aiNode* src); + + +private: + + // ------------------------------------------------------------------- + // Same as AddNodePrefixes, but with an additional check + static void AddNodePrefixesChecked(aiNode* node, const char* prefix, + unsigned int len, + std::vector<SceneHelper>& input, + unsigned int cur); + + // ------------------------------------------------------------------- + // Add node identifiers to a hashing set + static void AddNodeHashes(aiNode* node, std::set<unsigned int>& hashes); + + + // ------------------------------------------------------------------- + // Search for duplicate names + static bool FindNameMatch(const aiString& name, + std::vector<SceneHelper>& input, unsigned int cur); +}; + +} + +#endif // !! AI_SCENE_COMBINER_H_INC diff --git a/src/3rdparty/assimp/include/assimp/ai_assert.h b/src/3rdparty/assimp/include/assimp/ai_assert.h index 0caeff673..d8dbac8d2 100644 --- a/src/3rdparty/assimp/include/assimp/ai_assert.h +++ b/src/3rdparty/assimp/include/assimp/ai_assert.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -38,15 +39,15 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -#ifndef AI_DEBUG_H_INC -#define AI_DEBUG_H_INC +#pragma once +#ifndef AI_ASSERT_H_INC +#define AI_ASSERT_H_INC #ifdef ASSIMP_BUILD_DEBUG # include <assert.h> # define ai_assert(expression) assert(expression) #else # define ai_assert(expression) -#endif - +#endif // -#endif +#endif // AI_ASSERT_H_INC diff --git a/src/3rdparty/assimp/include/assimp/anim.h b/src/3rdparty/assimp/include/assimp/anim.h index 393224e40..f8774b8fd 100644 --- a/src/3rdparty/assimp/include/assimp/anim.h +++ b/src/3rdparty/assimp/include/assimp/anim.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -39,15 +40,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file anim.h - * @brief Defines the data structures in which the imported animations - * are returned. - */ +/** + * @file anim.h + * @brief Defines the data structures in which the imported animations + * are returned. + */ +#pragma once #ifndef AI_ANIM_H_INC #define AI_ANIM_H_INC -#include "types.h" -#include "quaternion.h" +#include <assimp/types.h> +#include <assimp/quaternion.h> #ifdef __cplusplus extern "C" { @@ -65,16 +68,20 @@ struct aiVectorKey #ifdef __cplusplus - //! Default constructor - aiVectorKey(){} + /// @brief The default constructor. + aiVectorKey() + : mTime( 0.0 ) + , mValue() { + // empty + } + + /// @brief Construction from a given time and key value. - //! Construction from a given time and key value aiVectorKey(double time, const aiVector3D& value) : mTime (time) , mValue (value) {} - typedef aiVector3D elem_type; // Comparison operators. For use with std::find(); @@ -92,7 +99,7 @@ struct aiVectorKey bool operator > (const aiVectorKey& o) const { return mTime > o.mTime; } -#endif +#endif // __cplusplus }; // --------------------------------------------------------------------------- @@ -107,7 +114,10 @@ struct aiQuatKey C_STRUCT aiQuaternion mValue; #ifdef __cplusplus - aiQuatKey(){ + aiQuatKey() + : mTime( 0.0 ) + , mValue() { + // empty } /** Construction from a given time and key value */ @@ -144,7 +154,7 @@ struct aiMeshKey double mTime; /** Index into the aiMesh::mAnimMeshes array of the - * mesh coresponding to the #aiMeshAnim hosting this + * mesh corresponding to the #aiMeshAnim hosting this * key frame. The referenced anim mesh is evaluated * according to the rules defined in the docs for #aiAnimMesh.*/ unsigned int mValue; @@ -181,7 +191,6 @@ struct aiMeshKey #endif }; - // --------------------------------------------------------------------------- /** Binds a morph anim mesh to a specific point in time. */ struct aiMeshMorphKey @@ -197,10 +206,10 @@ struct aiMeshMorphKey unsigned int mNumValuesAndWeights; #ifdef __cplusplus aiMeshMorphKey() - : mTime(0.0) - , mValues(NULL) - , mWeights(NULL) - , mNumValuesAndWeights(0) + : mTime(0.0) + , mValues(NULL) + , mWeights(NULL) + , mNumValuesAndWeights(0) { } @@ -237,8 +246,6 @@ enum aiAnimBehaviour * time is t, use the value at (t-n) % (|m-n|).*/ aiAnimBehaviour_REPEAT = 0x3, - - /** This value is not used, it is just here to force the * the compiler to map this enum to a 32 Bit integer */ #ifndef SWIG @@ -261,8 +268,7 @@ enum aiAnimBehaviour * Duplicate keys don't pass the validation step. Most likely there * will be no negative time values, but they are not forbidden also ( so * implementations need to cope with them! ) */ -struct aiNodeAnim -{ +struct aiNodeAnim { /** The name of the node affected by this animation. The node * must exist and it must be unique.*/ C_STRUCT aiString mNodeName; @@ -288,7 +294,6 @@ struct aiNodeAnim * scaling and one position key. */ C_STRUCT aiQuatKey* mRotationKeys; - /** The number of scaling keys */ unsigned int mNumScalingKeys; @@ -299,7 +304,6 @@ struct aiNodeAnim * position and one rotation key.*/ C_STRUCT aiVectorKey* mScalingKeys; - /** Defines how the animation behaves before the first * key is encountered. * @@ -315,17 +319,19 @@ struct aiNodeAnim C_ENUM aiAnimBehaviour mPostState; #ifdef __cplusplus - aiNodeAnim() - { - mNumPositionKeys = 0; mPositionKeys = NULL; - mNumRotationKeys = 0; mRotationKeys = NULL; - mNumScalingKeys = 0; mScalingKeys = NULL; - - mPreState = mPostState = aiAnimBehaviour_DEFAULT; + aiNodeAnim() + : mNumPositionKeys( 0 ) + , mPositionKeys( NULL ) + , mNumRotationKeys( 0 ) + , mRotationKeys( NULL ) + , mNumScalingKeys( 0 ) + , mScalingKeys( NULL ) + , mPreState( aiAnimBehaviour_DEFAULT ) + , mPostState( aiAnimBehaviour_DEFAULT ) { + // empty } - ~aiNodeAnim() - { + ~aiNodeAnim() { delete [] mPositionKeys; delete [] mRotationKeys; delete [] mScalingKeys; @@ -343,7 +349,7 @@ struct aiMeshAnim { /** Name of the mesh to be animated. An empty string is not allowed, * animated meshes need to be named (not necessarily uniquely, - * the name can basically serve as wildcard to select a group + * the name can basically serve as wild-card to select a group * of meshes with similar animation setup)*/ C_STRUCT aiString mName; @@ -400,10 +406,9 @@ struct aiMeshMorphAnim }; // --------------------------------------------------------------------------- -/** An animation consists of keyframe data for a number of nodes. For +/** An animation consists of key-frame data for a number of nodes. For * each node affected by the animation a separate series of data is given.*/ -struct aiAnimation -{ +struct aiAnimation { /** The name of the animation. If the modeling package this data was * exported from does support only a single animation channel, this * name is usually empty (length is zero). */ @@ -432,7 +437,6 @@ struct aiAnimation * The array is mNumMeshChannels in size. */ C_STRUCT aiMeshAnim** mMeshChannels; - /** The number of mesh animation channels. Each channel affects * a single mesh and defines morphing animation. */ unsigned int mNumMorphMeshChannels; @@ -442,56 +446,59 @@ struct aiAnimation C_STRUCT aiMeshMorphAnim **mMorphMeshChannels; #ifdef __cplusplus - aiAnimation() - : mDuration(-1.) - , mTicksPerSecond() - , mNumChannels() - , mChannels() - , mNumMeshChannels() - , mMeshChannels() - , mNumMorphMeshChannels() - , mMorphMeshChannels() - { - } + aiAnimation() + : mDuration(-1.) + , mTicksPerSecond(0.) + , mNumChannels(0) + , mChannels(NULL) + , mNumMeshChannels(0) + , mMeshChannels(NULL) + , mNumMorphMeshChannels(0) + , mMorphMeshChannels(NULL) { + // empty + } - ~aiAnimation() - { - // DO NOT REMOVE THIS ADDITIONAL CHECK - if (mNumChannels && mChannels) { - for( unsigned int a = 0; a < mNumChannels; a++) { - delete mChannels[a]; - } - - delete [] mChannels; - } - if (mNumMeshChannels && mMeshChannels) { - for( unsigned int a = 0; a < mNumMeshChannels; a++) { - delete mMeshChannels[a]; - } - - delete [] mMeshChannels; - } - if (mNumMorphMeshChannels && mMorphMeshChannels) { - for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) { - delete mMorphMeshChannels[a]; - } - } - } + ~aiAnimation() { + // DO NOT REMOVE THIS ADDITIONAL CHECK + if ( mNumChannels && mChannels ) { + for( unsigned int a = 0; a < mNumChannels; a++) { + delete mChannels[ a ]; + } + + delete [] mChannels; + } + if (mNumMeshChannels && mMeshChannels) { + for( unsigned int a = 0; a < mNumMeshChannels; a++) { + delete mMeshChannels[a]; + } + + delete [] mMeshChannels; + } + if (mNumMorphMeshChannels && mMorphMeshChannels) { + for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) { + delete mMorphMeshChannels[a]; + } + + delete [] mMorphMeshChannels; + } + } #endif // __cplusplus }; #ifdef __cplusplus -} +} -// some C++ utilities for inter- and extrapolation +/// @brief Some C++ utilities for inter- and extrapolation namespace Assimp { // --------------------------------------------------------------------------- -/** @brief CPP-API: Utility class to simplify interpolations of various data types. - * - * The type of interpolation is chosen automatically depending on the - * types of the arguments. */ +/** + * @brief CPP-API: Utility class to simplify interpolations of various data types. + * + * The type of interpolation is chosen automatically depending on the + * types of the arguments. + */ template <typename T> struct Interpolator { @@ -501,7 +508,7 @@ struct Interpolator * The interpolation algorithm depends on the type of the operands. * aiQuaternion's and aiQuatKey's SLERP, the rest does a simple * linear interpolation. */ - void operator () (T& out,const T& a, const T& b, float d) const { + void operator () (T& out,const T& a, const T& b, ai_real d) const { out = a + (b-a)*d; } }; // ! Interpolator <T> @@ -511,7 +518,7 @@ struct Interpolator template <> struct Interpolator <aiQuaternion> { void operator () (aiQuaternion& out,const aiQuaternion& a, - const aiQuaternion& b, float d) const + const aiQuaternion& b, ai_real d) const { aiQuaternion::Interpolate(out,a,b,d); } @@ -520,16 +527,16 @@ struct Interpolator <aiQuaternion> { template <> struct Interpolator <unsigned int> { void operator () (unsigned int& out,unsigned int a, - unsigned int b, float d) const + unsigned int b, ai_real d) const { out = d>0.5f ? b : a; } }; // ! Interpolator <aiQuaternion> template <> -struct Interpolator <aiVectorKey> { +struct Interpolator<aiVectorKey> { void operator () (aiVector3D& out,const aiVectorKey& a, - const aiVectorKey& b, float d) const + const aiVectorKey& b, ai_real d) const { Interpolator<aiVector3D> ipl; ipl(out,a.mValue,b.mValue,d); @@ -537,9 +544,9 @@ struct Interpolator <aiVectorKey> { }; // ! Interpolator <aiVectorKey> template <> -struct Interpolator <aiQuatKey> { +struct Interpolator<aiQuatKey> { void operator () (aiQuaternion& out, const aiQuatKey& a, - const aiQuatKey& b, float d) const + const aiQuatKey& b, ai_real d) const { Interpolator<aiQuaternion> ipl; ipl(out,a.mValue,b.mValue,d); @@ -547,9 +554,9 @@ struct Interpolator <aiQuatKey> { }; // ! Interpolator <aiQuatKey> template <> -struct Interpolator <aiMeshKey> { +struct Interpolator<aiMeshKey> { void operator () (unsigned int& out, const aiMeshKey& a, - const aiMeshKey& b, float d) const + const aiMeshKey& b, ai_real d) const { Interpolator<unsigned int> ipl; ipl(out,a.mValue,b.mValue,d); @@ -557,9 +564,9 @@ struct Interpolator <aiMeshKey> { }; // ! Interpolator <aiQuatKey> //! @endcond -} // ! end namespace Assimp - +} // ! end namespace Assimp #endif // __cplusplus + #endif // AI_ANIM_H_INC diff --git a/src/3rdparty/assimp/include/assimp/camera.h b/src/3rdparty/assimp/include/assimp/camera.h index 37f1bdaa0..7b7bd0922 100644 --- a/src/3rdparty/assimp/include/assimp/camera.h +++ b/src/3rdparty/assimp/include/assimp/camera.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -43,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Defines the aiCamera data structure */ +#pragma once #ifndef AI_CAMERA_H_INC #define AI_CAMERA_H_INC diff --git a/src/3rdparty/assimp/include/assimp/cexport.h b/src/3rdparty/assimp/include/assimp/cexport.h index 71cb1f8ec..44b06fb3c 100644 --- a/src/3rdparty/assimp/include/assimp/cexport.h +++ b/src/3rdparty/assimp/include/assimp/cexport.h @@ -42,12 +42,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file cexport.h * @brief Defines the C-API for the Assimp export interface */ +#pragma once #ifndef AI_EXPORT_H_INC #define AI_EXPORT_H_INC #ifndef ASSIMP_BUILD_NO_EXPORT -#include "types.h" +// Public ASSIMP data structures +#include <assimp/types.h> #ifdef __cplusplus extern "C" { @@ -86,7 +88,7 @@ ASSIMP_API size_t aiGetExportFormatCount(void); // -------------------------------------------------------------------------------- /** Returns a description of the nth export file format. Use #aiGetExportFormatCount() - * to learn how many export formats are supported. The description must be released by + * to learn how many export formats are supported. The description must be released by * calling aiReleaseExportFormatDescription afterwards. * @param pIndex Index of the export format to retrieve information for. Valid range is * 0 to #aiGetExportFormatCount() @@ -95,7 +97,7 @@ ASSIMP_API size_t aiGetExportFormatCount(void); ASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex); // -------------------------------------------------------------------------------- -/** Release a description of the nth export file format. Must be returned by +/** Release a description of the nth export file format. Must be returned by * aiGetExportFormatDescription * @param desc Pointer to the description */ @@ -259,4 +261,3 @@ ASSIMP_API void aiReleaseExportBlob( const C_STRUCT aiExportDataBlob* pData ); #endif // ASSIMP_BUILD_NO_EXPORT #endif // AI_EXPORT_H_INC - diff --git a/src/3rdparty/assimp/include/assimp/cfileio.h b/src/3rdparty/assimp/include/assimp/cfileio.h index d91974b78..63eeb59b0 100644 --- a/src/3rdparty/assimp/include/assimp/cfileio.h +++ b/src/3rdparty/assimp/include/assimp/cfileio.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,10 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file cfileio.h * @brief Defines generic C routines to access memory-mapped files */ +#pragma once #ifndef AI_FILEIO_H_INC #define AI_FILEIO_H_INC -#include "types.h" +#include <assimp/types.h> #ifdef __cplusplus extern "C" { #endif @@ -53,15 +55,15 @@ struct aiFileIO; struct aiFile; // aiFile callbacks -typedef size_t (*aiFileWriteProc) (C_STRUCT aiFile*, const char*, size_t, size_t); -typedef size_t (*aiFileReadProc) (C_STRUCT aiFile*, char*, size_t,size_t); -typedef size_t (*aiFileTellProc) (C_STRUCT aiFile*); -typedef void (*aiFileFlushProc) (C_STRUCT aiFile*); -typedef aiReturn (*aiFileSeek)(C_STRUCT aiFile*, size_t, aiOrigin); +typedef size_t (*aiFileWriteProc) (C_STRUCT aiFile*, const char*, size_t, size_t); +typedef size_t (*aiFileReadProc) (C_STRUCT aiFile*, char*, size_t,size_t); +typedef size_t (*aiFileTellProc) (C_STRUCT aiFile*); +typedef void (*aiFileFlushProc) (C_STRUCT aiFile*); +typedef C_ENUM aiReturn (*aiFileSeek) (C_STRUCT aiFile*, size_t, C_ENUM aiOrigin); // aiFileIO callbacks -typedef aiFile* (*aiFileOpenProc) (C_STRUCT aiFileIO*, const char*, const char*); -typedef void (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*); +typedef C_STRUCT aiFile* (*aiFileOpenProc) (C_STRUCT aiFileIO*, const char*, const char*); +typedef void (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*); // Represents user-defined data typedef char* aiUserData; diff --git a/src/3rdparty/assimp/include/assimp/cimport.h b/src/3rdparty/assimp/include/assimp/cimport.h index de0cbae30..8aa125c67 100644 --- a/src/3rdparty/assimp/include/assimp/cimport.h +++ b/src/3rdparty/assimp/include/assimp/cimport.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,9 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file cimport.h * @brief Defines the C-API to the Open Asset Import Library. */ +#pragma once #ifndef AI_ASSIMP_H_INC #define AI_ASSIMP_H_INC -#include "types.h" + +#include <assimp/types.h> #include "importerdesc.h" #ifdef __cplusplus @@ -334,7 +337,7 @@ ASSIMP_API void aiReleaseImport( * import process. NULL if there was no error. There can't be an error if you * got a non-NULL #aiScene from #aiImportFile/#aiImportFileEx/#aiApplyPostProcessing. */ -ASSIMP_API const char* aiGetErrorString(); +ASSIMP_API const char* aiGetErrorString(void); // -------------------------------------------------------------------------------- /** Returns whether a given file extension is supported by ASSIMP @@ -414,7 +417,7 @@ ASSIMP_API void aiSetImportPropertyInteger( ASSIMP_API void aiSetImportPropertyFloat( C_STRUCT aiPropertyStore* store, const char* szName, - float value); + ai_real value); // -------------------------------------------------------------------------------- /** Set a string property. diff --git a/src/3rdparty/assimp/include/assimp/color4.h b/src/3rdparty/assimp/include/assimp/color4.h index 6bcab45df..48e7aad30 100644 --- a/src/3rdparty/assimp/include/assimp/color4.h +++ b/src/3rdparty/assimp/include/assimp/color4.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -41,10 +42,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file color4.h * @brief RGBA color structure, including operators when compiling in C++ */ +#pragma once #ifndef AI_COLOR4D_H_INC #define AI_COLOR4D_H_INC -#include "./Compiler/pushpack1.h" +#include "defs.h" #ifdef __cplusplus @@ -87,18 +89,16 @@ public: // Red, green, blue and alpha color values TReal r, g, b, a; -} PACK_STRUCT; // !struct aiColor4D +}; // !struct aiColor4D -typedef aiColor4t<float> aiColor4D; +typedef aiColor4t<ai_real> aiColor4D; #else struct aiColor4D { - float r, g, b, a; -} PACK_STRUCT; + ai_real r, g, b, a; +}; #endif // __cplusplus -#include "./Compiler/poppack1.h" - #endif // AI_COLOR4D_H_INC diff --git a/src/3rdparty/assimp/include/assimp/color4.inl b/src/3rdparty/assimp/include/assimp/color4.inl index d69814714..b242c4e77 100644 --- a/src/3rdparty/assimp/include/assimp/color4.inl +++ b/src/3rdparty/assimp/include/assimp/color4.inl @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file color4.inl * @brief Inline implementation of aiColor4t<TReal> operators */ +#pragma once #ifndef AI_COLOR4D_INL_INC #define AI_COLOR4D_INL_INC @@ -75,12 +77,32 @@ AI_FORCE_INLINE const aiColor4t<TReal>& aiColor4t<TReal>::operator /= (TReal f) // ------------------------------------------------------------------------------------------------ template <typename TReal> AI_FORCE_INLINE TReal aiColor4t<TReal>::operator[](unsigned int i) const { - return *(&r + i); + switch ( i ) { + case 0: + return r; + case 1: + return g; + case 2: + return b; + default: + break; + } + return r; } // ------------------------------------------------------------------------------------------------ template <typename TReal> AI_FORCE_INLINE TReal& aiColor4t<TReal>::operator[](unsigned int i) { - return *(&r + i); + switch ( i ) { + case 0: + return r; + case 1: + return g; + case 2: + return b; + default: + break; + } + return r; } // ------------------------------------------------------------------------------------------------ template <typename TReal> diff --git a/src/3rdparty/assimp/include/assimp/config.h b/src/3rdparty/assimp/include/assimp/config.h index 3db8a5697..f881c56b4 100644 --- a/src/3rdparty/assimp/include/assimp/config.h +++ b/src/3rdparty/assimp/include/assimp/config.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team All rights reserved. @@ -55,8 +55,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * #aiSetImportPropertyFloat, * #aiSetImportPropertyString */ -#ifndef INCLUDED_AI_CONFIG_H -#define INCLUDED_AI_CONFIG_H +#ifndef AI_CONFIG_H_INC +#define AI_CONFIG_H_INC // ########################################################################### @@ -266,6 +266,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. "PP_FD_REMOVE" // --------------------------------------------------------------------------- +/** + * @brief Configures the #aiProcess_FindDegenerates to check the area of a + * trinagle to be greates than e-6. If this is not the case the triangle will + * be removed if #AI_CONFIG_PP_FD_REMOVE is set to true. + */ +#define AI_CONFIG_PP_FD_CHECKAREA \ + "PP_FD_CHECKAREA" + +// --------------------------------------------------------------------------- /** @brief Configures the #aiProcess_OptimizeGraph step to preserve nodes * matching a name in a given list. * @@ -322,7 +331,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @brief Set the maximum number of bones affecting a single vertex * * This is used by the #aiProcess_LimitBoneWeights PostProcess-Step. - * @note The default value is AI_LBW_MAX_WEIGHTS + * @note The default value is AI_LMW_MAX_WEIGHTS * Property type: integer.*/ #define AI_CONFIG_PP_LBW_MAX_WEIGHTS \ "PP_LBW_MAX_WEIGHTS" @@ -634,6 +643,15 @@ enum aiComponent // --------------------------------------------------------------------------- +/** @brief Set whether the fbx importer will search for embedded loaded textures, where no embedded texture data is provided. +* +* The default value is false (0) +* Property type: bool +*/ +#define AI_CONFIG_IMPORT_FBX_SEARCH_EMBEDDED_TEXTURES \ + "IMPORT_FBX_SEARCH_EMBEDDED_TEXTURES" + +// --------------------------------------------------------------------------- /** @brief Set the vertex animation keyframe to be imported * * ASSIMP does not support vertex keyframes (only bone animation is supported). @@ -843,14 +861,6 @@ enum aiComponent #define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME \ "IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME" -/** @brief Specifies whether the IFC loader skips over IfcSpace elements. - * - * IfcSpace elements (and their geometric representations) are used to - * represent, well, free space in a building storey.<br> - * Property type: Bool. Default value: true. - */ -#define AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS "IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS" - /** @brief Specifies whether the Android JNI asset extraction is supported. * * Turn on this option if you want to manage assets in native @@ -859,17 +869,14 @@ enum aiComponent */ #define AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT "AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT" - // --------------------------------------------------------------------------- -/** @brief Specifies whether the IFC loader skips over - * shape representations of type 'Curve2D'. +/** @brief Specifies whether the IFC loader skips over IfcSpace elements. * - * A lot of files contain both a faceted mesh representation and a outline - * with a presentation type of 'Curve2D'. Currently Assimp doesn't convert those, - * so turning this option off just clutters the log with errors.<br> + * IfcSpace elements (and their geometric representations) are used to + * represent, well, free space in a building storey.<br> * Property type: Bool. Default value: true. */ -#define AI_CONFIG_IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS "IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS" +#define AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS "IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS" // --------------------------------------------------------------------------- /** @brief Specifies whether the IFC loader will use its own, custom triangulation @@ -887,6 +894,38 @@ enum aiComponent #define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION" // --------------------------------------------------------------------------- +/** @brief Set the tessellation conic angle for IFC smoothing curves. + * + * This is used by the IFC importer to determine the tessellation parameter + * for smoothing curves. + * @note The default value is AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE and the + * accepted values are in range [5.0, 120.0]. + * Property type: Float. + */ +#define AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE "IMPORT_IFC_SMOOTHING_ANGLE" + +// default value for AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE +#if (!defined AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE) +# define AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE 10.0f +#endif + +// --------------------------------------------------------------------------- +/** @brief Set the tessellation for IFC cylindrical shapes. + * + * This is used by the IFC importer to determine the tessellation parameter + * for cylindrical shapes, i.e. the number of segments used to approximate a circle. + * @note The default value is AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION and the + * accepted values are in range [3, 180]. + * Property type: Integer. + */ +#define AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION "IMPORT_IFC_CYLINDRICAL_TESSELLATION" + +// default value for AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION +#if (!defined AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION) +# define AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION 32 +#endif + +// --------------------------------------------------------------------------- /** @brief Specifies whether the Collada loader will ignore the provided up direction. * * If this property is set to true, the up direction provided in the file header will @@ -904,4 +943,22 @@ enum aiComponent #define AI_CONFIG_EXPORT_XFILE_64BIT "EXPORT_XFILE_64BIT" +/** + * @brief Specifies a gobal key factor for scale, float value + */ +#define AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY "GLOBAL_SCALE_FACTOR" + +#if (!defined AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT) +# define AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT 1.0f +#endif // !! AI_DEBONE_THRESHOLD + +// ---------- All the Build/Compile-time defines ------------ + +/** @brief Specifies if double precision is supported inside assimp + * + * Property type: Bool. Default value: undefined. + */ + +//#cmakedefine ASSIMP_DOUBLE_PRECISION 1 + #endif // !! AI_CONFIG_H_INC diff --git a/src/3rdparty/assimp/include/assimp/defs.h b/src/3rdparty/assimp/include/assimp/defs.h index 2c9749357..20b234f90 100644 --- a/src/3rdparty/assimp/include/assimp/defs.h +++ b/src/3rdparty/assimp/include/assimp/defs.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -44,8 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * blocks to find out how to customize _your_ Assimp build. */ -#ifndef INCLUDED_AI_DEFINES_H -#define INCLUDED_AI_DEFINES_H +#pragma once +#ifndef AI_DEFINES_H_INC +#define AI_DEFINES_H_INC + +#include <assimp/config.h> ////////////////////////////////////////////////////////////////////////// /* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific @@ -209,7 +213,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__)) #error Currently, Borland is unsupported. Feel free to port Assimp. -// "W8059 Packgr��e der Struktur ge�ndert" +// "W8059 Packgröße der Struktur geändert" #endif @@ -228,6 +232,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif ////////////////////////////////////////////////////////////////////////// + /* Define ASSIMP_DOUBLE_PRECISION to compile assimp + * with double precision support (64-bit). */ + ////////////////////////////////////////////////////////////////////////// + +#ifdef ASSIMP_DOUBLE_PRECISION + typedef double ai_real; + typedef signed long long int ai_int; + typedef unsigned long long int ai_uint; +#else // ASSIMP_DOUBLE_PRECISION + typedef float ai_real; + typedef signed int ai_int; + typedef unsigned int ai_uint; +#endif // ASSIMP_DOUBLE_PRECISION + + ////////////////////////////////////////////////////////////////////////// /* Useful constants */ ////////////////////////////////////////////////////////////////////////// @@ -242,8 +261,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f) /* Tiny macro to convert from radians to degrees and back */ -#define AI_DEG_TO_RAD(x) ((x)*0.0174532925f) -#define AI_RAD_TO_DEG(x) ((x)*57.2957795f) +#define AI_DEG_TO_RAD(x) ((x)*(ai_real)0.0174532925) +#define AI_RAD_TO_DEG(x) ((x)*(ai_real)57.2957795) /* Support for big-endian builds */ #if defined(__BYTE_ORDER__) @@ -268,5 +287,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type)) - -#endif // !! INCLUDED_AI_DEFINES_H +#endif // !! AI_DEFINES_H_INC diff --git a/src/3rdparty/assimp/include/assimp/importerdesc.h b/src/3rdparty/assimp/include/assimp/importerdesc.h index b2b123aca..6b83b8aa2 100644 --- a/src/3rdparty/assimp/include/assimp/importerdesc.h +++ b/src/3rdparty/assimp/include/assimp/importerdesc.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file importerdesc.h * @brief #aiImporterFlags, aiImporterDesc implementation. */ -#ifndef INCLUDED_AI_IMPORTER_DESC_H -#define INCLUDED_AI_IMPORTER_DESC_H +#pragma once +#ifndef AI_IMPORTER_DESC_H_INC +#define AI_IMPORTER_DESC_H_INC /** Mixed set of flags for #aiImporterDesc, indicating some features @@ -140,4 +142,4 @@ Will return a NULL-pointer if no assigned importer desc. was found for the given */ ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension ); -#endif +#endif // AI_IMPORTER_DESC_H_INC diff --git a/src/3rdparty/assimp/include/assimp/light.h b/src/3rdparty/assimp/include/assimp/light.h index 939d5b6cd..324339a97 100644 --- a/src/3rdparty/assimp/include/assimp/light.h +++ b/src/3rdparty/assimp/include/assimp/light.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -43,8 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Defines the aiLight data structure */ -#ifndef __AI_LIGHT_H_INC__ -#define __AI_LIGHT_H_INC__ +#pragma once +#ifndef AI_LIGHT_H_INC +#define AI_LIGHT_H_INC #include "types.h" @@ -250,7 +252,7 @@ struct aiLight #ifdef __cplusplus } -#endif +#endif -#endif // !! __AI_LIGHT_H_INC__ +#endif // !! AI_LIGHT_H_INC diff --git a/src/3rdparty/assimp/include/assimp/material.h b/src/3rdparty/assimp/include/assimp/material.h index 87d27c569..a12e7d076 100644 --- a/src/3rdparty/assimp/include/assimp/material.h +++ b/src/3rdparty/assimp/include/assimp/material.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file material.h * @brief Defines the material system of the library */ - +#pragma once #ifndef AI_MATERIAL_H_INC #define AI_MATERIAL_H_INC @@ -413,7 +414,7 @@ enum aiTextureFlags * SourceColor * SourceBlend + DestColor * DestBlend * @endcode * where DestColor is the previous color in the framebuffer at this - * position and SourceColor is the material colro before the transparency + * position and SourceColor is the material color before the transparency * calculation.<br> * This corresponds to the #AI_MATKEY_BLEND_FUNC property. */ @@ -477,13 +478,14 @@ struct aiUVTransform * rotation center is 0.5f|0.5f. The default value * 0.f. */ - float mRotation; + ai_real mRotation; #ifdef __cplusplus aiUVTransform() - : mScaling (1.f,1.f) - , mRotation (0.f) + : mTranslation (0.0,0.0) + , mScaling (1.0,1.0) + , mRotation (0.0) { // nothing to be done here ... } @@ -508,6 +510,14 @@ enum aiPropertyTypeInfo */ aiPTI_Float = 0x1, + /** Array of double-precision (64 Bit) floats + * + * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API + * aiMaterial::Get()) to query properties stored in floating-point format. + * The material system performs the type conversion automatically. + */ + aiPTI_Double = 0x2, + /** The material property is an aiString. * * Arrays of strings aren't possible, aiGetMaterialString() (or the @@ -660,7 +670,7 @@ public: unsigned int idx, int* pOut, unsigned int* pMax) const; aiReturn Get(const char* pKey,unsigned int type, - unsigned int idx, float* pOut, unsigned int* pMax) const; + unsigned int idx, ai_real* pOut, unsigned int* pMax) const; // ------------------------------------------------------------------- /** @brief Retrieve a Type value with a specific key @@ -681,7 +691,7 @@ public: unsigned int idx, int& pOut) const; aiReturn Get(const char* pKey,unsigned int type, - unsigned int idx, float& pOut) const; + unsigned int idx, ai_real& pOut) const; aiReturn Get(const char* pKey,unsigned int type, unsigned int idx, aiString& pOut) const; @@ -705,37 +715,40 @@ public: // ------------------------------------------------------------------- /** Helper function to get all parameters pertaining to a * particular texture slot from a material. - * - * This function is provided just for convenience, you could also - * read the single material properties manually. - * @param type Specifies the type of the texture to be retrieved ( - * e.g. diffuse, specular, height map ...) - * @param index Index of the texture to be retrieved. The function fails - * if there is no texture of that type with this index. - * #GetTextureCount() can be used to determine the number of textures - * per texture type. - * @param path Receives the path to the texture. - * NULL is a valid value. - * @param mapping The texture mapping. - * NULL is allowed as value. - * @param uvindex Receives the UV index of the texture. - * NULL is a valid value. - * @param blend Receives the blend factor for the texture - * NULL is a valid value. - * @param op Receives the texture operation to be performed between - * this texture and the previous texture. NULL is allowed as value. - * @param mapmode Receives the mapping modes to be used for the texture. - * The parameter may be NULL but if it is a valid pointer it MUST - * point to an array of 3 aiTextureMapMode's (one for each - * axis: UVW order (=XYZ)). - */ + * + * This function is provided just for convenience, you could also + * read the single material properties manually. + * @param type Specifies the type of the texture to be retrieved ( + * e.g. diffuse, specular, height map ...) + * @param index Index of the texture to be retrieved. The function fails + * if there is no texture of that type with this index. + * #GetTextureCount() can be used to determine the number of textures + * per texture type. + * @param path Receives the path to the texture. + * If the texture is embedded, receives a '*' followed by the id of + * the texture (for the textures stored in the corresponding scene) which + * can be converted to an int using a function like atoi. + * NULL is a valid value. + * @param mapping The texture mapping. + * NULL is allowed as value. + * @param uvindex Receives the UV index of the texture. + * NULL is a valid value. + * @param blend Receives the blend factor for the texture + * NULL is a valid value. + * @param op Receives the texture operation to be performed between + * this texture and the previous texture. NULL is allowed as value. + * @param mapmode Receives the mapping modes to be used for the texture. + * The parameter may be NULL but if it is a valid pointer it MUST + * point to an array of 3 aiTextureMapMode's (one for each + * axis: UVW order (=XYZ)). + */ // ------------------------------------------------------------------- aiReturn GetTexture(aiTextureType type, unsigned int index, C_STRUCT aiString* path, aiTextureMapping* mapping = NULL, unsigned int* uvindex = NULL, - float* blend = NULL, + ai_real* blend = NULL, aiTextureOp* op = NULL, aiTextureMapMode* mapmode = NULL) const; @@ -817,6 +830,12 @@ public: unsigned int type = 0, unsigned int index = 0); + aiReturn AddProperty (const double* pInput, + unsigned int pNumValues, + const char* pKey, + unsigned int type = 0, + unsigned int index = 0); + aiReturn AddProperty (const aiUVTransform* pInput, unsigned int pNumValues, const char* pKey, @@ -1311,9 +1330,9 @@ extern "C" { * structure or NULL if the key has not been found. */ // --------------------------------------------------------------------------- ASSIMP_API C_ENUM aiReturn aiGetMaterialProperty( - const C_STRUCT aiMaterial* pMat, + const C_STRUCT aiMaterial* pMat, const char* pKey, - unsigned int type, + unsigned int type, unsigned int index, const C_STRUCT aiMaterialProperty** pPropOut); @@ -1348,7 +1367,7 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray( const char* pKey, unsigned int type, unsigned int index, - float* pOut, + ai_real* pOut, unsigned int* pMax); @@ -1377,7 +1396,7 @@ inline aiReturn aiGetMaterialFloat(const aiMaterial* pMat, const char* pKey, unsigned int type, unsigned int index, - float* pOut) + ai_real* pOut) { return aiGetMaterialFloatArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0); } @@ -1414,7 +1433,7 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial* inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial* pMat, const char* pKey, unsigned int type, - unsigned int index, + unsigned int index, int* pOut) { return aiGetMaterialIntegerArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0); @@ -1491,7 +1510,10 @@ ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMa * #aiGetMaterialTextureCount() can be used to determine the number of * textures in a particular texture stack. * @param[out] path Receives the output path - * This parameter must be non-null. + * If the texture is embedded, receives a '*' followed by the id of + * the texture (for the textures stored in the corresponding scene) which + * can be converted to an int using a function like atoi. + * This parameter must be non-null. * @param mapping The texture mapping mode to be used. * Pass NULL if you're not interested in this information. * @param[out] uvindex For UV-mapped textures: receives the index of the UV @@ -1516,7 +1538,7 @@ ASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat, aiString* path, aiTextureMapping* mapping = NULL, unsigned int* uvindex = NULL, - float* blend = NULL, + ai_real* blend = NULL, aiTextureOp* op = NULL, aiTextureMapMode* mapmode = NULL, unsigned int* flags = NULL); @@ -1527,7 +1549,7 @@ C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat, C_STRUCT aiString* path, C_ENUM aiTextureMapping* mapping /*= NULL*/, unsigned int* uvindex /*= NULL*/, - float* blend /*= NULL*/, + ai_real* blend /*= NULL*/, C_ENUM aiTextureOp* op /*= NULL*/, C_ENUM aiTextureMapMode* mapmode /*= NULL*/, unsigned int* flags /*= NULL*/); diff --git a/src/3rdparty/assimp/include/assimp/material.inl b/src/3rdparty/assimp/include/assimp/material.inl index 994e608b4..2c31fd571 100644 --- a/src/3rdparty/assimp/include/assimp/material.inl +++ b/src/3rdparty/assimp/include/assimp/material.inl @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -43,9 +44,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Defines the C++ getters for the material system */ +#pragma once #ifndef AI_MATERIAL_INL_INC #define AI_MATERIAL_INL_INC +// --------------------------------------------------------------------------- +inline aiPropertyTypeInfo ai_real_to_property_type_info(float) +{ + return aiPTI_Float; +} + +inline aiPropertyTypeInfo ai_real_to_property_type_info(double) +{ + return aiPTI_Double; +} +// --------------------------------------------------------------------------- + //! @cond never // --------------------------------------------------------------------------- @@ -54,7 +68,7 @@ inline aiReturn aiMaterial::GetTexture( aiTextureType type, C_STRUCT aiString* path, aiTextureMapping* mapping /*= NULL*/, unsigned int* uvindex /*= NULL*/, - float* blend /*= NULL*/, + ai_real* blend /*= NULL*/, aiTextureOp* op /*= NULL*/, aiTextureMapMode* mapmode /*= NULL*/) const { @@ -122,7 +136,7 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, // --------------------------------------------------------------------------- inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, - unsigned int idx,float* pOut, + unsigned int idx,ai_real* pOut, unsigned int* pMax) const { return ::aiGetMaterialFloatArray(this,pKey,type,idx,pOut,pMax); @@ -136,7 +150,7 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, } // --------------------------------------------------------------------------- inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type, - unsigned int idx,float& pOut) const + unsigned int idx,ai_real& pOut) const { return aiGetMaterialFloat(this,pKey,type,idx,&pOut); } @@ -201,6 +215,18 @@ inline aiReturn aiMaterial::AddProperty(const float* pInput, } // --------------------------------------------------------------------------- +inline aiReturn aiMaterial::AddProperty(const double* pInput, + const unsigned int pNumValues, + const char* pKey, + unsigned int type, + unsigned int index) +{ + return AddBinaryProperty((const void*)pInput, + pNumValues * sizeof(double), + pKey,type,index,aiPTI_Double); +} + +// --------------------------------------------------------------------------- inline aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, const unsigned int pNumValues, const char* pKey, @@ -209,7 +235,7 @@ inline aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, { return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(aiUVTransform), - pKey,type,index,aiPTI_Float); + pKey,type,index,ai_real_to_property_type_info(pInput->mRotation)); } // --------------------------------------------------------------------------- @@ -221,7 +247,7 @@ inline aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, { return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(aiColor4D), - pKey,type,index,aiPTI_Float); + pKey,type,index,ai_real_to_property_type_info(pInput->a)); } // --------------------------------------------------------------------------- @@ -233,7 +259,7 @@ inline aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, { return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(aiColor3D), - pKey,type,index,aiPTI_Float); + pKey,type,index,ai_real_to_property_type_info(pInput->b)); } // --------------------------------------------------------------------------- @@ -245,7 +271,7 @@ inline aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, { return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(aiVector3D), - pKey,type,index,aiPTI_Float); + pKey,type,index,ai_real_to_property_type_info(pInput->x)); } // --------------------------------------------------------------------------- @@ -282,6 +308,19 @@ inline aiReturn aiMaterial::AddProperty<float>(const float* pInput, // --------------------------------------------------------------------------- template<> +inline aiReturn aiMaterial::AddProperty<double>(const double* pInput, + const unsigned int pNumValues, + const char* pKey, + unsigned int type, + unsigned int index) +{ + return AddBinaryProperty((const void*)pInput, + pNumValues * sizeof(double), + pKey,type,index,aiPTI_Double); +} + +// --------------------------------------------------------------------------- +template<> inline aiReturn aiMaterial::AddProperty<aiUVTransform>(const aiUVTransform* pInput, const unsigned int pNumValues, const char* pKey, diff --git a/src/3rdparty/assimp/include/assimp/matrix3x3.h b/src/3rdparty/assimp/include/assimp/matrix3x3.h index 725b1c34c..3cf575e38 100644 --- a/src/3rdparty/assimp/include/assimp/matrix3x3.h +++ b/src/3rdparty/assimp/include/assimp/matrix3x3.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,10 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file matrix3x3.h * @brief Definition of a 3x3 matrix, including operators when compiling in C++ */ -#ifndef AI_MATRIX3x3_H_INC -#define AI_MATRIX3x3_H_INC +#pragma once +#ifndef AI_MATRIX3X3_H_INC +#define AI_MATRIX3X3_H_INC -#include "./Compiler/pushpack1.h" +#include "defs.h" #ifdef __cplusplus @@ -151,8 +153,8 @@ public: /** @brief A function for creating a rotation matrix that rotates a * vector called "from" into another vector called "to". * Input : from[3], to[3] which both must be *normalized* non-zero vectors - * Output: mtx[3][3] -- a 3x3 matrix in colum-major form - * Authors: Tomas M�ller, John Hughes + * Output: mtx[3][3] -- a 3x3 matrix in column-major form + * Authors: Tomas Möller, John Hughes * "Efficiently Building a Matrix to Rotate One Vector to Another" * Journal of Graphics Tools, 4(4):1-4, 1999 */ @@ -163,20 +165,18 @@ public: TReal a1, a2, a3; TReal b1, b2, b3; TReal c1, c2, c3; -} PACK_STRUCT; +}; -typedef aiMatrix3x3t<float> aiMatrix3x3; +typedef aiMatrix3x3t<ai_real> aiMatrix3x3; #else struct aiMatrix3x3 { - float a1, a2, a3; - float b1, b2, b3; - float c1, c2, c3; -} PACK_STRUCT; + ai_real a1, a2, a3; + ai_real b1, b2, b3; + ai_real c1, c2, c3; +}; #endif // __cplusplus -#include "./Compiler/poppack1.h" - -#endif // AI_MATRIX3x3_H_INC +#endif // AI_MATRIX3X3_H_INC diff --git a/src/3rdparty/assimp/include/assimp/matrix3x3.inl b/src/3rdparty/assimp/include/assimp/matrix3x3.inl index 9ace3f97b..14f2cd2fc 100644 --- a/src/3rdparty/assimp/include/assimp/matrix3x3.inl +++ b/src/3rdparty/assimp/include/assimp/matrix3x3.inl @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file matrix3x3.inl * @brief Inline implementation of the 3x3 matrix operators */ -#ifndef AI_MATRIX3x3_INL_INC -#define AI_MATRIX3x3_INL_INC +#pragma once +#ifndef AI_MATRIX3X3_INL_INC +#define AI_MATRIX3X3_INL_INC #ifdef __cplusplus #include "matrix3x3.h" @@ -100,16 +102,34 @@ inline aiMatrix3x3t<TReal> aiMatrix3x3t<TReal>::operator* (const aiMatrix3x3t<TR // ------------------------------------------------------------------------------------------------ template <typename TReal> -inline TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) -{ - return &this->a1 + p_iIndex * 3; +inline TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) { + switch ( p_iIndex ) { + case 0: + return &a1; + case 1: + return &b1; + case 2: + return &c1; + default: + break; + } + return &a1; } // ------------------------------------------------------------------------------------------------ template <typename TReal> -inline const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const -{ - return &this->a1 + p_iIndex * 3; +inline const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const { + switch ( p_iIndex ) { + case 0: + return &a1; + case 1: + return &b1; + case 2: + return &c1; + default: + break; + } + return &a1; } // ------------------------------------------------------------------------------------------------ @@ -241,7 +261,7 @@ inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::Translation( const aiVector2t<T * "from" into another vector called "to". * Input : from[3], to[3] which both must be *normalized* non-zero vectors * Output: mtx[3][3] -- a 3x3 matrix in colum-major form - * Authors: Tomas M�ller, John Hughes + * Authors: Tomas Möller, John Hughes * "Efficiently Building a Matrix to Rotate One Vector to Another" * Journal of Graphics Tools, 4(4):1-4, 1999 */ @@ -333,4 +353,4 @@ inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::FromToMatrix(const aiVector3t<T #endif // __cplusplus -#endif // AI_MATRIX3x3_INL_INC +#endif // AI_MATRIX3X3_INL_INC diff --git a/src/3rdparty/assimp/include/assimp/matrix4x4.h b/src/3rdparty/assimp/include/assimp/matrix4x4.h index fc77b6964..4311fa118 100644 --- a/src/3rdparty/assimp/include/assimp/matrix4x4.h +++ b/src/3rdparty/assimp/include/assimp/matrix4x4.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -41,11 +42,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file matrix4x4.h * @brief 4x4 matrix structure, including operators when compiling in C++ */ +#pragma once #ifndef AI_MATRIX4X4_H_INC #define AI_MATRIX4X4_H_INC #include "vector3.h" -#include "./Compiler/pushpack1.h" +#include "defs.h" #ifdef __cplusplus @@ -91,7 +93,15 @@ public: public: // array access operators + /** @fn TReal* operator[] (unsigned int p_iIndex) + * @param [in] p_iIndex - index of the row. + * @return pointer to pointed row. + */ TReal* operator[] (unsigned int p_iIndex); + + /** @fn const TReal* operator[] (unsigned int p_iIndex) const + * @overload TReal* operator[] (unsigned int p_iIndex) + */ const TReal* operator[] (unsigned int p_iIndex) const; // comparison operators @@ -103,6 +113,8 @@ public: // matrix multiplication. aiMatrix4x4t& operator *= (const aiMatrix4x4t& m); aiMatrix4x4t operator * (const aiMatrix4x4t& m) const; + aiMatrix4x4t operator * (const TReal& aFloat) const; + aiMatrix4x4t operator + (const aiMatrix4x4t& aMatrix) const; template <typename TOther> operator aiMatrix4x4t<TOther> () const; @@ -138,6 +150,27 @@ public: void Decompose (aiVector3t<TReal>& scaling, aiQuaterniont<TReal>& rotation, aiVector3t<TReal>& position) const; + // ------------------------------------------------------------------- + /** @fn void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotation, aiVector3t<TReal>& pPosition) const + * @brief Decompose a trafo matrix into its original components. + * Thx to good FAQ at http://www.gamedev.ru/code/articles/faq_matrix_quat + * @param [out] pScaling - Receives the output scaling for the x,y,z axes. + * @param [out] pRotation - Receives the output rotation as a Euler angles. + * @param [out] pPosition - Receives the output position for the x,y,z axes. + */ + void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotation, aiVector3t<TReal>& pPosition) const; + + // ------------------------------------------------------------------- + /** @fn void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotationAxis, TReal& pRotationAngle, aiVector3t<TReal>& pPosition) const + * @brief Decompose a trafo matrix into its original components + * Thx to good FAQ at http://www.gamedev.ru/code/articles/faq_matrix_quat + * @param [out] pScaling - Receives the output scaling for the x,y,z axes. + * @param [out] pRotationAxis - Receives the output rotation axis. + * @param [out] pRotationAngle - Receives the output rotation angle for @ref pRotationAxis. + * @param [out] pPosition - Receives the output position for the x,y,z axes. + */ + void Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotationAxis, TReal& pRotationAngle, aiVector3t<TReal>& pPosition) const; + // ------------------------------------------------------------------- /** @brief Decompose a trafo matrix with no scaling into its * original components @@ -191,7 +224,7 @@ public: * @return Reference to the output matrix */ static aiMatrix4x4t& Rotation(TReal a, const aiVector3t<TReal>& axis, - aiMatrix4x4t& out); + aiMatrix4x4t& out); // ------------------------------------------------------------------- /** @brief Returns a translation matrix @@ -199,7 +232,8 @@ public: * @param out Receives the output matrix * @return Reference to the output matrix */ - static aiMatrix4x4t& Translation( const aiVector3t<TReal>& v, aiMatrix4x4t& out); + static aiMatrix4x4t& Translation( const aiVector3t<TReal>& v, + aiMatrix4x4t& out); // ------------------------------------------------------------------- /** @brief Returns a scaling matrix @@ -219,29 +253,27 @@ public: * Journal of Graphics Tools, 4(4):1-4, 1999 */ static aiMatrix4x4t& FromToMatrix(const aiVector3t<TReal>& from, - const aiVector3t<TReal>& to, aiMatrix4x4t& out); + const aiVector3t<TReal>& to, aiMatrix4x4t& out); public: TReal a1, a2, a3, a4; TReal b1, b2, b3, b4; TReal c1, c2, c3, c4; TReal d1, d2, d3, d4; -} PACK_STRUCT; +}; -typedef aiMatrix4x4t<float> aiMatrix4x4; +typedef aiMatrix4x4t<ai_real> aiMatrix4x4; #else struct aiMatrix4x4 { - float a1, a2, a3, a4; - float b1, b2, b3, b4; - float c1, c2, c3, c4; - float d1, d2, d3, d4; -} PACK_STRUCT; + ai_real a1, a2, a3, a4; + ai_real b1, b2, b3, b4; + ai_real c1, c2, c3, c4; + ai_real d1, d2, d3, d4; +}; #endif // __cplusplus -#include "./Compiler/poppack1.h" - #endif // AI_MATRIX4X4_H_INC diff --git a/src/3rdparty/assimp/include/assimp/matrix4x4.inl b/src/3rdparty/assimp/include/assimp/matrix4x4.inl index 9ce794f0a..b15d50a09 100644 --- a/src/3rdparty/assimp/include/assimp/matrix4x4.inl +++ b/src/3rdparty/assimp/include/assimp/matrix4x4.inl @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file matrix4x4.inl * @brief Inline implementation of the 4x4 matrix operators */ -#ifndef AI_MATRIX4x4_INL_INC -#define AI_MATRIX4x4_INL_INC +#pragma once +#ifndef AI_MATRIX4X4_INL_INC +#define AI_MATRIX4X4_INL_INC #ifdef __cplusplus @@ -156,6 +158,54 @@ inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::operator *= (const aiMatrix4x4t // ---------------------------------------------------------------------------------------- template <typename TReal> +inline aiMatrix4x4t<TReal> aiMatrix4x4t<TReal>::operator* (const TReal& aFloat) const +{ + aiMatrix4x4t<TReal> temp( + a1 * aFloat, + a2 * aFloat, + a3 * aFloat, + a4 * aFloat, + b1 * aFloat, + b2 * aFloat, + b3 * aFloat, + b4 * aFloat, + c1 * aFloat, + c2 * aFloat, + c3 * aFloat, + c4 * aFloat, + d1 * aFloat, + d2 * aFloat, + d3 * aFloat, + d4 * aFloat); + return temp; +} + +// ---------------------------------------------------------------------------------------- +template <typename TReal> +inline aiMatrix4x4t<TReal> aiMatrix4x4t<TReal>::operator+ (const aiMatrix4x4t<TReal>& m) const +{ + aiMatrix4x4t<TReal> temp( + m.a1 + a1, + m.a2 + a2, + m.a3 + a3, + m.a4 + a4, + m.b1 + b1, + m.b2 + b2, + m.b3 + b3, + m.b4 + b4, + m.c1 + c1, + m.c2 + c2, + m.c3 + c3, + m.c4 + c4, + m.d1 + d1, + m.d2 + d2, + m.d3 + d3, + m.d4 + d4); + return temp; +} + +// ---------------------------------------------------------------------------------------- +template <typename TReal> inline aiMatrix4x4t<TReal> aiMatrix4x4t<TReal>::operator* (const aiMatrix4x4t<TReal>& m) const { aiMatrix4x4t<TReal> temp( *this); @@ -242,9 +292,19 @@ inline TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) { if (p_iIndex > 3) { return NULL; } - - // XXX this is UB. Has been for years. The fact that it works now does not make it better. - return &this->a1 + p_iIndex * 4; + switch ( p_iIndex ) { + case 0: + return &a1; + case 1: + return &b1; + case 2: + return &c1; + case 3: + return &d1; + default: + break; + } + return &a1; } // ---------------------------------------------------------------------------------------- @@ -254,8 +314,19 @@ inline const TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) const return NULL; } - // XXX same - return &this->a1 + p_iIndex * 4; + switch ( p_iIndex ) { + case 0: + return &a1; + case 1: + return &b1; + case 2: + return &c1; + case 3: + return &d1; + default: + break; + } + return &a1; } // ---------------------------------------------------------------------------------------- @@ -298,57 +369,126 @@ inline bool aiMatrix4x4t<TReal>::Equal(const aiMatrix4x4t<TReal>& m, TReal epsil } // ---------------------------------------------------------------------------------------- -template <typename TReal> -inline void aiMatrix4x4t<TReal>::Decompose (aiVector3t<TReal>& scaling, aiQuaterniont<TReal>& rotation, - aiVector3t<TReal>& position) const -{ - const aiMatrix4x4t<TReal>& _this = *this; - // extract translation - position.x = _this[0][3]; - position.y = _this[1][3]; - position.z = _this[2][3]; +#define ASSIMP_MATRIX4_4_DECOMPOSE_PART \ + const aiMatrix4x4t<TReal>& _this = *this;/* Create alias for conveniance. */ \ + \ + /* extract translation */ \ + pPosition.x = _this[0][3]; \ + pPosition.y = _this[1][3]; \ + pPosition.z = _this[2][3]; \ + \ + /* extract the columns of the matrix. */ \ + aiVector3t<TReal> vCols[3] = { \ + aiVector3t<TReal>(_this[0][0],_this[1][0],_this[2][0]), \ + aiVector3t<TReal>(_this[0][1],_this[1][1],_this[2][1]), \ + aiVector3t<TReal>(_this[0][2],_this[1][2],_this[2][2]) \ + }; \ + \ + /* extract the scaling factors */ \ + pScaling.x = vCols[0].Length(); \ + pScaling.y = vCols[1].Length(); \ + pScaling.z = vCols[2].Length(); \ + \ + /* and the sign of the scaling */ \ + if (Determinant() < 0) pScaling = -pScaling; \ + \ + /* and remove all scaling from the matrix */ \ + if(pScaling.x) vCols[0] /= pScaling.x; \ + if(pScaling.y) vCols[1] /= pScaling.y; \ + if(pScaling.z) vCols[2] /= pScaling.z; \ + \ + do {} while(false) + - // extract the rows of the matrix - aiVector3t<TReal> vRows[3] = { - aiVector3t<TReal>(_this[0][0],_this[1][0],_this[2][0]), - aiVector3t<TReal>(_this[0][1],_this[1][1],_this[2][1]), - aiVector3t<TReal>(_this[0][2],_this[1][2],_this[2][2]) - }; - - // extract the scaling factors - scaling.x = vRows[0].Length(); - scaling.y = vRows[1].Length(); - scaling.z = vRows[2].Length(); - - // and the sign of the scaling - if (Determinant() < 0) { - scaling.x = -scaling.x; - scaling.y = -scaling.y; - scaling.z = -scaling.z; - } - // and remove all scaling from the matrix - if(scaling.x) - { - vRows[0] /= scaling.x; - } - if(scaling.y) - { - vRows[1] /= scaling.y; - } - if(scaling.z) - { - vRows[2] /= scaling.z; - } + +template <typename TReal> +inline void aiMatrix4x4t<TReal>::Decompose (aiVector3t<TReal>& pScaling, aiQuaterniont<TReal>& pRotation, + aiVector3t<TReal>& pPosition) const +{ + ASSIMP_MATRIX4_4_DECOMPOSE_PART; // build a 3x3 rotation matrix - aiMatrix3x3t<TReal> m(vRows[0].x,vRows[1].x,vRows[2].x, - vRows[0].y,vRows[1].y,vRows[2].y, - vRows[0].z,vRows[1].z,vRows[2].z); + aiMatrix3x3t<TReal> m(vCols[0].x,vCols[1].x,vCols[2].x, + vCols[0].y,vCols[1].y,vCols[2].y, + vCols[0].z,vCols[1].z,vCols[2].z); // and generate the rotation quaternion from it - rotation = aiQuaterniont<TReal>(m); + pRotation = aiQuaterniont<TReal>(m); +} + +template <typename TReal> +inline void aiMatrix4x4t<TReal>::Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotation, aiVector3t<TReal>& pPosition) const +{ + ASSIMP_MATRIX4_4_DECOMPOSE_PART; + + /* + | CE -CF D 0 | + M = | BDE+AF -BDF+AE -BC 0 | + | -ADE+BF -ADF+BE AC 0 | + | 0 0 0 1 | + + A = cos(angle_x), B = sin(angle_x); + C = cos(angle_y), D = sin(angle_y); + E = cos(angle_z), F = sin(angle_z); + */ + + // Use a small epsilon to solve floating-point inaccuracies + const TReal epsilon = 10e-3f; + + pRotation.y = std::asin(vCols[2].x);// D. Angle around oY. + + TReal C = std::cos(pRotation.y); + + if(std::fabs(C) > epsilon) + { + // Finding angle around oX. + TReal tan_x = vCols[2].z / C;// A + TReal tan_y = -vCols[2].y / C;// B + + pRotation.x = std::atan2(tan_y, tan_x); + // Finding angle around oZ. + tan_x = vCols[0].x / C;// E + tan_y = -vCols[1].x / C;// F + pRotation.z = std::atan2(tan_y, tan_x); + } + else + {// oY is fixed. + pRotation.x = 0;// Set angle around oX to 0. => A == 1, B == 0, C == 0, D == 1. + + // And finding angle around oZ. + TReal tan_x = vCols[1].y;// -BDF+AE => E + TReal tan_y = vCols[0].y;// BDE+AF => F + + pRotation.z = std::atan2(tan_y, tan_x); + } +} + +#undef ASSIMP_MATRIX4_4_DECOMPOSE_PART + +template <typename TReal> +inline void aiMatrix4x4t<TReal>::Decompose(aiVector3t<TReal>& pScaling, aiVector3t<TReal>& pRotationAxis, TReal& pRotationAngle, + aiVector3t<TReal>& pPosition) const +{ +aiQuaterniont<TReal> pRotation; + + Decompose(pScaling, pRotation, pPosition); + pRotation.Normalize(); + + TReal angle_cos = pRotation.w; + TReal angle_sin = std::sqrt(1.0f - angle_cos * angle_cos); + + pRotationAngle = std::acos(angle_cos) * 2; + + // Use a small epsilon to solve floating-point inaccuracies + const TReal epsilon = 10e-3f; + + if(std::fabs(angle_sin) < epsilon) angle_sin = 1; + + pRotationAxis.x = pRotation.x / angle_sin; + pRotationAxis.y = pRotation.y / angle_sin; + pRotationAxis.z = pRotation.z / angle_sin; } // ---------------------------------------------------------------------------------------- @@ -522,7 +662,7 @@ inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Scaling( const aiVector3t<TReal * "from" into another vector called "to". * Input : from[3], to[3] which both must be *normalized* non-zero vectors * Output: mtx[3][3] -- a 3x3 matrix in colum-major form - * Authors: Tomas M�ller, John Hughes + * Authors: Tomas Möller, John Hughes * "Efficiently Building a Matrix to Rotate One Vector to Another" * Journal of Graphics Tools, 4(4):1-4, 1999 */ @@ -538,4 +678,4 @@ inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::FromToMatrix(const aiVector3t<T } #endif // __cplusplus -#endif // AI_MATRIX4x4_INL_INC +#endif // AI_MATRIX4X4_INL_INC diff --git a/src/3rdparty/assimp/include/assimp/mesh.h b/src/3rdparty/assimp/include/assimp/mesh.h index 5fd30bb02..c8648c778 100644 --- a/src/3rdparty/assimp/include/assimp/mesh.h +++ b/src/3rdparty/assimp/include/assimp/mesh.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team All rights reserved. @@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Declares the data structures in which the imported geometry is returned by ASSIMP: aiMesh, aiFace and aiBone data structures. */ -#ifndef INCLUDED_AI_MESH_H -#define INCLUDED_AI_MESH_H +#pragma once +#ifndef AI_MESH_H_INC +#define AI_MESH_H_INC #include "types.h" @@ -54,7 +55,7 @@ extern "C" { // --------------------------------------------------------------------------- // Limits. These values are required to match the settings Assimp was -// compiled against. Therfore, do not redefine them unless you build the +// compiled against. Therefore, do not redefine them unless you build the // library from source using the same definitions. // --------------------------------------------------------------------------- @@ -376,8 +377,10 @@ struct aiAnimMesh * from language bindings. */ unsigned int mNumVertices; - - /** Weight of the AnimMesh. */ + + /** + * Weight of the AnimMesh. + */ float mWeight; #ifdef __cplusplus @@ -388,6 +391,7 @@ struct aiAnimMesh , mTangents( NULL ) , mBitangents( NULL ) , mNumVertices( 0 ) + , mWeight( 0.0f ) { // fixme consider moving this to the ctor initializer list as well for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++){ @@ -623,17 +627,20 @@ struct aiMesh C_STRUCT aiString mName; - /** NOT CURRENTLY IN USE. The number of attachment meshes */ + /** The number of attachment meshes. Note! Currently only works with Collada loader. */ unsigned int mNumAnimMeshes; - /** NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation. + /** Attachment meshes for this mesh, for vertex-based animation. * Attachment meshes carry replacement data for some of the - * mesh'es vertex components (usually positions, normals). */ + * mesh'es vertex components (usually positions, normals). + * Note! Currently only works with Collada loader.*/ C_STRUCT aiAnimMesh** mAnimMeshes; - /** Method of morphing when animeshes are specified. */ + /** + * Method of morphing when animeshes are specified. + */ unsigned int mMethod; - + #ifdef __cplusplus //! Default constructor. Initializes all members to 0 @@ -651,6 +658,7 @@ struct aiMesh , mMaterialIndex( 0 ) , mNumAnimMeshes( 0 ) , mAnimMeshes( NULL ) + , mMethod( 0 ) { for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) { @@ -761,5 +769,5 @@ struct aiMesh #ifdef __cplusplus } #endif //! extern "C" -#endif // __AI_MESH_H_INC +#endif // AI_MESH_H_INC diff --git a/src/3rdparty/assimp/include/assimp/metadata.h b/src/3rdparty/assimp/include/assimp/metadata.h index 579ccd446..92db9b59a 100644 --- a/src/3rdparty/assimp/include/assimp/metadata.h +++ b/src/3rdparty/assimp/include/assimp/metadata.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,41 +43,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file metadata.h * @brief Defines the data structures for holding node meta information. */ -#ifndef __AI_METADATA_H_INC__ -#define __AI_METADATA_H_INC__ - -#include <assert.h> +#pragma once +#ifndef AI_METADATA_H_INC +#define AI_METADATA_H_INC #if defined(_MSC_VER) && (_MSC_VER <= 1500) -#include "Compiler/pstdint.h" +# include "Compiler/pstdint.h" #else -#include <limits.h> -#include <stdint.h> +# include <stdint.h> #endif - - // ------------------------------------------------------------------------------- /** * Enum used to distinguish data types */ // ------------------------------------------------------------------------------- -typedef enum aiMetadataType -{ - AI_BOOL = 0, - AI_INT = 1, - AI_UINT64 = 2, - AI_FLOAT = 3, - AI_AISTRING = 4, - AI_AIVECTOR3D = 5, +typedef enum aiMetadataType { + AI_BOOL = 0, + AI_INT32 = 1, + AI_UINT64 = 2, + AI_FLOAT = 3, + AI_DOUBLE = 4, + AI_AISTRING = 5, + AI_AIVECTOR3D = 6, #ifndef SWIG FORCE_32BIT = INT_MAX #endif } aiMetadataType; - - // ------------------------------------------------------------------------------- /** * Metadata entry @@ -84,37 +79,30 @@ typedef enum aiMetadataType * The type field uniquely identifies the underlying type of the data field */ // ------------------------------------------------------------------------------- -struct aiMetadataEntry -{ +struct aiMetadataEntry { aiMetadataType mType; void* mData; }; - - #ifdef __cplusplus #include <string> - - // ------------------------------------------------------------------------------- /** * Helper functions to get the aiType enum entry for a type */ // ------------------------------------------------------------------------------- -inline aiMetadataType GetAiType( bool ) { return AI_BOOL; } -inline aiMetadataType GetAiType( int ) { return AI_INT; } -inline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; } -inline aiMetadataType GetAiType( float ) { return AI_FLOAT; } -inline aiMetadataType GetAiType( const aiString & ) { return AI_AISTRING; } -inline aiMetadataType GetAiType( const aiVector3D & ) { return AI_AIVECTOR3D; } - - - -#endif +inline aiMetadataType GetAiType( bool ) { return AI_BOOL; } +inline aiMetadataType GetAiType( int32_t ) { return AI_INT32; } +inline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; } +inline aiMetadataType GetAiType( float ) { return AI_FLOAT; } +inline aiMetadataType GetAiType( double ) { return AI_DOUBLE; } +inline aiMetadataType GetAiType( const aiString & ) { return AI_AISTRING; } +inline aiMetadataType GetAiType( const aiVector3D & ) { return AI_AIVECTOR3D; } +#endif // __cplusplus // ------------------------------------------------------------------------------- /** @@ -123,8 +111,7 @@ inline aiMetadataType GetAiType( const aiVector3D & ) { return AI_AIVECTOR3D; } * Metadata is a key-value store using string keys and values. */ // ------------------------------------------------------------------------------- -struct aiMetadata -{ +struct aiMetadata { /** Length of the mKeys and mValues arrays, respectively */ unsigned int mNumProperties; @@ -137,33 +124,32 @@ struct aiMetadata #ifdef __cplusplus - /** Constructor */ + /** + * @brief The default constructor, set all members to zero by default. + */ aiMetadata() - // set all members to zero by default - : mNumProperties(0) - , mKeys(NULL) - , mValues(NULL) - {} - + : mNumProperties(0) + , mKeys(NULL) + , mValues(NULL) { + // empty + } - /** Destructor */ - ~aiMetadata() - { - delete[] mKeys; + /** + * @brief The destructor. + */ + ~aiMetadata() { + delete [] mKeys; mKeys = NULL; - if (mValues) - { + if (mValues) { // Delete each metadata entry - for (unsigned i=0; i<mNumProperties; ++i) - { + for (unsigned i=0; i<mNumProperties; ++i) { void* data = mValues[i].mData; - switch (mValues[i].mType) - { + switch (mValues[i].mType) { case AI_BOOL: delete static_cast<bool*>(data); break; - case AI_INT: - delete static_cast<int*>(data); + case AI_INT32: + delete static_cast<int32_t*>(data); break; case AI_UINT64: delete static_cast<uint64_t*>(data); @@ -171,6 +157,9 @@ struct aiMetadata case AI_FLOAT: delete static_cast<float*>(data); break; + case AI_DOUBLE: + delete static_cast<double*>(data); + break; case AI_AISTRING: delete static_cast<aiString*>(data); break; @@ -181,7 +170,6 @@ struct aiMetadata case FORCE_32BIT: #endif default: - assert(false); break; } } @@ -192,13 +180,67 @@ struct aiMetadata } } + /** + * @brief Allocates property fields + keys. + * @param numProperties Number of requested properties. + */ + static inline + aiMetadata *Alloc( unsigned int numProperties ) { + if ( 0 == numProperties ) { + return nullptr; + } + + aiMetadata *data = new aiMetadata; + data->mNumProperties = numProperties; + data->mKeys = new aiString[ data->mNumProperties ](); + data->mValues = new aiMetadataEntry[ data->mNumProperties ](); + + return data; + } + + /** + * @brief Deallocates property fields + keys. + */ + static inline + void Dealloc( aiMetadata *metadata ) { + delete metadata; + } + + template<typename T> + inline void Add(const std::string& key, const T& value) + { + aiString* new_keys = new aiString[mNumProperties + 1]; + aiMetadataEntry* new_values = new aiMetadataEntry[mNumProperties + 1]; + + for(unsigned int i = 0; i < mNumProperties; ++i) + { + new_keys[i] = mKeys[i]; + new_values[i] = mValues[i]; + } + + delete mKeys; + delete mValues; + mKeys = new_keys; + mValues = new_values; + + mNumProperties++; + + Set(mNumProperties - 1, key, value); + } template<typename T> - inline void Set( unsigned index, const std::string& key, const T& value ) - { + inline + bool Set( unsigned index, const std::string& key, const T& value ) { // In range assertion - assert(index < mNumProperties); + if ( index >= mNumProperties ) { + return false; + } + + // Ensure that we have a valid key. + if ( key.empty() ) { + return false; + } // Set metadata key mKeys[index] = key; @@ -207,13 +249,17 @@ struct aiMetadata mValues[index].mType = GetAiType(value); // Copy the given value to the dynamic storage mValues[index].mData = new T(value); + + return true; } template<typename T> - inline bool Get( unsigned index, T& value ) - { + inline + bool Get( unsigned index, T& value ) { // In range assertion - assert(index < mNumProperties); + if ( index >= mNumProperties ) { + return false; + } // Return false if the output data type does // not match the found value's data type @@ -224,16 +270,19 @@ struct aiMetadata // Otherwise, output the found value and // return true value = *static_cast<T*>(mValues[index].mData); + return true; } template<typename T> - inline bool Get( const aiString& key, T& value ) - { + inline + bool Get( const aiString& key, T& value ) { // Search for the given key - for (unsigned i=0; i<mNumProperties; ++i) - if (mKeys[i]==key) - return Get(i, value); + for ( unsigned int i = 0; i < mNumProperties; ++i ) { + if ( mKeys[ i ] == key ) { + return Get( i, value ); + } + } return false; } @@ -242,10 +291,24 @@ struct aiMetadata return Get(aiString(key), value); } -#endif // __cplusplus + /// Return metadata entry for analyzing it by user. + /// \param [in] pIndex - index of the entry. + /// \param [out] pKey - pointer to the key value. + /// \param [out] pEntry - pointer to the entry: type and value. + /// \return false - if pIndex is out of range, else - true. + inline bool Get(size_t index, const aiString*& key, const aiMetadataEntry*& entry) { + if ( index >= mNumProperties ) { + return false; + } -}; + key = &mKeys[index]; + entry = &mValues[index]; -#endif // __AI_METADATA_H_INC__ + return true; + } +#endif // __cplusplus + +}; +#endif // AI_METADATA_H_INC diff --git a/src/3rdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h b/src/3rdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h index 6f806f922..41d800487 100644 --- a/src/3rdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h +++ b/src/3rdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_ANDROIDJNIIOSYSTEM_H_INC #define AI_ANDROIDJNIIOSYSTEM_H_INC -#include "../code/DefaultIOSystem.h" +#include <assimp/DefaultIOSystem.h> #include <android/asset_manager.h> #include <android/asset_manager_jni.h> #include <android/native_activity.h> diff --git a/src/3rdparty/assimp/include/assimp/postprocess.h b/src/3rdparty/assimp/include/assimp/postprocess.h index 04de7a275..970df8e8a 100644 --- a/src/3rdparty/assimp/include/assimp/postprocess.h +++ b/src/3rdparty/assimp/include/assimp/postprocess.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -41,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file postprocess.h * @brief Definitions for import post processing steps */ +#pragma once #ifndef AI_POSTPROCESS_H_INC #define AI_POSTPROCESS_H_INC @@ -523,7 +525,17 @@ enum aiPostProcessSteps * Use <tt>#AI_CONFIG_PP_DB_ALL_OR_NONE</tt> if you want bones removed if and * only if all bones within the scene qualify for removal. */ - aiProcess_Debone = 0x4000000 + aiProcess_Debone = 0x4000000, + + // ------------------------------------------------------------------------- + /** <hr>This step will perform a global scale of the model. + * + * Some importers are providing a mechanism to define a scaling unit for the + * model. This post processing step can be used to do so. + * + * Use <tt>#AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY</tt> to control this. + */ + aiProcess_GlobalScale = 0x8000000 // aiProcess_GenEntityMeshes = 0x100000, // aiProcess_OptimizeAnimations = 0x200000 diff --git a/src/3rdparty/assimp/include/assimp/quaternion.h b/src/3rdparty/assimp/include/assimp/quaternion.h index fe213f71e..a5cb67a9a 100644 --- a/src/3rdparty/assimp/include/assimp/quaternion.h +++ b/src/3rdparty/assimp/include/assimp/quaternion.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -41,11 +42,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file quaternion.h * @brief Quaternion structure, including operators when compiling in C++ */ +#pragma once #ifndef AI_QUATERNION_H_INC #define AI_QUATERNION_H_INC #ifdef __cplusplus +#include "defs.h" + template <typename TReal> class aiVector3t; template <typename TReal> class aiMatrix3x3t; @@ -112,15 +116,14 @@ public: TReal w, x, y, z; } ; -typedef aiQuaterniont<float> aiQuaternion; +typedef aiQuaterniont<ai_real> aiQuaternion; #else struct aiQuaternion { - float w, x, y, z; + ai_real w, x, y, z; }; #endif - #endif // AI_QUATERNION_H_INC diff --git a/src/3rdparty/assimp/include/assimp/quaternion.inl b/src/3rdparty/assimp/include/assimp/quaternion.inl index db27c25ff..d0bf5831c 100644 --- a/src/3rdparty/assimp/include/assimp/quaternion.inl +++ b/src/3rdparty/assimp/include/assimp/quaternion.inl @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file quaternion.inl * @brief Inline implementation of aiQuaterniont<TReal> operators */ +#pragma once #ifndef AI_QUATERNION_INL_INC #define AI_QUATERNION_INL_INC @@ -280,4 +282,4 @@ inline aiVector3t<TReal> aiQuaterniont<TReal>::Rotate (const aiVector3t<TReal>& } #endif -#endif +#endif // AI_QUATERNION_INL_INC diff --git a/src/3rdparty/assimp/include/assimp/scene.h b/src/3rdparty/assimp/include/assimp/scene.h index 8987ac6a3..342c316d6 100644 --- a/src/3rdparty/assimp/include/assimp/scene.h +++ b/src/3rdparty/assimp/include/assimp/scene.h @@ -1,9 +1,10 @@ -/* +/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file scene.h * @brief Defines the data structures in which the imported scene is returned. */ -#ifndef __AI_SCENE_H_INC__ -#define __AI_SCENE_H_INC__ +#pragma once +#ifndef AI_SCENE_H_INC +#define AI_SCENE_H_INC #include "types.h" #include "texture.h" @@ -58,9 +60,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. extern "C" { #endif +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" +#endif // ------------------------------------------------------------------------------- -/** A node in the imported hierarchy. +/** + * A node in the imported hierarchy. * * Each node has name, a parent node (except for the root node), * a transformation relative to its parent and possibly several child nodes. @@ -68,7 +75,7 @@ extern "C" { * the imported scene does consist of only a single root node without children. */ // ------------------------------------------------------------------------------- -struct aiNode +struct ASSIMP_API aiNode { /** The name of the node. * @@ -109,7 +116,7 @@ struct aiNode /** The number of meshes of this node. */ unsigned int mNumMeshes; - /** The meshes of this node. Each entry is an index into the + /** The meshes of this node. Each entry is an index into the * mesh list of the #aiScene. */ unsigned int* mMeshes; @@ -123,47 +130,13 @@ struct aiNode #ifdef __cplusplus /** Constructor */ - aiNode() - // set all members to zero by default - : mName("") - , mParent(NULL) - , mNumChildren(0) - , mChildren(NULL) - , mNumMeshes(0) - , mMeshes(NULL) - , mMetaData(NULL) - { - } - + aiNode(); /** Construction from a specific name */ - explicit aiNode(const std::string& name) - // set all members to zero by default - : mName(name) - , mParent(NULL) - , mNumChildren(0) - , mChildren(NULL) - , mNumMeshes(0) - , mMeshes(NULL) - , mMetaData(NULL) - { - } + explicit aiNode(const std::string& name); /** Destructor */ - ~aiNode() - { - // delete all children recursively - // to make sure we won't crash if the data is invalid ... - if (mChildren && mNumChildren) - { - for( unsigned int a = 0; a < mNumChildren; a++) - delete mChildren[a]; - } - delete [] mChildren; - delete [] mMeshes; - delete mMetaData; - } - + ~aiNode(); /** Searches for a node with a specific name, beginning at this * nodes. Normally you will call this method on the root node @@ -172,49 +145,32 @@ struct aiNode * @param name Name to search for * @return NULL or a valid Node if the search was successful. */ - inline const aiNode* FindNode(const aiString& name) const - { + inline + const aiNode* FindNode(const aiString& name) const { return FindNode(name.data); } - - inline aiNode* FindNode(const aiString& name) - { + inline + aiNode* FindNode(const aiString& name) { return FindNode(name.data); } + const aiNode* FindNode(const char* name) const; - inline const aiNode* FindNode(const char* name) const - { - if (!::strcmp( mName.data,name))return this; - for (unsigned int i = 0; i < mNumChildren;++i) - { - const aiNode* const p = mChildren[i]->FindNode(name); - if (p) { - return p; - } - } - // there is definitely no sub-node with this name - return NULL; - } - - inline aiNode* FindNode(const char* name) - { - if (!::strcmp( mName.data,name))return this; - for (unsigned int i = 0; i < mNumChildren;++i) - { - aiNode* const p = mChildren[i]->FindNode(name); - if (p) { - return p; - } - } - // there is definitely no sub-node with this name - return NULL; - } + aiNode* FindNode(const char* name); + /** + * @brief Will add new children. + * @param numChildren Number of children to add. + * @param children The array with pointers showing to the children. + */ + void addChildren(unsigned int numChildren, aiNode **children); #endif // __cplusplus }; +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // ------------------------------------------------------------------------------- /** @@ -264,6 +220,13 @@ struct aiNode */ #define AI_SCENE_FLAGS_TERRAIN 0x10 + /** + * Specifies that the scene data can be shared between structures. For example: + * one vertex in few faces. \ref AI_SCENE_FLAGS_NON_VERBOSE_FORMAT can not be + * used for this because \ref AI_SCENE_FLAGS_NON_VERBOSE_FORMAT has internal + * meaning about postprocessing steps. + */ +#define AI_SCENE_FLAGS_ALLOW_SHARED 0x20 // ------------------------------------------------------------------------------- /** The root structure of the imported data. @@ -276,7 +239,6 @@ struct aiNode // ------------------------------------------------------------------------------- struct aiScene { - /** Any combination of the AI_SCENE_FLAGS_XXX flags. By default * this value is 0, no flags are set. Most applications will * want to reject all scenes with the AI_SCENE_FLAGS_INCOMPLETE @@ -284,7 +246,6 @@ struct aiScene */ unsigned int mFlags; - /** The root node of the hierarchy. * * There will always be at least the root node if the import @@ -294,8 +255,6 @@ struct aiScene */ C_STRUCT aiNode* mRootNode; - - /** The number of meshes in the scene. */ unsigned int mNumMeshes; @@ -308,8 +267,6 @@ struct aiScene */ C_STRUCT aiMesh** mMeshes; - - /** The number of materials in the scene. */ unsigned int mNumMaterials; @@ -322,8 +279,6 @@ struct aiScene */ C_STRUCT aiMaterial** mMaterials; - - /** The number of animations in the scene. */ unsigned int mNumAnimations; @@ -334,8 +289,6 @@ struct aiScene */ C_STRUCT aiAnimation** mAnimations; - - /** The number of textures embedded into the file */ unsigned int mNumTextures; @@ -347,7 +300,6 @@ struct aiScene */ C_STRUCT aiTexture** mTextures; - /** The number of light sources in the scene. Light sources * are fully optional, in most cases this attribute will be 0 */ @@ -360,7 +312,6 @@ struct aiScene */ C_STRUCT aiLight** mLights; - /** The number of cameras in the scene. Cameras * are fully optional, in most cases this attribute will be 0 */ @@ -385,33 +336,38 @@ struct aiScene //! Check whether the scene contains meshes //! Unless no special scene flags are set this will always be true. - inline bool HasMeshes() const - { return mMeshes != NULL && mNumMeshes > 0; } + inline bool HasMeshes() const { + return mMeshes != NULL && mNumMeshes > 0; + } //! Check whether the scene contains materials //! Unless no special scene flags are set this will always be true. - inline bool HasMaterials() const - { return mMaterials != NULL && mNumMaterials > 0; } + inline bool HasMaterials() const { + return mMaterials != NULL && mNumMaterials > 0; + } //! Check whether the scene contains lights - inline bool HasLights() const - { return mLights != NULL && mNumLights > 0; } + inline bool HasLights() const { + return mLights != NULL && mNumLights > 0; + } //! Check whether the scene contains textures - inline bool HasTextures() const - { return mTextures != NULL && mNumTextures > 0; } + inline bool HasTextures() const { + return mTextures != NULL && mNumTextures > 0; + } //! Check whether the scene contains cameras - inline bool HasCameras() const - { return mCameras != NULL && mNumCameras > 0; } + inline bool HasCameras() const { + return mCameras != NULL && mNumCameras > 0; + } //! Check whether the scene contains animations - inline bool HasAnimations() const - { return mAnimations != NULL && mNumAnimations > 0; } + inline bool HasAnimations() const { + return mAnimations != NULL && mNumAnimations > 0; + } #endif // __cplusplus - /** Internal data, do not touch */ #ifdef __cplusplus void* mPrivate; @@ -425,4 +381,4 @@ struct aiScene } //! namespace Assimp #endif -#endif // __AI_SCENE_H_INC__ +#endif // AI_SCENE_H_INC diff --git a/src/3rdparty/assimp/include/assimp/texture.h b/src/3rdparty/assimp/include/assimp/texture.h index ee3ee3149..c09ef2cbe 100644 --- a/src/3rdparty/assimp/include/assimp/texture.h +++ b/src/3rdparty/assimp/include/assimp/texture.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -47,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * pixels, and "compressed" textures, which are stored in a file format * such as PNG or TGA. */ - +#pragma once #ifndef AI_TEXTURE_H_INC #define AI_TEXTURE_H_INC @@ -59,6 +60,14 @@ extern "C" { // -------------------------------------------------------------------------------- + +/** \def AI_EMBEDDED_TEXNAME_PREFIX + * \ref AI_MAKE_EMBEDDED_TEXNAME + */ +#ifndef AI_EMBEDDED_TEXNAME_PREFIX +# define AI_EMBEDDED_TEXNAME_PREFIX "*" +#endif + /** @def AI_MAKE_EMBEDDED_TEXNAME * Used to build the reserved path name used by the material system to * reference textures that are embedded into their corresponding @@ -66,7 +75,7 @@ extern "C" { * (zero-based, in the aiScene::mTextures array) */ #if (!defined AI_MAKE_EMBEDDED_TEXNAME) -# define AI_MAKE_EMBEDDED_TEXNAME(_n_) "*" # _n_ +# define AI_MAKE_EMBEDDED_TEXNAME(_n_) AI_EMBEDDED_TEXNAME_PREFIX # _n_ #endif @@ -139,10 +148,17 @@ struct aiTexture unsigned int mHeight; /** A hint from the loader to make it easier for applications - * to determine the type of embedded compressed textures. + * to determine the type of embedded textures. * - * If mHeight != 0 this member is undefined. Otherwise it - * is set set to '\\0\\0\\0\\0' if the loader has no additional + * If mHeight != 0 this member is show how data is packed. Hint will consist of + * two parts: channel order and channel bitness (count of the bits for every + * color channel). For simple parsing by the viewer it's better to not omit + * absent color channel and just use 0 for bitness. For example: + * 1. Image contain RGBA and 8 bit per channel, achFormatHint == "rgba8888"; + * 2. Image contain ARGB and 8 bit per channel, achFormatHint == "argb8888"; + * 3. Image contain RGB and 5 bit for R and B channels and 6 bit for G channel, achFormatHint == "rgba5650"; + * 4. One color image with B channel and 1 bit for it, achFormatHint == "rgba0010"; + * If mHeight == 0 then achFormatHint is set set to '\\0\\0\\0\\0' if the loader has no additional * information about the texture file format used OR the * file extension of the format without a trailing dot. If there * are multiple file extensions for a format, the shortest @@ -150,7 +166,7 @@ struct aiTexture * E.g. 'dds\\0', 'pcx\\0', 'jpg\\0'. All characters are lower-case. * The fourth character will always be '\\0'. */ - char achFormatHint[4]; + char achFormatHint[9];// 8 for string + 1 for terminator. /** Data of the texture. * @@ -172,7 +188,7 @@ struct aiTexture //! @return true if the given string matches the format hint bool CheckFormat(const char* s) const { - return (0 == ::strncmp(achFormatHint,s,3)); + return (0 == ::strncmp(achFormatHint, s, sizeof(achFormatHint))); } // Construction diff --git a/src/3rdparty/assimp/include/assimp/types.h b/src/3rdparty/assimp/include/assimp/types.h index 592d5c64d..0012a0bba 100644 --- a/src/3rdparty/assimp/include/assimp/types.h +++ b/src/3rdparty/assimp/include/assimp/types.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,12 +43,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file types.h * Basic data types and primitives, such as vectors or colors. */ +#pragma once #ifndef AI_TYPES_H_INC #define AI_TYPES_H_INC // Some runtime headers #include <sys/types.h> -#include <math.h> #include <stddef.h> #include <string.h> #include <limits.h> @@ -109,13 +110,12 @@ extern "C" { /** Maximum dimension for strings, ASSIMP strings are zero terminated. */ #ifdef __cplusplus +static const size_t MAXLEN = 1024; #else # define MAXLEN 1024 #endif -#include "./Compiler/pushpack1.h" - // ---------------------------------------------------------------------------------- /** Represents a plane in a three-dimensional, euclidean space */ @@ -123,7 +123,7 @@ struct aiPlane { #ifdef __cplusplus aiPlane () : a(0.f), b(0.f), c(0.f), d(0.f) {} - aiPlane (float _a, float _b, float _c, float _d) + aiPlane (ai_real _a, ai_real _b, ai_real _c, ai_real _d) : a(_a), b(_b), c(_c), d(_d) {} aiPlane (const aiPlane& o) : a(o.a), b(o.b), c(o.c), d(o.d) {} @@ -131,8 +131,8 @@ struct aiPlane #endif // !__cplusplus //! Plane equation - float a,b,c,d; -} PACK_STRUCT; // !struct aiPlane + ai_real a,b,c,d; +}; // !struct aiPlane // ---------------------------------------------------------------------------------- /** Represents a ray @@ -150,7 +150,7 @@ struct aiRay //! Position and direction of the ray C_STRUCT aiVector3D pos, dir; -} PACK_STRUCT; // !struct aiRay +}; // !struct aiRay // ---------------------------------------------------------------------------------- /** Represents a color in Red-Green-Blue space. @@ -159,8 +159,8 @@ struct aiColor3D { #ifdef __cplusplus aiColor3D () : r(0.0f), g(0.0f), b(0.0f) {} - aiColor3D (float _r, float _g, float _b) : r(_r), g(_g), b(_b) {} - explicit aiColor3D (float _r) : r(_r), g(_r), b(_r) {} + aiColor3D (ai_real _r, ai_real _g, ai_real _b) : r(_r), g(_g), b(_b) {} + explicit aiColor3D (ai_real _r) : r(_r), g(_r), b(_r) {} aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {} /** Component-wise comparison */ @@ -176,11 +176,7 @@ struct aiColor3D /** Component-wise comparison */ // TODO: add epsilon? bool operator < (const aiColor3D& other) const { - return r < other.r || ( - r == other.r && (g < other.g || - (g == other.g && b < other.b) - ) - ); + return r < other.r || ( r == other.r && (g < other.g || (g == other.g && b < other.b ) ) ); } /** Component-wise addition */ @@ -199,32 +195,38 @@ struct aiColor3D } /** Multiply with a scalar */ - aiColor3D operator*(float f) const { + aiColor3D operator*(ai_real f) const { return aiColor3D(r*f,g*f,b*f); } /** Access a specific color component */ - float operator[](unsigned int i) const { + ai_real operator[](unsigned int i) const { return *(&r + i); } /** Access a specific color component */ - float& operator[](unsigned int i) { - return *(&r + i); + ai_real& operator[](unsigned int i) { + if ( 0 == i ) { + return r; + } else if ( 1 == i ) { + return g; + } else if ( 2 == i ) { + return b; + } + return r; } /** Check whether a color is black */ bool IsBlack() const { - static const float epsilon = 10e-3f; + static const ai_real epsilon = ai_real(10e-3); return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon; } #endif // !__cplusplus //! Red, green and blue color values - float r, g, b; -} PACK_STRUCT; // !struct aiColor3D -#include "./Compiler/poppack1.h" + ai_real r, g, b; +}; // !struct aiColor3D // ---------------------------------------------------------------------------------- /** Represents an UTF-8 string, zero byte terminated. @@ -512,4 +514,5 @@ struct aiMemoryInfo #include "quaternion.inl" #include "matrix3x3.inl" #include "matrix4x4.inl" -#endif + +#endif // AI_TYPES_H_INC diff --git a/src/3rdparty/assimp/include/assimp/vector2.h b/src/3rdparty/assimp/include/assimp/vector2.h index 199743e26..564d1f8b5 100644 --- a/src/3rdparty/assimp/include/assimp/vector2.h +++ b/src/3rdparty/assimp/include/assimp/vector2.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -41,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file vector2.h * @brief 2D vector structure, including operators when compiling in C++ */ +#pragma once #ifndef AI_VECTOR2D_H_INC #define AI_VECTOR2D_H_INC @@ -51,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #include "./Compiler/pushpack1.h" +#include "defs.h" // ---------------------------------------------------------------------------------- /** Represents a two-dimensional vector. @@ -98,12 +101,12 @@ public: TReal x, y; } PACK_STRUCT; -typedef aiVector2t<float> aiVector2D; +typedef aiVector2t<ai_real> aiVector2D; #else struct aiVector2D { - float x, y; + ai_real x, y; }; #endif // __cplusplus diff --git a/src/3rdparty/assimp/include/assimp/vector2.inl b/src/3rdparty/assimp/include/assimp/vector2.inl index ae823fc1a..5ce13eece 100644 --- a/src/3rdparty/assimp/include/assimp/vector2.inl +++ b/src/3rdparty/assimp/include/assimp/vector2.inl @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file vector2.inl * @brief Inline implementation of aiVector2t<TReal> operators */ +#pragma once #ifndef AI_VECTOR2D_INL_INC #define AI_VECTOR2D_INL_INC @@ -221,4 +223,5 @@ inline aiVector2t<TReal> operator - ( const aiVector2t<TReal>& v) } #endif -#endif + +#endif // AI_VECTOR2D_INL_INC diff --git a/src/3rdparty/assimp/include/assimp/vector3.h b/src/3rdparty/assimp/include/assimp/vector3.h index 84f785f8f..641dab795 100644 --- a/src/3rdparty/assimp/include/assimp/vector3.h +++ b/src/3rdparty/assimp/include/assimp/vector3.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -41,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file vector3.h * @brief 3D vector structure, including operators when compiling in C++ */ +#pragma once #ifndef AI_VECTOR3D_H_INC #define AI_VECTOR3D_H_INC @@ -50,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # include <math.h> #endif -#include "./Compiler/pushpack1.h" +#include "defs.h" #ifdef __cplusplus @@ -63,11 +65,10 @@ template <typename TReal> class aiVector3t { public: - - aiVector3t () : x(), y(), z() {} - aiVector3t (TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {} - explicit aiVector3t (TReal _xyz) : x(_xyz), y(_xyz), z(_xyz) {} - aiVector3t (const aiVector3t& o) : x(o.x), y(o.y), z(o.z) {} + aiVector3t() : x(), y(), z() {} + aiVector3t(TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {} + explicit aiVector3t (TReal _xyz ) : x(_xyz), y(_xyz), z(_xyz) {} + aiVector3t( const aiVector3t& o ) : x(o.x), y(o.y), z(o.z) {} public: @@ -96,7 +97,6 @@ public: operator aiVector3t<TOther> () const; public: - /** @brief Set the components of a vector * @param pX X component * @param pY Y component @@ -107,7 +107,6 @@ public: * @return Square length */ TReal SquareLength() const; - /** @brief Get the length of the vector * @return length */ TReal Length() const; @@ -126,25 +125,21 @@ public: const aiVector3t SymMul(const aiVector3t& o); TReal x, y, z; -} PACK_STRUCT; +}; -typedef aiVector3t<float> aiVector3D; +typedef aiVector3t<ai_real> aiVector3D; #else struct aiVector3D { - float x, y, z; -} PACK_STRUCT; + ai_real x, y, z; +}; #endif // __cplusplus -#include "./Compiler/poppack1.h" - #ifdef __cplusplus - - #endif // __cplusplus #endif // AI_VECTOR3D_H_INC diff --git a/src/3rdparty/assimp/include/assimp/vector3.inl b/src/3rdparty/assimp/include/assimp/vector3.inl index 0d0d62968..a074bb23a 100644 --- a/src/3rdparty/assimp/include/assimp/vector3.inl +++ b/src/3rdparty/assimp/include/assimp/vector3.inl @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -42,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file vector3.inl * @brief Inline implementation of aiVector3t<TReal> operators */ +#pragma once #ifndef AI_VECTOR3D_INL_INC #define AI_VECTOR3D_INL_INC @@ -140,12 +142,34 @@ AI_FORCE_INLINE aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatri // ------------------------------------------------------------------------------------------------ template <typename TReal> AI_FORCE_INLINE TReal aiVector3t<TReal>::operator[](unsigned int i) const { - return *(&x + i); +// return *(&x + i); + switch (i) { + case 0: + return x; + case 1: + return y; + case 2: + return z; + default: + break; + } + return x; } // ------------------------------------------------------------------------------------------------ template <typename TReal> AI_FORCE_INLINE TReal& aiVector3t<TReal>::operator[](unsigned int i) { - return *(&x + i); +// return *(&x + i); + switch (i) { + case 0: + return x; + case 1: + return y; + case 2: + return z; + default: + break; + } + return x; } // ------------------------------------------------------------------------------------------------ template <typename TReal> diff --git a/src/3rdparty/assimp/include/assimp/version.h b/src/3rdparty/assimp/include/assimp/version.h index 403798c1b..d1821fa2b 100644 --- a/src/3rdparty/assimp/include/assimp/version.h +++ b/src/3rdparty/assimp/include/assimp/version.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -43,8 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Functions to query the version of the Assimp runtime, check * compile flags, ... */ -#ifndef INCLUDED_AI_VERSION_H -#define INCLUDED_AI_VERSION_H +#pragma once +#ifndef AI_VERSION_H_INC +#define AI_VERSION_H_INC #include "defs.h" @@ -102,4 +104,5 @@ ASSIMP_API unsigned int aiGetCompileFlags (void); } // end extern "C" #endif -#endif // !! #ifndef INCLUDED_AI_VERSION_H +#endif // !! #ifndef AI_VERSION_H_INC + |