Merge branch 'master' into pugi_xml
This commit is contained in:
53
include/assimp/ColladaMetaData.h
Normal file
53
include/assimp/ColladaMetaData.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, 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 ColladaMetaData.h
|
||||
* Declares common metadata constants used by Collada files
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef AI_COLLADAMETADATA_H_INC
|
||||
#define AI_COLLADAMETADATA_H_INC
|
||||
|
||||
#define AI_METADATA_COLLADA_ID "Collada_id"
|
||||
#define AI_METADATA_COLLADA_SID "Collada_sid"
|
||||
|
||||
#endif
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
/** @brief Creates a logging instance.
|
||||
* @param name Name for log file. Only valid in combination
|
||||
* with the aiDefaultLogStream_FILE flag.
|
||||
* @param severity Log severity, VERBOSE turns on debug messages
|
||||
* @param severity Log severity, DEBUG turns on debug messages and VERBOSE turns on all messages.
|
||||
* @param defStreams Default log streams to be attached. Any bitwise
|
||||
* combination of the aiDefaultLogStream enumerated values.
|
||||
* If #aiDefaultLogStream_FILE is specified but an empty string is
|
||||
@@ -127,8 +127,8 @@ public:
|
||||
unsigned int severity);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @copydoc Logger::detatchStream */
|
||||
bool detatchStream(LogStream *pStream,
|
||||
/** @copydoc Logger::detachStream */
|
||||
bool detachStream(LogStream *pStream,
|
||||
unsigned int severity);
|
||||
|
||||
private:
|
||||
@@ -141,9 +141,12 @@ private:
|
||||
/** @briefDestructor */
|
||||
~DefaultLogger();
|
||||
|
||||
/** @brief Logs debug infos, only been written when severity level VERBOSE is set */
|
||||
/** @brief Logs debug infos, only been written when severity level DEBUG or higher is set */
|
||||
void OnDebug(const char* message);
|
||||
|
||||
/** @brief Logs debug infos, only been written when severity level VERBOSE is set */
|
||||
void OnVerboseDebug(const char *message);
|
||||
|
||||
/** @brief Logs an info message */
|
||||
void OnInfo(const char* message);
|
||||
|
||||
|
||||
@@ -66,10 +66,16 @@ public:
|
||||
: runtime_error(errorText) {
|
||||
// empty
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef DeadlyImportError DeadlyExportError;
|
||||
class DeadlyExportError : public runtime_error {
|
||||
public:
|
||||
/** Constructor with arguments */
|
||||
explicit DeadlyExportError(const std::string &errorText) :
|
||||
runtime_error(errorText) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(default : 4275)
|
||||
|
||||
@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -45,26 +44,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_GENERIC_PROPERTY_H_INCLUDED
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/Hash.h>
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline
|
||||
bool SetGenericProperty(std::map< unsigned int, T >& list,
|
||||
const char* szName, const T& value) {
|
||||
inline bool SetGenericProperty(std::map<unsigned int, T> &list,
|
||||
const char *szName, const T &value) {
|
||||
ai_assert(nullptr != szName);
|
||||
const uint32_t hash = SuperFastHash(szName);
|
||||
|
||||
typename std::map<unsigned int, T>::iterator it = list.find(hash);
|
||||
if (it == list.end()) {
|
||||
list.insert(std::pair<unsigned int, T>( hash, value ));
|
||||
if (it == list.end()) {
|
||||
list.insert(std::pair<unsigned int, T>(hash, value));
|
||||
return false;
|
||||
}
|
||||
(*it).second = value;
|
||||
@@ -74,9 +72,8 @@ bool SetGenericProperty(std::map< unsigned int, T >& list,
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline
|
||||
const T& GetGenericProperty(const std::map< unsigned int, T >& list,
|
||||
const char* szName, const T& errorReturn) {
|
||||
inline const T &GetGenericProperty(const std::map<unsigned int, T> &list,
|
||||
const char *szName, const T &errorReturn) {
|
||||
ai_assert(nullptr != szName);
|
||||
const uint32_t hash = SuperFastHash(szName);
|
||||
|
||||
@@ -92,22 +89,21 @@ const T& GetGenericProperty(const std::map< unsigned int, T >& list,
|
||||
// Special version for pointer types - they will be deleted when replaced with another value
|
||||
// passing NULL removes the whole property
|
||||
template <class T>
|
||||
inline
|
||||
void SetGenericPropertyPtr(std::map< unsigned int, T* >& list,
|
||||
const char* szName, T* value, bool* bWasExisting = nullptr ) {
|
||||
inline void SetGenericPropertyPtr(std::map<unsigned int, T *> &list,
|
||||
const char *szName, T *value, bool *bWasExisting = nullptr) {
|
||||
ai_assert(nullptr != szName);
|
||||
const uint32_t hash = SuperFastHash(szName);
|
||||
|
||||
typename std::map<unsigned int, T*>::iterator it = list.find(hash);
|
||||
if (it == list.end()) {
|
||||
typename std::map<unsigned int, T *>::iterator it = list.find(hash);
|
||||
if (it == list.end()) {
|
||||
if (bWasExisting) {
|
||||
*bWasExisting = false;
|
||||
}
|
||||
|
||||
list.insert(std::pair<unsigned int,T*>( hash, value ));
|
||||
list.insert(std::pair<unsigned int, T *>(hash, value));
|
||||
return;
|
||||
}
|
||||
if ((*it).second != value) {
|
||||
if ((*it).second != value) {
|
||||
delete (*it).second;
|
||||
(*it).second = value;
|
||||
}
|
||||
@@ -121,9 +117,8 @@ void SetGenericPropertyPtr(std::map< unsigned int, T* >& list,
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline
|
||||
bool HasGenericProperty(const std::map< unsigned int, T >& list,
|
||||
const char* szName) {
|
||||
inline bool HasGenericProperty(const std::map<unsigned int, T> &list,
|
||||
const char *szName) {
|
||||
ai_assert(nullptr != szName);
|
||||
const uint32_t hash = SuperFastHash(szName);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// Public ASSIMP data structures
|
||||
#include <assimp/types.h>
|
||||
|
||||
namespace Assimp {
|
||||
namespace Assimp {
|
||||
// =======================================================================
|
||||
// Public interface to Assimp
|
||||
class Importer;
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
* The return value remains valid until the property is modified.
|
||||
* @see GetPropertyInteger()
|
||||
*/
|
||||
const std::string GetPropertyString(const char* szName,
|
||||
std::string GetPropertyString(const char* szName,
|
||||
const std::string& sErrorReturn = "") const;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
* The return value remains valid until the property is modified.
|
||||
* @see GetPropertyInteger()
|
||||
*/
|
||||
const aiMatrix4x4 GetPropertyMatrix(const char* szName,
|
||||
aiMatrix4x4 GetPropertyMatrix(const char* szName,
|
||||
const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -72,7 +72,7 @@ for(LineSplitter splitter(stream);splitter;++splitter) {
|
||||
if (strtol(splitter[2]) > 5) { .. }
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG_F("Current line is: ", splitter.get_index());
|
||||
ASSIMP_LOG_VERBOSE_DEBUG_F("Current line is: ", splitter.get_index());
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
|
||||
@@ -94,6 +94,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void LogVerboseDebug(const Formatter::format& message) {
|
||||
if (!DefaultLogger::isNullLogger()) {
|
||||
ASSIMP_LOG_VERBOSE_DEBUG(Prefix()+(std::string)message);
|
||||
}
|
||||
}
|
||||
|
||||
// https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462
|
||||
#if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
||||
|
||||
@@ -125,6 +131,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static void LogVerboseDebug (const char* message) {
|
||||
if (!DefaultLogger::isNullLogger()) {
|
||||
LogVerboseDebug(Formatter::format(message));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@@ -74,7 +74,8 @@ public:
|
||||
*/
|
||||
enum LogSeverity {
|
||||
NORMAL, //!< Normal granularity of logging
|
||||
VERBOSE //!< Debug infos will be logged, too
|
||||
DEBUG, //!< Debug messages will be logged, but not verbose debug messages.
|
||||
VERBOSE //!< All messages will be logged
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -103,6 +104,12 @@ public:
|
||||
void debug(const char* message);
|
||||
void debug(const std::string &message);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message*/
|
||||
void verboseDebug(const char *message);
|
||||
void verboseDebug(const std::string &message);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a info message
|
||||
* @param message Info message*/
|
||||
@@ -154,7 +161,7 @@ public:
|
||||
* if the result is 0 the stream is detached from the Logger and
|
||||
* the caller retakes the possession of the stream.
|
||||
* @return true if the stream has been detached, false otherwise.*/
|
||||
virtual bool detatchStream(LogStream *pStream,
|
||||
virtual bool detachStream(LogStream *pStream,
|
||||
unsigned int severity = Debugging | Err | Warn | Info) = 0;
|
||||
|
||||
protected:
|
||||
@@ -178,6 +185,16 @@ protected:
|
||||
*/
|
||||
virtual void OnDebug(const char* message)= 0;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Called as a request to write a specific verbose debug message
|
||||
* @param message Debug message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
* the function is left.
|
||||
*/
|
||||
virtual void OnVerboseDebug(const char *message) = 0;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Called as a request to write a specific info message
|
||||
@@ -255,6 +272,11 @@ void Logger::debug(const std::string &message) {
|
||||
return debug(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline void Logger::verboseDebug(const std::string &message) {
|
||||
return verboseDebug(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline
|
||||
void Logger::error(const std::string &message) {
|
||||
@@ -273,33 +295,37 @@ void Logger::info(const std::string &message) {
|
||||
return info(message.c_str());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define ASSIMP_LOG_WARN_F(string,...)\
|
||||
DefaultLogger::get()->warn((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_ERROR_F(string,...)\
|
||||
DefaultLogger::get()->error((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_DEBUG_F(string,...)\
|
||||
DefaultLogger::get()->debug((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_INFO_F(string,...)\
|
||||
DefaultLogger::get()->info((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
|
||||
#define ASSIMP_LOG_WARN(string)\
|
||||
DefaultLogger::get()->warn(string)
|
||||
|
||||
#define ASSIMP_LOG_ERROR(string)\
|
||||
DefaultLogger::get()->error(string)
|
||||
|
||||
#define ASSIMP_LOG_DEBUG(string)\
|
||||
DefaultLogger::get()->debug(string)
|
||||
|
||||
#define ASSIMP_LOG_INFO(string)\
|
||||
DefaultLogger::get()->info(string)
|
||||
|
||||
|
||||
} // Namespace Assimp
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define ASSIMP_LOG_WARN_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->warn((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_ERROR_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->error((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_DEBUG_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->debug((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_VERBOSE_DEBUG_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->verboseDebug((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_INFO_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->info((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_WARN(string) \
|
||||
Assimp::DefaultLogger::get()->warn(string)
|
||||
|
||||
#define ASSIMP_LOG_ERROR(string) \
|
||||
Assimp::DefaultLogger::get()->error(string)
|
||||
|
||||
#define ASSIMP_LOG_DEBUG(string) \
|
||||
Assimp::DefaultLogger::get()->debug(string)
|
||||
|
||||
#define ASSIMP_LOG_VERBOSE_DEBUG(string) \
|
||||
Assimp::DefaultLogger::get()->verboseDebug(string)
|
||||
|
||||
#define ASSIMP_LOG_INFO(string) \
|
||||
Assimp::DefaultLogger::get()->info(string)
|
||||
|
||||
#endif // !! INCLUDED_AI_LOGGER_H
|
||||
|
||||
@@ -55,36 +55,51 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
namespace Math {
|
||||
|
||||
// TODO: use binary GCD for unsigned integers ....
|
||||
template < typename IntegerType >
|
||||
inline
|
||||
IntegerType gcd( IntegerType a, IntegerType b ) {
|
||||
/// @brief Will return the greatest common divisor.
|
||||
/// @param a [in] Value a.
|
||||
/// @param b [in] Value b.
|
||||
/// @return The greatest common divisor.
|
||||
template <typename IntegerType>
|
||||
inline IntegerType gcd( IntegerType a, IntegerType b ) {
|
||||
const IntegerType zero = (IntegerType)0;
|
||||
while ( true ) {
|
||||
if ( a == zero )
|
||||
if ( a == zero ) {
|
||||
return b;
|
||||
}
|
||||
b %= a;
|
||||
|
||||
if ( b == zero )
|
||||
if ( b == zero ) {
|
||||
return a;
|
||||
}
|
||||
a %= b;
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Will return the greatest common divisor.
|
||||
/// @param a [in] Value a.
|
||||
/// @param b [in] Value b.
|
||||
/// @return The greatest common divisor.
|
||||
template < typename IntegerType >
|
||||
inline
|
||||
IntegerType lcm( IntegerType a, IntegerType b ) {
|
||||
inline IntegerType lcm( IntegerType a, IntegerType b ) {
|
||||
const IntegerType t = gcd (a,b);
|
||||
if (!t)
|
||||
if (!t) {
|
||||
return t;
|
||||
}
|
||||
return a / t * b;
|
||||
}
|
||||
|
||||
/// @brief Will return the smallest epsilon-value for the requested type.
|
||||
/// @return The numercical limit epsilon depending on its type.
|
||||
template<class T>
|
||||
inline
|
||||
T getEpsilon() {
|
||||
inline T getEpsilon() {
|
||||
return std::numeric_limits<T>::epsilon();
|
||||
}
|
||||
|
||||
/// @brief Will return the constant PI for the requested type.
|
||||
/// @return Pi
|
||||
template<class T>
|
||||
inline T PI() {
|
||||
return static_cast<T>(3.14159265358979323846);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Math
|
||||
} // namespace Assimp
|
||||
|
||||
@@ -66,6 +66,11 @@ public:
|
||||
(void)message; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Logs a verbose debug message */
|
||||
void OnVerboseDebug(const char *message) {
|
||||
(void)message; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Logs an info message */
|
||||
void OnInfo(const char* message) {
|
||||
(void)message; //this avoids compiler warnings
|
||||
@@ -88,7 +93,7 @@ public:
|
||||
}
|
||||
|
||||
/** @brief Detach a still attached stream from logger */
|
||||
bool detatchStream(LogStream *pStream, unsigned int severity) {
|
||||
bool detachStream(LogStream *pStream, unsigned int severity) {
|
||||
(void)pStream; (void)severity; //this avoids compiler warnings
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
||||
164
include/assimp/SmallVector.h
Normal file
164
include/assimp/SmallVector.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, 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 Defines small vector with inplace storage.
|
||||
Based on CppCon 2016: Chandler Carruth "High Performance Code 201: Hybrid Data Structures" */
|
||||
|
||||
#pragma once
|
||||
#ifndef AI_SMALLVECTOR_H_INC
|
||||
#define AI_SMALLVECTOR_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
/// @brief Small vector with inplace storage.
|
||||
///
|
||||
/// Reduces heap allocations when list is shorter. It uses a small array for a dedicated size.
|
||||
/// When the growing gets bigger than this small cache a dynamic growing algorithm will be
|
||||
/// used.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
template<typename T, unsigned int Capacity>
|
||||
class SmallVector {
|
||||
public:
|
||||
/// @brief The default class constructor.
|
||||
SmallVector() :
|
||||
mStorage(mInplaceStorage),
|
||||
mSize(0),
|
||||
mCapacity(Capacity) {
|
||||
// empty
|
||||
}
|
||||
|
||||
/// @brief The class destructor.
|
||||
~SmallVector() {
|
||||
if (mStorage != mInplaceStorage) {
|
||||
delete [] mStorage;
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Will push a new item. The capacity will grow in case of a too small capacity.
|
||||
/// @param item [in] The item to push at the end of the vector.
|
||||
void push_back(const T& item) {
|
||||
if (mSize < mCapacity) {
|
||||
mStorage[mSize++] = item;
|
||||
return;
|
||||
}
|
||||
|
||||
push_back_and_grow(item);
|
||||
}
|
||||
|
||||
/// @brief Will resize the vector.
|
||||
/// @param newSize [in] The new size.
|
||||
void resize(size_t newSize) {
|
||||
if (newSize > mCapacity) {
|
||||
grow(newSize);
|
||||
}
|
||||
mSize = newSize;
|
||||
}
|
||||
|
||||
/// @brief Returns the current size of the vector.
|
||||
/// @return The current size.
|
||||
size_t size() const {
|
||||
return mSize;
|
||||
}
|
||||
|
||||
/// @brief Returns a pointer to the first item.
|
||||
/// @return The first item as a pointer.
|
||||
T* begin() {
|
||||
return mStorage;
|
||||
}
|
||||
|
||||
/// @brief Returns a pointer to the end.
|
||||
/// @return The end as a pointer.
|
||||
T* end() {
|
||||
return &mStorage[mSize];
|
||||
}
|
||||
|
||||
/// @brief Returns a const pointer to the first item.
|
||||
/// @return The first item as a const pointer.
|
||||
T* begin() const {
|
||||
return mStorage;
|
||||
}
|
||||
|
||||
/// @brief Returns a const pointer to the end.
|
||||
/// @return The end as a const pointer.
|
||||
T* end() const {
|
||||
return &mStorage[mSize];
|
||||
}
|
||||
|
||||
SmallVector(const SmallVector &) = delete;
|
||||
SmallVector(SmallVector &&) = delete;
|
||||
SmallVector &operator = (const SmallVector &) = delete;
|
||||
SmallVector &operator = (SmallVector &&) = delete;
|
||||
|
||||
private:
|
||||
void grow( size_t newCapacity) {
|
||||
T* oldStorage = mStorage;
|
||||
T* newStorage = new T[newCapacity];
|
||||
|
||||
std::memcpy(newStorage, oldStorage, mSize * sizeof(T));
|
||||
|
||||
mStorage = newStorage;
|
||||
mCapacity = newCapacity;
|
||||
|
||||
if (oldStorage != mInplaceStorage) {
|
||||
delete [] oldStorage;
|
||||
}
|
||||
}
|
||||
|
||||
void push_back_and_grow(const T& item) {
|
||||
grow(mCapacity + Capacity);
|
||||
|
||||
mStorage[mSize++] = item;
|
||||
}
|
||||
|
||||
T* mStorage;
|
||||
size_t mSize;
|
||||
size_t mCapacity;
|
||||
T mInplaceStorage[Capacity];
|
||||
};
|
||||
|
||||
} // end namespace Assimp
|
||||
|
||||
#endif // !! AI_SMALLVECTOR_H_INC
|
||||
@@ -46,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_SPATIALSORT_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <assimp/types.h>
|
||||
#include <vector>
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
@@ -62,10 +62,8 @@ namespace Assimp {
|
||||
* time, with O(n) worst case complexity when all vertices lay on the plane. The plane is chosen
|
||||
* so that it avoids common planes in usual data sets. */
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
class ASSIMP_API SpatialSort
|
||||
{
|
||||
class ASSIMP_API SpatialSort {
|
||||
public:
|
||||
|
||||
SpatialSort();
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
@@ -76,14 +74,12 @@ public:
|
||||
* @param pNumPositions Number of vectors to expect in that array.
|
||||
* @param pElementOffset Offset in bytes from the beginning of one vector in memory
|
||||
* to the beginning of the next vector. */
|
||||
SpatialSort( const aiVector3D* pPositions, unsigned int pNumPositions,
|
||||
unsigned int pElementOffset);
|
||||
SpatialSort(const aiVector3D *pPositions, unsigned int pNumPositions,
|
||||
unsigned int pElementOffset);
|
||||
|
||||
/** Destructor */
|
||||
~SpatialSort();
|
||||
|
||||
public:
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
/** Sets the input data for the SpatialSort. This replaces existing data, if any.
|
||||
* The new data receives new indices in ascending order.
|
||||
@@ -97,17 +93,15 @@ public:
|
||||
* required in order to use #FindPosition() or #GenerateMappingTable().
|
||||
* If you don't finalize yet, you can use #Append() to add data from
|
||||
* other sources.*/
|
||||
void Fill( const aiVector3D* pPositions, unsigned int pNumPositions,
|
||||
unsigned int pElementOffset,
|
||||
bool pFinalize = true);
|
||||
|
||||
void Fill(const aiVector3D *pPositions, unsigned int pNumPositions,
|
||||
unsigned int pElementOffset,
|
||||
bool pFinalize = true);
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
/** Same as #Fill(), except the method appends to existing data in the #SpatialSort. */
|
||||
void Append( const aiVector3D* pPositions, unsigned int pNumPositions,
|
||||
unsigned int pElementOffset,
|
||||
bool pFinalize = true);
|
||||
|
||||
void Append(const aiVector3D *pPositions, unsigned int pNumPositions,
|
||||
unsigned int pElementOffset,
|
||||
bool pFinalize = true);
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
/** Finalize the spatial hash data structure. This can be useful after
|
||||
@@ -123,8 +117,8 @@ public:
|
||||
* @param poResults The container to store the indices of the found positions.
|
||||
* Will be emptied by the call so it may contain anything.
|
||||
* @return An iterator to iterate over all vertices in the given area.*/
|
||||
void FindPositions( const aiVector3D& pPosition, ai_real pRadius,
|
||||
std::vector<unsigned int>& poResults) const;
|
||||
void FindPositions(const aiVector3D &pPosition, ai_real pRadius,
|
||||
std::vector<unsigned int> &poResults) const;
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
/** Fills an array with indices of all positions identical to the given position. In
|
||||
@@ -133,8 +127,8 @@ public:
|
||||
* @param pPosition The position to look for vertices.
|
||||
* @param poResults The container to store the indices of the found positions.
|
||||
* Will be emptied by the call so it may contain anything.*/
|
||||
void FindIdenticalPositions( const aiVector3D& pPosition,
|
||||
std::vector<unsigned int>& poResults) const;
|
||||
void FindIdenticalPositions(const aiVector3D &pPosition,
|
||||
std::vector<unsigned int> &poResults) const;
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
/** Compute a table that maps each vertex ID referring to a spatially close
|
||||
@@ -144,8 +138,8 @@ public:
|
||||
* @param pRadius Maximal distance from the position a vertex may have to
|
||||
* be counted in.
|
||||
* @return Number of unique vertices (n). */
|
||||
unsigned int GenerateMappingTable(std::vector<unsigned int>& fill,
|
||||
ai_real pRadius) const;
|
||||
unsigned int GenerateMappingTable(std::vector<unsigned int> &fill,
|
||||
ai_real pRadius) const;
|
||||
|
||||
protected:
|
||||
/** Normal of the sorting plane, normalized. The center is always at (0, 0, 0) */
|
||||
@@ -159,15 +153,17 @@ protected:
|
||||
ai_real mDistance; ///< Distance of this vertex to the sorting plane
|
||||
|
||||
Entry() AI_NO_EXCEPT
|
||||
: mIndex( 999999999 ), mPosition(), mDistance( 99999. ) {
|
||||
// empty
|
||||
: mIndex(999999999),
|
||||
mPosition(),
|
||||
mDistance(99999.) {
|
||||
// empty
|
||||
}
|
||||
Entry( unsigned int pIndex, const aiVector3D& pPosition, ai_real pDistance)
|
||||
: mIndex( pIndex), mPosition( pPosition), mDistance( pDistance) {
|
||||
Entry(unsigned int pIndex, const aiVector3D &pPosition, ai_real pDistance) :
|
||||
mIndex(pIndex), mPosition(pPosition), mDistance(pDistance) {
|
||||
// empty
|
||||
}
|
||||
|
||||
bool operator < (const Entry& e) const { return mDistance < e.mDistance; }
|
||||
bool operator<(const Entry &e) const { return mDistance < e.mDistance; }
|
||||
};
|
||||
|
||||
// all positions, sorted by distance to the sorting plane
|
||||
|
||||
@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -49,13 +47,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_STREAMREADER_H_INCLUDED
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <assimp/IOStream.hpp>
|
||||
#include <assimp/Defines.h>
|
||||
#include <assimp/ByteSwapper.h>
|
||||
#include <assimp/Defines.h>
|
||||
#include <assimp/Exceptional.h>
|
||||
#include <assimp/IOStream.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -74,10 +72,8 @@ namespace Assimp {
|
||||
template <bool SwapEndianess = false, bool RuntimeSwitch = false>
|
||||
class StreamReader {
|
||||
public:
|
||||
// FIXME: use these data types throughout the whole library,
|
||||
// then change them to 64 bit values :-)
|
||||
using diff = int;
|
||||
using pos = unsigned int;
|
||||
using diff = size_t;
|
||||
using pos = size_t;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Construction from a given stream with a well-defined endianness.
|
||||
@@ -91,40 +87,45 @@ public:
|
||||
* stream is in little endian byte order. Otherwise the
|
||||
* endianness information is contained in the @c SwapEndianess
|
||||
* template parameter and this parameter is meaningless. */
|
||||
StreamReader(std::shared_ptr<IOStream> stream, bool le = false)
|
||||
: stream(stream)
|
||||
, le(le)
|
||||
{
|
||||
StreamReader(std::shared_ptr<IOStream> stream, bool le = false) :
|
||||
mStream(stream),
|
||||
mBuffer(nullptr),
|
||||
mCurrent(nullptr),
|
||||
mEnd(nullptr),
|
||||
mLimit(nullptr),
|
||||
mLe(le) {
|
||||
ai_assert(stream);
|
||||
InternBegin();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
StreamReader(IOStream* stream, bool le = false)
|
||||
: stream(std::shared_ptr<IOStream>(stream))
|
||||
, le(le)
|
||||
{
|
||||
ai_assert(stream);
|
||||
StreamReader(IOStream *stream, bool le = false) :
|
||||
mStream(std::shared_ptr<IOStream>(stream)),
|
||||
mBuffer(nullptr),
|
||||
mCurrent(nullptr),
|
||||
mEnd(nullptr),
|
||||
mLimit(nullptr),
|
||||
mLe(le) {
|
||||
ai_assert(nullptr != stream);
|
||||
InternBegin();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
~StreamReader() {
|
||||
delete[] buffer;
|
||||
delete[] mBuffer;
|
||||
}
|
||||
|
||||
// deprecated, use overloaded operator>> instead
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Read a float from the stream */
|
||||
float GetF4()
|
||||
{
|
||||
/// Read a float from the stream.
|
||||
float GetF4() {
|
||||
return Get<float>();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Read a double from the stream */
|
||||
double GetF8() {
|
||||
/// Read a double from the stream.
|
||||
double GetF8() {
|
||||
return Get<double>();
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ public:
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Read a signed 8 bit integer from the stream */
|
||||
int8_t GetI1() {
|
||||
int8_t GetI1() {
|
||||
return Get<int8_t>();
|
||||
}
|
||||
|
||||
@@ -154,55 +155,55 @@ public:
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Read a unsigned 16 bit integer from the stream */
|
||||
uint16_t GetU2() {
|
||||
uint16_t GetU2() {
|
||||
return Get<uint16_t>();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Read a unsigned 8 bit integer from the stream */
|
||||
/// Read a unsigned 8 bit integer from the stream
|
||||
uint8_t GetU1() {
|
||||
return Get<uint8_t>();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Read an unsigned 32 bit integer from the stream */
|
||||
uint32_t GetU4() {
|
||||
/// Read an unsigned 32 bit integer from the stream
|
||||
uint32_t GetU4() {
|
||||
return Get<uint32_t>();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Read a unsigned 64 bit integer from the stream */
|
||||
uint64_t GetU8() {
|
||||
/// Read a unsigned 64 bit integer from the stream
|
||||
uint64_t GetU8() {
|
||||
return Get<uint64_t>();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Get the remaining stream size (to the end of the stream) */
|
||||
unsigned int GetRemainingSize() const {
|
||||
return (unsigned int)(end - current);
|
||||
/// Get the remaining stream size (to the end of the stream)
|
||||
size_t GetRemainingSize() const {
|
||||
return (unsigned int)(mEnd - mCurrent);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Get the remaining stream size (to the current read limit). The
|
||||
* return value is the remaining size of the stream if no custom
|
||||
* read limit has been set. */
|
||||
unsigned int GetRemainingSizeToLimit() const {
|
||||
return (unsigned int)(limit - current);
|
||||
size_t GetRemainingSizeToLimit() const {
|
||||
return (unsigned int)(mLimit - mCurrent);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Increase the file pointer (relative seeking) */
|
||||
void IncPtr(intptr_t plus) {
|
||||
current += plus;
|
||||
if (current > limit) {
|
||||
void IncPtr(intptr_t plus) {
|
||||
mCurrent += plus;
|
||||
if (mCurrent > mLimit) {
|
||||
throw DeadlyImportError("End of file or read limit was reached");
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Get the current file pointer */
|
||||
int8_t* GetPtr() const {
|
||||
return current;
|
||||
int8_t *GetPtr() const {
|
||||
return mCurrent;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -211,9 +212,9 @@ public:
|
||||
* large chunks of data at once.
|
||||
* @param p The new pointer, which is validated against the size
|
||||
* limit and buffer boundaries. */
|
||||
void SetPtr(int8_t* p) {
|
||||
current = p;
|
||||
if (current > limit || current < buffer) {
|
||||
void SetPtr(int8_t *p) {
|
||||
mCurrent = p;
|
||||
if (mCurrent > mLimit || mCurrent < mBuffer) {
|
||||
throw DeadlyImportError("End of file or read limit was reached");
|
||||
}
|
||||
}
|
||||
@@ -222,21 +223,20 @@ public:
|
||||
/** Copy n bytes to an external buffer
|
||||
* @param out Destination for copying
|
||||
* @param bytes Number of bytes to copy */
|
||||
void CopyAndAdvance(void* out, size_t bytes) {
|
||||
int8_t* ur = GetPtr();
|
||||
SetPtr(ur+bytes); // fire exception if eof
|
||||
void CopyAndAdvance(void *out, size_t bytes) {
|
||||
int8_t *ur = GetPtr();
|
||||
SetPtr(ur + bytes); // fire exception if eof
|
||||
|
||||
::memcpy(out,ur,bytes);
|
||||
::memcpy(out, ur, bytes);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Get the current offset from the beginning of the file */
|
||||
int GetCurrentPos() const {
|
||||
return (unsigned int)(current - buffer);
|
||||
/// @brief Get the current offset from the beginning of the file
|
||||
int GetCurrentPos() const {
|
||||
return (unsigned int)(mCurrent - mBuffer);
|
||||
}
|
||||
|
||||
void SetCurrentPos(size_t pos) {
|
||||
SetPtr(buffer + pos);
|
||||
SetPtr(mBuffer + pos);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -246,15 +246,15 @@ public:
|
||||
* the beginning of the file. Specifying UINT_MAX
|
||||
* resets the limit to the original end of the stream.
|
||||
* Returns the previously set limit. */
|
||||
unsigned int SetReadLimit(unsigned int _limit) {
|
||||
unsigned int SetReadLimit(unsigned int _limit) {
|
||||
unsigned int prev = GetReadLimit();
|
||||
if (UINT_MAX == _limit) {
|
||||
limit = end;
|
||||
mLimit = mEnd;
|
||||
return prev;
|
||||
}
|
||||
|
||||
limit = buffer + _limit;
|
||||
if (limit > end) {
|
||||
mLimit = mBuffer + _limit;
|
||||
if (mLimit > mEnd) {
|
||||
throw DeadlyImportError("StreamReader: Invalid read limit");
|
||||
}
|
||||
return prev;
|
||||
@@ -263,21 +263,21 @@ public:
|
||||
// ---------------------------------------------------------------------
|
||||
/** Get the current read limit in bytes. Reading over this limit
|
||||
* accidentally raises an exception. */
|
||||
unsigned int GetReadLimit() const {
|
||||
return (unsigned int)(limit - buffer);
|
||||
unsigned int GetReadLimit() const {
|
||||
return (unsigned int)(mLimit - mBuffer);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Skip to the read limit in bytes. Reading over this limit
|
||||
* accidentally raises an exception. */
|
||||
void SkipToReadLimit() {
|
||||
current = limit;
|
||||
void SkipToReadLimit() {
|
||||
mCurrent = mLimit;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** overload operator>> and allow chaining of >> ops. */
|
||||
template <typename T>
|
||||
StreamReader& operator >> (T& f) {
|
||||
StreamReader &operator>>(T &f) {
|
||||
f = Get<T>();
|
||||
return *this;
|
||||
}
|
||||
@@ -286,14 +286,14 @@ public:
|
||||
/** Generic read method. ByteSwap::Swap(T*) *must* be defined */
|
||||
template <typename T>
|
||||
T Get() {
|
||||
if ( current + sizeof(T) > limit) {
|
||||
if (mCurrent + sizeof(T) > mLimit) {
|
||||
throw DeadlyImportError("End of file or stream limit was reached");
|
||||
}
|
||||
|
||||
T f;
|
||||
::memcpy (&f, current, sizeof(T));
|
||||
Intern::Getter<SwapEndianess,T,RuntimeSwitch>() (&f,le);
|
||||
current += sizeof(T);
|
||||
::memcpy(&f, mCurrent, sizeof(T));
|
||||
Intern::Getter<SwapEndianess, T, RuntimeSwitch>()(&f, mLe);
|
||||
mCurrent += sizeof(T);
|
||||
|
||||
return f;
|
||||
}
|
||||
@@ -301,46 +301,44 @@ public:
|
||||
private:
|
||||
// ---------------------------------------------------------------------
|
||||
void InternBegin() {
|
||||
if (!stream) {
|
||||
// in case someone wonders: StreamReader is frequently invoked with
|
||||
// no prior validation whether the input stream is valid. Since
|
||||
// no one bothers changing the error message, this message here
|
||||
// is passed down to the caller and 'unable to open file'
|
||||
// simply describes best what happened.
|
||||
if (nullptr == mStream) {
|
||||
throw DeadlyImportError("StreamReader: Unable to open file");
|
||||
}
|
||||
|
||||
const size_t s = stream->FileSize() - stream->Tell();
|
||||
if (!s) {
|
||||
const size_t filesize = mStream->FileSize() - mStream->Tell();
|
||||
if (0 == filesize) {
|
||||
throw DeadlyImportError("StreamReader: File is empty or EOF is already reached");
|
||||
}
|
||||
|
||||
current = buffer = new int8_t[s];
|
||||
const size_t read = stream->Read(current,1,s);
|
||||
mCurrent = mBuffer = new int8_t[filesize];
|
||||
const size_t read = mStream->Read(mCurrent, 1, filesize);
|
||||
// (read < s) can only happen if the stream was opened in text mode, in which case FileSize() is not reliable
|
||||
ai_assert(read <= s);
|
||||
end = limit = &buffer[read-1] + 1;
|
||||
ai_assert(read <= filesize);
|
||||
mEnd = mLimit = &mBuffer[read - 1] + 1;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<IOStream> stream;
|
||||
int8_t *buffer, *current, *end, *limit;
|
||||
bool le;
|
||||
std::shared_ptr<IOStream> mStream;
|
||||
int8_t *mBuffer;
|
||||
int8_t *mCurrent;
|
||||
int8_t *mEnd;
|
||||
int8_t *mLimit;
|
||||
bool mLe;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// `static` StreamReaders. Their byte order is fixed and they might be a little bit faster.
|
||||
#ifdef AI_BUILD_BIG_ENDIAN
|
||||
typedef StreamReader<true> StreamReaderLE;
|
||||
typedef StreamReader<false> StreamReaderBE;
|
||||
typedef StreamReader<true> StreamReaderLE;
|
||||
typedef StreamReader<false> StreamReaderBE;
|
||||
#else
|
||||
typedef StreamReader<true> StreamReaderBE;
|
||||
typedef StreamReader<false> StreamReaderLE;
|
||||
typedef StreamReader<true> StreamReaderBE;
|
||||
typedef StreamReader<false> StreamReaderLE;
|
||||
#endif
|
||||
|
||||
// `dynamic` StreamReader. The byte order of the input data is specified in the
|
||||
// c'tor. This involves runtime branching and might be a little bit slower.
|
||||
typedef StreamReader<true,true> StreamReaderAny;
|
||||
typedef StreamReader<true, true> StreamReaderAny;
|
||||
|
||||
} // end namespace Assimp
|
||||
|
||||
|
||||
@@ -139,10 +139,27 @@ std::string DecimalToHexa( T toConvert ) {
|
||||
ss >> result;
|
||||
|
||||
for ( size_t i = 0; i < result.size(); ++i ) {
|
||||
result[ i ] = toupper( result[ i ] );
|
||||
result[ i ] = (char) toupper( result[ i ] );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @brief translate RGBA to String
|
||||
/// @param r aiColor.r
|
||||
/// @param g aiColor.g
|
||||
/// @param b aiColor.b
|
||||
/// @param a aiColor.a
|
||||
/// @param with_head #
|
||||
/// @return The hexadecimal string, is empty in case of an error.
|
||||
AI_FORCE_INLINE std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) {
|
||||
std::stringstream ss;
|
||||
if (with_head) {
|
||||
ss << "#";
|
||||
}
|
||||
ss << std::hex << (r << 24 | g << 16 | b << 8 | a);
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
#endif // INCLUDED_AI_STRINGUTILS_H
|
||||
|
||||
@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -51,11 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_ANIM_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/quaternion.h>
|
||||
#include <assimp/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -63,8 +61,7 @@ extern "C" {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** A time-value pair specifying a certain 3D vector for the given time. */
|
||||
struct aiVectorKey
|
||||
{
|
||||
struct aiVectorKey {
|
||||
/** The time of this key */
|
||||
double mTime;
|
||||
|
||||
@@ -75,34 +72,33 @@ struct aiVectorKey
|
||||
|
||||
/// @brief The default constructor.
|
||||
aiVectorKey() AI_NO_EXCEPT
|
||||
: mTime( 0.0 )
|
||||
, mValue() {
|
||||
: mTime(0.0),
|
||||
mValue() {
|
||||
// empty
|
||||
}
|
||||
|
||||
/// @brief Construction from a given time and key value.
|
||||
|
||||
aiVectorKey(double time, const aiVector3D& value)
|
||||
: mTime( time )
|
||||
, mValue( value ) {
|
||||
aiVectorKey(double time, const aiVector3D &value) :
|
||||
mTime(time), mValue(value) {
|
||||
// empty
|
||||
}
|
||||
|
||||
typedef aiVector3D elem_type;
|
||||
|
||||
// Comparison operators. For use with std::find();
|
||||
bool operator == (const aiVectorKey& rhs) const {
|
||||
bool operator==(const aiVectorKey &rhs) const {
|
||||
return rhs.mValue == this->mValue;
|
||||
}
|
||||
bool operator != (const aiVectorKey& rhs ) const {
|
||||
bool operator!=(const aiVectorKey &rhs) const {
|
||||
return rhs.mValue != this->mValue;
|
||||
}
|
||||
|
||||
// Relational operators. For use with std::sort();
|
||||
bool operator < (const aiVectorKey& rhs ) const {
|
||||
bool operator<(const aiVectorKey &rhs) const {
|
||||
return mTime < rhs.mTime;
|
||||
}
|
||||
bool operator > (const aiVectorKey& rhs ) const {
|
||||
bool operator>(const aiVectorKey &rhs) const {
|
||||
return mTime > rhs.mTime;
|
||||
}
|
||||
#endif // __cplusplus
|
||||
@@ -111,8 +107,7 @@ struct aiVectorKey
|
||||
// ---------------------------------------------------------------------------
|
||||
/** A time-value pair specifying a rotation for the given time.
|
||||
* Rotations are expressed with quaternions. */
|
||||
struct aiQuatKey
|
||||
{
|
||||
struct aiQuatKey {
|
||||
/** The time of this key */
|
||||
double mTime;
|
||||
|
||||
@@ -121,32 +116,30 @@ struct aiQuatKey
|
||||
|
||||
#ifdef __cplusplus
|
||||
aiQuatKey() AI_NO_EXCEPT
|
||||
: mTime( 0.0 )
|
||||
, mValue() {
|
||||
: mTime(0.0),
|
||||
mValue() {
|
||||
// empty
|
||||
}
|
||||
|
||||
/** Construction from a given time and key value */
|
||||
aiQuatKey(double time, const aiQuaternion& value)
|
||||
: mTime (time)
|
||||
, mValue (value)
|
||||
{}
|
||||
aiQuatKey(double time, const aiQuaternion &value) :
|
||||
mTime(time), mValue(value) {}
|
||||
|
||||
typedef aiQuaternion elem_type;
|
||||
|
||||
// Comparison operators. For use with std::find();
|
||||
bool operator == (const aiQuatKey& rhs ) const {
|
||||
bool operator==(const aiQuatKey &rhs) const {
|
||||
return rhs.mValue == this->mValue;
|
||||
}
|
||||
bool operator != (const aiQuatKey& rhs ) const {
|
||||
bool operator!=(const aiQuatKey &rhs) const {
|
||||
return rhs.mValue != this->mValue;
|
||||
}
|
||||
|
||||
// Relational operators. For use with std::sort();
|
||||
bool operator < (const aiQuatKey& rhs ) const {
|
||||
bool operator<(const aiQuatKey &rhs) const {
|
||||
return mTime < rhs.mTime;
|
||||
}
|
||||
bool operator > (const aiQuatKey& rhs ) const {
|
||||
bool operator>(const aiQuatKey &rhs) const {
|
||||
return mTime > rhs.mTime;
|
||||
}
|
||||
#endif
|
||||
@@ -154,8 +147,7 @@ struct aiQuatKey
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Binds a anim-mesh to a specific point in time. */
|
||||
struct aiMeshKey
|
||||
{
|
||||
struct aiMeshKey {
|
||||
/** The time of this key */
|
||||
double mTime;
|
||||
|
||||
@@ -168,32 +160,29 @@ struct aiMeshKey
|
||||
#ifdef __cplusplus
|
||||
|
||||
aiMeshKey() AI_NO_EXCEPT
|
||||
: mTime(0.0)
|
||||
, mValue(0)
|
||||
{
|
||||
: mTime(0.0),
|
||||
mValue(0) {
|
||||
}
|
||||
|
||||
/** Construction from a given time and key value */
|
||||
aiMeshKey(double time, const unsigned int value)
|
||||
: mTime (time)
|
||||
, mValue (value)
|
||||
{}
|
||||
aiMeshKey(double time, const unsigned int value) :
|
||||
mTime(time), mValue(value) {}
|
||||
|
||||
typedef unsigned int elem_type;
|
||||
|
||||
// Comparison operators. For use with std::find();
|
||||
bool operator == (const aiMeshKey& o) const {
|
||||
bool operator==(const aiMeshKey &o) const {
|
||||
return o.mValue == this->mValue;
|
||||
}
|
||||
bool operator != (const aiMeshKey& o) const {
|
||||
bool operator!=(const aiMeshKey &o) const {
|
||||
return o.mValue != this->mValue;
|
||||
}
|
||||
|
||||
// Relational operators. For use with std::sort();
|
||||
bool operator < (const aiMeshKey& o) const {
|
||||
bool operator<(const aiMeshKey &o) const {
|
||||
return mTime < o.mTime;
|
||||
}
|
||||
bool operator > (const aiMeshKey& o) const {
|
||||
bool operator>(const aiMeshKey &o) const {
|
||||
return mTime > o.mTime;
|
||||
}
|
||||
|
||||
@@ -202,8 +191,7 @@ struct aiMeshKey
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Binds a morph anim mesh to a specific point in time. */
|
||||
struct aiMeshMorphKey
|
||||
{
|
||||
struct aiMeshMorphKey {
|
||||
/** The time of this key */
|
||||
double mTime;
|
||||
|
||||
@@ -214,20 +202,17 @@ struct aiMeshMorphKey
|
||||
/** The number of values and weights */
|
||||
unsigned int mNumValuesAndWeights;
|
||||
#ifdef __cplusplus
|
||||
aiMeshMorphKey() AI_NO_EXCEPT
|
||||
: mTime(0.0)
|
||||
, mValues(nullptr)
|
||||
, mWeights(nullptr)
|
||||
, mNumValuesAndWeights(0)
|
||||
{
|
||||
aiMeshMorphKey() AI_NO_EXCEPT
|
||||
: mTime(0.0),
|
||||
mValues(nullptr),
|
||||
mWeights(nullptr),
|
||||
mNumValuesAndWeights(0) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
~aiMeshMorphKey()
|
||||
{
|
||||
~aiMeshMorphKey() {
|
||||
if (mNumValuesAndWeights && mValues && mWeights) {
|
||||
delete [] mValues;
|
||||
delete [] mWeights;
|
||||
delete[] mValues;
|
||||
delete[] mWeights;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -237,25 +222,24 @@ struct aiMeshMorphKey
|
||||
/** Defines how an animation channel behaves outside the defined time
|
||||
* range. This corresponds to aiNodeAnim::mPreState and
|
||||
* aiNodeAnim::mPostState.*/
|
||||
enum aiAnimBehaviour
|
||||
{
|
||||
enum aiAnimBehaviour {
|
||||
/** The value from the default node transformation is taken*/
|
||||
aiAnimBehaviour_DEFAULT = 0x0,
|
||||
aiAnimBehaviour_DEFAULT = 0x0,
|
||||
|
||||
/** The nearest key value is used without interpolation */
|
||||
aiAnimBehaviour_CONSTANT = 0x1,
|
||||
|
||||
/** The value of the nearest two keys is linearly
|
||||
* extrapolated for the current time value.*/
|
||||
aiAnimBehaviour_LINEAR = 0x2,
|
||||
aiAnimBehaviour_LINEAR = 0x2,
|
||||
|
||||
/** The animation is repeated.
|
||||
*
|
||||
* If the animation key go from n to m and the current
|
||||
* time is t, use the value at (t-n) % (|m-n|).*/
|
||||
aiAnimBehaviour_REPEAT = 0x3,
|
||||
aiAnimBehaviour_REPEAT = 0x3,
|
||||
|
||||
/** This value is not used, it is just here to force the
|
||||
/** 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
|
||||
_aiAnimBehaviour_Force32Bit = INT_MAX
|
||||
@@ -290,7 +274,7 @@ struct aiNodeAnim {
|
||||
*
|
||||
* If there are position keys, there will also be at least one
|
||||
* scaling and one rotation key.*/
|
||||
C_STRUCT aiVectorKey* mPositionKeys;
|
||||
C_STRUCT aiVectorKey *mPositionKeys;
|
||||
|
||||
/** The number of rotation keys */
|
||||
unsigned int mNumRotationKeys;
|
||||
@@ -301,7 +285,7 @@ struct aiNodeAnim {
|
||||
*
|
||||
* If there are rotation keys, there will also be at least one
|
||||
* scaling and one position key. */
|
||||
C_STRUCT aiQuatKey* mRotationKeys;
|
||||
C_STRUCT aiQuatKey *mRotationKeys;
|
||||
|
||||
/** The number of scaling keys */
|
||||
unsigned int mNumScalingKeys;
|
||||
@@ -311,7 +295,7 @@ struct aiNodeAnim {
|
||||
*
|
||||
* If there are scaling keys, there will also be at least one
|
||||
* position and one rotation key.*/
|
||||
C_STRUCT aiVectorKey* mScalingKeys;
|
||||
C_STRUCT aiVectorKey *mScalingKeys;
|
||||
|
||||
/** Defines how the animation behaves before the first
|
||||
* key is encountered.
|
||||
@@ -329,21 +313,21 @@ struct aiNodeAnim {
|
||||
|
||||
#ifdef __cplusplus
|
||||
aiNodeAnim() AI_NO_EXCEPT
|
||||
: mNumPositionKeys( 0 )
|
||||
, mPositionKeys( nullptr )
|
||||
, mNumRotationKeys( 0 )
|
||||
, mRotationKeys( nullptr )
|
||||
, mNumScalingKeys( 0 )
|
||||
, mScalingKeys( nullptr )
|
||||
, mPreState( aiAnimBehaviour_DEFAULT )
|
||||
, mPostState( aiAnimBehaviour_DEFAULT ) {
|
||||
// empty
|
||||
: mNumPositionKeys(0),
|
||||
mPositionKeys(nullptr),
|
||||
mNumRotationKeys(0),
|
||||
mRotationKeys(nullptr),
|
||||
mNumScalingKeys(0),
|
||||
mScalingKeys(nullptr),
|
||||
mPreState(aiAnimBehaviour_DEFAULT),
|
||||
mPostState(aiAnimBehaviour_DEFAULT) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~aiNodeAnim() {
|
||||
delete [] mPositionKeys;
|
||||
delete [] mRotationKeys;
|
||||
delete [] mScalingKeys;
|
||||
delete[] mPositionKeys;
|
||||
delete[] mRotationKeys;
|
||||
delete[] mScalingKeys;
|
||||
}
|
||||
#endif // __cplusplus
|
||||
};
|
||||
@@ -354,8 +338,7 @@ struct aiNodeAnim {
|
||||
* aiMesh::mAnimMeshes array. The purpose of aiMeshAnim is to
|
||||
* define keyframes linking each mesh attachment to a particular
|
||||
* point in time. */
|
||||
struct aiMeshAnim
|
||||
{
|
||||
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 wild-card to select a group
|
||||
@@ -366,17 +349,15 @@ struct aiMeshAnim
|
||||
unsigned int mNumKeys;
|
||||
|
||||
/** Key frames of the animation. May not be NULL. */
|
||||
C_STRUCT aiMeshKey* mKeys;
|
||||
C_STRUCT aiMeshKey *mKeys;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
aiMeshAnim() AI_NO_EXCEPT
|
||||
: mNumKeys()
|
||||
, mKeys()
|
||||
{}
|
||||
: mNumKeys(),
|
||||
mKeys() {}
|
||||
|
||||
~aiMeshAnim()
|
||||
{
|
||||
~aiMeshAnim() {
|
||||
delete[] mKeys;
|
||||
}
|
||||
|
||||
@@ -385,8 +366,7 @@ struct aiMeshAnim
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Describes a morphing animation of a given mesh. */
|
||||
struct aiMeshMorphAnim
|
||||
{
|
||||
struct aiMeshMorphAnim {
|
||||
/** 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
|
||||
@@ -397,17 +377,15 @@ struct aiMeshMorphAnim
|
||||
unsigned int mNumKeys;
|
||||
|
||||
/** Key frames of the animation. May not be NULL. */
|
||||
C_STRUCT aiMeshMorphKey* mKeys;
|
||||
C_STRUCT aiMeshMorphKey *mKeys;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
aiMeshMorphAnim() AI_NO_EXCEPT
|
||||
: mNumKeys()
|
||||
, mKeys()
|
||||
{}
|
||||
: mNumKeys(),
|
||||
mKeys() {}
|
||||
|
||||
~aiMeshMorphAnim()
|
||||
{
|
||||
~aiMeshMorphAnim() {
|
||||
delete[] mKeys;
|
||||
}
|
||||
|
||||
@@ -435,8 +413,7 @@ struct aiAnimation {
|
||||
|
||||
/** The node animation channels. Each channel affects a single node.
|
||||
* The array is mNumChannels in size. */
|
||||
C_STRUCT aiNodeAnim** mChannels;
|
||||
|
||||
C_STRUCT aiNodeAnim **mChannels;
|
||||
|
||||
/** The number of mesh animation channels. Each channel affects
|
||||
* a single mesh and defines vertex-based animation. */
|
||||
@@ -444,7 +421,7 @@ struct aiAnimation {
|
||||
|
||||
/** The mesh animation channels. Each channel affects a single mesh.
|
||||
* The array is mNumMeshChannels in size. */
|
||||
C_STRUCT aiMeshAnim** mMeshChannels;
|
||||
C_STRUCT aiMeshAnim **mMeshChannels;
|
||||
|
||||
/** The number of mesh animation channels. Each channel affects
|
||||
* a single mesh and defines morphing animation. */
|
||||
@@ -456,46 +433,45 @@ struct aiAnimation {
|
||||
|
||||
#ifdef __cplusplus
|
||||
aiAnimation() AI_NO_EXCEPT
|
||||
: mDuration(-1.)
|
||||
, mTicksPerSecond(0.)
|
||||
, mNumChannels(0)
|
||||
, mChannels(nullptr)
|
||||
, mNumMeshChannels(0)
|
||||
, mMeshChannels(nullptr)
|
||||
, mNumMorphMeshChannels(0)
|
||||
, mMorphMeshChannels(nullptr) {
|
||||
: mDuration(-1.),
|
||||
mTicksPerSecond(0.),
|
||||
mNumChannels(0),
|
||||
mChannels(nullptr),
|
||||
mNumMeshChannels(0),
|
||||
mMeshChannels(nullptr),
|
||||
mNumMorphMeshChannels(0),
|
||||
mMorphMeshChannels(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~aiAnimation() {
|
||||
// DO NOT REMOVE THIS ADDITIONAL CHECK
|
||||
if ( mNumChannels && mChannels ) {
|
||||
for( unsigned int a = 0; a < mNumChannels; a++) {
|
||||
delete mChannels[ a ];
|
||||
if (mNumChannels && mChannels) {
|
||||
for (unsigned int a = 0; a < mNumChannels; a++) {
|
||||
delete mChannels[a];
|
||||
}
|
||||
|
||||
delete [] mChannels;
|
||||
delete[] mChannels;
|
||||
}
|
||||
if (mNumMeshChannels && mMeshChannels) {
|
||||
for( unsigned int a = 0; a < mNumMeshChannels; a++) {
|
||||
if (mNumMeshChannels && mMeshChannels) {
|
||||
for (unsigned int a = 0; a < mNumMeshChannels; a++) {
|
||||
delete mMeshChannels[a];
|
||||
}
|
||||
|
||||
delete [] mMeshChannels;
|
||||
delete[] mMeshChannels;
|
||||
}
|
||||
if (mNumMorphMeshChannels && mMorphMeshChannels) {
|
||||
for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) {
|
||||
delete mMorphMeshChannels[a];
|
||||
}
|
||||
|
||||
delete [] mMorphMeshChannels;
|
||||
for (unsigned int a = 0; a < mNumMorphMeshChannels; a++) {
|
||||
delete mMorphMeshChannels[a];
|
||||
}
|
||||
|
||||
delete[] mMorphMeshChannels;
|
||||
}
|
||||
}
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
}
|
||||
|
||||
/// @brief Some C++ utilities for inter- and extrapolation
|
||||
@@ -509,72 +485,66 @@ namespace Assimp {
|
||||
* types of the arguments.
|
||||
*/
|
||||
template <typename T>
|
||||
struct Interpolator
|
||||
{
|
||||
struct Interpolator {
|
||||
// ------------------------------------------------------------------
|
||||
/** @brief Get the result of the interpolation between a,b.
|
||||
*
|
||||
* 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, ai_real d) const {
|
||||
out = a + (b-a)*d;
|
||||
void operator()(T &anim_out, const T &a, const T &b, ai_real d) const {
|
||||
anim_out = a + (b - a) * d;
|
||||
}
|
||||
}; // ! Interpolator <T>
|
||||
|
||||
//! @cond Never
|
||||
|
||||
template <>
|
||||
struct Interpolator <aiQuaternion> {
|
||||
void operator () (aiQuaternion& out,const aiQuaternion& a,
|
||||
const aiQuaternion& b, ai_real d) const
|
||||
{
|
||||
aiQuaternion::Interpolate(out,a,b,d);
|
||||
struct Interpolator<aiQuaternion> {
|
||||
void operator()(aiQuaternion &out, const aiQuaternion &a,
|
||||
const aiQuaternion &b, ai_real d) const {
|
||||
aiQuaternion::Interpolate(out, a, b, d);
|
||||
}
|
||||
}; // ! Interpolator <aiQuaternion>
|
||||
|
||||
template <>
|
||||
struct Interpolator <unsigned int> {
|
||||
void operator () (unsigned int& out,unsigned int a,
|
||||
unsigned int b, ai_real d) const
|
||||
{
|
||||
out = d>0.5f ? b : a;
|
||||
struct Interpolator<unsigned int> {
|
||||
void operator()(unsigned int &out, unsigned int a,
|
||||
unsigned int b, ai_real d) const {
|
||||
out = d > 0.5f ? b : a;
|
||||
}
|
||||
}; // ! Interpolator <aiQuaternion>
|
||||
|
||||
template <>
|
||||
struct Interpolator<aiVectorKey> {
|
||||
void operator () (aiVector3D& out,const aiVectorKey& a,
|
||||
const aiVectorKey& b, ai_real d) const
|
||||
{
|
||||
struct Interpolator<aiVectorKey> {
|
||||
void operator()(aiVector3D &out, const aiVectorKey &a,
|
||||
const aiVectorKey &b, ai_real d) const {
|
||||
Interpolator<aiVector3D> ipl;
|
||||
ipl(out,a.mValue,b.mValue,d);
|
||||
ipl(out, a.mValue, b.mValue, d);
|
||||
}
|
||||
}; // ! Interpolator <aiVectorKey>
|
||||
|
||||
template <>
|
||||
struct Interpolator<aiQuatKey> {
|
||||
void operator () (aiQuaternion& out, const aiQuatKey& a,
|
||||
const aiQuatKey& b, ai_real d) const
|
||||
{
|
||||
struct Interpolator<aiQuatKey> {
|
||||
void operator()(aiQuaternion &out, const aiQuatKey &a,
|
||||
const aiQuatKey &b, ai_real d) const {
|
||||
Interpolator<aiQuaternion> ipl;
|
||||
ipl(out,a.mValue,b.mValue,d);
|
||||
ipl(out, a.mValue, b.mValue, d);
|
||||
}
|
||||
}; // ! Interpolator <aiQuatKey>
|
||||
|
||||
template <>
|
||||
struct Interpolator<aiMeshKey> {
|
||||
void operator () (unsigned int& out, const aiMeshKey& a,
|
||||
const aiMeshKey& b, ai_real d) const
|
||||
{
|
||||
struct Interpolator<aiMeshKey> {
|
||||
void operator()(unsigned int &out, const aiMeshKey &a,
|
||||
const aiMeshKey &b, ai_real d) const {
|
||||
Interpolator<unsigned int> ipl;
|
||||
ipl(out,a.mValue,b.mValue,d);
|
||||
ipl(out, a.mValue, b.mValue, d);
|
||||
}
|
||||
}; // ! Interpolator <aiQuatKey>
|
||||
|
||||
//! @endcond
|
||||
|
||||
} // ! end namespace Assimp
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
@@ -171,15 +171,26 @@ struct aiCamera
|
||||
*/
|
||||
float mAspect;
|
||||
|
||||
/** Half horizontal orthographic width, in scene units.
|
||||
*
|
||||
* The orthographic width specifies the half width of the
|
||||
* orthographic view box. If non-zero the camera is
|
||||
* orthographic and the mAspect should define to the
|
||||
* ratio between the orthographic width and height
|
||||
* and mHorizontalFOV should be set to 0.
|
||||
* The default value is 0 (not orthographic).
|
||||
*/
|
||||
float mOrthographicWidth;
|
||||
#ifdef __cplusplus
|
||||
|
||||
aiCamera() AI_NO_EXCEPT
|
||||
: mUp (0.f,1.f,0.f)
|
||||
, mLookAt (0.f,0.f,1.f)
|
||||
, mHorizontalFOV (0.25f * (float)AI_MATH_PI)
|
||||
, mClipPlaneNear (0.1f)
|
||||
, mClipPlaneFar (1000.f)
|
||||
, mAspect (0.f)
|
||||
: mUp (0.f,1.f,0.f)
|
||||
, mLookAt (0.f,0.f,1.f)
|
||||
, mHorizontalFOV (0.25f * (float)AI_MATH_PI)
|
||||
, mClipPlaneNear (0.1f)
|
||||
, mClipPlaneFar (1000.f)
|
||||
, mAspect (0.f)
|
||||
, mOrthographicWidth (0.f)
|
||||
{}
|
||||
|
||||
/** @brief Get a *right-handed* camera matrix from me
|
||||
|
||||
@@ -47,42 +47,42 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_EXPORT_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
// Public ASSIMP data structures
|
||||
#include <assimp/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct aiScene; // aiScene.h
|
||||
struct aiFileIO; // aiFileIO.h
|
||||
struct aiScene;
|
||||
struct aiFileIO;
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Describes an file format which Assimp can export to. Use #aiGetExportFormatCount() to
|
||||
* learn how many export formats the current Assimp build supports and #aiGetExportFormatDescription()
|
||||
* to retrieve a description of an export format option.
|
||||
*/
|
||||
struct aiExportFormatDesc
|
||||
{
|
||||
/**
|
||||
* @brief Describes an file format which Assimp can export to.
|
||||
*
|
||||
* Use #aiGetExportFormatCount() to learn how many export-formats are supported by
|
||||
* the current Assimp-build and #aiGetExportFormatDescription() to retrieve the
|
||||
* description of the export format option.
|
||||
*/
|
||||
struct aiExportFormatDesc {
|
||||
/// a short string ID to uniquely identify the export format. Use this ID string to
|
||||
/// specify which file format you want to export to when calling #aiExportScene().
|
||||
/// Example: "dae" or "obj"
|
||||
const char* id;
|
||||
const char *id;
|
||||
|
||||
/// A short description of the file format to present to users. Useful if you want
|
||||
/// to allow the user to select an export format.
|
||||
const char* description;
|
||||
const char *description;
|
||||
|
||||
/// Recommended file extension for the exported file in lower case.
|
||||
const char* fileExtension;
|
||||
const char *fileExtension;
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Returns the number of export file formats available in the current Assimp build.
|
||||
* Use aiGetExportFormatDescription() to retrieve infos of a specific export format.
|
||||
@@ -97,14 +97,14 @@ ASSIMP_API size_t aiGetExportFormatCount(void);
|
||||
* 0 to #aiGetExportFormatCount()
|
||||
* @return A description of that specific export format. NULL if pIndex is out of range.
|
||||
*/
|
||||
ASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex);
|
||||
ASSIMP_API const C_STRUCT aiExportFormatDesc *aiGetExportFormatDescription(size_t pIndex);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Release a description of the nth export file format. Must be returned by
|
||||
* aiGetExportFormatDescription
|
||||
* @param desc Pointer to the description
|
||||
*/
|
||||
ASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatDesc *desc );
|
||||
ASSIMP_API void aiReleaseExportFormatDescription(const C_STRUCT aiExportFormatDesc *desc);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Create a modifiable copy of a scene.
|
||||
@@ -115,13 +115,12 @@ ASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatD
|
||||
* @param pOut Receives a modifyable copy of the scene. Use aiFreeScene() to
|
||||
* delete it again.
|
||||
*/
|
||||
ASSIMP_API void aiCopyScene(const C_STRUCT aiScene* pIn,
|
||||
C_STRUCT aiScene** pOut);
|
||||
|
||||
ASSIMP_API void aiCopyScene(const C_STRUCT aiScene *pIn,
|
||||
C_STRUCT aiScene **pOut);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Frees a scene copy created using aiCopyScene() */
|
||||
ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);
|
||||
ASSIMP_API void aiFreeScene(const C_STRUCT aiScene *pIn);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Exports the given scene to a chosen file format and writes the result file(s) to disk.
|
||||
@@ -154,19 +153,18 @@ ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);
|
||||
* triangulate data so they would run the step anyway.
|
||||
*
|
||||
* 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 a status code indicating the result of the export
|
||||
* @note Use aiCopyScene() to get a modifiable copy of a previously
|
||||
* imported scene.
|
||||
*/
|
||||
ASSIMP_API aiReturn aiExportScene( const C_STRUCT aiScene* pScene,
|
||||
const char* pFormatId,
|
||||
const char* pFileName,
|
||||
unsigned int pPreprocessing);
|
||||
|
||||
ASSIMP_API aiReturn aiExportScene(const C_STRUCT aiScene *pScene,
|
||||
const char *pFormatId,
|
||||
const char *pFileName,
|
||||
unsigned int pPreprocessing);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Exports the given scene to a chosen file format using custom IO logic supplied by you.
|
||||
@@ -183,11 +181,11 @@ ASSIMP_API aiReturn aiExportScene( const C_STRUCT aiScene* pScene,
|
||||
* @note Use aiCopyScene() to get a modifiable copy of a previously
|
||||
* imported scene.
|
||||
*/
|
||||
ASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene,
|
||||
const char* pFormatId,
|
||||
const char* pFileName,
|
||||
C_STRUCT aiFileIO* pIO,
|
||||
unsigned int pPreprocessing );
|
||||
ASSIMP_API aiReturn aiExportSceneEx(const C_STRUCT aiScene *pScene,
|
||||
const char *pFormatId,
|
||||
const char *pFileName,
|
||||
C_STRUCT aiFileIO *pIO,
|
||||
unsigned int pPreprocessing);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Describes a blob of exported scene data. Use #aiExportSceneToBlob() to create a blob containing an
|
||||
@@ -199,13 +197,12 @@ ASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene,
|
||||
* This is used when exporters write more than one output file for a given #aiScene. See the remarks for
|
||||
* #aiExportDataBlob::name for more information.
|
||||
*/
|
||||
struct aiExportDataBlob
|
||||
{
|
||||
struct aiExportDataBlob {
|
||||
/// Size of the data in bytes
|
||||
size_t size;
|
||||
|
||||
/// The data.
|
||||
void* data;
|
||||
void *data;
|
||||
|
||||
/** Name of the blob. An empty string always
|
||||
indicates the first (and primary) blob,
|
||||
@@ -222,18 +219,23 @@ struct aiExportDataBlob
|
||||
C_STRUCT aiString name;
|
||||
|
||||
/** Pointer to the next blob in the chain or NULL if there is none. */
|
||||
C_STRUCT aiExportDataBlob * next;
|
||||
C_STRUCT aiExportDataBlob *next;
|
||||
|
||||
#ifdef __cplusplus
|
||||
/// Default constructor
|
||||
aiExportDataBlob() { size = 0; data = next = NULL; }
|
||||
aiExportDataBlob() {
|
||||
size = 0;
|
||||
data = next = nullptr;
|
||||
}
|
||||
/// Releases the data
|
||||
~aiExportDataBlob() { delete [] static_cast<unsigned char*>( data ); delete next; }
|
||||
~aiExportDataBlob() {
|
||||
delete[] static_cast<unsigned char *>(data);
|
||||
delete next;
|
||||
}
|
||||
|
||||
aiExportDataBlob(const aiExportDataBlob &) = delete;
|
||||
aiExportDataBlob &operator=(const aiExportDataBlob &) = delete;
|
||||
|
||||
private:
|
||||
// no copying
|
||||
aiExportDataBlob(const aiExportDataBlob& );
|
||||
aiExportDataBlob& operator= (const aiExportDataBlob& );
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
@@ -247,15 +249,15 @@ private:
|
||||
* @param pPreprocessing Please see the documentation for #aiExportScene
|
||||
* @return the exported data or NULL in case of error
|
||||
*/
|
||||
ASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const C_STRUCT aiScene* pScene, const char* pFormatId,
|
||||
unsigned int pPreprocessing );
|
||||
ASSIMP_API const C_STRUCT aiExportDataBlob *aiExportSceneToBlob(const C_STRUCT aiScene *pScene, const char *pFormatId,
|
||||
unsigned int pPreprocessing);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Releases the memory associated with the given exported data. Use this function to free a data blob
|
||||
* returned by aiExportScene().
|
||||
* @param pData the data blob returned by #aiExportSceneToBlob
|
||||
*/
|
||||
ASSIMP_API void aiReleaseExportBlob( const C_STRUCT aiExportDataBlob* pData );
|
||||
ASSIMP_API void aiReleaseExportBlob(const C_STRUCT aiExportDataBlob *pData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -562,6 +562,675 @@ ASSIMP_API size_t aiGetImportFormatCount(void);
|
||||
* @return A description of that specific import format. NULL if pIndex is out of range.
|
||||
*/
|
||||
ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImportFormatDescription( size_t pIndex);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 2D vectors are equal.
|
||||
* @param a First vector to compare
|
||||
* @param b Second vector to compare
|
||||
* @return 1 if the vectors are equal
|
||||
* @return 0 if the vectors are not equal
|
||||
*/
|
||||
ASSIMP_API int aiVector2AreEqual(
|
||||
const C_STRUCT aiVector2D* a,
|
||||
const C_STRUCT aiVector2D* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 2D vectors are equal using epsilon.
|
||||
* @param a First vector to compare
|
||||
* @param b Second vector to compare
|
||||
* @param epsilon Epsilon
|
||||
* @return 1 if the vectors are equal
|
||||
* @return 0 if the vectors are not equal
|
||||
*/
|
||||
ASSIMP_API int aiVector2AreEqualEpsilon(
|
||||
const C_STRUCT aiVector2D* a,
|
||||
const C_STRUCT aiVector2D* b,
|
||||
const float epsilon);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Add 2D vectors.
|
||||
* @param dst First addend, receives result.
|
||||
* @param src Vector to be added to 'dst'.
|
||||
*/
|
||||
ASSIMP_API void aiVector2Add(
|
||||
C_STRUCT aiVector2D* dst,
|
||||
const C_STRUCT aiVector2D* src);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Subtract 2D vectors.
|
||||
* @param dst Minuend, receives result.
|
||||
* @param src Vector to be subtracted from 'dst'.
|
||||
*/
|
||||
ASSIMP_API void aiVector2Subtract(
|
||||
C_STRUCT aiVector2D* dst,
|
||||
const C_STRUCT aiVector2D* src);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Multiply a 2D vector by a scalar.
|
||||
* @param dst Vector to be scaled by \p s
|
||||
* @param s Scale factor
|
||||
*/
|
||||
ASSIMP_API void aiVector2Scale(
|
||||
C_STRUCT aiVector2D* dst,
|
||||
const float s);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Multiply each component of a 2D vector with
|
||||
* the components of another vector.
|
||||
* @param dst First vector, receives result
|
||||
* @param other Second vector
|
||||
*/
|
||||
ASSIMP_API void aiVector2SymMul(
|
||||
C_STRUCT aiVector2D* dst,
|
||||
const C_STRUCT aiVector2D* other);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Divide a 2D vector by a scalar.
|
||||
* @param dst Vector to be divided by \p s
|
||||
* @param s Scalar divisor
|
||||
*/
|
||||
ASSIMP_API void aiVector2DivideByScalar(
|
||||
C_STRUCT aiVector2D* dst,
|
||||
const float s);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Divide each component of a 2D vector by
|
||||
* the components of another vector.
|
||||
* @param dst Vector as the dividend
|
||||
* @param v Vector as the divisor
|
||||
*/
|
||||
ASSIMP_API void aiVector2DivideByVector(
|
||||
C_STRUCT aiVector2D* dst,
|
||||
C_STRUCT aiVector2D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the length of a 2D vector.
|
||||
* @return v Vector to evaluate
|
||||
*/
|
||||
ASSIMP_API float aiVector2Length(
|
||||
const C_STRUCT aiVector2D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the squared length of a 2D vector.
|
||||
* @return v Vector to evaluate
|
||||
*/
|
||||
ASSIMP_API float aiVector2SquareLength(
|
||||
const C_STRUCT aiVector2D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Negate a 2D vector.
|
||||
* @param dst Vector to be negated
|
||||
*/
|
||||
ASSIMP_API void aiVector2Negate(
|
||||
C_STRUCT aiVector2D* dst);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the dot product of 2D vectors.
|
||||
* @param a First vector
|
||||
* @param b Second vector
|
||||
* @return The dot product of vectors
|
||||
*/
|
||||
ASSIMP_API float aiVector2DotProduct(
|
||||
const C_STRUCT aiVector2D* a,
|
||||
const C_STRUCT aiVector2D* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Normalize a 2D vector.
|
||||
* @param v Vector to normalize
|
||||
*/
|
||||
ASSIMP_API void aiVector2Normalize(
|
||||
C_STRUCT aiVector2D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 3D vectors are equal.
|
||||
* @param a First vector to compare
|
||||
* @param b Second vector to compare
|
||||
* @return 1 if the vectors are equal
|
||||
* @return 0 if the vectors are not equal
|
||||
*/
|
||||
ASSIMP_API int aiVector3AreEqual(
|
||||
const C_STRUCT aiVector3D* a,
|
||||
const C_STRUCT aiVector3D* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 3D vectors are equal using epsilon.
|
||||
* @param a First vector to compare
|
||||
* @param b Second vector to compare
|
||||
* @param epsilon Epsilon
|
||||
* @return 1 if the vectors are equal
|
||||
* @return 0 if the vectors are not equal
|
||||
*/
|
||||
ASSIMP_API int aiVector3AreEqualEpsilon(
|
||||
const C_STRUCT aiVector3D* a,
|
||||
const C_STRUCT aiVector3D* b,
|
||||
const float epsilon);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if vector \p a is less than vector \p b.
|
||||
* @param a First vector to compare
|
||||
* @param b Second vector to compare
|
||||
* @param epsilon Epsilon
|
||||
* @return 1 if \p a is less than \p b
|
||||
* @return 0 if \p a is equal or greater than \p b
|
||||
*/
|
||||
ASSIMP_API int aiVector3LessThan(
|
||||
const C_STRUCT aiVector3D* a,
|
||||
const C_STRUCT aiVector3D* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Add 3D vectors.
|
||||
* @param dst First addend, receives result.
|
||||
* @param src Vector to be added to 'dst'.
|
||||
*/
|
||||
ASSIMP_API void aiVector3Add(
|
||||
C_STRUCT aiVector3D* dst,
|
||||
const C_STRUCT aiVector3D* src);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Subtract 3D vectors.
|
||||
* @param dst Minuend, receives result.
|
||||
* @param src Vector to be subtracted from 'dst'.
|
||||
*/
|
||||
ASSIMP_API void aiVector3Subtract(
|
||||
C_STRUCT aiVector3D* dst,
|
||||
const C_STRUCT aiVector3D* src);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Multiply a 3D vector by a scalar.
|
||||
* @param dst Vector to be scaled by \p s
|
||||
* @param s Scale factor
|
||||
*/
|
||||
ASSIMP_API void aiVector3Scale(
|
||||
C_STRUCT aiVector3D* dst,
|
||||
const float s);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Multiply each component of a 3D vector with
|
||||
* the components of another vector.
|
||||
* @param dst First vector, receives result
|
||||
* @param other Second vector
|
||||
*/
|
||||
ASSIMP_API void aiVector3SymMul(
|
||||
C_STRUCT aiVector3D* dst,
|
||||
const C_STRUCT aiVector3D* other);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Divide a 3D vector by a scalar.
|
||||
* @param dst Vector to be divided by \p s
|
||||
* @param s Scalar divisor
|
||||
*/
|
||||
ASSIMP_API void aiVector3DivideByScalar(
|
||||
C_STRUCT aiVector3D* dst,
|
||||
const float s);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Divide each component of a 3D vector by
|
||||
* the components of another vector.
|
||||
* @param dst Vector as the dividend
|
||||
* @param v Vector as the divisor
|
||||
*/
|
||||
ASSIMP_API void aiVector3DivideByVector(
|
||||
C_STRUCT aiVector3D* dst,
|
||||
C_STRUCT aiVector3D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the length of a 3D vector.
|
||||
* @return v Vector to evaluate
|
||||
*/
|
||||
ASSIMP_API float aiVector3Length(
|
||||
const C_STRUCT aiVector3D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the squared length of a 3D vector.
|
||||
* @return v Vector to evaluate
|
||||
*/
|
||||
ASSIMP_API float aiVector3SquareLength(
|
||||
const C_STRUCT aiVector3D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Negate a 3D vector.
|
||||
* @param dst Vector to be negated
|
||||
*/
|
||||
ASSIMP_API void aiVector3Negate(
|
||||
C_STRUCT aiVector3D* dst);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the dot product of 3D vectors.
|
||||
* @param a First vector
|
||||
* @param b Second vector
|
||||
* @return The dot product of vectors
|
||||
*/
|
||||
ASSIMP_API float aiVector3DotProduct(
|
||||
const C_STRUCT aiVector3D* a,
|
||||
const C_STRUCT aiVector3D* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get cross product of 3D vectors.
|
||||
* @param dst Vector to receive the result.
|
||||
* @param a First vector
|
||||
* @param b Second vector
|
||||
* @return The dot product of vectors
|
||||
*/
|
||||
ASSIMP_API void aiVector3CrossProduct(
|
||||
C_STRUCT aiVector3D* dst,
|
||||
const C_STRUCT aiVector3D* a,
|
||||
const C_STRUCT aiVector3D* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Normalize a 3D vector.
|
||||
* @param v Vector to normalize
|
||||
*/
|
||||
ASSIMP_API void aiVector3Normalize(
|
||||
C_STRUCT aiVector3D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check for division by zero and normalize a 3D vector.
|
||||
* @param v Vector to normalize
|
||||
*/
|
||||
ASSIMP_API void aiVector3NormalizeSafe(
|
||||
C_STRUCT aiVector3D* v);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Rotate a 3D vector by a quaternion.
|
||||
* @param v The vector to rotate by \p q
|
||||
* @param q Quaternion to use to rotate \p v
|
||||
*/
|
||||
ASSIMP_API void aiVector3RotateByQuaternion(
|
||||
C_STRUCT aiVector3D* v,
|
||||
const C_STRUCT aiQuaternion* q);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Construct a 3x3 matrix from a 4x4 matrix.
|
||||
* @param dst Receives the output matrix
|
||||
* @param mat The 4x4 matrix to use
|
||||
*/
|
||||
ASSIMP_API void aiMatrix3FromMatrix4(
|
||||
C_STRUCT aiMatrix3x3* dst,
|
||||
const C_STRUCT aiMatrix4x4* mat);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Construct a 3x3 matrix from a quaternion.
|
||||
* @param mat Receives the output matrix
|
||||
* @param q The quaternion matrix to use
|
||||
*/
|
||||
ASSIMP_API void aiMatrix3FromQuaternion(
|
||||
C_STRUCT aiMatrix3x3* mat,
|
||||
const C_STRUCT aiQuaternion* q);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 3x3 matrices are equal.
|
||||
* @param a First matrix to compare
|
||||
* @param b Second matrix to compare
|
||||
* @return 1 if the matrices are equal
|
||||
* @return 0 if the matrices are not equal
|
||||
*/
|
||||
ASSIMP_API int aiMatrix3AreEqual(
|
||||
const C_STRUCT aiMatrix3x3* a,
|
||||
const C_STRUCT aiMatrix3x3* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 3x3 matrices are equal.
|
||||
* @param a First matrix to compare
|
||||
* @param b Second matrix to compare
|
||||
* @param epsilon Epsilon
|
||||
* @return 1 if the matrices are equal
|
||||
* @return 0 if the matrices are not equal
|
||||
*/
|
||||
ASSIMP_API int aiMatrix3AreEqualEpsilon(
|
||||
const C_STRUCT aiMatrix3x3* a,
|
||||
const C_STRUCT aiMatrix3x3* b,
|
||||
const float epsilon);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Invert a 3x3 matrix.
|
||||
* @param mat Matrix to invert
|
||||
*/
|
||||
ASSIMP_API void aiMatrix3Inverse(
|
||||
C_STRUCT aiMatrix3x3* mat);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the determinant of a 3x3 matrix.
|
||||
* @param mat Matrix to get the determinant from
|
||||
*/
|
||||
ASSIMP_API float aiMatrix3Determinant(
|
||||
const C_STRUCT aiMatrix3x3* mat);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get a 3x3 rotation matrix around the Z axis.
|
||||
* @param mat Receives the output matrix
|
||||
* @param angle Rotation angle, in radians
|
||||
*/
|
||||
ASSIMP_API void aiMatrix3RotationZ(
|
||||
C_STRUCT aiMatrix3x3* mat,
|
||||
const float angle);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Returns a 3x3 rotation matrix for a rotation around an arbitrary axis.
|
||||
* @param mat Receives the output matrix
|
||||
* @param axis Rotation axis, should be a normalized vector
|
||||
* @param angle Rotation angle, in radians
|
||||
*/
|
||||
ASSIMP_API void aiMatrix3FromRotationAroundAxis(
|
||||
C_STRUCT aiMatrix3x3* mat,
|
||||
const C_STRUCT aiVector3D* axis,
|
||||
const float angle);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get a 3x3 translation matrix.
|
||||
* @param mat Receives the output matrix
|
||||
* @param translation The translation vector
|
||||
*/
|
||||
ASSIMP_API void aiMatrix3Translation(
|
||||
C_STRUCT aiMatrix3x3* mat,
|
||||
const C_STRUCT aiVector2D* translation);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Create a 3x3 matrix that rotates one vector to another vector.
|
||||
* @param mat Receives the output matrix
|
||||
* @param from Vector to rotate from
|
||||
* @param to Vector to rotate to
|
||||
*/
|
||||
ASSIMP_API void aiMatrix3FromTo(
|
||||
C_STRUCT aiMatrix3x3* mat,
|
||||
const C_STRUCT aiVector3D* from,
|
||||
const C_STRUCT aiVector3D* to);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Construct a 4x4 matrix from a 3x3 matrix.
|
||||
* @param dst Receives the output matrix
|
||||
* @param mat The 3x3 matrix to use
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4FromMatrix3(
|
||||
C_STRUCT aiMatrix4x4* dst,
|
||||
const C_STRUCT aiMatrix3x3* mat);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Construct a 4x4 matrix from scaling, rotation and position.
|
||||
* @param mat Receives the output matrix.
|
||||
* @param scaling The scaling for the x,y,z axes
|
||||
* @param rotation The rotation as a hamilton quaternion
|
||||
* @param position The position for the x,y,z axes
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4FromScalingQuaternionPosition(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const C_STRUCT aiVector3D* scaling,
|
||||
const C_STRUCT aiQuaternion* rotation,
|
||||
const C_STRUCT aiVector3D* position);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Add 4x4 matrices.
|
||||
* @param dst First addend, receives result.
|
||||
* @param src Matrix to be added to 'dst'.
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4Add(
|
||||
C_STRUCT aiMatrix4x4* dst,
|
||||
const C_STRUCT aiMatrix4x4* src);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 4x4 matrices are equal.
|
||||
* @param a First matrix to compare
|
||||
* @param b Second matrix to compare
|
||||
* @return 1 if the matrices are equal
|
||||
* @return 0 if the matrices are not equal
|
||||
*/
|
||||
ASSIMP_API int aiMatrix4AreEqual(
|
||||
const C_STRUCT aiMatrix4x4* a,
|
||||
const C_STRUCT aiMatrix4x4* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if 4x4 matrices are equal.
|
||||
* @param a First matrix to compare
|
||||
* @param b Second matrix to compare
|
||||
* @param epsilon Epsilon
|
||||
* @return 1 if the matrices are equal
|
||||
* @return 0 if the matrices are not equal
|
||||
*/
|
||||
ASSIMP_API int aiMatrix4AreEqualEpsilon(
|
||||
const C_STRUCT aiMatrix4x4* a,
|
||||
const C_STRUCT aiMatrix4x4* b,
|
||||
const float epsilon);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Invert a 4x4 matrix.
|
||||
* @param result Matrix to invert
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4Inverse(
|
||||
C_STRUCT aiMatrix4x4* mat);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get the determinant of a 4x4 matrix.
|
||||
* @param mat Matrix to get the determinant from
|
||||
* @return The determinant of the matrix
|
||||
*/
|
||||
ASSIMP_API float aiMatrix4Determinant(
|
||||
const C_STRUCT aiMatrix4x4* mat);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Returns true of the matrix is the identity matrix.
|
||||
* @param mat Matrix to get the determinant from
|
||||
* @return 1 if \p mat is an identity matrix.
|
||||
* @return 0 if \p mat is not an identity matrix.
|
||||
*/
|
||||
ASSIMP_API int aiMatrix4IsIdentity(
|
||||
const C_STRUCT aiMatrix4x4* mat);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Decompose a transformation matrix into its scaling,
|
||||
* rotational as euler angles, and translational components.
|
||||
*
|
||||
* @param mat Matrix to decompose
|
||||
* @param scaling Receives the output scaling for the x,y,z axes
|
||||
* @param rotation Receives the output rotation as a Euler angles
|
||||
* @param position Receives the output position for the x,y,z axes
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4DecomposeIntoScalingEulerAnglesPosition(
|
||||
const C_STRUCT aiMatrix4x4* mat,
|
||||
C_STRUCT aiVector3D* scaling,
|
||||
C_STRUCT aiVector3D* rotation,
|
||||
C_STRUCT aiVector3D* position);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Decompose a transformation matrix into its scaling,
|
||||
* rotational split into an axis and rotational angle,
|
||||
* and it's translational components.
|
||||
*
|
||||
* @param mat Matrix to decompose
|
||||
* @param rotation Receives the rotational component
|
||||
* @param axis Receives the output rotation axis
|
||||
* @param angle Receives the output rotation angle
|
||||
* @param position Receives the output position for the x,y,z axes.
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4DecomposeIntoScalingAxisAnglePosition(
|
||||
const C_STRUCT aiMatrix4x4* mat,
|
||||
C_STRUCT aiVector3D* scaling,
|
||||
C_STRUCT aiVector3D* axis,
|
||||
float* angle,
|
||||
C_STRUCT aiVector3D* position);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Decompose a transformation matrix into its rotational and
|
||||
* translational components.
|
||||
*
|
||||
* @param mat Matrix to decompose
|
||||
* @param rotation Receives the rotational component
|
||||
* @param position Receives the translational component.
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4DecomposeNoScaling(
|
||||
const C_STRUCT aiMatrix4x4* mat,
|
||||
C_STRUCT aiQuaternion* rotation,
|
||||
C_STRUCT aiVector3D* position);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Creates a 4x4 matrix from a set of euler angles.
|
||||
* @param mat Receives the output matrix
|
||||
* @param x Rotation angle for the x-axis, in radians
|
||||
* @param y Rotation angle for the y-axis, in radians
|
||||
* @param z Rotation angle for the z-axis, in radians
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4FromEulerAngles(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
float x, float y, float z);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get a 4x4 rotation matrix around the X axis.
|
||||
* @param mat Receives the output matrix
|
||||
* @param angle Rotation angle, in radians
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4RotationX(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const float angle);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get a 4x4 rotation matrix around the Y axis.
|
||||
* @param mat Receives the output matrix
|
||||
* @param angle Rotation angle, in radians
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4RotationY(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const float angle);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get a 4x4 rotation matrix around the Z axis.
|
||||
* @param mat Receives the output matrix
|
||||
* @param angle Rotation angle, in radians
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4RotationZ(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const float angle);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Returns a 4x4 rotation matrix for a rotation around an arbitrary axis.
|
||||
* @param mat Receives the output matrix
|
||||
* @param axis Rotation axis, should be a normalized vector
|
||||
* @param angle Rotation angle, in radians
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4FromRotationAroundAxis(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const C_STRUCT aiVector3D* axis,
|
||||
const float angle);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get a 4x4 translation matrix.
|
||||
* @param mat Receives the output matrix
|
||||
* @param translation The translation vector
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4Translation(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const C_STRUCT aiVector3D* translation);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Get a 4x4 scaling matrix.
|
||||
* @param mat Receives the output matrix
|
||||
* @param scaling The scaling vector
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4Scaling(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const C_STRUCT aiVector3D* scaling);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Create a 4x4 matrix that rotates one vector to another vector.
|
||||
* @param mat Receives the output matrix
|
||||
* @param from Vector to rotate from
|
||||
* @param to Vector to rotate to
|
||||
*/
|
||||
ASSIMP_API void aiMatrix4FromTo(
|
||||
C_STRUCT aiMatrix4x4* mat,
|
||||
const C_STRUCT aiVector3D* from,
|
||||
const C_STRUCT aiVector3D* to);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Create a Quaternion from euler angles.
|
||||
* @param q Receives the output quaternion
|
||||
* @param x Rotation angle for the x-axis, in radians
|
||||
* @param y Rotation angle for the y-axis, in radians
|
||||
* @param z Rotation angle for the z-axis, in radians
|
||||
*/
|
||||
ASSIMP_API void aiQuaternionFromEulerAngles(
|
||||
C_STRUCT aiQuaternion* q,
|
||||
float x, float y, float z);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Create a Quaternion from an axis angle pair.
|
||||
* @param q Receives the output quaternion
|
||||
* @param axis The orientation axis
|
||||
* @param angle The rotation angle, in radians
|
||||
*/
|
||||
ASSIMP_API void aiQuaternionFromAxisAngle(
|
||||
C_STRUCT aiQuaternion* q,
|
||||
const C_STRUCT aiVector3D* axis,
|
||||
const float angle);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Create a Quaternion from a normalized quaternion stored
|
||||
* in a 3D vector.
|
||||
* @param q Receives the output quaternion
|
||||
* @param normalized The vector that stores the quaternion
|
||||
*/
|
||||
ASSIMP_API void aiQuaternionFromNormalizedQuaternion(
|
||||
C_STRUCT aiQuaternion* q,
|
||||
const C_STRUCT aiVector3D* normalized);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if quaternions are equal.
|
||||
* @param a First quaternion to compare
|
||||
* @param b Second quaternion to compare
|
||||
* @return 1 if the quaternions are equal
|
||||
* @return 0 if the quaternions are not equal
|
||||
*/
|
||||
ASSIMP_API int aiQuaternionAreEqual(
|
||||
const C_STRUCT aiQuaternion* a,
|
||||
const C_STRUCT aiQuaternion* b);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Check if quaternions are equal using epsilon.
|
||||
* @param a First quaternion to compare
|
||||
* @param b Second quaternion to compare
|
||||
* @param epsilon Epsilon
|
||||
* @return 1 if the quaternions are equal
|
||||
* @return 0 if the quaternions are not equal
|
||||
*/
|
||||
ASSIMP_API int aiQuaternionAreEqualEpsilon(
|
||||
const C_STRUCT aiQuaternion* a,
|
||||
const C_STRUCT aiQuaternion* b,
|
||||
const float epsilon);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Normalize a quaternion.
|
||||
* @param q Quaternion to normalize
|
||||
*/
|
||||
ASSIMP_API void aiQuaternionNormalize(
|
||||
C_STRUCT aiQuaternion* q);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Compute quaternion conjugate.
|
||||
* @param q Quaternion to compute conjugate,
|
||||
* receives the output quaternion
|
||||
*/
|
||||
ASSIMP_API void aiQuaternionConjugate(
|
||||
C_STRUCT aiQuaternion* q);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Multiply quaternions.
|
||||
* @param dst First quaternion, receives the output quaternion
|
||||
* @param q Second quaternion
|
||||
*/
|
||||
ASSIMP_API void aiQuaternionMultiply(
|
||||
C_STRUCT aiQuaternion* dst,
|
||||
const C_STRUCT aiQuaternion* q);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Performs a spherical interpolation between two quaternions.
|
||||
* @param dst Receives the quaternion resulting from the interpolation.
|
||||
* @param start Quaternion when factor == 0
|
||||
* @param end Quaternion when factor == 1
|
||||
* @param factor Interpolation factor between 0 and 1
|
||||
*/
|
||||
ASSIMP_API void aiQuaternionInterpolate(
|
||||
C_STRUCT aiQuaternion* dst,
|
||||
const C_STRUCT aiQuaternion* start,
|
||||
const C_STRUCT aiQuaternion* end,
|
||||
const float factor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1030,10 +1030,10 @@ enum aiComponent
|
||||
#define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Specifies whether the Collada loader should use Collada names as node names.
|
||||
/** @brief Specifies whether the Collada loader should use Collada names.
|
||||
*
|
||||
* If this property is set to true, the Collada names will be used as the
|
||||
* node name. The default is to use the id tag (resp. sid tag, if no id tag is present)
|
||||
* If this property is set to true, the Collada names will be used as the node and
|
||||
* mesh names. The default is to use the id tag (resp. sid tag, if no id tag is present)
|
||||
* instead.
|
||||
* Property type: Bool. Default value: false.
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_DEFINES_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <assimp/config.h>
|
||||
@@ -76,21 +76,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_X
|
||||
# define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
#define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
#endif
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
|
||||
# define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
#define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
#endif
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
|
||||
# define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
# define ASSIMP_BUILD_NEED_UNZIP
|
||||
#define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
#define ASSIMP_BUILD_NEED_UNZIP
|
||||
#endif
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
|
||||
# define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
# define ASSIMP_BUILD_NEED_UNZIP
|
||||
#define ASSIMP_BUILD_NEED_Z_INFLATE
|
||||
#define ASSIMP_BUILD_NEED_UNZIP
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -129,72 +129,71 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef _WIN32
|
||||
# undef ASSIMP_API
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
# ifdef ASSIMP_BUILD_DLL_EXPORT
|
||||
# define ASSIMP_API __declspec(dllexport)
|
||||
# define ASSIMP_API_WINONLY __declspec(dllexport)
|
||||
#undef ASSIMP_API
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#ifdef ASSIMP_BUILD_DLL_EXPORT
|
||||
#define ASSIMP_API __declspec(dllexport)
|
||||
#define ASSIMP_API_WINONLY __declspec(dllexport)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
|
||||
* an external DLL under Windows. Default is static linkage. */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
# elif (defined ASSIMP_DLL)
|
||||
# define ASSIMP_API __declspec(dllimport)
|
||||
# define ASSIMP_API_WINONLY __declspec(dllimport)
|
||||
# else
|
||||
# define ASSIMP_API
|
||||
# define ASSIMP_API_WINONLY
|
||||
# endif
|
||||
#elif defined(SWIG)
|
||||
|
||||
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#elif (defined ASSIMP_DLL)
|
||||
#define ASSIMP_API __declspec(dllimport)
|
||||
#define ASSIMP_API_WINONLY __declspec(dllimport)
|
||||
#else
|
||||
# define ASSIMP_API __attribute__ ((visibility("default")))
|
||||
# define ASSIMP_API_WINONLY
|
||||
#define ASSIMP_API
|
||||
#define ASSIMP_API_WINONLY
|
||||
#endif
|
||||
#elif defined(SWIG)
|
||||
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
|
||||
#else
|
||||
#define ASSIMP_API __attribute__((visibility("default")))
|
||||
#define ASSIMP_API_WINONLY
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# ifdef ASSIMP_BUILD_DLL_EXPORT
|
||||
# pragma warning (disable : 4251)
|
||||
# endif
|
||||
/* Force the compiler to inline a function, if possible
|
||||
#pragma warning(disable : 4521 4512 4714 4127 4351 4510)
|
||||
#ifdef ASSIMP_BUILD_DLL_EXPORT
|
||||
#pragma warning(disable : 4251)
|
||||
#endif
|
||||
/* Force the compiler to inline a function, if possible
|
||||
*/
|
||||
# define AI_FORCE_INLINE __forceinline
|
||||
#define AI_FORCE_INLINE __forceinline
|
||||
|
||||
/* Tells the compiler that a function never returns. Used in code analysis
|
||||
/* Tells the compiler that a function never returns. Used in code analysis
|
||||
* to skip dead paths (e.g. after an assertion evaluated to false). */
|
||||
# define AI_WONT_RETURN __declspec(noreturn)
|
||||
#define AI_WONT_RETURN __declspec(noreturn)
|
||||
#elif defined(SWIG)
|
||||
|
||||
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
|
||||
/* Do nothing, the relevant defines are all in AssimpSwigPort.i */
|
||||
|
||||
#else
|
||||
# define AI_WONT_RETURN
|
||||
# define AI_FORCE_INLINE inline
|
||||
#define AI_WONT_RETURN
|
||||
#define AI_FORCE_INLINE inline
|
||||
#endif // (defined _MSC_VER)
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
|
||||
#define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
|
||||
#else
|
||||
# define AI_WONT_RETURN_SUFFIX
|
||||
#define AI_WONT_RETURN_SUFFIX
|
||||
#endif // (defined __clang__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
|
||||
/* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
|
||||
* in doxydocs.
|
||||
*/
|
||||
# define C_STRUCT
|
||||
# define C_ENUM
|
||||
#define C_STRUCT
|
||||
#define C_ENUM
|
||||
#else
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
|
||||
* is defined by Doxygen's preprocessor. The corresponding
|
||||
* entries in the DOXYFILE are: */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#if 0
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = YES
|
||||
@@ -206,98 +205,96 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
EXPAND_AS_DEFINED = C_STRUCT C_ENUM
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#endif
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Doxygen gets confused if we use c-struct typedefs to avoid
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Doxygen gets confused if we use c-struct typedefs to avoid
|
||||
* the explicit 'struct' notation. This trick here has the same
|
||||
* effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
|
||||
* to typedef all structs/enums. */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
# if (defined ASSIMP_DOXYGEN_BUILD)
|
||||
# define C_STRUCT
|
||||
# define C_ENUM
|
||||
# else
|
||||
# define C_STRUCT struct
|
||||
# define C_ENUM enum
|
||||
# endif
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#if (defined ASSIMP_DOXYGEN_BUILD)
|
||||
#define C_STRUCT
|
||||
#define C_ENUM
|
||||
#else
|
||||
#define C_STRUCT struct
|
||||
#define C_ENUM enum
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
|
||||
# error Currently, Borland is unsupported. Feel free to port Assimp.
|
||||
#if (defined(__BORLANDC__) || defined(__BCPLUSPLUS__))
|
||||
#error Currently, Borland is unsupported. Feel free to port Assimp.
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
|
||||
* without threading support. The library doesn't utilize
|
||||
* threads then and is itself not threadsafe. */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||
# define ASSIMP_BUILD_SINGLETHREADED
|
||||
#define ASSIMP_BUILD_SINGLETHREADED
|
||||
#endif
|
||||
|
||||
#if defined(_DEBUG) || ! defined(NDEBUG)
|
||||
# define ASSIMP_BUILD_DEBUG
|
||||
#if defined(_DEBUG) || !defined(NDEBUG)
|
||||
#define ASSIMP_BUILD_DEBUG
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Define ASSIMP_DOUBLE_PRECISION to compile assimp
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* 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;
|
||||
typedef double ai_real;
|
||||
typedef signed long long int ai_int;
|
||||
typedef unsigned long long int ai_uint;
|
||||
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
|
||||
#define ASSIMP_AI_REAL_TEXT_PRECISION 16
|
||||
#endif // ASSIMP_AI_REAL_TEXT_PRECISION
|
||||
#else // ASSIMP_DOUBLE_PRECISION
|
||||
typedef float ai_real;
|
||||
typedef signed int ai_int;
|
||||
typedef unsigned int ai_uint;
|
||||
typedef float ai_real;
|
||||
typedef signed int ai_int;
|
||||
typedef unsigned int ai_uint;
|
||||
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
|
||||
#define ASSIMP_AI_REAL_TEXT_PRECISION 8
|
||||
#endif // ASSIMP_AI_REAL_TEXT_PRECISION
|
||||
#endif // ASSIMP_DOUBLE_PRECISION
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Useful constants */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* Useful constants */
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* This is PI. Hi PI. */
|
||||
#define AI_MATH_PI (3.141592653589793238462643383279 )
|
||||
#define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
|
||||
#define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
|
||||
#define AI_MATH_PI (3.141592653589793238462643383279)
|
||||
#define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
|
||||
#define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
|
||||
|
||||
/* And this is to avoid endless casts to float */
|
||||
#define AI_MATH_PI_F (3.1415926538f)
|
||||
#define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
|
||||
#define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
|
||||
#define AI_MATH_PI_F (3.1415926538f)
|
||||
#define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
|
||||
#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)*(ai_real)0.0174532925)
|
||||
#define AI_RAD_TO_DEG(x) ((x)*(ai_real)57.2957795)
|
||||
#define AI_DEG_TO_RAD(x) ((x) * (ai_real)0.0174532925)
|
||||
#define AI_RAD_TO_DEG(x) ((x) * (ai_real)57.2957795)
|
||||
|
||||
/* Numerical limits */
|
||||
static const ai_real ai_epsilon = (ai_real) 0.00001;
|
||||
static const ai_real ai_epsilon = (ai_real)0.00001;
|
||||
|
||||
/* Support for big-endian builds */
|
||||
#if defined(__BYTE_ORDER__)
|
||||
# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
# if !defined(__BIG_ENDIAN__)
|
||||
# define __BIG_ENDIAN__
|
||||
# endif
|
||||
# else /* little endian */
|
||||
# if defined (__BIG_ENDIAN__)
|
||||
# undef __BIG_ENDIAN__
|
||||
# endif
|
||||
# endif
|
||||
#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#if !defined(__BIG_ENDIAN__)
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
#else /* little endian */
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
#undef __BIG_ENDIAN__
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
# define AI_BUILD_BIG_ENDIAN
|
||||
#define AI_BUILD_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* To avoid running out of memory
|
||||
* This can be adjusted for specific use cases
|
||||
@@ -306,26 +303,26 @@ static const ai_real ai_epsilon = (ai_real) 0.00001;
|
||||
#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
|
||||
|
||||
#ifndef _MSC_VER
|
||||
# if __cplusplus >= 201103L // C++11
|
||||
# define AI_NO_EXCEPT noexcept
|
||||
# else
|
||||
# define AI_NO_EXCEPT
|
||||
# endif
|
||||
#if __cplusplus >= 201103L // C++11
|
||||
#define AI_NO_EXCEPT noexcept
|
||||
#else
|
||||
# if (_MSC_VER >= 1915 )
|
||||
# define AI_NO_EXCEPT noexcept
|
||||
# else
|
||||
# define AI_NO_EXCEPT
|
||||
# endif
|
||||
#define AI_NO_EXCEPT
|
||||
#endif
|
||||
#else
|
||||
#if (_MSC_VER >= 1915)
|
||||
#define AI_NO_EXCEPT noexcept
|
||||
#else
|
||||
#define AI_NO_EXCEPT
|
||||
#endif
|
||||
#endif // _MSC_VER
|
||||
|
||||
/**
|
||||
* Helper macro to set a pointer to NULL in debug builds
|
||||
*/
|
||||
#if (defined ASSIMP_BUILD_DEBUG)
|
||||
# define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
|
||||
#define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
|
||||
#else
|
||||
# define AI_DEBUG_INVALIDATE_PTR(x)
|
||||
#define AI_DEBUG_INVALIDATE_PTR(x)
|
||||
#endif
|
||||
|
||||
#endif // !! AI_DEFINES_H_INC
|
||||
|
||||
@@ -312,6 +312,10 @@ enum aiTextureType
|
||||
|
||||
#define AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Get a string for a given aiTextureType
|
||||
ASSIMP_API const char* TextureTypeToString(enum aiTextureType in);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Defines all shading models supported by the library
|
||||
*
|
||||
|
||||
@@ -58,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
template <typename T> class aiMatrix4x4t;
|
||||
template <typename T> class aiVector2t;
|
||||
template <typename T> class aiVector3t;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Represents a row-major 3x3 matrix
|
||||
@@ -93,10 +94,10 @@ public:
|
||||
const TReal* operator[] (unsigned int p_iIndex) const;
|
||||
|
||||
// comparison operators
|
||||
bool operator== (const aiMatrix4x4t<TReal>& m) const;
|
||||
bool operator!= (const aiMatrix4x4t<TReal>& m) const;
|
||||
bool operator== (const aiMatrix3x3t<TReal>& m) const;
|
||||
bool operator!= (const aiMatrix3x3t<TReal>& m) const;
|
||||
|
||||
bool Equal(const aiMatrix4x4t<TReal>& m, TReal epsilon = 1e-6) const;
|
||||
bool Equal(const aiMatrix3x3t<TReal>& m, TReal epsilon = 1e-6) const;
|
||||
|
||||
template <typename TOther>
|
||||
operator aiMatrix3x3t<TOther> () const;
|
||||
@@ -136,8 +137,7 @@ public:
|
||||
* @param axis Axis to rotate around
|
||||
* @param out To be filled
|
||||
*/
|
||||
static aiMatrix3x3t& Rotation( TReal a,
|
||||
const aiVector3t<TReal>& axis, aiMatrix3x3t& out);
|
||||
static aiMatrix3x3t& Rotation( TReal a, const aiVector3t<TReal>& axis, aiMatrix3x3t& out);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Returns a translation matrix
|
||||
|
||||
@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -141,7 +139,7 @@ const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
AI_FORCE_INLINE
|
||||
bool aiMatrix3x3t<TReal>::operator== (const aiMatrix4x4t<TReal>& m) const {
|
||||
bool aiMatrix3x3t<TReal>::operator== (const aiMatrix3x3t<TReal>& m) const {
|
||||
return a1 == m.a1 && a2 == m.a2 && a3 == m.a3 &&
|
||||
b1 == m.b1 && b2 == m.b2 && b3 == m.b3 &&
|
||||
c1 == m.c1 && c2 == m.c2 && c3 == m.c3;
|
||||
@@ -150,14 +148,14 @@ bool aiMatrix3x3t<TReal>::operator== (const aiMatrix4x4t<TReal>& m) const {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
AI_FORCE_INLINE
|
||||
bool aiMatrix3x3t<TReal>::operator!= (const aiMatrix4x4t<TReal>& m) const {
|
||||
bool aiMatrix3x3t<TReal>::operator!= (const aiMatrix3x3t<TReal>& m) const {
|
||||
return !(*this == m);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
template<typename TReal>
|
||||
AI_FORCE_INLINE
|
||||
bool aiMatrix3x3t<TReal>::Equal(const aiMatrix4x4t<TReal>& m, TReal epsilon) const {
|
||||
bool aiMatrix3x3t<TReal>::Equal(const aiMatrix3x3t<TReal>& m, TReal epsilon) const {
|
||||
return
|
||||
std::abs(a1 - m.a1) <= epsilon &&
|
||||
std::abs(a2 - m.a2) <= epsilon &&
|
||||
|
||||
@@ -49,11 +49,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_MESH_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <assimp/types.h>
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable : 4351)
|
||||
#endif // _WIN32
|
||||
|
||||
#include <assimp/aabb.h>
|
||||
#include <assimp/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -69,42 +73,42 @@ extern "C" {
|
||||
* Maximum number of indices per face (polygon). */
|
||||
|
||||
#ifndef AI_MAX_FACE_INDICES
|
||||
# define AI_MAX_FACE_INDICES 0x7fff
|
||||
#define AI_MAX_FACE_INDICES 0x7fff
|
||||
#endif
|
||||
|
||||
/** @def AI_MAX_BONE_WEIGHTS
|
||||
* Maximum number of indices per face (polygon). */
|
||||
|
||||
#ifndef AI_MAX_BONE_WEIGHTS
|
||||
# define AI_MAX_BONE_WEIGHTS 0x7fffffff
|
||||
#define AI_MAX_BONE_WEIGHTS 0x7fffffff
|
||||
#endif
|
||||
|
||||
/** @def AI_MAX_VERTICES
|
||||
* Maximum number of vertices per mesh. */
|
||||
|
||||
#ifndef AI_MAX_VERTICES
|
||||
# define AI_MAX_VERTICES 0x7fffffff
|
||||
#define AI_MAX_VERTICES 0x7fffffff
|
||||
#endif
|
||||
|
||||
/** @def AI_MAX_FACES
|
||||
* Maximum number of faces per mesh. */
|
||||
|
||||
#ifndef AI_MAX_FACES
|
||||
# define AI_MAX_FACES 0x7fffffff
|
||||
#define AI_MAX_FACES 0x7fffffff
|
||||
#endif
|
||||
|
||||
/** @def AI_MAX_NUMBER_OF_COLOR_SETS
|
||||
* Supported number of vertex color sets per mesh. */
|
||||
|
||||
#ifndef AI_MAX_NUMBER_OF_COLOR_SETS
|
||||
# define AI_MAX_NUMBER_OF_COLOR_SETS 0x8
|
||||
#define AI_MAX_NUMBER_OF_COLOR_SETS 0x8
|
||||
#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS
|
||||
|
||||
/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS
|
||||
* Supported number of texture coord sets (UV(W) channels) per mesh */
|
||||
|
||||
#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS
|
||||
# define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8
|
||||
#define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8
|
||||
#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -129,39 +133,36 @@ extern "C" {
|
||||
* @note Take a look at the @link data Data Structures page @endlink for
|
||||
* more information on the layout and winding order of a face.
|
||||
*/
|
||||
struct aiFace
|
||||
{
|
||||
struct aiFace {
|
||||
//! Number of indices defining this face.
|
||||
//! The maximum value for this member is #AI_MAX_FACE_INDICES.
|
||||
unsigned int mNumIndices;
|
||||
|
||||
//! Pointer to the indices array. Size of the array is given in numIndices.
|
||||
unsigned int* mIndices;
|
||||
unsigned int *mIndices;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
//! Default constructor
|
||||
aiFace() AI_NO_EXCEPT
|
||||
: mNumIndices( 0 )
|
||||
, mIndices( nullptr ) {
|
||||
: mNumIndices(0),
|
||||
mIndices(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
//! Default destructor. Delete the index array
|
||||
~aiFace()
|
||||
{
|
||||
delete [] mIndices;
|
||||
~aiFace() {
|
||||
delete[] mIndices;
|
||||
}
|
||||
|
||||
//! Copy constructor. Copy the index array
|
||||
aiFace( const aiFace& o)
|
||||
: mNumIndices(0)
|
||||
, mIndices( nullptr ) {
|
||||
aiFace(const aiFace &o) :
|
||||
mNumIndices(0), mIndices(nullptr) {
|
||||
*this = o;
|
||||
}
|
||||
|
||||
//! Assignment operator. Copy the index array
|
||||
aiFace& operator = ( const aiFace& o) {
|
||||
aiFace &operator=(const aiFace &o) {
|
||||
if (&o == this) {
|
||||
return *this;
|
||||
}
|
||||
@@ -170,7 +171,7 @@ struct aiFace
|
||||
mNumIndices = o.mNumIndices;
|
||||
if (mNumIndices) {
|
||||
mIndices = new unsigned int[mNumIndices];
|
||||
::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));
|
||||
::memcpy(mIndices, o.mIndices, mNumIndices * sizeof(unsigned int));
|
||||
} else {
|
||||
mIndices = nullptr;
|
||||
}
|
||||
@@ -180,7 +181,7 @@ struct aiFace
|
||||
|
||||
//! Comparison operator. Checks whether the index array
|
||||
//! of two faces is identical
|
||||
bool operator== (const aiFace& o) const {
|
||||
bool operator==(const aiFace &o) const {
|
||||
if (mIndices == o.mIndices) {
|
||||
return true;
|
||||
}
|
||||
@@ -204,13 +205,12 @@ struct aiFace
|
||||
|
||||
//! Inverse comparison operator. Checks whether the index
|
||||
//! array of two faces is NOT identical
|
||||
bool operator != (const aiFace& o) const {
|
||||
bool operator!=(const aiFace &o) const {
|
||||
return !(*this == o);
|
||||
}
|
||||
#endif // __cplusplus
|
||||
}; // struct aiFace
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief A single influence of a bone on a vertex.
|
||||
*/
|
||||
@@ -220,38 +220,36 @@ struct aiVertexWeight {
|
||||
|
||||
//! The strength of the influence in the range (0...1).
|
||||
//! The influence from all bones at one vertex amounts to 1.
|
||||
float mWeight;
|
||||
ai_real mWeight;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
//! Default constructor
|
||||
aiVertexWeight() AI_NO_EXCEPT
|
||||
: mVertexId(0)
|
||||
, mWeight(0.0f) {
|
||||
: mVertexId(0),
|
||||
mWeight(0.0f) {
|
||||
// empty
|
||||
}
|
||||
|
||||
//! Initialization from a given index and vertex weight factor
|
||||
//! \param pID ID
|
||||
//! \param pWeight Vertex weight factor
|
||||
aiVertexWeight( unsigned int pID, float pWeight )
|
||||
: mVertexId( pID )
|
||||
, mWeight( pWeight ) {
|
||||
aiVertexWeight(unsigned int pID, float pWeight) :
|
||||
mVertexId(pID), mWeight(pWeight) {
|
||||
// empty
|
||||
}
|
||||
|
||||
bool operator == ( const aiVertexWeight &rhs ) const {
|
||||
return ( mVertexId == rhs.mVertexId && mWeight == rhs.mWeight );
|
||||
bool operator==(const aiVertexWeight &rhs) const {
|
||||
return (mVertexId == rhs.mVertexId && mWeight == rhs.mWeight);
|
||||
}
|
||||
|
||||
bool operator != ( const aiVertexWeight &rhs ) const {
|
||||
return ( *this == rhs );
|
||||
bool operator!=(const aiVertexWeight &rhs) const {
|
||||
return (*this == rhs);
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
|
||||
// Forward declare aiNode (pointer use only)
|
||||
struct aiNode;
|
||||
|
||||
@@ -274,15 +272,15 @@ struct aiBone {
|
||||
#ifndef ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS
|
||||
// The bone armature node - used for skeleton conversion
|
||||
// you must enable aiProcess_PopulateArmatureData to populate this
|
||||
C_STRUCT aiNode* mArmature;
|
||||
C_STRUCT aiNode *mArmature;
|
||||
|
||||
// The bone node in the scene - used for skeleton conversion
|
||||
// you must enable aiProcess_PopulateArmatureData to populate this
|
||||
C_STRUCT aiNode* mNode;
|
||||
C_STRUCT aiNode *mNode;
|
||||
|
||||
#endif
|
||||
//! The influence weights of this bone, by vertex index.
|
||||
C_STRUCT aiVertexWeight* mWeights;
|
||||
C_STRUCT aiVertexWeight *mWeights;
|
||||
|
||||
/** Matrix that transforms from bone space to mesh space in bind pose.
|
||||
*
|
||||
@@ -301,56 +299,54 @@ struct aiBone {
|
||||
|
||||
//! Default constructor
|
||||
aiBone() AI_NO_EXCEPT
|
||||
: mName()
|
||||
, mNumWeights( 0 )
|
||||
, mWeights( nullptr )
|
||||
, mOffsetMatrix() {
|
||||
: mName(),
|
||||
mNumWeights(0),
|
||||
mWeights(nullptr),
|
||||
mOffsetMatrix() {
|
||||
// empty
|
||||
}
|
||||
|
||||
//! Copy constructor
|
||||
aiBone(const aiBone& other)
|
||||
: mName( other.mName )
|
||||
, mNumWeights( other.mNumWeights )
|
||||
, mWeights(nullptr)
|
||||
, mOffsetMatrix( other.mOffsetMatrix ) {
|
||||
aiBone(const aiBone &other) :
|
||||
mName(other.mName),
|
||||
mNumWeights(other.mNumWeights),
|
||||
mWeights(nullptr),
|
||||
mOffsetMatrix(other.mOffsetMatrix) {
|
||||
if (other.mWeights && other.mNumWeights) {
|
||||
mWeights = new aiVertexWeight[mNumWeights];
|
||||
::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
|
||||
::memcpy(mWeights, other.mWeights, mNumWeights * sizeof(aiVertexWeight));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! Assignment operator
|
||||
aiBone &operator=(const aiBone& other) {
|
||||
aiBone &operator=(const aiBone &other) {
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
mName = other.mName;
|
||||
mNumWeights = other.mNumWeights;
|
||||
mName = other.mName;
|
||||
mNumWeights = other.mNumWeights;
|
||||
mOffsetMatrix = other.mOffsetMatrix;
|
||||
|
||||
if (other.mWeights && other.mNumWeights)
|
||||
{
|
||||
if (other.mWeights && other.mNumWeights) {
|
||||
if (mWeights) {
|
||||
delete[] mWeights;
|
||||
}
|
||||
|
||||
mWeights = new aiVertexWeight[mNumWeights];
|
||||
::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
|
||||
::memcpy(mWeights, other.mWeights, mNumWeights * sizeof(aiVertexWeight));
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator == ( const aiBone &rhs ) const {
|
||||
if ( mName != rhs.mName || mNumWeights != rhs.mNumWeights ) {
|
||||
bool operator==(const aiBone &rhs) const {
|
||||
if (mName != rhs.mName || mNumWeights != rhs.mNumWeights) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < mNumWeights; ++i ) {
|
||||
if ( mWeights[ i ] != rhs.mWeights[ i ] ) {
|
||||
for (size_t i = 0; i < mNumWeights; ++i) {
|
||||
if (mWeights[i] != rhs.mWeights[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -359,12 +355,11 @@ struct aiBone {
|
||||
}
|
||||
//! Destructor - deletes the array of vertex weights
|
||||
~aiBone() {
|
||||
delete [] mWeights;
|
||||
delete[] mWeights;
|
||||
}
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Enumerates the types of geometric primitives supported by Assimp.
|
||||
*
|
||||
@@ -373,27 +368,26 @@ struct aiBone {
|
||||
* @see aiProcess_Triangulate Automatic triangulation
|
||||
* @see AI_CONFIG_PP_SBP_REMOVE Removal of specific primitive types.
|
||||
*/
|
||||
enum aiPrimitiveType
|
||||
{
|
||||
enum aiPrimitiveType {
|
||||
/** A point primitive.
|
||||
*
|
||||
* This is just a single vertex in the virtual world,
|
||||
* #aiFace contains just one index for such a primitive.
|
||||
*/
|
||||
aiPrimitiveType_POINT = 0x1,
|
||||
aiPrimitiveType_POINT = 0x1,
|
||||
|
||||
/** A line primitive.
|
||||
*
|
||||
* This is a line defined through a start and an end position.
|
||||
* #aiFace contains exactly two indices for such a primitive.
|
||||
*/
|
||||
aiPrimitiveType_LINE = 0x2,
|
||||
aiPrimitiveType_LINE = 0x2,
|
||||
|
||||
/** A triangular primitive.
|
||||
*
|
||||
* A triangle consists of three indices.
|
||||
*/
|
||||
aiPrimitiveType_TRIANGLE = 0x4,
|
||||
aiPrimitiveType_TRIANGLE = 0x4,
|
||||
|
||||
/** A higher-level polygon with more than 3 edges.
|
||||
*
|
||||
@@ -402,10 +396,9 @@ enum aiPrimitiveType
|
||||
* is provided for your convenience, it splits all polygons in
|
||||
* triangles (which are much easier to handle).
|
||||
*/
|
||||
aiPrimitiveType_POLYGON = 0x8,
|
||||
aiPrimitiveType_POLYGON = 0x8,
|
||||
|
||||
|
||||
/** This value is not used. It is just here to force the
|
||||
/** This value is not used. It is just here to force the
|
||||
* compiler to map this enum to a 32 Bit integer.
|
||||
*/
|
||||
#ifndef SWIG
|
||||
@@ -417,8 +410,6 @@ enum aiPrimitiveType
|
||||
#define AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) \
|
||||
((n) > 3 ? aiPrimitiveType_POLYGON : (aiPrimitiveType)(1u << ((n)-1)))
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief An AnimMesh is an attachment to an #aiMesh stores per-vertex
|
||||
* animations for a particular frame.
|
||||
@@ -430,8 +421,7 @@ enum aiPrimitiveType
|
||||
* established by #aiMeshAnim, which references singular mesh attachments
|
||||
* by their ID and binds them to a time offset.
|
||||
*/
|
||||
struct aiAnimMesh
|
||||
{
|
||||
struct aiAnimMesh {
|
||||
/**Anim Mesh name */
|
||||
C_STRUCT aiString mName;
|
||||
|
||||
@@ -441,22 +431,22 @@ struct aiAnimMesh
|
||||
* meshes may neither add or nor remove vertex components (if
|
||||
* a replacement array is nullptr and the corresponding source
|
||||
* array is not, the source data is taken instead)*/
|
||||
C_STRUCT aiVector3D* mVertices;
|
||||
C_STRUCT aiVector3D *mVertices;
|
||||
|
||||
/** Replacement for aiMesh::mNormals. */
|
||||
C_STRUCT aiVector3D* mNormals;
|
||||
C_STRUCT aiVector3D *mNormals;
|
||||
|
||||
/** Replacement for aiMesh::mTangents. */
|
||||
C_STRUCT aiVector3D* mTangents;
|
||||
C_STRUCT aiVector3D *mTangents;
|
||||
|
||||
/** Replacement for aiMesh::mBitangents. */
|
||||
C_STRUCT aiVector3D* mBitangents;
|
||||
C_STRUCT aiVector3D *mBitangents;
|
||||
|
||||
/** Replacement for aiMesh::mColors */
|
||||
C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
||||
C_STRUCT aiColor4D *mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
||||
|
||||
/** Replacement for aiMesh::mTextureCoords */
|
||||
C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||
C_STRUCT aiVector3D *mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||
|
||||
/** The number of vertices in the aiAnimMesh, and thus the length of all
|
||||
* the member arrays.
|
||||
@@ -467,7 +457,7 @@ struct aiAnimMesh
|
||||
* from language bindings.
|
||||
*/
|
||||
unsigned int mNumVertices;
|
||||
|
||||
|
||||
/**
|
||||
* Weight of the AnimMesh.
|
||||
*/
|
||||
@@ -476,35 +466,33 @@ struct aiAnimMesh
|
||||
#ifdef __cplusplus
|
||||
|
||||
aiAnimMesh() AI_NO_EXCEPT
|
||||
: mVertices( nullptr )
|
||||
, mNormals(nullptr)
|
||||
, mTangents(nullptr)
|
||||
, mBitangents(nullptr)
|
||||
, mColors()
|
||||
, mTextureCoords()
|
||||
, mNumVertices( 0 )
|
||||
, mWeight( 0.0f )
|
||||
{
|
||||
: mVertices(nullptr),
|
||||
mNormals(nullptr),
|
||||
mTangents(nullptr),
|
||||
mBitangents(nullptr),
|
||||
mColors(),
|
||||
mTextureCoords(),
|
||||
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++){
|
||||
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
||||
mTextureCoords[a] = nullptr;
|
||||
}
|
||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
||||
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
||||
mColors[a] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
~aiAnimMesh()
|
||||
{
|
||||
delete [] mVertices;
|
||||
delete [] mNormals;
|
||||
delete [] mTangents;
|
||||
delete [] mBitangents;
|
||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
||||
delete [] mTextureCoords[a];
|
||||
~aiAnimMesh() {
|
||||
delete[] mVertices;
|
||||
delete[] mNormals;
|
||||
delete[] mTangents;
|
||||
delete[] mBitangents;
|
||||
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
||||
delete[] mTextureCoords[a];
|
||||
}
|
||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
||||
delete [] mColors[a];
|
||||
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
||||
delete[] mColors[a];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,14 +518,14 @@ struct aiAnimMesh
|
||||
/** Check whether the anim mesh overrides a particular
|
||||
* set of vertex colors on his host mesh.
|
||||
* @param pIndex 0<index<AI_MAX_NUMBER_OF_COLOR_SETS */
|
||||
bool HasVertexColors( unsigned int pIndex) const {
|
||||
bool HasVertexColors(unsigned int pIndex) const {
|
||||
return pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS ? false : mColors[pIndex] != nullptr;
|
||||
}
|
||||
|
||||
/** Check whether the anim mesh overrides a particular
|
||||
* set of texture coordinates on his host mesh.
|
||||
* @param pIndex 0<index<AI_MAX_NUMBER_OF_TEXTURECOORDS */
|
||||
bool HasTextureCoords( unsigned int pIndex) const {
|
||||
bool HasTextureCoords(unsigned int pIndex) const {
|
||||
return pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? false : mTextureCoords[pIndex] != nullptr;
|
||||
}
|
||||
|
||||
@@ -547,18 +535,17 @@ struct aiAnimMesh
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Enumerates the methods of mesh morphing supported by Assimp.
|
||||
*/
|
||||
enum aiMorphingMethod
|
||||
{
|
||||
enum aiMorphingMethod {
|
||||
/** Interpolation between morph targets */
|
||||
aiMorphingMethod_VERTEX_BLEND = 0x1,
|
||||
aiMorphingMethod_VERTEX_BLEND = 0x1,
|
||||
|
||||
/** Normalized morphing between morph targets */
|
||||
aiMorphingMethod_MORPH_NORMALIZED = 0x2,
|
||||
aiMorphingMethod_MORPH_NORMALIZED = 0x2,
|
||||
|
||||
/** Relative morphing between morph targets */
|
||||
aiMorphingMethod_MORPH_RELATIVE = 0x3,
|
||||
aiMorphingMethod_MORPH_RELATIVE = 0x3,
|
||||
|
||||
/** This value is not used. It is just here to force the
|
||||
/** This value is not used. It is just here to force the
|
||||
* compiler to map this enum to a 32 Bit integer.
|
||||
*/
|
||||
#ifndef SWIG
|
||||
@@ -585,8 +572,7 @@ enum aiMorphingMethod
|
||||
* aiScene::mFlags
|
||||
* @endcode
|
||||
*/
|
||||
struct aiMesh
|
||||
{
|
||||
struct aiMesh {
|
||||
/** Bitwise combination of the members of the #aiPrimitiveType enum.
|
||||
* This specifies which types of primitives are present in the mesh.
|
||||
* The "SortByPrimitiveType"-Step can be used to make sure the
|
||||
@@ -610,7 +596,7 @@ struct aiMesh
|
||||
* This array is always present in a mesh. The array is
|
||||
* mNumVertices in size.
|
||||
*/
|
||||
C_STRUCT aiVector3D* mVertices;
|
||||
C_STRUCT aiVector3D *mVertices;
|
||||
|
||||
/** Vertex normals.
|
||||
* The array contains normalized vectors, nullptr if not present.
|
||||
@@ -632,7 +618,7 @@ struct aiMesh
|
||||
* However, this needn't apply for normals that have been taken
|
||||
* directly from the model file.
|
||||
*/
|
||||
C_STRUCT aiVector3D* mNormals;
|
||||
C_STRUCT aiVector3D *mNormals;
|
||||
|
||||
/** Vertex tangents.
|
||||
* The tangent of a vertex points in the direction of the positive
|
||||
@@ -646,7 +632,7 @@ struct aiMesh
|
||||
* @note If the mesh contains tangents, it automatically also
|
||||
* contains bitangents.
|
||||
*/
|
||||
C_STRUCT aiVector3D* mTangents;
|
||||
C_STRUCT aiVector3D *mTangents;
|
||||
|
||||
/** Vertex bitangents.
|
||||
* The bitangent of a vertex points in the direction of the positive
|
||||
@@ -655,20 +641,20 @@ struct aiMesh
|
||||
* @note If the mesh contains tangents, it automatically also contains
|
||||
* bitangents.
|
||||
*/
|
||||
C_STRUCT aiVector3D* mBitangents;
|
||||
C_STRUCT aiVector3D *mBitangents;
|
||||
|
||||
/** Vertex color sets.
|
||||
* A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex
|
||||
* colors per vertex. nullptr if not present. Each array is
|
||||
* mNumVertices in size if present.
|
||||
*/
|
||||
C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
||||
C_STRUCT aiColor4D *mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
||||
|
||||
/** Vertex texture coords, also known as UV channels.
|
||||
* A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per
|
||||
* vertex. nullptr if not present. The array is mNumVertices in size.
|
||||
*/
|
||||
C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||
C_STRUCT aiVector3D *mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||
|
||||
/** Specifies the number of components for a given UV channel.
|
||||
* Up to three channels are supported (UVW, for accessing volume
|
||||
@@ -685,7 +671,7 @@ struct aiMesh
|
||||
* in mNumFaces. If the #AI_SCENE_FLAGS_NON_VERBOSE_FORMAT
|
||||
* is NOT set each face references an unique set of vertices.
|
||||
*/
|
||||
C_STRUCT aiFace* mFaces;
|
||||
C_STRUCT aiFace *mFaces;
|
||||
|
||||
/** The number of bones this mesh contains.
|
||||
* Can be 0, in which case the mBones array is nullptr.
|
||||
@@ -696,7 +682,7 @@ struct aiMesh
|
||||
* A bone consists of a name by which it can be found in the
|
||||
* frame hierarchy and a set of vertex weights.
|
||||
*/
|
||||
C_STRUCT aiBone** mBones;
|
||||
C_STRUCT aiBone **mBones;
|
||||
|
||||
/** The material used by this mesh.
|
||||
* A mesh uses only a single material. If an imported model uses
|
||||
@@ -718,7 +704,6 @@ struct aiMesh
|
||||
**/
|
||||
C_STRUCT aiString mName;
|
||||
|
||||
|
||||
/** The number of attachment meshes. Note! Currently only works with Collada loader. */
|
||||
unsigned int mNumAnimMeshes;
|
||||
|
||||
@@ -726,7 +711,7 @@ struct aiMesh
|
||||
* Attachment meshes carry replacement data for some of the
|
||||
* mesh'es vertex components (usually positions, normals).
|
||||
* Note! Currently only works with Collada loader.*/
|
||||
C_STRUCT aiAnimMesh** mAnimMeshes;
|
||||
C_STRUCT aiAnimMesh **mAnimMeshes;
|
||||
|
||||
/**
|
||||
* Method of morphing when animeshes are specified.
|
||||
@@ -737,30 +722,30 @@ struct aiMesh
|
||||
*
|
||||
*/
|
||||
C_STRUCT aiAABB mAABB;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
//! Default constructor. Initializes all members to 0
|
||||
aiMesh() AI_NO_EXCEPT
|
||||
: mPrimitiveTypes( 0 )
|
||||
, mNumVertices( 0 )
|
||||
, mNumFaces( 0 )
|
||||
, mVertices( nullptr )
|
||||
, mNormals(nullptr)
|
||||
, mTangents(nullptr)
|
||||
, mBitangents(nullptr)
|
||||
, mColors()
|
||||
, mTextureCoords()
|
||||
, mNumUVComponents()
|
||||
, mFaces(nullptr)
|
||||
, mNumBones( 0 )
|
||||
, mBones(nullptr)
|
||||
, mMaterialIndex( 0 )
|
||||
, mNumAnimMeshes( 0 )
|
||||
, mAnimMeshes(nullptr)
|
||||
, mMethod( 0 )
|
||||
, mAABB() {
|
||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) {
|
||||
: mPrimitiveTypes(0),
|
||||
mNumVertices(0),
|
||||
mNumFaces(0),
|
||||
mVertices(nullptr),
|
||||
mNormals(nullptr),
|
||||
mTangents(nullptr),
|
||||
mBitangents(nullptr),
|
||||
mColors(),
|
||||
mTextureCoords(),
|
||||
mNumUVComponents(),
|
||||
mFaces(nullptr),
|
||||
mNumBones(0),
|
||||
mBones(nullptr),
|
||||
mMaterialIndex(0),
|
||||
mNumAnimMeshes(0),
|
||||
mAnimMeshes(nullptr),
|
||||
mMethod(0),
|
||||
mAABB() {
|
||||
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
|
||||
mNumUVComponents[a] = 0;
|
||||
mTextureCoords[a] = nullptr;
|
||||
}
|
||||
@@ -772,62 +757,57 @@ struct aiMesh
|
||||
|
||||
//! Deletes all storage allocated for the mesh
|
||||
~aiMesh() {
|
||||
delete [] mVertices;
|
||||
delete [] mNormals;
|
||||
delete [] mTangents;
|
||||
delete [] mBitangents;
|
||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
||||
delete [] mTextureCoords[a];
|
||||
delete[] mVertices;
|
||||
delete[] mNormals;
|
||||
delete[] mTangents;
|
||||
delete[] mBitangents;
|
||||
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
||||
delete[] mTextureCoords[a];
|
||||
}
|
||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
||||
delete [] mColors[a];
|
||||
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
||||
delete[] mColors[a];
|
||||
}
|
||||
|
||||
// DO NOT REMOVE THIS ADDITIONAL CHECK
|
||||
if (mNumBones && mBones) {
|
||||
for( unsigned int a = 0; a < mNumBones; a++) {
|
||||
if(mBones[a])
|
||||
{
|
||||
if (mNumBones && mBones) {
|
||||
for (unsigned int a = 0; a < mNumBones; a++) {
|
||||
if (mBones[a]) {
|
||||
delete mBones[a];
|
||||
}
|
||||
}
|
||||
delete [] mBones;
|
||||
delete[] mBones;
|
||||
}
|
||||
|
||||
if (mNumAnimMeshes && mAnimMeshes) {
|
||||
for( unsigned int a = 0; a < mNumAnimMeshes; a++) {
|
||||
if (mNumAnimMeshes && mAnimMeshes) {
|
||||
for (unsigned int a = 0; a < mNumAnimMeshes; a++) {
|
||||
delete mAnimMeshes[a];
|
||||
}
|
||||
delete [] mAnimMeshes;
|
||||
delete[] mAnimMeshes;
|
||||
}
|
||||
|
||||
delete [] mFaces;
|
||||
delete[] mFaces;
|
||||
}
|
||||
|
||||
//! Check whether the mesh contains positions. Provided no special
|
||||
//! scene flags are set, this will always be true
|
||||
bool HasPositions() const
|
||||
{ return mVertices != nullptr && mNumVertices > 0; }
|
||||
bool HasPositions() const { return mVertices != nullptr && mNumVertices > 0; }
|
||||
|
||||
//! Check whether the mesh contains faces. If no special scene flags
|
||||
//! are set this should always return true
|
||||
bool HasFaces() const
|
||||
{ return mFaces != nullptr && mNumFaces > 0; }
|
||||
bool HasFaces() const { return mFaces != nullptr && mNumFaces > 0; }
|
||||
|
||||
//! Check whether the mesh contains normal vectors
|
||||
bool HasNormals() const
|
||||
{ return mNormals != nullptr && mNumVertices > 0; }
|
||||
bool HasNormals() const { return mNormals != nullptr && mNumVertices > 0; }
|
||||
|
||||
//! Check whether the mesh contains tangent and bitangent vectors
|
||||
//! It is not possible that it contains tangents and no bitangents
|
||||
//! (or the other way round). The existence of one of them
|
||||
//! implies that the second is there, too.
|
||||
bool HasTangentsAndBitangents() const
|
||||
{ return mTangents != nullptr && mBitangents != nullptr && mNumVertices > 0; }
|
||||
bool HasTangentsAndBitangents() const { return mTangents != nullptr && mBitangents != nullptr && mNumVertices > 0; }
|
||||
|
||||
//! Check whether the mesh contains a vertex color set
|
||||
//! \param pIndex Index of the vertex color set
|
||||
bool HasVertexColors( unsigned int pIndex) const {
|
||||
bool HasVertexColors(unsigned int pIndex) const {
|
||||
if (pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -837,7 +817,7 @@ struct aiMesh
|
||||
|
||||
//! Check whether the mesh contains a texture coordinate set
|
||||
//! \param pIndex Index of the texture coordinates set
|
||||
bool HasTextureCoords( unsigned int pIndex) const {
|
||||
bool HasTextureCoords(unsigned int pIndex) const {
|
||||
if (pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -847,7 +827,7 @@ struct aiMesh
|
||||
|
||||
//! Get the number of UV channels the mesh contains
|
||||
unsigned int GetNumUVChannels() const {
|
||||
unsigned int n( 0 );
|
||||
unsigned int n(0);
|
||||
while (n < AI_MAX_NUMBER_OF_TEXTURECOORDS && mTextureCoords[n]) {
|
||||
++n;
|
||||
}
|
||||
@@ -876,4 +856,3 @@ struct aiMesh
|
||||
}
|
||||
#endif //! extern "C"
|
||||
#endif // AI_MESH_H_INC
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -49,29 +47,29 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_METADATA_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER <= 1500)
|
||||
# include "Compiler/pstdint.h"
|
||||
#include "Compiler/pstdint.h"
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/**
|
||||
* Enum used to distinguish data types
|
||||
*/
|
||||
// -------------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------
|
||||
typedef enum aiMetadataType {
|
||||
AI_BOOL = 0,
|
||||
AI_INT32 = 1,
|
||||
AI_UINT64 = 2,
|
||||
AI_FLOAT = 3,
|
||||
AI_DOUBLE = 4,
|
||||
AI_AISTRING = 5,
|
||||
AI_BOOL = 0,
|
||||
AI_INT32 = 1,
|
||||
AI_UINT64 = 2,
|
||||
AI_FLOAT = 3,
|
||||
AI_DOUBLE = 4,
|
||||
AI_AISTRING = 5,
|
||||
AI_AIVECTOR3D = 6,
|
||||
AI_META_MAX = 7,
|
||||
AI_META_MAX = 7,
|
||||
|
||||
#ifndef SWIG
|
||||
FORCE_32BIT = INT_MAX
|
||||
@@ -84,10 +82,18 @@ typedef enum aiMetadataType {
|
||||
*
|
||||
* The type field uniquely identifies the underlying type of the data field
|
||||
*/
|
||||
// -------------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------
|
||||
struct aiMetadataEntry {
|
||||
aiMetadataType mType;
|
||||
void* mData;
|
||||
void *mData;
|
||||
|
||||
#ifdef __cplusplus
|
||||
aiMetadataEntry() :
|
||||
mType(AI_META_MAX),
|
||||
mData( nullptr ) {
|
||||
// empty
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -98,15 +104,29 @@ struct aiMetadataEntry {
|
||||
/**
|
||||
* Helper functions to get the aiType enum entry for a type
|
||||
*/
|
||||
// -------------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
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; }
|
||||
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
|
||||
|
||||
@@ -116,17 +136,17 @@ inline aiMetadataType GetAiType( const aiVector3D & ) { return AI_AIVECTOR3D; }
|
||||
*
|
||||
* Metadata is a key-value store using string keys and values.
|
||||
*/
|
||||
// -------------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------
|
||||
struct aiMetadata {
|
||||
/** Length of the mKeys and mValues arrays, respectively */
|
||||
unsigned int mNumProperties;
|
||||
|
||||
/** Arrays of keys, may not be NULL. Entries in this array may not be NULL as well. */
|
||||
C_STRUCT aiString* mKeys;
|
||||
C_STRUCT aiString *mKeys;
|
||||
|
||||
/** Arrays of values, may not be NULL. Entries in this array may be NULL if the
|
||||
* corresponding property key has no assigned value. */
|
||||
C_STRUCT aiMetadataEntry* mValues;
|
||||
C_STRUCT aiMetadataEntry *mValues;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -134,71 +154,62 @@ struct aiMetadata {
|
||||
* @brief The default constructor, set all members to zero by default.
|
||||
*/
|
||||
aiMetadata() AI_NO_EXCEPT
|
||||
: mNumProperties(0)
|
||||
, mKeys(nullptr)
|
||||
, mValues(nullptr) {
|
||||
: mNumProperties(0),
|
||||
mKeys(nullptr),
|
||||
mValues(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
aiMetadata( const aiMetadata &rhs )
|
||||
: mNumProperties( rhs.mNumProperties )
|
||||
, mKeys( nullptr )
|
||||
, mValues( nullptr ) {
|
||||
mKeys = new aiString[ mNumProperties ];
|
||||
for ( size_t i = 0; i < static_cast<size_t>( mNumProperties ); ++i ) {
|
||||
mKeys[ i ] = rhs.mKeys[ i ];
|
||||
aiMetadata(const aiMetadata &rhs) :
|
||||
mNumProperties(rhs.mNumProperties), mKeys(nullptr), mValues(nullptr) {
|
||||
mKeys = new aiString[mNumProperties];
|
||||
for (size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i) {
|
||||
mKeys[i] = rhs.mKeys[i];
|
||||
}
|
||||
mValues = new aiMetadataEntry[ mNumProperties ];
|
||||
for ( size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i ) {
|
||||
mValues[ i ].mType = rhs.mValues[ i ].mType;
|
||||
switch ( rhs.mValues[ i ].mType ) {
|
||||
mValues = new aiMetadataEntry[mNumProperties];
|
||||
for (size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i) {
|
||||
mValues[i].mType = rhs.mValues[i].mType;
|
||||
switch (rhs.mValues[i].mType) {
|
||||
case AI_BOOL:
|
||||
mValues[ i ].mData = new bool;
|
||||
::memcpy( mValues[ i ].mData, rhs.mValues[ i ].mData, sizeof(bool) );
|
||||
mValues[i].mData = new bool;
|
||||
::memcpy(mValues[i].mData, rhs.mValues[i].mData, sizeof(bool));
|
||||
break;
|
||||
case AI_INT32: {
|
||||
int32_t v;
|
||||
::memcpy( &v, rhs.mValues[ i ].mData, sizeof( int32_t ) );
|
||||
mValues[ i ].mData = new int32_t( v );
|
||||
}
|
||||
break;
|
||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(int32_t));
|
||||
mValues[i].mData = new int32_t(v);
|
||||
} break;
|
||||
case AI_UINT64: {
|
||||
uint64_t v;
|
||||
::memcpy( &v, rhs.mValues[ i ].mData, sizeof( uint64_t ) );
|
||||
mValues[ i ].mData = new uint64_t( v );
|
||||
}
|
||||
break;
|
||||
uint64_t v;
|
||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(uint64_t));
|
||||
mValues[i].mData = new uint64_t(v);
|
||||
} break;
|
||||
case AI_FLOAT: {
|
||||
float v;
|
||||
::memcpy( &v, rhs.mValues[ i ].mData, sizeof( float ) );
|
||||
mValues[ i ].mData = new float( v );
|
||||
}
|
||||
break;
|
||||
float v;
|
||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(float));
|
||||
mValues[i].mData = new float(v);
|
||||
} break;
|
||||
case AI_DOUBLE: {
|
||||
double v;
|
||||
::memcpy( &v, rhs.mValues[ i ].mData, sizeof( double ) );
|
||||
mValues[ i ].mData = new double( v );
|
||||
}
|
||||
break;
|
||||
double v;
|
||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(double));
|
||||
mValues[i].mData = new double(v);
|
||||
} break;
|
||||
case AI_AISTRING: {
|
||||
aiString v;
|
||||
rhs.Get<aiString>( mKeys[ i ], v );
|
||||
mValues[ i ].mData = new aiString( v );
|
||||
}
|
||||
break;
|
||||
aiString v;
|
||||
rhs.Get<aiString>(mKeys[i], v);
|
||||
mValues[i].mData = new aiString(v);
|
||||
} break;
|
||||
case AI_AIVECTOR3D: {
|
||||
aiVector3D v;
|
||||
rhs.Get<aiVector3D>( mKeys[ i ], v );
|
||||
mValues[ i ].mData = new aiVector3D( v );
|
||||
}
|
||||
break;
|
||||
aiVector3D v;
|
||||
rhs.Get<aiVector3D>(mKeys[i], v);
|
||||
mValues[i].mData = new aiVector3D(v);
|
||||
} break;
|
||||
#ifndef SWIG
|
||||
case FORCE_32BIT:
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,33 +217,33 @@ struct aiMetadata {
|
||||
* @brief The destructor.
|
||||
*/
|
||||
~aiMetadata() {
|
||||
delete [] mKeys;
|
||||
delete[] mKeys;
|
||||
mKeys = nullptr;
|
||||
if (mValues) {
|
||||
// Delete each metadata entry
|
||||
for (unsigned i=0; i<mNumProperties; ++i) {
|
||||
void* data = mValues[i].mData;
|
||||
for (unsigned i = 0; i < mNumProperties; ++i) {
|
||||
void *data = mValues[i].mData;
|
||||
switch (mValues[i].mType) {
|
||||
case AI_BOOL:
|
||||
delete static_cast< bool* >( data );
|
||||
delete static_cast<bool *>(data);
|
||||
break;
|
||||
case AI_INT32:
|
||||
delete static_cast< int32_t* >( data );
|
||||
delete static_cast<int32_t *>(data);
|
||||
break;
|
||||
case AI_UINT64:
|
||||
delete static_cast< uint64_t* >( data );
|
||||
delete static_cast<uint64_t *>(data);
|
||||
break;
|
||||
case AI_FLOAT:
|
||||
delete static_cast< float* >( data );
|
||||
delete static_cast<float *>(data);
|
||||
break;
|
||||
case AI_DOUBLE:
|
||||
delete static_cast< double* >( data );
|
||||
delete static_cast<double *>(data);
|
||||
break;
|
||||
case AI_AISTRING:
|
||||
delete static_cast< aiString* >( data );
|
||||
delete static_cast<aiString *>(data);
|
||||
break;
|
||||
case AI_AIVECTOR3D:
|
||||
delete static_cast< aiVector3D* >( data );
|
||||
delete static_cast<aiVector3D *>(data);
|
||||
break;
|
||||
#ifndef SWIG
|
||||
case FORCE_32BIT:
|
||||
@@ -243,7 +254,7 @@ struct aiMetadata {
|
||||
}
|
||||
|
||||
// Delete the metadata array
|
||||
delete [] mValues;
|
||||
delete[] mValues;
|
||||
mValues = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -252,16 +263,15 @@ struct aiMetadata {
|
||||
* @brief Allocates property fields + keys.
|
||||
* @param numProperties Number of requested properties.
|
||||
*/
|
||||
static inline
|
||||
aiMetadata *Alloc( unsigned int numProperties ) {
|
||||
if ( 0 == numProperties ) {
|
||||
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 ]();
|
||||
data->mKeys = new aiString[data->mNumProperties]();
|
||||
data->mValues = new aiMetadataEntry[data->mNumProperties]();
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -269,44 +279,40 @@ struct aiMetadata {
|
||||
/**
|
||||
* @brief Deallocates property fields + keys.
|
||||
*/
|
||||
static inline
|
||||
void Dealloc( aiMetadata *metadata ) {
|
||||
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];
|
||||
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];
|
||||
}
|
||||
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||
new_keys[i] = mKeys[i];
|
||||
new_values[i] = mValues[i];
|
||||
}
|
||||
|
||||
delete[] mKeys;
|
||||
delete[] mValues;
|
||||
delete[] mKeys;
|
||||
delete[] mValues;
|
||||
|
||||
mKeys = new_keys;
|
||||
mValues = new_values;
|
||||
mKeys = new_keys;
|
||||
mValues = new_values;
|
||||
|
||||
mNumProperties++;
|
||||
mNumProperties++;
|
||||
|
||||
Set(mNumProperties - 1, key, value);
|
||||
}
|
||||
Set(mNumProperties - 1, key, value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
bool Set( unsigned index, const std::string& key, const T& value ) {
|
||||
template <typename T>
|
||||
inline bool Set(unsigned index, const std::string &key, const T &value) {
|
||||
// In range assertion
|
||||
if ( index >= mNumProperties ) {
|
||||
if (index >= mNumProperties) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ensure that we have a valid key.
|
||||
if ( key.empty() ) {
|
||||
if (key.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -315,79 +321,97 @@ struct aiMetadata {
|
||||
|
||||
// Set metadata type
|
||||
mValues[index].mType = GetAiType(value);
|
||||
|
||||
// Copy the given value to the dynamic storage
|
||||
mValues[index].mData = new T(value);
|
||||
if (nullptr != mValues[index].mData) {
|
||||
::memcpy(mValues[index].mData, &value, sizeof(T));
|
||||
} else {
|
||||
mValues[index].mData = new T(value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
bool Get( unsigned index, T& value ) const {
|
||||
template <typename T>
|
||||
inline bool Set(const std::string &key, const T &value) {
|
||||
if (key.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||
if (key == mKeys[i].C_Str()) {
|
||||
Set(i, key, value);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool Get(unsigned index, T &value) const {
|
||||
// In range assertion
|
||||
if ( index >= mNumProperties ) {
|
||||
if (index >= mNumProperties) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return false if the output data type does
|
||||
// not match the found value's data type
|
||||
if ( GetAiType( value ) != mValues[ index ].mType ) {
|
||||
if (GetAiType(value) != mValues[index].mType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise, output the found value and
|
||||
// return true
|
||||
value = *static_cast<T*>(mValues[index].mData);
|
||||
value = *static_cast<T *>(mValues[index].mData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
bool Get( const aiString& key, T& value ) const {
|
||||
template <typename T>
|
||||
inline bool Get(const aiString &key, T &value) const {
|
||||
// Search for the given key
|
||||
for ( unsigned int 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;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
bool Get( const std::string& key, T& value ) const {
|
||||
template <typename T>
|
||||
inline bool Get(const std::string &key, T &value) const {
|
||||
return Get(aiString(key), value);
|
||||
}
|
||||
|
||||
/// 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) const {
|
||||
if ( index >= mNumProperties ) {
|
||||
/// 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) const {
|
||||
if (index >= mNumProperties) {
|
||||
return false;
|
||||
}
|
||||
|
||||
key = &mKeys[index];
|
||||
entry = &mValues[index];
|
||||
key = &mKeys[index];
|
||||
entry = &mValues[index];
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Check whether there is a metadata entry for the given key.
|
||||
/// \param [in] Key - the key value value to check for.
|
||||
inline
|
||||
bool HasKey(const char* key) {
|
||||
if ( nullptr == key ) {
|
||||
inline bool HasKey(const char *key) {
|
||||
if (nullptr == key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Search for the given key
|
||||
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||
if ( 0 == strncmp(mKeys[i].C_Str(), key, mKeys[i].length ) ) {
|
||||
if (0 == strncmp(mKeys[i].C_Str(), key, mKeys[i].length)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -395,7 +419,6 @@ struct aiMetadata {
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
};
|
||||
|
||||
#endif // AI_METADATA_H_INC
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
aiQuaterniont& Conjugate ();
|
||||
|
||||
/** Rotate a point by this quaternion */
|
||||
aiVector3t<TReal> Rotate (const aiVector3t<TReal>& in);
|
||||
aiVector3t<TReal> Rotate (const aiVector3t<TReal>& in) const;
|
||||
|
||||
/** Multiply two quaternions */
|
||||
aiQuaterniont operator* (const aiQuaterniont& two) const;
|
||||
|
||||
@@ -277,7 +277,7 @@ inline aiQuaterniont<TReal>& aiQuaterniont<TReal>::Conjugate ()
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
template<typename TReal>
|
||||
inline aiVector3t<TReal> aiQuaterniont<TReal>::Rotate (const aiVector3t<TReal>& v)
|
||||
inline aiVector3t<TReal> aiQuaterniont<TReal>::Rotate (const aiVector3t<TReal>& v) const
|
||||
{
|
||||
aiQuaterniont q2(0.f,v.x,v.y,v.z), q = *this, qinv = q;
|
||||
qinv.Conjugate();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -49,40 +47,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_TYPES_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// Some runtime headers
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
// Our compile configuration
|
||||
#include <assimp/defs.h>
|
||||
|
||||
// Some types moved to separate header due to size of operators
|
||||
#include <assimp/vector3.h>
|
||||
#include <assimp/vector2.h>
|
||||
#include <assimp/vector3.h>
|
||||
#include <assimp/color4.h>
|
||||
#include <assimp/matrix3x3.h>
|
||||
#include <assimp/matrix4x4.h>
|
||||
#include <assimp/quaternion.h>
|
||||
|
||||
typedef int32_t ai_int32;
|
||||
typedef uint32_t ai_uint32 ;
|
||||
typedef uint32_t ai_uint32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstring>
|
||||
#include <new> // for std::nothrow_t
|
||||
#include <string> // for aiString::Set(const std::string&)
|
||||
|
||||
namespace Assimp {
|
||||
#include <cstring>
|
||||
#include <new> // for std::nothrow_t
|
||||
#include <string> // for aiString::Set(const std::string&)
|
||||
|
||||
namespace Assimp {
|
||||
//! @cond never
|
||||
namespace Intern {
|
||||
// --------------------------------------------------------------------
|
||||
/** @brief Internal helper class to utilize our internal new/delete
|
||||
namespace Intern {
|
||||
// --------------------------------------------------------------------
|
||||
/** @brief Internal helper class to utilize our internal new/delete
|
||||
* routines for allocating object of this and derived classes.
|
||||
*
|
||||
* By doing this you can safely share class objects between Assimp
|
||||
@@ -93,25 +92,25 @@ namespace Intern {
|
||||
* If it lies on a different heap than Assimp is working with,
|
||||
* the application is determined to crash.
|
||||
*/
|
||||
// --------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef SWIG
|
||||
struct ASSIMP_API AllocateFromAssimpHeap {
|
||||
// http://www.gotw.ca/publications/mill15.htm
|
||||
struct ASSIMP_API AllocateFromAssimpHeap {
|
||||
// http://www.gotw.ca/publications/mill15.htm
|
||||
|
||||
// new/delete overload
|
||||
void *operator new ( size_t num_bytes) /* throw( std::bad_alloc ) */;
|
||||
void *operator new ( size_t num_bytes, const std::nothrow_t& ) throw();
|
||||
void operator delete ( void* data);
|
||||
// new/delete overload
|
||||
void *operator new(size_t num_bytes) /* throw( std::bad_alloc ) */;
|
||||
void *operator new(size_t num_bytes, const std::nothrow_t &) throw();
|
||||
void operator delete(void *data);
|
||||
|
||||
// array new/delete overload
|
||||
void *operator new[] ( size_t num_bytes) /* throw( std::bad_alloc ) */;
|
||||
void *operator new[] ( size_t num_bytes, const std::nothrow_t& ) throw();
|
||||
void operator delete[] ( void* data);
|
||||
// array new/delete overload
|
||||
void *operator new[](size_t num_bytes) /* throw( std::bad_alloc ) */;
|
||||
void *operator new[](size_t num_bytes, const std::nothrow_t &) throw();
|
||||
void operator delete[](void *data);
|
||||
|
||||
}; // struct AllocateFromAssimpHeap
|
||||
}; // struct AllocateFromAssimpHeap
|
||||
#endif
|
||||
} // namespace Intern
|
||||
//! @endcond
|
||||
//! @endcond
|
||||
} // namespace Assimp
|
||||
|
||||
extern "C" {
|
||||
@@ -119,9 +118,9 @@ extern "C" {
|
||||
|
||||
/** Maximum dimension for strings, ASSIMP strings are zero terminated. */
|
||||
#ifdef __cplusplus
|
||||
static const size_t MAXLEN = 1024;
|
||||
static const size_t MAXLEN = 1024;
|
||||
#else
|
||||
# define MAXLEN 1024
|
||||
#define MAXLEN 1024
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
@@ -129,16 +128,17 @@ extern "C" {
|
||||
*/
|
||||
struct aiPlane {
|
||||
#ifdef __cplusplus
|
||||
aiPlane () AI_NO_EXCEPT : a(0.f), b(0.f), c(0.f), d(0.f) {}
|
||||
aiPlane (ai_real _a, ai_real _b, ai_real _c, ai_real _d)
|
||||
: a(_a), b(_b), c(_c), d(_d) {}
|
||||
aiPlane() AI_NO_EXCEPT : a(0.f), b(0.f), c(0.f), d(0.f) {}
|
||||
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) {}
|
||||
aiPlane(const aiPlane &o) :
|
||||
a(o.a), b(o.b), c(o.c), d(o.d) {}
|
||||
|
||||
#endif // !__cplusplus
|
||||
|
||||
//! Plane equation
|
||||
ai_real a,b,c,d;
|
||||
ai_real a, b, c, d;
|
||||
}; // !struct aiPlane
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
@@ -146,11 +146,12 @@ struct aiPlane {
|
||||
*/
|
||||
struct aiRay {
|
||||
#ifdef __cplusplus
|
||||
aiRay () AI_NO_EXCEPT {}
|
||||
aiRay (const aiVector3D& _pos, const aiVector3D& _dir)
|
||||
: pos(_pos), dir(_dir) {}
|
||||
aiRay() AI_NO_EXCEPT {}
|
||||
aiRay(const aiVector3D &_pos, const aiVector3D &_dir) :
|
||||
pos(_pos), dir(_dir) {}
|
||||
|
||||
aiRay (const aiRay& o) : pos (o.pos), dir (o.dir) {}
|
||||
aiRay(const aiRay &o) :
|
||||
pos(o.pos), dir(o.dir) {}
|
||||
|
||||
#endif // !__cplusplus
|
||||
|
||||
@@ -161,55 +162,55 @@ struct aiRay {
|
||||
// ----------------------------------------------------------------------------------
|
||||
/** Represents a color in Red-Green-Blue space.
|
||||
*/
|
||||
struct aiColor3D
|
||||
{
|
||||
struct aiColor3D {
|
||||
#ifdef __cplusplus
|
||||
aiColor3D () AI_NO_EXCEPT : r(0.0f), g(0.0f), b(0.0f) {}
|
||||
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) {}
|
||||
aiColor3D() AI_NO_EXCEPT : r(0.0f), g(0.0f), b(0.0f) {}
|
||||
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) {}
|
||||
|
||||
aiColor3D &operator=(const aiColor3D &o) {
|
||||
r = o.r;
|
||||
g = o.g;
|
||||
b = o.b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Component-wise comparison */
|
||||
// TODO: add epsilon?
|
||||
bool operator == (const aiColor3D& other) const
|
||||
{return r == other.r && g == other.g && b == other.b;}
|
||||
|
||||
/** Component-wise inverse comparison */
|
||||
// TODO: add epsilon?
|
||||
bool operator != (const aiColor3D& other) const
|
||||
{return r != other.r || g != other.g || b != other.b;}
|
||||
aiColor3D &operator=(const aiColor3D &o) {
|
||||
r = o.r;
|
||||
g = o.g;
|
||||
b = o.b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** 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 ) ) );
|
||||
bool operator==(const aiColor3D &other) const { return r == other.r && g == other.g && b == other.b; }
|
||||
|
||||
/** Component-wise inverse comparison */
|
||||
// TODO: add epsilon?
|
||||
bool operator!=(const aiColor3D &other) const { return r != other.r || g != other.g || b != other.b; }
|
||||
|
||||
/** 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)));
|
||||
}
|
||||
|
||||
/** Component-wise addition */
|
||||
aiColor3D operator+(const aiColor3D& c) const {
|
||||
return aiColor3D(r+c.r,g+c.g,b+c.b);
|
||||
aiColor3D operator+(const aiColor3D &c) const {
|
||||
return aiColor3D(r + c.r, g + c.g, b + c.b);
|
||||
}
|
||||
|
||||
/** Component-wise subtraction */
|
||||
aiColor3D operator-(const aiColor3D& c) const {
|
||||
return aiColor3D(r-c.r,g-c.g,b-c.b);
|
||||
aiColor3D operator-(const aiColor3D &c) const {
|
||||
return aiColor3D(r - c.r, g - c.g, b - c.b);
|
||||
}
|
||||
|
||||
/** Component-wise multiplication */
|
||||
aiColor3D operator*(const aiColor3D& c) const {
|
||||
return aiColor3D(r*c.r,g*c.g,b*c.b);
|
||||
aiColor3D operator*(const aiColor3D &c) const {
|
||||
return aiColor3D(r * c.r, g * c.g, b * c.b);
|
||||
}
|
||||
|
||||
/** Multiply with a scalar */
|
||||
aiColor3D operator*(ai_real f) const {
|
||||
return aiColor3D(r*f,g*f,b*f);
|
||||
return aiColor3D(r * f, g * f, b * f);
|
||||
}
|
||||
|
||||
/** Access a specific color component */
|
||||
@@ -218,12 +219,12 @@ struct aiColor3D
|
||||
}
|
||||
|
||||
/** Access a specific color component */
|
||||
ai_real& operator[](unsigned int i) {
|
||||
if ( 0 == i ) {
|
||||
ai_real &operator[](unsigned int i) {
|
||||
if (0 == i) {
|
||||
return r;
|
||||
} else if ( 1 == i ) {
|
||||
} else if (1 == i) {
|
||||
return g;
|
||||
} else if ( 2 == i ) {
|
||||
} else if (2 == i) {
|
||||
return b;
|
||||
}
|
||||
return r;
|
||||
@@ -232,14 +233,14 @@ struct aiColor3D
|
||||
/** Check whether a color is black */
|
||||
bool IsBlack() const {
|
||||
static const ai_real epsilon = ai_real(10e-3);
|
||||
return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon;
|
||||
return std::fabs(r) < epsilon && std::fabs(g) < epsilon && std::fabs(b) < epsilon;
|
||||
}
|
||||
|
||||
#endif // !__cplusplus
|
||||
|
||||
//! Red, green and blue color values
|
||||
ai_real r, g, b;
|
||||
}; // !struct aiColor3D
|
||||
}; // !struct aiColor3D
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
/** Represents an UTF-8 string, zero byte terminated.
|
||||
@@ -262,99 +263,95 @@ struct aiColor3D
|
||||
* (binary) length of such a string is limited to MAXLEN characters (including the
|
||||
* the terminating zero).
|
||||
*/
|
||||
struct aiString
|
||||
{
|
||||
struct aiString {
|
||||
#ifdef __cplusplus
|
||||
/** Default constructor, the string is set to have zero length */
|
||||
aiString() AI_NO_EXCEPT
|
||||
: length( 0 ) {
|
||||
: length(0) {
|
||||
data[0] = '\0';
|
||||
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
// Debug build: overwrite the string on its full length with ESC (27)
|
||||
memset(data+1,27,MAXLEN-1);
|
||||
memset(data + 1, 27, MAXLEN - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Copy constructor */
|
||||
aiString(const aiString& rOther)
|
||||
: length(rOther.length)
|
||||
{
|
||||
aiString(const aiString &rOther) :
|
||||
length(rOther.length) {
|
||||
// Crop the string to the maximum length
|
||||
length = length>=MAXLEN?MAXLEN-1:length;
|
||||
memcpy( data, rOther.data, length);
|
||||
length = length >= MAXLEN ? MAXLEN - 1 : length;
|
||||
memcpy(data, rOther.data, length);
|
||||
data[length] = '\0';
|
||||
}
|
||||
|
||||
/** Constructor from std::string */
|
||||
explicit aiString(const std::string& pString) :
|
||||
length( (ai_uint32) pString.length())
|
||||
{
|
||||
length = length>=MAXLEN?MAXLEN-1:length;
|
||||
memcpy( data, pString.c_str(), length);
|
||||
explicit aiString(const std::string &pString) :
|
||||
length((ai_uint32)pString.length()) {
|
||||
length = length >= MAXLEN ? MAXLEN - 1 : length;
|
||||
memcpy(data, pString.c_str(), length);
|
||||
data[length] = '\0';
|
||||
}
|
||||
|
||||
/** Copy a std::string to the aiString */
|
||||
void Set( const std::string& pString) {
|
||||
if( pString.length() > MAXLEN - 1) {
|
||||
void Set(const std::string &pString) {
|
||||
if (pString.length() > MAXLEN - 1) {
|
||||
return;
|
||||
}
|
||||
length = (ai_uint32)pString.length();
|
||||
memcpy( data, pString.c_str(), length);
|
||||
memcpy(data, pString.c_str(), length);
|
||||
data[length] = 0;
|
||||
}
|
||||
|
||||
/** Copy a const char* to the aiString */
|
||||
void Set( const char* sz) {
|
||||
const ai_int32 len = (ai_uint32) ::strlen(sz);
|
||||
if( len > (ai_int32)MAXLEN - 1) {
|
||||
void Set(const char *sz) {
|
||||
const ai_int32 len = (ai_uint32)::strlen(sz);
|
||||
if (len > (ai_int32)MAXLEN - 1) {
|
||||
return;
|
||||
}
|
||||
length = len;
|
||||
memcpy( data, sz, len);
|
||||
memcpy(data, sz, len);
|
||||
data[len] = 0;
|
||||
}
|
||||
|
||||
|
||||
/** Assignment operator */
|
||||
aiString& operator = (const aiString &rOther) {
|
||||
aiString &operator=(const aiString &rOther) {
|
||||
if (this == &rOther) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
length = rOther.length;;
|
||||
memcpy( data, rOther.data, length);
|
||||
length = rOther.length;
|
||||
;
|
||||
memcpy(data, rOther.data, length);
|
||||
data[length] = '\0';
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/** Assign a const char* to the string */
|
||||
aiString& operator = (const char* sz) {
|
||||
aiString &operator=(const char *sz) {
|
||||
Set(sz);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Assign a cstd::string to the string */
|
||||
aiString& operator = ( const std::string& pString) {
|
||||
aiString &operator=(const std::string &pString) {
|
||||
Set(pString);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Comparison operator */
|
||||
bool operator==(const aiString& other) const {
|
||||
return (length == other.length && 0 == memcmp(data,other.data,length));
|
||||
bool operator==(const aiString &other) const {
|
||||
return (length == other.length && 0 == memcmp(data, other.data, length));
|
||||
}
|
||||
|
||||
/** Inverse comparison operator */
|
||||
bool operator!=(const aiString& other) const {
|
||||
return (length != other.length || 0 != memcmp(data,other.data,length));
|
||||
bool operator!=(const aiString &other) const {
|
||||
return (length != other.length || 0 != memcmp(data, other.data, length));
|
||||
}
|
||||
|
||||
/** Append a string to the string */
|
||||
void Append (const char* app) {
|
||||
const ai_uint32 len = (ai_uint32) ::strlen(app);
|
||||
void Append(const char *app) {
|
||||
const ai_uint32 len = (ai_uint32)::strlen(app);
|
||||
if (!len) {
|
||||
return;
|
||||
}
|
||||
@@ -362,23 +359,23 @@ struct aiString
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(&data[length],app,len+1);
|
||||
memcpy(&data[length], app, len + 1);
|
||||
length += len;
|
||||
}
|
||||
|
||||
/** Clear the string - reset its length to zero */
|
||||
void Clear () {
|
||||
length = 0;
|
||||
void Clear() {
|
||||
length = 0;
|
||||
data[0] = '\0';
|
||||
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
// Debug build: overwrite the string on its full length with ESC (27)
|
||||
memset(data+1,27,MAXLEN-1);
|
||||
memset(data + 1, 27, MAXLEN - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Returns a pointer to the underlying zero-terminated array of characters */
|
||||
const char* C_Str() const {
|
||||
const char *C_Str() const {
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -391,15 +388,13 @@ struct aiString
|
||||
|
||||
/** String buffer. Size limit is MAXLEN */
|
||||
char data[MAXLEN];
|
||||
} ; // !struct aiString
|
||||
|
||||
}; // !struct aiString
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
/** Standard return type for some library functions.
|
||||
* Rarely used, and if, mostly in the C API.
|
||||
*/
|
||||
typedef enum aiReturn
|
||||
{
|
||||
typedef enum aiReturn {
|
||||
/** Indicates that a function was successful */
|
||||
aiReturn_SUCCESS = 0x0,
|
||||
|
||||
@@ -417,19 +412,18 @@ typedef enum aiReturn
|
||||
_AI_ENFORCE_ENUM_SIZE = 0x7fffffff
|
||||
|
||||
/// @endcond
|
||||
} aiReturn; // !enum aiReturn
|
||||
} aiReturn; // !enum aiReturn
|
||||
|
||||
// just for backwards compatibility, don't use these constants anymore
|
||||
#define AI_SUCCESS aiReturn_SUCCESS
|
||||
#define AI_FAILURE aiReturn_FAILURE
|
||||
#define AI_SUCCESS aiReturn_SUCCESS
|
||||
#define AI_FAILURE aiReturn_FAILURE
|
||||
#define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
/** Seek origins (for the virtual file system API).
|
||||
* Much cooler than using SEEK_SET, SEEK_CUR or SEEK_END.
|
||||
*/
|
||||
enum aiOrigin
|
||||
{
|
||||
enum aiOrigin {
|
||||
/** Beginning of the file */
|
||||
aiOrigin_SET = 0x0,
|
||||
|
||||
@@ -452,8 +446,7 @@ enum aiOrigin
|
||||
* Logging to these streams can be enabled with a single call to
|
||||
* #LogStream::createDefaultStream.
|
||||
*/
|
||||
enum aiDefaultLogStream
|
||||
{
|
||||
enum aiDefaultLogStream {
|
||||
/** Stream the log to a file */
|
||||
aiDefaultLogStream_FILE = 0x1,
|
||||
|
||||
@@ -476,9 +469,9 @@ enum aiDefaultLogStream
|
||||
}; // !enum aiDefaultLogStream
|
||||
|
||||
// just for backwards compatibility, don't use these constants anymore
|
||||
#define DLS_FILE aiDefaultLogStream_FILE
|
||||
#define DLS_STDOUT aiDefaultLogStream_STDOUT
|
||||
#define DLS_STDERR aiDefaultLogStream_STDERR
|
||||
#define DLS_FILE aiDefaultLogStream_FILE
|
||||
#define DLS_STDOUT aiDefaultLogStream_STDOUT
|
||||
#define DLS_STDERR aiDefaultLogStream_STDERR
|
||||
#define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
@@ -486,21 +479,19 @@ enum aiDefaultLogStream
|
||||
* animations) of an import. All sizes are in bytes.
|
||||
* @see Importer::GetMemoryRequirements()
|
||||
*/
|
||||
struct aiMemoryInfo
|
||||
{
|
||||
struct aiMemoryInfo {
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** Default constructor */
|
||||
aiMemoryInfo() AI_NO_EXCEPT
|
||||
: textures (0)
|
||||
, materials (0)
|
||||
, meshes (0)
|
||||
, nodes (0)
|
||||
, animations (0)
|
||||
, cameras (0)
|
||||
, lights (0)
|
||||
, total (0)
|
||||
{}
|
||||
: textures(0),
|
||||
materials(0),
|
||||
meshes(0),
|
||||
nodes(0),
|
||||
animations(0),
|
||||
cameras(0),
|
||||
lights(0),
|
||||
total(0) {}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -537,8 +528,8 @@ struct aiMemoryInfo
|
||||
#include "vector2.inl"
|
||||
#include "vector3.inl"
|
||||
#include "color4.inl"
|
||||
#include "quaternion.inl"
|
||||
#include "matrix3x3.inl"
|
||||
#include "matrix4x4.inl"
|
||||
#include "quaternion.inl"
|
||||
|
||||
#endif // AI_TYPES_H_INC
|
||||
|
||||
Reference in New Issue
Block a user