Add missing pod types.
parent
4950d02bac
commit
3ad67771fe
|
@ -84,10 +84,6 @@ OPTION( ASSIMP_NO_EXPORT
|
||||||
"Disable Assimp's export functionality."
|
"Disable Assimp's export functionality."
|
||||||
OFF
|
OFF
|
||||||
)
|
)
|
||||||
OPTION( ASSIMP_BUILD_ZLIB
|
|
||||||
"Build your own zlib"
|
|
||||||
OFF
|
|
||||||
)
|
|
||||||
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
|
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
|
||||||
"If the supplementary tools for Assimp are built in addition to the library."
|
"If the supplementary tools for Assimp are built in addition to the library."
|
||||||
OFF
|
OFF
|
||||||
|
@ -134,6 +130,18 @@ OPTION ( ASSIMP_IGNORE_GIT_HASH
|
||||||
OFF
|
OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF (WIN32)
|
||||||
|
OPTION( ASSIMP_BUILD_ZLIB
|
||||||
|
"Build your own zlib"
|
||||||
|
ON
|
||||||
|
)
|
||||||
|
ELSE()
|
||||||
|
OPTION( ASSIMP_BUILD_ZLIB
|
||||||
|
"Build your own zlib"
|
||||||
|
OFF
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
# Use subset of Windows.h
|
# Use subset of Windows.h
|
||||||
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
||||||
|
|
|
@ -56,6 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <assimp/quaternion.h>
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Enum used to distinguish data types
|
* Enum used to distinguish data types
|
||||||
|
@ -70,7 +72,9 @@ typedef enum aiMetadataType {
|
||||||
AI_AISTRING = 5,
|
AI_AISTRING = 5,
|
||||||
AI_AIVECTOR3D = 6,
|
AI_AIVECTOR3D = 6,
|
||||||
AI_AIMETADATA = 7,
|
AI_AIMETADATA = 7,
|
||||||
AI_META_MAX = 8,
|
AI_INT64 = 8,
|
||||||
|
AI_UINT32 = 9,
|
||||||
|
AI_META_MAX = 10,
|
||||||
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
FORCE_32BIT = INT_MAX
|
FORCE_32BIT = INT_MAX
|
||||||
|
@ -133,6 +137,12 @@ inline aiMetadataType GetAiType(const aiVector3D &) {
|
||||||
inline aiMetadataType GetAiType(const aiMetadata &) {
|
inline aiMetadataType GetAiType(const aiMetadata &) {
|
||||||
return AI_AIMETADATA;
|
return AI_AIMETADATA;
|
||||||
}
|
}
|
||||||
|
inline aiMetadataType GetAiType(int64_t) {
|
||||||
|
return AI_INT64;
|
||||||
|
}
|
||||||
|
inline aiMetadataType GetAiType(uint32_t) {
|
||||||
|
return AI_UINT32;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
@ -215,6 +225,16 @@ struct aiMetadata {
|
||||||
rhs.Get<aiMetadata>(static_cast<unsigned int>(i), v);
|
rhs.Get<aiMetadata>(static_cast<unsigned int>(i), v);
|
||||||
mValues[i].mData = new aiMetadata(v);
|
mValues[i].mData = new aiMetadata(v);
|
||||||
} break;
|
} break;
|
||||||
|
case AI_INT64: {
|
||||||
|
int64_t v;
|
||||||
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(int64_t));
|
||||||
|
mValues[i].mData = new int64_t(v);
|
||||||
|
} break;
|
||||||
|
case AI_UINT32: {
|
||||||
|
uint32_t v;
|
||||||
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(uint32_t));
|
||||||
|
mValues[i].mData = new uint32_t(v);
|
||||||
|
} break;
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
case FORCE_32BIT:
|
case FORCE_32BIT:
|
||||||
#endif
|
#endif
|
||||||
|
@ -267,6 +287,12 @@ struct aiMetadata {
|
||||||
case AI_AIMETADATA:
|
case AI_AIMETADATA:
|
||||||
delete static_cast<aiMetadata *>(data);
|
delete static_cast<aiMetadata *>(data);
|
||||||
break;
|
break;
|
||||||
|
case AI_INT64:
|
||||||
|
delete static_cast<int64_t *>(data);
|
||||||
|
break;
|
||||||
|
case AI_UINT32:
|
||||||
|
delete static_cast<uint32_t *>(data);
|
||||||
|
break;
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
case FORCE_32BIT:
|
case FORCE_32BIT:
|
||||||
#endif
|
#endif
|
||||||
|
@ -510,6 +536,16 @@ struct aiMetadata {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case AI_INT64: {
|
||||||
|
if (*static_cast<int64_t *>(lhs.mValues[i].mData) != *static_cast<int64_t *>(rhs.mValues[i].mData)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case AI_UINT32: {
|
||||||
|
if (*static_cast<uint32_t *>(lhs.mValues[i].mData) != *static_cast<uint32_t *>(rhs.mValues[i].mData)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
case FORCE_32BIT:
|
case FORCE_32BIT:
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2022, 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,
|
||||||
|
@ -84,7 +82,7 @@ TEST_F( utMetadata, allocTest ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( utMetadata, get_set_pod_Test ) {
|
TEST_F( utMetadata, get_set_pod_Test ) {
|
||||||
m_data = aiMetadata::Alloc( 5 );
|
m_data = aiMetadata::Alloc( 7 );
|
||||||
|
|
||||||
// int, 32 bit
|
// int, 32 bit
|
||||||
unsigned int index( 0 );
|
unsigned int index( 0 );
|
||||||
|
@ -137,6 +135,28 @@ TEST_F( utMetadata, get_set_pod_Test ) {
|
||||||
EXPECT_TRUE( success );
|
EXPECT_TRUE( success );
|
||||||
EXPECT_DOUBLE_EQ( 3.0, result_double );
|
EXPECT_DOUBLE_EQ( 3.0, result_double );
|
||||||
|
|
||||||
|
// int64_t
|
||||||
|
index++;
|
||||||
|
const std::string key_int64 = "test_int64";
|
||||||
|
int64_t val_int64 = 64;
|
||||||
|
success = m_data->Set(index, key_int64, val_int64);
|
||||||
|
EXPECT_TRUE(success);
|
||||||
|
int64_t result_int64(0);
|
||||||
|
success = m_data->Get(key_int64, result_int64);
|
||||||
|
EXPECT_TRUE(success);
|
||||||
|
EXPECT_EQ(result_int64, val_int64);
|
||||||
|
|
||||||
|
// uint32
|
||||||
|
index++;
|
||||||
|
const std::string key_uint32 = "test_uint32";
|
||||||
|
int64_t val_uint32 = 32;
|
||||||
|
success = m_data->Set(index, key_uint32, val_uint32);
|
||||||
|
EXPECT_TRUE(success);
|
||||||
|
int64_t result_uint32(0);
|
||||||
|
success = m_data->Get(key_uint32, result_uint32);
|
||||||
|
EXPECT_TRUE(success);
|
||||||
|
EXPECT_EQ(result_uint32, val_uint32);
|
||||||
|
|
||||||
// error
|
// error
|
||||||
int result;
|
int result;
|
||||||
success = m_data->Get( "bla", result );
|
success = m_data->Get( "bla", result );
|
||||||
|
@ -181,6 +201,7 @@ TEST_F( utMetadata, get_set_aiVector3D_Test ) {
|
||||||
EXPECT_TRUE( success );
|
EXPECT_TRUE( success );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_F( utMetadata, copy_test ) {
|
TEST_F( utMetadata, copy_test ) {
|
||||||
m_data = aiMetadata::Alloc( AI_META_MAX );
|
m_data = aiMetadata::Alloc( AI_META_MAX );
|
||||||
bool bv = true;
|
bool bv = true;
|
||||||
|
@ -199,9 +220,12 @@ TEST_F( utMetadata, copy_test ) {
|
||||||
m_data->Set( 6, "aiVector3D", vecVal );
|
m_data->Set( 6, "aiVector3D", vecVal );
|
||||||
aiMetadata metaVal;
|
aiMetadata metaVal;
|
||||||
m_data->Set( 7, "aiMetadata", metaVal );
|
m_data->Set( 7, "aiMetadata", metaVal );
|
||||||
|
int64_t i64 = 64;
|
||||||
aiMetadata copy( *m_data );
|
m_data->Set(8, "int64_t", i64);
|
||||||
EXPECT_EQ( 8u, copy.mNumProperties );
|
uint32_t ui32 = 32;
|
||||||
|
m_data->Set(9, "uint32_t", ui32);
|
||||||
|
aiMetadata copy(*m_data);
|
||||||
|
EXPECT_EQ( 10u, copy.mNumProperties );
|
||||||
|
|
||||||
// bool test
|
// bool test
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue