From 5247d7146c65672bd245ceb0dc213dfb319919c4 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Wed, 4 Apr 2018 09:53:27 +0100 Subject: Update Assimp to 4.1 Fixes build with C++17 / XCode 9.3 Change-Id: Ic1c19cc4b86e54e72dd4cfe054ec6d66f64b5a07 Reviewed-by: Mike Krus --- src/3rdparty/assimp/Readme.md | 121 +- src/3rdparty/assimp/assimp.pri | 1001 ++-- src/3rdparty/assimp/code/3DSConverter.cpp | 32 +- src/3rdparty/assimp/code/3DSExporter.cpp | 26 +- src/3rdparty/assimp/code/3DSExporter.h | 23 +- src/3rdparty/assimp/code/3DSHelper.h | 75 +- src/3rdparty/assimp/code/3DSLoader.cpp | 96 +- src/3rdparty/assimp/code/3DSLoader.h | 7 +- src/3rdparty/assimp/code/3MFXmlTags.h | 89 + src/3rdparty/assimp/code/ACLoader.cpp | 4 +- src/3rdparty/assimp/code/ACLoader.h | 3 +- src/3rdparty/assimp/code/AMFImporter.cpp | 704 +++ src/3rdparty/assimp/code/AMFImporter.hpp | 563 +++ src/3rdparty/assimp/code/AMFImporter_Geometry.cpp | 356 ++ src/3rdparty/assimp/code/AMFImporter_Macro.hpp | 165 + src/3rdparty/assimp/code/AMFImporter_Material.cpp | 310 ++ src/3rdparty/assimp/code/AMFImporter_Node.hpp | 400 ++ .../assimp/code/AMFImporter_Postprocess.cpp | 976 ++++ src/3rdparty/assimp/code/ASELoader.cpp | 15 +- src/3rdparty/assimp/code/ASELoader.h | 12 +- src/3rdparty/assimp/code/ASEParser.cpp | 79 +- src/3rdparty/assimp/code/ASEParser.h | 23 +- src/3rdparty/assimp/code/AssbinExporter.cpp | 66 +- src/3rdparty/assimp/code/AssbinExporter.h | 3 +- src/3rdparty/assimp/code/AssbinLoader.cpp | 74 +- src/3rdparty/assimp/code/AssbinLoader.h | 7 +- src/3rdparty/assimp/code/Assimp.cpp | 40 +- src/3rdparty/assimp/code/AssimpCExport.cpp | 12 +- src/3rdparty/assimp/code/AssxmlExporter.cpp | 14 +- src/3rdparty/assimp/code/AssxmlExporter.h | 3 +- src/3rdparty/assimp/code/B3DImporter.cpp | 63 +- src/3rdparty/assimp/code/B3DImporter.h | 6 +- src/3rdparty/assimp/code/BVHLoader.cpp | 8 +- src/3rdparty/assimp/code/BVHLoader.h | 3 +- src/3rdparty/assimp/code/BaseImporter.cpp | 204 +- src/3rdparty/assimp/code/BaseImporter.h | 63 +- src/3rdparty/assimp/code/BaseProcess.cpp | 3 +- src/3rdparty/assimp/code/BaseProcess.h | 5 +- src/3rdparty/assimp/code/Bitmap.cpp | 7 +- src/3rdparty/assimp/code/Bitmap.h | 143 +- src/3rdparty/assimp/code/BlenderBMesh.cpp | 8 +- src/3rdparty/assimp/code/BlenderDNA.cpp | 25 +- src/3rdparty/assimp/code/BlenderDNA.h | 89 +- src/3rdparty/assimp/code/BlenderDNA.inl | 31 +- src/3rdparty/assimp/code/BlenderIntermediate.h | 12 +- src/3rdparty/assimp/code/BlenderLoader.cpp | 79 +- src/3rdparty/assimp/code/BlenderLoader.h | 4 +- src/3rdparty/assimp/code/BlenderModifier.cpp | 18 +- src/3rdparty/assimp/code/BlenderModifier.h | 3 +- src/3rdparty/assimp/code/BlenderScene.cpp | 49 +- src/3rdparty/assimp/code/BlenderScene.h | 89 +- src/3rdparty/assimp/code/BlenderTessellator.cpp | 45 +- src/3rdparty/assimp/code/BlenderTessellator.h | 3 +- src/3rdparty/assimp/code/BlobIOSystem.h | 11 +- src/3rdparty/assimp/code/ByteSwapper.h | 3 +- src/3rdparty/assimp/code/C4DImporter.cpp | 12 +- src/3rdparty/assimp/code/C4DImporter.h | 2 +- src/3rdparty/assimp/code/CInterfaceIOWrapper.cpp | 135 + src/3rdparty/assimp/code/CInterfaceIOWrapper.h | 102 +- src/3rdparty/assimp/code/CMakeLists.txt | 250 +- src/3rdparty/assimp/code/COBLoader.cpp | 22 +- src/3rdparty/assimp/code/COBLoader.h | 3 +- src/3rdparty/assimp/code/COBScene.h | 10 +- src/3rdparty/assimp/code/CSMLoader.cpp | 7 +- src/3rdparty/assimp/code/CSMLoader.h | 3 +- src/3rdparty/assimp/code/CalcTangentsProcess.cpp | 5 +- src/3rdparty/assimp/code/CalcTangentsProcess.h | 3 +- src/3rdparty/assimp/code/ColladaExporter.cpp | 631 ++- src/3rdparty/assimp/code/ColladaExporter.h | 35 +- src/3rdparty/assimp/code/ColladaHelper.h | 101 +- src/3rdparty/assimp/code/ColladaLoader.cpp | 715 +-- src/3rdparty/assimp/code/ColladaLoader.h | 247 +- src/3rdparty/assimp/code/ColladaParser.cpp | 179 +- src/3rdparty/assimp/code/ColladaParser.h | 15 +- .../assimp/code/ComputeUVMappingProcess.cpp | 77 +- src/3rdparty/assimp/code/ComputeUVMappingProcess.h | 3 +- src/3rdparty/assimp/code/ConvertToLHProcess.cpp | 3 +- src/3rdparty/assimp/code/ConvertToLHProcess.h | 3 +- src/3rdparty/assimp/code/CreateAnimMesh.h | 3 +- src/3rdparty/assimp/code/D3MFExporter.cpp | 328 ++ src/3rdparty/assimp/code/D3MFExporter.h | 103 + src/3rdparty/assimp/code/D3MFImporter.cpp | 180 +- src/3rdparty/assimp/code/D3MFImporter.h | 18 +- src/3rdparty/assimp/code/D3MFOpcPackage.cpp | 251 +- src/3rdparty/assimp/code/D3MFOpcPackage.h | 23 +- src/3rdparty/assimp/code/DXFHelper.h | 3 +- src/3rdparty/assimp/code/DXFLoader.cpp | 15 +- src/3rdparty/assimp/code/DXFLoader.h | 4 +- src/3rdparty/assimp/code/DeboneProcess.cpp | 17 +- src/3rdparty/assimp/code/DeboneProcess.h | 5 +- src/3rdparty/assimp/code/DefaultIOStream.cpp | 23 +- src/3rdparty/assimp/code/DefaultIOStream.h | 142 - src/3rdparty/assimp/code/DefaultIOSystem.cpp | 8 +- src/3rdparty/assimp/code/DefaultIOSystem.h | 98 - src/3rdparty/assimp/code/DefaultLogger.cpp | 10 +- src/3rdparty/assimp/code/DefaultProgressHandler.h | 3 +- src/3rdparty/assimp/code/Defines.h | 49 - src/3rdparty/assimp/code/Exceptional.h | 6 +- src/3rdparty/assimp/code/Exporter.cpp | 192 +- src/3rdparty/assimp/code/FBXAnimation.cpp | 32 +- src/3rdparty/assimp/code/FBXBinaryTokenizer.cpp | 113 +- src/3rdparty/assimp/code/FBXCompileConfig.h | 7 +- src/3rdparty/assimp/code/FBXConverter.cpp | 414 +- src/3rdparty/assimp/code/FBXConverter.h | 3 +- src/3rdparty/assimp/code/FBXDeformer.cpp | 9 +- src/3rdparty/assimp/code/FBXDocument.cpp | 92 +- src/3rdparty/assimp/code/FBXDocument.h | 62 +- src/3rdparty/assimp/code/FBXDocumentUtil.cpp | 3 +- src/3rdparty/assimp/code/FBXImportSettings.h | 8 +- src/3rdparty/assimp/code/FBXImporter.cpp | 20 +- src/3rdparty/assimp/code/FBXImporter.h | 3 +- src/3rdparty/assimp/code/FBXMaterial.cpp | 61 +- src/3rdparty/assimp/code/FBXMeshGeometry.cpp | 146 +- src/3rdparty/assimp/code/FBXMeshGeometry.h | 33 +- src/3rdparty/assimp/code/FBXModel.cpp | 8 +- src/3rdparty/assimp/code/FBXNodeAttribute.cpp | 20 +- src/3rdparty/assimp/code/FBXParser.cpp | 23 +- src/3rdparty/assimp/code/FBXParser.h | 34 +- src/3rdparty/assimp/code/FBXProperties.cpp | 3 +- src/3rdparty/assimp/code/FBXProperties.h | 51 +- src/3rdparty/assimp/code/FBXTokenizer.cpp | 3 +- src/3rdparty/assimp/code/FBXTokenizer.h | 10 +- src/3rdparty/assimp/code/FBXUtil.cpp | 4 +- src/3rdparty/assimp/code/FBXUtil.h | 4 +- src/3rdparty/assimp/code/FIReader.cpp | 1833 ++++++++ src/3rdparty/assimp/code/FIReader.hpp | 185 + src/3rdparty/assimp/code/FileLogStream.h | 43 +- src/3rdparty/assimp/code/FindDegenerates.cpp | 115 +- src/3rdparty/assimp/code/FindDegenerates.h | 62 +- src/3rdparty/assimp/code/FindInstancesProcess.cpp | 3 +- src/3rdparty/assimp/code/FindInstancesProcess.h | 3 +- .../assimp/code/FindInvalidDataProcess.cpp | 40 +- src/3rdparty/assimp/code/FindInvalidDataProcess.h | 5 +- src/3rdparty/assimp/code/FixNormalsStep.cpp | 9 +- src/3rdparty/assimp/code/FixNormalsStep.h | 8 +- src/3rdparty/assimp/code/GenFaceNormalsProcess.cpp | 3 +- src/3rdparty/assimp/code/GenFaceNormalsProcess.h | 3 +- .../assimp/code/GenVertexNormalsProcess.cpp | 19 +- src/3rdparty/assimp/code/GenVertexNormalsProcess.h | 8 +- src/3rdparty/assimp/code/GenericProperty.h | 5 +- src/3rdparty/assimp/code/HMPFileData.h | 3 +- src/3rdparty/assimp/code/HMPLoader.cpp | 20 +- src/3rdparty/assimp/code/HMPLoader.h | 8 +- src/3rdparty/assimp/code/HalfLifeFileData.h | 9 +- src/3rdparty/assimp/code/Hash.h | 3 +- src/3rdparty/assimp/code/IFCBoolean.cpp | 11 +- src/3rdparty/assimp/code/IFCCurve.cpp | 156 +- src/3rdparty/assimp/code/IFCGeometry.cpp | 23 +- src/3rdparty/assimp/code/IFCLoader.cpp | 97 +- src/3rdparty/assimp/code/IFCLoader.h | 7 +- src/3rdparty/assimp/code/IFCMaterial.cpp | 39 +- src/3rdparty/assimp/code/IFCOpenings.cpp | 77 +- src/3rdparty/assimp/code/IFCProfile.cpp | 13 +- src/3rdparty/assimp/code/IFCReaderGen1.cpp | 4514 +++++++++--------- src/3rdparty/assimp/code/IFCReaderGen2.cpp | 2100 +++++---- src/3rdparty/assimp/code/IFCUtil.cpp | 11 +- src/3rdparty/assimp/code/IFCUtil.h | 3 +- src/3rdparty/assimp/code/IOStreamBuffer.h | 350 ++ src/3rdparty/assimp/code/IRRLoader.cpp | 100 +- src/3rdparty/assimp/code/IRRLoader.h | 37 +- src/3rdparty/assimp/code/IRRMeshLoader.cpp | 66 +- src/3rdparty/assimp/code/IRRMeshLoader.h | 3 +- src/3rdparty/assimp/code/IRRShared.cpp | 3 +- src/3rdparty/assimp/code/Importer.cpp | 34 +- src/3rdparty/assimp/code/Importer.h | 46 +- src/3rdparty/assimp/code/ImporterRegistry.cpp | 32 +- src/3rdparty/assimp/code/ImproveCacheLocality.cpp | 4 +- src/3rdparty/assimp/code/ImproveCacheLocality.h | 3 +- src/3rdparty/assimp/code/JoinVerticesProcess.cpp | 3 +- src/3rdparty/assimp/code/JoinVerticesProcess.h | 4 +- src/3rdparty/assimp/code/LWOAnimation.cpp | 18 +- src/3rdparty/assimp/code/LWOAnimation.h | 10 +- src/3rdparty/assimp/code/LWOBLoader.cpp | 3 +- src/3rdparty/assimp/code/LWOFileData.h | 3 +- src/3rdparty/assimp/code/LWOLoader.cpp | 18 +- src/3rdparty/assimp/code/LWOLoader.h | 5 +- src/3rdparty/assimp/code/LWOMaterial.cpp | 45 +- src/3rdparty/assimp/code/LWSLoader.cpp | 11 +- src/3rdparty/assimp/code/LWSLoader.h | 5 +- .../assimp/code/LimitBoneWeightsProcess.cpp | 7 +- src/3rdparty/assimp/code/LimitBoneWeightsProcess.h | 3 +- src/3rdparty/assimp/code/LineSplitter.h | 23 +- src/3rdparty/assimp/code/LogAux.h | 16 +- src/3rdparty/assimp/code/MD2FileData.h | 5 +- src/3rdparty/assimp/code/MD2Loader.cpp | 13 +- src/3rdparty/assimp/code/MD2Loader.h | 3 +- src/3rdparty/assimp/code/MD2NormalTable.h | 3 +- src/3rdparty/assimp/code/MD3FileData.h | 61 +- src/3rdparty/assimp/code/MD3Loader.cpp | 16 +- src/3rdparty/assimp/code/MD3Loader.h | 3 +- src/3rdparty/assimp/code/MD5Loader.cpp | 20 +- src/3rdparty/assimp/code/MD5Loader.h | 3 +- src/3rdparty/assimp/code/MD5Parser.cpp | 24 +- src/3rdparty/assimp/code/MD5Parser.h | 3 +- src/3rdparty/assimp/code/MDCFileData.h | 5 +- src/3rdparty/assimp/code/MDCLoader.cpp | 6 +- src/3rdparty/assimp/code/MDCLoader.h | 3 +- src/3rdparty/assimp/code/MDLDefaultColorMap.h | 3 +- src/3rdparty/assimp/code/MDLFileData.h | 80 +- src/3rdparty/assimp/code/MDLLoader.cpp | 17 +- src/3rdparty/assimp/code/MDLLoader.h | 3 +- src/3rdparty/assimp/code/MDLMaterialLoader.cpp | 19 +- src/3rdparty/assimp/code/MMDCpp14.h | 82 + src/3rdparty/assimp/code/MMDImporter.cpp | 370 ++ src/3rdparty/assimp/code/MMDImporter.h | 96 + src/3rdparty/assimp/code/MMDPmdParser.h | 596 +++ src/3rdparty/assimp/code/MMDPmxParser.cpp | 637 +++ src/3rdparty/assimp/code/MMDPmxParser.h | 780 ++++ src/3rdparty/assimp/code/MMDVmdParser.h | 375 ++ src/3rdparty/assimp/code/MS3DLoader.cpp | 10 +- src/3rdparty/assimp/code/MS3DLoader.h | 3 +- src/3rdparty/assimp/code/MakeVerboseFormat.cpp | 13 +- src/3rdparty/assimp/code/MakeVerboseFormat.h | 3 +- src/3rdparty/assimp/code/MaterialSystem.cpp | 93 +- src/3rdparty/assimp/code/MaterialSystem.h | 3 +- src/3rdparty/assimp/code/MemoryIOWrapper.h | 3 +- src/3rdparty/assimp/code/NDOLoader.cpp | 17 +- src/3rdparty/assimp/code/NFFLoader.cpp | 27 +- src/3rdparty/assimp/code/NFFLoader.h | 3 +- src/3rdparty/assimp/code/OFFLoader.cpp | 15 +- src/3rdparty/assimp/code/OFFLoader.h | 3 +- src/3rdparty/assimp/code/ObjExporter.cpp | 185 +- src/3rdparty/assimp/code/ObjExporter.h | 97 +- src/3rdparty/assimp/code/ObjFileData.h | 120 +- src/3rdparty/assimp/code/ObjFileImporter.cpp | 133 +- src/3rdparty/assimp/code/ObjFileImporter.h | 21 +- src/3rdparty/assimp/code/ObjFileMtlImporter.cpp | 107 +- src/3rdparty/assimp/code/ObjFileMtlImporter.h | 8 +- src/3rdparty/assimp/code/ObjFileParser.cpp | 454 +- src/3rdparty/assimp/code/ObjFileParser.h | 35 +- src/3rdparty/assimp/code/ObjTools.h | 86 +- src/3rdparty/assimp/code/OgreBinarySerializer.cpp | 7 +- src/3rdparty/assimp/code/OgreBinarySerializer.h | 3 +- src/3rdparty/assimp/code/OgreImporter.cpp | 6 +- src/3rdparty/assimp/code/OgreImporter.h | 3 +- src/3rdparty/assimp/code/OgreMaterial.cpp | 13 +- src/3rdparty/assimp/code/OgreParsingUtils.h | 11 +- src/3rdparty/assimp/code/OgreStructs.cpp | 57 +- src/3rdparty/assimp/code/OgreStructs.h | 3 +- src/3rdparty/assimp/code/OgreXmlSerializer.cpp | 7 +- src/3rdparty/assimp/code/OgreXmlSerializer.h | 3 +- src/3rdparty/assimp/code/OpenGEXExporter.cpp | 7 +- src/3rdparty/assimp/code/OpenGEXExporter.h | 3 +- src/3rdparty/assimp/code/OpenGEXImporter.cpp | 227 +- src/3rdparty/assimp/code/OpenGEXImporter.h | 24 +- src/3rdparty/assimp/code/OpenGEXStructs.h | 6 +- src/3rdparty/assimp/code/OptimizeGraph.cpp | 19 +- src/3rdparty/assimp/code/OptimizeGraph.h | 3 +- src/3rdparty/assimp/code/OptimizeMeshes.cpp | 14 +- src/3rdparty/assimp/code/OptimizeMeshes.h | 3 +- src/3rdparty/assimp/code/ParsingUtils.h | 3 +- src/3rdparty/assimp/code/PlyExporter.cpp | 73 +- src/3rdparty/assimp/code/PlyExporter.h | 9 +- src/3rdparty/assimp/code/PlyLoader.cpp | 1736 ++++--- src/3rdparty/assimp/code/PlyLoader.h | 68 +- src/3rdparty/assimp/code/PlyParser.cpp | 1637 ++++--- src/3rdparty/assimp/code/PlyParser.h | 98 +- src/3rdparty/assimp/code/PolyTools.h | 3 +- src/3rdparty/assimp/code/PostStepRegistry.cpp | 3 +- src/3rdparty/assimp/code/PretransformVertices.cpp | 28 +- src/3rdparty/assimp/code/PretransformVertices.h | 3 +- src/3rdparty/assimp/code/ProcessHelper.cpp | 31 +- src/3rdparty/assimp/code/ProcessHelper.h | 11 +- src/3rdparty/assimp/code/Profiler.h | 23 +- src/3rdparty/assimp/code/Q3BSPFileData.h | 3 +- src/3rdparty/assimp/code/Q3BSPFileImporter.cpp | 33 +- src/3rdparty/assimp/code/Q3BSPFileImporter.h | 24 +- src/3rdparty/assimp/code/Q3BSPFileParser.cpp | 5 +- src/3rdparty/assimp/code/Q3BSPFileParser.h | 3 +- src/3rdparty/assimp/code/Q3BSPZipArchive.cpp | 15 +- src/3rdparty/assimp/code/Q3BSPZipArchive.h | 120 +- src/3rdparty/assimp/code/Q3DLoader.cpp | 4 +- src/3rdparty/assimp/code/Q3DLoader.h | 3 +- src/3rdparty/assimp/code/RawLoader.cpp | 7 +- src/3rdparty/assimp/code/RawLoader.h | 3 +- src/3rdparty/assimp/code/RemoveComments.cpp | 3 +- src/3rdparty/assimp/code/RemoveComments.h | 5 +- .../assimp/code/RemoveRedundantMaterials.cpp | 14 +- .../assimp/code/RemoveRedundantMaterials.h | 3 +- src/3rdparty/assimp/code/RemoveVCProcess.cpp | 5 +- src/3rdparty/assimp/code/RemoveVCProcess.h | 7 +- src/3rdparty/assimp/code/SGSpatialSort.cpp | 11 +- src/3rdparty/assimp/code/SGSpatialSort.h | 3 +- src/3rdparty/assimp/code/SIBImporter.cpp | 191 +- src/3rdparty/assimp/code/SIBImporter.h | 9 +- src/3rdparty/assimp/code/SMDLoader.cpp | 53 +- src/3rdparty/assimp/code/SMDLoader.h | 7 +- src/3rdparty/assimp/code/STEPFile.h | 39 +- src/3rdparty/assimp/code/STEPFileEncoding.cpp | 62 +- src/3rdparty/assimp/code/STEPFileEncoding.h | 3 +- src/3rdparty/assimp/code/STEPFileReader.cpp | 3 +- src/3rdparty/assimp/code/STEPFileReader.h | 3 +- src/3rdparty/assimp/code/STLExporter.cpp | 19 +- src/3rdparty/assimp/code/STLExporter.h | 3 +- src/3rdparty/assimp/code/STLLoader.cpp | 158 +- src/3rdparty/assimp/code/STLLoader.h | 63 +- src/3rdparty/assimp/code/ScaleProcess.cpp | 105 + src/3rdparty/assimp/code/ScaleProcess.h | 87 + src/3rdparty/assimp/code/SceneCombiner.cpp | 245 +- src/3rdparty/assimp/code/SceneCombiner.h | 400 -- src/3rdparty/assimp/code/ScenePreprocessor.cpp | 15 +- src/3rdparty/assimp/code/ScenePreprocessor.h | 3 +- src/3rdparty/assimp/code/ScenePrivate.h | 3 +- src/3rdparty/assimp/code/SkeletonMeshBuilder.cpp | 101 +- src/3rdparty/assimp/code/SkeletonMeshBuilder.h | 3 +- src/3rdparty/assimp/code/SmoothingGroups.h | 3 +- src/3rdparty/assimp/code/SortByPTypeProcess.cpp | 3 +- src/3rdparty/assimp/code/SortByPTypeProcess.h | 3 +- src/3rdparty/assimp/code/SpatialSort.cpp | 41 +- src/3rdparty/assimp/code/SpatialSort.h | 11 +- .../assimp/code/SplitByBoneCountProcess.cpp | 5 +- src/3rdparty/assimp/code/SplitByBoneCountProcess.h | 3 +- src/3rdparty/assimp/code/SplitLargeMeshes.cpp | 3 +- src/3rdparty/assimp/code/SplitLargeMeshes.h | 3 +- src/3rdparty/assimp/code/StandardShapes.cpp | 159 +- src/3rdparty/assimp/code/StandardShapes.h | 9 +- src/3rdparty/assimp/code/StdOStreamLogStream.h | 32 +- src/3rdparty/assimp/code/StepExporter.cpp | 8 +- src/3rdparty/assimp/code/StepExporter.h | 3 +- src/3rdparty/assimp/code/StreamReader.h | 47 +- src/3rdparty/assimp/code/StreamWriter.h | 3 +- src/3rdparty/assimp/code/StringComparison.h | 4 +- src/3rdparty/assimp/code/StringUtils.h | 11 +- src/3rdparty/assimp/code/Subdivision.cpp | 29 +- src/3rdparty/assimp/code/Subdivision.h | 22 +- src/3rdparty/assimp/code/TargetAnimation.cpp | 15 +- src/3rdparty/assimp/code/TargetAnimation.h | 3 +- src/3rdparty/assimp/code/TerragenLoader.cpp | 10 +- src/3rdparty/assimp/code/TerragenLoader.h | 3 +- src/3rdparty/assimp/code/TextureTransform.cpp | 5 +- src/3rdparty/assimp/code/TextureTransform.h | 3 +- src/3rdparty/assimp/code/TinyFormatter.h | 6 +- src/3rdparty/assimp/code/TriangulateProcess.cpp | 27 +- src/3rdparty/assimp/code/TriangulateProcess.h | 3 +- src/3rdparty/assimp/code/UnrealLoader.cpp | 10 +- src/3rdparty/assimp/code/UnrealLoader.h | 3 +- src/3rdparty/assimp/code/ValidateDataStructure.cpp | 26 +- src/3rdparty/assimp/code/ValidateDataStructure.h | 7 +- src/3rdparty/assimp/code/Version.cpp | 59 +- src/3rdparty/assimp/code/Vertex.h | 71 +- .../assimp/code/VertexTriangleAdjacency.cpp | 3 +- src/3rdparty/assimp/code/VertexTriangleAdjacency.h | 3 +- src/3rdparty/assimp/code/Win32DebugLogStream.h | 74 +- src/3rdparty/assimp/code/X3DExporter.cpp | 735 +++ src/3rdparty/assimp/code/X3DExporter.hpp | 235 + src/3rdparty/assimp/code/X3DImporter.cpp | 1728 +++++++ src/3rdparty/assimp/code/X3DImporter.hpp | 833 ++++ .../assimp/code/X3DImporter_Geometry2D.cpp | 521 +++ .../assimp/code/X3DImporter_Geometry3D.cpp | 998 ++++ src/3rdparty/assimp/code/X3DImporter_Group.cpp | 317 ++ src/3rdparty/assimp/code/X3DImporter_Light.cpp | 289 ++ src/3rdparty/assimp/code/X3DImporter_Macro.hpp | 194 + src/3rdparty/assimp/code/X3DImporter_Metadata.cpp | 276 ++ .../assimp/code/X3DImporter_Networking.cpp | 133 + src/3rdparty/assimp/code/X3DImporter_Node.hpp | 779 ++++ .../assimp/code/X3DImporter_Postprocess.cpp | 826 ++++ src/3rdparty/assimp/code/X3DImporter_Rendering.cpp | 1070 +++++ src/3rdparty/assimp/code/X3DImporter_Shape.cpp | 249 + src/3rdparty/assimp/code/X3DImporter_Texturing.cpp | 196 + src/3rdparty/assimp/code/X3DVocabulary.cpp | 1675 +++++++ src/3rdparty/assimp/code/XFileExporter.cpp | 16 +- src/3rdparty/assimp/code/XFileExporter.h | 10 +- src/3rdparty/assimp/code/XFileHelper.h | 9 +- src/3rdparty/assimp/code/XFileImporter.cpp | 21 +- src/3rdparty/assimp/code/XFileImporter.h | 8 +- src/3rdparty/assimp/code/XFileParser.cpp | 30 +- src/3rdparty/assimp/code/XFileParser.h | 5 +- src/3rdparty/assimp/code/XGLLoader.cpp | 120 +- src/3rdparty/assimp/code/XGLLoader.h | 13 +- src/3rdparty/assimp/code/XMLTools.h | 3 +- src/3rdparty/assimp/code/fast_atof.h | 58 +- src/3rdparty/assimp/code/glTF2Asset.h | 1131 +++++ src/3rdparty/assimp/code/glTF2Asset.inl | 1449 ++++++ src/3rdparty/assimp/code/glTF2AssetWriter.h | 93 + src/3rdparty/assimp/code/glTF2AssetWriter.inl | 638 +++ src/3rdparty/assimp/code/glTF2Exporter.cpp | 1080 +++++ src/3rdparty/assimp/code/glTF2Exporter.h | 134 + src/3rdparty/assimp/code/glTF2Importer.cpp | 694 +++ src/3rdparty/assimp/code/glTF2Importer.h | 91 + src/3rdparty/assimp/code/glTFAsset.h | 376 +- src/3rdparty/assimp/code/glTFAsset.inl | 466 +- src/3rdparty/assimp/code/glTFAssetWriter.h | 14 +- src/3rdparty/assimp/code/glTFAssetWriter.inl | 278 +- src/3rdparty/assimp/code/glTFExporter.cpp | 731 ++- src/3rdparty/assimp/code/glTFExporter.h | 24 +- src/3rdparty/assimp/code/glTFImporter.cpp | 99 +- src/3rdparty/assimp/code/glTFImporter.h | 5 +- src/3rdparty/assimp/code/irrXMLWrapper.h | 13 +- src/3rdparty/assimp/code/makefile.mingw | 105 - src/3rdparty/assimp/code/qnan.h | 56 +- src/3rdparty/assimp/code/scene.cpp | 139 + .../assimp/contrib/ConvertUTF/ConvertUTF.c | 539 --- .../assimp/contrib/ConvertUTF/ConvertUTF.h | 151 - src/3rdparty/assimp/contrib/ConvertUTF/readme.txt | 43 - .../assimp/contrib/Open3DGC/o3dgcAdjacencyInfo.h | 155 + .../contrib/Open3DGC/o3dgcArithmeticCodec.cpp | 865 ++++ .../assimp/contrib/Open3DGC/o3dgcArithmeticCodec.h | 339 ++ .../assimp/contrib/Open3DGC/o3dgcBinaryStream.h | 433 ++ src/3rdparty/assimp/contrib/Open3DGC/o3dgcCommon.h | 412 ++ .../assimp/contrib/Open3DGC/o3dgcDVEncodeParams.h | 62 + .../assimp/contrib/Open3DGC/o3dgcDynamicVector.h | 84 + .../contrib/Open3DGC/o3dgcDynamicVectorDecoder.cpp | 278 ++ .../contrib/Open3DGC/o3dgcDynamicVectorDecoder.h | 76 + .../contrib/Open3DGC/o3dgcDynamicVectorEncoder.cpp | 295 ++ .../contrib/Open3DGC/o3dgcDynamicVectorEncoder.h | 79 + src/3rdparty/assimp/contrib/Open3DGC/o3dgcFIFO.h | 97 + .../assimp/contrib/Open3DGC/o3dgcIndexedFaceSet.h | 263 ++ .../contrib/Open3DGC/o3dgcIndexedFaceSet.inl | 47 + .../assimp/contrib/Open3DGC/o3dgcSC3DMCDecoder.h | 111 + .../assimp/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl | 850 ++++ .../contrib/Open3DGC/o3dgcSC3DMCEncodeParams.h | 140 + .../assimp/contrib/Open3DGC/o3dgcSC3DMCEncoder.h | 116 + .../assimp/contrib/Open3DGC/o3dgcSC3DMCEncoder.inl | 927 ++++ src/3rdparty/assimp/contrib/Open3DGC/o3dgcTimer.h | 134 + .../assimp/contrib/Open3DGC/o3dgcTools.cpp | 22 + .../assimp/contrib/Open3DGC/o3dgcTriangleFans.cpp | 475 ++ .../assimp/contrib/Open3DGC/o3dgcTriangleFans.h | 291 ++ .../contrib/Open3DGC/o3dgcTriangleListDecoder.h | 133 + .../contrib/Open3DGC/o3dgcTriangleListDecoder.inl | 364 ++ .../contrib/Open3DGC/o3dgcTriangleListEncoder.h | 101 + .../contrib/Open3DGC/o3dgcTriangleListEncoder.inl | 719 +++ src/3rdparty/assimp/contrib/Open3DGC/o3dgcVector.h | 184 + .../assimp/contrib/Open3DGC/o3dgcVector.inl | 317 ++ src/3rdparty/assimp/contrib/clipper/clipper.cpp | 5 +- src/3rdparty/assimp/contrib/clipper/clipper.hpp | 2 +- .../assimp/contrib/openddlparser/CMakeLists.txt | 122 +- src/3rdparty/assimp/contrib/openddlparser/CREDITS | 3 + .../assimp/contrib/openddlparser/README.md | 4 +- .../assimp/contrib/openddlparser/code/DDLNode.cpp | 20 +- .../contrib/openddlparser/code/OpenDDLCommon.cpp | 44 +- .../contrib/openddlparser/code/OpenDDLExport.cpp | 63 +- .../contrib/openddlparser/code/OpenDDLParser.cpp | 169 +- .../contrib/openddlparser/code/OpenDDLStream.cpp | 96 + .../assimp/contrib/openddlparser/code/Value.cpp | 35 +- .../openddlparser/include/openddlparser/DDLNode.h | 29 +- .../include/openddlparser/OpenDDLCommon.h | 7 +- .../include/openddlparser/OpenDDLExport.h | 30 +- .../include/openddlparser/OpenDDLParser.h | 16 +- .../include/openddlparser/OpenDDLParserUtils.h | 44 +- .../include/openddlparser/OpenDDLStream.h | 89 + .../openddlparser/include/openddlparser/Value.h | 10 +- .../contrib/poly2tri/poly2tri/common/shapes.cc | 52 +- .../contrib/poly2tri/poly2tri/common/shapes.h | 58 +- .../contrib/poly2tri/poly2tri/common/utils.h | 40 +- .../assimp/contrib/poly2tri/poly2tri/poly2tri.h | 3 +- .../poly2tri/poly2tri/sweep/advancing_front.cc | 5 +- .../poly2tri/poly2tri/sweep/advancing_front.h | 4 +- .../assimp/contrib/poly2tri/poly2tri/sweep/cdt.cc | 7 +- .../assimp/contrib/poly2tri/poly2tri/sweep/cdt.h | 32 +- .../contrib/poly2tri/poly2tri/sweep/sweep.cc | 133 +- .../assimp/contrib/poly2tri/poly2tri/sweep/sweep.h | 47 +- .../poly2tri/poly2tri/sweep/sweep_context.cc | 53 +- .../poly2tri/poly2tri/sweep/sweep_context.h | 32 +- .../rapidjson/include/rapidjson/allocators.h | 40 +- .../contrib/rapidjson/include/rapidjson/document.h | 985 +++- .../rapidjson/include/rapidjson/encodedstream.h | 48 +- .../rapidjson/include/rapidjson/encodings.h | 233 +- .../contrib/rapidjson/include/rapidjson/error/en.h | 21 +- .../rapidjson/include/rapidjson/error/error.h | 27 +- .../rapidjson/include/rapidjson/filereadstream.h | 13 +- .../rapidjson/include/rapidjson/filewritestream.h | 11 +- .../contrib/rapidjson/include/rapidjson/fwd.h | 151 + .../include/rapidjson/internal/biginteger.h | 2 +- .../rapidjson/include/rapidjson/internal/diyfp.h | 14 +- .../rapidjson/include/rapidjson/internal/dtoa.h | 46 +- .../rapidjson/include/rapidjson/internal/ieee754.h | 5 +- .../rapidjson/include/rapidjson/internal/regex.h | 734 +++ .../rapidjson/include/rapidjson/internal/stack.h | 49 +- .../rapidjson/include/rapidjson/internal/strfunc.h | 32 +- .../rapidjson/include/rapidjson/internal/strtod.h | 25 +- .../rapidjson/include/rapidjson/internal/swap.h | 9 + .../rapidjson/include/rapidjson/istreamwrapper.h | 115 + .../rapidjson/include/rapidjson/memorybuffer.h | 2 +- .../rapidjson/include/rapidjson/memorystream.h | 16 +- .../include/rapidjson/msinttypes/stdint.h | 8 +- .../rapidjson/include/rapidjson/ostreamwrapper.h | 81 + .../contrib/rapidjson/include/rapidjson/pointer.h | 131 +- .../rapidjson/include/rapidjson/prettywriter.h | 98 +- .../rapidjson/include/rapidjson/rapidjson.h | 310 +- .../contrib/rapidjson/include/rapidjson/reader.h | 1293 +++-- .../contrib/rapidjson/include/rapidjson/schema.h | 2016 ++++++++ .../contrib/rapidjson/include/rapidjson/stream.h | 179 + .../rapidjson/include/rapidjson/stringbuffer.h | 30 +- .../contrib/rapidjson/include/rapidjson/writer.h | 458 +- src/3rdparty/assimp/contrib/rapidjson/readme.md | 69 +- src/3rdparty/assimp/contrib/unzip/crypt.h | 8 +- src/3rdparty/assimp/contrib/unzip/ioapi.c | 34 +- src/3rdparty/assimp/contrib/unzip/ioapi.h | 16 +- src/3rdparty/assimp/contrib/unzip/unzip.c | 51 +- src/3rdparty/assimp/contrib/unzip/unzip.h | 66 +- .../assimp/contrib/utf8cpp/doc/ReleaseNotes | 12 + .../assimp/contrib/utf8cpp/doc/utf8cpp.html | 1789 +++++++ src/3rdparty/assimp/contrib/utf8cpp/source/utf8.h | 34 + .../assimp/contrib/utf8cpp/source/utf8/checked.h | 327 ++ .../assimp/contrib/utf8cpp/source/utf8/core.h | 329 ++ .../assimp/contrib/utf8cpp/source/utf8/unchecked.h | 228 + src/3rdparty/assimp/contrib/zip/README.md | 139 + src/3rdparty/assimp/contrib/zip/UNLICENSE | 26 + src/3rdparty/assimp/contrib/zip/src/miniz.h | 4927 ++++++++++++++++++++ src/3rdparty/assimp/contrib/zip/src/zip.c | 640 +++ src/3rdparty/assimp/contrib/zip/src/zip.h | 193 + .../assimp/include/assimp/Compiler/pushpack1.h | 3 - .../assimp/include/assimp/DefaultIOStream.h | 141 + .../assimp/include/assimp/DefaultIOSystem.h | 99 + .../assimp/include/assimp/DefaultLogger.hpp | 3 +- src/3rdparty/assimp/include/assimp/Defines.h | 49 + src/3rdparty/assimp/include/assimp/Exporter.hpp | 85 +- src/3rdparty/assimp/include/assimp/IOStream.hpp | 4 +- src/3rdparty/assimp/include/assimp/IOSystem.hpp | 109 +- src/3rdparty/assimp/include/assimp/Importer.hpp | 42 +- src/3rdparty/assimp/include/assimp/LogStream.hpp | 24 +- src/3rdparty/assimp/include/assimp/Logger.hpp | 7 +- src/3rdparty/assimp/include/assimp/NullLogger.hpp | 7 +- .../assimp/include/assimp/ProgressHandler.hpp | 12 +- src/3rdparty/assimp/include/assimp/SceneCombiner.h | 400 ++ src/3rdparty/assimp/include/assimp/ai_assert.h | 13 +- src/3rdparty/assimp/include/assimp/anim.h | 187 +- src/3rdparty/assimp/include/assimp/camera.h | 4 +- src/3rdparty/assimp/include/assimp/cexport.h | 9 +- src/3rdparty/assimp/include/assimp/cfileio.h | 20 +- src/3rdparty/assimp/include/assimp/cimport.h | 11 +- src/3rdparty/assimp/include/assimp/color4.h | 16 +- src/3rdparty/assimp/include/assimp/color4.inl | 28 +- src/3rdparty/assimp/include/assimp/config.h | 95 +- src/3rdparty/assimp/include/assimp/defs.h | 34 +- src/3rdparty/assimp/include/assimp/importerdesc.h | 10 +- src/3rdparty/assimp/include/assimp/light.h | 12 +- src/3rdparty/assimp/include/assimp/material.h | 104 +- src/3rdparty/assimp/include/assimp/material.inl | 55 +- src/3rdparty/assimp/include/assimp/matrix3x3.h | 30 +- src/3rdparty/assimp/include/assimp/matrix3x3.inl | 42 +- src/3rdparty/assimp/include/assimp/matrix4x4.h | 60 +- src/3rdparty/assimp/include/assimp/matrix4x4.inl | 248 +- src/3rdparty/assimp/include/assimp/mesh.h | 32 +- src/3rdparty/assimp/include/assimp/metadata.h | 207 +- .../assimp/port/AndroidJNI/AndroidJNIIOSystem.h | 2 +- src/3rdparty/assimp/include/assimp/postprocess.h | 16 +- src/3rdparty/assimp/include/assimp/quaternion.h | 11 +- src/3rdparty/assimp/include/assimp/quaternion.inl | 6 +- src/3rdparty/assimp/include/assimp/scene.h | 160 +- src/3rdparty/assimp/include/assimp/texture.h | 32 +- src/3rdparty/assimp/include/assimp/types.h | 51 +- src/3rdparty/assimp/include/assimp/vector2.h | 9 +- src/3rdparty/assimp/include/assimp/vector2.inl | 7 +- src/3rdparty/assimp/include/assimp/vector3.h | 29 +- src/3rdparty/assimp/include/assimp/vector3.inl | 30 +- src/3rdparty/assimp/include/assimp/version.h | 11 +- src/3rdparty/assimp/revision.h | 2 +- 548 files changed, 66354 insertions(+), 14765 deletions(-) create mode 100644 src/3rdparty/assimp/code/3MFXmlTags.h create mode 100644 src/3rdparty/assimp/code/AMFImporter.cpp create mode 100644 src/3rdparty/assimp/code/AMFImporter.hpp create mode 100644 src/3rdparty/assimp/code/AMFImporter_Geometry.cpp create mode 100644 src/3rdparty/assimp/code/AMFImporter_Macro.hpp create mode 100644 src/3rdparty/assimp/code/AMFImporter_Material.cpp create mode 100644 src/3rdparty/assimp/code/AMFImporter_Node.hpp create mode 100644 src/3rdparty/assimp/code/AMFImporter_Postprocess.cpp create mode 100644 src/3rdparty/assimp/code/CInterfaceIOWrapper.cpp create mode 100644 src/3rdparty/assimp/code/D3MFExporter.cpp create mode 100644 src/3rdparty/assimp/code/D3MFExporter.h delete mode 100644 src/3rdparty/assimp/code/DefaultIOStream.h delete mode 100644 src/3rdparty/assimp/code/DefaultIOSystem.h delete mode 100644 src/3rdparty/assimp/code/Defines.h create mode 100644 src/3rdparty/assimp/code/FIReader.cpp create mode 100644 src/3rdparty/assimp/code/FIReader.hpp create mode 100644 src/3rdparty/assimp/code/IOStreamBuffer.h create mode 100644 src/3rdparty/assimp/code/MMDCpp14.h create mode 100644 src/3rdparty/assimp/code/MMDImporter.cpp create mode 100644 src/3rdparty/assimp/code/MMDImporter.h create mode 100644 src/3rdparty/assimp/code/MMDPmdParser.h create mode 100644 src/3rdparty/assimp/code/MMDPmxParser.cpp create mode 100644 src/3rdparty/assimp/code/MMDPmxParser.h create mode 100644 src/3rdparty/assimp/code/MMDVmdParser.h create mode 100644 src/3rdparty/assimp/code/ScaleProcess.cpp create mode 100644 src/3rdparty/assimp/code/ScaleProcess.h delete mode 100644 src/3rdparty/assimp/code/SceneCombiner.h create mode 100644 src/3rdparty/assimp/code/X3DExporter.cpp create mode 100644 src/3rdparty/assimp/code/X3DExporter.hpp create mode 100644 src/3rdparty/assimp/code/X3DImporter.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter.hpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Geometry2D.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Geometry3D.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Group.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Light.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Macro.hpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Metadata.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Networking.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Node.hpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Postprocess.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Rendering.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Shape.cpp create mode 100644 src/3rdparty/assimp/code/X3DImporter_Texturing.cpp create mode 100644 src/3rdparty/assimp/code/X3DVocabulary.cpp create mode 100644 src/3rdparty/assimp/code/glTF2Asset.h create mode 100644 src/3rdparty/assimp/code/glTF2Asset.inl create mode 100644 src/3rdparty/assimp/code/glTF2AssetWriter.h create mode 100644 src/3rdparty/assimp/code/glTF2AssetWriter.inl create mode 100644 src/3rdparty/assimp/code/glTF2Exporter.cpp create mode 100644 src/3rdparty/assimp/code/glTF2Exporter.h create mode 100644 src/3rdparty/assimp/code/glTF2Importer.cpp create mode 100644 src/3rdparty/assimp/code/glTF2Importer.h delete mode 100644 src/3rdparty/assimp/code/makefile.mingw create mode 100644 src/3rdparty/assimp/code/scene.cpp delete mode 100644 src/3rdparty/assimp/contrib/ConvertUTF/ConvertUTF.c delete mode 100644 src/3rdparty/assimp/contrib/ConvertUTF/ConvertUTF.h delete mode 100644 src/3rdparty/assimp/contrib/ConvertUTF/readme.txt create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcAdjacencyInfo.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcArithmeticCodec.cpp create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcArithmeticCodec.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcBinaryStream.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcCommon.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcDVEncodeParams.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcDynamicVector.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcDynamicVectorDecoder.cpp create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcDynamicVectorDecoder.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcDynamicVectorEncoder.cpp create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcDynamicVectorEncoder.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcFIFO.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcIndexedFaceSet.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcIndexedFaceSet.inl create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcSC3DMCDecoder.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcSC3DMCEncodeParams.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcSC3DMCEncoder.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcSC3DMCEncoder.inl create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTimer.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTools.cpp create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTriangleFans.cpp create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTriangleFans.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTriangleListDecoder.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTriangleListDecoder.inl create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTriangleListEncoder.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcTriangleListEncoder.inl create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcVector.h create mode 100644 src/3rdparty/assimp/contrib/Open3DGC/o3dgcVector.inl create mode 100644 src/3rdparty/assimp/contrib/openddlparser/code/OpenDDLStream.cpp create mode 100644 src/3rdparty/assimp/contrib/openddlparser/include/openddlparser/OpenDDLStream.h create mode 100644 src/3rdparty/assimp/contrib/rapidjson/include/rapidjson/fwd.h create mode 100644 src/3rdparty/assimp/contrib/rapidjson/include/rapidjson/internal/regex.h create mode 100644 src/3rdparty/assimp/contrib/rapidjson/include/rapidjson/istreamwrapper.h create mode 100644 src/3rdparty/assimp/contrib/rapidjson/include/rapidjson/ostreamwrapper.h create mode 100644 src/3rdparty/assimp/contrib/rapidjson/include/rapidjson/schema.h create mode 100644 src/3rdparty/assimp/contrib/rapidjson/include/rapidjson/stream.h create mode 100644 src/3rdparty/assimp/contrib/utf8cpp/doc/ReleaseNotes create mode 100644 src/3rdparty/assimp/contrib/utf8cpp/doc/utf8cpp.html create mode 100644 src/3rdparty/assimp/contrib/utf8cpp/source/utf8.h create mode 100644 src/3rdparty/assimp/contrib/utf8cpp/source/utf8/checked.h create mode 100644 src/3rdparty/assimp/contrib/utf8cpp/source/utf8/core.h create mode 100644 src/3rdparty/assimp/contrib/utf8cpp/source/utf8/unchecked.h create mode 100644 src/3rdparty/assimp/contrib/zip/README.md create mode 100644 src/3rdparty/assimp/contrib/zip/UNLICENSE create mode 100644 src/3rdparty/assimp/contrib/zip/src/miniz.h create mode 100644 src/3rdparty/assimp/contrib/zip/src/zip.c create mode 100644 src/3rdparty/assimp/contrib/zip/src/zip.h create mode 100644 src/3rdparty/assimp/include/assimp/DefaultIOStream.h create mode 100644 src/3rdparty/assimp/include/assimp/DefaultIOSystem.h create mode 100644 src/3rdparty/assimp/include/assimp/Defines.h create mode 100644 src/3rdparty/assimp/include/assimp/SceneCombiner.h (limited to 'src/3rdparty') diff --git a/src/3rdparty/assimp/Readme.md b/src/3rdparty/assimp/Readme.md index e4fe07b02..1f6c4118f 100644 --- a/src/3rdparty/assimp/Readme.md +++ b/src/3rdparty/assimp/Readme.md @@ -1,71 +1,100 @@ Open Asset Import Library (assimp) ================================== +A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data. +### Current build status ### +[![Linux Build Status](https://travis-ci.org/assimp/assimp.svg)](https://travis-ci.org/assimp/assimp) +[![Windows Build Status](https://ci.appveyor.com/api/projects/status/tmo433wax6u6cjp4?svg=true)](https://ci.appveyor.com/project/kimkulling/assimp) + + Coverity Scan Build Status + +[![Coverage Status](https://coveralls.io/repos/github/assimp/assimp/badge.svg?branch=master)](https://coveralls.io/github/assimp/assimp?branch=master) +[![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS. Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more. -This is the development trunk containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [assimp.sf.net](http://assimp.sf.net) or from *nix package repositories. -The current build status is: +This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases). + +Monthly donations via Patreon: +
[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/assimp) + +
+ +One-off donations via PayPal: +
[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4) -Linux [![Linux Build Status](https://travis-ci.org/assimp/assimp.png)](https://travis-ci.org/assimp/assimp) -Windows [![Windows Build Status](https://ci.appveyor.com/api/projects/status/tmo433wax6u6cjp4?svg=true)](https://ci.appveyor.com/project/kimkulling/assimp) -Coverity - Coverity Scan Build Status - -Gitter [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-__[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.__ + +Please check our Wiki as well: https://github.com/assimp/assimp/wiki #### Supported file formats #### -A full list [is here](http://assimp.sourceforge.net/main_features_formats.html). +A full list [is here](http://assimp.org/main_features_formats.html). __Importers__: - +- 3D - 3DS +- 3MF +- AC +- AC3D +- ACC +- AMJ +- ASE +- ASK +- B3D; - BLEND (Blender) +- BVH +- COB +- CMS - DAE/Collada +- DXF +- ENFF - FBX +- glTF 1.0 + GLB +- glTF 2.0 +- HMB - IFC-STEP -- ASE -- DXF -- HMP +- IRR / IRRMESH +- LWO +- LWS +- LXO - MD2 - MD3 - MD5 - MDC - MDL +- MESH / MESH.XML +- MOT +- MS3D +- NDO - NFF -- PLY -- STL -- X - OBJ -- OpenGEX +- OFF +- OGEX +- PLY +- PMX +- PRJ +- Q3O +- Q3S +- RAW +- SCN +- SIB - SMD -- LWO -- LXO -- LWS +- STL +- STP - TER -- AC3D -- MS3D -- COB -- Q3BSP +- UC +- VTA +- X +- X3D - XGL -- CSM -- BVH -- B3D -- NDO -- Ogre Binary -- Ogre XML -- Q3D -- ASSBIN (Assimp custom format) -- glTF (partial) -- 3MF +- ZGL Additionally, some formats are supported by dependency on non-free code or external SDKs (not built by default): -- C4D (https://github.com/acgessler/assimp-cinema4d) +- C4D (https://github.com/assimp/assimp/wiki/Cinema4D-&-Melange) __Exporters__: @@ -78,7 +107,8 @@ __Exporters__: - JSON (for WebGl, via https://github.com/acgessler/assimp2json) - ASSBIN - STEP -- glTF (partial) +- glTF 1.0 (partial) +- glTF 2.0 (partial) ### Building ### Take a look into the `INSTALL` file. Our build system is CMake, if you used CMake before there is a good chance you know what to do. @@ -88,6 +118,12 @@ Take a look into the `INSTALL` file. Our build system is CMake, if you used CMak * [Python](port/PyAssimp/README.md) * [.NET](port/AssimpNET/Readme.md) * [Pascal](port/AssimpPascal/Readme.md) +* [Javascript (Alpha)](https://github.com/makc/assimp2json) +* [Unity 3d Plugin](https://www.assetstore.unity3d.com/en/#!/content/91777) +* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (currently supported obj, ply, stl, collada, md2) + +### Other tools ### +[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities. #### Repository structure #### Open Asset Import Library is implemented in C++. The directory structure is: @@ -107,7 +143,7 @@ Open Asset Import Library is implemented in C++. The directory structure is: ### Where to get help ### -For more information, visit [our website](http://assimp.sourceforge.net/). Or check out the `./doc`- folder, which contains the official documentation in HTML format. +For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format. (CHMs for Windows are included in some release packages and should be located right here in the root folder). If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github. @@ -117,17 +153,12 @@ For development discussions, there is also a (very low-volume) mailing list, _as Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export. -And we also have an IRC-channel at freenode: #assetimporterlib . You can easily join us via: [KiwiIRC/freenote](https://kiwiirc.com/client/irc.freenode.net), choose your nickname and type -> /join #assetimporterlib +And we also have a Gitter-channel:Gitter [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
### Contributing ### Contributions to assimp are highly appreciated. The easiest way to get involved is to submit a pull request with your changes against the main repository's `master` branch. -### Donate ### -If you like assimp, consider buying us a beer (or two): -[Donate](http://sourceforge.net/donate/index.php?group_id=226462) - ### License ### Our license is based on the modified, __3-clause BSD__-License. diff --git a/src/3rdparty/assimp/assimp.pri b/src/3rdparty/assimp/assimp.pri index 4c0eb40c9..1dc7849bc 100644 --- a/src/3rdparty/assimp/assimp.pri +++ b/src/3rdparty/assimp/assimp.pri @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Sun Mar 23 23:00:48 2014 -###################################################################### - # AssImp expects this to be defined on debug builds CONFIG(debug, debug|release) : DEFINES+=_DEBUG CONFIG += exceptions rtti @@ -21,7 +17,8 @@ DEFINES += \ ASSIMP_BUILD_NO_Q3BSP_IMPORTER \ ASSIMP_BUILD_NO_C4D_IMPORTER \ ASSIMP_BUILD_NO_3MF_IMPORTER \ - OPENDDL_STATIC_LIBARY + OPENDDL_STATIC_LIBARY \ + NOUNCRYPT intel_icc: { # warning #310: old-style parameter list (anachronism) @@ -81,469 +78,533 @@ INCLUDEPATH += \ # Input HEADERS += revision.h \ - code/3DSExporter.h \ - code/3DSHelper.h \ - code/3DSLoader.h \ - code/ACLoader.h \ - code/ASELoader.h \ - code/ASEParser.h \ - code/assbin_chunks.h \ - code/AssbinExporter.h \ - code/AssbinLoader.h \ - code/AssxmlExporter.h \ - code/B3DImporter.h \ - code/BaseImporter.h \ - code/BaseProcess.h \ - code/Bitmap.h \ - code/BlenderBMesh.h \ - code/BlenderDNA.h \ - code/BlenderDNA.inl \ - code/BlenderIntermediate.h \ - code/BlenderLoader.h \ - code/BlenderModifier.h \ - code/BlenderScene.h \ - code/BlenderSceneGen.h \ - code/BlenderTessellator.h \ - code/BlobIOSystem.h \ - code/BVHLoader.h \ - code/ByteSwapper.h \ - code/C4DImporter.h \ - code/CalcTangentsProcess.h \ - code/CInterfaceIOWrapper.h \ - code/COBLoader.h \ - code/COBScene.h \ - code/ColladaExporter.h \ - code/ColladaHelper.h \ - code/ColladaLoader.h \ - code/ColladaParser.h \ - code/ComputeUVMappingProcess.h \ - code/ConvertToLHProcess.h \ - code/CreateAnimMesh.h \ - code/CSMLoader.h \ - code/D3MFImporter.h \ - code/D3MFOpcPackage.h \ - code/DeboneProcess.h \ - code/DefaultIOStream.h \ - code/DefaultIOSystem.h \ - code/DefaultProgressHandler.h \ - code/Defines.h \ - code/DXFHelper.h \ - code/DXFLoader.h \ - code/Exceptional.h \ - code/fast_atof.h \ - code/FBXCompileConfig.h \ - code/FBXConverter.h \ - code/FBXDocument.h \ - code/FBXDocumentUtil.h \ - code/FBXImporter.h \ - code/FBXImportSettings.h \ - code/FBXMeshGeometry.h \ - code/FBXParser.h \ - code/FBXProperties.h \ - code/FBXTokenizer.h \ - code/FBXUtil.h \ - code/FileLogStream.h \ - code/FileSystemFilter.h \ - code/FindDegenerates.h \ - code/FindInstancesProcess.h \ - code/FindInvalidDataProcess.h \ - code/FixNormalsStep.h \ - code/GenericProperty.h \ - code/GenFaceNormalsProcess.h \ - code/GenVertexNormalsProcess.h \ - code/glTFAsset.h \ - code/glTFAsset.inl \ - code/glTFAssetWriter.h \ - code/glTFAssetWriter.inl \ - code/glTFExporter.h \ - code/glTFImporter.h \ - code/HalfLifeFileData.h \ - code/Hash.h \ - code/HMPFileData.h \ - code/HMPLoader.h \ - code/IFCLoader.h \ - code/IFCReaderGen.h \ - code/IFCUtil.h \ - code/IFF.h \ - code/Importer.h \ - code/ImproveCacheLocality.h \ - code/IRRLoader.h \ - code/IRRMeshLoader.h \ - code/IRRShared.h \ - code/irrXMLWrapper.h \ - code/JoinVerticesProcess.h \ - code/LimitBoneWeightsProcess.h \ - code/LineSplitter.h \ - code/LogAux.h \ - code/LWOAnimation.h \ - code/LWOFileData.h \ - code/LWOLoader.h \ - code/LWSLoader.h \ - code/Macros.h \ - code/MakeVerboseFormat.h \ - code/MaterialSystem.h \ - code/MathFunctions.h \ - code/MD2FileData.h \ - code/MD2Loader.h \ - code/MD2NormalTable.h \ - code/MD3FileData.h \ - code/MD3Loader.h \ - code/MD4FileData.h \ - code/MD5Loader.h \ - code/MD5Parser.h \ - code/MDCFileData.h \ - code/MDCLoader.h \ - code/MDCNormalTable.h \ - code/MDLDefaultColorMap.h \ - code/MDLFileData.h \ - code/MDLLoader.h \ - code/MemoryIOWrapper.h \ - code/MS3DLoader.h \ - code/NDOLoader.h \ - code/NFFLoader.h \ - code/ObjExporter.h \ - code/ObjFileData.h \ - code/ObjFileImporter.h \ - code/ObjFileMtlImporter.h \ - code/ObjFileParser.h \ - code/ObjTools.h \ - code/OFFLoader.h \ - code/OgreBinarySerializer.h \ - code/OgreImporter.h \ - code/OgreParsingUtils.h \ - code/OgreStructs.h \ - code/OgreXmlSerializer.h \ - code/OpenGEXExporter.h \ - code/OpenGEXImporter.h \ - code/OpenGEXStructs.h \ - code/OptimizeGraph.h \ - code/OptimizeMeshes.h \ - code/ParsingUtils.h \ - code/PlyExporter.h \ - code/PlyLoader.h \ - code/PlyParser.h \ - code/PolyTools.h \ - code/PretransformVertices.h \ - code/ProcessHelper.h \ - code/Profiler.h \ - code/Q3BSPFileData.h \ - code/Q3BSPFileImporter.h \ - code/Q3BSPFileParser.h \ - code/Q3BSPZipArchive.h \ - code/Q3DLoader.h \ - code/qnan.h \ - code/RawLoader.h \ - code/RemoveComments.h \ - code/RemoveRedundantMaterials.h \ - code/RemoveVCProcess.h \ - code/SceneCombiner.h \ - code/ScenePreprocessor.h \ - code/ScenePrivate.h \ - code/SGSpatialSort.h \ - code/SIBImporter.h \ - code/SkeletonMeshBuilder.h \ - code/SMDLoader.h \ - code/SmoothingGroups.h \ - code/SmoothingGroups.inl \ - code/SortByPTypeProcess.h \ - code/SpatialSort.h \ - code/SplitByBoneCountProcess.h \ - code/SplitLargeMeshes.h \ - code/StandardShapes.h \ - code/StdOStreamLogStream.h \ - code/StepExporter.h \ - code/STEPFile.h \ - code/STEPFileEncoding.h \ - code/STEPFileReader.h \ - code/STLExporter.h \ - code/STLLoader.h \ - code/StreamReader.h \ - code/StreamWriter.h \ - code/StringComparison.h \ - code/StringUtils.h \ - code/Subdivision.h \ - code/TargetAnimation.h \ - code/TerragenLoader.h \ - code/TextureTransform.h \ - code/TinyFormatter.h \ - code/TriangulateProcess.h \ - code/UnrealLoader.h \ - code/ValidateDataStructure.h \ - code/Vertex.h \ - code/VertexTriangleAdjacency.h \ - code/Win32DebugLogStream.h \ - code/XFileExporter.h \ - code/XFileHelper.h \ - code/XFileImporter.h \ - code/XFileParser.h \ - code/XGLLoader.h \ - code/XMLTools.h \ - code/res/resource.h \ - contrib/clipper/clipper.hpp \ - contrib/ConvertUTF/ConvertUTF.h \ - contrib/irrXML/CXMLReaderImpl.h \ - contrib/irrXML/heapsort.h \ - contrib/irrXML/irrArray.h \ - contrib/irrXML/irrString.h \ - contrib/irrXML/irrTypes.h \ - contrib/irrXML/irrXML.h \ - contrib/openddlparser/include/openddlparser/DDLNode.h \ - contrib/openddlparser/include/openddlparser/OpenDDLCommon.h \ - contrib/openddlparser/include/openddlparser/OpenDDLExport.h \ - contrib/openddlparser/include/openddlparser/OpenDDLParser.h \ - contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h \ - contrib/openddlparser/include/openddlparser/Value.h \ - contrib/poly2tri/poly2tri/poly2tri.h \ - contrib/poly2tri/poly2tri/common/shapes.h \ - contrib/poly2tri/poly2tri/common/utils.h \ - contrib/poly2tri/poly2tri/sweep/advancing_front.h \ - contrib/poly2tri/poly2tri/sweep/cdt.h \ - contrib/poly2tri/poly2tri/sweep/sweep.h \ - contrib/poly2tri/poly2tri/sweep/sweep_context.h \ - contrib/rapidjson/include/rapidjson/allocators.h \ - contrib/rapidjson/include/rapidjson/document.h \ - contrib/rapidjson/include/rapidjson/encodedstream.h \ - contrib/rapidjson/include/rapidjson/encodings.h \ - contrib/rapidjson/include/rapidjson/error/en.h \ - contrib/rapidjson/include/rapidjson/error/error.h \ - contrib/rapidjson/include/rapidjson/filereadstream.h \ - contrib/rapidjson/include/rapidjson/filewritestream.h \ - contrib/rapidjson/include/rapidjson/internal/biginteger.h \ - contrib/rapidjson/include/rapidjson/internal/diyfp.h \ - contrib/rapidjson/include/rapidjson/internal/dtoa.h \ - contrib/rapidjson/include/rapidjson/internal/ieee754.h \ - contrib/rapidjson/include/rapidjson/internal/itoa.h \ - contrib/rapidjson/include/rapidjson/internal/meta.h \ - contrib/rapidjson/include/rapidjson/internal/pow10.h \ - contrib/rapidjson/include/rapidjson/internal/stack.h \ - contrib/rapidjson/include/rapidjson/internal/strfunc.h \ - contrib/rapidjson/include/rapidjson/internal/strtod.h \ - contrib/rapidjson/include/rapidjson/internal/swap.h \ - contrib/rapidjson/include/rapidjson/memorybuffer.h \ - contrib/rapidjson/include/rapidjson/memorystream.h \ - contrib/rapidjson/include/rapidjson/msinttypes/inttypes.h \ - contrib/rapidjson/include/rapidjson/msinttypes/stdint.h \ - contrib/rapidjson/include/rapidjson/pointer.h \ - contrib/rapidjson/include/rapidjson/prettywriter.h \ - contrib/rapidjson/include/rapidjson/rapidjson.h \ - contrib/rapidjson/include/rapidjson/reader.h \ - contrib/rapidjson/include/rapidjson/stringbuffer.h \ - contrib/rapidjson/include/rapidjson/writer.h \ - contrib/unzip/crypt.h \ - contrib/unzip/ioapi.h \ - contrib/unzip/unzip.h \ - include/assimp/ai_assert.h \ - include/assimp/anim.h \ - include/assimp/camera.h \ - include/assimp/cexport.h \ - include/assimp/cfileio.h \ - include/assimp/cimport.h \ - include/assimp/color4.h \ - include/assimp/color4.inl \ - include/assimp/config.h \ - include/assimp/DefaultLogger.hpp \ - include/assimp/defs.h \ - include/assimp/Exporter.hpp \ - include/assimp/Importer.hpp \ - include/assimp/importerdesc.h \ - include/assimp/IOStream.hpp \ - include/assimp/IOSystem.hpp \ - include/assimp/light.h \ - include/assimp/Logger.hpp \ - include/assimp/LogStream.hpp \ - include/assimp/material.h \ - include/assimp/material.inl \ - include/assimp/matrix3x3.h \ - include/assimp/matrix3x3.inl \ - include/assimp/matrix4x4.h \ - include/assimp/matrix4x4.inl \ - include/assimp/mesh.h \ - include/assimp/metadata.h \ - include/assimp/NullLogger.hpp \ - include/assimp/postprocess.h \ - include/assimp/ProgressHandler.hpp \ - include/assimp/quaternion.h \ - include/assimp/quaternion.inl \ - include/assimp/scene.h \ - include/assimp/texture.h \ - include/assimp/types.h \ - include/assimp/vector2.h \ - include/assimp/vector2.inl \ - include/assimp/vector3.h \ - include/assimp/vector3.inl \ - include/assimp/version.h \ - include/assimp/Compiler/poppack1.h \ - include/assimp/Compiler/pushpack1.h \ - include/assimp/Compiler/pstdint.h + code/3DSExporter.h \ + code/3DSHelper.h \ + code/3DSLoader.h \ + code/3MFXmlTags.h \ + code/ACLoader.h \ + code/ASELoader.h \ + code/ASEParser.h \ + code/AssbinExporter.h \ + code/AssbinLoader.h \ + code/AssxmlExporter.h \ + code/B3DImporter.h \ + code/BVHLoader.h \ + code/BaseImporter.h \ + code/BaseProcess.h \ + code/Bitmap.h \ + code/BlenderBMesh.h \ + code/BlenderDNA.h \ + code/BlenderIntermediate.h \ + code/BlenderLoader.h \ + code/BlenderModifier.h \ + code/BlenderScene.h \ + code/BlenderSceneGen.h \ + code/BlenderTessellator.h \ + code/BlobIOSystem.h \ + code/ByteSwapper.h \ + code/C4DImporter.h \ + code/CInterfaceIOWrapper.h \ + code/COBLoader.h \ + code/COBScene.h \ + code/CSMLoader.h \ + code/CalcTangentsProcess.h \ + code/ColladaExporter.h \ + code/ColladaHelper.h \ + code/ColladaLoader.h \ + code/ColladaParser.h \ + code/ComputeUVMappingProcess.h \ + code/ConvertToLHProcess.h \ + code/CreateAnimMesh.h \ + code/D3MFExporter.h \ + code/D3MFImporter.h \ + code/D3MFOpcPackage.h \ + code/DXFHelper.h \ + code/DXFLoader.h \ + code/DeboneProcess.h \ + code/DefaultProgressHandler.h \ + code/Exceptional.h \ + code/FBXCompileConfig.h \ + code/FBXConverter.h \ + code/FBXDocument.h \ + code/FBXDocumentUtil.h \ + code/FBXImportSettings.h \ + code/FBXImporter.h \ + code/FBXMeshGeometry.h \ + code/FBXParser.h \ + code/FBXProperties.h \ + code/FBXTokenizer.h \ + code/FBXUtil.h \ + code/FileLogStream.h \ + code/FileSystemFilter.h \ + code/FindDegenerates.h \ + code/FindInstancesProcess.h \ + code/FindInvalidDataProcess.h \ + code/FixNormalsStep.h \ + code/GenFaceNormalsProcess.h \ + code/GenVertexNormalsProcess.h \ + code/GenericProperty.h \ + code/HMPFileData.h \ + code/HMPLoader.h \ + code/HalfLifeFileData.h \ + code/Hash.h \ + code/IFCLoader.h \ + code/IFCReaderGen.h \ + code/IFCUtil.h \ + code/IFF.h \ + code/IOStreamBuffer.h \ + code/IRRLoader.h \ + code/IRRMeshLoader.h \ + code/IRRShared.h \ + code/Importer.h \ + code/ImproveCacheLocality.h \ + code/JoinVerticesProcess.h \ + code/LWOAnimation.h \ + code/LWOFileData.h \ + code/LWOLoader.h \ + code/LWSLoader.h \ + code/LimitBoneWeightsProcess.h \ + code/LineSplitter.h \ + code/LogAux.h \ + code/MD2FileData.h \ + code/MD2Loader.h \ + code/MD2NormalTable.h \ + code/MD3FileData.h \ + code/MD3Loader.h \ + code/MD4FileData.h \ + code/MD5Loader.h \ + code/MD5Parser.h \ + code/MDCFileData.h \ + code/MDCLoader.h \ + code/MDCNormalTable.h \ + code/MDLDefaultColorMap.h \ + code/MDLFileData.h \ + code/MDLLoader.h \ + code/MMDCpp14.h \ + code/MMDImporter.h \ + code/MMDPmdParser.h \ + code/MMDPmxParser.h \ + code/MMDVmdParser.h \ + code/MS3DLoader.h \ + code/Macros.h \ + code/MakeVerboseFormat.h \ + code/MaterialSystem.h \ + code/MathFunctions.h \ + code/MemoryIOWrapper.h \ + code/NDOLoader.h \ + code/NFFLoader.h \ + code/OFFLoader.h \ + code/ObjExporter.h \ + code/ObjFileData.h \ + code/ObjFileImporter.h \ + code/ObjFileMtlImporter.h \ + code/ObjFileParser.h \ + code/ObjTools.h \ + code/OgreBinarySerializer.h \ + code/OgreImporter.h \ + code/OgreParsingUtils.h \ + code/OgreStructs.h \ + code/OgreXmlSerializer.h \ + code/OpenGEXExporter.h \ + code/OpenGEXImporter.h \ + code/OpenGEXStructs.h \ + code/OptimizeGraph.h \ + code/OptimizeMeshes.h \ + code/ParsingUtils.h \ + code/PlyExporter.h \ + code/PlyLoader.h \ + code/PlyParser.h \ + code/PolyTools.h \ + code/PretransformVertices.h \ + code/ProcessHelper.h \ + code/Profiler.h \ + code/Q3BSPFileData.h \ + code/Q3BSPFileImporter.h \ + code/Q3BSPFileParser.h \ + code/Q3BSPZipArchive.h \ + code/Q3DLoader.h \ + code/RawLoader.h \ + code/RemoveComments.h \ + code/RemoveRedundantMaterials.h \ + code/RemoveVCProcess.h \ + code/SGSpatialSort.h \ + code/SIBImporter.h \ + code/SMDLoader.h \ + code/STEPFile.h \ + code/STEPFileEncoding.h \ + code/STEPFileReader.h \ + code/STLExporter.h \ + code/STLLoader.h \ + code/ScaleProcess.h \ + code/ScenePreprocessor.h \ + code/ScenePrivate.h \ + code/SkeletonMeshBuilder.h \ + code/SmoothingGroups.h \ + code/SortByPTypeProcess.h \ + code/SpatialSort.h \ + code/SplitByBoneCountProcess.h \ + code/SplitLargeMeshes.h \ + code/StandardShapes.h \ + code/StdOStreamLogStream.h \ + code/StepExporter.h \ + code/StreamReader.h \ + code/StreamWriter.h \ + code/StringComparison.h \ + code/StringUtils.h \ + code/Subdivision.h \ + code/TargetAnimation.h \ + code/TerragenLoader.h \ + code/TextureTransform.h \ + code/TinyFormatter.h \ + code/TriangulateProcess.h \ + code/UnrealLoader.h \ + code/ValidateDataStructure.h \ + code/Vertex.h \ + code/VertexTriangleAdjacency.h \ + code/Win32DebugLogStream.h \ + code/XFileExporter.h \ + code/XFileHelper.h \ + code/XFileImporter.h \ + code/XFileParser.h \ + code/XGLLoader.h \ + code/XMLTools.h \ + code/assbin_chunks.h \ + code/fast_atof.h \ + code/glTF2Asset.h \ + code/glTF2AssetWriter.h \ + code/glTF2Exporter.h \ + code/glTF2Importer.h \ + code/glTFAsset.h \ + code/glTFAssetWriter.h \ + code/glTFExporter.h \ + code/glTFImporter.h \ + code/irrXMLWrapper.h \ + code/qnan.h \ + code/res/resource.h \ + contrib/Open3DGC/o3dgcAdjacencyInfo.h \ + contrib/Open3DGC/o3dgcArithmeticCodec.h \ + contrib/Open3DGC/o3dgcBinaryStream.h \ + contrib/Open3DGC/o3dgcCommon.h \ + contrib/Open3DGC/o3dgcDVEncodeParams.h \ + contrib/Open3DGC/o3dgcDynamicVector.h \ + contrib/Open3DGC/o3dgcDynamicVectorDecoder.h \ + contrib/Open3DGC/o3dgcDynamicVectorEncoder.h \ + contrib/Open3DGC/o3dgcFIFO.h \ + contrib/Open3DGC/o3dgcIndexedFaceSet.h \ + contrib/Open3DGC/o3dgcSC3DMCDecoder.h \ + contrib/Open3DGC/o3dgcSC3DMCEncodeParams.h \ + contrib/Open3DGC/o3dgcSC3DMCEncoder.h \ + contrib/Open3DGC/o3dgcTimer.h \ + contrib/Open3DGC/o3dgcTriangleFans.h \ + contrib/Open3DGC/o3dgcTriangleListDecoder.h \ + contrib/Open3DGC/o3dgcTriangleListEncoder.h \ + contrib/Open3DGC/o3dgcVector.h \ + contrib/clipper/clipper.hpp \ + contrib/irrXML/CXMLReaderImpl.h \ + contrib/irrXML/heapsort.h \ + contrib/irrXML/irrArray.h \ + contrib/irrXML/irrString.h \ + contrib/irrXML/irrTypes.h \ + contrib/irrXML/irrXML.h \ + contrib/openddlparser/include/openddlparser/DDLNode.h \ + contrib/openddlparser/include/openddlparser/OpenDDLCommon.h \ + contrib/openddlparser/include/openddlparser/OpenDDLExport.h \ + contrib/openddlparser/include/openddlparser/OpenDDLParser.h \ + contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h \ + contrib/openddlparser/include/openddlparser/OpenDDLStream.h \ + contrib/openddlparser/include/openddlparser/Value.h \ + contrib/poly2tri/poly2tri/common/shapes.h \ + contrib/poly2tri/poly2tri/common/utils.h \ + contrib/poly2tri/poly2tri/poly2tri.h \ + contrib/poly2tri/poly2tri/sweep/advancing_front.h \ + contrib/poly2tri/poly2tri/sweep/cdt.h \ + contrib/poly2tri/poly2tri/sweep/sweep.h \ + contrib/poly2tri/poly2tri/sweep/sweep_context.h \ + contrib/rapidjson/include/rapidjson/allocators.h \ + contrib/rapidjson/include/rapidjson/document.h \ + contrib/rapidjson/include/rapidjson/encodedstream.h \ + contrib/rapidjson/include/rapidjson/encodings.h \ + contrib/rapidjson/include/rapidjson/error/en.h \ + contrib/rapidjson/include/rapidjson/error/error.h \ + contrib/rapidjson/include/rapidjson/filereadstream.h \ + contrib/rapidjson/include/rapidjson/filewritestream.h \ + contrib/rapidjson/include/rapidjson/fwd.h \ + contrib/rapidjson/include/rapidjson/internal/biginteger.h \ + contrib/rapidjson/include/rapidjson/internal/diyfp.h \ + contrib/rapidjson/include/rapidjson/internal/dtoa.h \ + contrib/rapidjson/include/rapidjson/internal/ieee754.h \ + contrib/rapidjson/include/rapidjson/internal/itoa.h \ + contrib/rapidjson/include/rapidjson/internal/meta.h \ + contrib/rapidjson/include/rapidjson/internal/pow10.h \ + contrib/rapidjson/include/rapidjson/internal/regex.h \ + contrib/rapidjson/include/rapidjson/internal/stack.h \ + contrib/rapidjson/include/rapidjson/internal/strfunc.h \ + contrib/rapidjson/include/rapidjson/internal/strtod.h \ + contrib/rapidjson/include/rapidjson/internal/swap.h \ + contrib/rapidjson/include/rapidjson/istreamwrapper.h \ + contrib/rapidjson/include/rapidjson/memorybuffer.h \ + contrib/rapidjson/include/rapidjson/memorystream.h \ + contrib/rapidjson/include/rapidjson/msinttypes/inttypes.h \ + contrib/rapidjson/include/rapidjson/msinttypes/stdint.h \ + contrib/rapidjson/include/rapidjson/ostreamwrapper.h \ + contrib/rapidjson/include/rapidjson/pointer.h \ + contrib/rapidjson/include/rapidjson/prettywriter.h \ + contrib/rapidjson/include/rapidjson/rapidjson.h \ + contrib/rapidjson/include/rapidjson/reader.h \ + contrib/rapidjson/include/rapidjson/schema.h \ + contrib/rapidjson/include/rapidjson/stream.h \ + contrib/rapidjson/include/rapidjson/stringbuffer.h \ + contrib/rapidjson/include/rapidjson/writer.h \ + contrib/unzip/crypt.h \ + contrib/unzip/ioapi.h \ + contrib/unzip/unzip.h \ + contrib/utf8cpp/source/utf8.h \ + contrib/utf8cpp/source/utf8/checked.h \ + contrib/utf8cpp/source/utf8/core.h \ + contrib/utf8cpp/source/utf8/unchecked.h \ + include/assimp/Compiler/poppack1.h \ + include/assimp/Compiler/pstdint.h \ + include/assimp/Compiler/pushpack1.h \ + include/assimp/DefaultIOStream.h \ + include/assimp/DefaultIOSystem.h \ + include/assimp/DefaultLogger.hpp \ + include/assimp/Defines.h \ + include/assimp/Exporter.hpp \ + include/assimp/IOStream.hpp \ + include/assimp/IOSystem.hpp \ + include/assimp/Importer.hpp \ + include/assimp/LogStream.hpp \ + include/assimp/Logger.hpp \ + include/assimp/NullLogger.hpp \ + include/assimp/ProgressHandler.hpp \ + include/assimp/SceneCombiner.h \ + include/assimp/ai_assert.h \ + include/assimp/anim.h \ + include/assimp/camera.h \ + include/assimp/cexport.h \ + include/assimp/cfileio.h \ + include/assimp/cimport.h \ + include/assimp/color4.h \ + include/assimp/config.h \ + include/assimp/defs.h \ + include/assimp/importerdesc.h \ + include/assimp/light.h \ + include/assimp/material.h \ + include/assimp/matrix3x3.h \ + include/assimp/matrix4x4.h \ + include/assimp/mesh.h \ + include/assimp/metadata.h \ + include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h \ + include/assimp/postprocess.h \ + include/assimp/quaternion.h \ + include/assimp/scene.h \ + include/assimp/texture.h \ + include/assimp/types.h \ + include/assimp/vector2.h \ + include/assimp/vector3.h \ + include/assimp/version.h -SOURCES += code/3DSConverter.cpp \ - code/3DSExporter.cpp \ - code/3DSLoader.cpp \ - code/ACLoader.cpp \ - code/ASELoader.cpp \ - code/ASEParser.cpp \ - code/AssbinExporter.cpp \ - code/AssbinLoader.cpp \ - code/Assimp.cpp \ - code/AssimpCExport.cpp \ - code/AssxmlExporter.cpp \ - code/B3DImporter.cpp \ - code/BaseImporter.cpp \ - code/BaseProcess.cpp \ - code/Bitmap.cpp \ - code/BlenderBMesh.cpp \ - code/BlenderDNA.cpp \ - code/BlenderLoader.cpp \ - code/BlenderModifier.cpp \ - code/BlenderScene.cpp \ - code/BlenderTessellator.cpp \ - code/BVHLoader.cpp \ - code/C4DImporter.cpp \ - code/CalcTangentsProcess.cpp \ - code/COBLoader.cpp \ - code/ColladaExporter.cpp \ - code/ColladaLoader.cpp \ - code/ColladaParser.cpp \ - code/ComputeUVMappingProcess.cpp \ - code/ConvertToLHProcess.cpp \ - code/CreateAnimMesh.cpp \ - code/CSMLoader.cpp \ - code/D3MFImporter.cpp \ - code/D3MFOpcPackage.cpp \ - code/DeboneProcess.cpp \ - code/DefaultIOStream.cpp \ - code/DefaultIOSystem.cpp \ - code/DefaultLogger.cpp \ - code/DXFLoader.cpp \ - code/Exporter.cpp \ - code/FBXAnimation.cpp \ - code/FBXBinaryTokenizer.cpp \ - code/FBXConverter.cpp \ - code/FBXDeformer.cpp \ - code/FBXDocument.cpp \ - code/FBXDocumentUtil.cpp \ - code/FBXImporter.cpp \ - code/FBXMaterial.cpp \ - code/FBXMeshGeometry.cpp \ - code/FBXModel.cpp \ - code/FBXNodeAttribute.cpp \ - code/FBXParser.cpp \ - code/FBXProperties.cpp \ - code/FBXTokenizer.cpp \ - code/FBXUtil.cpp \ - code/FindDegenerates.cpp \ - code/FindInstancesProcess.cpp \ - code/FindInvalidDataProcess.cpp \ - code/FixNormalsStep.cpp \ - code/GenFaceNormalsProcess.cpp \ - code/GenVertexNormalsProcess.cpp \ - code/glTFExporter.cpp \ - code/glTFImporter.cpp \ - code/HMPLoader.cpp \ - code/IFCBoolean.cpp \ - code/IFCCurve.cpp \ - code/IFCGeometry.cpp \ - code/IFCLoader.cpp \ - code/IFCMaterial.cpp \ - code/IFCOpenings.cpp \ - code/IFCProfile.cpp \ - code/IFCReaderGen1.cpp \ - code/IFCReaderGen2.cpp \ - code/IFCUtil.cpp \ - code/Importer.cpp \ - code/ImporterRegistry.cpp \ - code/ImproveCacheLocality.cpp \ - code/IRRLoader.cpp \ - code/IRRMeshLoader.cpp \ - code/IRRShared.cpp \ - code/JoinVerticesProcess.cpp \ - code/LimitBoneWeightsProcess.cpp \ - code/LWOAnimation.cpp \ - code/LWOBLoader.cpp \ - code/LWOLoader.cpp \ - code/LWOMaterial.cpp \ - code/LWSLoader.cpp \ - code/MakeVerboseFormat.cpp \ - code/MaterialSystem.cpp \ - code/MD2Loader.cpp \ - code/MD3Loader.cpp \ - code/MD5Loader.cpp \ - code/MD5Parser.cpp \ - code/MDCLoader.cpp \ - code/MDLLoader.cpp \ - code/MDLMaterialLoader.cpp \ - code/MS3DLoader.cpp \ - code/NDOLoader.cpp \ - code/NFFLoader.cpp \ - code/ObjExporter.cpp \ - code/ObjFileImporter.cpp \ - code/ObjFileMtlImporter.cpp \ - code/ObjFileParser.cpp \ - code/OFFLoader.cpp \ - code/OgreBinarySerializer.cpp \ - code/OgreImporter.cpp \ - code/OgreMaterial.cpp \ - code/OgreStructs.cpp \ - code/OgreXmlSerializer.cpp \ - code/OpenGEXExporter.cpp \ - code/OpenGEXImporter.cpp \ - code/OptimizeGraph.cpp \ - code/OptimizeMeshes.cpp \ - code/PlyExporter.cpp \ - code/PlyLoader.cpp \ - code/PlyParser.cpp \ - code/PostStepRegistry.cpp \ - code/PretransformVertices.cpp \ - code/ProcessHelper.cpp \ - code/Q3BSPFileImporter.cpp \ - code/Q3BSPFileParser.cpp \ - code/Q3BSPZipArchive.cpp \ - code/Q3DLoader.cpp \ - code/RawLoader.cpp \ - code/RemoveComments.cpp \ - code/RemoveRedundantMaterials.cpp \ - code/RemoveVCProcess.cpp \ - code/SceneCombiner.cpp \ - code/ScenePreprocessor.cpp \ - code/SGSpatialSort.cpp \ - code/SIBImporter.cpp \ - code/SkeletonMeshBuilder.cpp \ - code/SMDLoader.cpp \ - code/SortByPTypeProcess.cpp \ - code/SpatialSort.cpp \ - code/SplitByBoneCountProcess.cpp \ - code/SplitLargeMeshes.cpp \ - code/StandardShapes.cpp \ - code/StepExporter.cpp \ - code/STEPFileEncoding.cpp \ - code/STEPFileReader.cpp \ - code/STLExporter.cpp \ - code/STLLoader.cpp \ - code/Subdivision.cpp \ - code/TargetAnimation.cpp \ - code/TerragenLoader.cpp \ - code/TextureTransform.cpp \ - code/TriangulateProcess.cpp \ - code/UnrealLoader.cpp \ - code/ValidateDataStructure.cpp \ - code/Version.cpp \ - code/VertexTriangleAdjacency.cpp \ - code/XFileExporter.cpp \ - code/XFileImporter.cpp \ - code/XFileParser.cpp \ - code/XGLLoader.cpp \ - contrib/clipper/clipper.cpp \ - contrib/ConvertUTF/ConvertUTF.c \ - contrib/irrXML/irrXML.cpp \ - contrib/openddlparser/code/DDLNode.cpp \ - contrib/openddlparser/code/OpenDDLCommon.cpp \ - contrib/openddlparser/code/OpenDDLExport.cpp \ - contrib/openddlparser/code/OpenDDLParser.cpp \ - contrib/openddlparser/code/Value.cpp \ - contrib/poly2tri/poly2tri/common/shapes.cc \ - contrib/poly2tri/poly2tri/sweep/advancing_front.cc \ - contrib/poly2tri/poly2tri/sweep/cdt.cc \ - contrib/poly2tri/poly2tri/sweep/sweep.cc \ - contrib/poly2tri/poly2tri/sweep/sweep_context.cc \ - contrib/unzip/ioapi.c \ - contrib/unzip/unzip.c +SOURCES += \ + code/3DSConverter.cpp \ + code/3DSExporter.cpp \ + code/3DSLoader.cpp \ + code/ACLoader.cpp \ + code/AMFImporter.cpp \ + code/AMFImporter_Geometry.cpp \ + code/AMFImporter_Material.cpp \ + code/AMFImporter_Postprocess.cpp \ + code/ASELoader.cpp \ + code/ASEParser.cpp \ + code/AssbinExporter.cpp \ + code/AssbinLoader.cpp \ + code/Assimp.cpp \ + code/AssimpCExport.cpp \ + code/AssxmlExporter.cpp \ + code/B3DImporter.cpp \ + code/BVHLoader.cpp \ + code/BaseImporter.cpp \ + code/BaseProcess.cpp \ + code/Bitmap.cpp \ + code/BlenderBMesh.cpp \ + code/BlenderDNA.cpp \ + code/BlenderLoader.cpp \ + code/BlenderModifier.cpp \ + code/BlenderScene.cpp \ + code/BlenderTessellator.cpp \ + code/C4DImporter.cpp \ + code/CInterfaceIOWrapper.cpp \ + code/COBLoader.cpp \ + code/CSMLoader.cpp \ + code/CalcTangentsProcess.cpp \ + code/ColladaExporter.cpp \ + code/ColladaLoader.cpp \ + code/ColladaParser.cpp \ + code/ComputeUVMappingProcess.cpp \ + code/ConvertToLHProcess.cpp \ + code/CreateAnimMesh.cpp \ + code/D3MFExporter.cpp \ + code/D3MFImporter.cpp \ + code/D3MFOpcPackage.cpp \ + code/DXFLoader.cpp \ + code/DeboneProcess.cpp \ + code/DefaultIOStream.cpp \ + code/DefaultIOSystem.cpp \ + code/DefaultLogger.cpp \ + code/Exporter.cpp \ + code/FBXAnimation.cpp \ + code/FBXBinaryTokenizer.cpp \ + code/FBXConverter.cpp \ + code/FBXDeformer.cpp \ + code/FBXDocument.cpp \ + code/FBXDocumentUtil.cpp \ + code/FBXImporter.cpp \ + code/FBXMaterial.cpp \ + code/FBXMeshGeometry.cpp \ + code/FBXModel.cpp \ + code/FBXNodeAttribute.cpp \ + code/FBXParser.cpp \ + code/FBXProperties.cpp \ + code/FBXTokenizer.cpp \ + code/FBXUtil.cpp \ + code/FIReader.cpp \ + code/FindDegenerates.cpp \ + code/FindInstancesProcess.cpp \ + code/FindInvalidDataProcess.cpp \ + code/FixNormalsStep.cpp \ + code/GenFaceNormalsProcess.cpp \ + code/GenVertexNormalsProcess.cpp \ + code/HMPLoader.cpp \ + code/IFCBoolean.cpp \ + code/IFCCurve.cpp \ + code/IFCGeometry.cpp \ + code/IFCLoader.cpp \ + code/IFCMaterial.cpp \ + code/IFCOpenings.cpp \ + code/IFCProfile.cpp \ + code/IFCReaderGen1.cpp \ + code/IFCReaderGen2.cpp \ + code/IFCUtil.cpp \ + code/IRRLoader.cpp \ + code/IRRMeshLoader.cpp \ + code/IRRShared.cpp \ + code/Importer.cpp \ + code/ImporterRegistry.cpp \ + code/ImproveCacheLocality.cpp \ + code/JoinVerticesProcess.cpp \ + code/LWOAnimation.cpp \ + code/LWOBLoader.cpp \ + code/LWOLoader.cpp \ + code/LWOMaterial.cpp \ + code/LWSLoader.cpp \ + code/LimitBoneWeightsProcess.cpp \ + code/MD2Loader.cpp \ + code/MD3Loader.cpp \ + code/MD5Loader.cpp \ + code/MD5Parser.cpp \ + code/MDCLoader.cpp \ + code/MDLLoader.cpp \ + code/MDLMaterialLoader.cpp \ + code/MMDImporter.cpp \ + code/MMDPmxParser.cpp \ + code/MS3DLoader.cpp \ + code/MakeVerboseFormat.cpp \ + code/MaterialSystem.cpp \ + code/NDOLoader.cpp \ + code/NFFLoader.cpp \ + code/OFFLoader.cpp \ + code/ObjExporter.cpp \ + code/ObjFileImporter.cpp \ + code/ObjFileMtlImporter.cpp \ + code/ObjFileParser.cpp \ + code/OgreBinarySerializer.cpp \ + code/OgreImporter.cpp \ + code/OgreMaterial.cpp \ + code/OgreStructs.cpp \ + code/OgreXmlSerializer.cpp \ + code/OpenGEXExporter.cpp \ + code/OpenGEXImporter.cpp \ + code/OptimizeGraph.cpp \ + code/OptimizeMeshes.cpp \ + code/PlyExporter.cpp \ + code/PlyLoader.cpp \ + code/PlyParser.cpp \ + code/PostStepRegistry.cpp \ + code/PretransformVertices.cpp \ + code/ProcessHelper.cpp \ + code/Q3BSPFileImporter.cpp \ + code/Q3BSPFileParser.cpp \ + code/Q3BSPZipArchive.cpp \ + code/Q3DLoader.cpp \ + code/RawLoader.cpp \ + code/RemoveComments.cpp \ + code/RemoveRedundantMaterials.cpp \ + code/RemoveVCProcess.cpp \ + code/SGSpatialSort.cpp \ + code/SIBImporter.cpp \ + code/SMDLoader.cpp \ + code/STEPFileEncoding.cpp \ + code/STEPFileReader.cpp \ + code/STLExporter.cpp \ + code/STLLoader.cpp \ + code/ScaleProcess.cpp \ + code/SceneCombiner.cpp \ + code/ScenePreprocessor.cpp \ + code/SkeletonMeshBuilder.cpp \ + code/SortByPTypeProcess.cpp \ + code/SpatialSort.cpp \ + code/SplitByBoneCountProcess.cpp \ + code/SplitLargeMeshes.cpp \ + code/StandardShapes.cpp \ + code/StepExporter.cpp \ + code/Subdivision.cpp \ + code/TargetAnimation.cpp \ + code/TerragenLoader.cpp \ + code/TextureTransform.cpp \ + code/TriangulateProcess.cpp \ + code/UnrealLoader.cpp \ + code/ValidateDataStructure.cpp \ + code/Version.cpp \ + code/VertexTriangleAdjacency.cpp \ + code/X3DExporter.cpp \ + code/X3DImporter.cpp \ + code/X3DImporter_Geometry2D.cpp \ + code/X3DImporter_Geometry3D.cpp \ + code/X3DImporter_Group.cpp \ + code/X3DImporter_Light.cpp \ + code/X3DImporter_Metadata.cpp \ + code/X3DImporter_Networking.cpp \ + code/X3DImporter_Postprocess.cpp \ + code/X3DImporter_Rendering.cpp \ + code/X3DImporter_Shape.cpp \ + code/X3DImporter_Texturing.cpp \ + code/X3DVocabulary.cpp \ + code/XFileExporter.cpp \ + code/XFileImporter.cpp \ + code/XFileParser.cpp \ + code/XGLLoader.cpp \ + code/glTF2Exporter.cpp \ + code/glTF2Importer.cpp \ + code/glTFExporter.cpp \ + code/glTFImporter.cpp \ + code/scene.cpp \ + contrib/Open3DGC/o3dgcArithmeticCodec.cpp \ + contrib/Open3DGC/o3dgcDynamicVectorDecoder.cpp \ + contrib/Open3DGC/o3dgcDynamicVectorEncoder.cpp \ + contrib/Open3DGC/o3dgcTools.cpp \ + contrib/Open3DGC/o3dgcTriangleFans.cpp \ + contrib/clipper/clipper.cpp \ + contrib/irrXML/irrXML.cpp \ + contrib/openddlparser/code/DDLNode.cpp \ + contrib/openddlparser/code/OpenDDLCommon.cpp \ + contrib/openddlparser/code/OpenDDLExport.cpp \ + contrib/openddlparser/code/OpenDDLParser.cpp \ + contrib/openddlparser/code/OpenDDLStream.cpp \ + contrib/openddlparser/code/Value.cpp \ + contrib/poly2tri/poly2tri/common/shapes.cc \ + contrib/poly2tri/poly2tri/sweep/advancing_front.cc \ + contrib/poly2tri/poly2tri/sweep/cdt.cc \ + contrib/poly2tri/poly2tri/sweep/sweep.cc \ + contrib/poly2tri/poly2tri/sweep/sweep_context.cc \ + contrib/unzip/ioapi.c \ + contrib/unzip/unzip.c \ + contrib/zip/src/zip.c diff --git a/src/3rdparty/assimp/code/3DSConverter.cpp b/src/3rdparty/assimp/code/3DSConverter.cpp index cb6fd9077..820c28f90 100644 --- a/src/3rdparty/assimp/code/3DSConverter.cpp +++ b/src/3rdparty/assimp/code/3DSConverter.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -55,18 +56,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace Assimp; +static const unsigned int NotSet = 0xcdcdcdcd; + // ------------------------------------------------------------------------------------------------ // Setup final material indices, generae a default material if necessary void Discreet3DSImporter::ReplaceDefaultMaterial() { - // Try to find an existing material that matches the // typical default material setting: // - no textures // - diffuse color (in grey!) // NOTE: This is here to workaround the fact that some // exporters are writing a default material, too. - unsigned int idx = 0xcdcdcdcd; + unsigned int idx( NotSet ); for (unsigned int i = 0; i < mScene->mMaterials.size();++i) { std::string s = mScene->mMaterials[i].mName; @@ -92,7 +94,9 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() } idx = i; } - if (0xcdcdcdcd == idx)idx = (unsigned int)mScene->mMaterials.size(); + if ( NotSet == idx ) { + idx = ( unsigned int )mScene->mMaterials.size(); + } // now iterate through all meshes and through all faces and // find all faces that are using the default material @@ -197,7 +201,7 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type) // Setup the texture blend factor if (is_not_qnan(texture.mTextureBlend)) - mat.AddProperty( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0)); + mat.AddProperty( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0)); // Setup the texture mapping mode mat.AddProperty((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0)); @@ -207,14 +211,14 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type) // FIXME: this is not really correct ... if (texture.mMapMode == aiTextureMapMode_Mirror) { - texture.mScaleU *= 2.f; - texture.mScaleV *= 2.f; - texture.mOffsetU /= 2.f; - texture.mOffsetV /= 2.f; + texture.mScaleU *= 2.0; + texture.mScaleV *= 2.0; + texture.mOffsetU /= 2.0; + texture.mOffsetV /= 2.0; } // Setup texture UV transformations - mat.AddProperty(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0)); + mat.AddProperty(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0)); } // ------------------------------------------------------------------------------------------------ @@ -265,10 +269,10 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat, } // Opacity - mat.AddProperty( &oldMat.mTransparency,1,AI_MATKEY_OPACITY); + mat.AddProperty( &oldMat.mTransparency,1,AI_MATKEY_OPACITY); // Bump height scaling - mat.AddProperty( &oldMat.mBumpHeight,1,AI_MATKEY_BUMPSCALING); + mat.AddProperty( &oldMat.mBumpHeight,1,AI_MATKEY_BUMPSCALING); // Two sided rendering? if (oldMat.mTwoSided) @@ -690,7 +694,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut, pcOut->mChildren = new aiNode*[pcIn->mChildren.size()]; // Recursively process all children - const unsigned int size = pcIn->mChildren.size(); + const unsigned int size = static_cast(pcIn->mChildren.size()); for (unsigned int i = 0; i < size;++i) { pcOut->mChildren[i] = new aiNode(); @@ -742,7 +746,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut) DefaultLogger::get()->warn("No hierarchy information has been found in the file. "); pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes + - mScene->mCameras.size() + mScene->mLights.size(); + static_cast(mScene->mCameras.size() + mScene->mLights.size()); pcOut->mRootNode->mChildren = new aiNode* [ pcOut->mRootNode->mNumChildren ]; pcOut->mRootNode->mName.Set("<3DSDummyRoot>"); diff --git a/src/3rdparty/assimp/code/3DSExporter.cpp b/src/3rdparty/assimp/code/3DSExporter.cpp index 5bb79408f..2f561fcd6 100644 --- a/src/3rdparty/assimp/code/3DSExporter.cpp +++ b/src/3rdparty/assimp/code/3DSExporter.cpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -38,13 +39,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ - #ifndef ASSIMP_BUILD_NO_EXPORT #ifndef ASSIMP_BUILD_NO_3DS_EXPORTER #include "3DSExporter.h" #include "3DSLoader.h" -#include "SceneCombiner.h" +#include "3DSHelper.h" +#include #include "SplitLargeMeshes.h" #include "StringComparison.h" #include @@ -54,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace Assimp; namespace Assimp { +using namespace D3DS; namespace { @@ -85,7 +87,7 @@ namespace { const std::size_t chunk_size = head_pos - chunk_start_pos; writer.SetCurrentPos(chunk_start_pos + SIZE_OFFSET); - writer.PutU4(chunk_size); + writer.PutU4(static_cast(chunk_size)); writer.SetCurrentPos(head_pos); } @@ -148,7 +150,7 @@ namespace { // ------------------------------------------------------------------------------------------------ // Worker function for exporting a scene to 3DS. Prototyped and registered in Exporter.cpp -void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) +void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/) { std::shared_ptr outfile (pIOSystem->Open(pFile, "wb")); if(!outfile) { @@ -207,6 +209,12 @@ Discreet3DSExporter:: Discreet3DSExporter(std::shared_ptr outfile, con } } +// ------------------------------------------------------------------------------------------------ +Discreet3DSExporter::~Discreet3DSExporter() { + // empty +} + + // ------------------------------------------------------------------------------------------------ int Discreet3DSExporter::WriteHierarchy(const aiNode& node, int seq, int sibling_level) { @@ -365,7 +373,7 @@ void Discreet3DSExporter::WriteTexture(const aiMaterial& mat, aiTextureType type aiTextureMapMode map_mode[2] = { aiTextureMapMode_Wrap, aiTextureMapMode_Wrap }; - float blend = 1.0f; + ai_real blend = 1.0; if (mat.GetTexture(type, 0, &path, NULL, NULL, &blend, NULL, map_mode) != AI_SUCCESS || !path.length) { return; } @@ -560,6 +568,12 @@ void Discreet3DSExporter::WritePercentChunk(float f) { writer.PutF4(f); } +// ------------------------------------------------------------------------------------------------ +void Discreet3DSExporter::WritePercentChunk(double f) { + ChunkWriter chunk(writer, Discreet3DS::CHUNK_PERCENTD); + writer.PutF8(f); +} + #endif // ASSIMP_BUILD_NO_3DS_EXPORTER #endif // ASSIMP_BUILD_NO_EXPORT diff --git a/src/3rdparty/assimp/code/3DSExporter.h b/src/3rdparty/assimp/code/3DSExporter.h index 321539cff..fc02e2390 100644 --- a/src/3rdparty/assimp/code/3DSExporter.h +++ b/src/3rdparty/assimp/code/3DSExporter.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -48,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "StreamWriter.h" -#include "./../include/assimp/material.h" +#include struct aiScene; struct aiNode; @@ -59,30 +60,28 @@ namespace Assimp { // ------------------------------------------------------------------------------------------------ -/** Helper class to export a given scene to a 3DS file. */ +/** + * @brief Helper class to export a given scene to a 3DS file. + */ // ------------------------------------------------------------------------------------------------ -class Discreet3DSExporter -{ +class Discreet3DSExporter { public: Discreet3DSExporter(std::shared_ptr outfile, const aiScene* pScene); + ~Discreet3DSExporter(); private: - void WriteMeshes(); void WriteMaterials(); void WriteTexture(const aiMaterial& mat, aiTextureType type, uint16_t chunk_flags); - void WriteFaceMaterialChunk(const aiMesh& mesh); - int WriteHierarchy(const aiNode& node, int level, int sibling_level); - void WriteString(const std::string& s); void WriteString(const aiString& s); void WriteColor(const aiColor3D& color); void WritePercentChunk(float f); + void WritePercentChunk(double f); private: - const aiScene* const scene; StreamWriterLE writer; @@ -93,6 +92,6 @@ private: }; -} +} // Namespace Assimp -#endif +#endif // AI_3DSEXPORTER_H_INC diff --git a/src/3rdparty/assimp/code/3DSHelper.h b/src/3rdparty/assimp/code/3DSHelper.h index 5911b9d47..9e701c3dd 100644 --- a/src/3rdparty/assimp/code/3DSHelper.h +++ b/src/3rdparty/assimp/code/3DSHelper.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -43,15 +44,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_3DSFILEHELPER_H_INC #define AI_3DSFILEHELPER_H_INC - #include "SpatialSort.h" #include "SmoothingGroups.h" #include "StringUtils.h" #include "qnan.h" -#include "./../include/assimp/material.h" -#include "./../include/assimp/camera.h" -#include "./../include/assimp/light.h" -#include "./../include/assimp/anim.h" +#include +#include +#include +#include #include //sprintf namespace Assimp { @@ -63,16 +63,19 @@ namespace D3DS { /** Discreet3DS class: Helper class for loading 3ds files. Defines chunks * and data structures. */ -class Discreet3DS -{ +class Discreet3DS { private: - inline Discreet3DS() {} + Discreet3DS() { + // empty + } -public: + ~Discreet3DS() { + // empty + } +public: //! data structure for a single chunk in a .3ds file - struct Chunk - { + struct Chunk { uint16_t Flag; uint32_t Size; } PACK_STRUCT; @@ -129,6 +132,7 @@ public: CHUNK_PERCENTW = 0x0030, // int2 percentage CHUNK_PERCENTF = 0x0031, // float4 percentage + CHUNK_PERCENTD = 0x0032, // float8 percentage // ******************************************************************** // Prj master chunk @@ -327,11 +331,11 @@ struct Texture { //! Default constructor Texture() - : mOffsetU (0.0f) - , mOffsetV (0.0f) - , mScaleU (1.0f) - , mScaleV (1.0f) - , mRotation (0.0f) + : mOffsetU (0.0) + , mOffsetV (0.0) + , mScaleU (1.0) + , mScaleV (1.0) + , mRotation (0.0) , mMapMode (aiTextureMapMode_Wrap) , bPrivate() , iUVSrc (0) @@ -340,17 +344,17 @@ struct Texture } //! Specifies the blend factor for the texture - float mTextureBlend; + ai_real mTextureBlend; //! Specifies the filename of the texture std::string mMapName; //! Specifies texture coordinate offsets/scaling/rotations - float mOffsetU; - float mOffsetV; - float mScaleU; - float mScaleV; - float mRotation; + ai_real mOffsetU; + ai_real mOffsetV; + ai_real mScaleU; + ai_real mScaleV; + ai_real mRotation; //! Specifies the mapping mode to be used for the texture aiTextureMapMode mMapMode; @@ -368,14 +372,13 @@ struct Material { //! Default constructor. Builds a default name for the material Material() - : - mDiffuse (0.6f,0.6f,0.6f), // FIX ... we won't want object to be black - mSpecularExponent (0.0f), - mShininessStrength (1.0f), - mShading(Discreet3DS::Gouraud), - mTransparency (1.0f), - mBumpHeight (1.0f), - mTwoSided (false) + : mDiffuse ( ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 0.6 ) ) // FIX ... we won't want object to be black + , mSpecularExponent ( ai_real( 0.0 ) ) + , mShininessStrength ( ai_real( 1.0 ) ) + , mShading(Discreet3DS::Gouraud) + , mTransparency ( ai_real( 1.0 ) ) + , mBumpHeight ( ai_real( 1.0 ) ) + , mTwoSided (false) { static int iCnt = 0; @@ -389,9 +392,9 @@ struct Material //! Diffuse color of the material aiColor3D mDiffuse; //! Specular exponent - float mSpecularExponent; + ai_real mSpecularExponent; //! Shininess strength, in percent - float mShininessStrength; + ai_real mShininessStrength; //! Specular color of the material aiColor3D mSpecular; //! Ambient color of the material @@ -399,7 +402,7 @@ struct Material //! Shading type to be used Discreet3DS::shadetype3ds mShading; //! Opacity of the material - float mTransparency; + ai_real mTransparency; //! Diffuse texture channel Texture sTexDiffuse; //! Opacity texture channel @@ -415,7 +418,7 @@ struct Material //! Shininess texture channel Texture sTexShininess; //! Scaling factor for the bump values - float mBumpHeight; + ai_real mBumpHeight; //! Emissive color aiColor3D mEmissive; //! Ambient texture channel @@ -459,7 +462,7 @@ struct Mesh : public MeshWithSmoothingGroups struct aiFloatKey { double mTime; ///< The time of this key - float mValue; ///< The value of this key + ai_real mValue; ///< The value of this key #ifdef __cplusplus diff --git a/src/3rdparty/assimp/code/3DSLoader.cpp b/src/3rdparty/assimp/code/3DSLoader.cpp index a2b73b2cb..704884a57 100644 --- a/src/3rdparty/assimp/code/3DSLoader.cpp +++ b/src/3rdparty/assimp/code/3DSLoader.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -54,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "StringComparison.h" using namespace Assimp; @@ -182,7 +184,7 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile, ParseMainChunk(); // Process all meshes in the file. First check whether all - // face indices haev valid values. The generate our + // face indices have valid values. The generate our // internal verbose representation. Finally compute normal // vectors from the smoothing groups we read from the // file. @@ -458,20 +460,20 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num) camera->mLookAt.x = stream->GetF4() - camera->mPosition.x; camera->mLookAt.y = stream->GetF4() - camera->mPosition.y; camera->mLookAt.z = stream->GetF4() - camera->mPosition.z; - float len = camera->mLookAt.Length(); - if (len < 1e-5f) { + ai_real len = camera->mLookAt.Length(); + if (len < 1e-5) { // There are some files with lookat == position. Don't know why or whether it's ok or not. DefaultLogger::get()->error("3DS: Unable to read proper camera look-at vector"); - camera->mLookAt = aiVector3D(0.f,1.f,0.f); + camera->mLookAt = aiVector3D(0.0,1.0,0.0); } else camera->mLookAt /= len; // And finally - the camera rotation angle, in counter clockwise direction - const float angle = AI_DEG_TO_RAD( stream->GetF4() ); + const ai_real angle = AI_DEG_TO_RAD( stream->GetF4() ); aiQuaternion quat(camera->mLookAt,angle); - camera->mUp = quat.GetMatrix() * aiVector3D(0.f,1.f,0.f); + camera->mUp = quat.GetMatrix() * aiVector3D(0.0,1.0,0.0); // Read the lense angle camera->mHorizontalFOV = AI_DEG_TO_RAD ( stream->GetF4() ); @@ -679,7 +681,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) if ( pcNode) { - // if the source is not a CHUNK_TRACKINFO block it wont be an object instance + // if the source is not a CHUNK_TRACKINFO block it won't be an object instance if (parent != Discreet3DS::CHUNK_TRACKINFO) { mCurrentNode = pcNode; @@ -1166,14 +1168,15 @@ void Discreet3DSImporter::ParseMaterialChunk() case Discreet3DS::CHUNK_MAT_TRANSPARENCY: { - // This is the material's transparency - float* pcf = &mScene->mMaterials.back().mTransparency; - *pcf = ParsePercentageChunk(); - - // NOTE: transparency, not opacity - if (is_qnan(*pcf)) - *pcf = 1.0f; - else *pcf = 1.0f - *pcf * (float)0xFFFF / 100.0f; + // This is the material's transparency + ai_real* pcf = &mScene->mMaterials.back().mTransparency; + *pcf = ParsePercentageChunk(); + + // NOTE: transparency, not opacity + if (is_qnan(*pcf)) + *pcf = ai_real( 1.0 ); + else + *pcf = ai_real( 1.0 ) - *pcf * (ai_real)0xFFFF / ai_real( 100.0 ); } break; @@ -1189,31 +1192,33 @@ void Discreet3DSImporter::ParseMaterialChunk() case Discreet3DS::CHUNK_MAT_SHININESS: { // This is the shininess of the material - float* pcf = &mScene->mMaterials.back().mSpecularExponent; + ai_real* pcf = &mScene->mMaterials.back().mSpecularExponent; *pcf = ParsePercentageChunk(); if (is_qnan(*pcf)) - *pcf = 0.0f; - else *pcf *= (float)0xFFFF; + *pcf = 0.0; + else *pcf *= (ai_real)0xFFFF; } break; case Discreet3DS::CHUNK_MAT_SHININESS_PERCENT: { // This is the shininess strength of the material - float* pcf = &mScene->mMaterials.back().mShininessStrength; - *pcf = ParsePercentageChunk(); - if (is_qnan(*pcf)) - *pcf = 0.0f; - else *pcf *= (float)0xffff / 100.0f; + ai_real* pcf = &mScene->mMaterials.back().mShininessStrength; + *pcf = ParsePercentageChunk(); + if (is_qnan(*pcf)) + *pcf = ai_real( 0.0 ); + else + *pcf *= (ai_real)0xffff / ai_real( 100.0 ); } break; case Discreet3DS::CHUNK_MAT_SELF_ILPCT: { // This is the self illumination strength of the material - float f = ParsePercentageChunk(); - if (is_qnan(f)) - f = 0.0f; - else f *= (float)0xFFFF / 100.0f; - mScene->mMaterials.back().mEmissive = aiColor3D(f,f,f); + ai_real f = ParsePercentageChunk(); + if (is_qnan(f)) + f = ai_real( 0.0 ); + else + f *= (ai_real)0xFFFF / ai_real( 100.0 ); + mScene->mMaterials.back().mEmissive = aiColor3D(f,f,f); } break; @@ -1270,6 +1275,11 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut) break; + case Discreet3DS::CHUNK_PERCENTD: + // Manually parse the blend factor + pcOut->mTextureBlend = ai_real( stream->GetF8() ); + break; + case Discreet3DS::CHUNK_PERCENTF: // Manually parse the blend factor pcOut->mTextureBlend = stream->GetF4(); @@ -1277,7 +1287,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut) case Discreet3DS::CHUNK_PERCENTW: // Manually parse the blend factor - pcOut->mTextureBlend = (float)((uint16_t)stream->GetI2()) / 100.0f; + pcOut->mTextureBlend = (ai_real)((uint16_t)stream->GetI2()) / ai_real( 100.0 ); break; case Discreet3DS::CHUNK_MAT_MAP_USCALE: @@ -1336,7 +1346,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut) // ------------------------------------------------------------------------------------------------ // Read a percentage chunk -float Discreet3DSImporter::ParsePercentageChunk() +ai_real Discreet3DSImporter::ParsePercentageChunk() { Discreet3DS::Chunk chunk; ReadChunk(&chunk); @@ -1344,19 +1354,18 @@ float Discreet3DSImporter::ParsePercentageChunk() if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag) return stream->GetF4(); else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag) - return (float)((uint16_t)stream->GetI2()) / (float)0xFFFF; + return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF; return get_qnan(); } // ------------------------------------------------------------------------------------------------ // Read a color chunk. If a percentage chunk is found instead it is read as a grayscale color -void Discreet3DSImporter::ParseColorChunk(aiColor3D* out, - bool acceptPercent) +void Discreet3DSImporter::ParseColorChunk( aiColor3D* out, bool acceptPercent ) { ai_assert(out != NULL); // error return value - const float qnan = get_qnan(); + const ai_real qnan = get_qnan(); static const aiColor3D clrError = aiColor3D(qnan,qnan,qnan); Discreet3DS::Chunk chunk; @@ -1384,13 +1393,16 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out, case Discreet3DS::CHUNK_LINRGBB: bGamma = true; case Discreet3DS::CHUNK_RGBB: - if (sizeof(char) * 3 > diff) { - *out = clrError; - return; + { + if ( sizeof( char ) * 3 > diff ) { + *out = clrError; + return; + } + const ai_real invVal = ai_real( 1.0 ) / ai_real( 255.0 ); + out->r = ( ai_real ) ( uint8_t ) stream->GetI1() * invVal; + out->g = ( ai_real ) ( uint8_t ) stream->GetI1() * invVal; + out->b = ( ai_real ) ( uint8_t ) stream->GetI1() * invVal; } - out->r = (float)(uint8_t)stream->GetI1() / 255.0f; - out->g = (float)(uint8_t)stream->GetI1() / 255.0f; - out->b = (float)(uint8_t)stream->GetI1() / 255.0f; break; // Percentage chunks are accepted, too. @@ -1404,7 +1416,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out, case Discreet3DS::CHUNK_PERCENTW: if (acceptPercent && 1 <= diff) { - out->g = out->b = out->r = (float)(uint8_t)stream->GetI1() / 255.0f; + out->g = out->b = out->r = (ai_real)(uint8_t)stream->GetI1() / ai_real( 255.0 ); break; } *out = clrError; diff --git a/src/3rdparty/assimp/code/3DSLoader.h b/src/3rdparty/assimp/code/3DSLoader.h index 437ec94b4..0e377180b 100644 --- a/src/3rdparty/assimp/code/3DSLoader.h +++ b/src/3rdparty/assimp/code/3DSLoader.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -119,7 +120,7 @@ protected: * chunk behind afterwards. If no percentage chunk is found * QNAN is returned. */ - float ParsePercentageChunk(); + ai_real ParsePercentageChunk(); // ------------------------------------------------------------------- /** Parse a color chunk. mCurrent will point to the next @@ -265,7 +266,7 @@ protected: aiColor3D mClrAmbient; /** Master scaling factor of the scene */ - float mMasterScale; + ai_real mMasterScale; /** Path to the background image of the scene */ std::string mBackgroundImage; diff --git a/src/3rdparty/assimp/code/3MFXmlTags.h b/src/3rdparty/assimp/code/3MFXmlTags.h new file mode 100644 index 000000000..7e47422f1 --- /dev/null +++ b/src/3rdparty/assimp/code/3MFXmlTags.h @@ -0,0 +1,89 @@ +/* +Open Asset Import Library (assimp) +---------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. + +---------------------------------------------------------------------- +*/ +#pragma once + +namespace Assimp { +namespace D3MF { + +namespace XmlTag { + static const std::string model = "model"; + static const std::string model_unit = "unit"; + static const std::string metadata = "metadata"; + static const std::string resources = "resources"; + static const std::string object = "object"; + static const std::string mesh = "mesh"; + static const std::string vertices = "vertices"; + static const std::string vertex = "vertex"; + static const std::string triangles = "triangles"; + static const std::string triangle = "triangle"; + static const std::string x = "x"; + static const std::string y = "y"; + static const std::string z = "z"; + static const std::string v1 = "v1"; + static const std::string v2 = "v2"; + static const std::string v3 = "v3"; + static const std::string id = "id"; + static const std::string name = "name"; + static const std::string type = "type"; + static const std::string build = "build"; + static const std::string item = "item"; + static const std::string objectid = "objectid"; + static const std::string transform = "transform"; + + static const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml"; + static const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels"; + static const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types"; + static const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships"; + static const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships"; + static const std::string RELS_RELATIONSHIP_NODE = "Relationship"; + static const std::string RELS_ATTRIB_TARGET = "Target"; + static const std::string RELS_ATTRIB_TYPE = "Type"; + static const std::string RELS_ATTRIB_ID = "Id"; + static const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel"; + static const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket"; + static const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture"; + static const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"; + static const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"; + +} + +} // Namespace D3MF +} // Namespace Assimp diff --git a/src/3rdparty/assimp/code/ACLoader.cpp b/src/3rdparty/assimp/code/ACLoader.cpp index c040d6bbd..a30baa75a 100644 --- a/src/3rdparty/assimp/code/ACLoader.cpp +++ b/src/3rdparty/assimp/code/ACLoader.cpp @@ -4,7 +4,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -60,6 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include using namespace Assimp; diff --git a/src/3rdparty/assimp/code/ACLoader.h b/src/3rdparty/assimp/code/ACLoader.h index 52563adad..4b202b77a 100644 --- a/src/3rdparty/assimp/code/ACLoader.h +++ b/src/3rdparty/assimp/code/ACLoader.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/src/3rdparty/assimp/code/AMFImporter.cpp b/src/3rdparty/assimp/code/AMFImporter.cpp new file mode 100644 index 000000000..e9211fe53 --- /dev/null +++ b/src/3rdparty/assimp/code/AMFImporter.cpp @@ -0,0 +1,704 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. +--------------------------------------------------------------------------- +*/ + +/// \file AMFImporter.cpp +/// \brief AMF-format files importer for Assimp: main algorithm implementation. +/// \date 2016 +/// \author smal.root@gmail.com + +#ifndef ASSIMP_BUILD_NO_AMF_IMPORTER + +// Header files, Assimp. +#include "AMFImporter.hpp" +#include "AMFImporter_Macro.hpp" + +#include "fast_atof.h" +#include + +// Header files, stdlib. +#include + +namespace Assimp +{ + +/// \var aiImporterDesc AMFImporter::Description +/// Conastant which hold importer description +const aiImporterDesc AMFImporter::Description = { + "Additive manufacturing file format(AMF) Importer", + "smalcom", + "", + "See documentation in source code. Chapter: Limitations.", + aiImporterFlags_SupportTextFlavour | aiImporterFlags_LimitedSupport | aiImporterFlags_Experimental, + 0, + 0, + 0, + 0, + "amf" +}; + +void AMFImporter::Clear() +{ + mNodeElement_Cur = nullptr; + mUnit.clear(); + mMaterial_Converted.clear(); + mTexture_Converted.clear(); + // Delete all elements + if(mNodeElement_List.size()) + { + for(CAMFImporter_NodeElement* ne: mNodeElement_List) { delete ne; } + + mNodeElement_List.clear(); + } +} + +AMFImporter::~AMFImporter() +{ + if(mReader != nullptr) delete mReader; + // Clear() is accounting if data already is deleted. So, just check again if all data is deleted. + Clear(); +} + +/*********************************************************************************************************************************************/ +/************************************************************ Functions: find set ************************************************************/ +/*********************************************************************************************************************************************/ + +bool AMFImporter::Find_NodeElement(const std::string& pID, const CAMFImporter_NodeElement::EType pType, CAMFImporter_NodeElement** pNodeElement) const +{ + for(CAMFImporter_NodeElement* ne: mNodeElement_List) + { + if((ne->ID == pID) && (ne->Type == pType)) + { + if(pNodeElement != nullptr) *pNodeElement = ne; + + return true; + } + }// for(CAMFImporter_NodeElement* ne: mNodeElement_List) + + return false; +} + +bool AMFImporter::Find_ConvertedNode(const std::string& pID, std::list& pNodeList, aiNode** pNode) const +{ +aiString node_name(pID.c_str()); + + for(aiNode* node: pNodeList) + { + if(node->mName == node_name) + { + if(pNode != nullptr) *pNode = node; + + return true; + } + }// for(aiNode* node: pNodeList) + + return false; +} + +bool AMFImporter::Find_ConvertedMaterial(const std::string& pID, const SPP_Material** pConvertedMaterial) const +{ + for(const SPP_Material& mat: mMaterial_Converted) + { + if(mat.ID == pID) + { + if(pConvertedMaterial != nullptr) *pConvertedMaterial = &mat; + + return true; + } + }// for(const SPP_Material& mat: mMaterial_Converted) + + return false; +} + +/*********************************************************************************************************************************************/ +/************************************************************ Functions: throw set ***********************************************************/ +/*********************************************************************************************************************************************/ + +void AMFImporter::Throw_CloseNotFound(const std::string& pNode) +{ + throw DeadlyImportError("Close tag for node <" + pNode + "> not found. Seems file is corrupt."); +} + +void AMFImporter::Throw_IncorrectAttr(const std::string& pAttrName) +{ + throw DeadlyImportError("Node <" + std::string(mReader->getNodeName()) + "> has incorrect attribute \"" + pAttrName + "\"."); +} + +void AMFImporter::Throw_IncorrectAttrValue(const std::string& pAttrName) +{ + throw DeadlyImportError("Attribute \"" + pAttrName + "\" in node <" + std::string(mReader->getNodeName()) + "> has incorrect value."); +} + +void AMFImporter::Throw_MoreThanOnceDefined(const std::string& pNodeType, const std::string& pDescription) +{ + throw DeadlyImportError("\"" + pNodeType + "\" node can be used only once in " + mReader->getNodeName() + ". Description: " + pDescription); +} + +void AMFImporter::Throw_ID_NotFound(const std::string& pID) const +{ + throw DeadlyImportError("Not found node with name \"" + pID + "\"."); +} + +/*********************************************************************************************************************************************/ +/************************************************************* Functions: XML set ************************************************************/ +/*********************************************************************************************************************************************/ + +void AMFImporter::XML_CheckNode_MustHaveChildren() +{ + if(mReader->isEmptyElement()) throw DeadlyImportError(std::string("Node <") + mReader->getNodeName() + "> must have children."); +} + +void AMFImporter::XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName) +{ + static const size_t Uns_Skip_Len = 3; + const char* Uns_Skip[Uns_Skip_Len] = { "composite", "edge", "normal" }; + + static bool skipped_before[Uns_Skip_Len] = { false, false, false }; + + std::string nn(mReader->getNodeName()); + bool found = false; + bool close_found = false; + size_t sk_idx; + + for(sk_idx = 0; sk_idx < Uns_Skip_Len; sk_idx++) + { + if(nn != Uns_Skip[sk_idx]) continue; + + found = true; + if(mReader->isEmptyElement()) + { + close_found = true; + + goto casu_cres; + } + + while(mReader->read()) + { + if((mReader->getNodeType() == irr::io::EXN_ELEMENT_END) && (nn == mReader->getNodeName())) + { + close_found = true; + + goto casu_cres; + } + } + }// for(sk_idx = 0; sk_idx < Uns_Skip_Len; sk_idx++) + +casu_cres: + + if(!found) throw DeadlyImportError("Unknown node \"" + nn + "\" in " + pParentNodeName + "."); + if(!close_found) Throw_CloseNotFound(nn); + + if(!skipped_before[sk_idx]) + { + skipped_before[sk_idx] = true; + LogWarning("Skipping node \"" + nn + "\" in " + pParentNodeName + "."); + } +} + +bool AMFImporter::XML_SearchNode(const std::string& pNodeName) +{ + while(mReader->read()) + { + if((mReader->getNodeType() == irr::io::EXN_ELEMENT) && XML_CheckNode_NameEqual(pNodeName)) return true; + } + + return false; +} + +bool AMFImporter::XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx) +{ + std::string val(mReader->getAttributeValue(pAttrIdx)); + + if((val == "false") || (val == "0")) + return false; + else if((val == "true") || (val == "1")) + return true; + else + throw DeadlyImportError("Bool attribute value can contain \"false\"/\"0\" or \"true\"/\"1\" not the \"" + val + "\""); +} + +float AMFImporter::XML_ReadNode_GetAttrVal_AsFloat(const int pAttrIdx) +{ + std::string val; + float tvalf; + + ParseHelper_FixTruncatedFloatString(mReader->getAttributeValue(pAttrIdx), val); + fast_atoreal_move(val.c_str(), tvalf, false); + + return tvalf; +} + +uint32_t AMFImporter::XML_ReadNode_GetAttrVal_AsU32(const int pAttrIdx) +{ + return strtoul10(mReader->getAttributeValue(pAttrIdx)); +} + +float AMFImporter::XML_ReadNode_GetVal_AsFloat() +{ + std::string val; + float tvalf; + + if(!mReader->read()) throw DeadlyImportError("XML_ReadNode_GetVal_AsFloat. No data, seems file is corrupt."); + if(mReader->getNodeType() != irr::io::EXN_TEXT) throw DeadlyImportError("XML_ReadNode_GetVal_AsFloat. Invalid type of XML element, seems file is corrupt."); + + ParseHelper_FixTruncatedFloatString(mReader->getNodeData(), val); + fast_atoreal_move(val.c_str(), tvalf, false); + + return tvalf; +} + +uint32_t AMFImporter::XML_ReadNode_GetVal_AsU32() +{ + if(!mReader->read()) throw DeadlyImportError("XML_ReadNode_GetVal_AsU32. No data, seems file is corrupt."); + if(mReader->getNodeType() != irr::io::EXN_TEXT) throw DeadlyImportError("XML_ReadNode_GetVal_AsU32. Invalid type of XML element, seems file is corrupt."); + + return strtoul10(mReader->getNodeData()); +} + +void AMFImporter::XML_ReadNode_GetVal_AsString(std::string& pValue) +{ + if(!mReader->read()) throw DeadlyImportError("XML_ReadNode_GetVal_AsString. No data, seems file is corrupt."); + if(mReader->getNodeType() != irr::io::EXN_TEXT) + throw DeadlyImportError("XML_ReadNode_GetVal_AsString. Invalid type of XML element, seems file is corrupt."); + + pValue = mReader->getNodeData(); +} + +/*********************************************************************************************************************************************/ +/************************************************************ Functions: parse set ***********************************************************/ +/*********************************************************************************************************************************************/ + +void AMFImporter::ParseHelper_Node_Enter(CAMFImporter_NodeElement* pNode) +{ + mNodeElement_Cur->Child.push_back(pNode);// add new element to current element child list. + mNodeElement_Cur = pNode;// switch current element to new one. +} + +void AMFImporter::ParseHelper_Node_Exit() +{ + // check if we can walk up. + if(mNodeElement_Cur != nullptr) mNodeElement_Cur = mNodeElement_Cur->Parent; +} + +void AMFImporter::ParseHelper_FixTruncatedFloatString(const char* pInStr, std::string& pOutString) +{ + size_t instr_len; + + pOutString.clear(); + instr_len = strlen(pInStr); + if(!instr_len) return; + + pOutString.reserve(instr_len * 3 / 2); + // check and correct floats in format ".x". Must be "x.y". + if(pInStr[0] == '.') pOutString.push_back('0'); + + pOutString.push_back(pInStr[0]); + for(size_t ci = 1; ci < instr_len; ci++) + { + if((pInStr[ci] == '.') && ((pInStr[ci - 1] == ' ') || (pInStr[ci - 1] == '-') || (pInStr[ci - 1] == '+') || (pInStr[ci - 1] == '\t'))) + { + pOutString.push_back('0'); + pOutString.push_back('.'); + } + else + { + pOutString.push_back(pInStr[ci]); + } + } +} + +static bool ParseHelper_Decode_Base64_IsBase64(const char pChar) +{ + return (isalnum(pChar) || (pChar == '+') || (pChar == '/')); +} + +void AMFImporter::ParseHelper_Decode_Base64(const std::string& pInputBase64, std::vector& pOutputData) const +{ + // With help from + // René Nyffenegger http://www.adp-gmbh.ch/cpp/common/base64.html + const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + uint8_t tidx = 0; + uint8_t arr4[4], arr3[3]; + + // check input data + if(pInputBase64.size() % 4) throw DeadlyImportError("Base64-encoded data must have size multiply of four."); + // prepare output place + pOutputData.clear(); + pOutputData.reserve(pInputBase64.size() / 4 * 3); + + for(size_t in_len = pInputBase64.size(), in_idx = 0; (in_len > 0) && (pInputBase64[in_idx] != '='); in_len--) + { + if(ParseHelper_Decode_Base64_IsBase64(pInputBase64[in_idx])) + { + arr4[tidx++] = pInputBase64[in_idx++]; + if(tidx == 4) + { + for(tidx = 0; tidx < 4; tidx++) arr4[tidx] = (uint8_t)base64_chars.find(arr4[tidx]); + + arr3[0] = (arr4[0] << 2) + ((arr4[1] & 0x30) >> 4); + arr3[1] = ((arr4[1] & 0x0F) << 4) + ((arr4[2] & 0x3C) >> 2); + arr3[2] = ((arr4[2] & 0x03) << 6) + arr4[3]; + for(tidx = 0; tidx < 3; tidx++) pOutputData.push_back(arr3[tidx]); + + tidx = 0; + }// if(tidx == 4) + }// if(ParseHelper_Decode_Base64_IsBase64(pInputBase64[in_idx])) + else + { + in_idx++; + }// if(ParseHelper_Decode_Base64_IsBase64(pInputBase64[in_idx])) else + } + + if(tidx) + { + for(uint8_t i = tidx; i < 4; i++) arr4[i] = 0; + for(uint8_t i = 0; i < 4; i++) arr4[i] = (uint8_t)(base64_chars.find(arr4[i])); + + arr3[0] = (arr4[0] << 2) + ((arr4[1] & 0x30) >> 4); + arr3[1] = ((arr4[1] & 0x0F) << 4) + ((arr4[2] & 0x3C) >> 2); + arr3[2] = ((arr4[2] & 0x03) << 6) + arr4[3]; + for(uint8_t i = 0; i < (tidx - 1); i++) pOutputData.push_back(arr3[i]); + } +} + +void AMFImporter::ParseFile(const std::string& pFile, IOSystem* pIOHandler) +{ + irr::io::IrrXMLReader* OldReader = mReader;// store current XMLreader. + std::unique_ptr file(pIOHandler->Open(pFile, "rb")); + + // Check whether we can read from the file + if(file.get() == NULL) throw DeadlyImportError("Failed to open AMF file " + pFile + "."); + + // generate a XML reader for it + std::unique_ptr mIOWrapper(new CIrrXML_IOStreamReader(file.get())); + mReader = irr::io::createIrrXMLReader(mIOWrapper.get()); + if(!mReader) throw DeadlyImportError("Failed to create XML reader for file" + pFile + "."); + // + // start reading + // search for root tag + if(XML_SearchNode("amf")) + ParseNode_Root(); + else + throw DeadlyImportError("Root node \"amf\" not found."); + + delete mReader; + // restore old XMLreader + mReader = OldReader; +} + +// +// +// Root XML element. +// Multi elements - No. +void AMFImporter::ParseNode_Root() +{ + std::string unit, version; + CAMFImporter_NodeElement *ne( nullptr ); + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("unit", unit, mReader->getAttributeValue); + MACRO_ATTRREAD_CHECK_RET("version", version, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND_WSKIP; + + // Check attributes + if(!mUnit.empty()) + { + if((mUnit != "inch") && (mUnit != "millimeter") && (mUnit != "meter") && (mUnit != "feet") && (mUnit != "micron")) Throw_IncorrectAttrValue("unit"); + } + + // create root node element. + ne = new CAMFImporter_NodeElement_Root(nullptr); + mNodeElement_Cur = ne;// set first "current" element + // and assign attribute's values + ((CAMFImporter_NodeElement_Root*)ne)->Unit = unit; + ((CAMFImporter_NodeElement_Root*)ne)->Version = version; + + // Check for child nodes + if(!mReader->isEmptyElement()) + { + MACRO_NODECHECK_LOOPBEGIN("amf"); + if(XML_CheckNode_NameEqual("object")) { ParseNode_Object(); continue; } + if(XML_CheckNode_NameEqual("material")) { ParseNode_Material(); continue; } + if(XML_CheckNode_NameEqual("texture")) { ParseNode_Texture(); continue; } + if(XML_CheckNode_NameEqual("constellation")) { ParseNode_Constellation(); continue; } + if(XML_CheckNode_NameEqual("metadata")) { ParseNode_Metadata(); continue; } + MACRO_NODECHECK_LOOPEND("amf"); + mNodeElement_Cur = ne;// force restore "current" element + }// if(!mReader->isEmptyElement()) + + mNodeElement_List.push_back(ne);// add to node element list because its a new object in graph. +} + +// +// +// A collection of objects or constellations with specific relative locations. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Constellation() +{ + std::string id; + CAMFImporter_NodeElement* ne( nullptr ); + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("id", id, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + + // create and if needed - define new grouping object. + ne = new CAMFImporter_NodeElement_Constellation(mNodeElement_Cur); + + CAMFImporter_NodeElement_Constellation& als = *((CAMFImporter_NodeElement_Constellation*)ne);// alias for convenience + + if(!id.empty()) als.ID = id; + // Check for child nodes + if(!mReader->isEmptyElement()) + { + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("constellation"); + if(XML_CheckNode_NameEqual("instance")) { ParseNode_Instance(); continue; } + if(XML_CheckNode_NameEqual("metadata")) { ParseNode_Metadata(); continue; } + MACRO_NODECHECK_LOOPEND("constellation"); + ParseHelper_Node_Exit(); + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// A collection of objects or constellations with specific relative locations. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Instance() +{ + std::string objectid; + CAMFImporter_NodeElement* ne( nullptr ); + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("objectid", objectid, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + + // used object id must be defined, check that. + if(objectid.empty()) throw DeadlyImportError("\"objectid\" in must be defined."); + // create and define new grouping object. + ne = new CAMFImporter_NodeElement_Instance(mNodeElement_Cur); + + CAMFImporter_NodeElement_Instance& als = *((CAMFImporter_NodeElement_Instance*)ne);// alias for convenience + + als.ObjectID = objectid; + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool read_flag[6] = { false, false, false, false, false, false }; + + als.Delta.Set(0, 0, 0); + als.Rotation.Set(0, 0, 0); + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("instance"); + MACRO_NODECHECK_READCOMP_F("deltax", read_flag[0], als.Delta.x); + MACRO_NODECHECK_READCOMP_F("deltay", read_flag[1], als.Delta.y); + MACRO_NODECHECK_READCOMP_F("deltaz", read_flag[2], als.Delta.z); + MACRO_NODECHECK_READCOMP_F("rx", read_flag[3], als.Rotation.x); + MACRO_NODECHECK_READCOMP_F("ry", read_flag[4], als.Rotation.y); + MACRO_NODECHECK_READCOMP_F("rz", read_flag[5], als.Rotation.z); + MACRO_NODECHECK_LOOPEND("instance"); + ParseHelper_Node_Exit(); + // also convert degrees to radians. + als.Rotation.x = AI_MATH_PI_F * als.Rotation.x / 180.0f; + als.Rotation.y = AI_MATH_PI_F * als.Rotation.y / 180.0f; + als.Rotation.z = AI_MATH_PI_F * als.Rotation.z / 180.0f; + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// An object definition. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Object() +{ + std::string id; + CAMFImporter_NodeElement* ne( nullptr ); + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("id", id, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + + // create and if needed - define new geometry object. + ne = new CAMFImporter_NodeElement_Object(mNodeElement_Cur); + + CAMFImporter_NodeElement_Object& als = *((CAMFImporter_NodeElement_Object*)ne);// alias for convenience + + if(!id.empty()) als.ID = id; + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool col_read = false; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("object"); + if(XML_CheckNode_NameEqual("color")) + { + // Check if color already defined for object. + if(col_read) Throw_MoreThanOnceDefined("color", "Only one color can be defined for ."); + // read data and set flag about it + ParseNode_Color(); + col_read = true; + + continue; + } + + if(XML_CheckNode_NameEqual("mesh")) { ParseNode_Mesh(); continue; } + if(XML_CheckNode_NameEqual("metadata")) { ParseNode_Metadata(); continue; } + MACRO_NODECHECK_LOOPEND("object"); + ParseHelper_Node_Exit(); + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// Specify additional information about an entity. +// Multi elements - Yes. +// Parent element - , , , , . +// +// Reserved types are: +// "Name" - The alphanumeric label of the entity, to be used by the interpreter if interacting with the user. +// "Description" - A description of the content of the entity +// "URL" - A link to an external resource relating to the entity +// "Author" - Specifies the name(s) of the author(s) of the entity +// "Company" - Specifying the company generating the entity +// "CAD" - specifies the name of the originating CAD software and version +// "Revision" - specifies the revision of the entity +// "Tolerance" - specifies the desired manufacturing tolerance of the entity in entity's unit system +// "Volume" - specifies the total volume of the entity, in the entity's unit system, to be used for verification (object and volume only) +void AMFImporter::ParseNode_Metadata() +{ + std::string type, value; + CAMFImporter_NodeElement* ne( nullptr ); + + // read attribute + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("type", type, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + // and value of node. + value = mReader->getNodeData(); + // Create node element and assign read data. + ne = new CAMFImporter_NodeElement_Metadata(mNodeElement_Cur); + ((CAMFImporter_NodeElement_Metadata*)ne)->Type = type; + ((CAMFImporter_NodeElement_Metadata*)ne)->Value = value; + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +/*********************************************************************************************************************************************/ +/******************************************************** Functions: BaseImporter set ********************************************************/ +/*********************************************************************************************************************************************/ + +bool AMFImporter::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool pCheckSig) const +{ + const std::string extension = GetExtension(pFile); + + if ( extension == "amf" ) { + return true; + } + + if(!extension.length() || pCheckSig) + { + const char* tokens[] = { "& pExtensionList) +{ + pExtensionList.insert("amf"); +} + +const aiImporterDesc* AMFImporter::GetInfo () const +{ + return &Description; +} + +void AMFImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) +{ + Clear();// delete old graph. + ParseFile(pFile, pIOHandler); + Postprocess_BuildScene(pScene); + // scene graph is ready, exit. +} + +}// namespace Assimp + +#endif // !ASSIMP_BUILD_NO_AMF_IMPORTER diff --git a/src/3rdparty/assimp/code/AMFImporter.hpp b/src/3rdparty/assimp/code/AMFImporter.hpp new file mode 100644 index 000000000..47ddc073b --- /dev/null +++ b/src/3rdparty/assimp/code/AMFImporter.hpp @@ -0,0 +1,563 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. +--------------------------------------------------------------------------- +*/ + +/// \file AMFImporter.hpp +/// \brief AMF-format files importer for Assimp. +/// \date 2016 +/// \author smal.root@gmail.com +// Thanks to acorn89 for support. + +#pragma once +#ifndef INCLUDED_AI_AMF_IMPORTER_H +#define INCLUDED_AI_AMF_IMPORTER_H + +#include "AMFImporter_Node.hpp" + +// Header files, Assimp. +#include +#include +#include "assimp/types.h" +#include "BaseImporter.h" +#include "irrXMLWrapper.h" + +// Header files, stdlib. +#include + +namespace Assimp +{ +/// \class AMFImporter +/// Class that holding scene graph which include: geometry, metadata, materials etc. +/// +/// Implementing features. +/// +/// Limitations. +/// +/// 1. When for texture mapping used set of source textures (r, g, b, a) not only one then attribute "tiled" for all set will be true if it true in any of +/// source textures. +/// Example. Triangle use for texture mapping three textures. Two of them has "tiled" set to false and one - set to true. In scene all three textures +/// will be tiled. +/// +/// Unsupported features: +/// 1. Node , formulas in and . For implementing this feature can be used expression parser "muParser" like in project +/// "amf_tools". +/// 2. Attribute "profile" in node . +/// 3. Curved geometry: , and children nodes of them. +/// 4. Attributes: "unit" and "version" in read but do nothing. +/// 5. stored only for root node . +/// 6. Color averaging of vertices for which 's set different colors. +/// +/// Supported nodes: +/// General: +/// ; ; and children , , , , , ; ; +/// +/// Geometry: +/// ; ; ; ; and children , , ; ; and children , , ; +/// +/// Material: +/// and children , , , ; ; ; +/// two variants of texture coordinates: +/// new - and children , , , , , +/// old - and children , , , , , +/// +class AMFImporter : public BaseImporter +{ + /***********************************************/ + /******************** Types ********************/ + /***********************************************/ + +private: + + struct SPP_Material;// forward declaration + + /// \struct SPP_Composite + /// Data type for postprocessing step. More suitable container for part of material's composition. + struct SPP_Composite + { + SPP_Material* Material;///< Pointer to material - part of composition. + std::string Formula;///< Formula for calculating ratio of \ref Material. + }; + + /// \struct SPP_Material + /// Data type for postprocessing step. More suitable container for material. + struct SPP_Material + { + std::string ID;///< Material ID. + std::list Metadata;///< Metadata of material. + CAMFImporter_NodeElement_Color* Color;///< Color of material. + std::list Composition;///< List of child materials if current material is composition of few another. + + /// \fn aiColor4D GetColor(const float pX, const float pY, const float pZ) const + /// Return color calculated for specified coordinate. + /// \param [in] pX - "x" coordinate. + /// \param [in] pY - "y" coordinate. + /// \param [in] pZ - "z" coordinate. + /// \return calculated color. + aiColor4D GetColor(const float pX, const float pY, const float pZ) const; + }; + + /// \struct SPP_Texture + /// Data type for post-processing step. More suitable container for texture. + struct SPP_Texture + { + std::string ID; + size_t Width, Height, Depth; + bool Tiled; + char FormatHint[ 9 ];// 8 for string + 1 for terminator. + uint8_t *Data; + }; + + /// \struct SComplexFace + /// Data type for post-processing step. Contain face data. + struct SComplexFace + { + aiFace Face;///< Face vertices. + const CAMFImporter_NodeElement_Color* Color;///< Face color. Equal to nullptr if color is not set for the face. + const CAMFImporter_NodeElement_TexMap* TexMap;///< Face texture mapping data. Equal to nullptr if texture mapping is not set for the face. + }; + + + + /***********************************************/ + /****************** Constants ******************/ + /***********************************************/ + +private: + + static const aiImporterDesc Description; + + /***********************************************/ + /****************** Variables ******************/ + /***********************************************/ + +private: + + CAMFImporter_NodeElement* mNodeElement_Cur;///< Current element. + std::list mNodeElement_List;///< All elements of scene graph. + irr::io::IrrXMLReader* mReader;///< Pointer to XML-reader object + std::string mUnit; + std::list mMaterial_Converted;///< List of converted materials for postprocessing step. + std::list mTexture_Converted;///< List of converted textures for postprocessing step. + + /***********************************************/ + /****************** Functions ******************/ + /***********************************************/ + +private: + + /// \fn AMFImporter(const AMFImporter& pScene) + /// Disabled copy constructor. + AMFImporter(const AMFImporter& pScene); + + /// \fn AMFImporter& operator=(const AMFImporter& pScene) + /// Disabled assign operator. + AMFImporter& operator=(const AMFImporter& pScene); + + /// \fn void Clear() + /// Clear all temporary data. + void Clear(); + + /***********************************************/ + /************* Functions: find set *************/ + /***********************************************/ + + /// \fn bool Find_NodeElement(const std::string& pID, const CAMFImporter_NodeElement::EType pType, aiNode** pNode) const + /// Find specified node element in node elements list ( \ref mNodeElement_List). + /// \param [in] pID - ID(name) of requested node element. + /// \param [in] pType - type of node element. + /// \param [out] pNode - pointer to pointer to item found. + /// \return true - if the node element is found, else - false. + bool Find_NodeElement(const std::string& pID, const CAMFImporter_NodeElement::EType pType, CAMFImporter_NodeElement** pNodeElement) const; + + /// \fn bool Find_ConvertedNode(const std::string& pID, std::list& pNodeList, aiNode** pNode) const + /// Find requested aiNode in node list. + /// \param [in] pID - ID(name) of requested node. + /// \param [in] pNodeList - list of nodes where to find the node. + /// \param [out] pNode - pointer to pointer to item found. + /// \return true - if the node is found, else - false. + bool Find_ConvertedNode(const std::string& pID, std::list& pNodeList, aiNode** pNode) const; + + /// \fn bool Find_ConvertedMaterial(const std::string& pID, const SPP_Material** pConvertedMaterial) const + /// Find material in list for converted materials. Use at postprocessing step. + /// \param [in] pID - material ID. + /// \param [out] pConvertedMaterial - pointer to found converted material (\ref SPP_Material). + /// \return true - if the material is found, else - false. + bool Find_ConvertedMaterial(const std::string& pID, const SPP_Material** pConvertedMaterial) const; + + /// \fn bool Find_ConvertedTexture(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, const std::string& pID_A, uint32_t* pConvertedTextureIndex = nullptr) const + /// Find texture in list of converted textures. Use at postprocessing step, + /// \param [in] pID_R - ID of source "red" texture. + /// \param [in] pID_G - ID of source "green" texture. + /// \param [in] pID_B - ID of source "blue" texture. + /// \param [in] pID_A - ID of source "alpha" texture. Use empty string to find RGB-texture. + /// \param [out] pConvertedTextureIndex - pointer where index in list of found texture will be written. If equivalent to nullptr then nothing will be + /// written. + /// \return true - if the texture is found, else - false. + bool Find_ConvertedTexture(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, const std::string& pID_A, + uint32_t* pConvertedTextureIndex = nullptr) const; + + /***********************************************/ + /********* Functions: postprocess set **********/ + /***********************************************/ + + /// \fn void PostprocessHelper_CreateMeshDataArray(const CAMFImporter_NodeElement_Mesh& pNodeElement, std::vector& pVertexCoordinateArray, std::vector& pVertexColorArray) const + /// Get data stored in and place it to arrays. + /// \param [in] pNodeElement - reference to node element which kept data. + /// \param [in] pVertexCoordinateArray - reference to vertices coordinates kept in . + /// \param [in] pVertexColorArray - reference to vertices colors for all & pVertexCoordinateArray, + std::vector& pVertexColorArray) const; + + /// \fn size_t PostprocessHelper_GetTextureID_Or_Create(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, const std::string& pID_A) + /// Return converted texture ID which related to specified source textures ID's. If converted texture does not exist then it will be created and ID on new + /// converted texture will be returned. Conversion: set of textures from \ref CAMFImporter_NodeElement_Texture to one \ref SPP_Texture and place it + /// to converted textures list. + /// Any of source ID's can be absent(empty string) or even one ID only specified. But at least one ID must be specified. + /// \param [in] pID_R - ID of source "red" texture. + /// \param [in] pID_G - ID of source "green" texture. + /// \param [in] pID_B - ID of source "blue" texture. + /// \param [in] pID_A - ID of source "alpha" texture. + /// \return index of the texture in array of the converted textures. + size_t PostprocessHelper_GetTextureID_Or_Create(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, const std::string& pID_A); + + /// \fn void PostprocessHelper_SplitFacesByTextureID(std::list& pInputList, std::list > pOutputList_Separated) + /// Separate input list by texture IDs. This step is needed because aiMesh can contain mesh which is use only one texture (or set: diffuse, bump etc). + /// \param [in] pInputList - input list with faces. Some of them can contain color or texture mapping, or both of them, or nothing. Will be cleared after + /// processing. + /// \param [out] pOutputList_Separated - output list of the faces lists. Separated faces list by used texture IDs. Will be cleared before processing. + void PostprocessHelper_SplitFacesByTextureID(std::list& pInputList, std::list >& pOutputList_Separated); + + /// \fn void Postprocess_AddMetadata(const std::list& pMetadataList, aiNode& pSceneNode) const + /// Check if child elements of node element is metadata and add it to scene node. + /// \param [in] pMetadataList - reference to list with collected metadata. + /// \param [out] pSceneNode - scene node in which metadata will be added. + void Postprocess_AddMetadata(const std::list& pMetadataList, aiNode& pSceneNode) const; + + /// \fn void Postprocess_BuildNodeAndObject(const CAMFImporter_NodeElement_Object& pNodeElement, std::list& pMeshList, aiNode** pSceneNode) + /// To create aiMesh and aiNode for it from . + /// \param [in] pNodeElement - reference to node element which kept data. + /// \param [out] pMeshList - reference to a list with all aiMesh of the scene. + /// \param [out] pSceneNode - pointer to place where new aiNode will be created. + void Postprocess_BuildNodeAndObject(const CAMFImporter_NodeElement_Object& pNodeElement, std::list& pMeshList, aiNode** pSceneNode); + + /// \fn void Postprocess_BuildMeshSet(const CAMFImporter_NodeElement_Mesh& pNodeElement, const std::vector& pVertexCoordinateArray, const std::vector& pVertexColorArray, const CAMFImporter_NodeElement_Color* pObjectColor, std::list& pMeshList, aiNode& pSceneNode) + /// Create mesh for every in . + /// \param [in] pNodeElement - reference to node element which kept data. + /// \param [in] pVertexCoordinateArray - reference to vertices coordinates for all 's. + /// \param [in] pVertexColorArray - reference to vertices colors for all 's. If color for vertex is not set then corresponding member of array + /// contain nullptr. + /// \param [in] pObjectColor - pointer to colors for . If color is not set then argument contain nullptr. + /// \param [in] pMaterialList - reference to a list with defined materials. + /// \param [out] pMeshList - reference to a list with all aiMesh of the scene. + /// \param [out] pSceneNode - reference to aiNode which will own new aiMesh's. + void Postprocess_BuildMeshSet(const CAMFImporter_NodeElement_Mesh& pNodeElement, const std::vector& pVertexCoordinateArray, + const std::vector& pVertexColorArray, const CAMFImporter_NodeElement_Color* pObjectColor, + std::list& pMeshList, aiNode& pSceneNode); + + /// \fn void Postprocess_BuildMaterial(const CAMFImporter_NodeElement_Material& pMaterial) + /// Convert material from \ref CAMFImporter_NodeElement_Material to \ref SPP_Material. + /// \param [in] pMaterial - source CAMFImporter_NodeElement_Material. + void Postprocess_BuildMaterial(const CAMFImporter_NodeElement_Material& pMaterial); + + /// \fn void Postprocess_BuildConstellation(CAMFImporter_NodeElement_Constellation& pConstellation, std::list& pNodeList) const + /// Create and add to aiNode's list new part of scene graph defined by . + /// \param [in] pConstellation - reference to node. + /// \param [out] pNodeList - reference to aiNode's list. + void Postprocess_BuildConstellation(CAMFImporter_NodeElement_Constellation& pConstellation, std::list& pNodeList) const; + + /// \fn void Postprocess_BuildScene() + /// Build Assimp scene graph in aiScene from collected data. + /// \param [out] pScene - pointer to aiScene where tree will be built. + void Postprocess_BuildScene(aiScene* pScene); + + /***********************************************/ + /************* Functions: throw set ************/ + /***********************************************/ + + /// \fn void Throw_CloseNotFound(const std::string& pNode) + /// Call that function when close tag of node not found and exception must be raised. + /// E.g.: + /// + /// + /// + /// \throw DeadlyImportError. + /// \param [in] pNode - node name in which exception happened. + void Throw_CloseNotFound(const std::string& pNode); + + /// \fn void Throw_IncorrectAttr(const std::string& pAttrName) + /// Call that function when attribute name is incorrect and exception must be raised. + /// \param [in] pAttrName - attribute name. + /// \throw DeadlyImportError. + void Throw_IncorrectAttr(const std::string& pAttrName); + + /// \fn void Throw_IncorrectAttrValue(const std::string& pAttrName) + /// Call that function when attribute value is incorrect and exception must be raised. + /// \param [in] pAttrName - attribute name. + /// \throw DeadlyImportError. + void Throw_IncorrectAttrValue(const std::string& pAttrName); + + /// \fn void Throw_MoreThanOnceDefined(const std::string& pNode, const std::string& pDescription) + /// Call that function when some type of nodes are defined twice or more when must be used only once and exception must be raised. + /// E.g.: + /// + /// ... + /// ... + /// + /// \throw DeadlyImportError. + /// \param [in] pNodeType - type of node which defined one more time. + /// \param [in] pDescription - message about error. E.g. what the node defined while exception raised. + void Throw_MoreThanOnceDefined(const std::string& pNodeType, const std::string& pDescription); + + /// \fn void Throw_ID_NotFound(const std::string& pID) const + /// Call that function when referenced element ID are not found in graph and exception must be raised. + /// \param [in] pID - ID of of element which not found. + /// \throw DeadlyImportError. + void Throw_ID_NotFound(const std::string& pID) const; + + /***********************************************/ + /************** Functions: LOG set *************/ + /***********************************************/ + + /// \fn void LogInfo(const std::string& pMessage) + /// Short variant for calling \ref DefaultLogger::get()->info() + void LogInfo(const std::string& pMessage) { DefaultLogger::get()->info(pMessage); } + + /// \fn void LogWarning(const std::string& pMessage) + /// Short variant for calling \ref DefaultLogger::get()->warn() + void LogWarning(const std::string& pMessage) { DefaultLogger::get()->warn(pMessage); } + + /// \fn void LogError(const std::string& pMessage) + /// Short variant for calling \ref DefaultLogger::get()->error() + void LogError(const std::string& pMessage) { DefaultLogger::get()->error(pMessage); } + + /***********************************************/ + /************** Functions: XML set *************/ + /***********************************************/ + + /// \fn void XML_CheckNode_MustHaveChildren() + /// Check if current node have children: .... If not then exception will throwed. + void XML_CheckNode_MustHaveChildren(); + + /// \fn bool XML_CheckNode_NameEqual(const std::string& pNodeName) + /// Check if current node name is equal to pNodeName. + /// \param [in] pNodeName - name for checking. + /// return true if current node name is equal to pNodeName, else - false. + bool XML_CheckNode_NameEqual(const std::string& pNodeName) { return mReader->getNodeName() == pNodeName; } + + /// \fn void XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName) + /// Skip unsupported node and report about that. Depend on node name can be skipped begin tag of node all whole node. + /// \param [in] pParentNodeName - parent node name. Used for reporting. + void XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName); + + /// \fn bool XML_SearchNode(const std::string& pNodeName) + /// Search for specified node in file. XML file read pointer(mReader) will point to found node or file end after search is end. + /// \param [in] pNodeName - requested node name. + /// return true - if node is found, else - false. + bool XML_SearchNode(const std::string& pNodeName); + + /// \fn bool XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx) + /// Read attribute value. + /// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set). + /// \return read data. + bool XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx); + + /// \fn float XML_ReadNode_GetAttrVal_AsFloat(const int pAttrIdx) + /// Read attribute value. + /// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set). + /// \return read data. + float XML_ReadNode_GetAttrVal_AsFloat(const int pAttrIdx); + + /// \fn uint32_t XML_ReadNode_GetAttrVal_AsU32(const int pAttrIdx) + /// Read attribute value. + /// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set). + /// \return read data. + uint32_t XML_ReadNode_GetAttrVal_AsU32(const int pAttrIdx); + + /// \fn float XML_ReadNode_GetVal_AsFloat() + /// Read node value. + /// \return read data. + float XML_ReadNode_GetVal_AsFloat(); + + /// \fn uint32_t XML_ReadNode_GetVal_AsU32() + /// Read node value. + /// \return read data. + uint32_t XML_ReadNode_GetVal_AsU32(); + + /// \fn void XML_ReadNode_GetVal_AsString(std::string& pValue) + /// Read node value. + /// \return read data. + void XML_ReadNode_GetVal_AsString(std::string& pValue); + + /***********************************************/ + /******** Functions: parse set private *********/ + /***********************************************/ + + /// \fn void ParseHelper_Node_Enter(CAMFImporter_NodeElement* pNode) + /// Make pNode as current and enter deeper for parsing child nodes. At end \ref ParseHelper_Node_Exit must be called. + /// \param [in] pNode - new current node. + void ParseHelper_Node_Enter(CAMFImporter_NodeElement* pNode); + + /// \fn void ParseHelper_Group_End() + /// This function must be called when exiting from grouping node. \ref ParseHelper_Group_Begin. + void ParseHelper_Node_Exit(); + + /// \fn void ParseHelper_FixTruncatedFloatString(const char* pInStr, std::string& pOutString) + /// Attribute values of floating point types can take form ".x"(without leading zero). irrXMLReader can not read this form of values and it + /// must be converted to right form - "0.xxx". + /// \param [in] pInStr - pointer to input string which can contain incorrect form of values. + /// \param [out[ pOutString - output string with right form of values. + void ParseHelper_FixTruncatedFloatString(const char* pInStr, std::string& pOutString); + + /// \fn void ParseHelper_Decode_Base64(const std::string& pInputBase64, std::vector& pOutputData) const + /// Decode Base64-encoded data. + /// \param [in] pInputBase64 - reference to input Base64-encoded string. + /// \param [out] pOutputData - reference to output array for decoded data. + void ParseHelper_Decode_Base64(const std::string& pInputBase64, std::vector& pOutputData) const; + + /// \fn void ParseNode_Root() + /// Parse node of the file. + void ParseNode_Root(); + + /******** Functions: top nodes *********/ + + /// \fn void ParseNode_Constellation() + /// Parse node of the file. + void ParseNode_Constellation(); + + /// \fn void ParseNode_Constellation() + /// Parse node of the file. + void ParseNode_Instance(); + + /// \fn void ParseNode_Material() + /// Parse node of the file. + void ParseNode_Material(); + + /// \fn void ParseNode_Metadata() + /// Parse node. + void ParseNode_Metadata(); + + /// \fn void ParseNode_Object() + /// Parse node of the file. + void ParseNode_Object(); + + /// \fn void ParseNode_Texture() + /// Parse node of the file. + void ParseNode_Texture(); + + /******** Functions: geometry nodes *********/ + + /// \fn void ParseNode_Coordinates() + /// Parse node of the file. + void ParseNode_Coordinates(); + + /// \fn void ParseNode_Edge() + /// Parse node of the file. + void ParseNode_Edge(); + + /// \fn void ParseNode_Mesh() + /// Parse node of the file. + void ParseNode_Mesh(); + + /// \fn void ParseNode_Triangle() + /// Parse node of the file. + void ParseNode_Triangle(); + + /// \fn void ParseNode_Vertex() + /// Parse node of the file. + void ParseNode_Vertex(); + + /// \fn void ParseNode_Vertices() + /// Parse node of the file. + void ParseNode_Vertices(); + + /// \fn void ParseNode_Volume() + /// Parse node of the file. + void ParseNode_Volume(); + + /******** Functions: material nodes *********/ + + /// \fn void ParseNode_Color() + /// Parse node of the file. + void ParseNode_Color(); + + /// \fn void ParseNode_TexMap(const bool pUseOldName = false) + /// Parse of node of the file. + /// \param [in] pUseOldName - if true then use old name of node(and children) - , instead of new name - . + void ParseNode_TexMap(const bool pUseOldName = false); + +public: + + /// \fn AMFImporter() + /// Default constructor. + AMFImporter() + : mNodeElement_Cur(nullptr), mReader(nullptr) + {} + + /// \fn ~AMFImporter() + /// Default destructor. + ~AMFImporter(); + + /***********************************************/ + /******** Functions: parse set, public *********/ + /***********************************************/ + + /// \fn void ParseFile(const std::string& pFile, IOSystem* pIOHandler) + /// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph. + /// Also exception can be throwed if trouble will found. + /// \param [in] pFile - name of file to be parsed. + /// \param [in] pIOHandler - pointer to IO helper object. + void ParseFile(const std::string& pFile, IOSystem* pIOHandler); + + /***********************************************/ + /********* Functions: BaseImporter set *********/ + /***********************************************/ + + bool CanRead(const std::string& pFile, IOSystem* pIOHandler, bool pCheckSig) const; + void GetExtensionList(std::set& pExtensionList); + void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler); + const aiImporterDesc* GetInfo ()const; + +};// class AMFImporter + +}// namespace Assimp + +#endif // INCLUDED_AI_AMF_IMPORTER_H diff --git a/src/3rdparty/assimp/code/AMFImporter_Geometry.cpp b/src/3rdparty/assimp/code/AMFImporter_Geometry.cpp new file mode 100644 index 000000000..afba3f2bc --- /dev/null +++ b/src/3rdparty/assimp/code/AMFImporter_Geometry.cpp @@ -0,0 +1,356 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. +--------------------------------------------------------------------------- +*/ + +/// \file AMFImporter_Geometry.cpp +/// \brief Parsing data from geometry nodes. +/// \date 2016 +/// \author smal.root@gmail.com + +#ifndef ASSIMP_BUILD_NO_AMF_IMPORTER + +#include "AMFImporter.hpp" +#include "AMFImporter_Macro.hpp" + +namespace Assimp +{ + +// +// +// A 3D mesh hull. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Mesh() +{ +CAMFImporter_NodeElement* ne; + + // create new mesh object. + ne = new CAMFImporter_NodeElement_Mesh(mNodeElement_Cur); + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool vert_read = false; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("mesh"); + if(XML_CheckNode_NameEqual("vertices")) + { + // Check if data already defined. + if(vert_read) Throw_MoreThanOnceDefined("vertices", "Only one vertices set can be defined for ."); + // read data and set flag about it + ParseNode_Vertices(); + vert_read = true; + + continue; + } + + if(XML_CheckNode_NameEqual("volume")) { ParseNode_Volume(); continue; } + MACRO_NODECHECK_LOOPEND("mesh"); + ParseHelper_Node_Exit(); + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// The list of vertices to be used in defining triangles. +// Multi elements - No. +// Parent element - . +void AMFImporter::ParseNode_Vertices() +{ +CAMFImporter_NodeElement* ne; + + // create new mesh object. + ne = new CAMFImporter_NodeElement_Vertices(mNodeElement_Cur); + // Check for child nodes + if(!mReader->isEmptyElement()) + { + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("vertices"); + if(XML_CheckNode_NameEqual("vertex")) { ParseNode_Vertex(); continue; } + MACRO_NODECHECK_LOOPEND("vertices"); + ParseHelper_Node_Exit(); + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// A vertex to be referenced in triangles. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Vertex() +{ +CAMFImporter_NodeElement* ne; + + // create new mesh object. + ne = new CAMFImporter_NodeElement_Vertex(mNodeElement_Cur); + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool col_read = false; + bool coord_read = false; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("vertex"); + if(XML_CheckNode_NameEqual("color")) + { + // Check if data already defined. + if(col_read) Throw_MoreThanOnceDefined("color", "Only one color can be defined for ."); + // read data and set flag about it + ParseNode_Color(); + col_read = true; + + continue; + } + + if(XML_CheckNode_NameEqual("coordinates")) + { + // Check if data already defined. + if(coord_read) Throw_MoreThanOnceDefined("coordinates", "Only one coordinates set can be defined for ."); + // read data and set flag about it + ParseNode_Coordinates(); + coord_read = true; + + continue; + } + + if(XML_CheckNode_NameEqual("metadata")) { ParseNode_Metadata(); continue; } + MACRO_NODECHECK_LOOPEND("vertex"); + ParseHelper_Node_Exit(); + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// Specifies the 3D location of this vertex. +// Multi elements - No. +// Parent element - . +// +// Children elements: +// , , +// Multi elements - No. +// X, Y, or Z coordinate, respectively, of a vertex position in space. +void AMFImporter::ParseNode_Coordinates() +{ +CAMFImporter_NodeElement* ne; + + // create new color object. + ne = new CAMFImporter_NodeElement_Coordinates(mNodeElement_Cur); + + CAMFImporter_NodeElement_Coordinates& als = *((CAMFImporter_NodeElement_Coordinates*)ne);// alias for convenience + + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool read_flag[3] = { false, false, false }; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("coordinates"); + MACRO_NODECHECK_READCOMP_F("x", read_flag[0], als.Coordinate.x); + MACRO_NODECHECK_READCOMP_F("y", read_flag[1], als.Coordinate.y); + MACRO_NODECHECK_READCOMP_F("z", read_flag[2], als.Coordinate.z); + MACRO_NODECHECK_LOOPEND("coordinates"); + ParseHelper_Node_Exit(); + // check that all components was defined + if((read_flag[0] && read_flag[1] && read_flag[2]) == 0) throw DeadlyImportError("Not all coordinate's components are defined."); + + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// Defines a volume from the established vertex list. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Volume() +{ +std::string materialid; +std::string type; +CAMFImporter_NodeElement* ne; + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("materialid", materialid, mReader->getAttributeValue); + MACRO_ATTRREAD_CHECK_RET("type", type, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + + // create new object. + ne = new CAMFImporter_NodeElement_Volume(mNodeElement_Cur); + // and assign read data + ((CAMFImporter_NodeElement_Volume*)ne)->MaterialID = materialid; + ((CAMFImporter_NodeElement_Volume*)ne)->Type = type; + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool col_read = false; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("volume"); + if(XML_CheckNode_NameEqual("color")) + { + // Check if data already defined. + if(col_read) Throw_MoreThanOnceDefined("color", "Only one color can be defined for ."); + // read data and set flag about it + ParseNode_Color(); + col_read = true; + + continue; + } + + if(XML_CheckNode_NameEqual("triangle")) { ParseNode_Triangle(); continue; } + if(XML_CheckNode_NameEqual("metadata")) { ParseNode_Metadata(); continue; } + MACRO_NODECHECK_LOOPEND("volume"); + ParseHelper_Node_Exit(); + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// Defines a 3D triangle from three vertices, according to the right-hand rule (counter-clockwise when looking from the outside). +// Multi elements - Yes. +// Parent element - . +// +// Children elements: +// , , +// Multi elements - No. +// Index of the desired vertices in a triangle or edge. +void AMFImporter::ParseNode_Triangle() +{ +CAMFImporter_NodeElement* ne; + + // create new color object. + ne = new CAMFImporter_NodeElement_Triangle(mNodeElement_Cur); + + CAMFImporter_NodeElement_Triangle& als = *((CAMFImporter_NodeElement_Triangle*)ne);// alias for convenience + + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool col_read = false, tex_read = false; + bool read_flag[3] = { false, false, false }; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("triangle"); + if(XML_CheckNode_NameEqual("color")) + { + // Check if data already defined. + if(col_read) Throw_MoreThanOnceDefined("color", "Only one color can be defined for ."); + // read data and set flag about it + ParseNode_Color(); + col_read = true; + + continue; + } + + if(XML_CheckNode_NameEqual("texmap"))// new name of node: "texmap". + { + // Check if data already defined. + if(tex_read) Throw_MoreThanOnceDefined("texmap", "Only one texture coordinate can be defined for ."); + // read data and set flag about it + ParseNode_TexMap(); + tex_read = true; + + continue; + } + else if(XML_CheckNode_NameEqual("map"))// old name of node: "map". + { + // Check if data already defined. + if(tex_read) Throw_MoreThanOnceDefined("map", "Only one texture coordinate can be defined for ."); + // read data and set flag about it + ParseNode_TexMap(true); + tex_read = true; + + continue; + } + + MACRO_NODECHECK_READCOMP_U32("v1", read_flag[0], als.V[0]); + MACRO_NODECHECK_READCOMP_U32("v2", read_flag[1], als.V[1]); + MACRO_NODECHECK_READCOMP_U32("v3", read_flag[2], als.V[2]); + MACRO_NODECHECK_LOOPEND("triangle"); + ParseHelper_Node_Exit(); + // check that all components was defined + if((read_flag[0] && read_flag[1] && read_flag[2]) == 0) throw DeadlyImportError("Not all vertices of the triangle are defined."); + + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +}// namespace Assimp + +#endif // !ASSIMP_BUILD_NO_AMF_IMPORTER diff --git a/src/3rdparty/assimp/code/AMFImporter_Macro.hpp b/src/3rdparty/assimp/code/AMFImporter_Macro.hpp new file mode 100644 index 000000000..b7c0f9863 --- /dev/null +++ b/src/3rdparty/assimp/code/AMFImporter_Macro.hpp @@ -0,0 +1,165 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. +--------------------------------------------------------------------------- +*/ + +/// \file AMFImporter_Macro.hpp +/// \brief Useful macrodefines. +/// \date 2016 +/// \author smal.root@gmail.com + +#pragma once +#ifndef AMFIMPORTER_MACRO_HPP_INCLUDED +#define AMFIMPORTER_MACRO_HPP_INCLUDED + +/// \def MACRO_ATTRREAD_LOOPBEG +/// Begin of loop that read attributes values. +#define MACRO_ATTRREAD_LOOPBEG \ + for(int idx = 0, idx_end = mReader->getAttributeCount(); idx < idx_end; idx++) \ + { \ + std::string an(mReader->getAttributeName(idx)); + +/// \def MACRO_ATTRREAD_LOOPEND +/// End of loop that read attributes values. +#define MACRO_ATTRREAD_LOOPEND \ + Throw_IncorrectAttr(an); \ + } + +/// \def MACRO_ATTRREAD_LOOPEND_WSKIP +/// End of loop that read attributes values. Difference from \ref MACRO_ATTRREAD_LOOPEND in that: current macro skip unknown attributes, but +/// \ref MACRO_ATTRREAD_LOOPEND throw an exception. +#define MACRO_ATTRREAD_LOOPEND_WSKIP \ + continue; \ + } + +/// \def MACRO_ATTRREAD_CHECK_REF +/// Check curent attribute name and if it equal to requested then read value. Result write to output variable by reference. If result was read then +/// "continue" will called. +/// \param [in] pAttrName - attribute name. +/// \param [out] pVarName - output variable name. +/// \param [in] pFunction - function which read attribute value and write it to pVarName. +#define MACRO_ATTRREAD_CHECK_REF(pAttrName, pVarName, pFunction) \ + if(an == pAttrName) \ + { \ + pFunction(idx, pVarName); \ + continue; \ + } + +/// \def MACRO_ATTRREAD_CHECK_RET +/// Check curent attribute name and if it equal to requested then read value. Result write to output variable using return value of \ref pFunction. +/// If result was read then "continue" will called. +/// \param [in] pAttrName - attribute name. +/// \param [out] pVarName - output variable name. +/// \param [in] pFunction - function which read attribute value and write it to pVarName. +#define MACRO_ATTRREAD_CHECK_RET(pAttrName, pVarName, pFunction) \ + if(an == pAttrName) \ + { \ + pVarName = pFunction(idx); \ + continue; \ + } + +/// \def MACRO_NODECHECK_LOOPBEGIN(pNodeName) +/// Begin of loop of parsing child nodes. Do not add ';' at end. +/// \param [in] pNodeName - current node name. +#define MACRO_NODECHECK_LOOPBEGIN(pNodeName) \ + do { \ + bool close_found = false; \ + \ + while(mReader->read()) \ + { \ + if(mReader->getNodeType() == irr::io::EXN_ELEMENT) \ + { + +/// \def MACRO_NODECHECK_LOOPEND(pNodeName) +/// End of loop of parsing child nodes. +/// \param [in] pNodeName - current node name. +#define MACRO_NODECHECK_LOOPEND(pNodeName) \ + XML_CheckNode_SkipUnsupported(pNodeName); \ + }/* if(mReader->getNodeType() == irr::io::EXN_ELEMENT) */ \ + else if(mReader->getNodeType() == irr::io::EXN_ELEMENT_END) \ + { \ + if(XML_CheckNode_NameEqual(pNodeName)) \ + { \ + close_found = true; \ + \ + break; \ + } \ + }/* else if(mReader->getNodeType() == irr::io::EXN_ELEMENT_END) */ \ + }/* while(mReader->read()) */ \ + \ + if(!close_found) Throw_CloseNotFound(pNodeName); \ + \ + } while(false) + +/// \def MACRO_NODECHECK_READCOMP_F +/// Check curent node name and if it equal to requested then read value. Result write to output variable of type "float". +/// If result was read then "continue" will called. Also check if node data already read then raise exception. +/// \param [in] pNodeName - node name. +/// \param [in, out] pReadFlag - read flag. +/// \param [out] pVarName - output variable name. +#define MACRO_NODECHECK_READCOMP_F(pNodeName, pReadFlag, pVarName) \ + if(XML_CheckNode_NameEqual(pNodeName)) \ + { \ + /* Check if field already read before. */ \ + if(pReadFlag) Throw_MoreThanOnceDefined(pNodeName, "Only one component can be defined."); \ + /* Read color component and assign it to object. */ \ + pVarName = XML_ReadNode_GetVal_AsFloat(); \ + pReadFlag = true; \ + continue; \ + } + +/// \def MACRO_NODECHECK_READCOMP_U32 +/// Check curent node name and if it equal to requested then read value. Result write to output variable of type "uint32_t". +/// If result was read then "continue" will called. Also check if node data already read then raise exception. +/// \param [in] pNodeName - node name. +/// \param [in, out] pReadFlag - read flag. +/// \param [out] pVarName - output variable name. +#define MACRO_NODECHECK_READCOMP_U32(pNodeName, pReadFlag, pVarName) \ + if(XML_CheckNode_NameEqual(pNodeName)) \ + { \ + /* Check if field already read before. */ \ + if(pReadFlag) Throw_MoreThanOnceDefined(pNodeName, "Only one component can be defined."); \ + /* Read color component and assign it to object. */ \ + pVarName = XML_ReadNode_GetVal_AsU32(); \ + pReadFlag = true; \ + continue; \ + } + +#endif // AMFIMPORTER_MACRO_HPP_INCLUDED diff --git a/src/3rdparty/assimp/code/AMFImporter_Material.cpp b/src/3rdparty/assimp/code/AMFImporter_Material.cpp new file mode 100644 index 000000000..d15099fac --- /dev/null +++ b/src/3rdparty/assimp/code/AMFImporter_Material.cpp @@ -0,0 +1,310 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. +--------------------------------------------------------------------------- +*/ + +/// \file AMFImporter_Material.cpp +/// \brief Parsing data from material nodes. +/// \date 2016 +/// \author smal.root@gmail.com + +#ifndef ASSIMP_BUILD_NO_AMF_IMPORTER + +#include "AMFImporter.hpp" +#include "AMFImporter_Macro.hpp" + +namespace Assimp +{ + +// , and . +// > +// +// A color definition. +// Multi elements - No. +// Parent element - , , , , . +// +// "profile" can be one of "sRGB", "AdobeRGB", "Wide-Gamut-RGB", "CIERGB", "CIELAB", or "CIEXYZ". +// Children elements: +// , , , +// Multi elements - No. +// Red, Greed, Blue and Alpha (transparency) component of a color in sRGB space, values ranging from 0 to 1. The +// values can be specified as constants, or as a formula depending on the coordinates. +void AMFImporter::ParseNode_Color() +{ +std::string profile; +CAMFImporter_NodeElement* ne; + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("profile", profile, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + + // create new color object. + ne = new CAMFImporter_NodeElement_Color(mNodeElement_Cur); + + CAMFImporter_NodeElement_Color& als = *((CAMFImporter_NodeElement_Color*)ne);// alias for convenience + + als.Profile = profile; + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool read_flag[4] = { false, false, false, false }; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("color"); + MACRO_NODECHECK_READCOMP_F("r", read_flag[0], als.Color.r); + MACRO_NODECHECK_READCOMP_F("g", read_flag[1], als.Color.g); + MACRO_NODECHECK_READCOMP_F("b", read_flag[2], als.Color.b); + MACRO_NODECHECK_READCOMP_F("a", read_flag[3], als.Color.a); + MACRO_NODECHECK_LOOPEND("color"); + ParseHelper_Node_Exit(); + // check that all components was defined + if(!(read_flag[0] && read_flag[1] && read_flag[2])) throw DeadlyImportError("Not all color components are defined."); + // check if is absent. Then manualy add "a == 1". + if(!read_flag[3]) als.Color.a = 1; + + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + als.Composed = false; + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// An available material. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Material() +{ +std::string id; +CAMFImporter_NodeElement* ne; + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("id", id, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + + // create new object. + ne = new CAMFImporter_NodeElement_Material(mNodeElement_Cur); + // and assign read data + ((CAMFImporter_NodeElement_Material*)ne)->ID = id; + // Check for child nodes + if(!mReader->isEmptyElement()) + { + bool col_read = false; + + ParseHelper_Node_Enter(ne); + MACRO_NODECHECK_LOOPBEGIN("material"); + if(XML_CheckNode_NameEqual("color")) + { + // Check if data already defined. + if(col_read) Throw_MoreThanOnceDefined("color", "Only one color can be defined for ."); + // read data and set flag about it + ParseNode_Color(); + col_read = true; + + continue; + } + + if(XML_CheckNode_NameEqual("metadata")) { ParseNode_Metadata(); continue; } + MACRO_NODECHECK_LOOPEND("material"); + ParseHelper_Node_Exit(); + }// if(!mReader->isEmptyElement()) + else + { + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + }// if(!mReader->isEmptyElement()) else + + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// +// Specifies an texture data to be used as a map. Lists a sequence of Base64 values specifying values for pixels from left to right then top to bottom, +// then layer by layer. +// Multi elements - Yes. +// Parent element - . +void AMFImporter::ParseNode_Texture() +{ +std::string id; +uint32_t width = 0; +uint32_t height = 0; +uint32_t depth = 1; +std::string type; +bool tiled = false; +std::string enc64_data; +CAMFImporter_NodeElement* ne; + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("id", id, mReader->getAttributeValue); + MACRO_ATTRREAD_CHECK_RET("width", width, XML_ReadNode_GetAttrVal_AsU32); + MACRO_ATTRREAD_CHECK_RET("height", height, XML_ReadNode_GetAttrVal_AsU32); + MACRO_ATTRREAD_CHECK_RET("depth", depth, XML_ReadNode_GetAttrVal_AsU32); + MACRO_ATTRREAD_CHECK_RET("type", type, mReader->getAttributeValue); + MACRO_ATTRREAD_CHECK_RET("tiled", tiled, XML_ReadNode_GetAttrVal_AsBool); + MACRO_ATTRREAD_LOOPEND; + + // create new texture object. + ne = new CAMFImporter_NodeElement_Texture(mNodeElement_Cur); + + CAMFImporter_NodeElement_Texture& als = *((CAMFImporter_NodeElement_Texture*)ne);// alias for convenience + + // Check for child nodes + if(!mReader->isEmptyElement()) XML_ReadNode_GetVal_AsString(enc64_data); + + // check that all components was defined + if(id.empty()) throw DeadlyImportError("ID for texture must be defined."); + if(width < 1) Throw_IncorrectAttrValue("width"); + if(height < 1) Throw_IncorrectAttrValue("height"); + if(depth < 1) Throw_IncorrectAttrValue("depth"); + if(type != "grayscale") Throw_IncorrectAttrValue("type"); + if(enc64_data.empty()) throw DeadlyImportError("Texture data not defined."); + // copy data + als.ID = id; + als.Width = width; + als.Height = height; + als.Depth = depth; + als.Tiled = tiled; + ParseHelper_Decode_Base64(enc64_data, als.Data); + // check data size + if((width * height * depth) != als.Data.size()) throw DeadlyImportError("Texture has incorrect data size."); + + mNodeElement_Cur->Child.push_back(ne);// Add element to child list of current element + mNodeElement_List.push_back(ne);// and to node element list because its a new object in graph. +} + +// +// , old name: +// Specifies texture coordinates for triangle. +// Multi elements - No. +// Parent element - . +// Children elements: +// , , , , , . Old name: , , , , , . +// Multi elements - No. +// Texture coordinates for every vertex of triangle. +void AMFImporter::ParseNode_TexMap(const bool pUseOldName) +{ +std::string rtexid, gtexid, btexid, atexid; +CAMFImporter_NodeElement* ne; + + // Read attributes for node . + MACRO_ATTRREAD_LOOPBEG; + MACRO_ATTRREAD_CHECK_RET("rtexid", rtexid, mReader->getAttributeValue); + MACRO_ATTRREAD_CHECK_RET("gtexid", gtexid, mReader->getAttributeValue); + MACRO_ATTRREAD_CHECK_RET("btexid", btexid, mReader->getAttributeValue); + MACRO_ATTRREAD_CHECK_RET("atexid", atexid, mReader->getAttributeValue); + MACRO_ATTRREAD_LOOPEND; + + // create new texture coordinates object. + ne = new CAMFImporter_NodeElement_TexMap(mNodeElement_Cur); + + CAMFImporter_NodeElement_TexMap& als = *((CAMFImporter_NodeElement_TexMap*)ne);// alias for convenience + // check data + if(rtexid.empty() && gtexid.empty() && btexid.empty()) throw DeadlyImportError("ParseNode_TexMap. At least one texture ID must be defined."); + // Check for children nodes + XML_CheckNode_MustHaveChildren(); + // read children nodes + bool read_flag[6] = { false, false, false, false, false, false }; + + ParseHelper_Node_Enter(ne); + if(!pUseOldName) + { + MACRO_NODECHECK_LOOPBEGIN("texmap"); + MACRO_NODECHECK_READCOMP_F("utex1", read_flag[0], als.TextureCoordinate[0].x); + MACRO_NODECHECK_READCOMP_F("utex2", read_flag[1], als.TextureCoordinate[1].x); + MACRO_NODECHECK_READCOMP_F("utex3", read_flag[2], als.TextureCoordinate[2].x); + MACRO_NODECHECK_READCOMP_F("vtex1", read_flag[3], als.TextureCoordinate[0].y); + MACRO_NODECHECK_READCOMP_F("vtex2", read_flag[4], als.TextureCoordinate[1].y); + MACRO_NODECHECK_READCOMP_F("vtex3", read_flag[5], als.TextureCoordinate[2].y); + MACRO_NODECHECK_LOOPEND("texmap"); + } + else + { + MACRO_NODECHECK_LOOPBEGIN("map"); + MACRO_NODECHECK_READCOMP_F("u1", read_flag[0], als.TextureCoordinate[0].x); + MACRO_NODECHECK_READCOMP_F("u2", read_flag[1], als.TextureCoordinate[1].x); + MACRO_NODECHECK_READCOMP_F("u3", read_flag[2], als.TextureCoordinate[2].x); + MACRO_NODECHECK_READCOMP_F("v1", read_flag[3], als.TextureCoordinate[0].y); + MACRO_NODECHECK_READCOMP_F("v2", read_flag[4], als.TextureCoordinate[1].y); + MACRO_NODECHECK_READCOMP_F("v3", read_flag[5], als.TextureCoordinate[2].y); + MACRO_NODECHECK_LOOPEND("map"); + }// if(!pUseOldName) else + + ParseHelper_Node_Exit(); + + // check that all components was defined + if(!(read_flag[0] && read_flag[1] && read_flag[2] && read_flag[3] && read_flag[4] && read_flag[5])) + throw DeadlyImportError("Not all texture coordinates are defined."); + + // copy attributes data + als.TextureID_R = rtexid; + als.TextureID_G = gtexid; + als.TextureID_B = btexid; + als.TextureID_A = atexid; + + mNodeElement_List.push_back(ne);// add to node element list because its a new object in graph. +} + +}// namespace Assimp + +#endif // !ASSIMP_BUILD_NO_AMF_IMPORTER diff --git a/src/3rdparty/assimp/code/AMFImporter_Node.hpp b/src/3rdparty/assimp/code/AMFImporter_Node.hpp new file mode 100644 index 000000000..522e6ccca --- /dev/null +++ b/src/3rdparty/assimp/code/AMFImporter_Node.hpp @@ -0,0 +1,400 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. +--------------------------------------------------------------------------- +*/ + +/// \file AMFImporter_Node.hpp +/// \brief Elements of scene graph. +/// \date 2016 +/// \author smal.root@gmail.com + +#pragma once +#ifndef INCLUDED_AI_AMF_IMPORTER_NODE_H +#define INCLUDED_AI_AMF_IMPORTER_NODE_H + +// Header files, stdlib. +#include +#include +#include + +// Header files, Assimp. +#include "assimp/types.h" +#include "assimp/scene.h" + +/// \class CAMFImporter_NodeElement +/// Base class for elements of nodes. +class CAMFImporter_NodeElement { + +public: + /// Define what data type contain node element. + enum EType { + ENET_Color, ///< Color element: . + ENET_Constellation,///< Grouping element: . + ENET_Coordinates, ///< Coordinates element: . + ENET_Edge, ///< Edge element: . + ENET_Instance, ///< Grouping element: . + ENET_Material, ///< Material element: . + ENET_Metadata, ///< Metadata element: . + ENET_Mesh, ///< Metadata element: . + ENET_Object, ///< Element which hold object: . + ENET_Root, ///< Root element: . + ENET_Triangle, ///< Triangle element: . + ENET_TexMap, ///< Texture coordinates element: or . + ENET_Texture, ///< Texture element: . + ENET_Vertex, ///< Vertex element: . + ENET_Vertices, ///< Vertex element: . + ENET_Volume, ///< Volume element: . + + ENET_Invalid ///< Element has invalid type and possible contain invalid data. + }; + + const EType Type;///< Type of element. + std::string ID;///< ID of element. + CAMFImporter_NodeElement* Parent;///< Parent element. If nullptr then this node is root. + std::list Child;///< Child elements. + +public: /// Destructor, virtual.. + virtual ~CAMFImporter_NodeElement() { + // empty + } + +private: + /// Disabled copy constructor. + CAMFImporter_NodeElement(const CAMFImporter_NodeElement& pNodeElement); + + /// Disabled assign operator. + CAMFImporter_NodeElement& operator=(const CAMFImporter_NodeElement& pNodeElement); + + /// Disabled default constructor. + CAMFImporter_NodeElement(); + +protected: + /// In constructor inheritor must set element type. + /// \param [in] pType - element type. + /// \param [in] pParent - parent element. + CAMFImporter_NodeElement(const EType pType, CAMFImporter_NodeElement* pParent) + : Type(pType) + , ID() + , Parent(pParent) + , Child() { + // empty + } +};// class IAMFImporter_NodeElement + +/// \struct CAMFImporter_NodeElement_Constellation +/// A collection of objects or constellations with specific relative locations. +struct CAMFImporter_NodeElement_Constellation : public CAMFImporter_NodeElement +{ + /// \fn CAMFImporter_NodeElement_Constellation(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Constellation(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Constellation, pParent) + {} + +};// struct CAMFImporter_NodeElement_Constellation + +/// \struct CAMFImporter_NodeElement_Instance +/// Part of constellation. +struct CAMFImporter_NodeElement_Instance : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + std::string ObjectID;///< ID of object for instantiation. + /// \var Delta - The distance of translation in the x, y, or z direction, respectively, in the referenced object's coordinate system, to + /// create an instance of the object in the current constellation. + aiVector3D Delta; + + /// \var Rotation - The rotation, in degrees, to rotate the referenced object about its x, y, and z axes, respectively, to create an + /// instance of the object in the current constellation. Rotations shall be executed in order of x first, then y, then z. + aiVector3D Rotation; + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_Instance(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Instance(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Instance, pParent) + {} + +};// struct CAMFImporter_NodeElement_Instance + +/// \struct CAMFImporter_NodeElement_Metadata +/// Structure that define metadata node. +struct CAMFImporter_NodeElement_Metadata : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + std::string Type;///< Type of "Value". + std::string Value;///< Value. + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_Metadata(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Metadata(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Metadata, pParent) + {} + +};// struct CAMFImporter_NodeElement_Metadata + +/// \struct CAMFImporter_NodeElement_Root +/// Structure that define root node. +struct CAMFImporter_NodeElement_Root : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + std::string Unit;///< The units to be used. May be "inch", "millimeter", "meter", "feet", or "micron". + std::string Version;///< Version of format. + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_Root(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Root(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Root, pParent) + {} + +};// struct CAMFImporter_NodeElement_Root + +/// \struct CAMFImporter_NodeElement_Color +/// Structure that define object node. +struct CAMFImporter_NodeElement_Color : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + bool Composed;///< Type of color stored: if true then look for formula in \ref Color_Composed[4], else - in \ref Color. + std::string Color_Composed[4];///< By components formulas of composed color. [0..3] => RGBA. + aiColor4D Color;///< Constant color. + std::string Profile;///< The ICC color space used to interpret the three color channels , and .. + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_Color(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Color(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Color, pParent) + {} + +};// struct CAMFImporter_NodeElement_Color + +/// \struct CAMFImporter_NodeElement_Material +/// Structure that define material node. +struct CAMFImporter_NodeElement_Material : public CAMFImporter_NodeElement +{ + /// \fn CAMFImporter_NodeElement_Material(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Material(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Material, pParent) + {} + +};// struct CAMFImporter_NodeElement_Material + +/// \struct CAMFImporter_NodeElement_Object +/// Structure that define object node. +struct CAMFImporter_NodeElement_Object : public CAMFImporter_NodeElement +{ + /// \fn CAMFImporter_NodeElement_Object(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Object(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Object, pParent) + {} + +};// struct CAMFImporter_NodeElement_Object + +/// \struct CAMFImporter_NodeElement_Mesh +/// Structure that define mesh node. +struct CAMFImporter_NodeElement_Mesh : public CAMFImporter_NodeElement +{ + /// \fn CAMFImporter_NodeElement_Mesh(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Mesh(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Mesh, pParent) + {} + +};// struct CAMFImporter_NodeElement_Mesh + +/// \struct CAMFImporter_NodeElement_Vertex +/// Structure that define vertex node. +struct CAMFImporter_NodeElement_Vertex : public CAMFImporter_NodeElement +{ + /// \fn CAMFImporter_NodeElement_Vertex(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Vertex(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Vertex, pParent) + {} + +};// struct CAMFImporter_NodeElement_Vertex + +/// \struct CAMFImporter_NodeElement_Edge +/// Structure that define edge node. +struct CAMFImporter_NodeElement_Edge : public CAMFImporter_NodeElement +{ + /// \fn CAMFImporter_NodeElement_Edge(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Edge(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Edge, pParent) + {} + +};// struct CAMFImporter_NodeElement_Vertex + +/// \struct CAMFImporter_NodeElement_Vertices +/// Structure that define vertices node. +struct CAMFImporter_NodeElement_Vertices : public CAMFImporter_NodeElement +{ + /// \fn CAMFImporter_NodeElement_Vertices(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Vertices(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Vertices, pParent) + {} + +};// struct CAMFImporter_NodeElement_Vertices + +/// \struct CAMFImporter_NodeElement_Volume +/// Structure that define volume node. +struct CAMFImporter_NodeElement_Volume : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + std::string MaterialID;///< Which material to use. + std::string Type;///< What this volume describes can be “region” or “support”. If none specified, “object” is assumed. + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_Volume(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Volume(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Volume, pParent) + {} + +};// struct CAMFImporter_NodeElement_Volume + +/// \struct CAMFImporter_NodeElement_Coordinates +/// Structure that define coordinates node. +struct CAMFImporter_NodeElement_Coordinates : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + aiVector3D Coordinate;///< Coordinate. + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_Coordinates(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Coordinates(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Coordinates, pParent) + {} + +};// struct CAMFImporter_NodeElement_Coordinates + +/// \struct CAMFImporter_NodeElement_TexMap +/// Structure that define texture coordinates node. +struct CAMFImporter_NodeElement_TexMap : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + aiVector3D TextureCoordinate[3];///< Texture coordinates. + std::string TextureID_R;///< Texture ID for red color component. + std::string TextureID_G;///< Texture ID for green color component. + std::string TextureID_B;///< Texture ID for blue color component. + std::string TextureID_A;///< Texture ID for alpha color component. + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_TexMap(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_TexMap(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_TexMap, pParent) + {} + +};// struct CAMFImporter_NodeElement_TexMap + +/// \struct CAMFImporter_NodeElement_Triangle +/// Structure that define triangle node. +struct CAMFImporter_NodeElement_Triangle : public CAMFImporter_NodeElement +{ + /****************** Variables ******************/ + + size_t V[3];///< Triangle vertices. + + /****************** Functions ******************/ + + /// \fn CAMFImporter_NodeElement_Triangle(CAMFImporter_NodeElement* pParent) + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Triangle(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Triangle, pParent) + {} + +};// struct CAMFImporter_NodeElement_Triangle + +/// Structure that define texture node. +struct CAMFImporter_NodeElement_Texture : public CAMFImporter_NodeElement { + size_t Width, Height, Depth;///< Size of the texture. + std::vector Data;///< Data of the texture. + bool Tiled; + + /// Constructor. + /// \param [in] pParent - pointer to parent node. + CAMFImporter_NodeElement_Texture(CAMFImporter_NodeElement* pParent) + : CAMFImporter_NodeElement(ENET_Texture, pParent) + , Width( 0 ) + , Height( 0 ) + , Depth( 0 ) + , Data() + , Tiled( false ){ + // empty + } +};// struct CAMFImporter_NodeElement_Texture + +#endif // INCLUDED_AI_AMF_IMPORTER_NODE_H diff --git a/src/3rdparty/assimp/code/AMFImporter_Postprocess.cpp b/src/3rdparty/assimp/code/AMFImporter_Postprocess.cpp new file mode 100644 index 000000000..991eb97e7 --- /dev/null +++ b/src/3rdparty/assimp/code/AMFImporter_Postprocess.cpp @@ -0,0 +1,976 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2017, 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. +--------------------------------------------------------------------------- +*/ + +/// \file AMFImporter_Postprocess.cpp +/// \brief Convert built scenegraph and objects to Assimp scenegraph. +/// \date 2016 +/// \author smal.root@gmail.com + +#ifndef ASSIMP_BUILD_NO_AMF_IMPORTER + +#include "AMFImporter.hpp" + +// Header files, Assimp. +#include +#include "StandardShapes.h" +#include "StringUtils.h" + +// Header files, stdlib. +#include + +namespace Assimp +{ + +aiColor4D AMFImporter::SPP_Material::GetColor(const float /*pX*/, const float /*pY*/, const float /*pZ*/) const +{ + aiColor4D tcol; + + // Check if stored data are supported. + if(Composition.size() != 0) + { + throw DeadlyImportError("IME. GetColor for composition"); + } + else if(Color->Composed) + { + throw DeadlyImportError("IME. GetColor, composed color"); + } + else + { + tcol = Color->Color; + } + + // Check if default color must be used + if((tcol.r == 0) && (tcol.g == 0) && (tcol.b == 0) && (tcol.a == 0)) + { + tcol.r = 0.5f; + tcol.g = 0.5f; + tcol.b = 0.5f; + tcol.a = 1; + } + + return tcol; +} + +void AMFImporter::PostprocessHelper_CreateMeshDataArray(const CAMFImporter_NodeElement_Mesh& pNodeElement, std::vector& pVertexCoordinateArray, + std::vector& pVertexColorArray) const +{ + CAMFImporter_NodeElement_Vertices* vn = nullptr; + size_t col_idx; + + // All data stored in "vertices", search for it. + for(CAMFImporter_NodeElement* ne_child: pNodeElement.Child) + { + if(ne_child->Type == CAMFImporter_NodeElement::ENET_Vertices) vn = (CAMFImporter_NodeElement_Vertices*)ne_child; + } + + // If "vertices" not found then no work for us. + if(vn == nullptr) return; + + pVertexCoordinateArray.reserve(vn->Child.size());// all coordinates stored as child and we need to reserve space for future push_back's. + pVertexColorArray.resize(vn->Child.size());// colors count equal vertices count. + col_idx = 0; + // Inside vertices collect all data and place to arrays + for(CAMFImporter_NodeElement* vn_child: vn->Child) + { + // vertices, colors + if(vn_child->Type == CAMFImporter_NodeElement::ENET_Vertex) + { + // by default clear color for current vertex + pVertexColorArray[col_idx] = nullptr; + + for(CAMFImporter_NodeElement* vtx: vn_child->Child) + { + if(vtx->Type == CAMFImporter_NodeElement::ENET_Coordinates) + { + pVertexCoordinateArray.push_back(((CAMFImporter_NodeElement_Coordinates*)vtx)->Coordinate); + + continue; + } + + if(vtx->Type == CAMFImporter_NodeElement::ENET_Color) + { + pVertexColorArray[col_idx] = (CAMFImporter_NodeElement_Color*)vtx; + + continue; + } + }// for(CAMFImporter_NodeElement* vtx: vn_child->Child) + + col_idx++; + }// if(vn_child->Type == CAMFImporter_NodeElement::ENET_Vertex) + }// for(CAMFImporter_NodeElement* vn_child: vn->Child) +} + +size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string& pID_R, const std::string& pID_G, const std::string& pID_B, + const std::string& pID_A) +{ + size_t TextureConverted_Index; + std::string TextureConverted_ID; + + // check input data + if(pID_R.empty() && pID_G.empty() && pID_B.empty() && pID_A.empty()) + throw DeadlyImportError("PostprocessHelper_GetTextureID_Or_Create. At least one texture ID must be defined."); + + // Create ID + TextureConverted_ID = pID_R + "_" + pID_G + "_" + pID_B + "_" + pID_A; + // Check if texture specified by set of IDs is converted already. + TextureConverted_Index = 0; + for(const SPP_Texture& tex_convd: mTexture_Converted) + { + if(tex_convd.ID == TextureConverted_ID) + return TextureConverted_Index; + else + TextureConverted_Index++; + } + + // + // Converted texture not found, create it. + // + CAMFImporter_NodeElement_Texture* src_texture[4]{nullptr}; + std::vector src_texture_4check; + SPP_Texture converted_texture; + + {// find all specified source textures + CAMFImporter_NodeElement* t_tex; + + // R + if(!pID_R.empty()) + { + if(!Find_NodeElement(pID_R, CAMFImporter_NodeElement::ENET_Texture, &t_tex)) Throw_ID_NotFound(pID_R); + + src_texture[0] = (CAMFImporter_NodeElement_Texture*)t_tex; + src_texture_4check.push_back((CAMFImporter_NodeElement_Texture*)t_tex); + } + else + { + src_texture[0] = nullptr; + } + + // G + if(!pID_G.empty()) + { + if(!Find_NodeElement(pID_G, CAMFImporter_NodeElement::ENET_Texture, &t_tex)) Throw_ID_NotFound(pID_G); + + src_texture[1] = (CAMFImporter_NodeElement_Texture*)t_tex; + src_texture_4check.push_back((CAMFImporter_NodeElement_Texture*)t_tex); + } + else + { + src_texture[1] = nullptr; + } + + // B + if(!pID_B.empty()) + { + if(!Find_NodeElement(pID_B, CAMFImporter_NodeElement::ENET_Texture, &t_tex)) Throw_ID_NotFound(pID_B); + + src_texture[2] = (CAMFImporter_NodeElement_Texture*)t_tex; + src_texture_4check.push_back((CAMFImporter_NodeElement_Texture*)t_tex); + } + else + { + src_texture[2] = nullptr; + } + + // A + if(!pID_A.empty()) + { + if(!Find_NodeElement(pID_A, CAMFImporter_NodeElement::ENET_Texture, &t_tex)) Throw_ID_NotFound(pID_A); + + src_texture[3] = (CAMFImporter_NodeElement_Texture*)t_tex; + src_texture_4check.push_back((CAMFImporter_NodeElement_Texture*)t_tex); + } + else + { + src_texture[3] = nullptr; + } + }// END: find all specified source textures + + // check that all textures has same size + if(src_texture_4check.size() > 1) + { + for (size_t i = 0, i_e = (src_texture_4check.size() - 1); i < i_e; i++) + { + if((src_texture_4check[i]->Width != src_texture_4check[i + 1]->Width) || (src_texture_4check[i]->Height != src_texture_4check[i + 1]->Height) || + (src_texture_4check[i]->Depth != src_texture_4check[i + 1]->Depth)) + { + throw DeadlyImportError("PostprocessHelper_GetTextureID_Or_Create. Source texture must has the same size."); + } + } + }// if(src_texture_4check.size() > 1) + + // set texture attributes + converted_texture.Width = src_texture_4check[0]->Width; + converted_texture.Height = src_texture_4check[0]->Height; + converted_texture.Depth = src_texture_4check[0]->Depth; + // if one of source texture is tiled then converted texture is tiled too. + converted_texture.Tiled = false; + for(uint8_t i = 0; i < src_texture_4check.size(); i++) converted_texture.Tiled |= src_texture_4check[i]->Tiled; + + // Create format hint. + strcpy(converted_texture.FormatHint, "rgba0000");// copy initial string. + if(!pID_R.empty()) converted_texture.FormatHint[4] = '8'; + if(!pID_G.empty()) converted_texture.FormatHint[5] = '8'; + if(!pID_B.empty()) converted_texture.FormatHint[6] = '8'; + if(!pID_A.empty()) converted_texture.FormatHint[7] = '8'; + + // + // Сopy data of textures. + // + size_t tex_size = 0; + size_t step = 0; + size_t off_g = 0; + size_t off_b = 0; + + // Calculate size of the target array and rule how data will be copied. + if(!pID_R.empty() && nullptr != src_texture[ 0 ] ) { + tex_size += src_texture[0]->Data.size(); step++, off_g++, off_b++; + } + if(!pID_G.empty() && nullptr != src_texture[ 1 ] ) { + tex_size += src_texture[1]->Data.size(); step++, off_b++; + } + if(!pID_B.empty() && nullptr != src_texture[ 2 ] ) { + tex_size += src_texture[2]->Data.size(); step++; + } + if(!pID_A.empty() && nullptr != src_texture[ 3 ] ) { + tex_size += src_texture[3]->Data.size(); step++; + } + + // Create target array. + converted_texture.Data = new uint8_t[tex_size]; + // And copy data + auto CopyTextureData = [&](const std::string& pID, const size_t pOffset, const size_t pStep, const uint8_t pSrcTexNum) -> void + { + if(!pID.empty()) + { + for(size_t idx_target = pOffset, idx_src = 0; idx_target < tex_size; idx_target += pStep, idx_src++) { + CAMFImporter_NodeElement_Texture* tex = src_texture[pSrcTexNum]; + ai_assert(tex); + converted_texture.Data[idx_target] = tex->Data.at(idx_src); + } + } + };// auto CopyTextureData = [&](const size_t pOffset, const size_t pStep, const uint8_t pSrcTexNum) -> void + + CopyTextureData(pID_R, 0, step, 0); + CopyTextureData(pID_G, off_g, step, 1); + CopyTextureData(pID_B, off_b, step, 2); + CopyTextureData(pID_A, step - 1, step, 3); + + // Store new converted texture ID + converted_texture.ID = TextureConverted_ID; + // Store new converted texture + mTexture_Converted.push_back(converted_texture); + + return TextureConverted_Index; +} + +void AMFImporter::PostprocessHelper_SplitFacesByTextureID(std::list& pInputList, std::list >& pOutputList_Separated) +{ + auto texmap_is_equal = [](const CAMFImporter_NodeElement_TexMap* pTexMap1, const CAMFImporter_NodeElement_TexMap* pTexMap2) -> bool + { + if((pTexMap1 == nullptr) && (pTexMap2 == nullptr)) return true; + if(pTexMap1 == nullptr) return false; + if(pTexMap2 == nullptr) return false; + + if(pTexMap1->TextureID_R != pTexMap2->TextureID_R) return false; + if(pTexMap1->TextureID_G != pTexMap2->TextureID_G) return false; + if(pTexMap1->TextureID_B != pTexMap2->TextureID_B) return false; + if(pTexMap1->TextureID_A != pTexMap2->TextureID_A) return false; + + return true; + }; + + pOutputList_Separated.clear(); + if(pInputList.size() == 0) return; + + do + { + SComplexFace face_start = pInputList.front(); + std::list face_list_cur; + + for(std::list::iterator it = pInputList.begin(), it_end = pInputList.end(); it != it_end;) + { + if(texmap_is_equal(face_start.TexMap, it->TexMap)) + { + auto it_old = it; + + it++; + face_list_cur.push_back(*it_old); + pInputList.erase(it_old); + } + else + { + it++; + } + } + + if(face_list_cur.size() > 0) pOutputList_Separated.push_back(face_list_cur); + + } while(pInputList.size() > 0); +} + +void AMFImporter::Postprocess_AddMetadata(const std::list& metadataList, aiNode& sceneNode) const +{ + if ( !metadataList.empty() ) + { + if(sceneNode.mMetaData != nullptr) throw DeadlyImportError("Postprocess. MetaData member in node are not nullptr. Something went wrong."); + + // copy collected metadata to output node. + sceneNode.mMetaData = aiMetadata::Alloc( static_cast(metadataList.size()) ); + size_t meta_idx( 0 ); + + for(const CAMFImporter_NodeElement_Metadata& metadata: metadataList) + { + sceneNode.mMetaData->Set(static_cast(meta_idx++), metadata.Type, aiString(metadata.Value)); + } + }// if(!metadataList.empty()) +} + +void AMFImporter::Postprocess_BuildNodeAndObject(const CAMFImporter_NodeElement_Object& pNodeElement, std::list& pMeshList, aiNode** pSceneNode) +{ +CAMFImporter_NodeElement_Color* object_color = nullptr; + + // create new aiNode and set name as has. + *pSceneNode = new aiNode; + (*pSceneNode)->mName = pNodeElement.ID; + // read mesh and color + for(const CAMFImporter_NodeElement* ne_child: pNodeElement.Child) + { + std::vector vertex_arr; + std::vector color_arr; + + // color for object + if(ne_child->Type == CAMFImporter_NodeElement::ENET_Color) object_color = (CAMFImporter_NodeElement_Color*)ne_child; + + if(ne_child->Type == CAMFImporter_NodeElement::ENET_Mesh) + { + // Create arrays from children of mesh: vertices. + PostprocessHelper_CreateMeshDataArray(*((CAMFImporter_NodeElement_Mesh*)ne_child), vertex_arr, color_arr); + // Use this arrays as a source when creating every aiMesh + Postprocess_BuildMeshSet(*((CAMFImporter_NodeElement_Mesh*)ne_child), vertex_arr, color_arr, object_color, pMeshList, **pSceneNode); + } + }// for(const CAMFImporter_NodeElement* ne_child: pNodeElement) +} + +void AMFImporter::Postprocess_BuildMeshSet(const CAMFImporter_NodeElement_Mesh& pNodeElement, const std::vector& pVertexCoordinateArray, + const std::vector& pVertexColorArray, + const CAMFImporter_NodeElement_Color* pObjectColor, std::list& pMeshList, aiNode& pSceneNode) +{ +std::list mesh_idx; + + // all data stored in "volume", search for it. + for(const CAMFImporter_NodeElement* ne_child: pNodeElement.Child) + { + const CAMFImporter_NodeElement_Color* ne_volume_color = nullptr; + const SPP_Material* cur_mat = nullptr; + + if(ne_child->Type == CAMFImporter_NodeElement::ENET_Volume) + { + /******************* Get faces *******************/ + const CAMFImporter_NodeElement_Volume* ne_volume = reinterpret_cast(ne_child); + + std::list complex_faces_list;// List of the faces of the volume. + std::list > complex_faces_toplist;// List of the face list for every mesh. + + // check if volume use material + if(!ne_volume->MaterialID.empty()) + { + if(!Find_ConvertedMaterial(ne_volume->MaterialID, &cur_mat)) Throw_ID_NotFound(ne_volume->MaterialID); + } + + // inside "volume" collect all data and place to arrays or create new objects + for(const CAMFImporter_NodeElement* ne_volume_child: ne_volume->Child) + { + // color for volume + if(ne_volume_child->Type == CAMFImporter_NodeElement::ENET_Color) + { + ne_volume_color = reinterpret_cast(ne_volume_child); + } + else if(ne_volume_child->Type == CAMFImporter_NodeElement::ENET_Triangle)// triangles, triangles colors + { + const CAMFImporter_NodeElement_Triangle& tri_al = *reinterpret_cast(ne_volume_child); + + SComplexFace complex_face; + + // initialize pointers + complex_face.Color = nullptr; + complex_face.TexMap = nullptr; + // get data from triangle children: color, texture coordinates. + if(tri_al.Child.size()) + { + for(const CAMFImporter_NodeElement* ne_triangle_child: tri_al.Child) + { + if(ne_triangle_child->Type == CAMFImporter_NodeElement::ENET_Color) + complex_face.Color = reinterpret_cast(ne_triangle_child); + else if(ne_triangle_child->Type == CAMFImporter_NodeElement::ENET_TexMap) + complex_face.TexMap = reinterpret_cast(ne_triangle_child); + } + }// if(tri_al.Child.size()) + + // create new face and store it. + complex_face.Face.mNumIndices = 3; + complex_face.Face.mIndices = new unsigned int[3]; + complex_face.Face.mIndices[0] = static_cast(tri_al.V[0]); + complex_face.Face.mIndices[1] = static_cast(tri_al.V[1]); + complex_face.Face.mIndices[2] = static_cast(tri_al.V[2]); + complex_faces_list.push_back(complex_face); + } + }// for(const CAMFImporter_NodeElement* ne_volume_child: ne_volume->Child) + + /**** Split faces list: one list per mesh ****/ + PostprocessHelper_SplitFacesByTextureID(complex_faces_list, complex_faces_toplist); + + /***** Create mesh for every faces list ******/ + for(std::list& face_list_cur: complex_faces_toplist) + { + auto VertexIndex_GetMinimal = [](const std::list& pFaceList, const size_t* pBiggerThan) -> size_t + { + size_t rv; + + if(pBiggerThan != nullptr) + { + bool found = false; + + for(const SComplexFace& face: pFaceList) + { + for(size_t idx_vert = 0; idx_vert < face.Face.mNumIndices; idx_vert++) + { + if(face.Face.mIndices[idx_vert] > *pBiggerThan) + { + rv = face.Face.mIndices[idx_vert]; + found = true; + + break; + } + } + + if(found) break; + } + + if(!found) return *pBiggerThan; + } + else + { + rv = pFaceList.front().Face.mIndices[0]; + }// if(pBiggerThan != nullptr) else + + for(const SComplexFace& face: pFaceList) + { + for(size_t vi = 0; vi < face.Face.mNumIndices; vi++) + { + if(face.Face.mIndices[vi] < rv) + { + if(pBiggerThan != nullptr) + { + if(face.Face.mIndices[vi] > *pBiggerThan) rv = face.Face.mIndices[vi]; + } + else + { + rv = face.Face.mIndices[vi]; + } + } + } + }// for(const SComplexFace& face: pFaceList) + + return rv; + };// auto VertexIndex_GetMinimal = [](const std::list& pFaceList, const size_t* pBiggerThan) -> size_t + + auto VertexIndex_Replace = [](std::list& pFaceList, const size_t pIdx_From, const size_t pIdx_To) -> void + { + for(const SComplexFace& face: pFaceList) + { + for(size_t vi = 0; vi < face.Face.mNumIndices; vi++) + { + if(face.Face.mIndices[vi] == pIdx_From) face.Face.mIndices[vi] = static_cast(pIdx_To); + } + } + };// auto VertexIndex_Replace = [](std::list& pFaceList, const size_t pIdx_From, const size_t pIdx_To) -> void + + auto Vertex_CalculateColor = [&](const size_t pIdx) -> aiColor4D + { + // Color priorities(In descending order): + // 1. triangle color; + // 2. vertex color; + // 3. volume color; + // 4. object color; + // 5. material; + // 6. default - invisible coat. + // + // Fill vertices colors in color priority list above that's points from 1 to 6. + if((pIdx < pVertexColorArray.size()) && (pVertexColorArray[pIdx] != nullptr))// check for vertex color + { + if(pVertexColorArray[pIdx]->Composed) + throw DeadlyImportError("IME: vertex color composed"); + else + return pVertexColorArray[pIdx]->Color; + } + else if(ne_volume_color != nullptr)// check for volume color + { + if(ne_volume_color->Composed) + throw DeadlyImportError("IME: volume color composed"); + else + return ne_volume_color->Color; + } + else if(pObjectColor != nullptr)// check for object color + { + if(pObjectColor->Composed) + throw DeadlyImportError("IME: object color composed"); + else + return pObjectColor->Color; + } + else if(cur_mat != nullptr)// check for material + { + return cur_mat->GetColor(pVertexCoordinateArray.at(pIdx).x, pVertexCoordinateArray.at(pIdx).y, pVertexCoordinateArray.at(pIdx).z); + } + else// set default color. + { + return {0, 0, 0, 0}; + }// if((vi < pVertexColorArray.size()) && (pVertexColorArray[vi] != nullptr)) else + + };// auto Vertex_CalculateColor = [&](const size_t pIdx) -> aiColor4D + + aiMesh* tmesh = new aiMesh; + + tmesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;// Only triangles is supported by AMF. + // + // set geometry and colors (vertices) + // + // copy faces/triangles + tmesh->mNumFaces = static_cast(face_list_cur.size()); + tmesh->mFaces = new aiFace[tmesh->mNumFaces]; + + // Create vertices list and optimize indices. Optimisation mean following.In AMF all volumes use one big list of vertices. And one volume + // can use only part of vertices list, for example: vertices list contain few thousands of vertices and volume use vertices 1, 3, 10. + // Do you need all this thousands of garbage? Of course no. So, optimisation step transformate sparse indices set to continuous. + size_t VertexCount_Max = tmesh->mNumFaces * 3;// 3 - triangles. + std::vector vert_arr, texcoord_arr; + std::vector col_arr; + + vert_arr.reserve(VertexCount_Max * 2);// "* 2" - see below TODO. + col_arr.reserve(VertexCount_Max * 2); + + {// fill arrays + size_t vert_idx_from, vert_idx_to; + + // first iteration. + vert_idx_to = 0; + vert_idx_from = VertexIndex_GetMinimal(face_list_cur, nullptr); + vert_arr.push_back(pVertexCoordinateArray.at(vert_idx_from)); + col_arr.push_back(Vertex_CalculateColor(vert_idx_from)); + if(vert_idx_from != vert_idx_to) VertexIndex_Replace(face_list_cur, vert_idx_from, vert_idx_to); + + // rest iterations + do + { + vert_idx_from = VertexIndex_GetMinimal(face_list_cur, &vert_idx_to); + if(vert_idx_from == vert_idx_to) break;// all indices are transferred, + + vert_arr.push_back(pVertexCoordinateArray.at(vert_idx_from)); + col_arr.push_back(Vertex_CalculateColor(vert_idx_from)); + vert_idx_to++; + if(vert_idx_from != vert_idx_to) VertexIndex_Replace(face_list_cur, vert_idx_from, vert_idx_to); + + } while(true); + }// fill arrays. END. + + // + // check if triangle colors are used and create additional faces if needed. + // + for(const SComplexFace& face_cur: face_list_cur) + { + if(face_cur.Color != nullptr) + { + aiColor4D face_color; + size_t vert_idx_new = vert_arr.size(); + + if(face_cur.Color->Composed) + throw DeadlyImportError("IME: face color composed"); + else + face_color = face_cur.Color->Color; + + for(size_t idx_ind = 0; idx_ind < face_cur.Face.mNumIndices; idx_ind++) + { + vert_arr.push_back(vert_arr.at(face_cur.Face.mIndices[idx_ind])); + col_arr.push_back(face_color); + face_cur.Face.mIndices[idx_ind] = static_cast(vert_idx_new++); + } + }// if(face_cur.Color != nullptr) + }// for(const SComplexFace& face_cur: face_list_cur) + + // + // if texture is used then copy texture coordinates too. + // + if(face_list_cur.front().TexMap != nullptr) + { + size_t idx_vert_new = vert_arr.size(); + ///TODO: clean unused vertices. "* 2": in certain cases - mesh full of triangle colors - vert_arr will contain duplicated vertices for + /// colored triangles and initial vertices (for colored vertices) which in real became unused. This part need more thinking about + /// optimisation. + bool* idx_vert_used; + + idx_vert_used = new bool[VertexCount_Max * 2]; + for(size_t i = 0, i_e = VertexCount_Max * 2; i < i_e; i++) idx_vert_used[i] = false; + + // This ID's will be used when set materials ID in scene. + tmesh->mMaterialIndex = static_cast(PostprocessHelper_GetTextureID_Or_Create(face_list_cur.front().TexMap->TextureID_R, + face_list_cur.front().TexMap->TextureID_G, + face_list_cur.front().TexMap->TextureID_B, + face_list_cur.front().TexMap->TextureID_A)); + texcoord_arr.resize(VertexCount_Max * 2); + for(const SComplexFace& face_cur: face_list_cur) + { + for(size_t idx_ind = 0; idx_ind < face_cur.Face.mNumIndices; idx_ind++) + { + const size_t idx_vert = face_cur.Face.mIndices[idx_ind]; + + if(!idx_vert_used[idx_vert]) + { + texcoord_arr.at(idx_vert) = face_cur.TexMap->TextureCoordinate[idx_ind]; + idx_vert_used[idx_vert] = true; + } + else if(texcoord_arr.at(idx_vert) != face_cur.TexMap->TextureCoordinate[idx_ind]) + { + // in that case one vertex is shared with many texture coordinates. We need to duplicate vertex with another texture + // coordinates. + vert_arr.push_back(vert_arr.at(idx_vert)); + col_arr.push_back(col_arr.at(idx_vert)); + texcoord_arr.at(idx_vert_new) = face_cur.TexMap->TextureCoordinate[idx_ind]; + face_cur.Face.mIndices[idx_ind] = static_cast(idx_vert_new++); + } + }// for(size_t idx_ind = 0; idx_ind < face_cur.Face.mNumIndices; idx_ind++) + }// for(const SComplexFace& face_cur: face_list_cur) + + delete [] idx_vert_used; + // shrink array + texcoord_arr.resize(idx_vert_new); + }// if(face_list_cur.front().TexMap != nullptr) + + // + // copy collected data to mesh + // + tmesh->mNumVertices = static_cast(vert_arr.size()); + tmesh->mVertices = new aiVector3D[tmesh->mNumVertices]; + tmesh->mColors[0] = new aiColor4D[tmesh->mNumVertices]; + + memcpy(tmesh->mVertices, vert_arr.data(), tmesh->mNumVertices * sizeof(aiVector3D)); + memcpy(tmesh->mColors[0], col_arr.data(), tmesh->mNumVertices * sizeof(aiColor4D)); + if(texcoord_arr.size() > 0) + { + tmesh->mTextureCoords[0] = new aiVector3D[tmesh->mNumVertices]; + memcpy(tmesh->mTextureCoords[0], texcoord_arr.data(), tmesh->mNumVertices * sizeof(aiVector3D)); + tmesh->mNumUVComponents[0] = 2;// U and V stored in "x", "y" of aiVector3D. + } + + size_t idx_face = 0; + for(const SComplexFace& face_cur: face_list_cur) tmesh->mFaces[idx_face++] = face_cur.Face; + + // store new aiMesh + mesh_idx.push_back(static_cast(pMeshList.size())); + pMeshList.push_back(tmesh); + }// for(const std::list& face_list_cur: complex_faces_toplist) + }// if(ne_child->Type == CAMFImporter_NodeElement::ENET_Volume) + }// for(const CAMFImporter_NodeElement* ne_child: pNodeElement.Child) + + // if meshes was created then assign new indices with current aiNode + if(mesh_idx.size() > 0) + { + std::list::const_iterator mit = mesh_idx.begin(); + + pSceneNode.mNumMeshes = static_cast(mesh_idx.size()); + pSceneNode.mMeshes = new unsigned int[pSceneNode.mNumMeshes]; + for(size_t i = 0; i < pSceneNode.mNumMeshes; i++) pSceneNode.mMeshes[i] = *mit++; + }// if(mesh_idx.size() > 0) +} + +void AMFImporter::Postprocess_BuildMaterial(const CAMFImporter_NodeElement_Material& pMaterial) +{ +SPP_Material new_mat; + + new_mat.ID = pMaterial.ID; + for(const CAMFImporter_NodeElement* mat_child: pMaterial.Child) + { + if(mat_child->Type == CAMFImporter_NodeElement::ENET_Color) + { + new_mat.Color = (CAMFImporter_NodeElement_Color*)mat_child; + } + else if(mat_child->Type == CAMFImporter_NodeElement::ENET_Metadata) + { + new_mat.Metadata.push_back((CAMFImporter_NodeElement_Metadata*)mat_child); + } + }// for(const CAMFImporter_NodeElement* mat_child; pMaterial.Child) + + // place converted material to special list + mMaterial_Converted.push_back(new_mat); +} + +void AMFImporter::Postprocess_BuildConstellation(CAMFImporter_NodeElement_Constellation& pConstellation, std::list& pNodeList) const +{ +aiNode* con_node; +std::list ch_node; + + // We will build next hierarchy: + // aiNode as parent () for set of nodes as a children + // |- aiNode for transformation ( -> , ) - aiNode for pointing to object ("objectid") + // ... + // \_ aiNode for transformation ( -> , ) - aiNode for pointing to object ("objectid") + con_node = new aiNode; + con_node->mName = pConstellation.ID; + // Walk through children and search for instances of another objects, constellations. + for(const CAMFImporter_NodeElement* ne: pConstellation.Child) + { + aiMatrix4x4 tmat; + aiNode* t_node; + aiNode* found_node; + + if(ne->Type == CAMFImporter_NodeElement::ENET_Metadata) continue; + if(ne->Type != CAMFImporter_NodeElement::ENET_Instance) throw DeadlyImportError("Only nodes can be in ."); + + // create alias for conveniance + CAMFImporter_NodeElement_Instance& als = *((CAMFImporter_NodeElement_Instance*)ne); + // find referenced object + if(!Find_ConvertedNode(als.ObjectID, pNodeList, &found_node)) Throw_ID_NotFound(als.ObjectID); + + // create node for apllying transformation + t_node = new aiNode; + t_node->mParent = con_node; + // apply transformation + aiMatrix4x4::Translation(als.Delta, tmat), t_node->mTransformation *= tmat; + aiMatrix4x4::RotationX(als.Rotation.x, tmat), t_node->mTransformation *= tmat; + aiMatrix4x4::RotationY(als.Rotation.y, tmat), t_node->mTransformation *= tmat; + aiMatrix4x4::RotationZ(als.Rotation.z, tmat), t_node->mTransformation *= tmat; + // create array for one child node + t_node->mNumChildren = 1; + t_node->mChildren = new aiNode*[t_node->mNumChildren]; + SceneCombiner::Copy(&t_node->mChildren[0], found_node); + t_node->mChildren[0]->mParent = t_node; + ch_node.push_back(t_node); + }// for(const CAMFImporter_NodeElement* ne: pConstellation.Child) + + // copy found aiNode's as children + if(ch_node.size() == 0) throw DeadlyImportError(" must have at least one ."); + + size_t ch_idx = 0; + + con_node->mNumChildren = static_cast(ch_node.size()); + con_node->mChildren = new aiNode*[con_node->mNumChildren]; + for(aiNode* node: ch_node) con_node->mChildren[ch_idx++] = node; + + // and place "root" of node to node list + pNodeList.push_back(con_node); +} + +void AMFImporter::Postprocess_BuildScene(aiScene* pScene) +{ +std::list node_list; +std::list mesh_list; +std::list meta_list; + + // + // Because for AMF "material" is just complex colors mixing so aiMaterial will not be used. + // For building aiScene we are must to do few steps: + // at first creating root node for aiScene. + pScene->mRootNode = new aiNode; + pScene->mRootNode->mParent = nullptr; + pScene->mFlags |= AI_SCENE_FLAGS_ALLOW_SHARED; + // search for root() element + CAMFImporter_NodeElement* root_el = nullptr; + + for(CAMFImporter_NodeElement* ne: mNodeElement_List) + { + if(ne->Type != CAMFImporter_NodeElement::ENET_Root) continue; + + root_el = ne; + + break; + }// for(const CAMFImporter_NodeElement* ne: mNodeElement_List) + + // Check if root element are found. + if(root_el == nullptr) throw DeadlyImportError("Root() element not found."); + + // after that walk through children of root and collect data. Five types of nodes can be placed at top level - in : , , , + // and . But at first we must read and because they will be used in . can be read + // at any moment. + // + // 1. + // 2. will be converted later when processing triangles list. \sa Postprocess_BuildMeshSet + for(const CAMFImporter_NodeElement* root_child: root_el->Child) + { + if(root_child->Type == CAMFImporter_NodeElement::ENET_Material) Postprocess_BuildMaterial(*((CAMFImporter_NodeElement_Material*)root_child)); + } + + // After "appearance" nodes we must read because it will be used in -> . + // + // 3. + for(const CAMFImporter_NodeElement* root_child: root_el->Child) + { + if(root_child->Type == CAMFImporter_NodeElement::ENET_Object) + { + aiNode* tnode = nullptr; + + // for mesh and node must be built: object ID assigned to aiNode name and will be used in future for + Postprocess_BuildNodeAndObject(*((CAMFImporter_NodeElement_Object*)root_child), mesh_list, &tnode); + if(tnode != nullptr) node_list.push_back(tnode); + + } + }// for(const CAMFImporter_NodeElement* root_child: root_el->Child) + + // And finally read rest of nodes. + // + for(const CAMFImporter_NodeElement* root_child: root_el->Child) + { + // 4. + if(root_child->Type == CAMFImporter_NodeElement::ENET_Constellation) + { + // and at top of self abstraction use aiNode. So we can use only aiNode list for creating new aiNode's. + Postprocess_BuildConstellation(*((CAMFImporter_NodeElement_Constellation*)root_child), node_list); + } + + // 5, + if(root_child->Type == CAMFImporter_NodeElement::ENET_Metadata) meta_list.push_back((CAMFImporter_NodeElement_Metadata*)root_child); + }// for(const CAMFImporter_NodeElement* root_child: root_el->Child) + + // at now we can add collected metadata to root node + Postprocess_AddMetadata(meta_list, *pScene->mRootNode); + // + // Check constellation children + // + // As said in specification: + // "When multiple objects and constellations are defined in a single file, only the top level objects and constellations are available for printing." + // What that means? For example: if some object is used in constellation then you must show only constellation but not original object. + // And at this step we are checking that relations. +nl_clean_loop: + + if(node_list.size() > 1) + { + // walk through all nodes + for(std::list::iterator nl_it = node_list.begin(); nl_it != node_list.end(); nl_it++) + { + // and try to find them in another top nodes. + std::list::const_iterator next_it = nl_it; + + next_it++; + for(; next_it != node_list.end(); next_it++) + { + if((*next_it)->FindNode((*nl_it)->mName) != nullptr) + { + // if current top node(nl_it) found in another top node then erase it from node_list and restart search loop. + node_list.erase(nl_it); + + goto nl_clean_loop; + } + }// for(; next_it != node_list.end(); next_it++) + }// for(std::list::const_iterator nl_it = node_list.begin(); nl_it != node_list.end(); nl_it++) + } + + // + // move created objects to aiScene + // + // + // Nodes + if(node_list.size() > 0) + { + std::list::const_iterator nl_it = node_list.begin(); + + pScene->mRootNode->mNumChildren = static_cast(node_list.size()); + pScene->mRootNode->mChildren = new aiNode*[pScene->mRootNode->mNumChildren]; + for(size_t i = 0; i < pScene->mRootNode->mNumChildren; i++) + { + // Objects and constellation that must be showed placed at top of hierarchy in node. So all aiNode's in node_list must have + // mRootNode only as parent. + (*nl_it)->mParent = pScene->mRootNode; + pScene->mRootNode->mChildren[i] = *nl_it++; + } + }// if(node_list.size() > 0) + + // + // Meshes + if(mesh_list.size() > 0) + { + std::list::const_iterator ml_it = mesh_list.begin(); + + pScene->mNumMeshes = static_cast(mesh_list.size()); + pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]; + for(size_t i = 0; i < pScene->mNumMeshes; i++) pScene->mMeshes[i] = *ml_it++; + }// if(mesh_list.size() > 0) + + // + // Textures + pScene->mNumTextures = static_cast(mTexture_Converted.size()); + if(pScene->mNumTextures > 0) + { + size_t idx; + + idx = 0; + pScene->mTextures = new aiTexture*[pScene->mNumTextures]; + for(const SPP_Texture& tex_convd: mTexture_Converted) + { + pScene->mTextures[idx] = new aiTexture; + pScene->mTextures[idx]->mWidth = static_cast(tex_convd.Width); + pScene->mTextures[idx]->mHeight = static_cast(tex_convd.Height); + pScene->mTextures[idx]->pcData = (aiTexel*)tex_convd.Data; + // texture format description. + strcpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint); + idx++; + }// for(const SPP_Texture& tex_convd: mTexture_Converted) + + // Create materials for embedded textures. + idx = 0; + pScene->mNumMaterials = static_cast(mTexture_Converted.size()); + pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials]; + for(const SPP_Texture& tex_convd: mTexture_Converted) + { + const aiString texture_id(AI_EMBEDDED_TEXNAME_PREFIX + to_string(idx)); + const int mode = aiTextureOp_Multiply; + const int repeat = tex_convd.Tiled ? 1 : 0; + + pScene->mMaterials[idx] = new aiMaterial; + pScene->mMaterials[idx]->AddProperty(&texture_id, AI_MATKEY_TEXTURE_DIFFUSE(0)); + pScene->mMaterials[idx]->AddProperty(&mode, 1, AI_MATKEY_TEXOP_DIFFUSE(0)); + pScene->mMaterials[idx]->AddProperty(&repeat, 1, AI_MATKEY_MAPPINGMODE_U_DIFFUSE(0)); + pScene->mMaterials[idx]->AddProperty(&repeat, 1, AI_MATKEY_MAPPINGMODE_V_DIFFUSE(0)); + idx++; + } + }// if(pScene->mNumTextures > 0) +}// END: after that walk through children of root and collect data + +}// namespace Assimp + +#endif // !ASSIMP_BUILD_NO_AMF_IMPORTER diff --git a/src/3rdparty/assimp/code/ASELoader.cpp b/src/3rdparty/assimp/code/ASELoader.cpp index 39a33e9fd..65935f48f 100644 --- a/src/3rdparty/assimp/code/ASELoader.cpp +++ b/src/3rdparty/assimp/code/ASELoader.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -45,6 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER + // internal headers #include "ASELoader.h" #include "StringComparison.h" @@ -54,6 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include @@ -819,10 +823,10 @@ void CopyASETexture(aiMaterial& mat, ASE::Texture& texture, aiTextureType type) // Setup the texture blend factor if (is_not_qnan(texture.mTextureBlend)) - mat.AddProperty( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0)); + mat.AddProperty( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0)); // Setup texture UV transformations - mat.AddProperty(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0)); + mat.AddProperty(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0)); } // ------------------------------------------------------------------------------------------------ @@ -865,7 +869,7 @@ void ASEImporter::ConvertMaterial(ASE::Material& mat) } // opacity - mat.pcInstance->AddProperty( &mat.mTransparency,1,AI_MATKEY_OPACITY); + mat.pcInstance->AddProperty( &mat.mTransparency,1,AI_MATKEY_OPACITY); // Two sided rendering? if (mat.mTwoSided) @@ -1017,6 +1021,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector& avOutMesh // convert bones, if existing if (!mesh.mBones.empty()) { + ai_assert(avOutputBones); // check whether there is a vertex weight for this vertex index if (iIndex2 < mesh.mBoneVertices.size()) { @@ -1318,4 +1323,6 @@ bool ASEImporter::GenerateNormals(ASE::Mesh& mesh) { return false; } +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + #endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER diff --git a/src/3rdparty/assimp/code/ASELoader.h b/src/3rdparty/assimp/code/ASELoader.h index b775fc6bb..8a8d4faa4 100644 --- a/src/3rdparty/assimp/code/ASELoader.h +++ b/src/3rdparty/assimp/code/ASELoader.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -46,12 +47,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseImporter.h" #include +#include "ASEParser.h" struct aiNode; -#include "ASEParser.h" namespace Assimp { +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER // -------------------------------------------------------------------------------- /** Importer class for the 3DS ASE ASCII format. @@ -62,9 +64,6 @@ public: ASEImporter(); ~ASEImporter(); - -public: - // ------------------------------------------------------------------- /** Returns whether the class can handle the format of the given file. * See BaseImporter::CanRead() for details. @@ -200,6 +199,9 @@ protected: bool noSkeletonMesh; }; +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + } // end of namespace Assimp + #endif // AI_3DSIMPORTER_H_INC diff --git a/src/3rdparty/assimp/code/ASEParser.cpp b/src/3rdparty/assimp/code/ASEParser.cpp index 204f8bf62..7de80a2d8 100644 --- a/src/3rdparty/assimp/code/ASEParser.cpp +++ b/src/3rdparty/assimp/code/ASEParser.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -25,8 +26,8 @@ conditions are met: 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 + 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, @@ -45,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER // internal headers #include "TextureTransform.h" #include "ASELoader.h" -#include "MaterialSystem.h" #include "fast_atof.h" #include @@ -431,7 +432,7 @@ void Parser::ParseLV1SoftSkinBlock() ParseString(bone,"*MESH_SOFTSKINVERTS.Bone"); // Find the bone in the mesh's list - std::pair me; + std::pair me; me.first = -1; for (unsigned int n = 0; n < curMesh->mBones.size();++n) @@ -618,12 +619,13 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat) if (TokenMatch(filePtr,"MATERIAL_TRANSPARENCY",21)) { ParseLV4MeshFloat(mat.mTransparency); - mat.mTransparency = 1.0f - mat.mTransparency;continue; + mat.mTransparency = ai_real( 1.0 ) - mat.mTransparency; + continue; } // material self illumination if (TokenMatch(filePtr,"MATERIAL_SELFILLUM",18)) { - float f = 0.0f; + ai_real f = 0.0; ParseLV4MeshFloat(f); mat.mEmissive.r = f; @@ -1134,7 +1136,7 @@ void Parser::ParseLV3ScaleAnimationBlock(ASE::Animation& anim) bool b = false; // For the moment we're just reading the three floats - - // we ignore the �dditional information for bezier's and TCBs + // we ignore the additional information for bezier's and TCBs // simple scaling keyframe if (TokenMatch(filePtr,"CONTROL_SCALE_SAMPLE" ,20)) @@ -1180,7 +1182,7 @@ void Parser::ParseLV3PosAnimationBlock(ASE::Animation& anim) bool b = false; // For the moment we're just reading the three floats - - // we ignore the �dditional information for bezier's and TCBs + // we ignore the additional information for bezier's and TCBs // simple scaling keyframe if (TokenMatch(filePtr,"CONTROL_POS_SAMPLE" ,18)) @@ -1226,7 +1228,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim) bool b = false; // For the moment we're just reading the floats - - // we ignore the �dditional information for bezier's and TCBs + // we ignore the additional information for bezier's and TCBs // simple scaling keyframe if (TokenMatch(filePtr,"CONTROL_ROT_SAMPLE" ,18)) @@ -1251,7 +1253,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim) { anim.akeyRotations.push_back(aiQuatKey()); aiQuatKey& key = anim.akeyRotations.back(); - aiVector3D v;float f; + aiVector3D v;ai_real f; ParseLV4MeshFloatTriple(&v.x,iIndex); ParseLV4MeshFloat(f); key.mTime = (double)iIndex; @@ -1463,30 +1465,29 @@ void Parser::ParseLV2MeshBlock(ASE::Mesh& mesh) continue; } // another mesh UV channel ... - if (TokenMatch(filePtr,"MESH_MAPPINGCHANNEL" ,19)) - { - - unsigned int iIndex = 0; + if (TokenMatch(filePtr,"MESH_MAPPINGCHANNEL" ,19)) { + unsigned int iIndex( 0 ); ParseLV4MeshLong(iIndex); - - if (iIndex < 2) - { - LogWarning("Mapping channel has an invalid index. Skipping UV channel"); + if ( 0 == iIndex ) { + LogWarning( "Mapping channel has an invalid index. Skipping UV channel" ); // skip it ... SkipSection(); + } else { + if ( iIndex < 2 ) { + LogWarning( "Mapping channel has an invalid index. Skipping UV channel" ); + // skip it ... + SkipSection(); + } + if ( iIndex > AI_MAX_NUMBER_OF_TEXTURECOORDS ) { + LogWarning( "Too many UV channels specified. Skipping channel .." ); + // skip it ... + SkipSection(); + } else { + // parse the mapping channel + ParseLV3MappingChannel( iIndex - 1, mesh ); + } + continue; } - if (iIndex > AI_MAX_NUMBER_OF_TEXTURECOORDS) - { - LogWarning("Too many UV channels specified. Skipping channel .."); - // skip it ... - SkipSection(); - } - else - { - // parse the mapping channel - ParseLV3MappingChannel(iIndex-1,mesh); - } - continue; } // mesh animation keyframe. Not supported if (TokenMatch(filePtr,"MESH_ANIMATION" ,14)) @@ -1604,7 +1605,7 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices,ASE::Mesh& mesh } // --- ignored - float afVert[3]; + ai_real afVert[3]; ParseLV4MeshFloatTriple(afVert); std::pair pairOut; @@ -1858,7 +1859,7 @@ void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh& mesh) ++filePtr; // Face entry - if (TokenMatch(filePtr,"MESH_CFACE" ,11)) + if (TokenMatch(filePtr,"MESH_CFACE" ,10)) { unsigned int aiValues[3]; unsigned int iIndex = 0; @@ -2102,7 +2103,7 @@ void Parser::ParseLV4MeshLongTriple(unsigned int* apOut, unsigned int& rIndexOut ParseLV4MeshLongTriple(apOut); } // ------------------------------------------------------------------------------------------------ -void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut) +void Parser::ParseLV4MeshFloatTriple(ai_real* apOut, unsigned int& rIndexOut) { ai_assert(NULL != apOut); @@ -2113,7 +2114,7 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut) ParseLV4MeshFloatTriple(apOut); } // ------------------------------------------------------------------------------------------------ -void Parser::ParseLV4MeshFloatTriple(float* apOut) +void Parser::ParseLV4MeshFloatTriple(ai_real* apOut) { ai_assert(NULL != apOut); @@ -2121,19 +2122,19 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut) ParseLV4MeshFloat(apOut[i]); } // ------------------------------------------------------------------------------------------------ -void Parser::ParseLV4MeshFloat(float& fOut) +void Parser::ParseLV4MeshFloat(ai_real& fOut) { // skip spaces and tabs if(!SkipSpaces(&filePtr)) { // LOG LogWarning("Unable to parse float: unexpected EOL [#1]"); - fOut = 0.0f; + fOut = 0.0; ++iLineNumber; return; } // parse the first float - filePtr = fast_atoreal_move(filePtr,fOut); + filePtr = fast_atoreal_move(filePtr,fOut); } // ------------------------------------------------------------------------------------------------ void Parser::ParseLV4MeshLong(unsigned int& iOut) @@ -2151,4 +2152,6 @@ void Parser::ParseLV4MeshLong(unsigned int& iOut) iOut = strtoul10(filePtr,&filePtr); } +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + #endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER diff --git a/src/3rdparty/assimp/code/ASEParser.h b/src/3rdparty/assimp/code/ASEParser.h index 667c7c5a0..db64f2a16 100644 --- a/src/3rdparty/assimp/code/ASEParser.h +++ b/src/3rdparty/assimp/code/ASEParser.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -48,6 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER + // for some helper routines like IsSpace() #include "ParsingUtils.h" #include "qnan.h" @@ -222,7 +225,7 @@ struct BaseNode mName = szTemp; // Set mTargetPosition to qnan - const float qnan = get_qnan(); + const ai_real qnan = get_qnan(); mTargetPosition.x = qnan; } @@ -317,9 +320,9 @@ struct Light : public BaseNode LightType mLightType; aiColor3D mColor; - float mIntensity; - float mAngle; // in degrees - float mFalloff; + ai_real mIntensity; + ai_real mAngle; // in degrees + ai_real mFalloff; }; // --------------------------------------------------------------------------- @@ -342,7 +345,7 @@ struct Camera : public BaseNode { } - float mFOV, mNear, mFar; + ai_real mFOV, mNear, mFar; CameraType mCameraType; }; @@ -544,13 +547,13 @@ private: //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...) //! \param apOut Output buffer (3 floats) //! \param rIndexOut Output index - void ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut); + void ParseLV4MeshFloatTriple(ai_real* apOut, unsigned int& rIndexOut); // ------------------------------------------------------------------- //! Parse a *MESH_VERT block in a file //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...) //! \param apOut Output buffer (3 floats) - void ParseLV4MeshFloatTriple(float* apOut); + void ParseLV4MeshFloatTriple(ai_real* apOut); // ------------------------------------------------------------------- //! Parse a *MESH_TFACE block in a file @@ -568,7 +571,7 @@ private: // ------------------------------------------------------------------- //! Parse a single float element //! \param fOut Output float - void ParseLV4MeshFloat(float& fOut); + void ParseLV4MeshFloat(ai_real& fOut); // ------------------------------------------------------------------- //! Parse a single int element @@ -661,4 +664,6 @@ public: } // Namespace ASE } // Namespace ASSIMP +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + #endif // !! include guard diff --git a/src/3rdparty/assimp/code/AssbinExporter.cpp b/src/3rdparty/assimp/code/AssbinExporter.cpp index 9240d3739..bcac2e08f 100644 --- a/src/3rdparty/assimp/code/AssbinExporter.cpp +++ b/src/3rdparty/assimp/code/AssbinExporter.cpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -138,6 +139,17 @@ inline size_t Write(IOStream * stream, const aiVector3D& v) return t; } +// ----------------------------------------------------------------------------------- +// Serialize a color value +template <> +inline size_t Write(IOStream * stream, const aiColor3D& v) +{ + size_t t = Write(stream,v.r); + t += Write(stream,v.g); + t += Write(stream,v.b); + return t; +} + // ----------------------------------------------------------------------------------- // Serialize a color value template <> @@ -159,6 +171,7 @@ inline size_t Write(IOStream * stream, const aiQuaternion& v) t += Write(stream,v.x); t += Write(stream,v.y); t += Write(stream,v.z); + ai_assert(t == 16); return 16; } @@ -324,10 +337,13 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) { AssbinChunkWriter chunk( container, ASSBIN_CHUNK_AINODE ); + unsigned int nb_metadata = (node->mMetaData != NULL ? node->mMetaData->mNumProperties : 0); + Write(&chunk,node->mName); Write(&chunk,node->mTransformation); Write(&chunk,node->mNumChildren); Write(&chunk,node->mNumMeshes); + Write(&chunk,nb_metadata); for (unsigned int i = 0; i < node->mNumMeshes;++i) { Write(&chunk,node->mMeshes[i]); @@ -336,6 +352,44 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) for (unsigned int i = 0; i < node->mNumChildren;++i) { WriteBinaryNode( &chunk, node->mChildren[i] ); } + + for (unsigned int i = 0; i < nb_metadata; ++i) { + const aiString& key = node->mMetaData->mKeys[i]; + aiMetadataType type = node->mMetaData->mValues[i].mType; + void* value = node->mMetaData->mValues[i].mData; + + Write(&chunk, key); + Write(&chunk, type); + + switch (type) { + case AI_BOOL: + Write(&chunk, *((bool*) value)); + break; + case AI_INT32: + Write(&chunk, *((int32_t*) value)); + break; + case AI_UINT64: + Write(&chunk, *((uint64_t*) value)); + break; + case AI_FLOAT: + Write(&chunk, *((float*) value)); + break; + case AI_DOUBLE: + Write(&chunk, *((double*) value)); + break; + case AI_AISTRING: + Write(&chunk, *((aiString*) value)); + break; + case AI_AIVECTOR3D: + Write(&chunk, *((aiVector3D*) value)); + break; +#ifdef SWIG + case FORCE_32BIT: +#endif // SWIG + default: + break; + } + } } // ----------------------------------------------------------------------------------- @@ -597,9 +651,9 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) Write(&chunk,l->mAttenuationQuadratic); } - Write(&chunk,(const aiVector3D&)l->mColorDiffuse); - Write(&chunk,(const aiVector3D&)l->mColorSpecular); - Write(&chunk,(const aiVector3D&)l->mColorAmbient); + Write(&chunk,l->mColorDiffuse); + Write(&chunk,l->mColorSpecular); + Write(&chunk,l->mColorAmbient); if (l->mType == aiLightSource_SPOT) { Write(&chunk,l->mAngleInnerCone); @@ -737,7 +791,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) AssbinChunkWriter uncompressedStream( NULL, 0 ); WriteBinaryScene( &uncompressedStream, pScene ); - uLongf uncompressedSize = uncompressedStream.Tell(); + uLongf uncompressedSize = static_cast(uncompressedStream.Tell()); uLongf compressedSize = (uLongf)(uncompressedStream.Tell() * 1.001 + 12.); uint8_t* compressedBuffer = new uint8_t[ compressedSize ]; @@ -757,7 +811,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) } }; -void ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) +void ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/) { AssbinExport exporter; exporter.WriteBinaryDump( pFile, pIOSystem, pScene ); diff --git a/src/3rdparty/assimp/code/AssbinExporter.h b/src/3rdparty/assimp/code/AssbinExporter.h index 4a0219c04..55bb9fc82 100644 --- a/src/3rdparty/assimp/code/AssbinExporter.h +++ b/src/3rdparty/assimp/code/AssbinExporter.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/src/3rdparty/assimp/code/AssbinLoader.cpp b/src/3rdparty/assimp/code/AssbinLoader.cpp index c4261c4cb..a7044c119 100644 --- a/src/3rdparty/assimp/code/AssbinLoader.cpp +++ b/src/3rdparty/assimp/code/AssbinLoader.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -54,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #ifdef ASSIMP_BUILD_NO_OWN_ZLIB # include @@ -196,9 +198,9 @@ template void ReadBounds( IOStream * stream, T* /*p*/, unsigned int stream->Seek( sizeof(T) * n, aiOrigin_CUR ); } -void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node ) -{ +void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node, aiNode* parent ) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AINODE); /*uint32_t size =*/ Read(stream); @@ -208,29 +210,72 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node ) (*node)->mTransformation = Read(stream); (*node)->mNumChildren = Read(stream); (*node)->mNumMeshes = Read(stream); + unsigned int nb_metadata = Read(stream); - if ((*node)->mNumMeshes) - { + if(parent) { + (*node)->mParent = parent; + } + + if ((*node)->mNumMeshes) { (*node)->mMeshes = new unsigned int[(*node)->mNumMeshes]; for (unsigned int i = 0; i < (*node)->mNumMeshes; ++i) { (*node)->mMeshes[i] = Read(stream); } } - if ((*node)->mNumChildren) - { + if ((*node)->mNumChildren) { (*node)->mChildren = new aiNode*[(*node)->mNumChildren]; for (unsigned int i = 0; i < (*node)->mNumChildren; ++i) { - ReadBinaryNode( stream, &(*node)->mChildren[i] ); + ReadBinaryNode( stream, &(*node)->mChildren[i], *node ); } } + if ( nb_metadata > 0 ) { + (*node)->mMetaData = aiMetadata::Alloc(nb_metadata); + for (unsigned int i = 0; i < nb_metadata; ++i) { + (*node)->mMetaData->mKeys[i] = Read(stream); + (*node)->mMetaData->mValues[i].mType = (aiMetadataType) Read(stream); + void* data( nullptr ); + + switch ((*node)->mMetaData->mValues[i].mType) { + case AI_BOOL: + data = new bool(Read(stream)); + break; + case AI_INT32: + data = new int32_t(Read(stream)); + break; + case AI_UINT64: + data = new uint64_t(Read(stream)); + break; + case AI_FLOAT: + data = new float(Read(stream)); + break; + case AI_DOUBLE: + data = new double(Read(stream)); + break; + case AI_AISTRING: + data = new aiString(Read(stream)); + break; + case AI_AIVECTOR3D: + data = new aiVector3D(Read(stream)); + break; +#ifndef SWIG + case FORCE_32BIT: +#endif // SWIG + default: + break; + } + + (*node)->mMetaData->mValues[i].mData = data; + } + } } // ----------------------------------------------------------------------------------- void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b ) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AIBONE); /*uint32_t size =*/ Read(stream); @@ -255,6 +300,7 @@ void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b ) void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh ) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AIMESH); /*uint32_t size =*/ Read(stream); @@ -380,6 +426,7 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh ) void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialProperty* prop) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIALPROPERTY); /*uint32_t size =*/ Read(stream); @@ -397,6 +444,7 @@ void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialPro void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIAL); /*uint32_t size =*/ Read(stream); @@ -419,6 +467,7 @@ void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat) void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AINODEANIM); /*uint32_t size =*/ Read(stream); @@ -468,6 +517,7 @@ void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd) void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim ) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AIANIMATION); /*uint32_t size =*/ Read(stream); @@ -489,6 +539,7 @@ void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim ) void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AITEXTURE); /*uint32_t size =*/ Read(stream); @@ -513,6 +564,7 @@ void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l ) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AILIGHT); /*uint32_t size =*/ Read(stream); @@ -540,6 +592,7 @@ void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l ) void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam ) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AICAMERA); /*uint32_t size =*/ Read(stream); @@ -556,6 +609,7 @@ void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam ) void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene ) { uint32_t chunkID = Read(stream); + (void)(chunkID); ai_assert(chunkID == ASSBIN_CHUNK_AISCENE); /*uint32_t size =*/ Read(stream); @@ -569,7 +623,7 @@ void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene ) // Read node graph scene->mRootNode = new aiNode[1]; - ReadBinaryNode( stream, &scene->mRootNode ); + ReadBinaryNode( stream, &scene->mRootNode, (aiNode*)NULL ); // Read all meshes if (scene->mNumMeshes) @@ -659,7 +713,7 @@ void AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene, if (compressed) { uLongf uncompressedSize = Read(stream); - uLongf compressedSize = stream->FileSize() - stream->Tell(); + uLongf compressedSize = static_cast(stream->FileSize() - stream->Tell()); unsigned char * compressedData = new unsigned char[ compressedSize ]; stream->Read( compressedData, 1, compressedSize ); diff --git a/src/3rdparty/assimp/code/AssbinLoader.h b/src/3rdparty/assimp/code/AssbinLoader.h index e8c8dd0cb..2eb7a6488 100644 --- a/src/3rdparty/assimp/code/AssbinLoader.h +++ b/src/3rdparty/assimp/code/AssbinLoader.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -46,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_ASSBINIMPORTER_H_INC #include "BaseImporter.h" -#include struct aiMesh; struct aiNode; @@ -71,7 +71,6 @@ class AssbinImporter : public BaseImporter private: bool shortened; bool compressed; -protected: public: virtual bool CanRead( @@ -86,7 +85,7 @@ public: IOSystem* pIOHandler ); void ReadBinaryScene( IOStream * stream, aiScene* pScene ); - void ReadBinaryNode( IOStream * stream, aiNode** mRootNode ); + void ReadBinaryNode( IOStream * stream, aiNode** mRootNode, aiNode* parent ); void ReadBinaryMesh( IOStream * stream, aiMesh* mesh ); void ReadBinaryBone( IOStream * stream, aiBone* bone ); void ReadBinaryMaterial(IOStream * stream, aiMaterial* mat); diff --git a/src/3rdparty/assimp/code/Assimp.cpp b/src/3rdparty/assimp/code/Assimp.cpp index 8507c8641..9269f905e 100644 --- a/src/3rdparty/assimp/code/Assimp.cpp +++ b/src/3rdparty/assimp/code/Assimp.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -65,8 +66,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ------------------------------------------------------------------------------------------------ using namespace Assimp; -namespace Assimp -{ +namespace Assimp { // underlying structure for aiPropertyStore typedef BatchLoader::PropertyMap PropertyMap; @@ -109,12 +109,11 @@ static std::mutex gLogStreamMutex; // ------------------------------------------------------------------------------------------------ // Custom LogStream implementation for the C-API -class LogToCallbackRedirector : public LogStream -{ +class LogToCallbackRedirector : public LogStream { public: explicit LogToCallbackRedirector(const aiLogStream& s) - : stream (s) { - ai_assert(NULL != s.callback); + : stream (s) { + ai_assert(NULL != s.callback); } ~LogToCallbackRedirector() { @@ -145,32 +144,27 @@ private: }; // ------------------------------------------------------------------------------------------------ -void ReportSceneNotFoundError() -{ +void ReportSceneNotFoundError() { DefaultLogger::get()->error("Unable to find the Assimp::Importer for this aiScene. " "The C-API does not accept scenes produced by the C++ API and vice versa"); - assert(false); + ai_assert(false); } // ------------------------------------------------------------------------------------------------ // Reads the given file and returns its content. -const aiScene* aiImportFile( const char* pFile, unsigned int pFlags) -{ +const aiScene* aiImportFile( const char* pFile, unsigned int pFlags) { return aiImportFileEx(pFile,pFlags,NULL); } // ------------------------------------------------------------------------------------------------ -const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags, aiFileIO* pFS) -{ +const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags, aiFileIO* pFS) { return aiImportFileExWithProperties(pFile, pFlags, pFS, NULL); } // ------------------------------------------------------------------------------------------------ -const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags, - aiFileIO* pFS, - const aiPropertyStore* props) -{ +const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags, + aiFileIO* pFS, const aiPropertyStore* props) { ai_assert(NULL != pFile); const aiScene* scene = NULL; @@ -189,7 +183,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl pimpl->mMatrixProperties = pp->matrices; } // setup a custom IO system if necessary - if (pFS) { + if (pFS) { imp->SetIOHandler( new CIOSystemWrapper (pFS) ); } @@ -200,8 +194,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl if( scene) { ScenePrivateData* priv = const_cast( ScenePriv(scene) ); priv->mOrigImporter = imp; - } - else { + } else { // if failed, extract error code and destroy the import gLastErrorString = imp->GetErrorString(); delete imp; @@ -209,6 +202,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl // return imported data. If the import failed the pointer is NULL anyways ASSIMP_END_EXCEPTION_REGION(const aiScene*); + return scene; } @@ -546,11 +540,11 @@ ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szNam // ------------------------------------------------------------------------------------------------ // Importer::SetPropertyFloat -ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, float value) +ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, ai_real value) { ASSIMP_BEGIN_EXCEPTION_REGION(); PropertyMap* pp = reinterpret_cast(p); - SetGenericProperty(pp->floats,szName,value); + SetGenericProperty(pp->floats,szName,value); ASSIMP_END_EXCEPTION_REGION(void); } diff --git a/src/3rdparty/assimp/code/AssimpCExport.cpp b/src/3rdparty/assimp/code/AssimpCExport.cpp index c5f26fc47..b8d3264a1 100644 --- a/src/3rdparty/assimp/code/AssimpCExport.cpp +++ b/src/3rdparty/assimp/code/AssimpCExport.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -44,8 +45,9 @@ Assimp C export interface. See Exporter.cpp for some notes. */ #ifndef ASSIMP_BUILD_NO_EXPORT + #include "CInterfaceIOWrapper.h" -#include "SceneCombiner.h" +#include #include "ScenePrivate.h" #include @@ -70,11 +72,11 @@ ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t index) } aiExportFormatDesc *desc = new aiExportFormatDesc; - desc->description = new char[ strlen( orig->description ) + 1 ]; + desc->description = new char[ strlen( orig->description ) + 1 ](); ::strncpy( (char*) desc->description, orig->description, strlen( orig->description ) ); - desc->fileExtension = new char[ strlen( orig->fileExtension ) + 1 ]; + desc->fileExtension = new char[ strlen( orig->fileExtension ) + 1 ](); ::strncpy( ( char* ) desc->fileExtension, orig->fileExtension, strlen( orig->fileExtension ) ); - desc->id = new char[ strlen( orig->id ) + 1 ]; + desc->id = new char[ strlen( orig->id ) + 1 ](); ::strncpy( ( char* ) desc->id, orig->id, strlen( orig->id ) ); return desc; diff --git a/src/3rdparty/assimp/code/AssxmlExporter.cpp b/src/3rdparty/assimp/code/AssxmlExporter.cpp index cf18837f5..90ed66701 100644 --- a/src/3rdparty/assimp/code/AssxmlExporter.cpp +++ b/src/3rdparty/assimp/code/AssxmlExporter.cpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -41,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ASSXML exporter main code */ #include -#include "./../include/assimp/version.h" +#include #include "ProcessHelper.h" #include #include @@ -74,11 +75,10 @@ static int ioprintf( IOStream * io, const char *format, ... ) { static const int Size = 4096; char sz[ Size ]; - size_t len( strlen( format ) ); ::memset( sz, '\0', Size ); va_list va; va_start( va, format ); - int nSize = vsnprintf( sz, Size-1, format, va ); + const unsigned int nSize = vsnprintf( sz, Size-1, format, va ); ai_assert( nSize < Size ); va_end( va ); @@ -300,7 +300,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened) { else if (!shortened){ ioprintf(io,"\t\t \n",tex->mWidth*tex->mHeight*4); - // const unsigned int width = (unsigned int)log10((double)std::max(tex->mHeight,tex->mWidth))+1; + // const unsigned int width = (unsigned int)std::log10((double)std::max(tex->mHeight,tex->mWidth))+1; for (unsigned int y = 0; y < tex->mHeight;++y) { for (unsigned int x = 0; x < tex->mWidth;++x) { aiTexel* tx = tex->pcData + y*tex->mWidth+x; @@ -458,7 +458,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened) { ioprintf(io,"\n",scene->mNumMeshes); for (unsigned int i = 0; i < scene->mNumMeshes;++i) { aiMesh* mesh = scene->mMeshes[i]; - // const unsigned int width = (unsigned int)log10((double)mesh->mNumVertices)+1; + // const unsigned int width = (unsigned int)std::log10((double)mesh->mNumVertices)+1; // mesh header ioprintf(io,"\t\n", @@ -631,7 +631,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened) { } // end of namespace AssxmlExport -void ExportSceneAssxml(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) +void ExportSceneAssxml(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/) { IOStream * out = pIOSystem->Open( pFile, "wt" ); if (!out) return; diff --git a/src/3rdparty/assimp/code/AssxmlExporter.h b/src/3rdparty/assimp/code/AssxmlExporter.h index ba9921f70..9694f74a3 100644 --- a/src/3rdparty/assimp/code/AssxmlExporter.h +++ b/src/3rdparty/assimp/code/AssxmlExporter.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/src/3rdparty/assimp/code/B3DImporter.cpp b/src/3rdparty/assimp/code/B3DImporter.cpp index 1b9ba1433..bc888fb66 100644 --- a/src/3rdparty/assimp/code/B3DImporter.cpp +++ b/src/3rdparty/assimp/code/B3DImporter.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -56,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include - +#include using namespace Assimp; using namespace std; @@ -81,6 +82,20 @@ static const aiImporterDesc desc = { //#define DEBUG_B3D +template +void DeleteAllBarePointers(std::vector& x) +{ + for(auto p : x) + { + delete p; + } +} + +B3DImporter::~B3DImporter() +{ + DeleteAllBarePointers(_animations); +} + // ------------------------------------------------------------------------------------------------ bool B3DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const{ @@ -156,7 +171,8 @@ int B3DImporter::ReadByte(){ // ------------------------------------------------------------------------------------------------ int B3DImporter::ReadInt(){ if( _pos+4<=_buf.size() ){ - int n=*(int*)&_buf[_pos]; + int n; + memcpy(&n, &_buf[_pos], 4); _pos+=4; return n; } @@ -167,7 +183,8 @@ int B3DImporter::ReadInt(){ // ------------------------------------------------------------------------------------------------ float B3DImporter::ReadFloat(){ if( _pos+4<=_buf.size() ){ - float n=*(float*)&_buf[_pos]; + float n; + memcpy(&n, &_buf[_pos], 4); _pos+=4; return n; } @@ -331,7 +348,7 @@ void B3DImporter::ReadVRTS(){ int sz=12+(_vflags&1?12:0)+(_vflags&2?16:0)+(_tcsets*_tcsize*4); int n_verts=ChunkSize()/sz; - int v0=_vertices.size(); + int v0=static_cast(_vertices.size()); _vertices.resize( v0+n_verts ); for( int i=0;i(_vertices.size()); while( ChunkSize() ){ string t=ReadChunk(); @@ -462,17 +479,17 @@ void B3DImporter::ReadKEYS( aiNodeAnim *nodeAnim ){ } if( flags & 1 ){ - nodeAnim->mNumPositionKeys=trans.size(); + nodeAnim->mNumPositionKeys=static_cast(trans.size()); nodeAnim->mPositionKeys=to_array( trans ); } if( flags & 2 ){ - nodeAnim->mNumScalingKeys=scale.size(); + nodeAnim->mNumScalingKeys=static_cast(scale.size()); nodeAnim->mScalingKeys=to_array( scale ); } if( flags & 4 ){ - nodeAnim->mNumRotationKeys=rot.size(); + nodeAnim->mNumRotationKeys=static_cast(rot.size()); nodeAnim->mRotationKeys=to_array( rot ); } } @@ -506,7 +523,7 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ aiMatrix4x4 tform=trans * rot * scale; - int nodeid=_nodes.size(); + int nodeid=static_cast(_nodes.size()); aiNode *node=new aiNode( name ); _nodes.push_back( node ); @@ -521,9 +538,9 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ while( ChunkSize() ){ string t=ReadChunk(); if( t=="MESH" ){ - int n=_meshes.size(); + unsigned int n= static_cast(_meshes.size()); ReadMESH(); - for( int i=n;i<(int)_meshes.size();++i ){ + for( unsigned int i=n;i(_meshes.size());++i ){ meshes.push_back( i ); } }else if( t=="BONE" ){ @@ -544,10 +561,10 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ ExitChunk(); } - node->mNumMeshes=meshes.size(); + node->mNumMeshes= static_cast(meshes.size()); node->mMeshes=to_array( meshes ); - node->mNumChildren=children.size(); + node->mNumChildren=static_cast(children.size()); node->mChildren=to_array( children ); return node; @@ -557,13 +574,19 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ void B3DImporter::ReadBB3D( aiScene *scene ){ _textures.clear(); + _materials.clear(); _vertices.clear(); + _meshes.clear(); + DeleteAllBarePointers(_nodes); _nodes.clear(); + _nodeAnims.clear(); + + DeleteAllBarePointers(_animations); _animations.clear(); string t=ReadChunk(); @@ -645,7 +668,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){ aiNode *bnode=_nodes[i]; bone->mName=bnode->mName; - bone->mNumWeights=weights.size(); + bone->mNumWeights= static_cast(weights.size()); bone->mWeights=to_array( weights ); aiMatrix4x4 mat=bnode->mTransformation; @@ -655,7 +678,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){ } bone->mOffsetMatrix=mat.Inverse(); } - mesh->mNumBones=bones.size(); + mesh->mNumBones= static_cast(bones.size()); mesh->mBones=to_array( bones ); } } @@ -667,21 +690,21 @@ void B3DImporter::ReadBB3D( aiScene *scene ){ if( !_materials.size() ){ _materials.push_back( new aiMaterial ); } - scene->mNumMaterials=_materials.size(); + scene->mNumMaterials= static_cast(_materials.size()); scene->mMaterials=to_array( _materials ); //meshes - scene->mNumMeshes=_meshes.size(); + scene->mNumMeshes= static_cast(_meshes.size()); scene->mMeshes=to_array( _meshes ); //animations if( _animations.size()==1 && _nodeAnims.size() ){ aiAnimation *anim=_animations.back(); - anim->mNumChannels=_nodeAnims.size(); + anim->mNumChannels=static_cast(_nodeAnims.size()); anim->mChannels=to_array( _nodeAnims ); - scene->mNumAnimations=_animations.size(); + scene->mNumAnimations=static_cast(_animations.size()); scene->mAnimations=to_array( _animations ); } diff --git a/src/3rdparty/assimp/code/B3DImporter.h b/src/3rdparty/assimp/code/B3DImporter.h index 92ddc0272..94644edd4 100644 --- a/src/3rdparty/assimp/code/B3DImporter.h +++ b/src/3rdparty/assimp/code/B3DImporter.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -48,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "BaseImporter.h" -#include #include struct aiNodeAnim; @@ -59,6 +59,8 @@ namespace Assimp{ class B3DImporter : public BaseImporter{ public: + B3DImporter() = default; + virtual ~B3DImporter(); virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const; diff --git a/src/3rdparty/assimp/code/BVHLoader.cpp b/src/3rdparty/assimp/code/BVHLoader.cpp index ca6c5d36c..c20cbec4e 100644 --- a/src/3rdparty/assimp/code/BVHLoader.cpp +++ b/src/3rdparty/assimp/code/BVHLoader.cpp @@ -4,7 +4,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -51,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "TinyFormatter.h" #include #include +#include using namespace Assimp; using namespace Assimp::Formatter; @@ -237,7 +239,7 @@ aiNode* BVHLoader::ReadNode() // add the child nodes if there are any if( childNodes.size() > 0) { - node->mNumChildren = childNodes.size(); + node->mNumChildren = static_cast(childNodes.size()); node->mChildren = new aiNode*[node->mNumChildren]; std::copy( childNodes.begin(), childNodes.end(), node->mChildren); } @@ -443,7 +445,7 @@ void BVHLoader::CreateAnimation( aiScene* pScene) anim->mDuration = double( mAnimNumFrames - 1); // now generate the tracks for all nodes - anim->mNumChannels = mNodes.size(); + anim->mNumChannels = static_cast(mNodes.size()); anim->mChannels = new aiNodeAnim*[anim->mNumChannels]; // FIX: set the array elements to NULL to ensure proper deletion if an exception is thrown diff --git a/src/3rdparty/assimp/code/BVHLoader.h b/src/3rdparty/assimp/code/BVHLoader.h index 8a163d1e7..6a89e1aaf 100644 --- a/src/3rdparty/assimp/code/BVHLoader.h +++ b/src/3rdparty/assimp/code/BVHLoader.h @@ -4,7 +4,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/src/3rdparty/assimp/code/BaseImporter.cpp b/src/3rdparty/assimp/code/BaseImporter.cpp index aa615e592..b9b9eeb71 100644 --- a/src/3rdparty/assimp/code/BaseImporter.cpp +++ b/src/3rdparty/assimp/code/BaseImporter.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -50,13 +51,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include #include #include #include #include - using namespace Assimp; // ------------------------------------------------------------------------------------------------ @@ -88,12 +89,12 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile, FileSystemFilter filter(pFile,pIOHandler); // create a scene object to hold the data - ScopeGuard sc(new aiScene()); + std::unique_ptr sc(new aiScene()); // dispatch importing try { - InternReadFile( pFile, sc, &filter); + InternReadFile( pFile, sc.get(), &filter); } catch( const std::exception& err ) { // extract error description @@ -103,8 +104,7 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile, } // return what we gathered from the import. - sc.dismiss(); - return sc; + return sc.release(); } // ------------------------------------------------------------------------------------------------ @@ -137,14 +137,17 @@ void BaseImporter::GetExtensionList(std::set& extensions) } // ------------------------------------------------------------------------------------------------ -/*static*/ bool BaseImporter::SearchFileHeaderForToken(IOSystem* pIOHandler, +/*static*/ bool BaseImporter::SearchFileHeaderForToken( IOSystem* pIOHandler, const std::string& pFile, const char** tokens, unsigned int numTokens, unsigned int searchBytes /* = 200 */, bool tokensSol /* false */) { - ai_assert(NULL != tokens && 0 != numTokens && 0 != searchBytes); + ai_assert( NULL != tokens ); + ai_assert( 0 != numTokens ); + ai_assert( 0 != searchBytes); + if (!pIOHandler) return false; @@ -179,8 +182,6 @@ void BaseImporter::GetExtensionList(std::set& extensions) for (unsigned int i = 0; i < numTokens;++i) { ai_assert(NULL != tokens[i]); - - const char* r = strstr(buffer,tokens[i]); if( !r ) { continue; @@ -301,24 +302,13 @@ void BaseImporter::GetExtensionList(std::set& extensions) return false; } -#include "../contrib/ConvertUTF/ConvertUTF.h" - -// ------------------------------------------------------------------------------------------------ -void ReportResult(ConversionResult res) -{ - if(res == sourceExhausted) { - DefaultLogger::get()->error("Source ends with incomplete character sequence, transformation to UTF-8 fails"); - } - else if(res == sourceIllegal) { - DefaultLogger::get()->error("Source contains illegal character sequence, transformation to UTF-8 fails"); - } -} +#include "../contrib/utf8cpp/source/utf8.h" // ------------------------------------------------------------------------------------------------ // Convert to UTF8 data void BaseImporter::ConvertToUTF8(std::vector& data) { - ConversionResult result; + //ConversionResult result; if(data.size() < 8) { throw DeadlyImportError("File is too small"); } @@ -331,7 +321,8 @@ void BaseImporter::ConvertToUTF8(std::vector& data) data.resize(data.size()-3); return; } - + + // UTF 32 BE with BOM if(*((uint32_t*)&data.front()) == 0xFFFE0000) { @@ -345,21 +336,10 @@ void BaseImporter::ConvertToUTF8(std::vector& data) if(*((uint32_t*)&data.front()) == 0x0000FFFE) { DefaultLogger::get()->debug("Found UTF-32 BOM ..."); - const uint32_t* sstart = (uint32_t*)&data.front()+1, *send = (uint32_t*)&data.back()+1; - char* dstart,*dend; std::vector output; - do { - output.resize(output.size()?output.size()*3/2:data.size()/2); - dstart = &output.front(),dend = &output.back()+1; - - result = ConvertUTF32toUTF8((const UTF32**)&sstart,(const UTF32*)send,(UTF8**)&dstart,(UTF8*)dend,lenientConversion); - } while(result == targetExhausted); - - ReportResult(result); - - // copy to output buffer. - const size_t outlen = (size_t)(dstart-&output.front()); - data.assign(output.begin(),output.begin()+outlen); + int *ptr = (int*)&data[ 0 ]; + int *end = ptr + ( data.size() / sizeof(int) ) +1; + utf8::utf32to8( ptr, end, back_inserter(output)); return; } @@ -376,21 +356,8 @@ void BaseImporter::ConvertToUTF8(std::vector& data) if(*((uint16_t*)&data.front()) == 0xFEFF) { DefaultLogger::get()->debug("Found UTF-16 BOM ..."); - const uint16_t* sstart = (uint16_t*)&data.front()+1, *send = (uint16_t*)(&data.back()+1); - char* dstart,*dend; - std::vector output; - do { - output.resize(output.size()?output.size()*3/2:data.size()*3/4); - dstart = &output.front(),dend = &output.back()+1; - - result = ConvertUTF16toUTF8((const UTF16**)&sstart,(const UTF16*)send,(UTF8**)&dstart,(UTF8*)dend,lenientConversion); - } while(result == targetExhausted); - - ReportResult(result); - - // copy to output buffer. - const size_t outlen = (size_t)(dstart-&output.front()); - data.assign(output.begin(),output.begin()+outlen); + std::vector output; + utf8::utf16to8(data.begin(), data.end(), back_inserter(output)); return; } } @@ -461,41 +428,53 @@ void BaseImporter::TextFileToBuffer(IOStream* stream, } // ------------------------------------------------------------------------------------------------ -namespace Assimp -{ +namespace Assimp { // Represents an import request - struct LoadRequest - { + struct LoadRequest { LoadRequest(const std::string& _file, unsigned int _flags,const BatchLoader::PropertyMap* _map, unsigned int _id) - : file(_file), flags(_flags), refCnt(1),scene(NULL), loaded(false), id(_id) - { - if (_map) + : file(_file) + , flags(_flags) + , refCnt(1) + , scene(NULL) + , loaded(false) + , id(_id) { + if ( _map ) { map = *_map; + } } - const std::string file; - unsigned int flags; - unsigned int refCnt; - aiScene* scene; - bool loaded; - BatchLoader::PropertyMap map; - unsigned int id; - - bool operator== (const std::string& f) { + bool operator== ( const std::string& f ) const { return file == f; } + + const std::string file; + unsigned int flags; + unsigned int refCnt; + aiScene *scene; + bool loaded; + BatchLoader::PropertyMap map; + unsigned int id; }; } // ------------------------------------------------------------------------------------------------ // BatchLoader::pimpl data structure -struct Assimp::BatchData -{ - BatchData() - : pIOSystem() - , pImporter() - , next_id(0xffff) - {} +struct Assimp::BatchData { + BatchData( IOSystem* pIO, bool validate ) + : pIOSystem( pIO ) + , pImporter( nullptr ) + , next_id(0xffff) + , validate( validate ) { + ai_assert( NULL != pIO ); + + pImporter = new Importer(); + pImporter->SetIOHandler( pIO ); + } + + ~BatchData() { + pImporter->SetIOHandler( NULL ); /* get pointer back into our possession */ + delete pImporter; + } // IO system to be used for all imports IOSystem* pIOSystem; @@ -511,53 +490,59 @@ struct Assimp::BatchData // Id for next item unsigned int next_id; + + // Validation enabled state + bool validate; }; +typedef std::list::iterator LoadReqIt; + // ------------------------------------------------------------------------------------------------ -BatchLoader::BatchLoader(IOSystem* pIO) +BatchLoader::BatchLoader(IOSystem* pIO, bool validate ) { ai_assert(NULL != pIO); - data = new BatchData(); - data->pIOSystem = pIO; - - data->pImporter = new Importer(); - data->pImporter->SetIOHandler(data->pIOSystem); + m_data = new BatchData( pIO, validate ); } // ------------------------------------------------------------------------------------------------ BatchLoader::~BatchLoader() { - // delete all scenes wthat have not been polled by the user - for (std::list::iterator it = data->requests.begin();it != data->requests.end(); ++it) { - + // delete all scenes what have not been polled by the user + for ( LoadReqIt it = m_data->requests.begin();it != m_data->requests.end(); ++it) { delete (*it).scene; } - data->pImporter->SetIOHandler(NULL); /* get pointer back into our possession */ - delete data->pImporter; - delete data; + delete m_data; +} + +// ------------------------------------------------------------------------------------------------ +void BatchLoader::setValidation( bool enabled ) { + m_data->validate = enabled; } +// ------------------------------------------------------------------------------------------------ +bool BatchLoader::getValidation() const { + return m_data->validate; +} // ------------------------------------------------------------------------------------------------ -unsigned int BatchLoader::AddLoadRequest (const std::string& file, +unsigned int BatchLoader::AddLoadRequest(const std::string& file, unsigned int steps /*= 0*/, const PropertyMap* map /*= NULL*/) { ai_assert(!file.empty()); // check whether we have this loading request already - std::list::iterator it; - for (it = data->requests.begin();it != data->requests.end(); ++it) { - + for ( LoadReqIt it = m_data->requests.begin();it != m_data->requests.end(); ++it) { // Call IOSystem's path comparison function here - if (data->pIOSystem->ComparePaths((*it).file,file)) { - + if ( m_data->pIOSystem->ComparePaths((*it).file,file)) { if (map) { - if (!((*it).map == *map)) + if ( !( ( *it ).map == *map ) ) { continue; + } } - else if (!(*it).map.empty()) + else if ( !( *it ).map.empty() ) { continue; + } (*it).refCnt++; return (*it).id; @@ -565,20 +550,18 @@ unsigned int BatchLoader::AddLoadRequest (const std::string& file, } // no, we don't have it. So add it to the queue ... - data->requests.push_back(LoadRequest(file,steps,map,data->next_id)); - return data->next_id++; + m_data->requests.push_back(LoadRequest(file,steps,map, m_data->next_id)); + return m_data->next_id++; } // ------------------------------------------------------------------------------------------------ -aiScene* BatchLoader::GetImport (unsigned int which) +aiScene* BatchLoader::GetImport( unsigned int which ) { - for (std::list::iterator it = data->requests.begin();it != data->requests.end(); ++it) { - + for ( LoadReqIt it = m_data->requests.begin();it != m_data->requests.end(); ++it) { if ((*it).id == which && (*it).loaded) { - aiScene* sc = (*it).scene; if (!(--(*it).refCnt)) { - data->requests.erase(it); + m_data->requests.erase(it); } return sc; } @@ -590,14 +573,15 @@ aiScene* BatchLoader::GetImport (unsigned int which) void BatchLoader::LoadAll() { // no threaded implementation for the moment - for (std::list::iterator it = data->requests.begin();it != data->requests.end(); ++it) { + for ( LoadReqIt it = m_data->requests.begin();it != m_data->requests.end(); ++it) { // force validation in debug builds unsigned int pp = (*it).flags; -#ifdef ASSIMP_BUILD_DEBUG - pp |= aiProcess_ValidateDataStructure; -#endif + if ( m_data->validate ) { + pp |= aiProcess_ValidateDataStructure; + } + // setup config properties if necessary - ImporterPimpl* pimpl = data->pImporter->Pimpl(); + ImporterPimpl* pimpl = m_data->pImporter->Pimpl(); pimpl->mFloatProperties = (*it).map.floats; pimpl->mIntProperties = (*it).map.ints; pimpl->mStringProperties = (*it).map.strings; @@ -608,8 +592,8 @@ void BatchLoader::LoadAll() DefaultLogger::get()->info("%%% BEGIN EXTERNAL FILE %%%"); DefaultLogger::get()->info("File: " + (*it).file); } - data->pImporter->ReadFile((*it).file,pp); - (*it).scene = data->pImporter->GetOrphanedScene(); + m_data->pImporter->ReadFile((*it).file,pp); + (*it).scene = m_data->pImporter->GetOrphanedScene(); (*it).loaded = true; DefaultLogger::get()->info("%%% END EXTERNAL FILE %%%"); diff --git a/src/3rdparty/assimp/code/BaseImporter.h b/src/3rdparty/assimp/code/BaseImporter.h index 5c9ddfa5e..b424d2f83 100644 --- a/src/3rdparty/assimp/code/BaseImporter.h +++ b/src/3rdparty/assimp/code/BaseImporter.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -44,14 +45,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Exceptional.h" -#include -#include #include #include #include #include struct aiScene; +struct aiImporterDesc; namespace Assimp { @@ -61,47 +61,10 @@ class BaseProcess; class SharedPostProcessInfo; class IOStream; - // utility to do char4 to uint32 in a portable manner #define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \ (string[1] << 16) + (string[2] << 8) + string[3])) -// --------------------------------------------------------------------------- -template -struct ScopeGuard -{ - explicit ScopeGuard(T* obj) : obj(obj), mdismiss() {} - ~ScopeGuard () throw() { - if (!mdismiss) { - delete obj; - } - obj = NULL; - } - - T* dismiss() { - mdismiss=true; - return obj; - } - - operator T*() { - return obj; - } - - T* operator -> () { - return obj; - } - -private: - // no copying allowed. - ScopeGuard(); - ScopeGuard( const ScopeGuard & ); - ScopeGuard &operator = ( const ScopeGuard & ); - - T* obj; - bool mdismiss; -}; - - // --------------------------------------------------------------------------- /** FOR IMPORTER PLUGINS ONLY: The BaseImporter defines a common interface @@ -194,14 +157,11 @@ public: const Importer* pImp ); - // ------------------------------------------------------------------- /** Called by #Importer::GetImporterInfo to get a description of * some loader features. Importers must provide this information. */ virtual const aiImporterDesc* GetInfo() const = 0; - - // ------------------------------------------------------------------- /** Called by #Importer::GetExtensionList for each loaded importer. * Take the extension list contained in the structure returned by @@ -317,7 +277,7 @@ public: // static utilities * @param Size of one token, in bytes. Maximally 16 bytes. * @return true if one of the given tokens was found * - * @note For convinence, the check is also performed for the + * @note For convenience, the check is also performed for the * byte-swapped variant of all tokens (big endian). Only for * tokens of size 2,4. */ @@ -347,7 +307,12 @@ public: // static utilities static void ConvertUTF8toISO8859_1( std::string& data); - enum TextFileMode { ALLOW_EMPTY, FORBID_EMPTY }; + // ------------------------------------------------------------------- + /// @brief Enum to define, if empty files are ok or not. + enum TextFileMode { + ALLOW_EMPTY, + FORBID_EMPTY + }; // ------------------------------------------------------------------- /** Utility for text file loaders which copies the contents of the @@ -382,14 +347,10 @@ public: // static utilities } } - - protected: - - /** Error description in case there was one. */ + /// Error description in case there was one. std::string m_ErrorText; - - /** Currently set progress handler */ + /// Currently set progress handler. ProgressHandler* m_progress; }; diff --git a/src/3rdparty/assimp/code/BaseProcess.cpp b/src/3rdparty/assimp/code/BaseProcess.cpp index 580f89cdb..9e175d315 100644 --- a/src/3rdparty/assimp/code/BaseProcess.cpp +++ b/src/3rdparty/assimp/code/BaseProcess.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. diff --git a/src/3rdparty/assimp/code/BaseProcess.h b/src/3rdparty/assimp/code/BaseProcess.h index 148f07284..aa873f717 100644 --- a/src/3rdparty/assimp/code/BaseProcess.h +++ b/src/3rdparty/assimp/code/BaseProcess.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -43,8 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define INCLUDED_AI_BASEPROCESS_H #include - -#include #include "GenericProperty.h" struct aiScene; diff --git a/src/3rdparty/assimp/code/Bitmap.cpp b/src/3rdparty/assimp/code/Bitmap.cpp index ae6d62083..76994513e 100644 --- a/src/3rdparty/assimp/code/Bitmap.cpp +++ b/src/3rdparty/assimp/code/Bitmap.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -101,7 +102,7 @@ namespace Assimp { offset += Copy(&data[offset], header.size); offset += Copy(&data[offset], header.reserved1); offset += Copy(&data[offset], header.reserved2); - offset += Copy(&data[offset], header.offset); + Copy(&data[offset], header.offset); file->Write(data, Header::header_size, 1); } @@ -121,7 +122,7 @@ namespace Assimp { offset += Copy(&data[offset], dib.x_resolution); offset += Copy(&data[offset], dib.y_resolution); offset += Copy(&data[offset], dib.nb_colors); - offset += Copy(&data[offset], dib.nb_important_colors); + Copy(&data[offset], dib.nb_important_colors); file->Write(data, DIB::dib_size, 1); } diff --git a/src/3rdparty/assimp/code/Bitmap.h b/src/3rdparty/assimp/code/Bitmap.h index ad29783ce..96c994dbe 100644 --- a/src/3rdparty/assimp/code/Bitmap.h +++ b/src/3rdparty/assimp/code/Bitmap.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -50,93 +51,71 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include + struct aiTexture; namespace Assimp { class IOStream; -class Bitmap { - - protected: - - struct Header { - - uint16_t type; - - uint32_t size; - - uint16_t reserved1; - - uint16_t reserved2; - - uint32_t offset; - - // We define the struct size because sizeof(Header) might return a wrong result because of structure padding. - // Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field). - static const std::size_t header_size = - sizeof(uint16_t) + // type - sizeof(uint32_t) + // size - sizeof(uint16_t) + // reserved1 - sizeof(uint16_t) + // reserved2 - sizeof(uint32_t); // offset - - }; - - struct DIB { - - uint32_t size; - - int32_t width; - - int32_t height; - - uint16_t planes; - - uint16_t bits_per_pixel; - - uint32_t compression; - - uint32_t image_size; - - int32_t x_resolution; - - int32_t y_resolution; - - uint32_t nb_colors; - - uint32_t nb_important_colors; - - // We define the struct size because sizeof(DIB) might return a wrong result because of structure padding. - // Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field). - static const std::size_t dib_size = - sizeof(uint32_t) + // size - sizeof(int32_t) + // width - sizeof(int32_t) + // height - sizeof(uint16_t) + // planes - sizeof(uint16_t) + // bits_per_pixel - sizeof(uint32_t) + // compression - sizeof(uint32_t) + // image_size - sizeof(int32_t) + // x_resolution - sizeof(int32_t) + // y_resolution - sizeof(uint32_t) + // nb_colors - sizeof(uint32_t); // nb_important_colors - - }; - - static const std::size_t mBytesPerPixel = 4; - - public: - - static void Save(aiTexture* texture, IOStream* file); - - protected: - - static void WriteHeader(Header& header, IOStream* file); - - static void WriteDIB(DIB& dib, IOStream* file); - - static void WriteData(aiTexture* texture, IOStream* file); +class Bitmap { +protected: + + struct Header { + uint16_t type; + uint32_t size; + uint16_t reserved1; + uint16_t reserved2; + uint32_t offset; + + // We define the struct size because sizeof(Header) might return a wrong result because of structure padding. + // Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field). + static const std::size_t header_size = + sizeof(uint16_t) + // type + sizeof(uint32_t) + // size + sizeof(uint16_t) + // reserved1 + sizeof(uint16_t) + // reserved2 + sizeof(uint32_t); // offset + }; + + struct DIB { + uint32_t size; + int32_t width; + int32_t height; + uint16_t planes; + uint16_t bits_per_pixel; + uint32_t compression; + uint32_t image_size; + int32_t x_resolution; + int32_t y_resolution; + uint32_t nb_colors; + uint32_t nb_important_colors; + + // We define the struct size because sizeof(DIB) might return a wrong result because of structure padding. + // Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field). + static const std::size_t dib_size = + sizeof(uint32_t) + // size + sizeof(int32_t) + // width + sizeof(int32_t) + // height + sizeof(uint16_t) + // planes + sizeof(uint16_t) + // bits_per_pixel + sizeof(uint32_t) + // compression + sizeof(uint32_t) + // image_size + sizeof(int32_t) + // x_resolution + sizeof(int32_t) + // y_resolution + sizeof(uint32_t) + // nb_colors + sizeof(uint32_t); // nb_important_colors + }; + + static const std::size_t mBytesPerPixel = 4; + +public: + static void Save(aiTexture* texture, IOStream* file); + +protected: + static void WriteHeader(Header& header, IOStream* file); + static void WriteDIB(DIB& dib, IOStream* file); + static void WriteData(aiTexture* texture, IOStream* file); }; } diff --git a/src/3rdparty/assimp/code/BlenderBMesh.cpp b/src/3rdparty/assimp/code/BlenderBMesh.cpp index bf27a9396..8a13819a6 100644 --- a/src/3rdparty/assimp/code/BlenderBMesh.cpp +++ b/src/3rdparty/assimp/code/BlenderBMesh.cpp @@ -52,7 +52,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { - template< > const std::string LogFunctions< BlenderBMeshConverter >::log_prefix = "BLEND_BMESH: "; + template< > const char* LogFunctions< BlenderBMeshConverter >::Prefix() + { + static auto prefix = "BLEND_BMESH: "; + return prefix; + } } using namespace Assimp; @@ -180,7 +184,7 @@ void BlenderBMeshConverter::AddFace( int v1, int v2, int v3, int v4 ) // TODO - Work out how materials work face.mat_nr = 0; triMesh->mface.push_back( face ); - triMesh->totface = triMesh->mface.size( ); + triMesh->totface = static_cast(triMesh->mface.size( )); } // ------------------------------------------------------------------------------------------------ diff --git a/src/3rdparty/assimp/code/BlenderDNA.cpp b/src/3rdparty/assimp/code/BlenderDNA.cpp index 18ec9f2b4..23ece913f 100644 --- a/src/3rdparty/assimp/code/BlenderDNA.cpp +++ b/src/3rdparty/assimp/code/BlenderDNA.cpp @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -48,17 +49,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BlenderDNA.h" #include "StreamReader.h" #include "fast_atof.h" +#include "TinyFormatter.h" using namespace Assimp; using namespace Assimp::Blender; using namespace Assimp::Formatter; -bool match4(StreamReaderAny& stream, const char* string) { +static bool match4(StreamReaderAny& stream, const char* string) { + ai_assert( nullptr != string ); char tmp[] = { - (stream).GetI1(), - (stream).GetI1(), - (stream).GetI1(), - (stream).GetI1() + (const char)(stream).GetI1(), + (const char)(stream).GetI1(), + (const char)(stream).GetI1(), + (const char)(stream).GetI1() }; return (tmp[0]==string[0] && tmp[1]==string[1] && tmp[2]==string[2] && tmp[3]==string[3]); } @@ -69,7 +72,7 @@ struct Type { }; // ------------------------------------------------------------------------------------------------ -void DNAParser :: Parse () +void DNAParser::Parse () { StreamReaderAny& stream = *db.reader.get(); DNA& dna = db.dna; @@ -345,10 +348,10 @@ void SectionParser :: Next() stream.SetCurrentPos(current.start + current.size); const char tmp[] = { - stream.GetI1(), - stream.GetI1(), - stream.GetI1(), - stream.GetI1() + (const char)stream.GetI1(), + (const char)stream.GetI1(), + (const char)stream.GetI1(), + (const char)stream.GetI1() }; current.id = std::string(tmp,tmp[3]?4:tmp[2]?3:tmp[1]?2:1); diff --git a/src/3rdparty/assimp/code/BlenderDNA.h b/src/3rdparty/assimp/code/BlenderDNA.h index 801d68fce..bac8d78bc 100644 --- a/src/3rdparty/assimp/code/BlenderDNA.h +++ b/src/3rdparty/assimp/code/BlenderDNA.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -46,12 +47,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define INCLUDED_AI_BLEND_DNA_H #include "BaseImporter.h" -#include "TinyFormatter.h" #include "StreamReader.h" #include #include #include - +#include // enable verbose log output. really verbose, so be careful. #ifdef ASSIMP_BUILD_DEBUG @@ -61,15 +61,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // #define ASSIMP_BUILD_BLENDER_NO_STATS namespace Assimp { - template class StreamReader; - typedef StreamReader StreamReaderAny; - namespace Blender { - class FileDatabase; - struct FileBlockHead; +template class StreamReader; +typedef StreamReader StreamReaderAny; + +namespace Blender { + +class FileDatabase; +struct FileBlockHead; - template