From b03b3b9c03954aee8d860bf4f70841b15505dae9 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 24 May 2019 17:22:54 +0200 Subject: [PATCH 01/43] Initial parsing for header and more. --- code/CMakeLists.txt | 5 +++++ code/ImporterRegistry.cpp | 9 ++++++++- test/CMakeLists.txt | 1 + test/models/JT/conrod.jt | Bin 0 -> 61578 bytes test/models/PLY/cube_test.ply | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 test/models/JT/conrod.jt diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index df12695d2..53da5019e 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -292,6 +292,11 @@ ADD_ASSIMP_IMPORTER( AMF AMFImporter_Postprocess.cpp ) +ADD_ASSIMP_IMPORTER( JT + JTImporter.h + JTImporter.cpp +) + ADD_ASSIMP_IMPORTER( 3DS 3DSConverter.cpp 3DSHelper.h diff --git a/code/ImporterRegistry.cpp b/code/ImporterRegistry.cpp index 747815fa6..69a50bf27 100644 --- a/code/ImporterRegistry.cpp +++ b/code/ImporterRegistry.cpp @@ -200,6 +200,9 @@ corresponding preprocessor flag to selectively disable formats. #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER # include "Importer/StepFile/StepFileImporter.h" #endif +#ifndef ASSIMP_BUILD_NO_JT_IMPORTER +# include "JTImporter.h" +#endif namespace Assimp { @@ -358,13 +361,17 @@ void GetImporterInstanceList(std::vector< BaseImporter* >& out) #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER out.push_back(new StepFile::StepFileImporter()); #endif +#ifndef ASSIMP_BUILD_NO_JT_IMPORTER + out.push_back(new JTImporter()); +#endif + } /** will delete all registered importers. */ void DeleteImporterInstanceList(std::vector< BaseImporter* >& deleteList){ for(size_t i= 0; i^1y6e#0NC?sm0@5Yj-6@BZ?vxPe?h>S1LO?pC1SJ(z6hZkm z|Np(?-s^jBeBT(~n`5ti=A6H|*PeT?xni%ij-HLDmxG%tod`EC-Tw^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=;CVsiih literal 0 HcmV?d00001 diff --git a/test/models/PLY/cube_test.ply b/test/models/PLY/cube_test.ply index a86d022a5..b460215dc 100644 --- a/test/models/PLY/cube_test.ply +++ b/test/models/PLY/cube_test.ply @@ -1,6 +1,6 @@ ply format ascii 1.0 -comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.3297435427) +comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.732158294) element vertex 8 property float x property float y From 6ed4f5d936dbd341bc12a19303ec11d7472b568e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 6 Jun 2019 08:29:12 +0200 Subject: [PATCH 02/43] JT: Inital commit. --- code/FBXConverter.h | 1 + code/JTImporter.cpp | 186 +++++++++++++++++++++++++++++++++++++++ code/JTImporter.h | 207 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 394 insertions(+) create mode 100644 code/JTImporter.cpp create mode 100644 code/JTImporter.h diff --git a/code/FBXConverter.h b/code/FBXConverter.h index f75222d5b..1aa7e13ea 100644 --- a/code/FBXConverter.h +++ b/code/FBXConverter.h @@ -52,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "FBXUtil.h" #include "FBXProperties.h" #include "FBXImporter.h" + #include #include #include diff --git a/code/JTImporter.cpp b/code/JTImporter.cpp new file mode 100644 index 000000000..efee4bcb3 --- /dev/null +++ b/code/JTImporter.cpp @@ -0,0 +1,186 @@ +#include "JTImporter.h" + +#include +#include +#include +#include +#include + +#ifndef ASSIMP_BUILD_NO_JT_IMPORTER + +namespace Assimp { + +namespace { + + static const aiImporterDesc desc = { + "Siemens JF File format importer", + "", + "", + "", + aiImporterFlags_SupportTextFlavour, + 0, + 0, + 0, + 0, + "jt" + }; +} + +enum SegmentType { + SceneGraph = 1, + JT_B_Rep, + PMI_Data, + MetaData, + Shape, + Shape_LOD0, + Shape_LOD1, + Shape_LOD2, + Shape_LOD3, + Shape_LOD4, + Shape_LOD5, + Shape_LOD6, + Shape_LOD7, + Shape_LOD8, + Shape_LOD9, + XT_B_Rep, + Wireframe_Rep, + ULP, + LWPA +}; + +JTImporter::JTImporter() +: BaseImporter() +, mJTModel() +, mDataSegments() +, mCurrentDataSegment( nullptr ){ + // empty +} + +JTImporter::~JTImporter() { + // empty +} + +bool JTImporter::CanRead(const std::string &file, IOSystem* pIOHandler, bool checkSig) const { + const std::string& extension = GetExtension(file); + if (extension == std::string(desc.mFileExtensions)) { + return true; + } + + return false; +} + +const aiImporterDesc* JTImporter::GetInfo() const { + return &desc; +} + +void JTImporter::InternReadFile(const std::string &file, aiScene* pScene, IOSystem* pIOHandler) { + + std::unique_ptr stream(pIOHandler->Open(file, "rb")); + if (!stream) { + throw DeadlyImportError("JT: Cannot open file " + file ); + } + + std::vector contents; + contents.resize(stream->FileSize() + 1); + stream->Read(&*contents.begin(), 1, contents.size() - 1); + contents[contents.size() - 1] = 0; + BinReader reader(contents); + ReadHeader(reader); +} + +void JTImporter::ReadHeader(BinReader& reader) { + reader.readChars(VersionLen, mJTModel.mJTHeader.mVersion); + reader.readUChar(mJTModel.mJTHeader.mByteOrder); + reader.readI32(mJTModel.mJTHeader.mReserved); + + int toc_offset; + reader.readI32(toc_offset); +} + +void JTImporter::ReadTokenSegment(BinReader& reader) { + int toc_count; + reader.readI32(toc_count); + if (0 == toc_count) { + return; + } + + for (int i = 0; i < toc_count; ++i) { + ReadTokenEntry(reader); + } +} + +void JTImporter::ReadTokenEntry(BinReader& reader) { + TokenEntry* entry = new TokenEntry; + reader.readGUID(entry->guid); + reader.readI32(entry->offset); + reader.readI32(entry->length); + reader.readU32(entry->attributes); + + mJTModel.mTokenEntryMap[entry->guid] = entry; +} + +TokenEntry* JTImporter::FindTokenEntryByGuid(GUID& guid) { + if (mJTModel.mTokenEntryMap.empty()) { + return nullptr; + } + + JTModel::TokenEntryMap::const_iterator it(mJTModel.mTokenEntryMap.find(guid)); + if (it == mJTModel.mTokenEntryMap.end()) { + return nullptr; + } + + return it->second; +} + +static bool SupportsZlibCompression(SegmentType type) { + switch (type) { + case SceneGraph: + case JT_B_Rep: + case PMI_Data: + case MetaData: + return true; + case Shape: + case Shape_LOD0: + case Shape_LOD1: + case Shape_LOD2: + case Shape_LOD3: + case Shape_LOD4: + case Shape_LOD5: + case Shape_LOD6: + case Shape_LOD7: + case Shape_LOD8: + case Shape_LOD9: + return false; + case XT_B_Rep: + case Wireframe_Rep: + case ULP: + case LWPA: + return true; + default: + ai_assert_entry(); + break; + } + + return false; +} + +void JTImporter::ReadDataSegment(BinReader& reader) { + mCurrentDataSegment = new DataSegment; + mDataSegments.push_back(mCurrentDataSegment); + ReadDataSegmentHeader(reader); + +} + +void JTImporter::ReadDataSegmentHeader(BinReader& reader) { + if (nullptr == mCurrentDataSegment) { + return; + } + + reader.readGUID(mCurrentDataSegment->m_DataSegmentHeader.guid); + reader.readI32(mCurrentDataSegment->m_DataSegmentHeader.type); + reader.readI32(mCurrentDataSegment->m_DataSegmentHeader.length); +} + +} // end namespace Assimp + +#endif // ASSIMP_BUILD_NO_JT_IMPORTER diff --git a/code/JTImporter.h b/code/JTImporter.h new file mode 100644 index 000000000..821a31032 --- /dev/null +++ b/code/JTImporter.h @@ -0,0 +1,207 @@ +#pragma once +#ifndef AI_JTIMPORTER_H_INC +#define AI_JTIMPORTER_H_INC + +#include + +#include +#include + +#ifndef ASSIMP_BUILD_NO_JT_IMPORTER + +namespace Assimp { + +using i32 = int; +using u32 = unsigned int; +using i16 = short; +using u16 = unsigned short; +using c8 = char; +using u8 = unsigned char; +using f32 = float; +using f64 = double; + +static const size_t VersionLen = 80u; + +struct JTHeader { + char mVersion[VersionLen]; + unsigned char mByteOrder; + int mReserved; + int toc_offset; +}; + +template +struct TJTCoord { + T x, y, z; +}; + +using F32Coord = TJTCoord; +using F64Coord = TJTCoord; + +struct BBox32 { + F32Coord min; + F32Coord max; +}; + +template +struct THJTCoord { + T x, y, z, w; +}; + +using F32HCoord = THJTCoord; +using F64HCoord = THJTCoord; + +struct MbString { + int count; + char *data; +}; + +struct String { + int count; + char* data; +}; + +template +struct TVec { + int count; + T *data; +}; + +using VecF32 = TVec; +using VecF64 = TVec; +using VecI32 = TVec; + +struct RGB { + f32 data[3]; +}; + +struct RGBA { + f32 data[4]; + }; + +struct GUID { + unsigned int id1; + u16 id2[2]; + u8 id3[8]; +}; + +struct GUIDComparer { + bool operator() (const GUID& lhs, const GUID& rhs) const { + if (lhs.id1 < rhs.id1) { + return true; + } + + for (size_t i = 0; i < 2; ++i) { + if (lhs.id2[i] < rhs.id2[i]) { + return true; + } + } + + for (size_t i = 0; i < 8; ++i) { + if (lhs.id3[i] < rhs.id3[i]) { + return true; + } + } + + return false; + } +}; + +struct TokenEntry { + GUID guid; + i32 offset; + i32 length; + u32 attributes; +}; + +struct DataSegmentHeader { + GUID guid; + i32 type; + i32 length; +}; + +struct DataSegment { + DataSegmentHeader m_DataSegmentHeader; +}; + +struct ElementHeader { + GUID obj_type_id; + u8 obj_base_type; + i32 obj_id; +}; + +struct JTModel { + JTHeader mJTHeader; + GUID mGUID; + using TokenEntryMap = std::map; + TokenEntryMap mTokenEntryMap; +}; + +class BinReader { + std::vector& mData; + size_t mOffset; + +public: + BinReader(std::vector& data) + : mData(data) + , mOffset(0u){ + // empty + } + + void readChars(size_t numChars, char* buffer) { + ::memcpy(buffer, &mData[mOffset], numChars); + mOffset += numChars; + } + + void readUChar(unsigned char &c) { + ::memcpy(&c, &mData[mOffset], sizeof(unsigned char)); + mOffset += sizeof(unsigned char); + } + + void readI32(int32_t& v) { + ::memcpy(&v, &mData[mOffset], sizeof(int32_t)); + mOffset += sizeof(int32_t); + } + + void readU32(uint32_t& v) { + ::memcpy(&v, &mData[mOffset], sizeof(uint32_t)); + mOffset += sizeof(uint32_t); + } + + void readGUID(GUID &guid) { + ::memcpy(&guid.id1, &mData[mOffset], sizeof(i32)); + mOffset += sizeof(i32); + ::memcpy(guid.id2, &mData[mOffset], sizeof(u16) * 2); + mOffset += sizeof(u16)*2; + ::memcpy(guid.id3, &mData[mOffset], sizeof(u8) * 8); + mOffset += sizeof(u8) * 8; + } +}; + +class JTImporter : public BaseImporter { +public: + JTImporter(); + ~JTImporter(); + bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const override; + const aiImporterDesc* GetInfo() const override; + +protected: + void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler ) override; + void ReadHeader(BinReader &reader); + void ReadTokenSegment(BinReader& reader); + void ReadTokenEntry(BinReader& reader); + TokenEntry* FindTokenEntryByGuid(GUID& id); + void ReadDataSegment(BinReader& reader); + void ReadDataSegmentHeader(BinReader& reader); + +private: + JTModel mJTModel; + std::vector mDataSegments; + DataSegment *mCurrentDataSegment; + +}; + +} // end namespace Assimp + +#endif // ASSIMP_BUILD_NO_JT_IMPORTER + +#endif // AI_JTIMPORTER_H_INC From 6b3d6c3b8f53a493e44ed60dafde22a243dc169b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 18 Jun 2019 20:35:02 +0200 Subject: [PATCH 03/43] JT: next steps. --- code/JTImporter.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++-- code/JTImporter.h | 3 +++ 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/code/JTImporter.cpp b/code/JTImporter.cpp index efee4bcb3..0348770bc 100644 --- a/code/JTImporter.cpp +++ b/code/JTImporter.cpp @@ -27,7 +27,7 @@ namespace { } enum SegmentType { - SceneGraph = 1, + LogicalSceneGraph = 1, JT_B_Rep, PMI_Data, MetaData, @@ -134,7 +134,7 @@ TokenEntry* JTImporter::FindTokenEntryByGuid(GUID& guid) { static bool SupportsZlibCompression(SegmentType type) { switch (type) { - case SceneGraph: + case LogicalSceneGraph: case JT_B_Rep: case PMI_Data: case MetaData: @@ -179,6 +179,67 @@ void JTImporter::ReadDataSegmentHeader(BinReader& reader) { reader.readGUID(mCurrentDataSegment->m_DataSegmentHeader.guid); reader.readI32(mCurrentDataSegment->m_DataSegmentHeader.type); reader.readI32(mCurrentDataSegment->m_DataSegmentHeader.length); + +} + +void JTImporter::ReadLogicalElementHeaderZLib(BinReader& reader) { + i32 compressionFlag; + reader.readI32(compressionFlag); + i32 compressedLen; + reader.readI32(compressedLen); + u8 compressionAlgo; + reader.readUChar(compressionAlgo); +} + +void JTImporter::ReadSegmentType(BinReader& reader) { + SegmentType type = static_cast(mCurrentDataSegment->m_DataSegmentHeader.type); + switch (type) { + case LogicalSceneGraph: + ReadLSG(reader); + break; + case JT_B_Rep: + break; + case PMI_Data: + break; + case MetaData: + break; + case Shape: + break; + case Shape_LOD0: + break; + case Shape_LOD1: + break; + case Shape_LOD2: + break; + case Shape_LOD3: + break; + case Shape_LOD4: + break; + case Shape_LOD5: + break; + case Shape_LOD6: + break; + case Shape_LOD7: + break; + case Shape_LOD8: + break; + case Shape_LOD9: + break; + case XT_B_Rep: + break; + case Wireframe_Rep: + break; + case ULP: + break; + case LWPA: + break; + default: + break; + } +} + +void JTImporter::ReadLSG(BinReader& reader) { + ReadLogicalElementHeaderZLib(reader); } } // end namespace Assimp diff --git a/code/JTImporter.h b/code/JTImporter.h index 821a31032..9466900bb 100644 --- a/code/JTImporter.h +++ b/code/JTImporter.h @@ -192,6 +192,9 @@ protected: TokenEntry* FindTokenEntryByGuid(GUID& id); void ReadDataSegment(BinReader& reader); void ReadDataSegmentHeader(BinReader& reader); + void ReadLogicalElementHeaderZLib(BinReader& reader); + void ReadSegmentType(BinReader& reader); + void ReadLSG(BinReader& reader); private: JTModel mJTModel; From 418c07a9bb0c74babf74eac16660f1b1d273e20d Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 21 Jun 2019 18:00:53 +0200 Subject: [PATCH 04/43] closes https://github.com/assimp/assimp/issues/2368: add missign anim mesh for multimaterial meshes in fbx,. --- code/CreateAnimMesh.cpp | 4 ++-- code/FBXConverter.cpp | 44 +++++++++++++++++++++++++++++++++++++++++ code/FBXParser.cpp | 4 ---- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/code/CreateAnimMesh.cpp b/code/CreateAnimMesh.cpp index 1a052849b..ab7dac5ca 100644 --- a/code/CreateAnimMesh.cpp +++ b/code/CreateAnimMesh.cpp @@ -47,10 +47,10 @@ namespace Assimp { aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh) { aiAnimMesh *animesh = new aiAnimMesh; - animesh->mVertices = NULL; + /*animesh->mVertices = NULL; animesh->mNormals = NULL; animesh->mTangents = NULL; - animesh->mBitangents = NULL; + animesh->mBitangents = NULL;*/ animesh->mNumVertices = mesh->mNumVertices; if (mesh->mVertices) { animesh->mVertices = new aiVector3D[animesh->mNumVertices]; diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 1701b2966..5f7835461 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -1385,6 +1385,50 @@ namespace Assimp { ConvertWeights(out_mesh, model, mesh, node_global_transform, index, &reverseMapping); } + std::vector animMeshes; + size_t bsIdx(0), bsChannelIdx(0); + for (const BlendShape* blendShape : mesh.GetBlendShapes()) { + for (const BlendShapeChannel* blendShapeChannel : blendShape->BlendShapeChannels()) { + const std::vector& shapeGeometries = blendShapeChannel->GetShapeGeometries(); + for (size_t i = 0; i < shapeGeometries.size(); i++) { + aiAnimMesh* animMesh = aiCreateAnimMesh(out_mesh); + const ShapeGeometry* shapeGeometry = shapeGeometries.at(i); + const std::vector& vertices = shapeGeometry->GetVertices(); + const std::vector& normals = shapeGeometry->GetNormals(); + const std::vector& indices = shapeGeometry->GetIndices(); + animMesh->mName.Set(FixAnimMeshName(shapeGeometry->Name())); + for (size_t j = 0; j < indices.size(); j++) { + unsigned int index = indices.at(j); + aiVector3D vertex = vertices.at(j); + aiVector3D normal = normals.at(j); + unsigned int count = 0; + const unsigned int* outIndices = mesh.ToOutputVertexIndex(index, count); + for (unsigned int k = 0; k < count; k++) { + unsigned int index = outIndices[k]; + animMesh->mVertices[index] += vertex; + if (animMesh->mNormals != nullptr) { + animMesh->mNormals[index] += normal; + animMesh->mNormals[index].NormalizeSafe(); + } + } + } + animMesh->mWeight = shapeGeometries.size() > 1 ? blendShapeChannel->DeformPercent() / 100.0f : 1.0f; + animMeshes.push_back(animMesh); + } + bsChannelIdx++; + } + bsIdx++; + } + + const size_t numAnimMeshes = animMeshes.size(); + if (numAnimMeshes > 0) { + out_mesh->mNumAnimMeshes = static_cast(numAnimMeshes); + out_mesh->mAnimMeshes = new aiAnimMesh * [numAnimMeshes]; + for (size_t i = 0; i < numAnimMeshes; i++) { + out_mesh->mAnimMeshes[i] = animMeshes.at(i); + } + } + return static_cast(meshes.size() - 1); } diff --git a/code/FBXParser.cpp b/code/FBXParser.cpp index fe63866a0..d1f1689c5 100644 --- a/code/FBXParser.cpp +++ b/code/FBXParser.cpp @@ -963,7 +963,6 @@ void ParseVectorDataArray(std::vector& out, const Element& el) } } - // ------------------------------------------------------------------------------------------------ // read an array of uints void ParseVectorDataArray(std::vector& out, const Element& el) @@ -1280,7 +1279,6 @@ float ParseTokenAsFloat(const Token& t) return i; } - // ------------------------------------------------------------------------------------------------ // wrapper around ParseTokenAsInt() with ParseError handling int ParseTokenAsInt(const Token& t) @@ -1293,8 +1291,6 @@ int ParseTokenAsInt(const Token& t) return i; } - - // ------------------------------------------------------------------------------------------------ // wrapper around ParseTokenAsInt64() with ParseError handling int64_t ParseTokenAsInt64(const Token& t) From b87f4c03bab4df875d5ec05be15809bbec73d342 Mon Sep 17 00:00:00 2001 From: kkulling Date: Tue, 9 Jul 2019 11:49:59 +0200 Subject: [PATCH 05/43] Remove not needed init. --- code/CreateAnimMesh.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/code/CreateAnimMesh.cpp b/code/CreateAnimMesh.cpp index ab7dac5ca..98b60e531 100644 --- a/code/CreateAnimMesh.cpp +++ b/code/CreateAnimMesh.cpp @@ -47,10 +47,6 @@ namespace Assimp { aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh) { aiAnimMesh *animesh = new aiAnimMesh; - /*animesh->mVertices = NULL; - animesh->mNormals = NULL; - animesh->mTangents = NULL; - animesh->mBitangents = NULL;*/ animesh->mNumVertices = mesh->mNumVertices; if (mesh->mVertices) { animesh->mVertices = new aiVector3D[animesh->mNumVertices]; From 6b5e0a991401db8f13c3861e59a05cdd186add4a Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Tue, 9 Jul 2019 19:05:45 -0700 Subject: [PATCH 06/43] fix group node being exported as bone node --- code/FBX/FBXExporter.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index dd34e135f..a0a46e09d 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -1617,6 +1617,17 @@ void FBXExporter::WriteObjects () // at the same time we can build a list of all the skeleton nodes, // which will be used later to mark them as type "limbNode". std::unordered_set limbnodes; + + //actual bone nodes in fbx, without parenting-up + std::set setAllBoneNamesInScene; + for(int m = 0; m < mScene->mNumMeshes; ++ m) + { + aiMesh* pMesh = mScene->mMeshes[m]; + for(int b = 0; b < pMesh->mNumBones; ++ b) + setAllBoneNamesInScene.insert(pMesh->mBones[b]->mName.data); + } + aiMatrix4x4 mxTransIdentity; + // and a map of nodes by bone name, as finding them is annoying. std::map node_by_bone; for (size_t mi = 0; mi < mScene->mNumMeshes; ++mi) { @@ -1660,6 +1671,11 @@ void FBXExporter::WriteObjects () if (node_name.find(MAGIC_NODE_TAG) != std::string::npos) { continue; } + //not a bone in scene && no effect in transform + if(setAllBoneNamesInScene.find(node_name)==setAllBoneNamesInScene.end() + && parent->mTransformation == mxTransIdentity) { + continue; + } // otherwise check if this is the root of the skeleton bool end = false; // is the mesh part of this node? From d7773dcfba97b76ca4671b629f8856c0d2693d74 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 09:51:20 -0700 Subject: [PATCH 07/43] set->unordered_set;unsigned int for iteration --- code/FBX/FBXExporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index a0a46e09d..08f4bdbc9 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -1619,11 +1619,11 @@ void FBXExporter::WriteObjects () std::unordered_set limbnodes; //actual bone nodes in fbx, without parenting-up - std::set setAllBoneNamesInScene; - for(int m = 0; m < mScene->mNumMeshes; ++ m) + std::unordered_set setAllBoneNamesInScene; + for(unsigned int m = 0; m < mScene->mNumMeshes; ++ m) { aiMesh* pMesh = mScene->mMeshes[m]; - for(int b = 0; b < pMesh->mNumBones; ++ b) + for(unsigned int b = 0; b < pMesh->mNumBones; ++ b) setAllBoneNamesInScene.insert(pMesh->mBones[b]->mName.data); } aiMatrix4x4 mxTransIdentity; From f703a798f4a66166687a0d5252a6e389bd1d752c Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:27:59 -0700 Subject: [PATCH 08/43] customize error rate for bind pose --- code/FBX/FBXExporter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index dd34e135f..347025a79 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -68,6 +68,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include //wangyi + // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure @@ -1824,7 +1826,10 @@ void FBXExporter::WriteObjects () // this should be the same as the bone's mOffsetMatrix. // if it's not the same, the skeleton isn't in the bind pose. - const float epsilon = 1e-4f; // some error is to be expected + float epsilon = 1e-4f; // some error is to be expected +#ifdef ASSIMP_CUSTOM_BINDPOSE_ERR + epsilon = ASSIMP_CUSTOM_BINDPOSE_ERR; +#endif bool bone_xform_okay = true; if (b && ! tr.Equal(b->mOffsetMatrix, epsilon)) { not_in_bind_pose.insert(b); From f03f099fa88b078b6197e5bcbdf8defdc136a107 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:29:50 -0700 Subject: [PATCH 09/43] clean up --- code/FBX/FBXExporter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 347025a79..ea1efb777 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -68,8 +68,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include //wangyi - // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure From eb5e829436a0497e84325609040d65aabfe30be6 Mon Sep 17 00:00:00 2001 From: kkulling Date: Thu, 11 Jul 2019 17:43:03 +0200 Subject: [PATCH 10/43] Assjson: add json export to list of exporters. --- code/Assjson/json_exporter.cpp | 8 +++++++- code/Common/Exporter.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/code/Assjson/json_exporter.cpp b/code/Assjson/json_exporter.cpp index 2696e779d..848a08b4d 100644 --- a/code/Assjson/json_exporter.cpp +++ b/code/Assjson/json_exporter.cpp @@ -6,6 +6,9 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information */ +#ifndef ASSIMP_BUILD_NO_EXPORT +#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER + #include #include #include @@ -821,7 +824,7 @@ void Write(JSONWriter& out, const aiScene& ai) } -void Assimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, const Assimp::ExportProperties*) +void ExportAssimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, const Assimp::ExportProperties*) { std::unique_ptr str(io->Open(file,"wt")); if(!str) { @@ -851,3 +854,6 @@ void Assimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, c } } // + +#endif // ASSIMP_BUILD_NO_ASSJSON_EXPORTER +#endif // ASSIMP_BUILD_NO_EXPORT diff --git a/code/Common/Exporter.cpp b/code/Common/Exporter.cpp index b1caa4f96..58cad3be8 100644 --- a/code/Common/Exporter.cpp +++ b/code/Common/Exporter.cpp @@ -102,6 +102,7 @@ void ExportSceneX3D(const char*, IOSystem*, const aiScene*, const ExportProperti void ExportSceneFBX(const char*, IOSystem*, const aiScene*, const ExportProperties*); void ExportSceneFBXA(const char*, IOSystem*, const aiScene*, const ExportProperties*); void ExportScene3MF( const char*, IOSystem*, const aiScene*, const ExportProperties* ); +void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::ExportProperties*); // ------------------------------------------------------------------------------------------------ // global array of all export formats which Assimp supports in its current build @@ -179,7 +180,11 @@ Exporter::ExportFormatEntry gExporters[] = #endif #ifndef ASSIMP_BUILD_NO_3MF_EXPORTER - Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 ) + Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 ), +#endif + +#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER + Exporter::ExportFormatEntry("json", "Plain JSON representation of the Assimp scene data structure", "json", &ExportAssimp2Json, 0) #endif }; From da33262bcc02e3870df8da5a84c2b9d03aaed11a Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 11 Jul 2019 19:17:41 +0200 Subject: [PATCH 11/43] Update FBXConverter.cpp Fix merge conflicts --- code/FBX/FBXConverter.cpp | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/code/FBX/FBXConverter.cpp b/code/FBX/FBXConverter.cpp index fc9c8b299..a4c1015bf 100644 --- a/code/FBX/FBXConverter.cpp +++ b/code/FBX/FBXConverter.cpp @@ -420,11 +420,6 @@ namespace Assimp { out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight(); - //cameras are defined along positive x direction - /*out_camera->mPosition = cam.Position(); - out_camera->mLookAt = (cam.InterestPosition() - out_camera->mPosition).Normalize(); - out_camera->mUp = cam.UpVector();*/ - out_camera->mPosition = aiVector3D(0.0f); out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f); out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f); @@ -667,8 +662,7 @@ namespace Assimp { if ((v - all_ones).SquareLength() > zero_epsilon) { return true; } - } - else if (ok) { + } else if (ok) { if (v.SquareLength() > zero_epsilon) { return true; } @@ -1396,10 +1390,6 @@ namespace Assimp { } std::vector animMeshes; -<<<<<<< HEAD:code/FBXConverter.cpp - size_t bsIdx(0), bsChannelIdx(0); -======= ->>>>>>> master:code/FBX/FBXConverter.cpp for (const BlendShape* blendShape : mesh.GetBlendShapes()) { for (const BlendShapeChannel* blendShapeChannel : blendShape->BlendShapeChannels()) { const std::vector& shapeGeometries = blendShapeChannel->GetShapeGeometries(); @@ -1417,12 +1407,7 @@ namespace Assimp { unsigned int count = 0; const unsigned int* outIndices = mesh.ToOutputVertexIndex(index, count); for (unsigned int k = 0; k < count; k++) { -<<<<<<< HEAD:code/FBXConverter.cpp - unsigned int index = outIndices[k]; -======= unsigned int index = translateIndexMap[outIndices[k]]; - ->>>>>>> master:code/FBX/FBXConverter.cpp animMesh->mVertices[index] += vertex; if (animMesh->mNormals != nullptr) { animMesh->mNormals[index] += normal; @@ -1433,20 +1418,6 @@ namespace Assimp { animMesh->mWeight = shapeGeometries.size() > 1 ? blendShapeChannel->DeformPercent() / 100.0f : 1.0f; animMeshes.push_back(animMesh); } -<<<<<<< HEAD:code/FBXConverter.cpp - bsChannelIdx++; - } - bsIdx++; - } - - const size_t numAnimMeshes = animMeshes.size(); - if (numAnimMeshes > 0) { - out_mesh->mNumAnimMeshes = static_cast(numAnimMeshes); - out_mesh->mAnimMeshes = new aiAnimMesh * [numAnimMeshes]; - for (size_t i = 0; i < numAnimMeshes; i++) { - out_mesh->mAnimMeshes[i] = animMeshes.at(i); -======= ->>>>>>> master:code/FBX/FBXConverter.cpp } } @@ -1755,9 +1726,8 @@ namespace Assimp { } void FBXConverter::TrySetTextureProperties(aiMaterial* out_mat, const TextureMap& textures, - const std::string& propName, - aiTextureType target, const MeshGeometry* const mesh) - { + const std::string& propName, + aiTextureType target, const MeshGeometry* const mesh) { TextureMap::const_iterator it = textures.find(propName); if (it == textures.end()) { return; From 82e7775d6db02368bbc469b014ef2d9b2e1600f4 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 11 Jul 2019 19:23:00 +0200 Subject: [PATCH 12/43] Update JTImporter.cpp disable unused method,. --- code/JTImporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/JTImporter.cpp b/code/JTImporter.cpp index 0348770bc..12b17e141 100644 --- a/code/JTImporter.cpp +++ b/code/JTImporter.cpp @@ -131,7 +131,7 @@ TokenEntry* JTImporter::FindTokenEntryByGuid(GUID& guid) { return it->second; } - +/* static bool SupportsZlibCompression(SegmentType type) { switch (type) { case LogicalSceneGraph: @@ -162,7 +162,7 @@ static bool SupportsZlibCompression(SegmentType type) { } return false; -} +}*/ void JTImporter::ReadDataSegment(BinReader& reader) { mCurrentDataSegment = new DataSegment; From 8bf1b9ac5ecde9d60c6821cee3604a41f616a9eb Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 11 Jul 2019 22:29:30 +0200 Subject: [PATCH 13/43] Update CMakeLists.txt remove jtimporter --- code/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index bdb589bc0..a8a514f73 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -297,11 +297,6 @@ ADD_ASSIMP_IMPORTER( AMF AMF/AMFImporter_Postprocess.cpp ) -ADD_ASSIMP_IMPORTER( JT - JTImporter.h - JTImporter.cpp -) - ADD_ASSIMP_IMPORTER( 3DS 3DS/3DSConverter.cpp 3DS/3DSHelper.h From b1d8398243ef94ea050becc17a9d49f63381c4c8 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 11 Jul 2019 22:31:24 +0200 Subject: [PATCH 14/43] Delete JTImporter.cpp Remove JTImorter.cpp from pull request --- code/JTImporter.cpp | 247 -------------------------------------------- 1 file changed, 247 deletions(-) delete mode 100644 code/JTImporter.cpp diff --git a/code/JTImporter.cpp b/code/JTImporter.cpp deleted file mode 100644 index 12b17e141..000000000 --- a/code/JTImporter.cpp +++ /dev/null @@ -1,247 +0,0 @@ -#include "JTImporter.h" - -#include -#include -#include -#include -#include - -#ifndef ASSIMP_BUILD_NO_JT_IMPORTER - -namespace Assimp { - -namespace { - - static const aiImporterDesc desc = { - "Siemens JF File format importer", - "", - "", - "", - aiImporterFlags_SupportTextFlavour, - 0, - 0, - 0, - 0, - "jt" - }; -} - -enum SegmentType { - LogicalSceneGraph = 1, - JT_B_Rep, - PMI_Data, - MetaData, - Shape, - Shape_LOD0, - Shape_LOD1, - Shape_LOD2, - Shape_LOD3, - Shape_LOD4, - Shape_LOD5, - Shape_LOD6, - Shape_LOD7, - Shape_LOD8, - Shape_LOD9, - XT_B_Rep, - Wireframe_Rep, - ULP, - LWPA -}; - -JTImporter::JTImporter() -: BaseImporter() -, mJTModel() -, mDataSegments() -, mCurrentDataSegment( nullptr ){ - // empty -} - -JTImporter::~JTImporter() { - // empty -} - -bool JTImporter::CanRead(const std::string &file, IOSystem* pIOHandler, bool checkSig) const { - const std::string& extension = GetExtension(file); - if (extension == std::string(desc.mFileExtensions)) { - return true; - } - - return false; -} - -const aiImporterDesc* JTImporter::GetInfo() const { - return &desc; -} - -void JTImporter::InternReadFile(const std::string &file, aiScene* pScene, IOSystem* pIOHandler) { - - std::unique_ptr stream(pIOHandler->Open(file, "rb")); - if (!stream) { - throw DeadlyImportError("JT: Cannot open file " + file ); - } - - std::vector contents; - contents.resize(stream->FileSize() + 1); - stream->Read(&*contents.begin(), 1, contents.size() - 1); - contents[contents.size() - 1] = 0; - BinReader reader(contents); - ReadHeader(reader); -} - -void JTImporter::ReadHeader(BinReader& reader) { - reader.readChars(VersionLen, mJTModel.mJTHeader.mVersion); - reader.readUChar(mJTModel.mJTHeader.mByteOrder); - reader.readI32(mJTModel.mJTHeader.mReserved); - - int toc_offset; - reader.readI32(toc_offset); -} - -void JTImporter::ReadTokenSegment(BinReader& reader) { - int toc_count; - reader.readI32(toc_count); - if (0 == toc_count) { - return; - } - - for (int i = 0; i < toc_count; ++i) { - ReadTokenEntry(reader); - } -} - -void JTImporter::ReadTokenEntry(BinReader& reader) { - TokenEntry* entry = new TokenEntry; - reader.readGUID(entry->guid); - reader.readI32(entry->offset); - reader.readI32(entry->length); - reader.readU32(entry->attributes); - - mJTModel.mTokenEntryMap[entry->guid] = entry; -} - -TokenEntry* JTImporter::FindTokenEntryByGuid(GUID& guid) { - if (mJTModel.mTokenEntryMap.empty()) { - return nullptr; - } - - JTModel::TokenEntryMap::const_iterator it(mJTModel.mTokenEntryMap.find(guid)); - if (it == mJTModel.mTokenEntryMap.end()) { - return nullptr; - } - - return it->second; -} -/* -static bool SupportsZlibCompression(SegmentType type) { - switch (type) { - case LogicalSceneGraph: - case JT_B_Rep: - case PMI_Data: - case MetaData: - return true; - case Shape: - case Shape_LOD0: - case Shape_LOD1: - case Shape_LOD2: - case Shape_LOD3: - case Shape_LOD4: - case Shape_LOD5: - case Shape_LOD6: - case Shape_LOD7: - case Shape_LOD8: - case Shape_LOD9: - return false; - case XT_B_Rep: - case Wireframe_Rep: - case ULP: - case LWPA: - return true; - default: - ai_assert_entry(); - break; - } - - return false; -}*/ - -void JTImporter::ReadDataSegment(BinReader& reader) { - mCurrentDataSegment = new DataSegment; - mDataSegments.push_back(mCurrentDataSegment); - ReadDataSegmentHeader(reader); - -} - -void JTImporter::ReadDataSegmentHeader(BinReader& reader) { - if (nullptr == mCurrentDataSegment) { - return; - } - - reader.readGUID(mCurrentDataSegment->m_DataSegmentHeader.guid); - reader.readI32(mCurrentDataSegment->m_DataSegmentHeader.type); - reader.readI32(mCurrentDataSegment->m_DataSegmentHeader.length); - -} - -void JTImporter::ReadLogicalElementHeaderZLib(BinReader& reader) { - i32 compressionFlag; - reader.readI32(compressionFlag); - i32 compressedLen; - reader.readI32(compressedLen); - u8 compressionAlgo; - reader.readUChar(compressionAlgo); -} - -void JTImporter::ReadSegmentType(BinReader& reader) { - SegmentType type = static_cast(mCurrentDataSegment->m_DataSegmentHeader.type); - switch (type) { - case LogicalSceneGraph: - ReadLSG(reader); - break; - case JT_B_Rep: - break; - case PMI_Data: - break; - case MetaData: - break; - case Shape: - break; - case Shape_LOD0: - break; - case Shape_LOD1: - break; - case Shape_LOD2: - break; - case Shape_LOD3: - break; - case Shape_LOD4: - break; - case Shape_LOD5: - break; - case Shape_LOD6: - break; - case Shape_LOD7: - break; - case Shape_LOD8: - break; - case Shape_LOD9: - break; - case XT_B_Rep: - break; - case Wireframe_Rep: - break; - case ULP: - break; - case LWPA: - break; - default: - break; - } -} - -void JTImporter::ReadLSG(BinReader& reader) { - ReadLogicalElementHeaderZLib(reader); -} - -} // end namespace Assimp - -#endif // ASSIMP_BUILD_NO_JT_IMPORTER From 3b3a965d2b1b4aa404d8fb5956a919ee9b85e851 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 11 Jul 2019 22:31:40 +0200 Subject: [PATCH 15/43] Delete JTImporter.h --- code/JTImporter.h | 210 ---------------------------------------------- 1 file changed, 210 deletions(-) delete mode 100644 code/JTImporter.h diff --git a/code/JTImporter.h b/code/JTImporter.h deleted file mode 100644 index 9466900bb..000000000 --- a/code/JTImporter.h +++ /dev/null @@ -1,210 +0,0 @@ -#pragma once -#ifndef AI_JTIMPORTER_H_INC -#define AI_JTIMPORTER_H_INC - -#include - -#include -#include - -#ifndef ASSIMP_BUILD_NO_JT_IMPORTER - -namespace Assimp { - -using i32 = int; -using u32 = unsigned int; -using i16 = short; -using u16 = unsigned short; -using c8 = char; -using u8 = unsigned char; -using f32 = float; -using f64 = double; - -static const size_t VersionLen = 80u; - -struct JTHeader { - char mVersion[VersionLen]; - unsigned char mByteOrder; - int mReserved; - int toc_offset; -}; - -template -struct TJTCoord { - T x, y, z; -}; - -using F32Coord = TJTCoord; -using F64Coord = TJTCoord; - -struct BBox32 { - F32Coord min; - F32Coord max; -}; - -template -struct THJTCoord { - T x, y, z, w; -}; - -using F32HCoord = THJTCoord; -using F64HCoord = THJTCoord; - -struct MbString { - int count; - char *data; -}; - -struct String { - int count; - char* data; -}; - -template -struct TVec { - int count; - T *data; -}; - -using VecF32 = TVec; -using VecF64 = TVec; -using VecI32 = TVec; - -struct RGB { - f32 data[3]; -}; - -struct RGBA { - f32 data[4]; - }; - -struct GUID { - unsigned int id1; - u16 id2[2]; - u8 id3[8]; -}; - -struct GUIDComparer { - bool operator() (const GUID& lhs, const GUID& rhs) const { - if (lhs.id1 < rhs.id1) { - return true; - } - - for (size_t i = 0; i < 2; ++i) { - if (lhs.id2[i] < rhs.id2[i]) { - return true; - } - } - - for (size_t i = 0; i < 8; ++i) { - if (lhs.id3[i] < rhs.id3[i]) { - return true; - } - } - - return false; - } -}; - -struct TokenEntry { - GUID guid; - i32 offset; - i32 length; - u32 attributes; -}; - -struct DataSegmentHeader { - GUID guid; - i32 type; - i32 length; -}; - -struct DataSegment { - DataSegmentHeader m_DataSegmentHeader; -}; - -struct ElementHeader { - GUID obj_type_id; - u8 obj_base_type; - i32 obj_id; -}; - -struct JTModel { - JTHeader mJTHeader; - GUID mGUID; - using TokenEntryMap = std::map; - TokenEntryMap mTokenEntryMap; -}; - -class BinReader { - std::vector& mData; - size_t mOffset; - -public: - BinReader(std::vector& data) - : mData(data) - , mOffset(0u){ - // empty - } - - void readChars(size_t numChars, char* buffer) { - ::memcpy(buffer, &mData[mOffset], numChars); - mOffset += numChars; - } - - void readUChar(unsigned char &c) { - ::memcpy(&c, &mData[mOffset], sizeof(unsigned char)); - mOffset += sizeof(unsigned char); - } - - void readI32(int32_t& v) { - ::memcpy(&v, &mData[mOffset], sizeof(int32_t)); - mOffset += sizeof(int32_t); - } - - void readU32(uint32_t& v) { - ::memcpy(&v, &mData[mOffset], sizeof(uint32_t)); - mOffset += sizeof(uint32_t); - } - - void readGUID(GUID &guid) { - ::memcpy(&guid.id1, &mData[mOffset], sizeof(i32)); - mOffset += sizeof(i32); - ::memcpy(guid.id2, &mData[mOffset], sizeof(u16) * 2); - mOffset += sizeof(u16)*2; - ::memcpy(guid.id3, &mData[mOffset], sizeof(u8) * 8); - mOffset += sizeof(u8) * 8; - } -}; - -class JTImporter : public BaseImporter { -public: - JTImporter(); - ~JTImporter(); - bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const override; - const aiImporterDesc* GetInfo() const override; - -protected: - void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler ) override; - void ReadHeader(BinReader &reader); - void ReadTokenSegment(BinReader& reader); - void ReadTokenEntry(BinReader& reader); - TokenEntry* FindTokenEntryByGuid(GUID& id); - void ReadDataSegment(BinReader& reader); - void ReadDataSegmentHeader(BinReader& reader); - void ReadLogicalElementHeaderZLib(BinReader& reader); - void ReadSegmentType(BinReader& reader); - void ReadLSG(BinReader& reader); - -private: - JTModel mJTModel; - std::vector mDataSegments; - DataSegment *mCurrentDataSegment; - -}; - -} // end namespace Assimp - -#endif // ASSIMP_BUILD_NO_JT_IMPORTER - -#endif // AI_JTIMPORTER_H_INC From 259a9bd2af6e7a0ed1d651b2bc0dfdec8d066003 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Thu, 11 Jul 2019 17:00:47 -0700 Subject: [PATCH 16/43] use ExportProperties to customize bind pose epsilon --- code/FBX/FBXExporter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index ea1efb777..c51e15252 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -67,6 +67,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ @@ -1825,9 +1826,9 @@ void FBXExporter::WriteObjects () // this should be the same as the bone's mOffsetMatrix. // if it's not the same, the skeleton isn't in the bind pose. float epsilon = 1e-4f; // some error is to be expected -#ifdef ASSIMP_CUSTOM_BINDPOSE_ERR - epsilon = ASSIMP_CUSTOM_BINDPOSE_ERR; -#endif + float epsilon_custom = mProperties->GetPropertyFloat("BINDPOSE_EPSILON", -1); + if(epsilon_custom > 0) + epsilon = epsilon_custom; bool bone_xform_okay = true; if (b && ! tr.Equal(b->mOffsetMatrix, epsilon)) { not_in_bind_pose.insert(b); From 53c0f913059160b270d5f6ce6ba1956acf366c30 Mon Sep 17 00:00:00 2001 From: kimkulling Date: Fri, 12 Jul 2019 16:08:51 +0200 Subject: [PATCH 17/43] Add unittest for json. --- code/Assjson/json_exporter.cpp | 1501 ++++++++--------- code/Assjson/mesh_splitter.cpp | 19 +- code/COB/COBLoader.cpp | 11 +- code/Common/ImporterRegistry.cpp | 7 - code/FBX/FBXDocument.h | 2 +- include/assimp/camera.h | 4 +- test/CMakeLists.txt | 12 +- test/models/PLY/cube_test.ply | 6 +- test/unit/AbstractImportExportBase.h | 24 +- .../ImportExport/utAssjsonImportExport.cpp | 69 + test/unit/utAMFImportExport.cpp | 2 - test/unit/utASEImportExport.cpp | 2 - test/unit/utAssbinImportExport.cpp | 8 +- test/unit/utB3DImportExport.cpp | 2 - test/unit/utFindDegenerates.cpp | 71 +- test/unit/utFindInvalidData.cpp | 117 +- test/unit/utGenBoundingBoxesProcess.cpp | 10 +- test/unit/utJoinVertices.cpp | 64 +- test/unit/utLimitBoneWeights.cpp | 74 +- test/unit/utPretransformVertices.cpp | 73 +- test/unit/utScenePreprocessor.cpp | 67 +- test/unit/utSortByPType.cpp | 108 +- 22 files changed, 1137 insertions(+), 1116 deletions(-) create mode 100644 test/unit/ImportExport/utAssjsonImportExport.cpp diff --git a/code/Assjson/json_exporter.cpp b/code/Assjson/json_exporter.cpp index 848a08b4d..cd542b29e 100644 --- a/code/Assjson/json_exporter.cpp +++ b/code/Assjson/json_exporter.cpp @@ -13,7 +13,6 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information #include #include #include - #include #include @@ -28,832 +27,792 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information #include "mesh_splitter.h" - extern "C" { -#include "cencode.h" + #include "cencode.h" } +namespace Assimp { -namespace { -void Assimp2Json(const char*, Assimp::IOSystem*, const aiScene*, const Assimp::ExportProperties*); -} +void ExportAssimp2Json(const char*, Assimp::IOSystem*, const aiScene*, const Assimp::ExportProperties*); -Assimp::Exporter::ExportFormatEntry Assimp2Json_desc = Assimp::Exporter::ExportFormatEntry( - "assimp.json", - "Plain JSON representation of the Assimp scene data structure", - "assimp.json", - Assimp2Json, - 0u); - -namespace { +Exporter::ExportFormatEntry Assimp2Json_desc = Assimp::Exporter::ExportFormatEntry( + "json", + "Plain JSON representation of the Assimp scene data structure", + "json", + &ExportAssimp2Json, + 0u +); - // small utility class to simplify serializing the aiScene to Json -class JSONWriter -{ - +// small utility class to simplify serializing the aiScene to Json +class JSONWriter { public: + enum { + Flag_DoNotIndent = 0x1, + Flag_WriteSpecialFloats = 0x2, + }; - enum { - Flag_DoNotIndent = 0x1, - Flag_WriteSpecialFloats = 0x2, - }; + JSONWriter(Assimp::IOStream& out, unsigned int flags = 0u) + : out(out) + , first() + , flags(flags) { + // make sure that all formatting happens using the standard, C locale and not the user's current locale + buff.imbue(std::locale("C")); + } -public: + ~JSONWriter() { + Flush(); + } - JSONWriter(Assimp::IOStream& out, unsigned int flags = 0u) - : out(out) - , first() - , flags(flags) - { - // make sure that all formatting happens using the standard, C locale and not the user's current locale - buff.imbue( std::locale("C") ); - } + void Flush() { + const std::string s = buff.str(); + out.Write(s.c_str(), s.length(), 1); + buff.clear(); + } - ~JSONWriter() - { - Flush(); - } + void PushIndent() { + indent += '\t'; + } -public: + void PopIndent() { + indent.erase(indent.end() - 1); + } - void Flush() { - const std::string s = buff.str(); - out.Write(s.c_str(),s.length(),1); - buff.clear(); - } + void Key(const std::string& name) { + AddIndentation(); + Delimit(); + buff << '\"' + name + "\": "; + } - void PushIndent() { - indent += '\t'; - } + template + void Element(const Literal& name) { + AddIndentation(); + Delimit(); - void PopIndent() { - indent.erase(indent.end()-1); - } + LiteralToString(buff, name) << '\n'; + } - void Key(const std::string& name) { - AddIndentation(); - Delimit(); - buff << '\"'+name+"\": "; - } + template + void SimpleValue(const Literal& s) { + LiteralToString(buff, s) << '\n'; + } - template - void Element(const Literal& name) { - AddIndentation(); - Delimit(); + void SimpleValue(const void* buffer, size_t len) { + base64_encodestate s; + base64_init_encodestate(&s); - LiteralToString(buff, name) << '\n'; - } + char* const out = new char[std::max(len * 2, static_cast(16u))]; + const int n = base64_encode_block(reinterpret_cast(buffer), static_cast(len), out, &s); + out[n + base64_encode_blockend(out + n, &s)] = '\0'; - template - void SimpleValue(const Literal& s) { - LiteralToString(buff, s) << '\n'; - } + // base64 encoding may add newlines, but JSON strings may not contain 'real' newlines + // (only escaped ones). Remove any newlines in out. + for (char* cur = out; *cur; ++cur) { + if (*cur == '\n') { + *cur = ' '; + } + } + buff << '\"' << out << "\"\n"; + delete[] out; + } - void SimpleValue(const void* buffer, size_t len) { - base64_encodestate s; - base64_init_encodestate(&s); + void StartObj(bool is_element = false) { + // if this appears as a plain array element, we need to insert a delimiter and we should also indent it + if (is_element) { + AddIndentation(); + if (!first) { + buff << ','; + } + } + first = true; + buff << "{\n"; + PushIndent(); + } - char* const out = new char[std::max(len*2, static_cast(16u))]; - const int n = base64_encode_block(reinterpret_cast( buffer ), static_cast( len ),out,&s); - out[n+base64_encode_blockend(out + n,&s)] = '\0'; + void EndObj() { + PopIndent(); + AddIndentation(); + first = false; + buff << "}\n"; + } - // base64 encoding may add newlines, but JSON strings may not contain 'real' newlines - // (only escaped ones). Remove any newlines in out. - for(char* cur = out; *cur; ++cur) { - if(*cur == '\n') { - *cur = ' '; - } - } + void StartArray(bool is_element = false) { + // if this appears as a plain array element, we need to insert a delimiter and we should also indent it + if (is_element) { + AddIndentation(); + if (!first) { + buff << ','; + } + } + first = true; + buff << "[\n"; + PushIndent(); + } + void EndArray() { + PopIndent(); + AddIndentation(); + buff << "]\n"; + first = false; + } - buff << '\"' << out << "\"\n"; - delete[] out; - } + void AddIndentation() { + if (!(flags & Flag_DoNotIndent)) { + buff << indent; + } + } - void StartObj(bool is_element = false) { - // if this appears as a plain array element, we need to insert a delimiter and we should also indent it - if(is_element) { - AddIndentation(); - if(!first) { - buff << ','; - } - } - first = true; - buff << "{\n"; - PushIndent(); - } - - void EndObj() { - PopIndent(); - AddIndentation(); - first = false; - buff << "}\n"; - } - - void StartArray(bool is_element = false) { - // if this appears as a plain array element, we need to insert a delimiter and we should also indent it - if(is_element) { - AddIndentation(); - if(!first) { - buff << ','; - } - } - first = true; - buff << "[\n"; - PushIndent(); - } - - void EndArray() { - PopIndent(); - AddIndentation(); - buff << "]\n"; - first = false; - } - - void AddIndentation() { - if(!(flags & Flag_DoNotIndent)) { - buff << indent; - } - } - - void Delimit() { - if(!first) { - buff << ','; - } - else { - buff << ' '; - first = false; - } - } + void Delimit() { + if (!first) { + buff << ','; + } + else { + buff << ' '; + first = false; + } + } private: + template + std::stringstream& LiteralToString(std::stringstream& stream, const Literal& s) { + stream << s; + return stream; + } - template - std::stringstream& LiteralToString(std::stringstream& stream, const Literal& s) { - stream << s; - return stream; - } + std::stringstream& LiteralToString(std::stringstream& stream, const aiString& s) { + std::string t; - std::stringstream& LiteralToString(std::stringstream& stream, const aiString& s) { - std::string t; + // escape backslashes and single quotes, both would render the JSON invalid if left as is + t.reserve(s.length); + for (size_t i = 0; i < s.length; ++i) { - // escape backslashes and single quotes, both would render the JSON invalid if left as is - t.reserve(s.length); - for(size_t i = 0; i < s.length; ++i) { - - if (s.data[i] == '\\' || s.data[i] == '\'' || s.data[i] == '\"') { - t.push_back('\\'); - } + if (s.data[i] == '\\' || s.data[i] == '\'' || s.data[i] == '\"') { + t.push_back('\\'); + } - t.push_back(s.data[i]); - } - stream << "\""; - stream << t; - stream << "\""; - return stream; - } + t.push_back(s.data[i]); + } + stream << "\""; + stream << t; + stream << "\""; + return stream; + } - std::stringstream& LiteralToString(std::stringstream& stream, float f) { - if (!std::numeric_limits::is_iec559) { - // on a non IEEE-754 platform, we make no assumptions about the representation or existence - // of special floating-point numbers. - stream << f; - return stream; - } + std::stringstream& LiteralToString(std::stringstream& stream, float f) { + if (!std::numeric_limits::is_iec559) { + // on a non IEEE-754 platform, we make no assumptions about the representation or existence + // of special floating-point numbers. + stream << f; + return stream; + } - // JSON does not support writing Inf/Nan - // [RFC 4672: "Numeric values that cannot be represented as sequences of digits - // (such as Infinity and NaN) are not permitted."] - // Nevertheless, many parsers will accept the special keywords Infinity, -Infinity and NaN - if (std::numeric_limits::infinity() == fabs(f)) { - if (flags & Flag_WriteSpecialFloats) { - stream << (f < 0 ? "\"-" : "\"") + std::string( "Infinity\"" ); - return stream; - } - // we should print this warning, but we can't - this is called from within a generic assimp exporter, we cannot use cerr - // std::cerr << "warning: cannot represent infinite number literal, substituting 0 instead (use -i flag to enforce Infinity/NaN)" << std::endl; - stream << "0.0"; - return stream; - } - // f!=f is the most reliable test for NaNs that I know of - else if (f != f) { - if (flags & Flag_WriteSpecialFloats) { - stream << "\"NaN\""; - return stream; - } - // we should print this warning, but we can't - this is called from within a generic assimp exporter, we cannot use cerr - // std::cerr << "warning: cannot represent infinite number literal, substituting 0 instead (use -i flag to enforce Infinity/NaN)" << std::endl; - stream << "0.0"; - return stream; - } + // JSON does not support writing Inf/Nan + // [RFC 4672: "Numeric values that cannot be represented as sequences of digits + // (such as Infinity and NaN) are not permitted."] + // Nevertheless, many parsers will accept the special keywords Infinity, -Infinity and NaN + if (std::numeric_limits::infinity() == fabs(f)) { + if (flags & Flag_WriteSpecialFloats) { + stream << (f < 0 ? "\"-" : "\"") + std::string("Infinity\""); + return stream; + } + // we should print this warning, but we can't - this is called from within a generic assimp exporter, we cannot use cerr + // std::cerr << "warning: cannot represent infinite number literal, substituting 0 instead (use -i flag to enforce Infinity/NaN)" << std::endl; + stream << "0.0"; + return stream; + } + // f!=f is the most reliable test for NaNs that I know of + else if (f != f) { + if (flags & Flag_WriteSpecialFloats) { + stream << "\"NaN\""; + return stream; + } + // we should print this warning, but we can't - this is called from within a generic assimp exporter, we cannot use cerr + // std::cerr << "warning: cannot represent infinite number literal, substituting 0 instead (use -i flag to enforce Infinity/NaN)" << std::endl; + stream << "0.0"; + return stream; + } - stream << f; - return stream; - } + stream << f; + return stream; + } -private: - Assimp::IOStream& out; - std::string indent, newline; - std::stringstream buff; - bool first; +private: + Assimp::IOStream& out; + std::string indent, newline; + std::stringstream buff; + bool first; - unsigned int flags; + unsigned int flags; }; - -void Write(JSONWriter& out, const aiVector3D& ai, bool is_elem = true) -{ - out.StartArray(is_elem); - out.Element(ai.x); - out.Element(ai.y); - out.Element(ai.z); - out.EndArray(); +void Write(JSONWriter& out, const aiVector3D& ai, bool is_elem = true) { + out.StartArray(is_elem); + out.Element(ai.x); + out.Element(ai.y); + out.Element(ai.z); + out.EndArray(); } -void Write(JSONWriter& out, const aiQuaternion& ai, bool is_elem = true) -{ - out.StartArray(is_elem); - out.Element(ai.w); - out.Element(ai.x); - out.Element(ai.y); - out.Element(ai.z); - out.EndArray(); +void Write(JSONWriter& out, const aiQuaternion& ai, bool is_elem = true) { + out.StartArray(is_elem); + out.Element(ai.w); + out.Element(ai.x); + out.Element(ai.y); + out.Element(ai.z); + out.EndArray(); } -void Write(JSONWriter& out, const aiColor3D& ai, bool is_elem = true) -{ - out.StartArray(is_elem); - out.Element(ai.r); - out.Element(ai.g); - out.Element(ai.b); - out.EndArray(); +void Write(JSONWriter& out, const aiColor3D& ai, bool is_elem = true) { + out.StartArray(is_elem); + out.Element(ai.r); + out.Element(ai.g); + out.Element(ai.b); + out.EndArray(); } -void Write(JSONWriter& out, const aiMatrix4x4& ai, bool is_elem = true) -{ - out.StartArray(is_elem); - for(unsigned int x = 0; x < 4; ++x) { - for(unsigned int y = 0; y < 4; ++y) { - out.Element(ai[x][y]); - } - } - out.EndArray(); +void Write(JSONWriter& out, const aiMatrix4x4& ai, bool is_elem = true) { + out.StartArray(is_elem); + for (unsigned int x = 0; x < 4; ++x) { + for (unsigned int y = 0; y < 4; ++y) { + out.Element(ai[x][y]); + } + } + out.EndArray(); } -void Write(JSONWriter& out, const aiBone& ai, bool is_elem = true) -{ - out.StartObj(is_elem); +void Write(JSONWriter& out, const aiBone& ai, bool is_elem = true) { + out.StartObj(is_elem); - out.Key("name"); - out.SimpleValue(ai.mName); + out.Key("name"); + out.SimpleValue(ai.mName); - out.Key("offsetmatrix"); - Write(out,ai.mOffsetMatrix,false); + out.Key("offsetmatrix"); + Write(out, ai.mOffsetMatrix, false); - out.Key("weights"); - out.StartArray(); - for(unsigned int i = 0; i < ai.mNumWeights; ++i) { - out.StartArray(true); - out.Element(ai.mWeights[i].mVertexId); - out.Element(ai.mWeights[i].mWeight); - out.EndArray(); - } - out.EndArray(); - out.EndObj(); + out.Key("weights"); + out.StartArray(); + for (unsigned int i = 0; i < ai.mNumWeights; ++i) { + out.StartArray(true); + out.Element(ai.mWeights[i].mVertexId); + out.Element(ai.mWeights[i].mWeight); + out.EndArray(); + } + out.EndArray(); + out.EndObj(); +} + +void Write(JSONWriter& out, const aiFace& ai, bool is_elem = true) { + out.StartArray(is_elem); + for (unsigned int i = 0; i < ai.mNumIndices; ++i) { + out.Element(ai.mIndices[i]); + } + out.EndArray(); +} + +void Write(JSONWriter& out, const aiMesh& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("name"); + out.SimpleValue(ai.mName); + + out.Key("materialindex"); + out.SimpleValue(ai.mMaterialIndex); + + out.Key("primitivetypes"); + out.SimpleValue(ai.mPrimitiveTypes); + + out.Key("vertices"); + out.StartArray(); + for (unsigned int i = 0; i < ai.mNumVertices; ++i) { + out.Element(ai.mVertices[i].x); + out.Element(ai.mVertices[i].y); + out.Element(ai.mVertices[i].z); + } + out.EndArray(); + + if (ai.HasNormals()) { + out.Key("normals"); + out.StartArray(); + for (unsigned int i = 0; i < ai.mNumVertices; ++i) { + out.Element(ai.mNormals[i].x); + out.Element(ai.mNormals[i].y); + out.Element(ai.mNormals[i].z); + } + out.EndArray(); + } + + if (ai.HasTangentsAndBitangents()) { + out.Key("tangents"); + out.StartArray(); + for (unsigned int i = 0; i < ai.mNumVertices; ++i) { + out.Element(ai.mTangents[i].x); + out.Element(ai.mTangents[i].y); + out.Element(ai.mTangents[i].z); + } + out.EndArray(); + + out.Key("bitangents"); + out.StartArray(); + for (unsigned int i = 0; i < ai.mNumVertices; ++i) { + out.Element(ai.mBitangents[i].x); + out.Element(ai.mBitangents[i].y); + out.Element(ai.mBitangents[i].z); + } + out.EndArray(); + } + + if (ai.GetNumUVChannels()) { + out.Key("numuvcomponents"); + out.StartArray(); + for (unsigned int n = 0; n < ai.GetNumUVChannels(); ++n) { + out.Element(ai.mNumUVComponents[n]); + } + out.EndArray(); + + out.Key("texturecoords"); + out.StartArray(); + for (unsigned int n = 0; n < ai.GetNumUVChannels(); ++n) { + const unsigned int numc = ai.mNumUVComponents[n] ? ai.mNumUVComponents[n] : 2; + + out.StartArray(true); + for (unsigned int i = 0; i < ai.mNumVertices; ++i) { + for (unsigned int c = 0; c < numc; ++c) { + out.Element(ai.mTextureCoords[n][i][c]); + } + } + out.EndArray(); + } + out.EndArray(); + } + + if (ai.GetNumColorChannels()) { + out.Key("colors"); + out.StartArray(); + for (unsigned int n = 0; n < ai.GetNumColorChannels(); ++n) { + out.StartArray(true); + for (unsigned int i = 0; i < ai.mNumVertices; ++i) { + out.Element(ai.mColors[n][i].r); + out.Element(ai.mColors[n][i].g); + out.Element(ai.mColors[n][i].b); + out.Element(ai.mColors[n][i].a); + } + out.EndArray(); + } + out.EndArray(); + } + + if (ai.mNumBones) { + out.Key("bones"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumBones; ++n) { + Write(out, *ai.mBones[n]); + } + out.EndArray(); + } + + out.Key("faces"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumFaces; ++n) { + Write(out, ai.mFaces[n]); + } + out.EndArray(); + + out.EndObj(); +} + +void Write(JSONWriter& out, const aiNode& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("name"); + out.SimpleValue(ai.mName); + + out.Key("transformation"); + Write(out, ai.mTransformation, false); + + if (ai.mNumMeshes) { + out.Key("meshes"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumMeshes; ++n) { + out.Element(ai.mMeshes[n]); + } + out.EndArray(); + } + + if (ai.mNumChildren) { + out.Key("children"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumChildren; ++n) { + Write(out, *ai.mChildren[n]); + } + out.EndArray(); + } + + out.EndObj(); +} + +void Write(JSONWriter& out, const aiMaterial& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("properties"); + out.StartArray(); + for (unsigned int i = 0; i < ai.mNumProperties; ++i) { + const aiMaterialProperty* const prop = ai.mProperties[i]; + out.StartObj(true); + out.Key("key"); + out.SimpleValue(prop->mKey); + out.Key("semantic"); + out.SimpleValue(prop->mSemantic); + out.Key("index"); + out.SimpleValue(prop->mIndex); + + out.Key("type"); + out.SimpleValue(prop->mType); + + out.Key("value"); + switch (prop->mType) { + case aiPTI_Float: + if (prop->mDataLength / sizeof(float) > 1) { + out.StartArray(); + for (unsigned int i = 0; i < prop->mDataLength / sizeof(float); ++i) { + out.Element(reinterpret_cast(prop->mData)[i]); + } + out.EndArray(); + } + else { + out.SimpleValue(*reinterpret_cast(prop->mData)); + } + break; + + case aiPTI_Integer: + if (prop->mDataLength / sizeof(int) > 1) { + out.StartArray(); + for (unsigned int i = 0; i < prop->mDataLength / sizeof(int); ++i) { + out.Element(reinterpret_cast(prop->mData)[i]); + } + out.EndArray(); + } else { + out.SimpleValue(*reinterpret_cast(prop->mData)); + } + break; + + case aiPTI_String: + { + aiString s; + aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s); + out.SimpleValue(s); + } + break; + case aiPTI_Buffer: + { + // binary data is written as series of hex-encoded octets + out.SimpleValue(prop->mData, prop->mDataLength); + } + break; + default: + assert(false); + } + + out.EndObj(); + } + + out.EndArray(); + out.EndObj(); +} + +void Write(JSONWriter& out, const aiTexture& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("width"); + out.SimpleValue(ai.mWidth); + + out.Key("height"); + out.SimpleValue(ai.mHeight); + + out.Key("formathint"); + out.SimpleValue(aiString(ai.achFormatHint)); + + out.Key("data"); + if (!ai.mHeight) { + out.SimpleValue(ai.pcData, ai.mWidth); + } + else { + out.StartArray(); + for (unsigned int y = 0; y < ai.mHeight; ++y) { + out.StartArray(true); + for (unsigned int x = 0; x < ai.mWidth; ++x) { + const aiTexel& tx = ai.pcData[y*ai.mWidth + x]; + out.StartArray(true); + out.Element(static_cast(tx.r)); + out.Element(static_cast(tx.g)); + out.Element(static_cast(tx.b)); + out.Element(static_cast(tx.a)); + out.EndArray(); + } + out.EndArray(); + } + out.EndArray(); + } + + out.EndObj(); +} + +void Write(JSONWriter& out, const aiLight& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("name"); + out.SimpleValue(ai.mName); + + out.Key("type"); + out.SimpleValue(ai.mType); + + if (ai.mType == aiLightSource_SPOT || ai.mType == aiLightSource_UNDEFINED) { + out.Key("angleinnercone"); + out.SimpleValue(ai.mAngleInnerCone); + + out.Key("angleoutercone"); + out.SimpleValue(ai.mAngleOuterCone); + } + + out.Key("attenuationconstant"); + out.SimpleValue(ai.mAttenuationConstant); + + out.Key("attenuationlinear"); + out.SimpleValue(ai.mAttenuationLinear); + + out.Key("attenuationquadratic"); + out.SimpleValue(ai.mAttenuationQuadratic); + + out.Key("diffusecolor"); + Write(out, ai.mColorDiffuse, false); + + out.Key("specularcolor"); + Write(out, ai.mColorSpecular, false); + + out.Key("ambientcolor"); + Write(out, ai.mColorAmbient, false); + + if (ai.mType != aiLightSource_POINT) { + out.Key("direction"); + Write(out, ai.mDirection, false); + + } + + if (ai.mType != aiLightSource_DIRECTIONAL) { + out.Key("position"); + Write(out, ai.mPosition, false); + } + + out.EndObj(); +} + +void Write(JSONWriter& out, const aiNodeAnim& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("name"); + out.SimpleValue(ai.mNodeName); + + out.Key("prestate"); + out.SimpleValue(ai.mPreState); + + out.Key("poststate"); + out.SimpleValue(ai.mPostState); + + if (ai.mNumPositionKeys) { + out.Key("positionkeys"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumPositionKeys; ++n) { + const aiVectorKey& pos = ai.mPositionKeys[n]; + out.StartArray(true); + out.Element(pos.mTime); + Write(out, pos.mValue); + out.EndArray(); + } + out.EndArray(); + } + + if (ai.mNumRotationKeys) { + out.Key("rotationkeys"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumRotationKeys; ++n) { + const aiQuatKey& rot = ai.mRotationKeys[n]; + out.StartArray(true); + out.Element(rot.mTime); + Write(out, rot.mValue); + out.EndArray(); + } + out.EndArray(); + } + + if (ai.mNumScalingKeys) { + out.Key("scalingkeys"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumScalingKeys; ++n) { + const aiVectorKey& scl = ai.mScalingKeys[n]; + out.StartArray(true); + out.Element(scl.mTime); + Write(out, scl.mValue); + out.EndArray(); + } + out.EndArray(); + } + out.EndObj(); +} + +void Write(JSONWriter& out, const aiAnimation& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("name"); + out.SimpleValue(ai.mName); + + out.Key("tickspersecond"); + out.SimpleValue(ai.mTicksPerSecond); + + out.Key("duration"); + out.SimpleValue(ai.mDuration); + + out.Key("channels"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumChannels; ++n) { + Write(out, *ai.mChannels[n]); + } + out.EndArray(); + out.EndObj(); +} + +void Write(JSONWriter& out, const aiCamera& ai, bool is_elem = true) { + out.StartObj(is_elem); + + out.Key("name"); + out.SimpleValue(ai.mName); + + out.Key("aspect"); + out.SimpleValue(ai.mAspect); + + out.Key("clipplanefar"); + out.SimpleValue(ai.mClipPlaneFar); + + out.Key("clipplanenear"); + out.SimpleValue(ai.mClipPlaneNear); + + out.Key("horizontalfov"); + out.SimpleValue(ai.mHorizontalFOV); + + out.Key("up"); + Write(out, ai.mUp, false); + + out.Key("lookat"); + Write(out, ai.mLookAt, false); + + out.EndObj(); +} + +void WriteFormatInfo(JSONWriter& out) { + out.StartObj(); + out.Key("format"); + out.SimpleValue("\"assimp2json\""); + out.Key("version"); + out.SimpleValue(CURRENT_FORMAT_VERSION); + out.EndObj(); +} + +void Write(JSONWriter& out, const aiScene& ai) { + out.StartObj(); + + out.Key("__metadata__"); + WriteFormatInfo(out); + + out.Key("rootnode"); + Write(out, *ai.mRootNode, false); + + out.Key("flags"); + out.SimpleValue(ai.mFlags); + + if (ai.HasMeshes()) { + out.Key("meshes"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumMeshes; ++n) { + Write(out, *ai.mMeshes[n]); + } + out.EndArray(); + } + + if (ai.HasMaterials()) { + out.Key("materials"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumMaterials; ++n) { + Write(out, *ai.mMaterials[n]); + } + out.EndArray(); + } + + if (ai.HasAnimations()) { + out.Key("animations"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumAnimations; ++n) { + Write(out, *ai.mAnimations[n]); + } + out.EndArray(); + } + + if (ai.HasLights()) { + out.Key("lights"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumLights; ++n) { + Write(out, *ai.mLights[n]); + } + out.EndArray(); + } + + if (ai.HasCameras()) { + out.Key("cameras"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumCameras; ++n) { + Write(out, *ai.mCameras[n]); + } + out.EndArray(); + } + + if (ai.HasTextures()) { + out.Key("textures"); + out.StartArray(); + for (unsigned int n = 0; n < ai.mNumTextures; ++n) { + Write(out, *ai.mTextures[n]); + } + out.EndArray(); + } + out.EndObj(); } -void Write(JSONWriter& out, const aiFace& ai, bool is_elem = true) -{ - out.StartArray(is_elem); - for(unsigned int i = 0; i < ai.mNumIndices; ++i) { - out.Element(ai.mIndices[i]); - } - out.EndArray(); +void ExportAssimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, const Assimp::ExportProperties*) { + std::unique_ptr str(io->Open(file, "wt")); + if (!str) { + //throw Assimp::DeadlyExportError("could not open output file"); + } + + // get a copy of the scene so we can modify it + aiScene* scenecopy_tmp; + aiCopyScene(scene, &scenecopy_tmp); + + try { + // split meshes so they fit into a 16 bit index buffer + MeshSplitter splitter; + splitter.SetLimit(1 << 16); + splitter.Execute(scenecopy_tmp); + + // XXX Flag_WriteSpecialFloats is turned on by default, right now we don't have a configuration interface for exporters + JSONWriter s(*str, JSONWriter::Flag_WriteSpecialFloats); + Write(s, *scenecopy_tmp); + + } + catch (...) { + aiFreeScene(scenecopy_tmp); + throw; + } + aiFreeScene(scenecopy_tmp); } - -void Write(JSONWriter& out, const aiMesh& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("name"); - out.SimpleValue(ai.mName); - - out.Key("materialindex"); - out.SimpleValue(ai.mMaterialIndex); - - out.Key("primitivetypes"); - out.SimpleValue(ai.mPrimitiveTypes); - - out.Key("vertices"); - out.StartArray(); - for(unsigned int i = 0; i < ai.mNumVertices; ++i) { - out.Element(ai.mVertices[i].x); - out.Element(ai.mVertices[i].y); - out.Element(ai.mVertices[i].z); - } - out.EndArray(); - - if(ai.HasNormals()) { - out.Key("normals"); - out.StartArray(); - for(unsigned int i = 0; i < ai.mNumVertices; ++i) { - out.Element(ai.mNormals[i].x); - out.Element(ai.mNormals[i].y); - out.Element(ai.mNormals[i].z); - } - out.EndArray(); - } - - if(ai.HasTangentsAndBitangents()) { - out.Key("tangents"); - out.StartArray(); - for(unsigned int i = 0; i < ai.mNumVertices; ++i) { - out.Element(ai.mTangents[i].x); - out.Element(ai.mTangents[i].y); - out.Element(ai.mTangents[i].z); - } - out.EndArray(); - - out.Key("bitangents"); - out.StartArray(); - for(unsigned int i = 0; i < ai.mNumVertices; ++i) { - out.Element(ai.mBitangents[i].x); - out.Element(ai.mBitangents[i].y); - out.Element(ai.mBitangents[i].z); - } - out.EndArray(); - } - - if(ai.GetNumUVChannels()) { - out.Key("numuvcomponents"); - out.StartArray(); - for(unsigned int n = 0; n < ai.GetNumUVChannels(); ++n) { - out.Element(ai.mNumUVComponents[n]); - } - out.EndArray(); - - out.Key("texturecoords"); - out.StartArray(); - for(unsigned int n = 0; n < ai.GetNumUVChannels(); ++n) { - - const unsigned int numc = ai.mNumUVComponents[n] ? ai.mNumUVComponents[n] : 2; - - out.StartArray(true); - for(unsigned int i = 0; i < ai.mNumVertices; ++i) { - for(unsigned int c = 0; c < numc; ++c) { - out.Element(ai.mTextureCoords[n][i][c]); - } - } - out.EndArray(); - } - out.EndArray(); - } - - if(ai.GetNumColorChannels()) { - out.Key("colors"); - out.StartArray(); - for(unsigned int n = 0; n < ai.GetNumColorChannels(); ++n) { - - out.StartArray(true); - for(unsigned int i = 0; i < ai.mNumVertices; ++i) { - out.Element(ai.mColors[n][i].r); - out.Element(ai.mColors[n][i].g); - out.Element(ai.mColors[n][i].b); - out.Element(ai.mColors[n][i].a); - } - out.EndArray(); - } - out.EndArray(); - } - - if(ai.mNumBones) { - out.Key("bones"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumBones; ++n) { - Write(out, *ai.mBones[n]); - } - out.EndArray(); - } - - - out.Key("faces"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumFaces; ++n) { - Write(out, ai.mFaces[n]); - } - out.EndArray(); - - out.EndObj(); } - -void Write(JSONWriter& out, const aiNode& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("name"); - out.SimpleValue(ai.mName); - - out.Key("transformation"); - Write(out,ai.mTransformation,false); - - if(ai.mNumMeshes) { - out.Key("meshes"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumMeshes; ++n) { - out.Element(ai.mMeshes[n]); - } - out.EndArray(); - } - - if(ai.mNumChildren) { - out.Key("children"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumChildren; ++n) { - Write(out,*ai.mChildren[n]); - } - out.EndArray(); - } - - out.EndObj(); -} - -void Write(JSONWriter& out, const aiMaterial& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("properties"); - out.StartArray(); - for(unsigned int i = 0; i < ai.mNumProperties; ++i) { - const aiMaterialProperty* const prop = ai.mProperties[i]; - out.StartObj(true); - out.Key("key"); - out.SimpleValue(prop->mKey); - out.Key("semantic"); - out.SimpleValue(prop->mSemantic); - out.Key("index"); - out.SimpleValue(prop->mIndex); - - out.Key("type"); - out.SimpleValue(prop->mType); - - out.Key("value"); - switch(prop->mType) - { - case aiPTI_Float: - if(prop->mDataLength/sizeof(float) > 1) { - out.StartArray(); - for(unsigned int i = 0; i < prop->mDataLength/sizeof(float); ++i) { - out.Element(reinterpret_cast(prop->mData)[i]); - } - out.EndArray(); - } - else { - out.SimpleValue(*reinterpret_cast(prop->mData)); - } - break; - - case aiPTI_Integer: - if(prop->mDataLength/sizeof(int) > 1) { - out.StartArray(); - for(unsigned int i = 0; i < prop->mDataLength/sizeof(int); ++i) { - out.Element(reinterpret_cast(prop->mData)[i]); - } - out.EndArray(); - } - else { - out.SimpleValue(*reinterpret_cast(prop->mData)); - } - break; - case aiPTI_String: - { - aiString s; - aiGetMaterialString(&ai,prop->mKey.data,prop->mSemantic,prop->mIndex,&s); - out.SimpleValue(s); - } - break; - case aiPTI_Buffer: - { - // binary data is written as series of hex-encoded octets - out.SimpleValue(prop->mData,prop->mDataLength); - } - break; - default: - assert(false); - } - - out.EndObj(); - } - - out.EndArray(); - out.EndObj(); -} - -void Write(JSONWriter& out, const aiTexture& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("width"); - out.SimpleValue(ai.mWidth); - - out.Key("height"); - out.SimpleValue(ai.mHeight); - - out.Key("formathint"); - out.SimpleValue(aiString(ai.achFormatHint)); - - out.Key("data"); - if(!ai.mHeight) { - out.SimpleValue(ai.pcData,ai.mWidth); - } - else { - out.StartArray(); - for(unsigned int y = 0; y < ai.mHeight; ++y) { - out.StartArray(true); - for(unsigned int x = 0; x < ai.mWidth; ++x) { - const aiTexel& tx = ai.pcData[y*ai.mWidth+x]; - out.StartArray(true); - out.Element(static_cast(tx.r)); - out.Element(static_cast(tx.g)); - out.Element(static_cast(tx.b)); - out.Element(static_cast(tx.a)); - out.EndArray(); - } - out.EndArray(); - } - out.EndArray(); - } - - out.EndObj(); -} - -void Write(JSONWriter& out, const aiLight& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("name"); - out.SimpleValue(ai.mName); - - out.Key("type"); - out.SimpleValue(ai.mType); - - if(ai.mType == aiLightSource_SPOT || ai.mType == aiLightSource_UNDEFINED) { - out.Key("angleinnercone"); - out.SimpleValue(ai.mAngleInnerCone); - - out.Key("angleoutercone"); - out.SimpleValue(ai.mAngleOuterCone); - } - - out.Key("attenuationconstant"); - out.SimpleValue(ai.mAttenuationConstant); - - out.Key("attenuationlinear"); - out.SimpleValue(ai.mAttenuationLinear); - - out.Key("attenuationquadratic"); - out.SimpleValue(ai.mAttenuationQuadratic); - - out.Key("diffusecolor"); - Write(out,ai.mColorDiffuse,false); - - out.Key("specularcolor"); - Write(out,ai.mColorSpecular,false); - - out.Key("ambientcolor"); - Write(out,ai.mColorAmbient,false); - - if(ai.mType != aiLightSource_POINT) { - out.Key("direction"); - Write(out,ai.mDirection,false); - - } - - if(ai.mType != aiLightSource_DIRECTIONAL) { - out.Key("position"); - Write(out,ai.mPosition,false); - } - - out.EndObj(); -} - -void Write(JSONWriter& out, const aiNodeAnim& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("name"); - out.SimpleValue(ai.mNodeName); - - out.Key("prestate"); - out.SimpleValue(ai.mPreState); - - out.Key("poststate"); - out.SimpleValue(ai.mPostState); - - if(ai.mNumPositionKeys) { - out.Key("positionkeys"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumPositionKeys; ++n) { - const aiVectorKey& pos = ai.mPositionKeys[n]; - out.StartArray(true); - out.Element(pos.mTime); - Write(out,pos.mValue); - out.EndArray(); - } - out.EndArray(); - } - - if(ai.mNumRotationKeys) { - out.Key("rotationkeys"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumRotationKeys; ++n) { - const aiQuatKey& rot = ai.mRotationKeys[n]; - out.StartArray(true); - out.Element(rot.mTime); - Write(out,rot.mValue); - out.EndArray(); - } - out.EndArray(); - } - - if(ai.mNumScalingKeys) { - out.Key("scalingkeys"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumScalingKeys; ++n) { - const aiVectorKey& scl = ai.mScalingKeys[n]; - out.StartArray(true); - out.Element(scl.mTime); - Write(out,scl.mValue); - out.EndArray(); - } - out.EndArray(); - } - out.EndObj(); -} - -void Write(JSONWriter& out, const aiAnimation& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("name"); - out.SimpleValue(ai.mName); - - out.Key("tickspersecond"); - out.SimpleValue(ai.mTicksPerSecond); - - out.Key("duration"); - out.SimpleValue(ai.mDuration); - - out.Key("channels"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumChannels; ++n) { - Write(out,*ai.mChannels[n]); - } - out.EndArray(); - out.EndObj(); -} - -void Write(JSONWriter& out, const aiCamera& ai, bool is_elem = true) -{ - out.StartObj(is_elem); - - out.Key("name"); - out.SimpleValue(ai.mName); - - out.Key("aspect"); - out.SimpleValue(ai.mAspect); - - out.Key("clipplanefar"); - out.SimpleValue(ai.mClipPlaneFar); - - out.Key("clipplanenear"); - out.SimpleValue(ai.mClipPlaneNear); - - out.Key("horizontalfov"); - out.SimpleValue(ai.mHorizontalFOV); - - out.Key("up"); - Write(out,ai.mUp,false); - - out.Key("lookat"); - Write(out,ai.mLookAt,false); - - out.EndObj(); -} - -void WriteFormatInfo(JSONWriter& out) -{ - out.StartObj(); - out.Key("format"); - out.SimpleValue("\"assimp2json\""); - out.Key("version"); - out.SimpleValue(CURRENT_FORMAT_VERSION); - out.EndObj(); -} - -void Write(JSONWriter& out, const aiScene& ai) -{ - out.StartObj(); - - out.Key("__metadata__"); - WriteFormatInfo(out); - - out.Key("rootnode"); - Write(out,*ai.mRootNode, false); - - out.Key("flags"); - out.SimpleValue(ai.mFlags); - - if(ai.HasMeshes()) { - out.Key("meshes"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumMeshes; ++n) { - Write(out,*ai.mMeshes[n]); - } - out.EndArray(); - } - - if(ai.HasMaterials()) { - out.Key("materials"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumMaterials; ++n) { - Write(out,*ai.mMaterials[n]); - } - out.EndArray(); - } - - if(ai.HasAnimations()) { - out.Key("animations"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumAnimations; ++n) { - Write(out,*ai.mAnimations[n]); - } - out.EndArray(); - } - - if(ai.HasLights()) { - out.Key("lights"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumLights; ++n) { - Write(out,*ai.mLights[n]); - } - out.EndArray(); - } - - if(ai.HasCameras()) { - out.Key("cameras"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumCameras; ++n) { - Write(out,*ai.mCameras[n]); - } - out.EndArray(); - } - - if(ai.HasTextures()) { - out.Key("textures"); - out.StartArray(); - for(unsigned int n = 0; n < ai.mNumTextures; ++n) { - Write(out,*ai.mTextures[n]); - } - out.EndArray(); - } - out.EndObj(); -} - - -void ExportAssimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, const Assimp::ExportProperties*) -{ - std::unique_ptr str(io->Open(file,"wt")); - if(!str) { - //throw Assimp::DeadlyExportError("could not open output file"); - } - - // get a copy of the scene so we can modify it - aiScene* scenecopy_tmp; - aiCopyScene(scene, &scenecopy_tmp); - - try { - // split meshes so they fit into a 16 bit index buffer - MeshSplitter splitter; - splitter.SetLimit(1 << 16); - splitter.Execute(scenecopy_tmp); - - // XXX Flag_WriteSpecialFloats is turned on by default, right now we don't have a configuration interface for exporters - JSONWriter s(*str,JSONWriter::Flag_WriteSpecialFloats); - Write(s,*scenecopy_tmp); - - } - catch(...) { - aiFreeScene(scenecopy_tmp); - throw; - } - aiFreeScene(scenecopy_tmp); -} - -} // - #endif // ASSIMP_BUILD_NO_ASSJSON_EXPORTER #endif // ASSIMP_BUILD_NO_EXPORT diff --git a/code/Assjson/mesh_splitter.cpp b/code/Assjson/mesh_splitter.cpp index 07ae0bd86..24385f9a0 100644 --- a/code/Assjson/mesh_splitter.cpp +++ b/code/Assjson/mesh_splitter.cpp @@ -6,7 +6,6 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information */ - #include "mesh_splitter.h" #include @@ -18,8 +17,7 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information // ------------------------------------------------------------------------------------------------ // Executes the post processing step on the given imported data. -void MeshSplitter :: Execute( aiScene* pScene) -{ +void MeshSplitter::Execute( aiScene* pScene) { std::vector > source_mesh_map; for( unsigned int a = 0; a < pScene->mNumMeshes; a++) { @@ -27,8 +25,7 @@ void MeshSplitter :: Execute( aiScene* pScene) } const unsigned int size = static_cast(source_mesh_map.size()); - if (size != pScene->mNumMeshes) - { + if (size != pScene->mNumMeshes) { // it seems something has been split. rebuild the mesh list delete[] pScene->mMeshes; pScene->mNumMeshes = size; @@ -45,8 +42,7 @@ void MeshSplitter :: Execute( aiScene* pScene) // ------------------------------------------------------------------------------------------------ -void MeshSplitter :: UpdateNode(aiNode* pcNode, const std::vector >& source_mesh_map) -{ +void MeshSplitter::UpdateNode(aiNode* pcNode, const std::vector >& source_mesh_map) { // TODO: should better use std::(multi)set for source_mesh_map. // for every index in out list build a new entry @@ -82,10 +78,9 @@ typedef std::pair PerVertexWeight; typedef std::vector VertexWeightTable; // ------------------------------------------------------------------------------------------------ -VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) -{ +VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) { if (!pMesh || !pMesh->mNumVertices || !pMesh->mNumBones) { - return NULL; + return nullptr; } VertexWeightTable* const avPerVertexWeights = new VertexWeightTable[pMesh->mNumVertices]; @@ -101,9 +96,7 @@ VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) } // ------------------------------------------------------------------------------------------------ -void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, - std::vector >& source_mesh_map) -{ +void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector >& source_mesh_map) { // TODO: should better use std::(multi)set for source_mesh_map. if (in_mesh->mNumVertices <= LIMIT) { diff --git a/code/COB/COBLoader.cpp b/code/COB/COBLoader.cpp index b9eb5b7ea..19e3cd59e 100644 --- a/code/COB/COBLoader.cpp +++ b/code/COB/COBLoader.cpp @@ -898,6 +898,7 @@ public: : nfo(nfo) , reader(reader) , cur(reader.GetCurrentPos()) { + // empty } ~chunk_guard() { @@ -905,7 +906,7 @@ public: if(nfo.size != static_cast(-1)) { try { reader.IncPtr( static_cast< int >( nfo.size ) - reader.GetCurrentPos() + cur ); - } catch (const DeadlyImportError& e ) { + } catch (const DeadlyImportError& ) { // out of limit so correct the value reader.IncPtr( reader.GetReadLimit() ); } @@ -913,15 +914,17 @@ public: } private: - const COB::ChunkInfo& nfo; StreamReaderLE& reader; long cur; }; // ------------------------------------------------------------------------------------------------ -void COBImporter::ReadBinaryFile(Scene& out, StreamReaderLE* reader) -{ +void COBImporter::ReadBinaryFile(Scene& out, StreamReaderLE* reader) { + if (nullptr == reader) { + return; + } + while(1) { std::string type; type += reader -> GetI1() diff --git a/code/Common/ImporterRegistry.cpp b/code/Common/ImporterRegistry.cpp index b99f145ab..32ac3b416 100644 --- a/code/Common/ImporterRegistry.cpp +++ b/code/Common/ImporterRegistry.cpp @@ -200,9 +200,6 @@ corresponding preprocessor flag to selectively disable formats. #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER # include "Importer/StepFile/StepFileImporter.h" #endif -#ifndef ASSIMP_BUILD_NO_JT_IMPORTER -# include "JTImporter.h" -#endif namespace Assimp { @@ -361,10 +358,6 @@ void GetImporterInstanceList(std::vector< BaseImporter* >& out) #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER out.push_back(new StepFile::StepFileImporter()); #endif -#ifndef ASSIMP_BUILD_NO_JT_IMPORTER - out.push_back(new JTImporter()); -#endif - } /** will delete all registered importers. */ diff --git a/code/FBX/FBXDocument.h b/code/FBX/FBXDocument.h index 53bd65878..18e5c38f1 100644 --- a/code/FBX/FBXDocument.h +++ b/code/FBX/FBXDocument.h @@ -627,7 +627,7 @@ public: return content; } - uint32_t ContentLength() const { + uint64_t ContentLength() const { return contentLength; } diff --git a/include/assimp/camera.h b/include/assimp/camera.h index dd45d90d1..e573eea5d 100644 --- a/include/assimp/camera.h +++ b/include/assimp/camera.h @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -60,7 +58,7 @@ extern "C" { * * Cameras have a representation in the node graph and can be animated. * An important aspect is that the camera itself is also part of the - * scenegraph. This means, any values such as the look-at vector are not + * scene-graph. This means, any values such as the look-at vector are not * *absolute*, they're relative to the coordinate system defined * by the node which corresponds to the camera. This allows for camera * animations. For static cameras parameters like the 'look-at' or 'up' vectors diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 28aeac65a..913813c3b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -120,13 +120,13 @@ SET( IMPORTERS unit/utB3DImportExport.cpp unit/utMDCImportExport.cpp unit/utAssbinImportExport.cpp + unit/ImportExport/utAssjsonImportExport.cpp unit/ImportExport/utCOBImportExport.cpp unit/ImportExport/utOgreImportExport.cpp unit/ImportExport/utQ3BSPFileImportExport.cpp unit/ImportExport/utOFFImportExport.cpp unit/ImportExport/utNFFImportExport.cpp unit/ImportExport/utXGLImportExport.cpp -# unit/ImportExport/utJTImporter.cpp ) SET( MATERIAL @@ -166,11 +166,11 @@ SET( POST_PROCESSES ) SOURCE_GROUP( UnitTests\\Compiler FILES unit/CCompilerTest.c ) -SOURCE_GROUP( UnitTests\\Common FILES ${COMMON} ) -SOURCE_GROUP( UnitTests\\Importers FILES ${IMPORTERS} ) -SOURCE_GROUP( UnitTests\\Material FILES ${MATERIAL} ) -SOURCE_GROUP( UnitTests\\Math FILES ${MATH} ) -SOURCE_GROUP( UnitTests\\PostProcess FILES ${POST_PROCESSES}) +SOURCE_GROUP( UnitTests\\Common FILES ${COMMON} ) +SOURCE_GROUP( UnitTests\\ImportExport FILES ${IMPORTERS} ) +SOURCE_GROUP( UnitTests\\Material FILES ${MATERIAL} ) +SOURCE_GROUP( UnitTests\\Math FILES ${MATH} ) +SOURCE_GROUP( UnitTests\\PostProcess FILES ${POST_PROCESSES}) add_executable( unit ../contrib/gtest/src/gtest-all.cc diff --git a/test/models/PLY/cube_test.ply b/test/models/PLY/cube_test.ply index 45fae27fb..f2ac612e8 100644 --- a/test/models/PLY/cube_test.ply +++ b/test/models/PLY/cube_test.ply @@ -1,10 +1,6 @@ ply format ascii 1.0 -<<<<<<< HEAD -comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.732158294) -======= -comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.649942190) ->>>>>>> master +comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.993695325) element vertex 8 property float x property float y diff --git a/test/unit/AbstractImportExportBase.h b/test/unit/AbstractImportExportBase.h index 529b9cf7d..d6ae37d60 100644 --- a/test/unit/AbstractImportExportBase.h +++ b/test/unit/AbstractImportExportBase.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2019, assimp team All rights reserved. @@ -39,17 +39,37 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ #pragma once +#ifndef AI_ABSTRACTIMPORTEXPORTBASE_H_INC +#define AI_ABSTRACTIMPORTEXPORTBASE_H_INC #include "UnitTestPCH.h" +// --------------------------------------------------------------------------- +/** Abstract base class to test import and export + */ + // --------------------------------------------------------------------------- class AbstractImportExportBase : public ::testing::Test { public: + /// @brief The class destructor. virtual ~AbstractImportExportBase(); - virtual bool importerTest() = 0; + + /// @brief The importer-test, will return true for successful import. + /// @return true for success, false for failure. + virtual bool importerTest(); + + /// @brief The exporter-test, will return true for successful import. + /// @return true for success, false for failure. virtual bool exporterTest(); }; +inline +bool AbstractImportExportBase::importerTest() { + return true; +} + inline bool AbstractImportExportBase::exporterTest() { return true; } + +#endif // AI_ABSTRACTIMPORTEXPORTBASE_H_INC diff --git a/test/unit/ImportExport/utAssjsonImportExport.cpp b/test/unit/ImportExport/utAssjsonImportExport.cpp new file mode 100644 index 000000000..20a2a9e24 --- /dev/null +++ b/test/unit/ImportExport/utAssjsonImportExport.cpp @@ -0,0 +1,69 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2019, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ +#include "UnitTestPCH.h" +#include "AbstractImportExportBase.h" + +#include +#include +#include +#include + +using namespace Assimp; + +#ifndef ASSIMP_BUILD_NO_EXPORT + +class utAssjsonImportExport : public AbstractImportExportBase { +public: + bool exporterTest() override { + Importer importer; + const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure); + + Exporter exporter; + aiReturn res = exporter.Export(scene, "json", "./spider_test.json"); + return aiReturn_SUCCESS == res; + } +}; + +TEST_F(utAssjsonImportExport, exportTest) { + EXPECT_TRUE(exporterTest()); +} + +#endif // ASSIMP_BUILD_NO_EXPORT diff --git a/test/unit/utAMFImportExport.cpp b/test/unit/utAMFImportExport.cpp index dc2c9b99b..6eb0b4418 100644 --- a/test/unit/utAMFImportExport.cpp +++ b/test/unit/utAMFImportExport.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/test/unit/utASEImportExport.cpp b/test/unit/utASEImportExport.cpp index 28168de7d..313f0f83a 100644 --- a/test/unit/utASEImportExport.cpp +++ b/test/unit/utASEImportExport.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/test/unit/utAssbinImportExport.cpp b/test/unit/utAssbinImportExport.cpp index 6def04796..011aaa649 100644 --- a/test/unit/utAssbinImportExport.cpp +++ b/test/unit/utAssbinImportExport.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -53,8 +51,8 @@ using namespace Assimp; class utAssbinImportExport : public AbstractImportExportBase { public: - virtual bool importerTest() { - Assimp::Importer importer; + bool importerTest() override { + Importer importer; const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure ); Exporter exporter; @@ -66,7 +64,7 @@ public: }; TEST_F( utAssbinImportExport, exportAssbin3DFromFileTest ) { - Assimp::Importer importer; + Importer importer; const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure ); EXPECT_NE( nullptr, scene ); } diff --git a/test/unit/utB3DImportExport.cpp b/test/unit/utB3DImportExport.cpp index d51ca51a6..ea75b1939 100644 --- a/test/unit/utB3DImportExport.cpp +++ b/test/unit/utB3DImportExport.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/test/unit/utFindDegenerates.cpp b/test/unit/utFindDegenerates.cpp index ea539df27..064031f34 100644 --- a/test/unit/utFindDegenerates.cpp +++ b/test/unit/utFindDegenerates.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -49,35 +47,42 @@ using namespace Assimp; class FindDegeneratesProcessTest : public ::testing::Test { public: + FindDegeneratesProcessTest() + : Test() + , mMesh( nullptr ) + , mProcess( nullptr ) { + // empty + } + +protected: virtual void SetUp(); virtual void TearDown(); protected: - aiMesh* mesh; - FindDegeneratesProcess* process; + aiMesh* mMesh; + FindDegeneratesProcess* mProcess; }; -// ------------------------------------------------------------------------------------------------ void FindDegeneratesProcessTest::SetUp() { - mesh = new aiMesh(); - process = new FindDegeneratesProcess(); + mMesh = new aiMesh(); + mProcess = new FindDegeneratesProcess(); - mesh->mNumFaces = 1000; - mesh->mFaces = new aiFace[1000]; + mMesh->mNumFaces = 1000; + mMesh->mFaces = new aiFace[1000]; - mesh->mNumVertices = 5000*2; - mesh->mVertices = new aiVector3D[5000*2]; + mMesh->mNumVertices = 5000*2; + mMesh->mVertices = new aiVector3D[5000*2]; for (unsigned int i = 0; i < 5000; ++i) { - mesh->mVertices[i] = mesh->mVertices[i+5000] = aiVector3D((float)i); + mMesh->mVertices[i] = mMesh->mVertices[i+5000] = aiVector3D((float)i); } - mesh->mPrimitiveTypes = aiPrimitiveType_LINE | aiPrimitiveType_POINT | + mMesh->mPrimitiveTypes = aiPrimitiveType_LINE | aiPrimitiveType_POINT | aiPrimitiveType_POLYGON | aiPrimitiveType_TRIANGLE; unsigned int numOut = 0, numFaces = 0; for (unsigned int i = 0; i < 1000; ++i) { - aiFace& f = mesh->mFaces[i]; + aiFace& f = mMesh->mFaces[i]; f.mNumIndices = (i % 5)+1; // between 1 and 5 f.mIndices = new unsigned int[f.mNumIndices]; bool had = false; @@ -102,46 +107,46 @@ void FindDegeneratesProcessTest::SetUp() { if (!had) ++numFaces; } - mesh->mNumUVComponents[0] = numOut; - mesh->mNumUVComponents[1] = numFaces; + mMesh->mNumUVComponents[0] = numOut; + mMesh->mNumUVComponents[1] = numFaces; } void FindDegeneratesProcessTest::TearDown() { - delete mesh; - delete process; + delete mMesh; + delete mProcess; } TEST_F(FindDegeneratesProcessTest, testDegeneratesDetection) { - process->EnableInstantRemoval(false); - process->ExecuteOnMesh(mesh); + mProcess->EnableInstantRemoval(false); + mProcess->ExecuteOnMesh(mMesh); unsigned int out = 0; for (unsigned int i = 0; i < 1000; ++i) { - aiFace& f = mesh->mFaces[i]; + aiFace& f = mMesh->mFaces[i]; out += f.mNumIndices; } - EXPECT_EQ(1000U, mesh->mNumFaces); - EXPECT_EQ(10000U, mesh->mNumVertices); - EXPECT_EQ(out, mesh->mNumUVComponents[0]); + EXPECT_EQ(1000U, mMesh->mNumFaces); + EXPECT_EQ(10000U, mMesh->mNumVertices); + EXPECT_EQ(out, mMesh->mNumUVComponents[0]); EXPECT_EQ(static_cast( aiPrimitiveType_LINE | aiPrimitiveType_POINT | aiPrimitiveType_POLYGON | aiPrimitiveType_TRIANGLE), - mesh->mPrimitiveTypes); + mMesh->mPrimitiveTypes); } TEST_F(FindDegeneratesProcessTest, testDegeneratesRemoval) { - process->EnableAreaCheck(false); - process->EnableInstantRemoval(true); - process->ExecuteOnMesh(mesh); + mProcess->EnableAreaCheck(false); + mProcess->EnableInstantRemoval(true); + mProcess->ExecuteOnMesh(mMesh); - EXPECT_EQ(mesh->mNumUVComponents[1], mesh->mNumFaces); + EXPECT_EQ(mMesh->mNumUVComponents[1], mMesh->mNumFaces); } TEST_F(FindDegeneratesProcessTest, testDegeneratesRemovalWithAreaCheck) { - process->EnableAreaCheck(true); - process->EnableInstantRemoval(true); - process->ExecuteOnMesh(mesh); + mProcess->EnableAreaCheck(true); + mProcess->EnableInstantRemoval(true); + mProcess->ExecuteOnMesh(mMesh); - EXPECT_EQ(mesh->mNumUVComponents[1]-100, mesh->mNumFaces); + EXPECT_EQ(mMesh->mNumUVComponents[1]-100, mMesh->mNumFaces); } diff --git a/test/unit/utFindInvalidData.cpp b/test/unit/utFindInvalidData.cpp index 5b874a2a4..7c70a71a9 100644 --- a/test/unit/utFindInvalidData.cpp +++ b/test/unit/utFindInvalidData.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -48,89 +46,100 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace std; using namespace Assimp; -class FindInvalidDataProcessTest : public ::testing::Test -{ +class utFindInvalidDataProcess : public ::testing::Test { public: + utFindInvalidDataProcess() + : Test() + , mMesh(nullptr) + , mProcess(nullptr) { + // empty + } + +protected: virtual void SetUp(); virtual void TearDown(); protected: - aiMesh* pcMesh; - FindInvalidDataProcess* piProcess; + aiMesh* mMesh; + FindInvalidDataProcess* mProcess; }; // ------------------------------------------------------------------------------------------------ -void FindInvalidDataProcessTest::SetUp() { +void utFindInvalidDataProcess::SetUp() { ASSERT_TRUE( AI_MAX_NUMBER_OF_TEXTURECOORDS >= 3); - piProcess = new FindInvalidDataProcess(); - pcMesh = new aiMesh(); + mProcess = new FindInvalidDataProcess(); + mMesh = new aiMesh(); - pcMesh->mNumVertices = 1000; - pcMesh->mVertices = new aiVector3D[1000]; - for (unsigned int i = 0; i < 1000;++i) - pcMesh->mVertices[i] = aiVector3D((float)i); + mMesh->mNumVertices = 1000; + mMesh->mVertices = new aiVector3D[1000]; + for (unsigned int i = 0; i < 1000; ++i) { + mMesh->mVertices[i] = aiVector3D((float)i); + } - pcMesh->mNormals = new aiVector3D[1000]; - for (unsigned int i = 0; i < 1000;++i) - pcMesh->mNormals[i] = aiVector3D((float)i+1); + mMesh->mNormals = new aiVector3D[1000]; + for (unsigned int i = 0; i < 1000; ++i) { + mMesh->mNormals[i] = aiVector3D((float)i + 1); + } - pcMesh->mTangents = new aiVector3D[1000]; - for (unsigned int i = 0; i < 1000;++i) - pcMesh->mTangents[i] = aiVector3D((float)i); + mMesh->mTangents = new aiVector3D[1000]; + for (unsigned int i = 0; i < 1000; ++i) { + mMesh->mTangents[i] = aiVector3D((float)i); + } - pcMesh->mBitangents = new aiVector3D[1000]; - for (unsigned int i = 0; i < 1000;++i) - pcMesh->mBitangents[i] = aiVector3D((float)i); + mMesh->mBitangents = new aiVector3D[1000]; + for (unsigned int i = 0; i < 1000; ++i) { + mMesh->mBitangents[i] = aiVector3D((float)i); + } - for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS;++a) - { - pcMesh->mTextureCoords[a] = new aiVector3D[1000]; - for (unsigned int i = 0; i < 1000;++i) - pcMesh->mTextureCoords[a][i] = aiVector3D((float)i); + for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS;++a) { + mMesh->mTextureCoords[a] = new aiVector3D[1000]; + for (unsigned int i = 0; i < 1000; ++i) { + mMesh->mTextureCoords[a][i] = aiVector3D((float)i); + } } } // ------------------------------------------------------------------------------------------------ -void FindInvalidDataProcessTest::TearDown() -{ - delete piProcess; - delete pcMesh; +void utFindInvalidDataProcess::TearDown() { + delete mProcess; + delete mMesh; } // ------------------------------------------------------------------------------------------------ -TEST_F(FindInvalidDataProcessTest, testStepNegativeResult) -{ - ::memset(pcMesh->mNormals,0,pcMesh->mNumVertices*sizeof(aiVector3D)); - ::memset(pcMesh->mBitangents,0,pcMesh->mNumVertices*sizeof(aiVector3D)); +TEST_F(utFindInvalidDataProcess, testStepNegativeResult) { + ::memset(mMesh->mNormals, 0, mMesh->mNumVertices*sizeof(aiVector3D) ); + ::memset(mMesh->mBitangents, 0, mMesh->mNumVertices*sizeof(aiVector3D) ); - pcMesh->mTextureCoords[2][455] = aiVector3D( std::numeric_limits::quiet_NaN() ); + mMesh->mTextureCoords[2][455] = aiVector3D( std::numeric_limits::quiet_NaN() ); - piProcess->ProcessMesh(pcMesh); + mProcess->ProcessMesh(mMesh); - EXPECT_TRUE(NULL != pcMesh->mVertices); - EXPECT_TRUE(NULL == pcMesh->mNormals); - EXPECT_TRUE(NULL == pcMesh->mTangents); - EXPECT_TRUE(NULL == pcMesh->mBitangents); + EXPECT_TRUE(NULL != mMesh->mVertices); + EXPECT_EQ(NULL, mMesh->mNormals); + EXPECT_EQ(NULL, mMesh->mTangents); + EXPECT_EQ(NULL, mMesh->mBitangents); - for (unsigned int i = 0; i < 2;++i) - EXPECT_TRUE(NULL != pcMesh->mTextureCoords[i]); + for (unsigned int i = 0; i < 2; ++i) { + EXPECT_TRUE(NULL != mMesh->mTextureCoords[i]); + } - for (unsigned int i = 2; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i) - EXPECT_TRUE(NULL == pcMesh->mTextureCoords[i]); + for (unsigned int i = 2; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) { + EXPECT_EQ(NULL, mMesh->mTextureCoords[i]); + } } // ------------------------------------------------------------------------------------------------ -TEST_F(FindInvalidDataProcessTest, testStepPositiveResult) -{ - piProcess->ProcessMesh(pcMesh); +TEST_F(utFindInvalidDataProcess, testStepPositiveResult) { + mProcess->ProcessMesh(mMesh); - EXPECT_TRUE(NULL != pcMesh->mVertices); + EXPECT_NE(nullptr, mMesh->mVertices); - EXPECT_TRUE(NULL != pcMesh->mNormals); - EXPECT_TRUE(NULL != pcMesh->mTangents); - EXPECT_TRUE(NULL != pcMesh->mBitangents); + EXPECT_NE(nullptr, mMesh->mNormals); + EXPECT_NE(nullptr, mMesh->mTangents); + EXPECT_NE(nullptr, mMesh->mBitangents); - for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i) - EXPECT_TRUE(NULL != pcMesh->mTextureCoords[i]); + for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) { + EXPECT_NE(nullptr, mMesh->mTextureCoords[i]); + } } diff --git a/test/unit/utGenBoundingBoxesProcess.cpp b/test/unit/utGenBoundingBoxesProcess.cpp index a26edb7e3..2c2f831bc 100644 --- a/test/unit/utGenBoundingBoxesProcess.cpp +++ b/test/unit/utGenBoundingBoxesProcess.cpp @@ -48,13 +48,21 @@ using namespace Assimp; class utGenBoundingBoxesProcess : public ::testing::Test { public: + utGenBoundingBoxesProcess() + : Test() + , mProcess(nullptr) + , mMesh(nullptr) + , mScene(nullptr) { + // empty + } + void SetUp() override { mProcess = new GenBoundingBoxesProcess; mMesh = new aiMesh(); mMesh->mNumVertices = 100; mMesh->mVertices = new aiVector3D[100]; for (unsigned int i = 0; i < 100; ++i) { - mMesh->mVertices[i] = aiVector3D(i, i, i); + mMesh->mVertices[i] = aiVector3D((ai_real)i, (ai_real)i, (ai_real)i); } mScene = new aiScene(); mScene->mNumMeshes = 1; diff --git a/test/unit/utJoinVertices.cpp b/test/unit/utJoinVertices.cpp index 6b832b73d..215b0dd90 100644 --- a/test/unit/utJoinVertices.cpp +++ b/test/unit/utJoinVertices.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -49,8 +47,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace std; using namespace Assimp; -class JoinVerticesTest : public ::testing::Test { +class utJoinVertices : public ::testing::Test { public: + utJoinVertices() + : Test() + , piProcess(nullptr) + , pcMesh(nullptr) { + // empty + } + +protected: virtual void SetUp(); virtual void TearDown(); @@ -60,8 +66,7 @@ protected: }; // ------------------------------------------------------------------------------------------------ -void JoinVerticesTest::SetUp() -{ +void utJoinVertices::SetUp() { // construct the process piProcess = new JoinVerticesProcess(); @@ -71,11 +76,9 @@ void JoinVerticesTest::SetUp() pcMesh->mNumVertices = 900; aiVector3D*& pv = pcMesh->mVertices = new aiVector3D[900]; - for (unsigned int i = 0; i < 3;++i) - { + for (unsigned int i = 0; i < 3;++i) { const unsigned int base = i*300; - for (unsigned int a = 0; a < 300;++a) - { + for (unsigned int a = 0; a < 300;++a) { pv[base+a].x = pv[base+a].y = pv[base+a].z = (float)a; } } @@ -83,38 +86,37 @@ void JoinVerticesTest::SetUp() // generate faces - each vertex is referenced once pcMesh->mNumFaces = 300; pcMesh->mFaces = new aiFace[300]; - for (unsigned int i = 0,p = 0; i < 300;++i) - { + for (unsigned int i = 0,p = 0; i < 300;++i) { aiFace& face = pcMesh->mFaces[i]; face.mIndices = new unsigned int[ face.mNumIndices = 3 ]; - for (unsigned int a = 0; a < 3;++a) + for (unsigned int a = 0; a < 3; ++a) { face.mIndices[a] = p++; + } } // generate extra members - set them to zero to make sure they're identical pcMesh->mTextureCoords[0] = new aiVector3D[900]; - for (unsigned int i = 0; i < 900;++i)pcMesh->mTextureCoords[0][i] = aiVector3D( 0.f ); - - pcMesh->mNormals = new aiVector3D[900]; - for (unsigned int i = 0; i < 900;++i)pcMesh->mNormals[i] = aiVector3D( 0.f ); - - pcMesh->mTangents = new aiVector3D[900]; - for (unsigned int i = 0; i < 900;++i)pcMesh->mTangents[i] = aiVector3D( 0.f ); - pcMesh->mBitangents = new aiVector3D[900]; - for (unsigned int i = 0; i < 900;++i)pcMesh->mBitangents[i] = aiVector3D( 0.f ); + pcMesh->mNormals = new aiVector3D[900]; + pcMesh->mTangents = new aiVector3D[900]; + for (unsigned int i = 0; i < 900; ++i) { + pcMesh->mTextureCoords[0][i] = aiVector3D(0.f); + pcMesh->mNormals[i] = aiVector3D(0.f); + pcMesh->mTangents[i] = aiVector3D(0.f); + pcMesh->mBitangents[i] = aiVector3D(0.f); + } } // ------------------------------------------------------------------------------------------------ -void JoinVerticesTest::TearDown() -{ +void utJoinVertices::TearDown() { delete this->pcMesh; + pcMesh = nullptr; delete this->piProcess; + piProcess = nullptr; } // ------------------------------------------------------------------------------------------------ -TEST_F(JoinVerticesTest, testProcess) -{ +TEST_F(utJoinVertices, testProcess) { // execute the step on the given data piProcess->ProcessMesh(pcMesh,0); @@ -122,15 +124,14 @@ TEST_F(JoinVerticesTest, testProcess) ASSERT_EQ(300U, pcMesh->mNumFaces); ASSERT_EQ(300U, pcMesh->mNumVertices); - ASSERT_TRUE(NULL != pcMesh->mNormals); - ASSERT_TRUE(NULL != pcMesh->mTangents); - ASSERT_TRUE(NULL != pcMesh->mBitangents); - ASSERT_TRUE(NULL != pcMesh->mTextureCoords[0]); + ASSERT_TRUE( nullptr != pcMesh->mNormals); + ASSERT_TRUE( nullptr != pcMesh->mTangents); + ASSERT_TRUE( nullptr != pcMesh->mBitangents); + ASSERT_TRUE( nullptr != pcMesh->mTextureCoords[0]); // the order doesn't care float fSum = 0.f; - for (unsigned int i = 0; i < 300;++i) - { + for (unsigned int i = 0; i < 300; ++i) { aiVector3D& v = pcMesh->mVertices[i]; fSum += v.x + v.y + v.z; @@ -141,4 +142,3 @@ TEST_F(JoinVerticesTest, testProcess) } EXPECT_EQ(150.f*299.f*3.f, fSum); // gaussian sum equation } - diff --git a/test/unit/utLimitBoneWeights.cpp b/test/unit/utLimitBoneWeights.cpp index 5172976b4..927a9e37c 100644 --- a/test/unit/utLimitBoneWeights.cpp +++ b/test/unit/utLimitBoneWeights.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -50,83 +48,83 @@ using namespace Assimp; class LimitBoneWeightsTest : public ::testing::Test { public: + LimitBoneWeightsTest() + : Test() + , mProcess(nullptr) + , mMesh(nullptr) { + // empty + } + +protected: virtual void SetUp(); virtual void TearDown(); protected: - LimitBoneWeightsProcess* piProcess; - aiMesh* pcMesh; + LimitBoneWeightsProcess *mProcess; + aiMesh *mMesh; }; // ------------------------------------------------------------------------------------------------ -void LimitBoneWeightsTest::SetUp() -{ +void LimitBoneWeightsTest::SetUp() { // construct the process - this->piProcess = new LimitBoneWeightsProcess(); + this->mProcess = new LimitBoneWeightsProcess(); // now need to create a nice mesh for testing purposes - this->pcMesh = new aiMesh(); + this->mMesh = new aiMesh(); - pcMesh->mNumVertices = 500; - pcMesh->mVertices = new aiVector3D[500]; // uninit. - pcMesh->mNumBones = 30; - pcMesh->mBones = new aiBone*[30]; + mMesh->mNumVertices = 500; + mMesh->mVertices = new aiVector3D[500]; // uninit. + mMesh->mNumBones = 30; + mMesh->mBones = new aiBone*[30]; unsigned int iCur = 0; - for (unsigned int i = 0; i < 30;++i) - { - aiBone* pc = pcMesh->mBones[i] = new aiBone(); + for (unsigned int i = 0; i < 30;++i) { + aiBone* pc = mMesh->mBones[i] = new aiBone(); pc->mNumWeights = 250; pc->mWeights = new aiVertexWeight[pc->mNumWeights]; - for (unsigned int qq = 0; qq < pc->mNumWeights;++qq) - { + for (unsigned int qq = 0; qq < pc->mNumWeights;++qq) { aiVertexWeight& v = pc->mWeights[qq]; v.mVertexId = iCur++; - if (500 == iCur)iCur = 0; + if (500 == iCur) { + iCur = 0; + } v.mWeight = 1.0f / 15; // each vertex should occur once in two bones } } } // ------------------------------------------------------------------------------------------------ -void LimitBoneWeightsTest::TearDown() -{ - delete pcMesh; - delete piProcess; +void LimitBoneWeightsTest::TearDown() { + delete mMesh; + delete mProcess; } // ------------------------------------------------------------------------------------------------ -TEST_F(LimitBoneWeightsTest, testProcess) -{ +TEST_F(LimitBoneWeightsTest, testProcess) { // execute the step on the given data - piProcess->ProcessMesh(pcMesh); + mProcess->ProcessMesh(mMesh); // check whether everything is ok ... typedef std::vector VertexWeightList; - VertexWeightList* asWeights = new VertexWeightList[pcMesh->mNumVertices]; + VertexWeightList* asWeights = new VertexWeightList[mMesh->mNumVertices]; - for (unsigned int i = 0; i < pcMesh->mNumVertices;++i) + for (unsigned int i = 0; i < mMesh->mNumVertices; ++i) { asWeights[i].reserve(4); + } // sort back as per-vertex lists - for (unsigned int i = 0; i < pcMesh->mNumBones;++i) - { - aiBone& pcBone = **(pcMesh->mBones+i); - for (unsigned int q = 0; q < pcBone.mNumWeights;++q) - { + for (unsigned int i = 0; i < mMesh->mNumBones;++i) { + aiBone& pcBone = **(mMesh->mBones+i); + for (unsigned int q = 0; q < pcBone.mNumWeights;++q) { aiVertexWeight weight = pcBone.mWeights[q]; asWeights[weight.mVertexId].push_back(LimitBoneWeightsProcess::Weight (i,weight.mWeight)); } } // now validate the size of the lists and check whether all weights sum to 1.0f - for (unsigned int i = 0; i < pcMesh->mNumVertices;++i) - { + for (unsigned int i = 0; i < mMesh->mNumVertices;++i) { EXPECT_LE(asWeights[i].size(), 4U); float fSum = 0.0f; - for (VertexWeightList::const_iterator - iter = asWeights[i].begin(); - iter != asWeights[i].end();++iter) - { + for (VertexWeightList::const_iterator iter = asWeights[i].begin(); iter != asWeights[i].end();++iter) { fSum += (*iter).mWeight; } EXPECT_GE(fSum, 0.95F); diff --git a/test/unit/utPretransformVertices.cpp b/test/unit/utPretransformVertices.cpp index 22d1b28b4..0839740ac 100644 --- a/test/unit/utPretransformVertices.cpp +++ b/test/unit/utPretransformVertices.cpp @@ -51,18 +51,24 @@ using namespace Assimp; class PretransformVerticesTest : public ::testing::Test { public: + PretransformVerticesTest() + : Test() + , mScene(nullptr) + , mProcess(nullptr) { + // empty + } + +protected: virtual void SetUp(); virtual void TearDown(); protected: - - aiScene* scene; - PretransformVertices* process; + aiScene *mScene; + PretransformVertices *mProcess; }; // ------------------------------------------------------------------------------------------------ -void AddNodes(unsigned int num, aiNode* father, unsigned int depth) -{ +void AddNodes(unsigned int num, aiNode* father, unsigned int depth) { father->mChildren = new aiNode*[father->mNumChildren = 5]; for (unsigned int i = 0; i < 5; ++i) { aiNode* nd = father->mChildren[i] = new aiNode(); @@ -79,26 +85,26 @@ void AddNodes(unsigned int num, aiNode* father, unsigned int depth) } if (depth > 1) { - for (unsigned int i = 0; i < 5; ++i) - AddNodes(i, father->mChildren[i],depth-1); + for (unsigned int i = 0; i < 5; ++i) { + AddNodes(i, father->mChildren[i], depth - 1); + } } } // ------------------------------------------------------------------------------------------------ -void PretransformVerticesTest::SetUp() -{ - scene = new aiScene(); +void PretransformVerticesTest::SetUp() { + mScene = new aiScene(); // add 5 empty materials - scene->mMaterials = new aiMaterial*[scene->mNumMaterials = 5]; + mScene->mMaterials = new aiMaterial*[mScene->mNumMaterials = 5]; for (unsigned int i = 0; i < 5;++i) { - scene->mMaterials[i] = new aiMaterial(); + mScene->mMaterials[i] = new aiMaterial(); } // add 25 test meshes - scene->mMeshes = new aiMesh*[scene->mNumMeshes = 25]; - for ( unsigned int i = 0; i < 25; ++i) { - aiMesh* mesh = scene->mMeshes[ i ] = new aiMesh(); + mScene->mMeshes = new aiMesh*[mScene->mNumMeshes = 25]; + for ( unsigned int i = 0; i < 25; ++i) { + aiMesh* mesh = mScene->mMeshes[ i ] = new aiMesh(); mesh->mPrimitiveTypes = aiPrimitiveType_POINT; mesh->mFaces = new aiFace[ mesh->mNumFaces = 10+i ]; @@ -124,36 +130,33 @@ void PretransformVerticesTest::SetUp() } // construct some nodes (1+25) - scene->mRootNode = new aiNode(); - scene->mRootNode->mName.Set("Root"); - AddNodes(0,scene->mRootNode,2); + mScene->mRootNode = new aiNode(); + mScene->mRootNode->mName.Set("Root"); + AddNodes(0, mScene->mRootNode, 2); - process = new PretransformVertices(); + mProcess = new PretransformVertices(); } // ------------------------------------------------------------------------------------------------ -void PretransformVerticesTest::TearDown() -{ - delete scene; - delete process; +void PretransformVerticesTest::TearDown() { + delete mScene; + delete mProcess; } // ------------------------------------------------------------------------------------------------ -TEST_F(PretransformVerticesTest, testProcessCollapseHierarchy) -{ - process->KeepHierarchy(false); - process->Execute(scene); +TEST_F(PretransformVerticesTest, testProcessCollapseHierarchy) { + mProcess->KeepHierarchy(false); + mProcess->Execute(mScene); - EXPECT_EQ(5U, scene->mNumMaterials); - EXPECT_EQ(10U, scene->mNumMeshes); // every second mesh has normals + EXPECT_EQ(5U, mScene->mNumMaterials); + EXPECT_EQ(10U, mScene->mNumMeshes); // every second mesh has normals } // ------------------------------------------------------------------------------------------------ -TEST_F(PretransformVerticesTest, testProcessKeepHierarchy) -{ - process->KeepHierarchy(true); - process->Execute(scene); +TEST_F(PretransformVerticesTest, testProcessKeepHierarchy) { + mProcess->KeepHierarchy(true); + mProcess->Execute(mScene); - EXPECT_EQ(5U, scene->mNumMaterials); - EXPECT_EQ(49U, scene->mNumMeshes); // see note on mesh 12 above + EXPECT_EQ(5U, mScene->mNumMaterials); + EXPECT_EQ(49U, mScene->mNumMeshes); // see note on mesh 12 above } diff --git a/test/unit/utScenePreprocessor.cpp b/test/unit/utScenePreprocessor.cpp index 2c181a90f..7233e1379 100644 --- a/test/unit/utScenePreprocessor.cpp +++ b/test/unit/utScenePreprocessor.cpp @@ -50,67 +50,67 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace std; using namespace Assimp; - -class ScenePreprocessorTest : public ::testing::Test -{ +class ScenePreprocessorTest : public ::testing::Test { public: + ScenePreprocessorTest() + : Test() + , mScenePreprocessor(nullptr) + , mScene(nullptr) { + // empty + } +protected: virtual void SetUp(); virtual void TearDown(); protected: - void CheckIfOnly(aiMesh* p, unsigned int num, unsigned flag); + void ProcessAnimation(aiAnimation* anim) { mScenePreprocessor->ProcessAnimation(anim); } + void ProcessMesh(aiMesh* mesh) { mScenePreprocessor->ProcessMesh(mesh); } - void ProcessAnimation(aiAnimation* anim) { pp->ProcessAnimation(anim); } - void ProcessMesh(aiMesh* mesh) { pp->ProcessMesh(mesh); } - - ScenePreprocessor* pp; - aiScene* scene; +private: + ScenePreprocessor *mScenePreprocessor; + aiScene *mScene; }; // ------------------------------------------------------------------------------------------------ -void ScenePreprocessorTest::SetUp() -{ +void ScenePreprocessorTest::SetUp() { // setup a dummy scene with a single node - scene = new aiScene(); - scene->mRootNode = new aiNode(); - scene->mRootNode->mName.Set(""); + mScene = new aiScene(); + mScene->mRootNode = new aiNode(); + mScene->mRootNode->mName.Set(""); // add some translation - scene->mRootNode->mTransformation.a4 = 1.f; - scene->mRootNode->mTransformation.b4 = 2.f; - scene->mRootNode->mTransformation.c4 = 3.f; + mScene->mRootNode->mTransformation.a4 = 1.f; + mScene->mRootNode->mTransformation.b4 = 2.f; + mScene->mRootNode->mTransformation.c4 = 3.f; // and allocate a ScenePreprocessor to operate on the scene - pp = new ScenePreprocessor(scene); + mScenePreprocessor = new ScenePreprocessor(mScene); } // ------------------------------------------------------------------------------------------------ -void ScenePreprocessorTest::TearDown() -{ - delete pp; - delete scene; +void ScenePreprocessorTest::TearDown() { + delete mScenePreprocessor; + delete mScene; } // ------------------------------------------------------------------------------------------------ // Check whether ProcessMesh() returns flag for a mesh that consist of primitives with num indices -void ScenePreprocessorTest::CheckIfOnly(aiMesh* p, unsigned int num, unsigned int flag) -{ +void ScenePreprocessorTest::CheckIfOnly(aiMesh* p, unsigned int num, unsigned int flag) { // Triangles only for (unsigned i = 0; i < p->mNumFaces;++i) { p->mFaces[i].mNumIndices = num; } - pp->ProcessMesh(p); + mScenePreprocessor->ProcessMesh(p); EXPECT_EQ(flag, p->mPrimitiveTypes); p->mPrimitiveTypes = 0; } // ------------------------------------------------------------------------------------------------ // Check whether a mesh is preprocessed correctly. Case 1: The mesh needs preprocessing -TEST_F(ScenePreprocessorTest, testMeshPreprocessingPos) -{ - aiMesh* p = new aiMesh(); +TEST_F(ScenePreprocessorTest, testMeshPreprocessingPos) { + aiMesh* p = new aiMesh; p->mNumFaces = 100; p->mFaces = new aiFace[p->mNumFaces]; @@ -145,9 +145,8 @@ TEST_F(ScenePreprocessorTest, testMeshPreprocessingPos) // ------------------------------------------------------------------------------------------------ // Check whether a mesh is preprocessed correctly. Case 1: The mesh doesn't need preprocessing -TEST_F(ScenePreprocessorTest, testMeshPreprocessingNeg) -{ - aiMesh* p = new aiMesh(); +TEST_F(ScenePreprocessorTest, testMeshPreprocessingNeg) { + aiMesh* p = new aiMesh; p->mPrimitiveTypes = aiPrimitiveType_TRIANGLE|aiPrimitiveType_POLYGON; ProcessMesh(p); @@ -160,8 +159,7 @@ TEST_F(ScenePreprocessorTest, testMeshPreprocessingNeg) // ------------------------------------------------------------------------------------------------ // Make a dummy animation with a single channel, '' -aiAnimation* MakeDummyAnimation() -{ +aiAnimation* MakeDummyAnimation() { aiAnimation* p = new aiAnimation(); p->mNumChannels = 1; p->mChannels = new aiNodeAnim*[1]; @@ -172,8 +170,7 @@ aiAnimation* MakeDummyAnimation() // ------------------------------------------------------------------------------------------------ // Check whether an anim is preprocessed correctly. Case 1: The anim needs preprocessing -TEST_F(ScenePreprocessorTest, testAnimationPreprocessingPos) -{ +TEST_F(ScenePreprocessorTest, testAnimationPreprocessingPos) { aiAnimation* p = MakeDummyAnimation(); aiNodeAnim* anim = p->mChannels[0]; diff --git a/test/unit/utSortByPType.cpp b/test/unit/utSortByPType.cpp index 1aa9dad0a..749e618da 100644 --- a/test/unit/utSortByPType.cpp +++ b/test/unit/utSortByPType.cpp @@ -52,12 +52,20 @@ using namespace Assimp; class SortByPTypeProcessTest : public ::testing::Test { public: + SortByPTypeProcessTest() + : Test() + , mProcess1(nullptr) + , mScene(nullptr) { + // empty + } + +protected: virtual void SetUp(); virtual void TearDown(); protected: - SortByPTypeProcess* process1; - aiScene* scene; + SortByPTypeProcess* mProcess1; + aiScene* mScene; }; // ------------------------------------------------------------------------------------------------ @@ -75,8 +83,7 @@ static unsigned int num[10][4] = { }; // ------------------------------------------------------------------------------------------------ -static unsigned int result[10] = -{ +static unsigned int result[10] = { aiPrimitiveType_POLYGON, aiPrimitiveType_TRIANGLE, aiPrimitiveType_LINE, @@ -90,19 +97,16 @@ static unsigned int result[10] = }; // ------------------------------------------------------------------------------------------------ -void SortByPTypeProcessTest::SetUp() -{ -// process0 = new DeterminePTypeHelperProcess(); - process1 = new SortByPTypeProcess(); - scene = new aiScene(); +void SortByPTypeProcessTest::SetUp() { + mProcess1 = new SortByPTypeProcess(); + mScene = new aiScene(); - scene->mNumMeshes = 10; - scene->mMeshes = new aiMesh*[10]; + mScene->mNumMeshes = 10; + mScene->mMeshes = new aiMesh*[10]; bool five = false; - for (unsigned int i = 0; i < 10; ++i) - { - aiMesh* mesh = scene->mMeshes[i] = new aiMesh(); + for (unsigned int i = 0; i < 10; ++i) { + aiMesh* mesh = mScene->mMeshes[i] = new aiMesh(); mesh->mNumFaces = 1000; aiFace* faces = mesh->mFaces = new aiFace[1000]; aiVector3D* pv = mesh->mVertices = new aiVector3D[mesh->mNumFaces*5]; @@ -115,27 +119,24 @@ void SortByPTypeProcessTest::SetUp() unsigned int remaining[4] = {num[i][0],num[i][1],num[i][2],num[i][3]}; unsigned int n = 0; - for (unsigned int m = 0; m < 1000; ++m) - { + for (unsigned int m = 0; m < 1000; ++m) { unsigned int idx = m % 4; - while (true) - { - if (!remaining[idx]) - { - if (4 == ++idx)idx = 0; + while (true) { + if (!remaining[idx]) { + if (4 == ++idx) { + idx = 0; + } continue; } break; } faces->mNumIndices = idx+1; - if (4 == faces->mNumIndices) - { + if (4 == faces->mNumIndices) { if(five)++faces->mNumIndices; five = !five; } faces->mIndices = new unsigned int[faces->mNumIndices]; - for (unsigned int q = 0; q mNumIndices;++q,++n) - { + for (unsigned int q = 0; q mNumIndices;++q,++n) { faces->mIndices[q] = n; float f = (float)remaining[idx]; @@ -152,12 +153,11 @@ void SortByPTypeProcessTest::SetUp() mesh->mNumVertices = n; } - scene->mRootNode = new aiNode(); - scene->mRootNode->mNumChildren = 5; - scene->mRootNode->mChildren = new aiNode*[5]; - for (unsigned int i = 0; i< 5;++i ) - { - aiNode* node = scene->mRootNode->mChildren[i] = new aiNode(); + mScene->mRootNode = new aiNode(); + mScene->mRootNode->mNumChildren = 5; + mScene->mRootNode->mChildren = new aiNode*[5]; + for (unsigned int i = 0; i< 5;++i ) { + aiNode* node = mScene->mRootNode->mChildren[i] = new aiNode(); node->mNumMeshes = 2; node->mMeshes = new unsigned int[2]; node->mMeshes[0] = (i<<1u); @@ -166,48 +166,28 @@ void SortByPTypeProcessTest::SetUp() } // ------------------------------------------------------------------------------------------------ -void SortByPTypeProcessTest::TearDown() -{ - //delete process0; - delete process1; - delete scene; +void SortByPTypeProcessTest::TearDown() { + delete mProcess1; + delete mScene; } // ------------------------------------------------------------------------------------------------ -//TEST_F(SortByPTypeProcessTest, DeterminePTypeStep() -//{ -// process0->Execute(scene); -// -// for (unsigned int i = 0; i < 10; ++i) -// { -// aiMesh* mesh = scene->mMeshes[i]; -// EXPECT_TRUE(mesh->mPrimitiveTypes == result[i]); -// } -//} - -// ------------------------------------------------------------------------------------------------ -TEST_F(SortByPTypeProcessTest, SortByPTypeStep) -{ - // process0->Execute(scene); - - // and another small test for ScenePreprocessor - ScenePreprocessor s(scene); +TEST_F(SortByPTypeProcessTest, SortByPTypeStep) { + ScenePreprocessor s(mScene); s.ProcessScene(); for (unsigned int m = 0; m< 10;++m) - EXPECT_EQ(result[m], scene->mMeshes[m]->mPrimitiveTypes); + EXPECT_EQ(result[m], mScene->mMeshes[m]->mPrimitiveTypes); - process1->Execute(scene); + mProcess1->Execute(mScene); unsigned int idx = 0; - for (unsigned int m = 0,real = 0; m< 10;++m) - { - for (unsigned int n = 0; n < 4;++n) - { + for (unsigned int m = 0,real = 0; m< 10;++m) { + for (unsigned int n = 0; n < 4;++n) { if ((idx = num[m][n])) { - EXPECT_TRUE(real < scene->mNumMeshes); + EXPECT_TRUE(real < mScene->mNumMeshes); - aiMesh* mesh = scene->mMeshes[real]; + aiMesh* mesh = mScene->mMeshes[real]; EXPECT_TRUE(NULL != mesh); EXPECT_EQ(AI_PRIMITIVE_TYPE_FOR_N_INDICES(n+1), mesh->mPrimitiveTypes); @@ -218,8 +198,7 @@ TEST_F(SortByPTypeProcessTest, SortByPTypeStep) EXPECT_TRUE(NULL != mesh->mTextureCoords[0]); EXPECT_TRUE(mesh->mNumFaces == idx); - for (unsigned int f = 0; f < mesh->mNumFaces;++f) - { + for (unsigned int f = 0; f < mesh->mNumFaces;++f) { aiFace& face = mesh->mFaces[f]; EXPECT_TRUE(face.mNumIndices == (n+1) || (3 == n && face.mNumIndices > 3)); } @@ -228,4 +207,3 @@ TEST_F(SortByPTypeProcessTest, SortByPTypeStep) } } } - From 8f74508e403ad1b8657d59127537ad3e452d8618 Mon Sep 17 00:00:00 2001 From: kimkulling Date: Fri, 12 Jul 2019 16:28:36 +0200 Subject: [PATCH 18/43] Fix missing doc in config.h --- include/assimp/config.h.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/assimp/config.h.in b/include/assimp/config.h.in index c95f0e160..d08b929a1 100644 --- a/include/assimp/config.h.in +++ b/include/assimp/config.h.in @@ -981,8 +981,12 @@ enum aiComponent #define AI_CONFIG_EXPORT_XFILE_64BIT "EXPORT_XFILE_64BIT" -/** - * +/** @brief Specifies whether the assimp export shall be able to export point clouds + * + * When this flag is not defined the render data has to contain valid faces. + * Point clouds are only a collection of vertices which have nor spatial organization + * by a face and the validation process will remove them. Enabling this feature will + * switch off the flag and enable the functionality to export pure point clouds. */ #define AI_CONFIG_EXPORT_POINT_CLOUDS "EXPORT_POINT_CLOUDS" From bcdb173e0936b191c2a150819ddc1b0942582cda Mon Sep 17 00:00:00 2001 From: Frooxius Date: Sat, 13 Jul 2019 22:20:47 +0200 Subject: [PATCH 19/43] - Fixed anim meshes generated from blendshapes not being copied to output for multi-material meshes - Fixed first vertex of each blendshape on a multi-material mesh having all unmapped vertice offsets being added to it - Fixed blendshapes not importing for multi-material FBX meshes with no bones --- code/FBX/FBXConverter.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/code/FBX/FBXConverter.cpp b/code/FBX/FBXConverter.cpp index a4c1015bf..9f940d322 100644 --- a/code/FBX/FBXConverter.cpp +++ b/code/FBX/FBXConverter.cpp @@ -1247,10 +1247,10 @@ namespace Assimp { ai_assert(count_faces); ai_assert(count_vertices); - // mapping from output indices to DOM indexing, needed to resolve weights + // mapping from output indices to DOM indexing, needed to resolve weights or blendshapes std::vector reverseMapping; std::map translateIndexMap; - if (process_weights) { + if (process_weights || mesh.GetBlendShapes().size() > 0) { reverseMapping.resize(count_vertices); } @@ -1407,7 +1407,10 @@ namespace Assimp { unsigned int count = 0; const unsigned int* outIndices = mesh.ToOutputVertexIndex(index, count); for (unsigned int k = 0; k < count; k++) { - unsigned int index = translateIndexMap[outIndices[k]]; + unsigned int outIndex = outIndices[k]; + if (translateIndexMap.find(outIndex) == translateIndexMap.end()) + continue; + unsigned int index = translateIndexMap[outIndex]; animMesh->mVertices[index] += vertex; if (animMesh->mNormals != nullptr) { animMesh->mNormals[index] += normal; @@ -1421,6 +1424,15 @@ namespace Assimp { } } + const size_t numAnimMeshes = animMeshes.size(); + if (numAnimMeshes > 0) { + out_mesh->mNumAnimMeshes = static_cast(numAnimMeshes); + out_mesh->mAnimMeshes = new aiAnimMesh*[numAnimMeshes]; + for (size_t i = 0; i < numAnimMeshes; i++) { + out_mesh->mAnimMeshes[i] = animMeshes.at(i); + } + } + return static_cast(meshes.size() - 1); } From f2731a1b99b6174c1d33b3c6e4146b1ecf72a097 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:27:59 -0700 Subject: [PATCH 20/43] customize error rate for bind pose --- code/FBX/FBXExporter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 08f4bdbc9..f25b4f135 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -68,6 +68,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include //wangyi + // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure @@ -1840,7 +1842,10 @@ void FBXExporter::WriteObjects () // this should be the same as the bone's mOffsetMatrix. // if it's not the same, the skeleton isn't in the bind pose. - const float epsilon = 1e-4f; // some error is to be expected + float epsilon = 1e-4f; // some error is to be expected +#ifdef ASSIMP_CUSTOM_BINDPOSE_ERR + epsilon = ASSIMP_CUSTOM_BINDPOSE_ERR; +#endif bool bone_xform_okay = true; if (b && ! tr.Equal(b->mOffsetMatrix, epsilon)) { not_in_bind_pose.insert(b); From add4d6028b5da6c2a4c1cf4a9261a7a288715262 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:29:50 -0700 Subject: [PATCH 21/43] clean up --- code/FBX/FBXExporter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index f25b4f135..5367a8525 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -68,8 +68,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include //wangyi - // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure From 36130f9b86d27a8c8600dc5d163d69d9cbb19fef Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Thu, 11 Jul 2019 17:00:47 -0700 Subject: [PATCH 22/43] use ExportProperties to customize bind pose epsilon --- code/FBX/FBXExporter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 5367a8525..915b4aca7 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -67,6 +67,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ @@ -1841,9 +1842,9 @@ void FBXExporter::WriteObjects () // this should be the same as the bone's mOffsetMatrix. // if it's not the same, the skeleton isn't in the bind pose. float epsilon = 1e-4f; // some error is to be expected -#ifdef ASSIMP_CUSTOM_BINDPOSE_ERR - epsilon = ASSIMP_CUSTOM_BINDPOSE_ERR; -#endif + float epsilon_custom = mProperties->GetPropertyFloat("BINDPOSE_EPSILON", -1); + if(epsilon_custom > 0) + epsilon = epsilon_custom; bool bone_xform_okay = true; if (b && ! tr.Equal(b->mOffsetMatrix, epsilon)) { not_in_bind_pose.insert(b); From f04517004878681e4fac09a60f7876a6df4652f2 Mon Sep 17 00:00:00 2001 From: ywang Date: Mon, 15 Jul 2019 15:52:45 -0700 Subject: [PATCH 23/43] update --- code/FBX/FBXExporter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 915b4aca7..dc17fc885 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -67,7 +67,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ From c1670b6a97dc91f7176afc16e21922a4c633bb95 Mon Sep 17 00:00:00 2001 From: kimkulling Date: Tue, 16 Jul 2019 11:40:34 +0200 Subject: [PATCH 24/43] closes https://github.com/assimp/assimp/issues/2548: check if weight are set or set the weight to 1.0f --- code/Collada/ColladaLoader.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/Collada/ColladaLoader.cpp b/code/Collada/ColladaLoader.cpp index 81db957d5..8d4570da8 100644 --- a/code/Collada/ColladaLoader.cpp +++ b/code/Collada/ColladaLoader.cpp @@ -772,10 +772,14 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: for( size_t b = 0; b < pairCount; ++b, ++iit) { - size_t jointIndex = iit->first; - size_t vertexIndex = iit->second; - ai_real weight = ReadFloat( weightsAcc, weights, vertexIndex, 0); + const size_t jointIndex = iit->first; + const size_t vertexIndex = iit->second; + ai_real weight = 1.0f; + if (!weights.mValues.empty()) { + weight = ReadFloat(weightsAcc, weights, vertexIndex, 0); + } + // one day I gonna kill that XSI Collada exporter if( weight > 0.0f) From 2122dc231d25bbf8bb604d11892f0b01cc4bd8e9 Mon Sep 17 00:00:00 2001 From: Merwan Date: Tue, 16 Jul 2019 20:37:41 +0200 Subject: [PATCH 25/43] Fix line continuations in OBJ files --- code/Obj/ObjFileParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Obj/ObjFileParser.cpp b/code/Obj/ObjFileParser.cpp index d1603c6f0..97ef4af70 100644 --- a/code/Obj/ObjFileParser.cpp +++ b/code/Obj/ObjFileParser.cpp @@ -118,7 +118,7 @@ void ObjFileParser::parseFile( IOStreamBuffer &streamBuffer ) { size_t lastFilePos( 0 ); std::vector buffer; - while ( streamBuffer.getNextDataLine( buffer, '\0' ) ) { + while ( streamBuffer.getNextDataLine( buffer, '\\' ) ) { m_DataIt = buffer.begin(); m_DataItEnd = buffer.end(); From 9210ff37f2433e016cb8b83d62f9064ed0428e8d Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Tue, 9 Jul 2019 19:05:45 -0700 Subject: [PATCH 26/43] fix group node being exported as bone node --- code/FBX/FBXExporter.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index dd34e135f..a0a46e09d 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -1617,6 +1617,17 @@ void FBXExporter::WriteObjects () // at the same time we can build a list of all the skeleton nodes, // which will be used later to mark them as type "limbNode". std::unordered_set limbnodes; + + //actual bone nodes in fbx, without parenting-up + std::set setAllBoneNamesInScene; + for(int m = 0; m < mScene->mNumMeshes; ++ m) + { + aiMesh* pMesh = mScene->mMeshes[m]; + for(int b = 0; b < pMesh->mNumBones; ++ b) + setAllBoneNamesInScene.insert(pMesh->mBones[b]->mName.data); + } + aiMatrix4x4 mxTransIdentity; + // and a map of nodes by bone name, as finding them is annoying. std::map node_by_bone; for (size_t mi = 0; mi < mScene->mNumMeshes; ++mi) { @@ -1660,6 +1671,11 @@ void FBXExporter::WriteObjects () if (node_name.find(MAGIC_NODE_TAG) != std::string::npos) { continue; } + //not a bone in scene && no effect in transform + if(setAllBoneNamesInScene.find(node_name)==setAllBoneNamesInScene.end() + && parent->mTransformation == mxTransIdentity) { + continue; + } // otherwise check if this is the root of the skeleton bool end = false; // is the mesh part of this node? From c889699d581f2acbef899120be60104c5b1127cb Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 09:51:20 -0700 Subject: [PATCH 27/43] set->unordered_set;unsigned int for iteration --- code/FBX/FBXExporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index a0a46e09d..08f4bdbc9 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -1619,11 +1619,11 @@ void FBXExporter::WriteObjects () std::unordered_set limbnodes; //actual bone nodes in fbx, without parenting-up - std::set setAllBoneNamesInScene; - for(int m = 0; m < mScene->mNumMeshes; ++ m) + std::unordered_set setAllBoneNamesInScene; + for(unsigned int m = 0; m < mScene->mNumMeshes; ++ m) { aiMesh* pMesh = mScene->mMeshes[m]; - for(int b = 0; b < pMesh->mNumBones; ++ b) + for(unsigned int b = 0; b < pMesh->mNumBones; ++ b) setAllBoneNamesInScene.insert(pMesh->mBones[b]->mName.data); } aiMatrix4x4 mxTransIdentity; From cdf60d7423200890b9740715fb0ef1a65f5da6f0 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:27:59 -0700 Subject: [PATCH 28/43] customize error rate for bind pose --- code/FBX/FBXExporter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 08f4bdbc9..f25b4f135 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -68,6 +68,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include //wangyi + // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure @@ -1840,7 +1842,10 @@ void FBXExporter::WriteObjects () // this should be the same as the bone's mOffsetMatrix. // if it's not the same, the skeleton isn't in the bind pose. - const float epsilon = 1e-4f; // some error is to be expected + float epsilon = 1e-4f; // some error is to be expected +#ifdef ASSIMP_CUSTOM_BINDPOSE_ERR + epsilon = ASSIMP_CUSTOM_BINDPOSE_ERR; +#endif bool bone_xform_okay = true; if (b && ! tr.Equal(b->mOffsetMatrix, epsilon)) { not_in_bind_pose.insert(b); From 6e0810d3c1e31f347ea2dff60ef7202bc9c5f802 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:29:50 -0700 Subject: [PATCH 29/43] clean up --- code/FBX/FBXExporter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index f25b4f135..5367a8525 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -68,8 +68,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include //wangyi - // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure From 6299c58fae951302e67381921de55994b9125517 Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Thu, 11 Jul 2019 17:00:47 -0700 Subject: [PATCH 30/43] use ExportProperties to customize bind pose epsilon --- code/FBX/FBXExporter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 5367a8525..915b4aca7 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -67,6 +67,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ @@ -1841,9 +1842,9 @@ void FBXExporter::WriteObjects () // this should be the same as the bone's mOffsetMatrix. // if it's not the same, the skeleton isn't in the bind pose. float epsilon = 1e-4f; // some error is to be expected -#ifdef ASSIMP_CUSTOM_BINDPOSE_ERR - epsilon = ASSIMP_CUSTOM_BINDPOSE_ERR; -#endif + float epsilon_custom = mProperties->GetPropertyFloat("BINDPOSE_EPSILON", -1); + if(epsilon_custom > 0) + epsilon = epsilon_custom; bool bone_xform_okay = true; if (b && ! tr.Equal(b->mOffsetMatrix, epsilon)) { not_in_bind_pose.insert(b); From 5121a835b5021a2262e71550fd876688fd9c72ae Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:27:59 -0700 Subject: [PATCH 31/43] customize error rate for bind pose --- code/FBX/FBXExporter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 915b4aca7..7419f3d15 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -69,6 +69,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include //wangyi + // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure From e3683e49e4476aaba44fe5b9484091413ea35f7f Mon Sep 17 00:00:00 2001 From: thomasbiang Date: Wed, 10 Jul 2019 16:29:50 -0700 Subject: [PATCH 32/43] clean up --- code/FBX/FBXExporter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 7419f3d15..915b4aca7 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -69,8 +69,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include //wangyi - // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ // https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure From e1e9d92c01e0f38f0da2b02ca4acb409f84eedb2 Mon Sep 17 00:00:00 2001 From: ywang Date: Mon, 15 Jul 2019 15:52:45 -0700 Subject: [PATCH 33/43] update --- code/FBX/FBXExporter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/FBX/FBXExporter.cpp b/code/FBX/FBXExporter.cpp index 915b4aca7..dc17fc885 100644 --- a/code/FBX/FBXExporter.cpp +++ b/code/FBX/FBXExporter.cpp @@ -67,7 +67,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include // RESOURCES: // https://code.blender.org/2013/08/fbx-binary-file-format-specification/ From 2f6a005fb8c0f5830e03ad6dfe218810d3aebadf Mon Sep 17 00:00:00 2001 From: Merwan Date: Wed, 17 Jul 2019 18:19:17 +0200 Subject: [PATCH 34/43] Add unit test for OBJ line continuations --- test/unit/utObjImportExport.cpp | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/unit/utObjImportExport.cpp b/test/unit/utObjImportExport.cpp index bb0d36b13..8156091b8 100644 --- a/test/unit/utObjImportExport.cpp +++ b/test/unit/utObjImportExport.cpp @@ -448,3 +448,37 @@ TEST_F(utObjImportExport, import_without_linend) { const aiScene *scene = myImporter.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/box_without_lineending.obj", 0); ASSERT_NE(nullptr, scene); } + +TEST_F(utObjImportExport, import_with_line_continuations) { + static const char *ObjModel = + "v -0.5 -0.5 0.5\n" + "v -0.5 \\\n" + " -0.5 -0.5\n" + "v -0.5 \\\n" + " 0.5 \\\n" + " -0.5\n" + "f 1 2 3\n"; + + Assimp::Importer myImporter; + const aiScene *scene = myImporter.ReadFileFromMemory(ObjModel, strlen(ObjModel), 0); + EXPECT_NE(nullptr, scene); + + EXPECT_EQ(scene->mNumMeshes, 1U); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 3U); + EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 1U); + + auto vertices = scene->mMeshes[0]->mVertices; + const float threshold = 0.0001f; + + EXPECT_NEAR(vertices[0].x, -0.5f, threshold); + EXPECT_NEAR(vertices[0].y, -0.5f, threshold); + EXPECT_NEAR(vertices[0].z, 0.5f, threshold); + + EXPECT_NEAR(vertices[1].x, -0.5f, threshold); + EXPECT_NEAR(vertices[1].y, -0.5f, threshold); + EXPECT_NEAR(vertices[1].z, -0.5f, threshold); + + EXPECT_NEAR(vertices[2].x, -0.5f, threshold); + EXPECT_NEAR(vertices[2].y, 0.5f, threshold); + EXPECT_NEAR(vertices[2].z, -0.5f, threshold); +} From a8019cf8d896d70349f13abd2d233efc62179768 Mon Sep 17 00:00:00 2001 From: kkulling Date: Fri, 19 Jul 2019 10:38:44 +0200 Subject: [PATCH 35/43] Unit: Fix new compiler warnings. --- code/Collada/ColladaLoader.cpp | 198 ++++++++++++++-------------- test/unit/utFBXImporterExporter.cpp | 39 +++--- test/unit/utSortByPType.cpp | 3 +- test/unit/utglTF2ImportExport.cpp | 135 +++++++++---------- 4 files changed, 182 insertions(+), 193 deletions(-) diff --git a/code/Collada/ColladaLoader.cpp b/code/Collada/ColladaLoader.cpp index 8d4570da8..e10edb732 100644 --- a/code/Collada/ColladaLoader.cpp +++ b/code/Collada/ColladaLoader.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -43,7 +41,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file Implementation of the Collada loader */ - #ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER #include "ColladaLoader.h" @@ -67,7 +64,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -using namespace Assimp; +namespace Assimp { + using namespace Assimp::Formatter; static const aiImporterDesc desc = { @@ -112,7 +110,7 @@ ColladaLoader::~ColladaLoader() { // Returns whether the class can handle the format of the given file. bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const { // check file extension - std::string extension = GetExtension(pFile); + const std::string extension = GetExtension(pFile); if (extension == "dae") { return true; @@ -166,12 +164,13 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I // parse the input file ColladaParser parser( pIOHandler, pFile); - if( !parser.mRootNode) + if( !parser.mRootNode) { throw DeadlyImportError( "Collada: File came out empty. Something is wrong here."); + } // reserve some storage to avoid unnecessary reallocs - newMats.reserve(parser.mMaterialLibrary.size()*2); - mMeshes.reserve(parser.mMeshLibrary.size()*2); + newMats.reserve(parser.mMaterialLibrary.size()*2u); + mMeshes.reserve(parser.mMeshLibrary.size()*2u); mCameras.reserve(parser.mCameraLibrary.size()); mLights.reserve(parser.mLightLibrary.size()); @@ -191,19 +190,20 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I 0, 0, parser.mUnitSize, 0, 0, 0, 0, 1); if( !ignoreUpDirection ) { - // Convert to Y_UP, if different orientation - if( parser.mUpDirection == ColladaParser::UP_X) - pScene->mRootNode->mTransformation *= aiMatrix4x4( - 0, -1, 0, 0, - 1, 0, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1); - else if( parser.mUpDirection == ColladaParser::UP_Z) - pScene->mRootNode->mTransformation *= aiMatrix4x4( - 1, 0, 0, 0, - 0, 0, 1, 0, - 0, -1, 0, 0, - 0, 0, 0, 1); + // Convert to Y_UP, if different orientation + if( parser.mUpDirection == ColladaParser::UP_X) { + pScene->mRootNode->mTransformation *= aiMatrix4x4( + 0, -1, 0, 0, + 1, 0, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + } else if( parser.mUpDirection == ColladaParser::UP_Z) { + pScene->mRootNode->mTransformation *= aiMatrix4x4( + 1, 0, 0, 0, + 0, 0, 1, 0, + 0, -1, 0, 0, + 0, 0, 0, 1); + } } // Store scene metadata @@ -211,8 +211,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I const size_t numMeta(parser.mAssetMetaData.size()); pScene->mMetaData = aiMetadata::Alloc(static_cast(numMeta)); size_t i = 0; - for (auto it = parser.mAssetMetaData.cbegin(); it != parser.mAssetMetaData.cend(); ++it, ++i) - { + for (auto it = parser.mAssetMetaData.cbegin(); it != parser.mAssetMetaData.cend(); ++it, ++i) { pScene->mMetaData->Set(static_cast(i), (*it).first, (*it).second); } } @@ -232,9 +231,8 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I // store all animations StoreAnimations( pScene, parser); - // If no meshes have been loaded, it's probably just an animated skeleton. - if (!pScene->mNumMeshes) { + if ( 0u == pScene->mNumMeshes) { if (!noSkeletonMesh) { SkeletonMeshBuilder hero(pScene); @@ -302,13 +300,12 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co // FIX for http://sourceforge.net/tracker/?func=detail&aid=3054873&group_id=226462&atid=1067632 // need to check for both name and ID to catch all. To avoid breaking valid files, // the workaround is only enabled when the first attempt to resolve the node has failed. - if (!nd) { + if (nullptr == nd) { nd = FindNode(pParser.mRootNode, nodeInst.mNode); } - if (!nd) + if (nullptr == nd) { ASSIMP_LOG_ERROR_F("Collada: Unable to resolve reference to instanced node ", nodeInst.mNode); - - else { + } else { // attach this node to the list of children resolved.push_back(nd); } @@ -318,7 +315,7 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co // ------------------------------------------------------------------------------------------------ // Resolve UV channels void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler, - const Collada::SemanticMappingTable& table) { + const Collada::SemanticMappingTable& table) { std::map::const_iterator it = table.mMap.find(sampler.mUVChannel); if (it != table.mMap.end()) { if (it->second.mType != Collada::IT_Texcoord) { @@ -431,8 +428,7 @@ void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Col out->mAspect = std::tan(AI_DEG_TO_RAD(srcCamera->mHorFov)) / std::tan(AI_DEG_TO_RAD(srcCamera->mVerFov)); } - } - else if (srcCamera->mAspect != 10e10f && srcCamera->mVerFov != 10e10f) { + } else if (srcCamera->mAspect != 10e10f && srcCamera->mVerFov != 10e10f) { out->mHorizontalFOV = 2.0f * AI_RAD_TO_DEG(std::atan(srcCamera->mAspect * std::tan(AI_DEG_TO_RAD(srcCamera->mVerFov) * 0.5f))); } @@ -470,7 +466,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll } } - if( !srcMesh) { + if( nullptr == srcMesh) { ASSIMP_LOG_WARN_F( "Collada: Unable to find geometry for ID \"", mid.mMeshOrController, "\". Skipping." ); continue; } @@ -770,16 +766,13 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: IndexPairVector::const_iterator iit = weightStartPerVertex[orgIndex]; size_t pairCount = pSrcController->mWeightCounts[orgIndex]; - for( size_t b = 0; b < pairCount; ++b, ++iit) - { - + for( size_t b = 0; b < pairCount; ++b, ++iit) { const size_t jointIndex = iit->first; const size_t vertexIndex = iit->second; ai_real weight = 1.0f; if (!weights.mValues.empty()) { weight = ReadFloat(weightsAcc, weights, vertexIndex, 0); } - // one day I gonna kill that XSI Collada exporter if( weight > 0.0f) @@ -794,19 +787,21 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: // count the number of bones which influence vertices of the current submesh size_t numRemainingBones = 0; - for( std::vector >::const_iterator it = dstBones.begin(); it != dstBones.end(); ++it) - if( it->size() > 0) - numRemainingBones++; + for( std::vector >::const_iterator it = dstBones.begin(); it != dstBones.end(); ++it) { + if( it->size() > 0) { + ++numRemainingBones; + } + } // create bone array and copy bone weights one by one dstMesh->mNumBones = static_cast(numRemainingBones); dstMesh->mBones = new aiBone*[numRemainingBones]; size_t boneCount = 0; - for( size_t a = 0; a < numBones; ++a) - { + for( size_t a = 0; a < numBones; ++a) { // omit bones without weights - if( dstBones[a].size() == 0) + if( dstBones[a].empty() ) { continue; + } // create bone with its weights aiBone* bone = new aiBone; @@ -852,14 +847,16 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: // and replace the bone's name by the node's name so that the user can use the standard // find-by-name method to associate nodes with bones. const Collada::Node* bnode = FindNode( pParser.mRootNode, bone->mName.data); - if( !bnode) + if( !bnode) { bnode = FindNodeBySID( pParser.mRootNode, bone->mName.data); + } // assign the name that we would have assigned for the source node - if( bnode) + if( bnode) { bone->mName.Set( FindNameForNode( bnode)); - else + } else { ASSIMP_LOG_WARN_F( "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"", bone->mName.data, "\"." ); + } // and insert bone dstMesh->mBones[boneCount++] = bone; @@ -871,89 +868,80 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: // ------------------------------------------------------------------------------------------------ // Stores all meshes in the given scene -void ColladaLoader::StoreSceneMeshes( aiScene* pScene) -{ +void ColladaLoader::StoreSceneMeshes( aiScene* pScene) { pScene->mNumMeshes = static_cast(mMeshes.size()); - if( mMeshes.size() > 0) - { - pScene->mMeshes = new aiMesh*[mMeshes.size()]; - std::copy( mMeshes.begin(), mMeshes.end(), pScene->mMeshes); - mMeshes.clear(); + if( mMeshes.empty() ) { + return; } + pScene->mMeshes = new aiMesh*[mMeshes.size()]; + std::copy( mMeshes.begin(), mMeshes.end(), pScene->mMeshes); + mMeshes.clear(); } // ------------------------------------------------------------------------------------------------ // Stores all cameras in the given scene -void ColladaLoader::StoreSceneCameras( aiScene* pScene) -{ +void ColladaLoader::StoreSceneCameras( aiScene* pScene) { pScene->mNumCameras = static_cast(mCameras.size()); - if( mCameras.size() > 0) - { - pScene->mCameras = new aiCamera*[mCameras.size()]; - std::copy( mCameras.begin(), mCameras.end(), pScene->mCameras); - mCameras.clear(); + if( mCameras.empty() ) { + return; } + pScene->mCameras = new aiCamera*[mCameras.size()]; + std::copy( mCameras.begin(), mCameras.end(), pScene->mCameras); + mCameras.clear(); } // ------------------------------------------------------------------------------------------------ // Stores all lights in the given scene -void ColladaLoader::StoreSceneLights( aiScene* pScene) -{ +void ColladaLoader::StoreSceneLights( aiScene* pScene) { pScene->mNumLights = static_cast(mLights.size()); - if( mLights.size() > 0) - { - pScene->mLights = new aiLight*[mLights.size()]; - std::copy( mLights.begin(), mLights.end(), pScene->mLights); - mLights.clear(); + if( mLights.empty() ) { + return; } + pScene->mLights = new aiLight*[mLights.size()]; + std::copy( mLights.begin(), mLights.end(), pScene->mLights); + mLights.clear(); } // ------------------------------------------------------------------------------------------------ // Stores all textures in the given scene -void ColladaLoader::StoreSceneTextures( aiScene* pScene) -{ +void ColladaLoader::StoreSceneTextures( aiScene* pScene) { pScene->mNumTextures = static_cast(mTextures.size()); - if( mTextures.size() > 0) - { - pScene->mTextures = new aiTexture*[mTextures.size()]; - std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures); - mTextures.clear(); + if( mTextures.empty() ) { + return; } + pScene->mTextures = new aiTexture*[mTextures.size()]; + std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures); + mTextures.clear(); } // ------------------------------------------------------------------------------------------------ // Stores all materials in the given scene -void ColladaLoader::StoreSceneMaterials( aiScene* pScene) -{ +void ColladaLoader::StoreSceneMaterials( aiScene* pScene) { pScene->mNumMaterials = static_cast(newMats.size()); - - if (newMats.size() > 0) { - pScene->mMaterials = new aiMaterial*[newMats.size()]; - for (unsigned int i = 0; i < newMats.size();++i) - pScene->mMaterials[i] = newMats[i].second; - - newMats.clear(); + if (newMats.empty() ) { + return; } + pScene->mMaterials = new aiMaterial*[newMats.size()]; + for (unsigned int i = 0; i < newMats.size();++i) { + pScene->mMaterials[i] = newMats[i].second; + } + newMats.clear(); } // ------------------------------------------------------------------------------------------------ // Stores all animations -void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser) -{ +void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser) { // recursively collect all animations from the collada scene StoreAnimations( pScene, pParser, &pParser.mAnims, ""); // catch special case: many animations with the same length, each affecting only a single node. // we need to unite all those single-node-anims to a proper combined animation - for( size_t a = 0; a < mAnims.size(); ++a) - { + for( size_t a = 0; a < mAnims.size(); ++a) { aiAnimation* templateAnim = mAnims[a]; - if( templateAnim->mNumChannels == 1) - { + if( templateAnim->mNumChannels == 1) { // search for other single-channel-anims with the same duration std::vector collectedAnimIndices; - for( size_t b = a+1; b < mAnims.size(); ++b) - { + for( size_t b = a+1; b < mAnims.size(); ++b) { aiAnimation* other = mAnims[b]; if( other->mNumChannels == 1 && other->mDuration == templateAnim->mDuration && other->mTicksPerSecond == templateAnim->mTicksPerSecond ) @@ -1884,19 +1872,23 @@ const Collada::Node* ColladaLoader::FindNode( const Collada::Node* pNode, const // ------------------------------------------------------------------------------------------------ // Finds a node in the collada scene by the given SID -const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, const std::string& pSID) const -{ - if( pNode->mSID == pSID) - return pNode; +const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, const std::string& pSID) const { + if (nullptr == pNode) { + return nullptr; + } - for( size_t a = 0; a < pNode->mChildren.size(); ++a) - { - const Collada::Node* node = FindNodeBySID( pNode->mChildren[a], pSID); - if( node) - return node; - } + if (pNode->mSID == pSID) { + return pNode; + } - return NULL; + for( size_t a = 0; a < pNode->mChildren.size(); ++a) { + const Collada::Node* node = FindNodeBySID( pNode->mChildren[a], pSID); + if (node) { + return node; + } + } + + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -1930,4 +1922,6 @@ std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode) } } +} // Namespace Assimp + #endif // !! ASSIMP_BUILD_NO_DAE_IMPORTER diff --git a/test/unit/utFBXImporterExporter.cpp b/test/unit/utFBXImporterExporter.cpp index 3180d96a2..ecba5ee1e 100644 --- a/test/unit/utFBXImporterExporter.cpp +++ b/test/unit/utFBXImporterExporter.cpp @@ -70,10 +70,10 @@ TEST_F( utFBXImporterExporter, importBareBoxWithoutColorsAndTextureCoords ) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/FBX/box.fbx", aiProcess_ValidateDataStructure ); EXPECT_NE( nullptr, scene ); - EXPECT_EQ(scene->mNumMeshes, 1); + EXPECT_EQ(scene->mNumMeshes, 1u); aiMesh* mesh = scene->mMeshes[0]; - EXPECT_EQ(mesh->mNumFaces, 12); - EXPECT_EQ(mesh->mNumVertices, 36); + EXPECT_EQ(mesh->mNumFaces, 12u); + EXPECT_EQ(mesh->mNumVertices, 36u); } TEST_F(utFBXImporterExporter, importCubesWithNoNames) { @@ -85,13 +85,13 @@ TEST_F(utFBXImporterExporter, importCubesWithNoNames) { const auto root = scene->mRootNode; ASSERT_STREQ(root->mName.C_Str(), "RootNode"); ASSERT_TRUE(root->mChildren); - ASSERT_EQ(root->mNumChildren, 2); + ASSERT_EQ(root->mNumChildren, 2u); const auto child0 = root->mChildren[0]; ASSERT_TRUE(child0); ASSERT_STREQ(child0->mName.C_Str(), "RootNode001"); ASSERT_TRUE(child0->mChildren); - ASSERT_EQ(child0->mNumChildren, 1); + ASSERT_EQ(child0->mNumChildren, 1u); const auto child00 = child0->mChildren[0]; ASSERT_TRUE(child00); @@ -101,7 +101,7 @@ TEST_F(utFBXImporterExporter, importCubesWithNoNames) { ASSERT_TRUE(child1); ASSERT_STREQ(child1->mName.C_Str(), "RootNode002"); ASSERT_TRUE(child1->mChildren); - ASSERT_EQ(child1->mNumChildren, 1); + ASSERT_EQ(child1->mNumChildren, 1u); const auto child10 = child1->mChildren[0]; ASSERT_TRUE(child10); @@ -117,13 +117,13 @@ TEST_F(utFBXImporterExporter, importCubesWithUnicodeDuplicatedNames) { const auto root = scene->mRootNode; ASSERT_STREQ(root->mName.C_Str(), "RootNode"); ASSERT_TRUE(root->mChildren); - ASSERT_EQ(root->mNumChildren, 2); + ASSERT_EQ(root->mNumChildren, 2u); const auto child0 = root->mChildren[0]; ASSERT_TRUE(child0); ASSERT_STREQ(child0->mName.C_Str(), "Cube2"); ASSERT_TRUE(child0->mChildren); - ASSERT_EQ(child0->mNumChildren, 1); + ASSERT_EQ(child0->mNumChildren, 1u); const auto child00 = child0->mChildren[0]; ASSERT_TRUE(child00); @@ -133,7 +133,7 @@ TEST_F(utFBXImporterExporter, importCubesWithUnicodeDuplicatedNames) { ASSERT_TRUE(child1); ASSERT_STREQ(child1->mName.C_Str(), "Cube3"); ASSERT_TRUE(child1->mChildren); - ASSERT_EQ(child1->mNumChildren, 1); + ASSERT_EQ(child1->mNumChildren, 1u); const auto child10 = child1->mChildren[0]; ASSERT_TRUE(child10); @@ -149,13 +149,13 @@ TEST_F(utFBXImporterExporter, importCubesComplexTransform) { const auto root = scene->mRootNode; ASSERT_STREQ(root->mName.C_Str(), "RootNode"); ASSERT_TRUE(root->mChildren); - ASSERT_EQ(root->mNumChildren, 2); + ASSERT_EQ(root->mNumChildren, 2u); const auto child0 = root->mChildren[0]; ASSERT_TRUE(child0); ASSERT_STREQ(child0->mName.C_Str(), "Cube2"); ASSERT_TRUE(child0->mChildren); - ASSERT_EQ(child0->mNumChildren, 1); + ASSERT_EQ(child0->mNumChildren, 1u); const auto child00 = child0->mChildren[0]; ASSERT_TRUE(child00); @@ -177,10 +177,9 @@ TEST_F(utFBXImporterExporter, importCubesComplexTransform) { "Cube1001_$AssimpFbx$_ScalingPivotInverse", "Cube1001" }; - for (size_t i = 0; i < chain_length; ++i) - { + for (size_t i = 0; i < chain_length; ++i) { ASSERT_TRUE(parent->mChildren); - ASSERT_EQ(parent->mNumChildren, 1); + ASSERT_EQ(parent->mNumChildren, 1u); auto node = parent->mChildren[0]; ASSERT_TRUE(node); ASSERT_STREQ(node->mName.C_Str(), chainStr[i]); @@ -193,19 +192,21 @@ TEST_F( utFBXImporterExporter, importPhongMaterial ) { Assimp::Importer importer; const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/FBX/phong_cube.fbx", aiProcess_ValidateDataStructure ); EXPECT_NE( nullptr, scene ); - EXPECT_EQ( (unsigned int)1, scene->mNumMaterials ); + EXPECT_EQ( 1u, scene->mNumMaterials ); const aiMaterial *mat = scene->mMaterials[0]; EXPECT_NE( nullptr, mat ); - float f; aiColor3D c; + float f; + aiColor3D c; + // phong_cube.fbx has all properties defined EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_DIFFUSE, c), aiReturn_SUCCESS ); EXPECT_EQ( c, aiColor3D(0.5, 0.25, 0.25) ); EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_SPECULAR, c), aiReturn_SUCCESS ); EXPECT_EQ( c, aiColor3D(0.25, 0.25, 0.5) ); EXPECT_EQ( mat->Get(AI_MATKEY_SHININESS_STRENGTH, f), aiReturn_SUCCESS ); - EXPECT_EQ( f, 0.5 ); + EXPECT_EQ( f, 0.5f ); EXPECT_EQ( mat->Get(AI_MATKEY_SHININESS, f), aiReturn_SUCCESS ); - EXPECT_EQ( f, 10.0 ); + EXPECT_EQ( f, 10.0f ); EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_AMBIENT, c), aiReturn_SUCCESS ); EXPECT_EQ( c, aiColor3D(0.125, 0.25, 0.25) ); EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_EMISSIVE, c), aiReturn_SUCCESS ); @@ -213,7 +214,7 @@ TEST_F( utFBXImporterExporter, importPhongMaterial ) { EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_TRANSPARENT, c), aiReturn_SUCCESS ); EXPECT_EQ( c, aiColor3D(0.75, 0.5, 0.25) ); EXPECT_EQ( mat->Get(AI_MATKEY_OPACITY, f), aiReturn_SUCCESS ); - EXPECT_EQ( f, 0.5 ); + EXPECT_EQ( f, 0.5f ); } TEST_F(utFBXImporterExporter, importUnitScaleFactor) { diff --git a/test/unit/utSortByPType.cpp b/test/unit/utSortByPType.cpp index 749e618da..fb637b004 100644 --- a/test/unit/utSortByPType.cpp +++ b/test/unit/utSortByPType.cpp @@ -183,8 +183,7 @@ TEST_F(SortByPTypeProcessTest, SortByPTypeStep) { unsigned int idx = 0; for (unsigned int m = 0,real = 0; m< 10;++m) { for (unsigned int n = 0; n < 4;++n) { - if ((idx = num[m][n])) - { + if ((idx = num[m][n])) { EXPECT_TRUE(real < mScene->mNumMeshes); aiMesh* mesh = mScene->mMeshes[real]; diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index bac76473d..4104fe6b7 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -55,17 +53,23 @@ 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", aiProcess_ValidateDataStructure); + const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", + aiProcess_ValidateDataStructure); EXPECT_NE( scene, nullptr ); - if ( !scene ) return false; + if (!scene) { + return false; + } EXPECT_TRUE( scene->HasMaterials() ); - if ( !scene->HasMaterials() ) return false; + if (!scene->HasMaterials()) { + return false; + } const aiMaterial *material = scene->mMaterials[0]; aiString path; aiTextureMapMode modes[2]; - EXPECT_EQ( aiReturn_SUCCESS, material->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes) ); + EXPECT_EQ( aiReturn_SUCCESS, material->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, + nullptr, nullptr, modes) ); EXPECT_STREQ( path.C_Str(), "CesiumLogoFlat.png" ); EXPECT_EQ( modes[0], aiTextureMapMode_Mirror ); EXPECT_EQ( modes[1], aiTextureMapMode_Clamp ); @@ -75,7 +79,8 @@ public: virtual bool binaryImporterTest() { Assimp::Importer importer; - const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/2CylinderEngine-glTF-Binary/2CylinderEngine.glb", aiProcess_ValidateDataStructure); + const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/2CylinderEngine-glTF-Binary/2CylinderEngine.glb", + aiProcess_ValidateDataStructure); return nullptr != scene; } @@ -83,7 +88,8 @@ public: virtual bool exporterTest() { Assimp::Importer importer; Assimp::Exporter exporter; - const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure ); + 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" ) ); @@ -105,7 +111,8 @@ TEST_F( utglTF2ImportExport, importBinaryglTF2FromFileTest ) { TEST_F(utglTF2ImportExport, importglTF2AndExportToOBJ) { Assimp::Importer importer; Assimp::Exporter exporter; - const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure); + 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, "obj", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured_out.obj")); } @@ -113,7 +120,8 @@ TEST_F(utglTF2ImportExport, importglTF2AndExportToOBJ) { TEST_F(utglTF2ImportExport, importglTF2EmbeddedAndExportToOBJ) { Assimp::Importer importer; Assimp::Exporter exporter; - const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-Embedded/BoxTextured.gltf", aiProcess_ValidateDataStructure); + const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-Embedded/BoxTextured.gltf", + aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "obj", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-Embedded/BoxTextured_out.obj")); } @@ -124,10 +132,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePointsWithoutIndices) { //Points without indices const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_00.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024); - for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) - { - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024u); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1u); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i); } } @@ -137,12 +144,11 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesWithoutIndices) { //Lines without indices const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_01.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 8); - for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) - { - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2); - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i*2); - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i*2 + 1); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 8u); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i*2u); + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i*2u + 1u); } } @@ -153,13 +159,12 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesLoopWithoutIndices) { EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - std::array l1 = {{ 0, 1, 2, 3, 0 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); - for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) - { - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2); + std::array l1 = {{ 0, 1, 2, 3, 0 }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]); + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1u]); } } @@ -171,11 +176,10 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesStripWithoutIndices) { EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 5); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); - for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) - { - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i); - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i + 1); + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i + 1u); } } @@ -184,19 +188,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStripWithoutIndices //Triangles strip without indices const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_04.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - std::array f1 = {{ 0, 1, 2 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); + std::array f1 = {{ 0, 1, 2 }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); + for (unsigned int i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 2, 1, 3 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + std::array f2 = {{ 2u, 1u, 3u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u); + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); } } @@ -206,19 +208,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFanWithoutIndices) //Triangles fan without indices const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_05.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); + EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); std::array f1 = {{ 0, 1, 2 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 0, 2, 3 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + std::array f2 = {{ 0, 2, 3 }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u); + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); } } @@ -228,19 +228,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesWithoutIndices) { //Triangles without indices const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_06.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 6); - std::array f1 = {{ 0, 1, 2 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 6u); + std::array f1 = {{ 0u, 1u, 2u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 3, 4, 5 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + std::array f2 = {{ 3u, 4u, 5u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u); + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); } } @@ -250,10 +248,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePoints) { //Line loop const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024); - for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) - { - EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024u); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1u); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i); } } @@ -264,8 +261,8 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLines) { const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - std::array l1 = {{ 0, 3, 2, 1, 0 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); + std::array l1 = {{ 0, 3, 2, 1, 0 }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); @@ -334,15 +331,13 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) { EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); std::array f1 = {{ 0, 3, 2 }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 0, 2, 1 }}; + std::array f2 = {{ 0, 2, 1 }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); } } From 3416c04ad986837825ae799bf7dfab37b6aaf081 Mon Sep 17 00:00:00 2001 From: kimkulling Date: Fri, 19 Jul 2019 11:26:48 +0200 Subject: [PATCH 36/43] Unit: fix more compiler warnings. --- test/unit/utFBXImporterExporter.cpp | 8 ++-- test/unit/utglTF2ImportExport.cpp | 64 ++++++++++++++--------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/test/unit/utFBXImporterExporter.cpp b/test/unit/utFBXImporterExporter.cpp index ecba5ee1e..1c7117319 100644 --- a/test/unit/utFBXImporterExporter.cpp +++ b/test/unit/utFBXImporterExporter.cpp @@ -185,7 +185,7 @@ TEST_F(utFBXImporterExporter, importCubesComplexTransform) { ASSERT_STREQ(node->mName.C_Str(), chainStr[i]); parent = node; } - ASSERT_EQ(0, parent->mNumChildren) << "Leaf node"; + ASSERT_EQ(0u, parent->mNumChildren) << "Leaf node"; } TEST_F( utFBXImporterExporter, importPhongMaterial ) { @@ -244,7 +244,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) { EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes)); ASSERT_STREQ(path.C_Str(), "..\\..\\..\\Desktop\\uv_test.png"); - ASSERT_EQ(1, scene->mNumTextures); + ASSERT_EQ(1u, scene->mNumTextures); ASSERT_TRUE(scene->mTextures[0]->pcData); ASSERT_EQ(439176u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture"; } @@ -255,7 +255,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedFragmentedAsciiTest) { const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box_embedded_texture_fragmented.fbx", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(1, scene->mNumMaterials); + EXPECT_EQ(1u, scene->mNumMaterials); aiMaterial *mat = scene->mMaterials[0]; ASSERT_NE(nullptr, mat); @@ -264,7 +264,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedFragmentedAsciiTest) { ASSERT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes)); ASSERT_STREQ(path.C_Str(), "paper.png"); - ASSERT_EQ(1, scene->mNumTextures); + ASSERT_EQ(1u, scene->mNumTextures); ASSERT_TRUE(scene->mTextures[0]->pcData); ASSERT_EQ(968029u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture"; } diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 4104fe6b7..2399f3371 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -157,9 +157,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesLoopWithoutIndices) { //Lines loop without indices const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); - std::array l1 = {{ 0, 1, 2, 3, 0 }}; + std::array l1 = {{ 0u, 1u, 2u, 3u, 0u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); @@ -173,9 +173,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesStripWithoutIndices) { //Lines strip without indices const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 5); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 5u); - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i); @@ -190,7 +190,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStripWithoutIndices EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); - std::array f1 = {{ 0, 1, 2 }}; + std::array f1 = {{ 0u, 1u, 2u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); for (unsigned int i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); @@ -210,13 +210,13 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFanWithoutIndices) EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); - std::array f1 = {{ 0, 1, 2 }}; + std::array f1 = {{ 0u, 1u, 2u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 0, 2, 3 }}; + std::array f2 = {{ 0u, 2u, 3u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); @@ -260,8 +260,8 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLines) { //Lines const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - std::array l1 = {{ 0, 3, 2, 1, 0 }}; + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); + std::array l1 = {{ 0u, 3u, 2u, 1u, 0u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { @@ -275,9 +275,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) { //Line loop const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - std::array l1 = {{ 0, 3, 2, 1, 0 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); + std::array l1 = {{ 0, 3u, 2u, 1u, 0u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); @@ -290,11 +290,10 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineStrip) { //Lines Strip const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - std::array l1 = {{ 0, 3, 2, 1, 0 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); - for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) - { + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); + std::array l1 = {{ 0u, 3u, 2u, 1u, 0u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]); } @@ -305,19 +304,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStrip) { //Triangles strip const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - std::array f1 = {{ 0, 3, 1 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); + std::array f1 = {{ 0u, 3u, 1u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 1, 3, 2 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); - for (int i = 0; i < 3; ++i) - { + std::array f2 = {{ 1u, 3u, 2u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u); + for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); } } @@ -327,16 +324,16 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) { //Triangles fan const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); - EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); - std::array f1 = {{ 0, 3, 2 }}; + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); + EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); + std::array f1 = {{ 0u, 3u, 2u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 0, 2, 1 }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); + std::array f2 = {{ 0u, 2u, 1u }}; + EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u ); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); } @@ -373,7 +370,8 @@ TEST_F(utglTF2ImportExport, importglTF2FromMemory) { TEST_F( utglTF2ImportExport, bug_import_simple_skin ) { Assimp::Importer importer; - const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/simple_skin/simple_skin.gltf", aiProcess_ValidateDataStructure ); + const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/simple_skin/simple_skin.gltf", + aiProcess_ValidateDataStructure ); EXPECT_NE( nullptr, scene ); } From 68520bff0ccbff35167097cec42ef129749f5158 Mon Sep 17 00:00:00 2001 From: kimkulling Date: Fri, 19 Jul 2019 11:55:12 +0200 Subject: [PATCH 37/43] Fix another signed / unsigned comparison warning. --- test/unit/utFBXImporterExporter.cpp | 2 +- test/unit/utglTF2ImportExport.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/utFBXImporterExporter.cpp b/test/unit/utFBXImporterExporter.cpp index 1c7117319..55471c023 100644 --- a/test/unit/utFBXImporterExporter.cpp +++ b/test/unit/utFBXImporterExporter.cpp @@ -235,7 +235,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) { const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box.FBX", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); - EXPECT_EQ(1, scene->mNumMaterials); + EXPECT_EQ(1u, scene->mNumMaterials); aiMaterial *mat = scene->mMaterials[0]; ASSERT_NE(nullptr, mat); diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 2399f3371..f3c861ba5 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -210,7 +210,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFanWithoutIndices) EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); - std::array f1 = {{ 0u, 1u, 2u }}; + std::array f1 = {{ 0u, 1u, 2u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); From e84f961f786ed214535275b00bd5f83c1e23fb02 Mon Sep 17 00:00:00 2001 From: kimkulling Date: Fri, 19 Jul 2019 13:03:08 +0200 Subject: [PATCH 38/43] change std::array to std::array to fix compiler warnings. --- test/unit/utglTF2ImportExport.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index f3c861ba5..29d63d81d 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -276,7 +276,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) { const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); - std::array l1 = {{ 0, 3u, 2u, 1u, 0u }}; + std::array l1 = {{ 0, 3u, 2u, 1u, 0u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { @@ -291,7 +291,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineStrip) { const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.gltf", aiProcess_ValidateDataStructure); EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); - std::array l1 = {{ 0u, 3u, 2u, 1u, 0u }}; + std::array l1 = {{ 0u, 3u, 2u, 1u, 0u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); @@ -306,13 +306,13 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStrip) { EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); - std::array f1 = {{ 0u, 3u, 1u }}; + std::array f1 = {{ 0u, 3u, 1u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } - std::array f2 = {{ 1u, 3u, 2u }}; + std::array f2 = {{ 1u, 3u, 2u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); @@ -326,7 +326,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) { EXPECT_NE(nullptr, scene); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); - std::array f1 = {{ 0u, 3u, 2u }}; + std::array f1 = {{ 0u, 3u, 2u }}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); From b6616e7b7983244858976b8b437fa0503c8938bb Mon Sep 17 00:00:00 2001 From: kimkulling Date: Fri, 19 Jul 2019 13:28:00 +0200 Subject: [PATCH 39/43] Fix another signed unsigned comparison warning. --- test/unit/utglTF2ImportExport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 29d63d81d..0ba5226cc 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -327,7 +327,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) { EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); std::array f1 = {{ 0u, 3u, 2u }}; - EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); + EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u ); for (size_t i = 0; i < 3; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); } From f804036cf3933d18f8e12161395e2149a76a16ac Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 19 Jul 2019 20:44:48 +0200 Subject: [PATCH 40/43] Update utBlenderWork.cpp Fix compiler warning signed against unsigned. --- test/unit/utBlenderWork.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/unit/utBlenderWork.cpp b/test/unit/utBlenderWork.cpp index 65fefde28..c0e3347ab 100644 --- a/test/unit/utBlenderWork.cpp +++ b/test/unit/utBlenderWork.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2019, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -73,11 +71,6 @@ TEST_F(BlenderWorkTest,work_279) { ASSERT_TRUE(pTest->HasMaterials()); ASSERT_TRUE(pTest->HasMeshes()); ASSERT_TRUE(pTest->mMeshes[0]->mNumVertices > 0); - ASSERT_EQ(44, pTest->mMeshes[0]->mNumFaces); - EXPECT_EQ(1, pTest->mNumMaterials); + ASSERT_EQ(44u, pTest->mMeshes[0]->mNumFaces); + EXPECT_EQ(1u, pTest->mNumMaterials); } - - - - - From 103048ff8512810c6c38d48b0fe4e9c7e843710c Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 20 Jul 2019 10:10:17 +0200 Subject: [PATCH 41/43] Update UnrealLoader.h use memcpy instead of = operator for pos copy. --- code/Unreal/UnrealLoader.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/Unreal/UnrealLoader.h b/code/Unreal/UnrealLoader.h index f846eb43a..678aaa76b 100644 --- a/code/Unreal/UnrealLoader.h +++ b/code/Unreal/UnrealLoader.h @@ -127,7 +127,8 @@ inline void CompressVertex(const aiVector3D& v, uint32_t& out) n.X = (int32_t)v.x; n.Y = (int32_t)v.y; n.Z = (int32_t)v.z; - out = t; + ::memcpy( &out, &t, sizeof(int32_t)); + //out = t; } // UNREAL vertex decompression From 78b283135e63707c7847242400be286351a8c9e8 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 21 Jul 2019 13:32:31 +0200 Subject: [PATCH 42/43] Update utIssues.cpp use correct test for floats. --- test/unit/utIssues.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/utIssues.cpp b/test/unit/utIssues.cpp index 6a974d7b9..0e30fa182 100644 --- a/test/unit/utIssues.cpp +++ b/test/unit/utIssues.cpp @@ -74,7 +74,7 @@ TEST_F( utIssues, OpacityBugWhenExporting_727 ) { if ( newScene->mNumMaterials > 0 ) { std::cout << "Desc = " << desc->description << "\n"; EXPECT_EQ( AI_SUCCESS, newScene->mMaterials[ 0 ]->Get( AI_MATKEY_OPACITY, newOpacity ) ); - EXPECT_EQ( opacity, newOpacity ); + EXPECT_FLOAT_EQ( opacity, newOpacity ); } delete scene; } From 17adc98eec4c4dc146c22a5cf665a9c3d59af38d Mon Sep 17 00:00:00 2001 From: Pierre Anquez <32702237+panquez@users.noreply.github.com> Date: Tue, 23 Jul 2019 15:58:30 +0200 Subject: [PATCH 43/43] Fix issue #2557 --- code/Common/Exporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Common/Exporter.cpp b/code/Common/Exporter.cpp index 58cad3be8..87745bca9 100644 --- a/code/Common/Exporter.cpp +++ b/code/Common/Exporter.cpp @@ -183,7 +183,7 @@ Exporter::ExportFormatEntry gExporters[] = Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 ), #endif -#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER +#ifndef ASSIMP_BUILD_NO_Assjson_EXPORTER Exporter::ExportFormatEntry("json", "Plain JSON representation of the Assimp scene data structure", "json", &ExportAssimp2Json, 0) #endif };