Merge branch 'master' into master
commit
09eba0f039
|
@ -44,15 +44,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Implementation of the Plain-C API
|
* @brief Implementation of the Plain-C API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assimp/BaseImporter.h>
|
||||||
|
#include <assimp/Exceptional.h>
|
||||||
|
#include <assimp/GenericProperty.h>
|
||||||
#include <assimp/cimport.h>
|
#include <assimp/cimport.h>
|
||||||
#include <assimp/LogStream.hpp>
|
|
||||||
#include <assimp/DefaultLogger.hpp>
|
|
||||||
#include <assimp/Importer.hpp>
|
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/GenericProperty.h>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/LogStream.hpp>
|
||||||
|
|
||||||
#include "CApi/CInterfaceIOWrapper.h"
|
#include "CApi/CInterfaceIOWrapper.h"
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
|
@ -62,8 +62,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
# include <thread>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
#endif
|
#endif
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -100,8 +100,7 @@ namespace Assimp {
|
||||||
|
|
||||||
/** will delete all registered importers. */
|
/** will delete all registered importers. */
|
||||||
void DeleteImporterInstanceList(std::vector<BaseImporter *> &out);
|
void DeleteImporterInstanceList(std::vector<BaseImporter *> &out);
|
||||||
} // namespace assimp
|
} // namespace Assimp
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
/** Global mutex to manage the access to the log-stream map */
|
/** Global mutex to manage the access to the log-stream map */
|
||||||
|
@ -112,8 +111,8 @@ static std::mutex gLogStreamMutex;
|
||||||
// Custom LogStream implementation for the C-API
|
// Custom LogStream implementation for the C-API
|
||||||
class LogToCallbackRedirector : public LogStream {
|
class LogToCallbackRedirector : public LogStream {
|
||||||
public:
|
public:
|
||||||
explicit LogToCallbackRedirector(const aiLogStream& s)
|
explicit LogToCallbackRedirector(const aiLogStream &s) :
|
||||||
: stream (s) {
|
stream(s) {
|
||||||
ai_assert(NULL != s.callback);
|
ai_assert(NULL != s.callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,8 +211,7 @@ const aiScene* aiImportFileFromMemory(
|
||||||
const char *pBuffer,
|
const char *pBuffer,
|
||||||
unsigned int pLength,
|
unsigned int pLength,
|
||||||
unsigned int pFlags,
|
unsigned int pFlags,
|
||||||
const char* pHint)
|
const char *pHint) {
|
||||||
{
|
|
||||||
return aiImportFileFromMemoryWithProperties(pBuffer, pLength, pFlags, pHint, NULL);
|
return aiImportFileFromMemoryWithProperties(pBuffer, pLength, pFlags, pHint, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,8 +221,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
|
||||||
unsigned int pLength,
|
unsigned int pLength,
|
||||||
unsigned int pFlags,
|
unsigned int pFlags,
|
||||||
const char *pHint,
|
const char *pHint,
|
||||||
const aiPropertyStore* props)
|
const aiPropertyStore *props) {
|
||||||
{
|
|
||||||
ai_assert(NULL != pBuffer);
|
ai_assert(NULL != pBuffer);
|
||||||
ai_assert(0 != pLength);
|
ai_assert(0 != pLength);
|
||||||
|
|
||||||
|
@ -251,8 +248,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
|
||||||
if (scene) {
|
if (scene) {
|
||||||
ScenePrivateData *priv = const_cast<ScenePrivateData *>(ScenePriv(scene));
|
ScenePrivateData *priv = const_cast<ScenePrivateData *>(ScenePriv(scene));
|
||||||
priv->mOrigImporter = imp;
|
priv->mOrigImporter = imp;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// if failed, extract error code and destroy the import
|
// if failed, extract error code and destroy the import
|
||||||
gLastErrorString = imp->GetErrorString();
|
gLastErrorString = imp->GetErrorString();
|
||||||
delete imp;
|
delete imp;
|
||||||
|
@ -264,8 +260,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Releases all resources associated with the given import process.
|
// Releases all resources associated with the given import process.
|
||||||
void aiReleaseImport( const aiScene* pScene)
|
void aiReleaseImport(const aiScene *pScene) {
|
||||||
{
|
|
||||||
if (!pScene) {
|
if (!pScene) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -276,8 +271,7 @@ void aiReleaseImport( const aiScene* pScene)
|
||||||
const ScenePrivateData *priv = ScenePriv(pScene);
|
const ScenePrivateData *priv = ScenePriv(pScene);
|
||||||
if (!priv || !priv->mOrigImporter) {
|
if (!priv || !priv->mOrigImporter) {
|
||||||
delete pScene;
|
delete pScene;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// deleting the Importer also deletes the scene
|
// deleting the Importer also deletes the scene
|
||||||
// Note: the reason that this is not written as 'delete priv->mOrigImporter'
|
// Note: the reason that this is not written as 'delete priv->mOrigImporter'
|
||||||
// is a suspected bug in gcc 4.4+ (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52339)
|
// is a suspected bug in gcc 4.4+ (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52339)
|
||||||
|
@ -290,11 +284,9 @@ void aiReleaseImport( const aiScene* pScene)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API const aiScene *aiApplyPostProcessing(const aiScene *pScene,
|
ASSIMP_API const aiScene *aiApplyPostProcessing(const aiScene *pScene,
|
||||||
unsigned int pFlags)
|
unsigned int pFlags) {
|
||||||
{
|
|
||||||
const aiScene *sc = NULL;
|
const aiScene *sc = NULL;
|
||||||
|
|
||||||
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
// find the importer associated with this data
|
// find the importer associated with this data
|
||||||
|
@ -343,8 +335,7 @@ ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CallbackToLogRedirector (const char* msg, char* dt)
|
void CallbackToLogRedirector(const char *msg, char *dt) {
|
||||||
{
|
|
||||||
ai_assert(NULL != msg);
|
ai_assert(NULL != msg);
|
||||||
ai_assert(NULL != dt);
|
ai_assert(NULL != dt);
|
||||||
LogStream *s = (LogStream *)dt;
|
LogStream *s = (LogStream *)dt;
|
||||||
|
@ -353,8 +344,7 @@ void CallbackToLogRedirector (const char* msg, char* dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const char* file)
|
ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream, const char *file) {
|
||||||
{
|
|
||||||
aiLogStream sout;
|
aiLogStream sout;
|
||||||
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
@ -362,8 +352,7 @@ ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
sout.callback = NULL;
|
sout.callback = NULL;
|
||||||
sout.user = NULL;
|
sout.user = NULL;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sout.callback = &CallbackToLogRedirector;
|
sout.callback = &CallbackToLogRedirector;
|
||||||
sout.user = (char *)stream;
|
sout.user = (char *)stream;
|
||||||
}
|
}
|
||||||
|
@ -373,8 +362,7 @@ ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
|
ASSIMP_API void aiAttachLogStream(const aiLogStream *stream) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
|
@ -392,8 +380,7 @@ ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
|
ASSIMP_API aiReturn aiDetachLogStream(const aiLogStream *stream) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
|
@ -418,8 +405,7 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiDetachAllLogStreams(void)
|
ASSIMP_API void aiDetachAllLogStreams(void) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
||||||
|
@ -440,8 +426,7 @@ ASSIMP_API void aiDetachAllLogStreams(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiEnableVerboseLogging(aiBool d)
|
ASSIMP_API void aiEnableVerboseLogging(aiBool d) {
|
||||||
{
|
|
||||||
if (!DefaultLogger::isNullLogger()) {
|
if (!DefaultLogger::isNullLogger()) {
|
||||||
DefaultLogger::get()->setLogSeverity((d == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
|
DefaultLogger::get()->setLogSeverity((d == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
|
||||||
}
|
}
|
||||||
|
@ -450,29 +435,25 @@ ASSIMP_API void aiEnableVerboseLogging(aiBool d)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns the error text of the last failed import process.
|
// Returns the error text of the last failed import process.
|
||||||
const char* aiGetErrorString()
|
const char *aiGetErrorString() {
|
||||||
{
|
|
||||||
return gLastErrorString.c_str();
|
return gLastErrorString.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
// Return the description of a importer given its index
|
// Return the description of a importer given its index
|
||||||
const aiImporterDesc* aiGetImportFormatDescription( size_t pIndex)
|
const aiImporterDesc *aiGetImportFormatDescription(size_t pIndex) {
|
||||||
{
|
|
||||||
return Importer().GetImporterInfo(pIndex);
|
return Importer().GetImporterInfo(pIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
// Return the number of importers
|
// Return the number of importers
|
||||||
size_t aiGetImportFormatCount(void)
|
size_t aiGetImportFormatCount(void) {
|
||||||
{
|
|
||||||
return Importer().GetImporterCount();
|
return Importer().GetImporterCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns the error text of the last failed import process.
|
// Returns the error text of the last failed import process.
|
||||||
aiBool aiIsExtensionSupported(const char* szExtension)
|
aiBool aiIsExtensionSupported(const char *szExtension) {
|
||||||
{
|
|
||||||
ai_assert(NULL != szExtension);
|
ai_assert(NULL != szExtension);
|
||||||
aiBool candoit = AI_FALSE;
|
aiBool candoit = AI_FALSE;
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
@ -487,8 +468,7 @@ aiBool aiIsExtensionSupported(const char* szExtension)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Get a list of all file extensions supported by ASSIMP
|
// Get a list of all file extensions supported by ASSIMP
|
||||||
void aiGetExtensionList(aiString* szOut)
|
void aiGetExtensionList(aiString *szOut) {
|
||||||
{
|
|
||||||
ai_assert(NULL != szOut);
|
ai_assert(NULL != szOut);
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
|
@ -502,8 +482,7 @@ void aiGetExtensionList(aiString* szOut)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Get the memory requirements for a particular import.
|
// Get the memory requirements for a particular import.
|
||||||
void aiGetMemoryRequirements(const C_STRUCT aiScene *pIn,
|
void aiGetMemoryRequirements(const C_STRUCT aiScene *pIn,
|
||||||
C_STRUCT aiMemoryInfo* in)
|
C_STRUCT aiMemoryInfo *in) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
// find the importer associated with this data
|
// find the importer associated with this data
|
||||||
|
@ -518,21 +497,18 @@ void aiGetMemoryRequirements(const C_STRUCT aiScene* pIn,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API aiPropertyStore* aiCreatePropertyStore(void)
|
ASSIMP_API aiPropertyStore *aiCreatePropertyStore(void) {
|
||||||
{
|
|
||||||
return reinterpret_cast<aiPropertyStore *>(new PropertyMap());
|
return reinterpret_cast<aiPropertyStore *>(new PropertyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiReleasePropertyStore(aiPropertyStore* p)
|
ASSIMP_API void aiReleasePropertyStore(aiPropertyStore *p) {
|
||||||
{
|
|
||||||
delete reinterpret_cast<PropertyMap *>(p);
|
delete reinterpret_cast<PropertyMap *>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyInteger
|
// Importer::SetPropertyInteger
|
||||||
ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szName, int value)
|
ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore *p, const char *szName, int value) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
||||||
SetGenericProperty<int>(pp->ints, szName, value);
|
SetGenericProperty<int>(pp->ints, szName, value);
|
||||||
|
@ -541,8 +517,7 @@ ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szNam
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyFloat
|
// Importer::SetPropertyFloat
|
||||||
ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, ai_real value)
|
ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore *p, const char *szName, ai_real value) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
||||||
SetGenericProperty<ai_real>(pp->floats, szName, value);
|
SetGenericProperty<ai_real>(pp->floats, szName, value);
|
||||||
|
@ -552,8 +527,7 @@ ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName,
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyString
|
// Importer::SetPropertyString
|
||||||
ASSIMP_API void aiSetImportPropertyString(aiPropertyStore *p, const char *szName,
|
ASSIMP_API void aiSetImportPropertyString(aiPropertyStore *p, const char *szName,
|
||||||
const C_STRUCT aiString* st)
|
const C_STRUCT aiString *st) {
|
||||||
{
|
|
||||||
if (!st) {
|
if (!st) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -566,8 +540,7 @@ ASSIMP_API void aiSetImportPropertyString(aiPropertyStore* p, const char* szName
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyMatrix
|
// Importer::SetPropertyMatrix
|
||||||
ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore *p, const char *szName,
|
ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore *p, const char *szName,
|
||||||
const C_STRUCT aiMatrix4x4* mat)
|
const C_STRUCT aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
if (!mat) {
|
if (!mat) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -579,8 +552,7 @@ ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore* p, const char* szName
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Rotation matrix to quaternion
|
// Rotation matrix to quaternion
|
||||||
ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
|
ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion *quat, const aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != quat);
|
ai_assert(NULL != quat);
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
*quat = aiQuaternion(*mat);
|
*quat = aiQuaternion(*mat);
|
||||||
|
@ -590,8 +562,7 @@ ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x
|
||||||
// Matrix decomposition
|
// Matrix decomposition
|
||||||
ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4 *mat, aiVector3D *scaling,
|
ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4 *mat, aiVector3D *scaling,
|
||||||
aiQuaternion *rotation,
|
aiQuaternion *rotation,
|
||||||
aiVector3D* position)
|
aiVector3D *position) {
|
||||||
{
|
|
||||||
ai_assert(NULL != rotation);
|
ai_assert(NULL != rotation);
|
||||||
ai_assert(NULL != position);
|
ai_assert(NULL != position);
|
||||||
ai_assert(NULL != scaling);
|
ai_assert(NULL != scaling);
|
||||||
|
@ -601,15 +572,13 @@ ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4* mat,aiVector3D* scaling,
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Matrix transpose
|
// Matrix transpose
|
||||||
ASSIMP_API void aiTransposeMatrix3(aiMatrix3x3* mat)
|
ASSIMP_API void aiTransposeMatrix3(aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
mat->Transpose();
|
mat->Transpose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
|
ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
mat->Transpose();
|
mat->Transpose();
|
||||||
}
|
}
|
||||||
|
@ -617,8 +586,7 @@ ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Vector transformation
|
// Vector transformation
|
||||||
ASSIMP_API void aiTransformVecByMatrix3(aiVector3D *vec,
|
ASSIMP_API void aiTransformVecByMatrix3(aiVector3D *vec,
|
||||||
const aiMatrix3x3* mat)
|
const aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
ai_assert(NULL != vec);
|
ai_assert(NULL != vec);
|
||||||
*vec *= (*mat);
|
*vec *= (*mat);
|
||||||
|
@ -626,8 +594,7 @@ ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiTransformVecByMatrix4(aiVector3D *vec,
|
ASSIMP_API void aiTransformVecByMatrix4(aiVector3D *vec,
|
||||||
const aiMatrix4x4* mat)
|
const aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
ai_assert(NULL != vec);
|
ai_assert(NULL != vec);
|
||||||
|
|
||||||
|
@ -638,8 +605,7 @@ ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec,
|
||||||
// Matrix multiplication
|
// Matrix multiplication
|
||||||
ASSIMP_API void aiMultiplyMatrix4(
|
ASSIMP_API void aiMultiplyMatrix4(
|
||||||
aiMatrix4x4 *dst,
|
aiMatrix4x4 *dst,
|
||||||
const aiMatrix4x4* src)
|
const aiMatrix4x4 *src) {
|
||||||
{
|
|
||||||
ai_assert(NULL != dst);
|
ai_assert(NULL != dst);
|
||||||
ai_assert(NULL != src);
|
ai_assert(NULL != src);
|
||||||
*dst = (*dst) * (*src);
|
*dst = (*dst) * (*src);
|
||||||
|
@ -648,8 +614,7 @@ ASSIMP_API void aiMultiplyMatrix4(
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiMultiplyMatrix3(
|
ASSIMP_API void aiMultiplyMatrix3(
|
||||||
aiMatrix3x3 *dst,
|
aiMatrix3x3 *dst,
|
||||||
const aiMatrix3x3* src)
|
const aiMatrix3x3 *src) {
|
||||||
{
|
|
||||||
ai_assert(NULL != dst);
|
ai_assert(NULL != dst);
|
||||||
ai_assert(NULL != src);
|
ai_assert(NULL != src);
|
||||||
*dst = (*dst) * (*src);
|
*dst = (*dst) * (*src);
|
||||||
|
@ -658,16 +623,14 @@ ASSIMP_API void aiMultiplyMatrix3(
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Matrix identity
|
// Matrix identity
|
||||||
ASSIMP_API void aiIdentityMatrix3(
|
ASSIMP_API void aiIdentityMatrix3(
|
||||||
aiMatrix3x3* mat)
|
aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
*mat = aiMatrix3x3();
|
*mat = aiMatrix3x3();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiIdentityMatrix4(
|
ASSIMP_API void aiIdentityMatrix4(
|
||||||
aiMatrix4x4* mat)
|
aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
*mat = aiMatrix4x4();
|
*mat = aiMatrix4x4();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -50,27 +49,25 @@ namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
|
||||||
/** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
|
/** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
|
||||||
struct ImportSettings
|
struct ImportSettings {
|
||||||
{
|
ImportSettings() :
|
||||||
ImportSettings()
|
strictMode(true),
|
||||||
: strictMode(true)
|
readAllLayers(true),
|
||||||
, readAllLayers(true)
|
readAllMaterials(false),
|
||||||
, readAllMaterials(false)
|
readMaterials(true),
|
||||||
, readMaterials(true)
|
readTextures(true),
|
||||||
, readTextures(true)
|
readCameras(true),
|
||||||
, readCameras(true)
|
readLights(true),
|
||||||
, readLights(true)
|
readAnimations(true),
|
||||||
, readAnimations(true)
|
readWeights(true),
|
||||||
, readWeights(true)
|
preservePivots(true),
|
||||||
, preservePivots(true)
|
optimizeEmptyAnimationCurves(true),
|
||||||
, optimizeEmptyAnimationCurves(true)
|
useLegacyEmbeddedTextureNaming(false),
|
||||||
, useLegacyEmbeddedTextureNaming(false)
|
removeEmptyBones(true),
|
||||||
, removeEmptyBones( true )
|
convertToMeters(false) {
|
||||||
, convertToMeters( false ) {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** enable strict mode:
|
/** enable strict mode:
|
||||||
* - only accept fbx 2012, 2013 files
|
* - only accept fbx 2012, 2013 files
|
||||||
* - on the slightest error, give up.
|
* - on the slightest error, give up.
|
||||||
|
@ -94,7 +91,6 @@ struct ImportSettings
|
||||||
* This bit is ignored unless readMaterials=true*/
|
* This bit is ignored unless readMaterials=true*/
|
||||||
bool readAllMaterials;
|
bool readAllMaterials;
|
||||||
|
|
||||||
|
|
||||||
/** import materials (true) or skip them and assign a default
|
/** import materials (true) or skip them and assign a default
|
||||||
* material. The default value is true.*/
|
* material. The default value is true.*/
|
||||||
bool readMaterials;
|
bool readMaterials;
|
||||||
|
@ -156,9 +152,7 @@ struct ImportSettings
|
||||||
bool convertToMeters;
|
bool convertToMeters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace FBX
|
||||||
} // !FBX
|
} // namespace Assimp
|
||||||
} // !Assimp
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -55,18 +54,20 @@ namespace Assimp {
|
||||||
|
|
||||||
// TinyFormatter.h
|
// TinyFormatter.h
|
||||||
namespace Formatter {
|
namespace Formatter {
|
||||||
template <typename T,typename TR, typename A> class basic_formatter;
|
|
||||||
|
template <typename T, typename TR, typename A>
|
||||||
|
class basic_formatter;
|
||||||
|
|
||||||
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
||||||
}
|
|
||||||
|
} // namespace Formatter
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
/** Load the Autodesk FBX file format.
|
/// Loads the Autodesk FBX file format.
|
||||||
|
///
|
||||||
See http://en.wikipedia.org/wiki/FBX
|
/// See http://en.wikipedia.org/wiki/FBX
|
||||||
*/
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
class FBXImporter : public BaseImporter, public LogFunctions<FBXImporter>
|
class FBXImporter : public BaseImporter, public LogFunctions<FBXImporter> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
FBXImporter();
|
FBXImporter();
|
||||||
virtual ~FBXImporter();
|
virtual ~FBXImporter();
|
||||||
|
@ -74,11 +75,9 @@ public:
|
||||||
// --------------------
|
// --------------------
|
||||||
bool CanRead(const std::string &pFile,
|
bool CanRead(const std::string &pFile,
|
||||||
IOSystem *pIOHandler,
|
IOSystem *pIOHandler,
|
||||||
bool checkSig
|
bool checkSig) const;
|
||||||
) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const;
|
||||||
|
|
||||||
|
@ -88,8 +87,7 @@ protected:
|
||||||
// --------------------
|
// --------------------
|
||||||
void InternReadFile(const std::string &pFile,
|
void InternReadFile(const std::string &pFile,
|
||||||
aiScene *pScene,
|
aiScene *pScene,
|
||||||
IOSystem* pIOHandler
|
IOSystem *pIOHandler);
|
||||||
);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FBX::ImportSettings settings;
|
FBX::ImportSettings settings;
|
||||||
|
@ -97,4 +95,3 @@ private:
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
#endif // !INCLUDED_AI_FBX_IMPORTER_H
|
#endif // !INCLUDED_AI_FBX_IMPORTER_H
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -100,13 +98,27 @@ struct aiMetadataEntry {
|
||||||
*/
|
*/
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
inline aiMetadataType GetAiType( bool ) { return AI_BOOL; }
|
inline aiMetadataType GetAiType(bool) {
|
||||||
inline aiMetadataType GetAiType( int32_t ) { return AI_INT32; }
|
return AI_BOOL;
|
||||||
inline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; }
|
}
|
||||||
inline aiMetadataType GetAiType( float ) { return AI_FLOAT; }
|
inline aiMetadataType GetAiType(int32_t) {
|
||||||
inline aiMetadataType GetAiType( double ) { return AI_DOUBLE; }
|
return AI_INT32;
|
||||||
inline aiMetadataType GetAiType( const aiString & ) { return AI_AISTRING; }
|
}
|
||||||
inline aiMetadataType GetAiType( const aiVector3D & ) { return AI_AIVECTOR3D; }
|
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
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
@ -134,16 +146,14 @@ struct aiMetadata {
|
||||||
* @brief The default constructor, set all members to zero by default.
|
* @brief The default constructor, set all members to zero by default.
|
||||||
*/
|
*/
|
||||||
aiMetadata() AI_NO_EXCEPT
|
aiMetadata() AI_NO_EXCEPT
|
||||||
: mNumProperties(0)
|
: mNumProperties(0),
|
||||||
, mKeys(nullptr)
|
mKeys(nullptr),
|
||||||
, mValues(nullptr) {
|
mValues(nullptr) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
aiMetadata( const aiMetadata &rhs )
|
aiMetadata(const aiMetadata &rhs) :
|
||||||
: mNumProperties( rhs.mNumProperties )
|
mNumProperties(rhs.mNumProperties), mKeys(nullptr), mValues(nullptr) {
|
||||||
, mKeys( nullptr )
|
|
||||||
, mValues( nullptr ) {
|
|
||||||
mKeys = new aiString[mNumProperties];
|
mKeys = new aiString[mNumProperties];
|
||||||
for (size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i) {
|
for (size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i) {
|
||||||
mKeys[i] = rhs.mKeys[i];
|
mKeys[i] = rhs.mKeys[i];
|
||||||
|
@ -160,45 +170,38 @@ struct aiMetadata {
|
||||||
int32_t v;
|
int32_t v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(int32_t));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(int32_t));
|
||||||
mValues[i].mData = new int32_t(v);
|
mValues[i].mData = new int32_t(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_UINT64: {
|
case AI_UINT64: {
|
||||||
uint64_t v;
|
uint64_t v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(uint64_t));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(uint64_t));
|
||||||
mValues[i].mData = new uint64_t(v);
|
mValues[i].mData = new uint64_t(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_FLOAT: {
|
case AI_FLOAT: {
|
||||||
float v;
|
float v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(float));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(float));
|
||||||
mValues[i].mData = new float(v);
|
mValues[i].mData = new float(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_DOUBLE: {
|
case AI_DOUBLE: {
|
||||||
double v;
|
double v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(double));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(double));
|
||||||
mValues[i].mData = new double(v);
|
mValues[i].mData = new double(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_AISTRING: {
|
case AI_AISTRING: {
|
||||||
aiString v;
|
aiString v;
|
||||||
rhs.Get<aiString>(mKeys[i], v);
|
rhs.Get<aiString>(mKeys[i], v);
|
||||||
mValues[i].mData = new aiString(v);
|
mValues[i].mData = new aiString(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_AIVECTOR3D: {
|
case AI_AIVECTOR3D: {
|
||||||
aiVector3D v;
|
aiVector3D v;
|
||||||
rhs.Get<aiVector3D>(mKeys[i], v);
|
rhs.Get<aiVector3D>(mKeys[i], v);
|
||||||
mValues[i].mData = new aiVector3D(v);
|
mValues[i].mData = new aiVector3D(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
case FORCE_32BIT:
|
case FORCE_32BIT:
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,8 +255,7 @@ struct aiMetadata {
|
||||||
* @brief Allocates property fields + keys.
|
* @brief Allocates property fields + keys.
|
||||||
* @param numProperties Number of requested properties.
|
* @param numProperties Number of requested properties.
|
||||||
*/
|
*/
|
||||||
static inline
|
static inline aiMetadata *Alloc(unsigned int numProperties) {
|
||||||
aiMetadata *Alloc( unsigned int numProperties ) {
|
|
||||||
if (0 == numProperties) {
|
if (0 == numProperties) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -269,19 +271,16 @@ struct aiMetadata {
|
||||||
/**
|
/**
|
||||||
* @brief Deallocates property fields + keys.
|
* @brief Deallocates property fields + keys.
|
||||||
*/
|
*/
|
||||||
static inline
|
static inline void Dealloc(aiMetadata *metadata) {
|
||||||
void Dealloc( aiMetadata *metadata ) {
|
|
||||||
delete metadata;
|
delete metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline void Add(const std::string &key, const T &value) {
|
||||||
void Add(const std::string& key, const T& value) {
|
|
||||||
aiString *new_keys = new aiString[mNumProperties + 1];
|
aiString *new_keys = new aiString[mNumProperties + 1];
|
||||||
aiMetadataEntry *new_values = new aiMetadataEntry[mNumProperties + 1];
|
aiMetadataEntry *new_values = new aiMetadataEntry[mNumProperties + 1];
|
||||||
|
|
||||||
for(unsigned int i = 0; i < mNumProperties; ++i)
|
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||||
{
|
|
||||||
new_keys[i] = mKeys[i];
|
new_keys[i] = mKeys[i];
|
||||||
new_values[i] = mValues[i];
|
new_values[i] = mValues[i];
|
||||||
}
|
}
|
||||||
|
@ -298,8 +297,7 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Set(unsigned index, const std::string &key, const T &value) {
|
||||||
bool Set( unsigned index, const std::string& key, const T& value ) {
|
|
||||||
// In range assertion
|
// In range assertion
|
||||||
if (index >= mNumProperties) {
|
if (index >= mNumProperties) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -322,8 +320,25 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Set( const std::string &key, const T &value ) {
|
||||||
bool Get( unsigned index, T& value ) const {
|
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
|
// In range assertion
|
||||||
if (index >= mNumProperties) {
|
if (index >= mNumProperties) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -343,8 +358,7 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Get(const aiString &key, T &value) const {
|
||||||
bool Get( const aiString& key, T& value ) const {
|
|
||||||
// Search for the given key
|
// Search for the given key
|
||||||
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||||
if (mKeys[i] == key) {
|
if (mKeys[i] == key) {
|
||||||
|
@ -355,8 +369,7 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Get(const std::string &key, T &value) const {
|
||||||
bool Get( const std::string& key, T& value ) const {
|
|
||||||
return Get(aiString(key), value);
|
return Get(aiString(key), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,8 +378,7 @@ struct aiMetadata {
|
||||||
/// \param [out] pKey - pointer to the key value.
|
/// \param [out] pKey - pointer to the key value.
|
||||||
/// \param [out] pEntry - pointer to the entry: type and value.
|
/// \param [out] pEntry - pointer to the entry: type and value.
|
||||||
/// \return false - if pIndex is out of range, else - true.
|
/// \return false - if pIndex is out of range, else - true.
|
||||||
inline
|
inline bool Get(size_t index, const aiString *&key, const aiMetadataEntry *&entry) const {
|
||||||
bool Get(size_t index, const aiString*& key, const aiMetadataEntry*& entry) const {
|
|
||||||
if (index >= mNumProperties) {
|
if (index >= mNumProperties) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -379,8 +391,7 @@ struct aiMetadata {
|
||||||
|
|
||||||
/// Check whether there is a metadata entry for the given key.
|
/// Check whether there is a metadata entry for the given key.
|
||||||
/// \param [in] Key - the key value value to check for.
|
/// \param [in] Key - the key value value to check for.
|
||||||
inline
|
inline bool HasKey(const char *key) {
|
||||||
bool HasKey(const char* key) {
|
|
||||||
if (nullptr == key) {
|
if (nullptr == key) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +406,6 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AI_METADATA_H_INC
|
#endif // AI_METADATA_H_INC
|
||||||
|
|
|
@ -31,40 +31,40 @@ struct Texture {
|
||||||
|
|
||||||
class Mesh {
|
class Mesh {
|
||||||
public:
|
public:
|
||||||
std::vector<VERTEX> vertices;
|
std::vector<VERTEX> vertices_;
|
||||||
std::vector<UINT> indices;
|
std::vector<UINT> indices_;
|
||||||
std::vector<Texture> textures;
|
std::vector<Texture> textures_;
|
||||||
ID3D11Device *dev;
|
ID3D11Device *dev_;
|
||||||
|
|
||||||
Mesh(ID3D11Device *dev, const std::vector<VERTEX>& vertices, const std::vector<UINT>& indices, const std::vector<Texture>& textures) :
|
Mesh(ID3D11Device *dev, const std::vector<VERTEX>& vertices, const std::vector<UINT>& indices, const std::vector<Texture>& textures) :
|
||||||
vertices(vertices),
|
vertices_(vertices),
|
||||||
indices(indices),
|
indices_(indices),
|
||||||
textures(textures),
|
textures_(textures),
|
||||||
dev(dev),
|
dev_(dev),
|
||||||
VertexBuffer(nullptr),
|
VertexBuffer_(nullptr),
|
||||||
IndexBuffer(nullptr) {
|
IndexBuffer_(nullptr) {
|
||||||
this->setupMesh(this->dev);
|
this->setupMesh(this->dev_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw(ID3D11DeviceContext *devcon) {
|
void Draw(ID3D11DeviceContext *devcon) {
|
||||||
UINT stride = sizeof(VERTEX);
|
UINT stride = sizeof(VERTEX);
|
||||||
UINT offset = 0;
|
UINT offset = 0;
|
||||||
|
|
||||||
devcon->IASetVertexBuffers(0, 1, &VertexBuffer, &stride, &offset);
|
devcon->IASetVertexBuffers(0, 1, &VertexBuffer_, &stride, &offset);
|
||||||
devcon->IASetIndexBuffer(IndexBuffer, DXGI_FORMAT_R32_UINT, 0);
|
devcon->IASetIndexBuffer(IndexBuffer_, DXGI_FORMAT_R32_UINT, 0);
|
||||||
|
|
||||||
devcon->PSSetShaderResources(0, 1, &textures[0].texture);
|
devcon->PSSetShaderResources(0, 1, &textures_[0].texture);
|
||||||
|
|
||||||
devcon->DrawIndexed(static_cast<UINT>(indices.size()), 0, 0);
|
devcon->DrawIndexed(static_cast<UINT>(indices_.size()), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() {
|
void Close() {
|
||||||
SafeRelease(VertexBuffer);
|
SafeRelease(VertexBuffer_);
|
||||||
SafeRelease(IndexBuffer);
|
SafeRelease(IndexBuffer_);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
// Render data
|
// Render data
|
||||||
ID3D11Buffer *VertexBuffer, *IndexBuffer;
|
ID3D11Buffer *VertexBuffer_, *IndexBuffer_;
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
// Initializes all the buffer objects/arrays
|
// Initializes all the buffer objects/arrays
|
||||||
|
@ -73,15 +73,15 @@ private:
|
||||||
|
|
||||||
D3D11_BUFFER_DESC vbd;
|
D3D11_BUFFER_DESC vbd;
|
||||||
vbd.Usage = D3D11_USAGE_IMMUTABLE;
|
vbd.Usage = D3D11_USAGE_IMMUTABLE;
|
||||||
vbd.ByteWidth = static_cast<UINT>(sizeof(VERTEX) * vertices.size());
|
vbd.ByteWidth = static_cast<UINT>(sizeof(VERTEX) * vertices_.size());
|
||||||
vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||||
vbd.CPUAccessFlags = 0;
|
vbd.CPUAccessFlags = 0;
|
||||||
vbd.MiscFlags = 0;
|
vbd.MiscFlags = 0;
|
||||||
|
|
||||||
D3D11_SUBRESOURCE_DATA initData;
|
D3D11_SUBRESOURCE_DATA initData;
|
||||||
initData.pSysMem = &vertices[0];
|
initData.pSysMem = &vertices_[0];
|
||||||
|
|
||||||
hr = dev->CreateBuffer(&vbd, &initData, &VertexBuffer);
|
hr = dev->CreateBuffer(&vbd, &initData, &VertexBuffer_);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
Close();
|
Close();
|
||||||
throw std::runtime_error("Failed to create vertex buffer.");
|
throw std::runtime_error("Failed to create vertex buffer.");
|
||||||
|
@ -89,14 +89,14 @@ private:
|
||||||
|
|
||||||
D3D11_BUFFER_DESC ibd;
|
D3D11_BUFFER_DESC ibd;
|
||||||
ibd.Usage = D3D11_USAGE_IMMUTABLE;
|
ibd.Usage = D3D11_USAGE_IMMUTABLE;
|
||||||
ibd.ByteWidth = static_cast<UINT>(sizeof(UINT) * indices.size());
|
ibd.ByteWidth = static_cast<UINT>(sizeof(UINT) * indices_.size());
|
||||||
ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||||
ibd.CPUAccessFlags = 0;
|
ibd.CPUAccessFlags = 0;
|
||||||
ibd.MiscFlags = 0;
|
ibd.MiscFlags = 0;
|
||||||
|
|
||||||
initData.pSysMem = &indices[0];
|
initData.pSysMem = &indices_[0];
|
||||||
|
|
||||||
hr = dev->CreateBuffer(&ibd, &initData, &IndexBuffer);
|
hr = dev->CreateBuffer(&ibd, &initData, &IndexBuffer_);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
Close();
|
Close();
|
||||||
throw std::runtime_error("Failed to create index buffer.");
|
throw std::runtime_error("Failed to create index buffer.");
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#include "ModelLoader.h"
|
#include "ModelLoader.h"
|
||||||
|
|
||||||
ModelLoader::ModelLoader() :
|
ModelLoader::ModelLoader() :
|
||||||
dev(nullptr),
|
dev_(nullptr),
|
||||||
devcon(nullptr),
|
devcon_(nullptr),
|
||||||
meshes(),
|
meshes_(),
|
||||||
directory(),
|
directory_(),
|
||||||
textures_loaded(),
|
textures_loaded_(),
|
||||||
hwnd(nullptr) {
|
hwnd_(nullptr) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ bool ModelLoader::Load(HWND hwnd, ID3D11Device * dev, ID3D11DeviceContext * devc
|
||||||
if (pScene == NULL)
|
if (pScene == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->directory = filename.substr(0, filename.find_last_of("/\\"));
|
this->directory_ = filename.substr(0, filename.find_last_of("/\\"));
|
||||||
|
|
||||||
this->dev = dev;
|
this->dev_ = dev;
|
||||||
this->devcon = devcon;
|
this->devcon_ = devcon;
|
||||||
this->hwnd = hwnd;
|
this->hwnd_ = hwnd;
|
||||||
|
|
||||||
processNode(pScene->mRootNode, pScene);
|
processNode(pScene->mRootNode, pScene);
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ bool ModelLoader::Load(HWND hwnd, ID3D11Device * dev, ID3D11DeviceContext * devc
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelLoader::Draw(ID3D11DeviceContext * devcon) {
|
void ModelLoader::Draw(ID3D11DeviceContext * devcon) {
|
||||||
for (int i = 0; i < meshes.size(); ++i ) {
|
for (size_t i = 0; i < meshes_.size(); ++i ) {
|
||||||
meshes[i].Draw(devcon);
|
meshes_[i].Draw(devcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ Mesh ModelLoader::processMesh(aiMesh * mesh, const aiScene * scene) {
|
||||||
textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());
|
textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Mesh(dev, vertices, indices, textures);
|
return Mesh(dev_, vertices, indices, textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Texture> ModelLoader::loadMaterialTextures(aiMaterial * mat, aiTextureType type, std::string typeName, const aiScene * scene) {
|
std::vector<Texture> ModelLoader::loadMaterialTextures(aiMaterial * mat, aiTextureType type, std::string typeName, const aiScene * scene) {
|
||||||
|
@ -98,9 +98,9 @@ std::vector<Texture> ModelLoader::loadMaterialTextures(aiMaterial * mat, aiTextu
|
||||||
mat->GetTexture(type, i, &str);
|
mat->GetTexture(type, i, &str);
|
||||||
// Check if texture was loaded before and if so, continue to next iteration: skip loading a new texture
|
// Check if texture was loaded before and if so, continue to next iteration: skip loading a new texture
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
for (UINT j = 0; j < textures_loaded.size(); j++) {
|
for (UINT j = 0; j < textures_loaded_.size(); j++) {
|
||||||
if (std::strcmp(textures_loaded[j].path.c_str(), str.C_Str()) == 0) {
|
if (std::strcmp(textures_loaded_[j].path.c_str(), str.C_Str()) == 0) {
|
||||||
textures.push_back(textures_loaded[j]);
|
textures.push_back(textures_loaded_[j]);
|
||||||
skip = true; // A texture with the same filepath has already been loaded, continue to next one. (optimization)
|
skip = true; // A texture with the same filepath has already been loaded, continue to next one. (optimization)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -113,34 +113,34 @@ std::vector<Texture> ModelLoader::loadMaterialTextures(aiMaterial * mat, aiTextu
|
||||||
texture.texture = getTextureFromModel(scene, textureindex);
|
texture.texture = getTextureFromModel(scene, textureindex);
|
||||||
} else {
|
} else {
|
||||||
std::string filename = std::string(str.C_Str());
|
std::string filename = std::string(str.C_Str());
|
||||||
filename = directory + '/' + filename;
|
filename = directory_ + '/' + filename;
|
||||||
std::wstring filenamews = std::wstring(filename.begin(), filename.end());
|
std::wstring filenamews = std::wstring(filename.begin(), filename.end());
|
||||||
hr = CreateWICTextureFromFile(dev, devcon, filenamews.c_str(), nullptr, &texture.texture);
|
hr = CreateWICTextureFromFile(dev_, devcon_, filenamews.c_str(), nullptr, &texture.texture);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
MessageBox(hwnd, "Texture couldn't be loaded", "Error!", MB_ICONERROR | MB_OK);
|
MessageBox(hwnd_, "Texture couldn't be loaded", "Error!", MB_ICONERROR | MB_OK);
|
||||||
}
|
}
|
||||||
texture.type = typeName;
|
texture.type = typeName;
|
||||||
texture.path = str.C_Str();
|
texture.path = str.C_Str();
|
||||||
textures.push_back(texture);
|
textures.push_back(texture);
|
||||||
this->textures_loaded.push_back(texture); // Store it as texture loaded for entire model, to ensure we won't unnecesery load duplicate textures.
|
this->textures_loaded_.push_back(texture); // Store it as texture loaded for entire model, to ensure we won't unnecesery load duplicate textures.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return textures;
|
return textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelLoader::Close() {
|
void ModelLoader::Close() {
|
||||||
for (auto& t : textures_loaded)
|
for (auto& t : textures_loaded_)
|
||||||
t.Release();
|
t.Release();
|
||||||
|
|
||||||
for (int i = 0; i < meshes.size(); i++) {
|
for (size_t i = 0; i < meshes_.size(); i++) {
|
||||||
meshes[i].Close();
|
meshes_[i].Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelLoader::processNode(aiNode * node, const aiScene * scene) {
|
void ModelLoader::processNode(aiNode * node, const aiScene * scene) {
|
||||||
for (UINT i = 0; i < node->mNumMeshes; i++) {
|
for (UINT i = 0; i < node->mNumMeshes; i++) {
|
||||||
aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
|
aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
|
||||||
meshes.push_back(this->processMesh(mesh, scene));
|
meshes_.push_back(this->processMesh(mesh, scene));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UINT i = 0; i < node->mNumChildren; i++) {
|
for (UINT i = 0; i < node->mNumChildren; i++) {
|
||||||
|
@ -179,9 +179,9 @@ ID3D11ShaderResourceView * ModelLoader::getTextureFromModel(const aiScene * scen
|
||||||
|
|
||||||
int* size = reinterpret_cast<int*>(&scene->mTextures[textureindex]->mWidth);
|
int* size = reinterpret_cast<int*>(&scene->mTextures[textureindex]->mWidth);
|
||||||
|
|
||||||
hr = CreateWICTextureFromMemory(dev, devcon, reinterpret_cast<unsigned char*>(scene->mTextures[textureindex]->pcData), *size, nullptr, &texture);
|
hr = CreateWICTextureFromMemory(dev_, devcon_, reinterpret_cast<unsigned char*>(scene->mTextures[textureindex]->pcData), *size, nullptr, &texture);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
MessageBox(hwnd, "Texture couldn't be created from memory!", "Error!", MB_ICONERROR | MB_OK);
|
MessageBox(hwnd_, "Texture couldn't be created from memory!", "Error!", MB_ICONERROR | MB_OK);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,12 @@ public:
|
||||||
|
|
||||||
void Close();
|
void Close();
|
||||||
private:
|
private:
|
||||||
ID3D11Device *dev;
|
ID3D11Device *dev_;
|
||||||
ID3D11DeviceContext *devcon;
|
ID3D11DeviceContext *devcon_;
|
||||||
std::vector<Mesh> meshes;
|
std::vector<Mesh> meshes_;
|
||||||
std::string directory;
|
std::string directory_;
|
||||||
std::vector<Texture> textures_loaded;
|
std::vector<Texture> textures_loaded_;
|
||||||
HWND hwnd;
|
HWND hwnd_;
|
||||||
|
|
||||||
void processNode(aiNode* node, const aiScene* scene);
|
void processNode(aiNode* node, const aiScene* scene);
|
||||||
Mesh processMesh(aiMesh* mesh, const aiScene* scene);
|
Mesh processMesh(aiMesh* mesh, const aiScene* scene);
|
||||||
|
|
|
@ -56,7 +56,7 @@ const char g_szClassName[] = "directxWindowClass";
|
||||||
static std::string g_ModelPath;
|
static std::string g_ModelPath;
|
||||||
|
|
||||||
UINT width, height;
|
UINT width, height;
|
||||||
HWND hwnd = nullptr;
|
HWND g_hwnd = nullptr;
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// DirectX Variables
|
// DirectX Variables
|
||||||
|
@ -120,8 +120,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
|
||||||
LPWSTR lpCmdLine, int nCmdShow)
|
LPWSTR /*lpCmdLine*/, int nCmdShow)
|
||||||
{
|
{
|
||||||
int argc;
|
int argc;
|
||||||
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||||
|
@ -182,7 +182,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
RECT wr = { 0,0, SCREEN_WIDTH, SCREEN_HEIGHT };
|
RECT wr = { 0,0, SCREEN_WIDTH, SCREEN_HEIGHT };
|
||||||
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
|
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
|
||||||
|
|
||||||
hwnd = CreateWindowEx(
|
g_hwnd = CreateWindowEx(
|
||||||
WS_EX_CLIENTEDGE,
|
WS_EX_CLIENTEDGE,
|
||||||
g_szClassName,
|
g_szClassName,
|
||||||
" Simple Textured Directx11 Sample ",
|
" Simple Textured Directx11 Sample ",
|
||||||
|
@ -191,21 +191,21 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
NULL, NULL, hInstance, NULL
|
NULL, NULL, hInstance, NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hwnd == NULL)
|
if (g_hwnd == NULL)
|
||||||
{
|
{
|
||||||
MessageBox(NULL, "Window Creation Failed!", "Error!",
|
MessageBox(NULL, "Window Creation Failed!", "Error!",
|
||||||
MB_ICONEXCLAMATION | MB_OK);
|
MB_ICONEXCLAMATION | MB_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowWindow(hwnd, nCmdShow);
|
ShowWindow(g_hwnd, nCmdShow);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(g_hwnd);
|
||||||
|
|
||||||
width = wr.right - wr.left;
|
width = wr.right - wr.left;
|
||||||
height = wr.bottom - wr.top;
|
height = wr.bottom - wr.top;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InitD3D(hInstance, hwnd);
|
InitD3D(hInstance, g_hwnd);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -225,17 +225,17 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
CleanD3D();
|
CleanD3D();
|
||||||
return static_cast<int>(msg.wParam);
|
return static_cast<int>(msg.wParam);
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
MessageBox(hwnd, e.what(), TEXT("Error!"), MB_ICONERROR | MB_OK);
|
MessageBox(g_hwnd, e.what(), TEXT("Error!"), MB_ICONERROR | MB_OK);
|
||||||
CleanD3D();
|
CleanD3D();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
MessageBox(hwnd, TEXT("Caught an unknown exception."), TEXT("Error!"), MB_ICONERROR | MB_OK);
|
MessageBox(g_hwnd, TEXT("Caught an unknown exception."), TEXT("Error!"), MB_ICONERROR | MB_OK);
|
||||||
CleanD3D();
|
CleanD3D();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitD3D(HINSTANCE hinstance, HWND hWnd)
|
void InitD3D(HINSTANCE /*hinstance*/, HWND hWnd)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ void InitD3D(HINSTANCE hinstance, HWND hWnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note this tutorial doesn't handle full-screen swapchains so we block the ALT+ENTER shortcut
|
// Note this tutorial doesn't handle full-screen swapchains so we block the ALT+ENTER shortcut
|
||||||
dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER);
|
dxgiFactory->MakeWindowAssociation(g_hwnd, DXGI_MWA_NO_ALT_ENTER);
|
||||||
|
|
||||||
dxgiFactory->Release();
|
dxgiFactory->Release();
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ void InitGraphics()
|
||||||
m_View = XMMatrixLookAtLH(Eye, At, Up);
|
m_View = XMMatrixLookAtLH(Eye, At, Up);
|
||||||
|
|
||||||
ourModel = new ModelLoader;
|
ourModel = new ModelLoader;
|
||||||
if (!ourModel->Load(hwnd, dev, devcon, g_ModelPath))
|
if (!ourModel->Load(g_hwnd, dev, devcon, g_ModelPath))
|
||||||
Throwanerror("Model couldn't be loaded");
|
Throwanerror("Model couldn't be loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,10 @@ TEST_F(utFBXImporterExporter, importUnitScaleFactor) {
|
||||||
double factor(0.0);
|
double factor(0.0);
|
||||||
scene->mMetaData->Get("UnitScaleFactor", factor);
|
scene->mMetaData->Get("UnitScaleFactor", factor);
|
||||||
EXPECT_DOUBLE_EQ(500.0, factor);
|
EXPECT_DOUBLE_EQ(500.0, factor);
|
||||||
|
|
||||||
|
scene->mMetaData->Set("UnitScaleFactor", factor * 2);
|
||||||
|
scene->mMetaData->Get("UnitScaleFactor", factor);
|
||||||
|
EXPECT_DOUBLE_EQ(1000.0, factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
|
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
|
||||||
|
|
Loading…
Reference in New Issue