Merge branch 'export_3mf' of https://github.com/assimp/assimp into export_3mf
commit
ddd23fad3f
|
@ -46,7 +46,7 @@ if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||||
if [ $ANALYZE = "ON" ] ; then
|
if [ $ANALYZE = "ON" ] ; then
|
||||||
if [ "$CC" = "clang" ]; then
|
if [ "$CC" = "clang" ]; then
|
||||||
scan-build cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_TESTS=OFF
|
scan-build cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_TESTS=OFF
|
||||||
scan-build --status-bugs make -j2
|
scan-build --status-bugs make -j2 -v
|
||||||
else
|
else
|
||||||
cppcheck --version
|
cppcheck --version
|
||||||
generate \
|
generate \
|
||||||
|
|
|
@ -42,6 +42,10 @@ OPTION( BUILD_SHARED_LIBS
|
||||||
"Build package with shared libraries."
|
"Build package with shared libraries."
|
||||||
ON
|
ON
|
||||||
)
|
)
|
||||||
|
OPTION( BUILD_FRAMEWORK
|
||||||
|
"Build package as Mac OS X Framework bundle."
|
||||||
|
OFF
|
||||||
|
)
|
||||||
OPTION( ASSIMP_DOUBLE_PRECISION
|
OPTION( ASSIMP_DOUBLE_PRECISION
|
||||||
"Set to ON to enable double precision processing"
|
"Set to ON to enable double precision processing"
|
||||||
OFF
|
OFF
|
||||||
|
@ -111,6 +115,11 @@ IF(MSVC)
|
||||||
)
|
)
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
|
|
||||||
|
IF (BUILD_FRAMEWORK)
|
||||||
|
SET (BUILD_SHARED_LIBS ON)
|
||||||
|
MESSAGE(STATUS "Framework bundle building enabled")
|
||||||
|
ENDIF(BUILD_FRAMEWORK)
|
||||||
|
|
||||||
IF(NOT BUILD_SHARED_LIBS)
|
IF(NOT BUILD_SHARED_LIBS)
|
||||||
MESSAGE(STATUS "Shared libraries disabled")
|
MESSAGE(STATUS "Shared libraries disabled")
|
||||||
SET(LINK_SEARCH_START_STATIC TRUE)
|
SET(LINK_SEARCH_START_STATIC TRUE)
|
||||||
|
|
|
@ -120,7 +120,7 @@ Take a look into the `INSTALL` file. Our build system is CMake, if you used CMak
|
||||||
* [Pascal](port/AssimpPascal/Readme.md)
|
* [Pascal](port/AssimpPascal/Readme.md)
|
||||||
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
|
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
|
||||||
* [Unity 3d Plugin](https://www.assetstore.unity3d.com/en/#!/content/91777)
|
* [Unity 3d Plugin](https://www.assetstore.unity3d.com/en/#!/content/91777)
|
||||||
* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (currently supported obj, ply, stl, ~collada)
|
* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (currently supported obj, ply, stl, collada, md2)
|
||||||
|
|
||||||
### Other tools ###
|
### Other tools ###
|
||||||
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
|
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
|
||||||
|
|
|
@ -926,8 +926,27 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||||
)
|
)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
SET_TARGET_PROPERTIES( assimp PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR}")
|
SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||||
endif()
|
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (BUILD_FRAMEWORK)
|
||||||
|
SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||||
|
FRAMEWORK TRUE
|
||||||
|
FRAMEWORK_VERSION C
|
||||||
|
MACOSX_FRAMEWORK_IDENTIFIER net.sf.assimp
|
||||||
|
PUBLIC_HEADER "${PUBLIC_HEADERS}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# PUBLIC_HEADER option does not support directory structure creation
|
||||||
|
# add ./Compiler/*.h to assimp.framework via copy command
|
||||||
|
ADD_CUSTOM_COMMAND(TARGET assimp POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||||
|
"../${HEADER_PATH}/Compiler"
|
||||||
|
assimp.framework/Headers/Compiler
|
||||||
|
COMMENT "Copying public ./Compiler/ header files to framework bundle's Headers/Compiler/")
|
||||||
|
endif(BUILD_FRAMEWORK)
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
# Build against external unzip, or add ../contrib/unzip so
|
# Build against external unzip, or add ../contrib/unzip so
|
||||||
# assimp can #include "unzip.h"
|
# assimp can #include "unzip.h"
|
||||||
|
@ -947,9 +966,11 @@ INSTALL( TARGETS assimp
|
||||||
LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}
|
RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}
|
||||||
|
FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
COMPONENT ${LIBASSIMP_COMPONENT})
|
COMPONENT ${LIBASSIMP_COMPONENT})
|
||||||
INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev)
|
INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev)
|
||||||
INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev)
|
INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev)
|
||||||
|
|
||||||
if (ASSIMP_ANDROID_JNIIOSYSTEM)
|
if (ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
INSTALL(FILES ${HEADER_PATH}/${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/AndroidJNIIOSystem.h
|
INSTALL(FILES ${HEADER_PATH}/${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/AndroidJNIIOSystem.h
|
||||||
DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}
|
DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
|
||||||
|
|
||||||
std::vector<ai_real> frames;
|
std::vector<ai_real> frames;
|
||||||
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
|
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
|
||||||
frames.push_back(nodeAnim->mPositionKeys[i].mTime);
|
frames.push_back(static_cast<ai_real>(nodeAnim->mPositionKeys[i].mTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteFloatArray( node_idstr , FloatType_Time, (const ai_real*) frames.data(), frames.size());
|
WriteFloatArray( node_idstr , FloatType_Time, (const ai_real*) frames.data(), frames.size());
|
||||||
|
@ -1309,7 +1309,7 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
|
||||||
// Combine the above transformations
|
// Combine the above transformations
|
||||||
aiMatrix4x4 mat = TranslationM * RotationM * ScalingM;
|
aiMatrix4x4 mat = TranslationM * RotationM * ScalingM;
|
||||||
|
|
||||||
for( size_t j = 0; j < 4; ++j) {
|
for( unsigned int j = 0; j < 4; ++j) {
|
||||||
keyframes.insert(keyframes.end(), mat[j], mat[j] + 4);
|
keyframes.insert(keyframes.end(), mat[j], mat[j] + 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
void ExportScene3MF( const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/ ) {
|
void ExportScene3MF( const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/ ) {
|
||||||
|
if ( nullptr == pIOSystem ) {
|
||||||
|
throw DeadlyExportError( "Could not export 3MP archive: " + std::string( pFile ) );
|
||||||
|
}
|
||||||
D3MF::D3MFExporter myExporter( pFile, pScene );
|
D3MF::D3MFExporter myExporter( pFile, pScene );
|
||||||
if ( myExporter.validate() ) {
|
if ( myExporter.validate() ) {
|
||||||
bool ok = myExporter.exportArchive(pFile);
|
bool ok = myExporter.exportArchive(pFile);
|
||||||
|
@ -248,6 +251,9 @@ void D3MFExporter::writeBuild() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3MFExporter::writeModelToArchive( const std::string &folder, const std::string &modelName ) {
|
void D3MFExporter::writeModelToArchive( const std::string &folder, const std::string &modelName ) {
|
||||||
|
if ( nullptr == m_zipArchive ) {
|
||||||
|
throw DeadlyExportError( "3MF-Export: Zip archive not valid, nullptr." );
|
||||||
|
}
|
||||||
const std::string entry = folder + "/" + modelName;
|
const std::string entry = folder + "/" + modelName;
|
||||||
zip_entry_open( m_zipArchive, entry.c_str() );
|
zip_entry_open( m_zipArchive, entry.c_str() );
|
||||||
|
|
||||||
|
@ -258,6 +264,9 @@ void D3MFExporter::writeModelToArchive( const std::string &folder, const std::st
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3MFExporter::writeRelInfoToFile( const std::string &folder, const std::string &relName ) {
|
void D3MFExporter::writeRelInfoToFile( const std::string &folder, const std::string &relName ) {
|
||||||
|
if ( nullptr == m_zipArchive ) {
|
||||||
|
throw DeadlyExportError( "3MF-Export: Zip archive not valid, nullptr." );
|
||||||
|
}
|
||||||
const std::string entry = folder + "/" + relName;
|
const std::string entry = folder + "/" + relName;
|
||||||
zip_entry_open( m_zipArchive, entry.c_str() );
|
zip_entry_open( m_zipArchive, entry.c_str() );
|
||||||
|
|
||||||
|
@ -271,3 +280,4 @@ void D3MFExporter::writeRelInfoToFile( const std::string &folder, const std::str
|
||||||
|
|
||||||
} // Namespace D3MF
|
} // Namespace D3MF
|
||||||
} // Namespace Assimp
|
} // Namespace Assimp
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ struct zip_t;
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
class IOStream;
|
class IOStream;
|
||||||
class IOSystem;
|
|
||||||
|
|
||||||
namespace D3MF {
|
namespace D3MF {
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "MemoryIOWrapper.h"
|
#include "MemoryIOWrapper.h"
|
||||||
#include "irrXMLWrapper.h"
|
#include "irrXMLWrapper.h"
|
||||||
#include "../contrib/utf8cpp/source/utf8.h"
|
#include "../contrib/utf8cpp/source/utf8.h"
|
||||||
|
#include "fast_atof.h"
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -714,7 +715,8 @@ public:
|
||||||
if (floatValue) {
|
if (floatValue) {
|
||||||
return floatValue->value.size() == 1 ? floatValue->value.front() : 0;
|
return floatValue->value.size() == 1 ? floatValue->value.front() : 0;
|
||||||
}
|
}
|
||||||
return static_cast<float>( atof( attr->value->toString().c_str() ) );
|
|
||||||
|
return fast_atof(attr->value->toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual float getAttributeValueAsFloat(int idx) const /*override*/ {
|
virtual float getAttributeValueAsFloat(int idx) const /*override*/ {
|
||||||
|
@ -725,7 +727,7 @@ public:
|
||||||
if (floatValue) {
|
if (floatValue) {
|
||||||
return floatValue->value.size() == 1 ? floatValue->value.front() : 0;
|
return floatValue->value.size() == 1 ? floatValue->value.front() : 0;
|
||||||
}
|
}
|
||||||
return static_cast<float>( atof( attributes[ idx ].value->toString().c_str() ) );
|
return fast_atof(attributes[idx].value->toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* getNodeName() const /*override*/ {
|
virtual const char* getNodeName() const /*override*/ {
|
||||||
|
@ -1792,6 +1794,7 @@ public:
|
||||||
|
|
||||||
virtual void registerDecoder(const std::string & /*algorithmUri*/, std::unique_ptr<FIDecoder> /*decoder*/) /*override*/ {}
|
virtual void registerDecoder(const std::string & /*algorithmUri*/, std::unique_ptr<FIDecoder> /*decoder*/) /*override*/ {}
|
||||||
|
|
||||||
|
|
||||||
virtual void registerVocabulary(const std::string &/*vocabularyUri*/, const FIVocabulary * /*vocabulary*/) /*override*/ {}
|
virtual void registerVocabulary(const std::string &/*vocabularyUri*/, const FIVocabulary * /*vocabulary*/) /*override*/ {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -93,7 +93,7 @@ void FindDegeneratesProcess::Execute( aiScene* pScene) {
|
||||||
|
|
||||||
static ai_real heron( ai_real a, ai_real b, ai_real c ) {
|
static ai_real heron( ai_real a, ai_real b, ai_real c ) {
|
||||||
ai_real s = (a + b + c) / 2;
|
ai_real s = (a + b + c) / 2;
|
||||||
ai_real area = pow((s * ( s - a ) * ( s - b ) * ( s - c ) ), 0.5 );
|
ai_real area = pow((s * ( s - a ) * ( s - b ) * ( s - c ) ), (ai_real)0.5 );
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ static ai_real distance3D( const aiVector3D &vA, aiVector3D &vB ) {
|
||||||
const ai_real ly = ( vB.y - vA.y );
|
const ai_real ly = ( vB.y - vA.y );
|
||||||
const ai_real lz = ( vB.z - vA.z );
|
const ai_real lz = ( vB.z - vA.z );
|
||||||
ai_real a = lx*lx + ly*ly + lz*lz;
|
ai_real a = lx*lx + ly*ly + lz*lz;
|
||||||
ai_real d = pow( a, 0.5 );
|
ai_real d = pow( a, (ai_real)0.5 );
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,7 @@ void FindInvalidDataProcess::ProcessAnimationChannel (aiNodeAnim* anim)
|
||||||
int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
|
int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
std::vector<bool> dirtyMask(pMesh->mNumVertices, pMesh->mNumFaces);
|
std::vector<bool> dirtyMask(pMesh->mNumVertices, pMesh->mNumFaces != 0);
|
||||||
|
|
||||||
// Ignore elements that are not referenced by vertices.
|
// Ignore elements that are not referenced by vertices.
|
||||||
// (they are, for example, caused by the FindDegenerates step)
|
// (they are, for example, caused by the FindDegenerates step)
|
||||||
|
|
|
@ -248,7 +248,7 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
|
||||||
std::vector<unsigned int> meshIndices;
|
std::vector<unsigned int> meshIndices;
|
||||||
aiMesh* pMesh = new aiMesh();
|
aiMesh* pMesh = new aiMesh();
|
||||||
pMesh->mMaterialIndex = 0;
|
pMesh->mMaterialIndex = 0;
|
||||||
meshIndices.push_back( meshes.size() );
|
meshIndices.push_back((unsigned int) meshes.size() );
|
||||||
meshes.push_back(pMesh);
|
meshes.push_back(pMesh);
|
||||||
aiNode *node = new aiNode;
|
aiNode *node = new aiNode;
|
||||||
node->mParent = root;
|
node->mParent = root;
|
||||||
|
@ -383,7 +383,7 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
|
||||||
pScene->mMeshes[ i ] = meshes[i];
|
pScene->mMeshes[ i ] = meshes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
root->mNumChildren = nodes.size();
|
root->mNumChildren = (unsigned int) nodes.size();
|
||||||
root->mChildren = new aiNode*[ root->mNumChildren ];
|
root->mChildren = new aiNode*[ root->mNumChildren ];
|
||||||
for ( size_t i=0; i<nodes.size(); ++i ) {
|
for ( size_t i=0; i<nodes.size(); ++i ) {
|
||||||
root->mChildren[ i ] = nodes[ i ];
|
root->mChildren[ i ] = nodes[ i ];
|
||||||
|
|
|
@ -66,8 +66,8 @@ namespace Assimp {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Add a prefix to a string
|
// Add a prefix to a string
|
||||||
inline void PrefixString(aiString& string,const char* prefix, unsigned int len)
|
inline
|
||||||
{
|
void PrefixString(aiString& string,const char* prefix, unsigned int len) {
|
||||||
// If the string is already prefixed, we won't prefix it a second time
|
// If the string is already prefixed, we won't prefix it a second time
|
||||||
if (string.length >= 1 && string.data[0] == '$')
|
if (string.length >= 1 && string.data[0] == '$')
|
||||||
return;
|
return;
|
||||||
|
@ -88,8 +88,7 @@ inline void PrefixString(aiString& string,const char* prefix, unsigned int len)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Add node identifiers to a hashing set
|
// Add node identifiers to a hashing set
|
||||||
void SceneCombiner::AddNodeHashes(aiNode* node, std::set<unsigned int>& hashes)
|
void SceneCombiner::AddNodeHashes(aiNode* node, std::set<unsigned int>& hashes) {
|
||||||
{
|
|
||||||
// Add node name to hashing set if it is non-empty - empty nodes are allowed
|
// Add node name to hashing set if it is non-empty - empty nodes are allowed
|
||||||
// and they can't have any anims assigned so its absolutely safe to duplicate them.
|
// and they can't have any anims assigned so its absolutely safe to duplicate them.
|
||||||
if (node->mName.length) {
|
if (node->mName.length) {
|
||||||
|
@ -103,25 +102,23 @@ void SceneCombiner::AddNodeHashes(aiNode* node, std::set<unsigned int>& hashes)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Add a name prefix to all nodes in a hierarchy
|
// Add a name prefix to all nodes in a hierarchy
|
||||||
void SceneCombiner::AddNodePrefixes(aiNode* node, const char* prefix, unsigned int len)
|
void SceneCombiner::AddNodePrefixes(aiNode* node, const char* prefix, unsigned int len) {
|
||||||
{
|
|
||||||
ai_assert(NULL != prefix);
|
ai_assert(NULL != prefix);
|
||||||
PrefixString(node->mName,prefix,len);
|
PrefixString(node->mName,prefix,len);
|
||||||
|
|
||||||
// Process all children recursively
|
// Process all children recursively
|
||||||
for (unsigned int i = 0; i < node->mNumChildren;++i)
|
for ( unsigned int i = 0; i < node->mNumChildren; ++i ) {
|
||||||
AddNodePrefixes( node->mChildren[ i ], prefix, len );
|
AddNodePrefixes( node->mChildren[ i ], prefix, len );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Search for matching names
|
// Search for matching names
|
||||||
bool SceneCombiner::FindNameMatch(const aiString& name, std::vector<SceneHelper>& input, unsigned int cur)
|
bool SceneCombiner::FindNameMatch(const aiString& name, std::vector<SceneHelper>& input, unsigned int cur) {
|
||||||
{
|
|
||||||
const unsigned int hash = SuperFastHash(name.data, static_cast<uint32_t>(name.length));
|
const unsigned int hash = SuperFastHash(name.data, static_cast<uint32_t>(name.length));
|
||||||
|
|
||||||
// Check whether we find a positive match in one of the given sets
|
// Check whether we find a positive match in one of the given sets
|
||||||
for (unsigned int i = 0; i < input.size(); ++i) {
|
for (unsigned int i = 0; i < input.size(); ++i) {
|
||||||
|
|
||||||
if (cur != i && input[i].hashes.find(hash) != input[i].hashes.end()) {
|
if (cur != i && input[i].hashes.find(hash) != input[i].hashes.end()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -132,14 +129,12 @@ bool SceneCombiner::FindNameMatch(const aiString& name, std::vector<SceneHelper>
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Add a name prefix to all nodes in a hierarchy if a hash match is found
|
// Add a name prefix to all nodes in a hierarchy if a hash match is found
|
||||||
void SceneCombiner::AddNodePrefixesChecked(aiNode* node, const char* prefix, unsigned int len,
|
void SceneCombiner::AddNodePrefixesChecked(aiNode* node, const char* prefix, unsigned int len,
|
||||||
std::vector<SceneHelper>& input, unsigned int cur)
|
std::vector<SceneHelper>& input, unsigned int cur) {
|
||||||
{
|
|
||||||
ai_assert(NULL != prefix);
|
ai_assert(NULL != prefix);
|
||||||
const unsigned int hash = SuperFastHash(node->mName.data, static_cast<uint32_t>(node->mName.length));
|
const unsigned int hash = SuperFastHash(node->mName.data, static_cast<uint32_t>(node->mName.length));
|
||||||
|
|
||||||
// Check whether we find a positive match in one of the given sets
|
// Check whether we find a positive match in one of the given sets
|
||||||
for (unsigned int i = 0; i < input.size(); ++i) {
|
for (unsigned int i = 0; i < input.size(); ++i) {
|
||||||
|
|
||||||
if (cur != i && input[i].hashes.find(hash) != input[i].hashes.end()) {
|
if (cur != i && input[i].hashes.find(hash) != input[i].hashes.end()) {
|
||||||
PrefixString(node->mName,prefix,len);
|
PrefixString(node->mName,prefix,len);
|
||||||
break;
|
break;
|
||||||
|
@ -153,27 +148,25 @@ void SceneCombiner::AddNodePrefixesChecked(aiNode* node, const char* prefix, uns
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Add an offset to all mesh indices in a node graph
|
// Add an offset to all mesh indices in a node graph
|
||||||
void SceneCombiner::OffsetNodeMeshIndices (aiNode* node, unsigned int offset)
|
void SceneCombiner::OffsetNodeMeshIndices (aiNode* node, unsigned int offset) {
|
||||||
{
|
|
||||||
for (unsigned int i = 0; i < node->mNumMeshes;++i)
|
for (unsigned int i = 0; i < node->mNumMeshes;++i)
|
||||||
node->mMeshes[i] += offset;
|
node->mMeshes[i] += offset;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < node->mNumChildren;++i)
|
for ( unsigned int i = 0; i < node->mNumChildren; ++i ) {
|
||||||
OffsetNodeMeshIndices( node->mChildren[ i ], offset );
|
OffsetNodeMeshIndices( node->mChildren[ i ], offset );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Merges two scenes. Currently only used by the LWS loader.
|
// Merges two scenes. Currently only used by the LWS loader.
|
||||||
void SceneCombiner::MergeScenes(aiScene** _dest,std::vector<aiScene*>& src,
|
void SceneCombiner::MergeScenes(aiScene** _dest,std::vector<aiScene*>& src, unsigned int flags) {
|
||||||
unsigned int flags)
|
if ( nullptr == _dest ) {
|
||||||
{
|
return;
|
||||||
ai_assert(NULL != _dest);
|
}
|
||||||
|
|
||||||
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
|
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
|
||||||
if (src.empty())
|
if (src.empty()) {
|
||||||
{
|
if (*_dest) {
|
||||||
if (*_dest)
|
|
||||||
{
|
|
||||||
(*_dest)->~aiScene();
|
(*_dest)->~aiScene();
|
||||||
SceneCombiner::CopySceneFlat(_dest,src[0]);
|
SceneCombiner::CopySceneFlat(_dest,src[0]);
|
||||||
}
|
}
|
||||||
|
@ -198,8 +191,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest,std::vector<aiScene*>& src,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::AttachToGraph (aiNode* attach, std::vector<NodeAttachmentInfo>& srcList)
|
void SceneCombiner::AttachToGraph (aiNode* attach, std::vector<NodeAttachmentInfo>& srcList) {
|
||||||
{
|
|
||||||
unsigned int cnt;
|
unsigned int cnt;
|
||||||
for ( cnt = 0; cnt < attach->mNumChildren; ++cnt ) {
|
for ( cnt = 0; cnt < attach->mNumChildren; ++cnt ) {
|
||||||
AttachToGraph( attach->mChildren[ cnt ], srcList );
|
AttachToGraph( attach->mChildren[ cnt ], srcList );
|
||||||
|
@ -239,19 +231,16 @@ void SceneCombiner::AttachToGraph (aiNode* attach, std::vector<NodeAttachmentInf
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::AttachToGraph ( aiScene* master,
|
void SceneCombiner::AttachToGraph ( aiScene* master, std::vector<NodeAttachmentInfo>& src) {
|
||||||
std::vector<NodeAttachmentInfo>& src)
|
|
||||||
{
|
|
||||||
ai_assert(NULL != master);
|
ai_assert(NULL != master);
|
||||||
AttachToGraph(master->mRootNode,src);
|
AttachToGraph(master->mRootNode,src);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
|
void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master, std::vector<AttachmentInfo>& srcList, unsigned int flags) {
|
||||||
std::vector<AttachmentInfo>& srcList,
|
if ( nullptr == _dest ) {
|
||||||
unsigned int flags)
|
return;
|
||||||
{
|
}
|
||||||
ai_assert(NULL != _dest);
|
|
||||||
|
|
||||||
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
|
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
|
||||||
if (srcList.empty()) {
|
if (srcList.empty()) {
|
||||||
|
@ -708,7 +697,9 @@ void SceneCombiner::BuildUniqueBoneList(std::list<BoneWithHash>& asBones,
|
||||||
void SceneCombiner::MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator it,
|
void SceneCombiner::MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator it,
|
||||||
std::vector<aiMesh*>::const_iterator end)
|
std::vector<aiMesh*>::const_iterator end)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != out && !out->mNumBones);
|
if ( nullptr == out || out->mNumBones == 0 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// find we need to build an unique list of all bones.
|
// find we need to build an unique list of all bones.
|
||||||
// we work with hashes to make the comparisons MUCH faster,
|
// we work with hashes to make the comparisons MUCH faster,
|
||||||
|
@ -762,7 +753,9 @@ void SceneCombiner::MergeMeshes(aiMesh** _out, unsigned int /*flags*/,
|
||||||
std::vector<aiMesh*>::const_iterator begin,
|
std::vector<aiMesh*>::const_iterator begin,
|
||||||
std::vector<aiMesh*>::const_iterator end)
|
std::vector<aiMesh*>::const_iterator end)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != _out);
|
if ( nullptr == _out ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (begin == end) {
|
if (begin == end) {
|
||||||
*_out = NULL; // no meshes ...
|
*_out = NULL; // no meshes ...
|
||||||
|
@ -903,7 +896,9 @@ void SceneCombiner::MergeMaterials(aiMaterial** dest,
|
||||||
std::vector<aiMaterial*>::const_iterator begin,
|
std::vector<aiMaterial*>::const_iterator begin,
|
||||||
std::vector<aiMaterial*>::const_iterator end)
|
std::vector<aiMaterial*>::const_iterator end)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != dest);
|
if ( nullptr == dest ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (begin == end) {
|
if (begin == end) {
|
||||||
*dest = NULL; // no materials ...
|
*dest = NULL; // no materials ...
|
||||||
|
@ -953,10 +948,9 @@ void SceneCombiner::MergeMaterials(aiMaterial** dest,
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
inline void CopyPtrArray (Type**& dest, const Type* const * src, ai_uint num)
|
inline
|
||||||
{
|
void CopyPtrArray (Type**& dest, const Type* const * src, ai_uint num) {
|
||||||
if (!num)
|
if (!num) {
|
||||||
{
|
|
||||||
dest = NULL;
|
dest = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -968,9 +962,11 @@ inline void CopyPtrArray (Type**& dest, const Type* const * src, ai_uint num)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
inline void GetArrayCopy (Type*& dest, ai_uint num )
|
inline
|
||||||
{
|
void GetArrayCopy(Type*& dest, ai_uint num ) {
|
||||||
if (!dest)return;
|
if ( !dest ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Type* old = dest;
|
Type* old = dest;
|
||||||
|
|
||||||
dest = new Type[num];
|
dest = new Type[num];
|
||||||
|
@ -978,22 +974,27 @@ inline void GetArrayCopy (Type*& dest, ai_uint num )
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::CopySceneFlat(aiScene** _dest,const aiScene* src)
|
void SceneCombiner::CopySceneFlat(aiScene** _dest,const aiScene* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// reuse the old scene or allocate a new?
|
// reuse the old scene or allocate a new?
|
||||||
if (*_dest) {
|
if (*_dest) {
|
||||||
(*_dest)->~aiScene();
|
(*_dest)->~aiScene();
|
||||||
new (*_dest) aiScene();
|
new (*_dest) aiScene();
|
||||||
|
} else {
|
||||||
|
*_dest = new aiScene();
|
||||||
}
|
}
|
||||||
else *_dest = new aiScene();
|
|
||||||
|
|
||||||
::memcpy(*_dest,src,sizeof(aiScene));
|
::memcpy(*_dest,src,sizeof(aiScene));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::CopyScene(aiScene** _dest,const aiScene* src,bool allocate)
|
void SceneCombiner::CopyScene(aiScene** _dest,const aiScene* src,bool allocate) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (allocate) {
|
if (allocate) {
|
||||||
*_dest = new aiScene();
|
*_dest = new aiScene();
|
||||||
|
@ -1044,9 +1045,10 @@ void SceneCombiner::CopyScene(aiScene** _dest,const aiScene* src,bool allocate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy (aiMesh** _dest, const aiMesh* src)
|
void SceneCombiner::Copy( aiMesh** _dest, const aiMesh* src ) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiMesh* dest = *_dest = new aiMesh();
|
aiMesh* dest = *_dest = new aiMesh();
|
||||||
|
|
||||||
|
@ -1072,17 +1074,17 @@ void SceneCombiner::Copy (aiMesh** _dest, const aiMesh* src)
|
||||||
|
|
||||||
// make a deep copy of all faces
|
// make a deep copy of all faces
|
||||||
GetArrayCopy(dest->mFaces,dest->mNumFaces);
|
GetArrayCopy(dest->mFaces,dest->mNumFaces);
|
||||||
for (unsigned int i = 0; i < dest->mNumFaces;++i)
|
for (unsigned int i = 0; i < dest->mNumFaces;++i) {
|
||||||
{
|
|
||||||
aiFace& f = dest->mFaces[i];
|
aiFace& f = dest->mFaces[i];
|
||||||
GetArrayCopy(f.mIndices,f.mNumIndices);
|
GetArrayCopy(f.mIndices,f.mNumIndices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src)
|
void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiMaterial* dest = (aiMaterial*) ( *_dest = new aiMaterial() );
|
aiMaterial* dest = (aiMaterial*) ( *_dest = new aiMaterial() );
|
||||||
|
|
||||||
|
@ -1110,9 +1112,10 @@ void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy (aiTexture** _dest, const aiTexture* src)
|
void SceneCombiner::Copy(aiTexture** _dest, const aiTexture* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiTexture* dest = *_dest = new aiTexture();
|
aiTexture* dest = *_dest = new aiTexture();
|
||||||
|
|
||||||
|
@ -1139,10 +1142,10 @@ void SceneCombiner::Copy (aiTexture** _dest, const aiTexture* src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy( aiAnimation** _dest, const aiAnimation* src )
|
void SceneCombiner::Copy( aiAnimation** _dest, const aiAnimation* src ) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert( NULL != _dest );
|
return;
|
||||||
ai_assert( NULL != src );
|
}
|
||||||
|
|
||||||
aiAnimation* dest = *_dest = new aiAnimation();
|
aiAnimation* dest = *_dest = new aiAnimation();
|
||||||
|
|
||||||
|
@ -1154,9 +1157,10 @@ void SceneCombiner::Copy( aiAnimation** _dest, const aiAnimation* src )
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy (aiNodeAnim** _dest, const aiNodeAnim* src)
|
void SceneCombiner::Copy(aiNodeAnim** _dest, const aiNodeAnim* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiNodeAnim* dest = *_dest = new aiNodeAnim();
|
aiNodeAnim* dest = *_dest = new aiNodeAnim();
|
||||||
|
|
||||||
|
@ -1170,9 +1174,10 @@ void SceneCombiner::Copy (aiNodeAnim** _dest, const aiNodeAnim* src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy (aiCamera** _dest,const aiCamera* src)
|
void SceneCombiner::Copy( aiCamera** _dest,const aiCamera* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiCamera* dest = *_dest = new aiCamera();
|
aiCamera* dest = *_dest = new aiCamera();
|
||||||
|
|
||||||
|
@ -1181,9 +1186,10 @@ void SceneCombiner::Copy (aiCamera** _dest,const aiCamera* src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy (aiLight** _dest, const aiLight* src)
|
void SceneCombiner::Copy(aiLight** _dest, const aiLight* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiLight* dest = *_dest = new aiLight();
|
aiLight* dest = *_dest = new aiLight();
|
||||||
|
|
||||||
|
@ -1192,9 +1198,10 @@ void SceneCombiner::Copy (aiLight** _dest, const aiLight* src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy (aiBone** _dest, const aiBone* src)
|
void SceneCombiner::Copy(aiBone** _dest, const aiBone* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert(NULL != _dest && NULL != src);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiBone* dest = *_dest = new aiBone();
|
aiBone* dest = *_dest = new aiBone();
|
||||||
|
|
||||||
|
@ -1230,10 +1237,14 @@ void SceneCombiner::Copy (aiNode** _dest, const aiNode* src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SceneCombiner::Copy(aiMetadata** _dest, const aiMetadata* src)
|
void SceneCombiner::Copy(aiMetadata** _dest, const aiMetadata* src) {
|
||||||
{
|
if ( nullptr == _dest || nullptr == src ) {
|
||||||
ai_assert( NULL != _dest );
|
return;
|
||||||
ai_assert( NULL != src);
|
}
|
||||||
|
|
||||||
|
if ( 0 == src->mNumProperties ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aiMetadata* dest = *_dest = aiMetadata::Alloc( src->mNumProperties );
|
aiMetadata* dest = *_dest = aiMetadata::Alloc( src->mNumProperties );
|
||||||
std::copy(src->mKeys, src->mKeys + src->mNumProperties, dest->mKeys);
|
std::copy(src->mKeys, src->mKeys + src->mNumProperties, dest->mKeys);
|
||||||
|
@ -1271,4 +1282,5 @@ void SceneCombiner::Copy(aiMetadata** _dest, const aiMetadata* src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // Namespace Assimp
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ private:
|
||||||
inline void DoValidation(T** array, unsigned int size,
|
inline void DoValidation(T** array, unsigned int size,
|
||||||
const char* firstName, const char* secondName);
|
const char* firstName, const char* secondName);
|
||||||
|
|
||||||
// extended version: checks whethr T::mName occurs twice
|
// extended version: checks whether T::mName occurs twice
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void DoValidationEx(T** array, unsigned int size,
|
inline void DoValidationEx(T** array, unsigned int size,
|
||||||
const char* firstName, const char* secondName);
|
const char* firstName, const char* secondName);
|
||||||
|
|
|
@ -775,7 +775,7 @@ namespace glTF2
|
||||||
PrimitiveMode mode;
|
PrimitiveMode mode;
|
||||||
|
|
||||||
struct Attributes {
|
struct Attributes {
|
||||||
AccessorList position, normal, texcoord, color, joint, jointmatrix, weight;
|
AccessorList position, normal, tangent, texcoord, color, joint, jointmatrix, weight;
|
||||||
} attributes;
|
} attributes;
|
||||||
|
|
||||||
Ref<Accessor> indices;
|
Ref<Accessor> indices;
|
||||||
|
|
|
@ -212,7 +212,7 @@ unsigned int LazyDict<T>::Remove(const char* id)
|
||||||
mObjs.erase(mObjs.begin() + index);
|
mObjs.erase(mObjs.begin() + index);
|
||||||
|
|
||||||
//update index of object in mObjs;
|
//update index of object in mObjs;
|
||||||
for (size_t i = index; i < mObjs.size(); ++i) {
|
for (unsigned int i = index; i < mObjs.size(); ++i) {
|
||||||
T *obj = mObjs[i];
|
T *obj = mObjs[i];
|
||||||
|
|
||||||
obj->index = i;
|
obj->index = i;
|
||||||
|
@ -867,6 +867,9 @@ namespace {
|
||||||
else if ((pos = Compare(attr, "NORMAL"))) {
|
else if ((pos = Compare(attr, "NORMAL"))) {
|
||||||
v = &(p.attributes.normal);
|
v = &(p.attributes.normal);
|
||||||
}
|
}
|
||||||
|
else if ((pos = Compare(attr, "TANGENT"))) {
|
||||||
|
v = &(p.attributes.tangent);
|
||||||
|
}
|
||||||
else if ((pos = Compare(attr, "TEXCOORD"))) {
|
else if ((pos = Compare(attr, "TEXCOORD"))) {
|
||||||
v = &(p.attributes.texcoord);
|
v = &(p.attributes.texcoord);
|
||||||
}
|
}
|
||||||
|
@ -906,7 +909,7 @@ inline void Mesh::Read(Value& pJSON_Object, Asset& pAsset_Root)
|
||||||
for (Value::MemberIterator it = attrs->MemberBegin(); it != attrs->MemberEnd(); ++it) {
|
for (Value::MemberIterator it = attrs->MemberBegin(); it != attrs->MemberEnd(); ++it) {
|
||||||
if (!it->value.IsUint()) continue;
|
if (!it->value.IsUint()) continue;
|
||||||
const char* attr = it->name.GetString();
|
const char* attr = it->name.GetString();
|
||||||
// Valid attribute semantics include POSITION, NORMAL, TEXCOORD, COLOR, JOINT, JOINTMATRIX,
|
// Valid attribute semantics include POSITION, NORMAL, TANGENT, TEXCOORD, COLOR, JOINT, JOINTMATRIX,
|
||||||
// and WEIGHT.Attribute semantics can be of the form[semantic]_[set_index], e.g., TEXCOORD_0, TEXCOORD_1, etc.
|
// and WEIGHT.Attribute semantics can be of the form[semantic]_[set_index], e.g., TEXCOORD_0, TEXCOORD_1, etc.
|
||||||
|
|
||||||
int undPos = 0;
|
int undPos = 0;
|
||||||
|
@ -934,7 +937,7 @@ inline void Camera::Read(Value& obj, Asset& /*r*/)
|
||||||
{
|
{
|
||||||
type = MemberOrDefault(obj, "type", Camera::Perspective);
|
type = MemberOrDefault(obj, "type", Camera::Perspective);
|
||||||
|
|
||||||
const char* subobjId = (type == Camera::Orthographic) ? "ortographic" : "perspective";
|
const char* subobjId = (type == Camera::Orthographic) ? "orthographic" : "perspective";
|
||||||
|
|
||||||
Value* it = FindObject(obj, subobjId);
|
Value* it = FindObject(obj, subobjId);
|
||||||
if (!it) throw DeadlyImportError("GLTF: Camera missing its parameters");
|
if (!it) throw DeadlyImportError("GLTF: Camera missing its parameters");
|
||||||
|
|
|
@ -445,7 +445,7 @@ void glTF2Exporter::ExportMaterials()
|
||||||
mat->Get(AI_MATKEY_SHININESS, shininess) == AI_SUCCESS
|
mat->Get(AI_MATKEY_SHININESS, shininess) == AI_SUCCESS
|
||||||
) {
|
) {
|
||||||
// convert specular color to luminance
|
// convert specular color to luminance
|
||||||
float specularIntensity = specularColor[0] * 0.2125 + specularColor[1] * 0.7154 + specularColor[2] * 0.0721;
|
float specularIntensity = specularColor[0] * 0.2125f + specularColor[1] * 0.7154f + specularColor[2] * 0.0721f;
|
||||||
//normalize shininess (assuming max is 1000) with an inverse exponentional curve
|
//normalize shininess (assuming max is 1000) with an inverse exponentional curve
|
||||||
float normalizedShininess = std::sqrt(shininess / 1000);
|
float normalizedShininess = std::sqrt(shininess / 1000);
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,31 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
|
||||||
attr.position[0]->ExtractData(aim->mVertices);
|
attr.position[0]->ExtractData(aim->mVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr.normal.size() > 0 && attr.normal[0]) attr.normal[0]->ExtractData(aim->mNormals);
|
if (attr.normal.size() > 0 && attr.normal[0]) {
|
||||||
|
attr.normal[0]->ExtractData(aim->mNormals);
|
||||||
|
|
||||||
|
// only extract tangents if normals are present
|
||||||
|
if (attr.tangent.size() > 0 && attr.tangent[0]) {
|
||||||
|
// generate bitangents from normals and tangents according to spec
|
||||||
|
struct Tangent
|
||||||
|
{
|
||||||
|
aiVector3D xyz;
|
||||||
|
ai_real w;
|
||||||
|
} *tangents = nullptr;
|
||||||
|
|
||||||
|
attr.tangent[0]->ExtractData(tangents);
|
||||||
|
|
||||||
|
aim->mTangents = new aiVector3D[aim->mNumVertices];
|
||||||
|
aim->mBitangents = new aiVector3D[aim->mNumVertices];
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < aim->mNumVertices; ++i) {
|
||||||
|
aim->mTangents[i] = tangents[i].xyz;
|
||||||
|
aim->mBitangents[i] = (aim->mNormals[i] ^ tangents[i].xyz) * tangents[i].w;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete tangents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t tc = 0; tc < attr.texcoord.size() && tc < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++tc) {
|
for (size_t tc = 0; tc < attr.texcoord.size() && tc < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++tc) {
|
||||||
attr.texcoord[tc]->ExtractData(aim->mTextureCoords[tc]);
|
attr.texcoord[tc]->ExtractData(aim->mTextureCoords[tc]);
|
||||||
|
@ -492,7 +516,7 @@ aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>&
|
||||||
{
|
{
|
||||||
Node& node = *ptr;
|
Node& node = *ptr;
|
||||||
|
|
||||||
aiNode* ainode = new aiNode(node.id);
|
aiNode* ainode = new aiNode(node.name);
|
||||||
|
|
||||||
if (!node.children.empty()) {
|
if (!node.children.empty()) {
|
||||||
ainode->mNumChildren = unsigned(node.children.size());
|
ainode->mNumChildren = unsigned(node.children.size());
|
||||||
|
@ -515,7 +539,13 @@ aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>&
|
||||||
CopyValue(node.translation.value, trans);
|
CopyValue(node.translation.value, trans);
|
||||||
aiMatrix4x4 t;
|
aiMatrix4x4 t;
|
||||||
aiMatrix4x4::Translation(trans, t);
|
aiMatrix4x4::Translation(trans, t);
|
||||||
matrix = t * matrix;
|
matrix = matrix * t;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.rotation.isPresent) {
|
||||||
|
aiQuaternion rot;
|
||||||
|
CopyValue(node.rotation.value, rot);
|
||||||
|
matrix = matrix * aiMatrix4x4(rot.GetMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.scale.isPresent) {
|
if (node.scale.isPresent) {
|
||||||
|
@ -523,14 +553,7 @@ aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>&
|
||||||
CopyValue(node.scale.value, scal);
|
CopyValue(node.scale.value, scal);
|
||||||
aiMatrix4x4 s;
|
aiMatrix4x4 s;
|
||||||
aiMatrix4x4::Scaling(scal, s);
|
aiMatrix4x4::Scaling(scal, s);
|
||||||
matrix = s * matrix;
|
matrix = matrix * s;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (node.rotation.isPresent) {
|
|
||||||
aiQuaternion rot;
|
|
||||||
CopyValue(node.rotation.value, rot);
|
|
||||||
matrix = aiMatrix4x4(rot.GetMatrix()) * matrix;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,13 +197,17 @@ struct SceneHelper
|
||||||
* The class is currently being used by various postprocessing steps
|
* The class is currently being used by various postprocessing steps
|
||||||
* and loaders (ie. LWS).
|
* and loaders (ie. LWS).
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API SceneCombiner
|
class ASSIMP_API SceneCombiner {
|
||||||
{
|
|
||||||
// class cannot be instanced
|
// class cannot be instanced
|
||||||
SceneCombiner() {}
|
SceneCombiner() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
~SceneCombiner() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Merges two or more scenes.
|
/** Merges two or more scenes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -187,7 +187,7 @@ struct aiMetadata {
|
||||||
static inline
|
static inline
|
||||||
aiMetadata *Alloc( unsigned int numProperties ) {
|
aiMetadata *Alloc( unsigned int numProperties ) {
|
||||||
if ( 0 == numProperties ) {
|
if ( 0 == numProperties ) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
aiMetadata *data = new aiMetadata;
|
aiMetadata *data = new aiMetadata;
|
||||||
|
|
|
@ -177,6 +177,13 @@ ELSE( WIN32 )
|
||||||
SET( platform_libs pthread )
|
SET( platform_libs pthread )
|
||||||
ENDIF( WIN32 )
|
ENDIF( WIN32 )
|
||||||
|
|
||||||
|
IF( WIN32 )
|
||||||
|
ADD_CUSTOM_COMMAND(TARGET unit
|
||||||
|
PRE_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:assimp> $<TARGET_FILE_DIR:unit>
|
||||||
|
MAIN_DEPENDENCY assimp)
|
||||||
|
ENDIF( WIN32 )
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class ut3DImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/3D/box_a.3d", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/3D/box_a.3d", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class ut3DSImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/3DS/fels.3ds", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/3DS/fels.3ds", aiProcess_ValidateDataStructure );
|
||||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utACImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/AC/Wuson.ac", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/AC/Wuson.ac", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utAMFImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/AMF/test1.amf", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/AMF/test1.amf", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utASEImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen.ASE", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen.ASE", aiProcess_ValidateDataStructure );
|
||||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utB3DImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/B3D/WusonBlitz.b3d", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/B3D/WusonBlitz.b3d", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class utBVHImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/BVH/01_01.bvh", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/BVH/01_01.bvh", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
class BlendImportAreaLight : public ::testing::Test {
|
class BlendImportAreaLight : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
|
@ -67,7 +68,7 @@ protected:
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
TEST_F(BlendImportAreaLight, testImportLight)
|
TEST_F(BlendImportAreaLight, testImportLight)
|
||||||
{
|
{
|
||||||
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/AreaLight_269.blend",0);
|
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/AreaLight_269.blend", aiProcess_ValidateDataStructure);
|
||||||
ASSERT_TRUE(pTest != NULL);
|
ASSERT_TRUE(pTest != NULL);
|
||||||
ASSERT_TRUE(pTest->HasLights());
|
ASSERT_TRUE(pTest->HasLights());
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/cexport.h>
|
#include <assimp/cexport.h>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
class BlendImportMaterials : public ::testing::Test {
|
class BlendImportMaterials : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
|
@ -66,7 +67,7 @@ protected:
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
TEST_F(BlendImportMaterials, testImportMaterial)
|
TEST_F(BlendImportMaterials, testImportMaterial)
|
||||||
{
|
{
|
||||||
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderMaterial_269.blend", 0);
|
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderMaterial_269.blend", aiProcess_ValidateDataStructure);
|
||||||
ASSERT_TRUE(pTest != NULL);
|
ASSERT_TRUE(pTest != NULL);
|
||||||
ASSERT_TRUE(pTest->HasMaterials());
|
ASSERT_TRUE(pTest->HasMaterials());
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class utBlenderImporterExporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/BLEND/box.blend", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/BLEND/box.blend", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class utCSMImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/CSM/ThomasFechten.csm", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/CSM/ThomasFechten.csm", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
||||||
{
|
{
|
||||||
const char* file = "cameraExp.dae";
|
const char* file = "cameraExp.dae";
|
||||||
|
|
||||||
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/cameras.dae",0);
|
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/cameras.dae", aiProcess_ValidateDataStructure);
|
||||||
ASSERT_TRUE(pTest!=NULL);
|
ASSERT_TRUE(pTest!=NULL);
|
||||||
ASSERT_TRUE(pTest->HasCameras());
|
ASSERT_TRUE(pTest->HasCameras());
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
||||||
names[ i ] = orig->mName;
|
names[ i ] = orig->mName;
|
||||||
pos[ i ] = orig->mPosition;
|
pos[ i ] = orig->mPosition;
|
||||||
}
|
}
|
||||||
const aiScene* imported = im->ReadFile(file,0);
|
const aiScene* imported = im->ReadFile(file, aiProcess_ValidateDataStructure);
|
||||||
|
|
||||||
ASSERT_TRUE(imported!=NULL);
|
ASSERT_TRUE(imported!=NULL);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ TEST_F(ColladaExportLight, testExportLight)
|
||||||
{
|
{
|
||||||
const char* file = "lightsExp.dae";
|
const char* file = "lightsExp.dae";
|
||||||
|
|
||||||
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/lights.dae",0);
|
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/lights.dae", aiProcess_ValidateDataStructure);
|
||||||
ASSERT_TRUE(pTest!=NULL);
|
ASSERT_TRUE(pTest!=NULL);
|
||||||
ASSERT_TRUE(pTest->HasLights());
|
ASSERT_TRUE(pTest->HasLights());
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ TEST_F(ColladaExportLight, testExportLight)
|
||||||
|
|
||||||
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
||||||
|
|
||||||
const aiScene* imported = im->ReadFile(file,0);
|
const aiScene* imported = im->ReadFile(file, aiProcess_ValidateDataStructure);
|
||||||
|
|
||||||
ASSERT_TRUE(imported!=NULL);
|
ASSERT_TRUE(imported!=NULL);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class utColladaImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/Collada/duck.dae", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/Collada/duck.dae", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
#include "D3MFExporter.h"
|
#include "D3MFExporter.h"
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utD3MFImporterExporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3MF/box.3mf", 0);
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3MF/box.3mf", aiProcess_ValidateDataStructure);
|
||||||
EXPECT_EQ( 1u, scene->mNumMeshes );
|
EXPECT_EQ( 1u, scene->mNumMeshes );
|
||||||
aiMesh *mesh = scene->mMeshes[ 0 ];
|
aiMesh *mesh = scene->mMeshes[ 0 ];
|
||||||
EXPECT_NE( nullptr, mesh );
|
EXPECT_NE( nullptr, mesh );
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utDXFImporterExporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/DXF/PinkEggFromLW.dxf", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/DXF/PinkEggFromLW.dxf", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ public:
|
||||||
ex = new Assimp::Exporter();
|
ex = new Assimp::Exporter();
|
||||||
im = new Assimp::Importer();
|
im = new Assimp::Importer();
|
||||||
|
|
||||||
pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test.x",0);
|
pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test.x", aiProcess_ValidateDataStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown()
|
virtual void TearDown()
|
||||||
|
@ -37,7 +37,7 @@ TEST_F(ExporterTest, testExportToFile)
|
||||||
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
||||||
|
|
||||||
// check if we can read it again
|
// check if we can read it again
|
||||||
EXPECT_TRUE(im->ReadFile(file,0));
|
EXPECT_TRUE(im->ReadFile(file, aiProcess_ValidateDataStructure));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utFBXImporterExporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/FBX/spider.fbx", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/FBX/spider.fbx", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class utHMPImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/HMP/terrain.hmp", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/HMP/terrain.hmp", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class utIFCImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/IFC/AC14-FZK-Haus.ifc", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/IFC/AC14-FZK-Haus.ifc", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
#include "TestModelFactory.h"
|
#include "TestModelFactory.h"
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ TEST_F( utIssues, OpacityBugWhenExporting_727 ) {
|
||||||
EXPECT_NE( desc, nullptr );
|
EXPECT_NE( desc, nullptr );
|
||||||
path.append( desc->fileExtension );
|
path.append( desc->fileExtension );
|
||||||
EXPECT_EQ( AI_SUCCESS, exporter.Export( scene, desc->id, path ) );
|
EXPECT_EQ( AI_SUCCESS, exporter.Export( scene, desc->id, path ) );
|
||||||
const aiScene *newScene( importer.ReadFile( path, 0 ) );
|
const aiScene *newScene( importer.ReadFile( path, aiProcess_ValidateDataStructure ) );
|
||||||
EXPECT_TRUE( NULL != newScene );
|
EXPECT_TRUE( NULL != newScene );
|
||||||
float newOpacity;
|
float newOpacity;
|
||||||
if ( newScene->mNumMaterials > 0 ) {
|
if ( newScene->mNumMaterials > 0 ) {
|
||||||
|
|
|
@ -193,7 +193,7 @@ protected:
|
||||||
|
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
::Assimp::Importer importer;
|
::Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ protected:
|
||||||
virtual bool exporterTest() {
|
virtual bool exporterTest() {
|
||||||
::Assimp::Importer importer;
|
::Assimp::Importer importer;
|
||||||
::Assimp::Exporter exporter;
|
::Assimp::Exporter exporter;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure );
|
||||||
EXPECT_NE( nullptr, scene );
|
EXPECT_NE( nullptr, scene );
|
||||||
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "obj", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_test.obj" ) );
|
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "obj", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_test.obj" ) );
|
||||||
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "objnomtl", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_nomtl_test.obj" ) );
|
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "objnomtl", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_nomtl_test.obj" ) );
|
||||||
|
@ -257,7 +257,7 @@ TEST_F( utObjImportExport, issue1111_no_mat_name_Test ) {
|
||||||
|
|
||||||
TEST_F( utObjImportExport, issue809_vertex_color_Test ) {
|
TEST_F( utObjImportExport, issue809_vertex_color_Test ) {
|
||||||
::Assimp::Importer importer;
|
::Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/cube_with_vertexcolors.obj", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/cube_with_vertexcolors.obj", aiProcess_ValidateDataStructure );
|
||||||
EXPECT_NE( nullptr, scene );
|
EXPECT_NE( nullptr, scene );
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
|
@ -52,7 +52,7 @@ class utPMXImporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
/*const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/../models-nonbsd/MMD/Alicia_blade.pmx", 0 );
|
/*const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/../models-nonbsd/MMD/Alicia_blade.pmx", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;*/
|
return nullptr != scene;*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ class utQ3DImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/Q3D/earth.q3o", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/Q3D/earth.q3o", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "SIBImporter.h"
|
#include "SIBImporter.h"
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
using namespace ::Assimp;
|
using namespace ::Assimp;
|
||||||
|
@ -51,7 +52,7 @@ class utSIBImporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SIB/heffalump.sib", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SIB/heffalump.sib", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "SMDLoader.h"
|
#include "SMDLoader.h"
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
using namespace ::Assimp;
|
using namespace ::Assimp;
|
||||||
|
@ -51,7 +52,7 @@ class utSMDImporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SMD/triangle.smd", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SMD/triangle.smd", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -73,6 +74,6 @@ TEST_F( utSMDImporter, importTest ) {
|
||||||
|
|
||||||
TEST_F( utSMDImporter, issue_899_Texture_garbage_at_end_of_string_Test ) {
|
TEST_F( utSMDImporter, issue_899_Texture_garbage_at_end_of_string_Test ) {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SMD/holy_grailref.smd", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SMD/holy_grailref.smd", aiProcess_ValidateDataStructure );
|
||||||
EXPECT_NE( nullptr, scene );
|
EXPECT_NE( nullptr, scene );
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utSTLImporterExporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/STL/Spider_ascii.stl", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/STL/Spider_ascii.stl", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -63,6 +64,6 @@ TEST_F( utSTLImporterExporter, importXFromFileTest ) {
|
||||||
|
|
||||||
TEST_F( utSTLImporterExporter, test_with_two_solids ) {
|
TEST_F( utSTLImporterExporter, test_with_two_solids ) {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/STL/triangle_with_two_solids.stl", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/STL/triangle_with_two_solids.stl", aiProcess_ValidateDataStructure );
|
||||||
EXPECT_NE( nullptr, scene );
|
EXPECT_NE( nullptr, scene );
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,3 +71,8 @@ TEST_F( utSceneCombiner, MergeMeshes_ValidNames_Test ) {
|
||||||
std::string outName = out->mName.C_Str();
|
std::string outName = out->mName.C_Str();
|
||||||
EXPECT_EQ( "mesh_1.mesh_2.mesh_3", outName );
|
EXPECT_EQ( "mesh_1.mesh_2.mesh_3", outName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F( utSceneCombiner, CopySceneWithNullptr_NoException ) {
|
||||||
|
EXPECT_NO_THROW( SceneCombiner::CopyScene( nullptr, nullptr ) );
|
||||||
|
EXPECT_NO_THROW( SceneCombiner::CopySceneFlat( nullptr, nullptr ) );
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utX3DImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/X3D/ComputerKeyboard.x3d", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/X3D/ComputerKeyboard.x3d", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class utXImporterExporter : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/X/test.x", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/X/test.x", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ class utglTF2ImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", 0);
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure);
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ public:
|
||||||
virtual bool exporterTest() {
|
virtual bool exporterTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
Assimp::Exporter exporter;
|
Assimp::Exporter exporter;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure );
|
||||||
EXPECT_NE( nullptr, scene );
|
EXPECT_NE( nullptr, scene );
|
||||||
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "gltf2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured_out.gltf" ) );
|
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "gltf2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured_out.gltf" ) );
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class utglTFImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF/TwoBoxes/TwoBoxes.gltf", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF/TwoBoxes/TwoBoxes.gltf", aiProcess_ValidateDataStructure );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue