Merge branch 'master' into master
commit
d180cfcba5
|
@ -1280,7 +1280,7 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
|
|||
|
||||
std::vector<ai_real> frames;
|
||||
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());
|
||||
|
|
|
@ -66,8 +66,8 @@ namespace Assimp {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// 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 (string.length >= 1 && string.data[0] == '$')
|
||||
return;
|
||||
|
@ -88,8 +88,7 @@ inline void PrefixString(aiString& string,const char* prefix, unsigned int len)
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// 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
|
||||
// and they can't have any anims assigned so its absolutely safe to duplicate them.
|
||||
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
|
||||
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);
|
||||
PrefixString(node->mName,prefix,len);
|
||||
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// 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));
|
||||
|
||||
// Check whether we find a positive match in one of the given sets
|
||||
for (unsigned int i = 0; i < input.size(); ++i) {
|
||||
|
||||
if (cur != i && input[i].hashes.find(hash) != input[i].hashes.end()) {
|
||||
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
|
||||
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);
|
||||
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
|
||||
for (unsigned int i = 0; i < input.size(); ++i) {
|
||||
|
||||
if (cur != i && input[i].hashes.find(hash) != input[i].hashes.end()) {
|
||||
PrefixString(node->mName,prefix,len);
|
||||
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
|
||||
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)
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Merges two scenes. Currently only used by the LWS loader.
|
||||
void SceneCombiner::MergeScenes(aiScene** _dest,std::vector<aiScene*>& src,
|
||||
unsigned int flags)
|
||||
{
|
||||
ai_assert(NULL != _dest);
|
||||
void SceneCombiner::MergeScenes(aiScene** _dest,std::vector<aiScene*>& src, unsigned int flags) {
|
||||
if ( nullptr == _dest ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
|
||||
if (src.empty())
|
||||
{
|
||||
if (*_dest)
|
||||
{
|
||||
if (src.empty()) {
|
||||
if (*_dest) {
|
||||
(*_dest)->~aiScene();
|
||||
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;
|
||||
for ( cnt = 0; cnt < attach->mNumChildren; ++cnt ) {
|
||||
AttachToGraph( attach->mChildren[ cnt ], srcList );
|
||||
|
@ -239,19 +231,16 @@ void SceneCombiner::AttachToGraph (aiNode* attach, std::vector<NodeAttachmentInf
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SceneCombiner::AttachToGraph ( aiScene* master,
|
||||
std::vector<NodeAttachmentInfo>& src)
|
||||
{
|
||||
void SceneCombiner::AttachToGraph ( aiScene* master, std::vector<NodeAttachmentInfo>& src) {
|
||||
ai_assert(NULL != master);
|
||||
AttachToGraph(master->mRootNode,src);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
|
||||
std::vector<AttachmentInfo>& srcList,
|
||||
unsigned int flags)
|
||||
{
|
||||
ai_assert(NULL != _dest);
|
||||
void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master, std::vector<AttachmentInfo>& srcList, unsigned int flags) {
|
||||
if ( nullptr == _dest ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
|
||||
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,
|
||||
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.
|
||||
// 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 end)
|
||||
{
|
||||
ai_assert(NULL != _out);
|
||||
if ( nullptr == _out ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (begin == end) {
|
||||
*_out = NULL; // no meshes ...
|
||||
|
@ -903,7 +896,9 @@ void SceneCombiner::MergeMaterials(aiMaterial** dest,
|
|||
std::vector<aiMaterial*>::const_iterator begin,
|
||||
std::vector<aiMaterial*>::const_iterator end)
|
||||
{
|
||||
ai_assert(NULL != dest);
|
||||
if ( nullptr == dest ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (begin == end) {
|
||||
*dest = NULL; // no materials ...
|
||||
|
@ -953,10 +948,9 @@ void SceneCombiner::MergeMaterials(aiMaterial** dest,
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename Type>
|
||||
inline void CopyPtrArray (Type**& dest, const Type* const * src, ai_uint num)
|
||||
{
|
||||
if (!num)
|
||||
{
|
||||
inline
|
||||
void CopyPtrArray (Type**& dest, const Type* const * src, ai_uint num) {
|
||||
if (!num) {
|
||||
dest = NULL;
|
||||
return;
|
||||
}
|
||||
|
@ -968,9 +962,11 @@ inline void CopyPtrArray (Type**& dest, const Type* const * src, ai_uint num)
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename Type>
|
||||
inline void GetArrayCopy (Type*& dest, ai_uint num )
|
||||
{
|
||||
if (!dest)return;
|
||||
inline
|
||||
void GetArrayCopy(Type*& dest, ai_uint num ) {
|
||||
if ( !dest ) {
|
||||
return;
|
||||
}
|
||||
Type* old = dest;
|
||||
|
||||
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?
|
||||
if (*_dest) {
|
||||
(*_dest)->~aiScene();
|
||||
new (*_dest) aiScene();
|
||||
} else {
|
||||
*_dest = new aiScene();
|
||||
}
|
||||
else *_dest = new aiScene();
|
||||
|
||||
::memcpy(*_dest,src,sizeof(aiScene));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SceneCombiner::CopyScene(aiScene** _dest,const aiScene* src,bool allocate)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::CopyScene(aiScene** _dest,const aiScene* src,bool allocate) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (allocate) {
|
||||
*_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)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::Copy( aiMesh** _dest, const aiMesh* src ) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
aiMesh* dest = *_dest = new aiMesh();
|
||||
|
||||
|
@ -1072,17 +1074,17 @@ void SceneCombiner::Copy (aiMesh** _dest, const aiMesh* src)
|
|||
|
||||
// make a deep copy of all faces
|
||||
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];
|
||||
GetArrayCopy(f.mIndices,f.mNumIndices);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::Copy(aiTexture** _dest, const aiTexture* src) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
ai_assert( NULL != _dest );
|
||||
ai_assert( NULL != src );
|
||||
void SceneCombiner::Copy( aiAnimation** _dest, const aiAnimation* src ) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::Copy(aiNodeAnim** _dest, const aiNodeAnim* src) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::Copy( aiCamera** _dest,const aiCamera* src) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::Copy(aiLight** _dest, const aiLight* src) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ai_assert(NULL != _dest && NULL != src);
|
||||
void SceneCombiner::Copy(aiBone** _dest, const aiBone* src) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ai_assert( NULL != _dest );
|
||||
ai_assert( NULL != src);
|
||||
void SceneCombiner::Copy(aiMetadata** _dest, const aiMetadata* src) {
|
||||
if ( nullptr == _dest || nullptr == src ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 0 == src->mNumProperties ) {
|
||||
return;
|
||||
}
|
||||
|
||||
aiMetadata* dest = *_dest = aiMetadata::Alloc( src->mNumProperties );
|
||||
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,
|
||||
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>
|
||||
inline void DoValidationEx(T** array, unsigned int size,
|
||||
const char* firstName, const char* secondName);
|
||||
|
|
|
@ -436,7 +436,6 @@ namespace glTF2
|
|||
{
|
||||
Ref<BufferView> bufferView; //!< The ID of the bufferView. (required)
|
||||
unsigned int byteOffset; //!< The offset relative to the start of the bufferView in bytes. (required)
|
||||
unsigned int byteStride; //!< The stride, in bytes, between attributes referenced by this accessor. (default: 0)
|
||||
ComponentType componentType; //!< The datatype of components in the attribute. (required)
|
||||
unsigned int count; //!< The number of attributes referenced by this accessor. (required)
|
||||
AttribType::Value type; //!< Specifies if the attribute is a scalar, vector, or matrix. (required)
|
||||
|
@ -627,6 +626,7 @@ namespace glTF2
|
|||
Ref<Buffer> buffer; //! The ID of the buffer. (required)
|
||||
size_t byteOffset; //! The offset into the buffer in bytes. (required)
|
||||
size_t byteLength; //! The length of the bufferView in bytes. (default: 0)
|
||||
unsigned int byteStride; //!< The stride, in bytes, between attributes referenced by this accessor. (default: 0)
|
||||
|
||||
BufferViewTarget target; //! The target that the WebGL buffer should be bound to.
|
||||
|
||||
|
|
|
@ -512,6 +512,7 @@ inline void BufferView::Read(Value& obj, Asset& r)
|
|||
|
||||
byteOffset = MemberOrDefault(obj, "byteOffset", 0u);
|
||||
byteLength = MemberOrDefault(obj, "byteLength", 0u);
|
||||
byteStride = MemberOrDefault(obj, "byteStride", 0u);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -526,7 +527,6 @@ inline void Accessor::Read(Value& obj, Asset& r)
|
|||
}
|
||||
|
||||
byteOffset = MemberOrDefault(obj, "byteOffset", 0u);
|
||||
byteStride = MemberOrDefault(obj, "byteStride", 0u);
|
||||
componentType = MemberOrDefault(obj, "componentType", ComponentType_BYTE);
|
||||
count = MemberOrDefault(obj, "count", 0u);
|
||||
|
||||
|
@ -601,7 +601,7 @@ bool Accessor::ExtractData(T*& outData)
|
|||
const size_t elemSize = GetElementSize();
|
||||
const size_t totalSize = elemSize * count;
|
||||
|
||||
const size_t stride = byteStride ? byteStride : elemSize;
|
||||
const size_t stride = bufferView && bufferView->byteStride ? bufferView->byteStride : elemSize;
|
||||
|
||||
const size_t targetElemSize = sizeof(T);
|
||||
ai_assert(elemSize <= targetElemSize);
|
||||
|
@ -641,7 +641,7 @@ inline Accessor::Indexer::Indexer(Accessor& acc)
|
|||
: accessor(acc)
|
||||
, data(acc.GetPointer())
|
||||
, elemSize(acc.GetElementSize())
|
||||
, stride(acc.byteStride ? acc.byteStride : elemSize)
|
||||
, stride(acc.bufferView && acc.bufferView->byteStride ? acc.bufferView->byteStride : elemSize)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -98,10 +98,6 @@ namespace glTF2 {
|
|||
obj.AddMember("bufferView", a.bufferView->index, w.mAl);
|
||||
obj.AddMember("byteOffset", a.byteOffset, w.mAl);
|
||||
|
||||
if (a.byteStride != 0) {
|
||||
obj.AddMember("byteStride", a.byteStride, w.mAl);
|
||||
}
|
||||
|
||||
obj.AddMember("componentType", int(a.componentType), w.mAl);
|
||||
obj.AddMember("count", a.count, w.mAl);
|
||||
obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
|
||||
|
@ -168,6 +164,9 @@ namespace glTF2 {
|
|||
obj.AddMember("buffer", bv.buffer->index, w.mAl);
|
||||
obj.AddMember("byteOffset", static_cast<uint64_t>(bv.byteOffset), w.mAl);
|
||||
obj.AddMember("byteLength", static_cast<uint64_t>(bv.byteLength), w.mAl);
|
||||
if (bv.byteStride != 0) {
|
||||
obj.AddMember("byteStride", bv.byteStride, w.mAl);
|
||||
}
|
||||
obj.AddMember("target", int(bv.target), w.mAl);
|
||||
}
|
||||
|
||||
|
|
|
@ -170,13 +170,13 @@ inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& bu
|
|||
bv->buffer = buffer;
|
||||
bv->byteOffset = unsigned(offset);
|
||||
bv->byteLength = length; //! The target that the WebGL buffer should be bound to.
|
||||
bv->byteStride = 0;
|
||||
bv->target = isIndices ? BufferViewTarget_ELEMENT_ARRAY_BUFFER : BufferViewTarget_ARRAY_BUFFER;
|
||||
|
||||
// accessor
|
||||
Ref<Accessor> acc = a.accessors.Create(a.FindUniqueID(meshName, "accessor"));
|
||||
acc->bufferView = bv;
|
||||
acc->byteOffset = 0;
|
||||
acc->byteStride = 0;
|
||||
acc->componentType = compType;
|
||||
acc->count = count;
|
||||
acc->type = typeOut;
|
||||
|
|
|
@ -197,13 +197,17 @@ struct SceneHelper
|
|||
* The class is currently being used by various postprocessing steps
|
||||
* and loaders (ie. LWS).
|
||||
*/
|
||||
class ASSIMP_API SceneCombiner
|
||||
{
|
||||
class ASSIMP_API SceneCombiner {
|
||||
// class cannot be instanced
|
||||
SceneCombiner() {}
|
||||
SceneCombiner() {
|
||||
// empty
|
||||
}
|
||||
|
||||
~SceneCombiner() {
|
||||
// empty
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Merges two or more scenes.
|
||||
*
|
||||
|
|
|
@ -187,7 +187,7 @@ struct aiMetadata {
|
|||
static inline
|
||||
aiMetadata *Alloc( unsigned int numProperties ) {
|
||||
if ( 0 == numProperties ) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aiMetadata *data = new aiMetadata;
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class ut3DImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class ut3DSImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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
|
||||
return nullptr != scene;
|
||||
#else
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utACImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utAMFImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utASEImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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
|
||||
return nullptr != scene;
|
||||
#else
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utB3DImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -50,7 +51,7 @@ class utBVHImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
class BlendImportAreaLight : public ::testing::Test {
|
||||
public:
|
||||
|
@ -67,7 +68,7 @@ protected:
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
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->HasLights());
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/cexport.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
class BlendImportMaterials : public ::testing::Test {
|
||||
public:
|
||||
|
@ -66,7 +67,7 @@ protected:
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
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->HasMaterials());
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -50,7 +51,7 @@ class utBlenderImporterExporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -50,7 +51,7 @@ class utCSMImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
|
@ -73,7 +74,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
|||
{
|
||||
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->HasCameras());
|
||||
|
||||
|
@ -95,7 +96,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
|||
names[ i ] = orig->mName;
|
||||
pos[ i ] = orig->mPosition;
|
||||
}
|
||||
const aiScene* imported = im->ReadFile(file,0);
|
||||
const aiScene* imported = im->ReadFile(file, aiProcess_ValidateDataStructure);
|
||||
|
||||
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/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
|
@ -72,7 +73,7 @@ TEST_F(ColladaExportLight, testExportLight)
|
|||
{
|
||||
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->HasLights());
|
||||
|
||||
|
@ -86,7 +87,7 @@ TEST_F(ColladaExportLight, testExportLight)
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -50,7 +51,7 @@ class utColladaImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -44,12 +44,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
class utD3MFImporterExporter : public AbstractImportExportBase {
|
||||
public:
|
||||
virtual bool importerTest() {
|
||||
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 );
|
||||
aiMesh *mesh = scene->mMeshes[ 0 ];
|
||||
EXPECT_NE( nullptr, mesh );
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utDXFImporterExporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
ex = new Assimp::Exporter();
|
||||
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()
|
||||
|
@ -37,7 +37,7 @@ TEST_F(ExporterTest, testExportToFile)
|
|||
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
||||
|
||||
// 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 <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utFBXImporterExporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -50,7 +51,7 @@ class utHMPImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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 true;
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -50,7 +51,7 @@ class utIFCImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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 true;
|
||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/scene.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
#include "TestModelFactory.h"
|
||||
|
||||
|
@ -66,7 +67,7 @@ TEST_F( utIssues, OpacityBugWhenExporting_727 ) {
|
|||
EXPECT_NE( desc, nullptr );
|
||||
path.append( desc->fileExtension );
|
||||
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 );
|
||||
float newOpacity;
|
||||
if ( newScene->mNumMaterials > 0 ) {
|
||||
|
|
|
@ -193,7 +193,7 @@ protected:
|
|||
|
||||
virtual bool importerTest() {
|
||||
::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;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ protected:
|
|||
virtual bool exporterTest() {
|
||||
::Assimp::Importer importer;
|
||||
::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_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" ) );
|
||||
|
@ -257,7 +257,7 @@ TEST_F( utObjImportExport, issue1111_no_mat_name_Test ) {
|
|||
|
||||
TEST_F( utObjImportExport, issue809_vertex_color_Test ) {
|
||||
::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 );
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
|
|
@ -52,7 +52,7 @@ class utPMXImporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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 true;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -51,7 +52,7 @@ class utQ3DImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "SIBImporter.h"
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
#include "AbstractImportExportBase.h"
|
||||
|
||||
using namespace ::Assimp;
|
||||
|
@ -51,7 +52,7 @@ class utSIBImporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "SMDLoader.h"
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
#include "AbstractImportExportBase.h"
|
||||
|
||||
using namespace ::Assimp;
|
||||
|
@ -51,7 +52,7 @@ class utSMDImporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
@ -73,6 +74,6 @@ TEST_F( utSMDImporter, importTest ) {
|
|||
|
||||
TEST_F( utSMDImporter, issue_899_Texture_garbage_at_end_of_string_Test ) {
|
||||
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 );
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utSTLImporterExporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
@ -63,6 +64,6 @@ TEST_F( utSTLImporterExporter, importXFromFileTest ) {
|
|||
|
||||
TEST_F( utSTLImporterExporter, test_with_two_solids ) {
|
||||
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 );
|
||||
}
|
||||
|
|
|
@ -71,3 +71,8 @@ TEST_F( utSceneCombiner, MergeMeshes_ValidNames_Test ) {
|
|||
std::string outName = out->mName.C_Str();
|
||||
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 <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utX3DImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AbstractImportExportBase.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class utXImporterExporter : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -51,7 +52,7 @@ class utglTF2ImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
virtual bool exporterTest() {
|
||||
Assimp::Importer importer;
|
||||
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_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 <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -50,7 +51,7 @@ class utglTFImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue