diff --git a/.travis.sh b/.travis.sh index c3624a593..fefd5292d 100755 --- a/.travis.sh +++ b/.travis.sh @@ -11,6 +11,6 @@ else && sudo make install \ && sudo ldconfig \ && (cd test/unit; ../../bin/unit) \ - && (cd test/regression; chmod 755 run.py; ./run.py ../../bin/assimp; \ - chmod 755 result_checker.py; ./result_checker.py) + #&& (cd test/regression; chmod 755 run.py; ./run.py ../../bin/assimp; \ + # chmod 755 result_checker.py; ./result_checker.py) fi diff --git a/.travis.yml b/.travis.yml index 6588285d8..05f963291 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ env: - secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc=" language: cpp - + compiler: - gcc diff --git a/CMakeLists.txt b/CMakeLists.txt index f0736da74..7fbc43b72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,11 +81,15 @@ IF(NOT GIT_COMMIT_HASH) ENDIF(NOT GIT_COMMIT_HASH) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in + ${CMAKE_CURRENT_LIST_DIR}/revision.h.in +# ${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in ${CMAKE_CURRENT_BINARY_DIR}/revision.h ) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories( + ./ + ${CMAKE_CURRENT_BINARY_DIR} +) OPTION(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" ) diff --git a/Readme.md b/Readme.md index ddb38f410..e75e9eca1 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,5 @@ Open Asset Import Library (assimp) ================================== -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. 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. @@ -15,7 +14,8 @@ 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.__ #### Supported file formats #### @@ -115,6 +115,8 @@ If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflo For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_ [(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions) +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 diff --git a/code/3DSConverter.cpp b/code/3DSConverter.cpp index 419b71b29..cb6fd9077 100644 --- a/code/3DSConverter.cpp +++ b/code/3DSConverter.cpp @@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // internal headers #include "3DSLoader.h" #include "TargetAnimation.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include #include "StringComparison.h" #include #include diff --git a/code/3DSExporter.cpp b/code/3DSExporter.cpp index 5450c1baf..5bb79408f 100644 --- a/code/3DSExporter.cpp +++ b/code/3DSExporter.cpp @@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "SceneCombiner.h" #include "SplitLargeMeshes.h" #include "StringComparison.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include #include using namespace Assimp; diff --git a/code/3DSLoader.cpp b/code/3DSLoader.cpp index f6ade56a3..a2b73b2cb 100644 --- a/code/3DSLoader.cpp +++ b/code/3DSLoader.cpp @@ -51,9 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // internal headers #include "3DSLoader.h" #include "Macros.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include #include "StringComparison.h" using namespace Assimp; @@ -186,15 +186,14 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile, // internal verbose representation. Finally compute normal // vectors from the smoothing groups we read from the // file. - for (std::vector::iterator i = mScene->mMeshes.begin(), - end = mScene->mMeshes.end(); i != end;++i) { - if ((*i).mFaces.size() > 0 && (*i).mPositions.size() == 0) { + for (auto &mesh : mScene->mMeshes) { + if (mesh.mFaces.size() > 0 && mesh.mPositions.size() == 0) { delete mScene; throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile); } - CheckIndices(*i); - MakeUnique (*i); - ComputeNormalsWithSmoothingsGroups(*i); + CheckIndices(mesh); + MakeUnique (mesh); + ComputeNormalsWithSmoothingsGroups(mesh); } // Replace all occurrences of the default material with a diff --git a/code/3DSLoader.h b/code/3DSLoader.h index 134f4012b..437ec94b4 100644 --- a/code/3DSLoader.h +++ b/code/3DSLoader.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_3DSIMPORTER_H_INC #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER diff --git a/code/ACLoader.cpp b/code/ACLoader.cpp index fbe8cb009..c040d6bbd 100644 --- a/code/ACLoader.cpp +++ b/code/ACLoader.cpp @@ -53,13 +53,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Subdivision.h" #include "Importer.h" #include "BaseImporter.h" -#include "../include/assimp/Importer.hpp" -#include "../include/assimp/light.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/material.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/config.h" -#include "../include/assimp/IOSystem.hpp" +#include +#include +#include +#include +#include +#include +#include #include using namespace Assimp; diff --git a/code/ACLoader.h b/code/ACLoader.h index 7ea336666..52563adad 100644 --- a/code/ACLoader.h +++ b/code/ACLoader.h @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include struct aiNode; struct aiMesh; diff --git a/code/ASELoader.cpp b/code/ASELoader.cpp index 6f6610786..39a33e9fd 100644 --- a/code/ASELoader.cpp +++ b/code/ASELoader.cpp @@ -50,12 +50,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StringComparison.h" #include "SkeletonMeshBuilder.h" #include "TargetAnimation.h" -#include "../include/assimp/Importer.hpp" -#include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include +#include +#include // utilities #include "fast_atof.h" @@ -225,17 +225,13 @@ void ASEImporter::InternReadFile( const std::string& pFile, + mParser->m_vCameras.size() + mParser->m_vDummies.size()); // Lights - for (std::vector::iterator it = mParser->m_vLights.begin(), - end = mParser->m_vLights.end();it != end; ++it)nodes.push_back(&(*it)); + for (auto &light : mParser->m_vLights)nodes.push_back(&light); // Cameras - for (std::vector::iterator it = mParser->m_vCameras.begin(), - end = mParser->m_vCameras.end();it != end; ++it)nodes.push_back(&(*it)); + for (auto &camera : mParser->m_vCameras)nodes.push_back(&camera); // Meshes - for (std::vector::iterator it = mParser->m_vMeshes.begin(), - end = mParser->m_vMeshes.end();it != end; ++it)nodes.push_back(&(*it)); + for (auto &mesh : mParser->m_vMeshes)nodes.push_back(&mesh); // Dummies - for (std::vector::iterator it = mParser->m_vDummies.begin(), - end = mParser->m_vDummies.end();it != end; ++it)nodes.push_back(&(*it)); + for (auto &dummy : mParser->m_vDummies)nodes.push_back(&dummy); // build the final node graph BuildNodes(nodes); @@ -657,8 +653,8 @@ void ASEImporter::BuildNodes(std::vector& nodes) { ch->mParent = root; // Change the transformation matrix of all nodes - for (std::vector::iterator it = nodes.begin(), end = nodes.end();it != end; ++it) { - aiMatrix4x4& m = (*it)->mTransform; + for (BaseNode *node : nodes) { + aiMatrix4x4& m = node->mTransform; m.Transpose(); // row-order vs column-order } diff --git a/code/ASELoader.h b/code/ASELoader.h index e0cd55d49..b775fc6bb 100644 --- a/code/ASELoader.h +++ b/code/ASELoader.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_ASELOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include struct aiNode; #include "ASEParser.h" diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index 37b7ea0cd..204f8bf62 100644 --- a/code/ASEParser.cpp +++ b/code/ASEParser.cpp @@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ASELoader.h" #include "MaterialSystem.h" #include "fast_atof.h" -#include "../include/assimp/DefaultLogger.hpp" +#include using namespace Assimp; using namespace Assimp::ASE; diff --git a/code/ASEParser.h b/code/ASEParser.h index 0a8931472..667c7c5a0 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_ASEFILEHELPER_H_INC // public ASSIMP headers -#include "../include/assimp/types.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/anim.h" +#include +#include +#include // for some helper routines like IsSpace() #include "ParsingUtils.h" diff --git a/code/AssbinExporter.cpp b/code/AssbinExporter.cpp index 7df58cd2d..9240d3739 100644 --- a/code/AssbinExporter.cpp +++ b/code/AssbinExporter.cpp @@ -41,10 +41,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ASSBIN exporter main code */ #include "assbin_chunks.h" -#include "../include/assimp/version.h" -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include +#include #include "ProcessHelper.h" #include "Exceptional.h" diff --git a/code/AssbinLoader.cpp b/code/AssbinLoader.cpp index 2e8e06f8a..c4261c4cb 100644 --- a/code/AssbinLoader.cpp +++ b/code/AssbinLoader.cpp @@ -51,14 +51,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "AssbinLoader.h" #include "assbin_chunks.h" #include "MemoryIOWrapper.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/anim.h" -#include "../include/assimp/scene.h" +#include +#include +#include #ifdef ASSIMP_BUILD_NO_OWN_ZLIB # include #else -# include "../contrib/zlib/zlib.h" +# include #endif using namespace Assimp; diff --git a/code/AssbinLoader.h b/code/AssbinLoader.h index 10d4f0901..e8c8dd0cb 100644 --- a/code/AssbinLoader.h +++ b/code/AssbinLoader.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_ASSBINIMPORTER_H_INC #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include struct aiMesh; struct aiNode; diff --git a/code/AssimpCExport.cpp b/code/AssimpCExport.cpp index c8c8fc107..c5f26fc47 100644 --- a/code/AssimpCExport.cpp +++ b/code/AssimpCExport.cpp @@ -47,7 +47,7 @@ Assimp C export interface. See Exporter.cpp for some notes. #include "CInterfaceIOWrapper.h" #include "SceneCombiner.h" #include "ScenePrivate.h" -#include "../include/assimp/Exporter.hpp" +#include using namespace Assimp; diff --git a/code/AssxmlExporter.cpp b/code/AssxmlExporter.cpp index bcf805501..f55f0174b 100644 --- a/code/AssxmlExporter.cpp +++ b/code/AssxmlExporter.cpp @@ -43,14 +43,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "./../include/assimp/version.h" #include "ProcessHelper.h" -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include #ifdef ASSIMP_BUILD_NO_OWN_ZLIB # include #else -# include "../contrib/zlib/zlib.h" +# include #endif #include @@ -179,7 +179,7 @@ static std::string encodeXML(const std::string& data) { // ----------------------------------------------------------------------------------- // Write a text model dump -static +static void WriteDump(const aiScene* scene, IOStream* io, bool shortened) { time_t tt = ::time( NULL ); tm* p = ::gmtime( &tt ); diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index a8214814d..1b9ba1433 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -52,10 +52,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ConvertToLHProcess.h" #include "StringUtils.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/anim.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include +#include using namespace Assimp; diff --git a/code/B3DImporter.h b/code/B3DImporter.h index 964ea46d6..92ddc0272 100644 --- a/code/B3DImporter.h +++ b/code/B3DImporter.h @@ -43,9 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_B3DIMPORTER_H_INC #define AI_B3DIMPORTER_H_INC -#include "../include/assimp/types.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/material.h" +#include +#include +#include #include "BaseImporter.h" #include diff --git a/code/BVHLoader.cpp b/code/BVHLoader.cpp index 6cca1f04a..ca6c5d36c 100644 --- a/code/BVHLoader.cpp +++ b/code/BVHLoader.cpp @@ -46,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BVHLoader.h" #include "fast_atof.h" #include "SkeletonMeshBuilder.h" -#include "../include/assimp/Importer.hpp" +#include #include #include "TinyFormatter.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" +#include +#include using namespace Assimp; using namespace Assimp::Formatter; diff --git a/code/BaseImporter.cpp b/code/BaseImporter.cpp index a7e134c54..aa615e592 100644 --- a/code/BaseImporter.cpp +++ b/code/BaseImporter.cpp @@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "FileSystemFilter.h" #include "Importer.h" #include "ByteSwapper.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/Importer.hpp" -#include "../include/assimp/postprocess.h" +#include +#include +#include #include #include #include diff --git a/code/BaseImporter.h b/code/BaseImporter.h index 167a03610..5c9ddfa5e 100644 --- a/code/BaseImporter.h +++ b/code/BaseImporter.h @@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "../include/assimp/types.h" -#include "../include/assimp/ProgressHandler.hpp" +#include +#include struct aiScene; diff --git a/code/BaseProcess.cpp b/code/BaseProcess.cpp index f0fb55e2b..580f89cdb 100644 --- a/code/BaseProcess.cpp +++ b/code/BaseProcess.cpp @@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseImporter.h" #include "BaseProcess.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include #include "Importer.h" using namespace Assimp; diff --git a/code/BaseProcess.h b/code/BaseProcess.h index ec4ba3e4f..148f07284 100644 --- a/code/BaseProcess.h +++ b/code/BaseProcess.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include "../include/assimp/types.h" +#include #include "GenericProperty.h" struct aiScene; diff --git a/code/Bitmap.cpp b/code/Bitmap.cpp index 7611a45e8..ae6d62083 100644 --- a/code/Bitmap.cpp +++ b/code/Bitmap.cpp @@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Bitmap.h" -#include "../include/assimp/texture.h" -#include "../include/assimp/IOStream.hpp" +#include +#include #include "ByteSwapper.h" namespace Assimp { diff --git a/code/BlenderDNA.h b/code/BlenderDNA.h index 4257d9ca5..801d68fce 100644 --- a/code/BlenderDNA.h +++ b/code/BlenderDNA.h @@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseImporter.h" #include "TinyFormatter.h" #include "StreamReader.h" -#include "../include/assimp/DefaultLogger.hpp" +#include #include #include diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index 574cdce9f..5bc358716 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BlenderModifier.h" #include "BlenderBMesh.h" #include "StringUtils.h" -#include "../include/assimp/scene.h" +#include #include "StringComparison.h" #include "StreamReader.h" @@ -554,10 +554,8 @@ void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const } // ------------------------------------------------------------------------------------------------ -void BlenderImporter::BuildMaterials(ConversionData& conv_data) +void BlenderImporter::BuildDefaultMaterial(Blender::ConversionData& conv_data) { - conv_data.materials->reserve(conv_data.materials_raw.size()); - // add a default material if necessary unsigned int index = static_cast( -1 ); for( aiMesh* mesh : conv_data.meshes.get() ) { @@ -588,6 +586,124 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data) mesh->mMaterialIndex = index; } } +} + +void BlenderImporter::AddBlendParams(aiMaterial* result, const Material* source) +{ + aiColor3D diffuseColor(source->r, source->g, source->b); + result->AddProperty(&diffuseColor, 1, "$mat.blend.diffuse.color", 0, 0); + + float diffuseIntensity = source->ref; + result->AddProperty(&diffuseIntensity, 1, "$mat.blend.diffuse.intensity", 0, 0); + + int diffuseShader = source->diff_shader; + result->AddProperty(&diffuseShader, 1, "$mat.blend.diffuse.shader", 0, 0); + + int diffuseRamp = 0; + result->AddProperty(&diffuseRamp, 1, "$mat.blend.diffuse.ramp", 0, 0); + + + aiColor3D specularColor(source->specr, source->specg, source->specb); + result->AddProperty(&specularColor, 1, "$mat.blend.specular.color", 0, 0); + + float specularIntensity = source->spec; + result->AddProperty(&specularIntensity, 1, "$mat.blend.specular.intensity", 0, 0); + + int specularShader = source->spec_shader; + result->AddProperty(&specularShader, 1, "$mat.blend.specular.shader", 0, 0); + + int specularRamp = 0; + result->AddProperty(&specularRamp, 1, "$mat.blend.specular.ramp", 0, 0); + + int specularHardness = source->har; + result->AddProperty(&specularHardness, 1, "$mat.blend.specular.hardness", 0, 0); + + + int transparencyUse = source->mode & MA_TRANSPARENCY ? 1 : 0; + result->AddProperty(&transparencyUse, 1, "$mat.blend.transparency.use", 0, 0); + + int transparencyMethod = source->mode & MA_RAYTRANSP ? 2 : (source->mode & MA_ZTRANSP ? 1 : 0); + result->AddProperty(&transparencyMethod, 1, "$mat.blend.transparency.method", 0, 0); + + float transparencyAlpha = source->alpha; + result->AddProperty(&transparencyAlpha, 1, "$mat.blend.transparency.alpha", 0, 0); + + float transparencySpecular = source->spectra; + result->AddProperty(&transparencySpecular, 1, "$mat.blend.transparency.specular", 0, 0); + + float transparencyFresnel = source->fresnel_tra; + result->AddProperty(&transparencyFresnel, 1, "$mat.blend.transparency.fresnel", 0, 0); + + float transparencyBlend = source->fresnel_tra_i; + result->AddProperty(&transparencyBlend, 1, "$mat.blend.transparency.blend", 0, 0); + + float transparencyIor = source->ang; + result->AddProperty(&transparencyIor, 1, "$mat.blend.transparency.ior", 0, 0); + + float transparencyFilter = source->filter; + result->AddProperty(&transparencyFilter, 1, "$mat.blend.transparency.filter", 0, 0); + + float transparencyFalloff = source->tx_falloff; + result->AddProperty(&transparencyFalloff, 1, "$mat.blend.transparency.falloff", 0, 0); + + float transparencyLimit = source->tx_limit; + result->AddProperty(&transparencyLimit, 1, "$mat.blend.transparency.limit", 0, 0); + + int transparencyDepth = source->ray_depth_tra; + result->AddProperty(&transparencyDepth, 1, "$mat.blend.transparency.depth", 0, 0); + + float transparencyGlossAmount = source->gloss_tra; + result->AddProperty(&transparencyGlossAmount, 1, "$mat.blend.transparency.glossAmount", 0, 0); + + float transparencyGlossThreshold = source->adapt_thresh_tra; + result->AddProperty(&transparencyGlossThreshold, 1, "$mat.blend.transparency.glossThreshold", 0, 0); + + int transparencyGlossSamples = source->samp_gloss_tra; + result->AddProperty(&transparencyGlossSamples, 1, "$mat.blend.transparency.glossSamples", 0, 0); + + + int mirrorUse = source->mode & MA_RAYMIRROR ? 1 : 0; + result->AddProperty(&mirrorUse, 1, "$mat.blend.mirror.use", 0, 0); + + float mirrorReflectivity = source->ray_mirror; + result->AddProperty(&mirrorReflectivity, 1, "$mat.blend.mirror.reflectivity", 0, 0); + + aiColor3D mirrorColor(source->mirr, source->mirg, source->mirb); + result->AddProperty(&mirrorColor, 1, "$mat.blend.mirror.color", 0, 0); + + float mirrorFresnel = source->fresnel_mir; + result->AddProperty(&mirrorFresnel, 1, "$mat.blend.mirror.fresnel", 0, 0); + + float mirrorBlend = source->fresnel_mir_i; + result->AddProperty(&mirrorBlend, 1, "$mat.blend.mirror.blend", 0, 0); + + int mirrorDepth = source->ray_depth; + result->AddProperty(&mirrorDepth, 1, "$mat.blend.mirror.depth", 0, 0); + + float mirrorMaxDist = source->dist_mir; + result->AddProperty(&mirrorMaxDist, 1, "$mat.blend.mirror.maxDist", 0, 0); + + int mirrorFadeTo = source->fadeto_mir; + result->AddProperty(&mirrorFadeTo, 1, "$mat.blend.mirror.fadeTo", 0, 0); + + float mirrorGlossAmount = source->gloss_mir; + result->AddProperty(&mirrorGlossAmount, 1, "$mat.blend.mirror.glossAmount", 0, 0); + + float mirrorGlossThreshold = source->adapt_thresh_mir; + result->AddProperty(&mirrorGlossThreshold, 1, "$mat.blend.mirror.glossThreshold", 0, 0); + + int mirrorGlossSamples = source->samp_gloss_mir; + result->AddProperty(&mirrorGlossSamples, 1, "$mat.blend.mirror.glossSamples", 0, 0); + + float mirrorGlossAnisotropic = source->aniso_gloss_mir; + result->AddProperty(&mirrorGlossAnisotropic, 1, "$mat.blend.mirror.glossAnisotropic", 0, 0); +} + +void BlenderImporter::BuildMaterials(ConversionData& conv_data) +{ + conv_data.materials->reserve(conv_data.materials_raw.size()); + + BuildDefaultMaterial(conv_data); for(std::shared_ptr mat : conv_data.materials_raw) { @@ -604,7 +720,6 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data) aiString name = aiString(mat->id.name+2); // skip over the name prefix 'MA' mout->AddProperty(&name,AI_MATKEY_NAME); - // basic material colors aiColor3D col(mat->r,mat->g,mat->b); if (mat->r || mat->g || mat->b ) { @@ -647,6 +762,8 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data) ResolveTexture(mout,mat.get(),mat->mtex[i].get(),conv_data); } + + AddBlendParams(mout, mat.get()); } } @@ -1049,7 +1166,24 @@ aiLight* BlenderImporter::ConvertLight(const Scene& /*in*/, const Object* obj, c // blender orients directional lights as facing toward -z out->mDirection = aiVector3D(0.f, 0.f, -1.f); + out->mUp = aiVector3D(0.f, 1.f, 0.f); break; + + case Lamp::Type_Area: + out->mType = aiLightSource_AREA; + + if (lamp->area_shape == 0) { + out->mSize = aiVector2D(lamp->area_size, lamp->area_size); + } + else { + out->mSize = aiVector2D(lamp->area_size, lamp->area_sizey); + } + + // blender orients directional lights as facing toward -z + out->mDirection = aiVector3D(0.f, 0.f, -1.f); + out->mUp = aiVector3D(0.f, 1.f, 0.f); + break; + default: break; } diff --git a/code/BlenderLoader.h b/code/BlenderLoader.h index ff13517f3..c964eee32 100644 --- a/code/BlenderLoader.h +++ b/code/BlenderLoader.h @@ -179,9 +179,18 @@ private: ); // -------------------- + void BuildDefaultMaterial( + Blender::ConversionData& conv_data + ); + + void AddBlendParams( + aiMaterial* result, + const Blender::Material* source + ); + void BuildMaterials( Blender::ConversionData& conv_data - ) ; + ); // -------------------- void ResolveTexture( diff --git a/code/BlenderModifier.cpp b/code/BlenderModifier.cpp index 84a727041..24aed25d0 100644 --- a/code/BlenderModifier.cpp +++ b/code/BlenderModifier.cpp @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BlenderModifier.h" #include "SceneCombiner.h" #include "Subdivision.h" -#include "../include/assimp/scene.h" +#include #include #include diff --git a/code/BlenderScene.cpp b/code/BlenderScene.cpp index 0addd013b..f4d07662e 100644 --- a/code/BlenderScene.cpp +++ b/code/BlenderScene.cpp @@ -206,6 +206,10 @@ template <> void Structure :: Convert ( ReadField(dest.att2,"att2",db); ReadField((int&)dest.falloff_type,"falloff_type",db); ReadField(dest.sun_brightness,"sun_brightness",db); + ReadField(dest.area_size,"area_size",db); + ReadField(dest.area_sizey,"area_sizey",db); + ReadField(dest.area_sizez,"area_sizez",db); + ReadField(dest.area_shape,"area_shape",db); db.reader->IncPtr(size); } @@ -297,7 +301,6 @@ template <> void Structure :: Convert ( const FileDatabase& db ) const { - ReadField(dest.id,"id",db); ReadField(dest.r,"r",db); ReadField(dest.g,"g",db); @@ -326,6 +329,91 @@ template <> void Structure :: Convert ( ReadField(dest.spec_shader,"spec_shader",db); ReadFieldPtr(dest.mtex,"*mtex",db); + + ReadField(dest.amb, "amb", db); + ReadField(dest.ang, "ang", db); + ReadField(dest.spectra, "spectra", db); + ReadField(dest.spec, "spec", db); + ReadField(dest.zoffs, "zoffs", db); + ReadField(dest.add, "add", db); + ReadField(dest.fresnel_mir, "fresnel_mir", db); + ReadField(dest.fresnel_mir_i, "fresnel_mir_i", db); + ReadField(dest.fresnel_tra, "fresnel_tra", db); + ReadField(dest.fresnel_tra_i, "fresnel_tra_i", db); + ReadField(dest.filter, "filter", db); + ReadField(dest.tx_limit, "tx_limit", db); + ReadField(dest.tx_falloff, "tx_falloff", db); + ReadField(dest.gloss_mir, "gloss_mir", db); + ReadField(dest.gloss_tra, "gloss_tra", db); + ReadField(dest.adapt_thresh_mir, "adapt_thresh_mir", db); + ReadField(dest.adapt_thresh_tra, "adapt_thresh_tra", db); + ReadField(dest.aniso_gloss_mir, "aniso_gloss_mir", db); + ReadField(dest.dist_mir, "dist_mir", db); + ReadField(dest.hasize, "hasize", db); + ReadField(dest.flaresize, "flaresize", db); + ReadField(dest.subsize, "subsize", db); + ReadField(dest.flareboost, "flareboost", db); + ReadField(dest.strand_sta, "strand_sta", db); + ReadField(dest.strand_end, "strand_end", db); + ReadField(dest.strand_ease, "strand_ease", db); + ReadField(dest.strand_surfnor, "strand_surfnor", db); + ReadField(dest.strand_min, "strand_min", db); + ReadField(dest.strand_widthfade, "strand_widthfade", db); + ReadField(dest.sbias, "sbias", db); + ReadField(dest.lbias, "lbias", db); + ReadField(dest.shad_alpha, "shad_alpha", db); + ReadField(dest.param, "param", db); + ReadField(dest.rms, "rms", db); + ReadField(dest.rampfac_col, "rampfac_col", db); + ReadField(dest.rampfac_spec, "rampfac_spec", db); + ReadField(dest.friction, "friction", db); + ReadField(dest.fh, "fh", db); + ReadField(dest.reflect, "reflect", db); + ReadField(dest.fhdist, "fhdist", db); + ReadField(dest.xyfrict, "xyfrict", db); + ReadField(dest.sss_radius, "sss_radius", db); + ReadField(dest.sss_col, "sss_col", db); + ReadField(dest.sss_error, "sss_error", db); + ReadField(dest.sss_scale, "sss_scale", db); + ReadField(dest.sss_ior, "sss_ior", db); + ReadField(dest.sss_colfac, "sss_colfac", db); + ReadField(dest.sss_texfac, "sss_texfac", db); + ReadField(dest.sss_front, "sss_front", db); + ReadField(dest.sss_back, "sss_back", db); + + ReadField(dest.material_type, "material_type", db); + ReadField(dest.flag, "flag", db); + ReadField(dest.ray_depth, "ray_depth", db); + ReadField(dest.ray_depth_tra, "ray_depth_tra", db); + ReadField(dest.samp_gloss_mir, "samp_gloss_mir", db); + ReadField(dest.samp_gloss_tra, "samp_gloss_tra", db); + ReadField(dest.fadeto_mir, "fadeto_mir", db); + ReadField(dest.shade_flag, "shade_flag", db); + ReadField(dest.flarec, "flarec", db); + ReadField(dest.starc, "starc", db); + ReadField(dest.linec, "linec", db); + ReadField(dest.ringc, "ringc", db); + ReadField(dest.pr_lamp, "pr_lamp", db); + ReadField(dest.pr_texture, "pr_texture", db); + ReadField(dest.ml_flag, "ml_flag", db); + ReadField(dest.diff_shader, "diff_shader", db); + ReadField(dest.spec_shader, "spec_shader", db); + ReadField(dest.texco, "texco", db); + ReadField(dest.mapto, "mapto", db); + ReadField(dest.ramp_show, "ramp_show", db); + ReadField(dest.pad3, "pad3", db); + ReadField(dest.dynamode, "dynamode", db); + ReadField(dest.pad2, "pad2", db); + ReadField(dest.sss_flag, "sss_flag", db); + ReadField(dest.sss_preset, "sss_preset", db); + ReadField(dest.shadowonly_flag, "shadowonly_flag", db); + ReadField(dest.index, "index", db); + ReadField(dest.vcol_alpha, "vcol_alpha", db); + ReadField(dest.pad4, "pad4", db); + + ReadField(dest.seed1, "seed1", db); + ReadField(dest.seed2, "seed2", db); + db.reader->IncPtr(size); } diff --git a/code/BlenderScene.h b/code/BlenderScene.h index 051b54ed3..9de0fcb39 100644 --- a/code/BlenderScene.h +++ b/code/BlenderScene.h @@ -242,6 +242,9 @@ struct MDeformVert : ElemBase { // ------------------------------------------------------------------------------- #define MA_RAYMIRROR 0x40000 +#define MA_TRANSPARENCY 0x10000 +#define MA_RAYTRANSP 0x20000 +#define MA_ZTRANSP 0x00040 struct Material : ElemBase { ID id FAIL; @@ -261,6 +264,89 @@ struct Material : ElemBase { float darkness; float refrac; + + float amb; + float ang; + float spectra; + float spec; + float zoffs; + float add; + float fresnel_mir; + float fresnel_mir_i; + float fresnel_tra; + float fresnel_tra_i; + float filter; + float tx_limit; + float tx_falloff; + float gloss_mir; + float gloss_tra; + float adapt_thresh_mir; + float adapt_thresh_tra; + float aniso_gloss_mir; + float dist_mir; + float hasize; + float flaresize; + float subsize; + float flareboost; + float strand_sta; + float strand_end; + float strand_ease; + float strand_surfnor; + float strand_min; + float strand_widthfade; + float sbias; + float lbias; + float shad_alpha; + float param; + float rms; + float rampfac_col; + float rampfac_spec; + float friction; + float fh; + float reflect; + float fhdist; + float xyfrict; + float sss_radius; + float sss_col; + float sss_error; + float sss_scale; + float sss_ior; + float sss_colfac; + float sss_texfac; + float sss_front; + float sss_back; + + short material_type; + short flag; + short ray_depth; + short ray_depth_tra; + short samp_gloss_mir; + short samp_gloss_tra; + short fadeto_mir; + short shade_flag; + short flarec; + short starc; + short linec; + short ringc; + short pr_lamp; + short pr_texture; + short ml_flag; + short texco; + short mapto; + short ramp_show; + short pad3; + short dynamode; + short pad2; + short sss_flag; + short sss_preset; + short shadowonly_flag; + short index; + short vcol_alpha; + short pad4; + + char seed1; + char seed2; + std::shared_ptr group; short diff_shader WARN; @@ -371,8 +457,8 @@ struct Lamp : ElemBase { //short ray_samp, ray_sampy, ray_sampz; //short ray_samp_type; - //short area_shape; - //float area_size, area_sizey, area_sizez; + short area_shape; + float area_size, area_sizey, area_sizez; //float adapt_thresh; //short ray_samp_method; diff --git a/code/ByteSwapper.h b/code/ByteSwapper.h index db499552b..37538e7cb 100644 --- a/code/ByteSwapper.h +++ b/code/ByteSwapper.h @@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_BYTESWAPPER_H_INC #define AI_BYTESWAPPER_H_INC -#include "../include/assimp/ai_assert.h" -#include "../include/assimp/types.h" +#include +#include #include #if _MSC_VER >= 1400 diff --git a/code/CInterfaceIOWrapper.h b/code/CInterfaceIOWrapper.h index 9032b8391..beffd8678 100644 --- a/code/CInterfaceIOWrapper.h +++ b/code/CInterfaceIOWrapper.h @@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_CIOSYSTEM_H_INCLUDED #define AI_CIOSYSTEM_H_INCLUDED -#include "../include/assimp/cfileio.h" -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/IOSystem.hpp" +#include +#include +#include namespace Assimp { diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 913c7e634..2d39a00c2 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -202,7 +202,7 @@ SET(ASSIMP_LOADER_SRCS "") SET(ASSIMP_IMPORTERS_ENABLED "") # list of enabled importers SET(ASSIMP_IMPORTERS_DISABLED "") # disabled list (used to print) -ADD_ASSIMP_IMPORTER(3DS +ADD_ASSIMP_IMPORTER( 3DS 3DSConverter.cpp 3DSHelper.h 3DSLoader.cpp @@ -211,41 +211,41 @@ ADD_ASSIMP_IMPORTER(3DS 3DSExporter.cpp ) -ADD_ASSIMP_IMPORTER(AC +ADD_ASSIMP_IMPORTER( AC ACLoader.cpp ACLoader.h ) -ADD_ASSIMP_IMPORTER(ASE +ADD_ASSIMP_IMPORTER( ASE ASELoader.cpp ASELoader.h ASEParser.cpp ASEParser.h ) -ADD_ASSIMP_IMPORTER(ASSBIN +ADD_ASSIMP_IMPORTER( ASSBIN AssbinExporter.h AssbinExporter.cpp AssbinLoader.h AssbinLoader.cpp ) -ADD_ASSIMP_IMPORTER(ASSXML +ADD_ASSIMP_IMPORTER( ASSXML AssxmlExporter.h AssxmlExporter.cpp ) -ADD_ASSIMP_IMPORTER(B3D +ADD_ASSIMP_IMPORTER( B3D B3DImporter.cpp B3DImporter.h ) -ADD_ASSIMP_IMPORTER(BVH +ADD_ASSIMP_IMPORTER( BVH BVHLoader.cpp BVHLoader.h ) -ADD_ASSIMP_IMPORTER(COLLADA +ADD_ASSIMP_IMPORTER( COLLADA ColladaHelper.h ColladaLoader.cpp ColladaLoader.h @@ -255,35 +255,39 @@ ADD_ASSIMP_IMPORTER(COLLADA ColladaExporter.cpp ) -ADD_ASSIMP_IMPORTER(DXF +ADD_ASSIMP_IMPORTER( DXF DXFLoader.cpp DXFLoader.h DXFHelper.h ) -ADD_ASSIMP_IMPORTER(CSM +ADD_ASSIMP_IMPORTER( CSM CSMLoader.cpp CSMLoader.h ) -ADD_ASSIMP_IMPORTER(HMP +ADD_ASSIMP_IMPORTER( HMP HMPFileData.h HMPLoader.cpp HMPLoader.h HalfLifeFileData.h ) -#FIXME: allow to set IRRMESH by option -ADD_ASSIMP_IMPORTER(IRR - IRRLoader.cpp - IRRLoader.h +ADD_ASSIMP_IMPORTER( IRRMESH IRRMeshLoader.cpp IRRMeshLoader.h IRRShared.cpp IRRShared.h ) -ADD_ASSIMP_IMPORTER(LWO +ADD_ASSIMP_IMPORTER( IRR + IRRLoader.cpp + IRRLoader.h + IRRShared.cpp + IRRShared.h +) + +ADD_ASSIMP_IMPORTER( LWO LWOAnimation.cpp LWOAnimation.h LWOBLoader.cpp @@ -293,39 +297,39 @@ ADD_ASSIMP_IMPORTER(LWO LWOMaterial.cpp ) -ADD_ASSIMP_IMPORTER(LWS +ADD_ASSIMP_IMPORTER( LWS LWSLoader.cpp LWSLoader.h ) -ADD_ASSIMP_IMPORTER(MD2 +ADD_ASSIMP_IMPORTER( MD2 MD2FileData.h MD2Loader.cpp MD2Loader.h MD2NormalTable.h ) -ADD_ASSIMP_IMPORTER(MD3 +ADD_ASSIMP_IMPORTER( MD3 MD3FileData.h MD3Loader.cpp MD3Loader.h ) -ADD_ASSIMP_IMPORTER(MD5 +ADD_ASSIMP_IMPORTER( MD5 MD5Loader.cpp MD5Loader.h MD5Parser.cpp MD5Parser.h ) -ADD_ASSIMP_IMPORTER(MDC +ADD_ASSIMP_IMPORTER( MDC MDCFileData.h MDCLoader.cpp MDCLoader.h MDCNormalTable.h ) -ADD_ASSIMP_IMPORTER(MDL +ADD_ASSIMP_IMPORTER( MDL MDLDefaultColorMap.h MDLFileData.h MDLLoader.cpp @@ -339,22 +343,22 @@ SET( MaterialSystem_SRCS ) SOURCE_GROUP( MaterialSystem FILES ${MaterialSystem_SRCS}) -ADD_ASSIMP_IMPORTER(NFF +ADD_ASSIMP_IMPORTER( NFF NFFLoader.cpp NFFLoader.h ) -ADD_ASSIMP_IMPORTER(NDO +ADD_ASSIMP_IMPORTER( NDO NDOLoader.cpp NDOLoader.h ) -ADD_ASSIMP_IMPORTER(OFF +ADD_ASSIMP_IMPORTER( OFF OFFLoader.cpp OFFLoader.h ) -ADD_ASSIMP_IMPORTER(OBJ +ADD_ASSIMP_IMPORTER( OBJ ObjFileData.h ObjFileImporter.cpp ObjFileImporter.h @@ -363,12 +367,11 @@ ADD_ASSIMP_IMPORTER(OBJ ObjFileParser.cpp ObjFileParser.h ObjTools.h - ObjExporter.h ObjExporter.cpp ) -ADD_ASSIMP_IMPORTER(OGRE +ADD_ASSIMP_IMPORTER( OGRE OgreImporter.h OgreStructs.h OgreParsingUtils.h @@ -381,7 +384,7 @@ ADD_ASSIMP_IMPORTER(OGRE OgreMaterial.cpp ) -ADD_ASSIMP_IMPORTER(OPENGEX +ADD_ASSIMP_IMPORTER( OPENGEX OpenGEXExporter.cpp OpenGEXExporter.h OpenGEXImporter.cpp @@ -389,7 +392,7 @@ ADD_ASSIMP_IMPORTER(OPENGEX OpenGEXStructs.h ) -ADD_ASSIMP_IMPORTER(PLY +ADD_ASSIMP_IMPORTER( PLY PlyLoader.cpp PlyLoader.h PlyParser.cpp @@ -398,18 +401,18 @@ ADD_ASSIMP_IMPORTER(PLY PlyExporter.h ) -ADD_ASSIMP_IMPORTER(MS3D +ADD_ASSIMP_IMPORTER( MS3D MS3DLoader.cpp MS3DLoader.h ) -ADD_ASSIMP_IMPORTER(COB +ADD_ASSIMP_IMPORTER( COB COBLoader.cpp COBLoader.h COBScene.h ) -ADD_ASSIMP_IMPORTER(BLEND +ADD_ASSIMP_IMPORTER( BLEND BlenderLoader.cpp BlenderLoader.h BlenderDNA.cpp @@ -427,7 +430,7 @@ ADD_ASSIMP_IMPORTER(BLEND BlenderTessellator.cpp ) -ADD_ASSIMP_IMPORTER(IFC +ADD_ASSIMP_IMPORTER( IFC IFCLoader.cpp IFCLoader.h IFCReaderGen.cpp @@ -450,13 +453,13 @@ if (MSVC AND ASSIMP_BUILD_IFC_IMPORTER) set_source_files_properties(IFCReaderGen.cpp PROPERTIES COMPILE_FLAGS "/bigobj") endif (MSVC AND ASSIMP_BUILD_IFC_IMPORTER) -ADD_ASSIMP_IMPORTER(XGL +ADD_ASSIMP_IMPORTER( XGL XGLLoader.cpp XGLLoader.h ) -ADD_ASSIMP_IMPORTER(FBX +ADD_ASSIMP_IMPORTER( FBX FBXImporter.cpp FBXCompileConfig.h FBXImporter.h @@ -539,12 +542,12 @@ SET( PostProcessing_SRCS ) SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS}) -ADD_ASSIMP_IMPORTER(Q3D +ADD_ASSIMP_IMPORTER( Q3D Q3DLoader.cpp Q3DLoader.h ) -ADD_ASSIMP_IMPORTER(Q3BSP +ADD_ASSIMP_IMPORTER( Q3BSP Q3BSPFileData.h Q3BSPFileParser.h Q3BSPFileParser.cpp @@ -554,39 +557,39 @@ ADD_ASSIMP_IMPORTER(Q3BSP Q3BSPZipArchive.cpp ) -ADD_ASSIMP_IMPORTER(RAW +ADD_ASSIMP_IMPORTER( RAW RawLoader.cpp RawLoader.h ) -ADD_ASSIMP_IMPORTER(SIB +ADD_ASSIMP_IMPORTER( SIB SIBImporter.cpp SIBImporter.h ) -ADD_ASSIMP_IMPORTER(SMD +ADD_ASSIMP_IMPORTER( SMD SMDLoader.cpp SMDLoader.h ) -ADD_ASSIMP_IMPORTER(STL +ADD_ASSIMP_IMPORTER( STL STLLoader.cpp STLLoader.h STLExporter.h STLExporter.cpp ) -ADD_ASSIMP_IMPORTER(TERRAGEN +ADD_ASSIMP_IMPORTER( TERRAGEN TerragenLoader.cpp TerragenLoader.h ) -ADD_ASSIMP_IMPORTER(3D +ADD_ASSIMP_IMPORTER( 3D UnrealLoader.cpp UnrealLoader.h ) -ADD_ASSIMP_IMPORTER(X +ADD_ASSIMP_IMPORTER( X XFileHelper.h XFileImporter.cpp XFileImporter.h @@ -596,26 +599,23 @@ ADD_ASSIMP_IMPORTER(X XFileExporter.cpp ) -ADD_ASSIMP_IMPORTER(GLTF +ADD_ASSIMP_IMPORTER( GLTF glTFAsset.h glTFAsset.inl glTFAssetWriter.h glTFAssetWriter.inl - glTFImporter.cpp glTFImporter.h - glTFExporter.h glTFExporter.cpp ) -ADD_ASSIMP_IMPORTER(3MF +ADD_ASSIMP_IMPORTER( 3MF D3MFImporter.h D3MFImporter.cpp D3MFOpcPackage.h D3MFOpcPackage.cpp - ) @@ -809,7 +809,7 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES ) if (APPLE) - SET_TARGET_PROPERTIES( assimp PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") + SET_TARGET_PROPERTIES( assimp PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR}") endif() # Build against external unzip, or add ../contrib/unzip so @@ -818,7 +818,7 @@ if (UNZIP_FOUND) INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES}) else (UNZIP_FOUND) - INCLUDE_DIRECTORIES("../contrib/unzip") + INCLUDE_DIRECTORIES("../") endif (UNZIP_FOUND) INSTALL( TARGETS assimp diff --git a/code/COBLoader.cpp b/code/COBLoader.cpp index e6fe76891..4f0ad3980 100644 --- a/code/COBLoader.cpp +++ b/code/COBLoader.cpp @@ -54,9 +54,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "LineSplitter.h" #include "TinyFormatter.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include using namespace Assimp; diff --git a/code/CSMLoader.cpp b/code/CSMLoader.cpp index 6a32141c7..925abf4bd 100644 --- a/code/CSMLoader.cpp +++ b/code/CSMLoader.cpp @@ -51,12 +51,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "SkeletonMeshBuilder.h" #include "ParsingUtils.h" #include "fast_atof.h" -#include "../include/assimp/Importer.hpp" +#include #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/anim.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include +#include using namespace Assimp; diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index a2d419af2..6a6dc67b6 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -49,9 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "SceneCombiner.h" #include "DefaultIOSystem.h" #include "XMLTools.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/Exporter.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include #include "Exceptional.h" @@ -530,7 +530,7 @@ void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* // Reimplementation of isalnum(,C locale), because AppVeyor does not see standard version. static bool isalnum_C(char c) { - return strchr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c); + return ( nullptr != strchr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c) ); } // ------------------------------------------------------------------------------------------------ @@ -1016,7 +1016,7 @@ void ColladaExporter::WriteSceneLibrary() // start recursive write at the root node for( size_t a = 0; a < mScene->mRootNode->mNumChildren; ++a ) - WriteNode( mScene->mRootNode->mChildren[a]); + WriteNode( mScene, mScene->mRootNode->mChildren[a]); PopTag(); mOutput << startstr << "" << endstr; @@ -1024,11 +1024,26 @@ void ColladaExporter::WriteSceneLibrary() mOutput << startstr << "" << endstr; } +// ------------------------------------------------------------------------------------------------ +// Helper to find a bone by name in the scene +aiBone* findBone( const aiScene* scene, const char * name) { + for (size_t m=0; mmNumMeshes; m++) { + aiMesh * mesh = scene->mMeshes[m]; + for (size_t b=0; bmNumBones; b++) { + aiBone * bone = mesh->mBones[b]; + if (0 == strcmp(name, bone->mName.C_Str())) { + return bone; + } + } + } + return NULL; +} + // ------------------------------------------------------------------------------------------------ // Recursively writes the given node -void ColladaExporter::WriteNode(aiNode* pNode) +void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode) { - // the must have a name + // the node must have a name if (pNode->mName.length == 0) { std::stringstream ss; @@ -1036,8 +1051,21 @@ void ColladaExporter::WriteNode(aiNode* pNode) pNode->mName.Set(ss.str()); } + // If the node is associated with a bone, it is a joint node (JOINT) + // otherwise it is a normal node (NODE) + const char * node_type; + if (NULL == findBone(pScene, pNode->mName.C_Str())) { + node_type = "NODE"; + } else { + node_type = "JOINT"; + } + const std::string node_name_escaped = XMLEscape(pNode->mName.data); - mOutput << startstr << "" << endstr; + mOutput << startstr + << "" << endstr; PushTag(); // write transformation - we can directly put the matrix there @@ -1102,7 +1130,7 @@ void ColladaExporter::WriteNode(aiNode* pNode) // recurse into subnodes for( size_t a = 0; a < pNode->mNumChildren; ++a ) - WriteNode( pNode->mChildren[a]); + WriteNode( pScene, pNode->mChildren[a]); PopTag(); mOutput << startstr << "" << endstr; diff --git a/code/ColladaExporter.h b/code/ColladaExporter.h index 52a160224..5e73628eb 100644 --- a/code/ColladaExporter.h +++ b/code/ColladaExporter.h @@ -44,11 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_COLLADAEXPORTER_H_INC #define AI_COLLADAEXPORTER_H_INC -#include "../include/assimp/ai_assert.h" -#include "../include/assimp/material.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/light.h" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include +#include +#include #include #include #include @@ -114,7 +114,7 @@ protected: void WriteSceneLibrary(); /// Recursively writes the given node - void WriteNode( aiNode* pNode); + void WriteNode( const aiScene* scene, aiNode* pNode); /// Enters a new xml element, which increases the indentation void PushTag() { startstr.append( " "); } diff --git a/code/ColladaHelper.h b/code/ColladaHelper.h index 0a635a559..5a516429c 100644 --- a/code/ColladaHelper.h +++ b/code/ColladaHelper.h @@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "../include/assimp/light.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/material.h" +#include +#include +#include struct aiMaterial; diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 9338452a5..6cc0f858a 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -44,9 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER -#include "../include/assimp/anim.h" -#include "../include/assimp/scene.h" #include "ColladaLoader.h" +#include +#include +#include +#include #include "ColladaParser.h" #include "fast_atof.h" @@ -56,8 +58,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "time.h" #include "math.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/Importer.hpp" #include #include "Defines.h" @@ -276,21 +276,20 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co resolved.reserve(pNode->mNodeInstances.size()); // ... and iterate through all nodes to be instanced as children of pNode - for (std::vector::const_iterator it = pNode->mNodeInstances.begin(), - end = pNode->mNodeInstances.end(); it != end; ++it) + for (const auto &nodeInst: pNode->mNodeInstances) { // find the corresponding node in the library - const ColladaParser::NodeLibrary::const_iterator itt = pParser.mNodeLibrary.find((*it).mNode); + const ColladaParser::NodeLibrary::const_iterator itt = pParser.mNodeLibrary.find(nodeInst.mNode); const Collada::Node* nd = itt == pParser.mNodeLibrary.end() ? NULL : (*itt).second; // FIX for http://sourceforge.net/tracker/?func=detail&aid=3054873&group_id=226462&atid=1067632 // need to check for both name and ID to catch all. To avoid breaking valid files, // the workaround is only enabled when the first attempt to resolve the node has failed. if (!nd) { - nd = FindNode(pParser.mRootNode,(*it).mNode); + nd = FindNode(pParser.mRootNode, nodeInst.mNode); } if (!nd) - DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode); + DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + nodeInst.mNode); else { // attach this node to the list of children @@ -1320,11 +1319,10 @@ void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser, // Fills materials from the collada material definitions void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pScene*/) { - for (std::vector >::iterator it = newMats.begin(), - end = newMats.end(); it != end; ++it) + for (auto &elem : newMats) { - aiMaterial& mat = (aiMaterial&)*it->second; - Collada::Effect& effect = *it->first; + aiMaterial& mat = (aiMaterial&)*elem.second; + Collada::Effect& effect = *elem.first; // resolve shading mode int shadeMode; diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index f20da819f..527e2ed5f 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -51,12 +51,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ColladaParser.h" #include "fast_atof.h" #include "ParsingUtils.h" -#include -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/light.h" +#include "StringUtils.h" +#include +#include +#include #include "TinyFormatter.h" +#include + using namespace Assimp; using namespace Assimp::Collada; @@ -3115,24 +3117,29 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vectorwarn( format() << "Vertex input type is empty." ); + return IT_Invalid; + } + + if( semantic == "POSITION") return IT_Position; - else if( pSemantic == "TEXCOORD") + else if( semantic == "TEXCOORD") return IT_Texcoord; - else if( pSemantic == "NORMAL") + else if( semantic == "NORMAL") return IT_Normal; - else if( pSemantic == "COLOR") + else if( semantic == "COLOR") return IT_Color; - else if( pSemantic == "VERTEX") + else if( semantic == "VERTEX") return IT_Vertex; - else if( pSemantic == "BINORMAL" || pSemantic == "TEXBINORMAL") + else if( semantic == "BINORMAL" || semantic == "TEXBINORMAL") return IT_Bitangent; - else if( pSemantic == "TANGENT" || pSemantic == "TEXTANGENT") + else if( semantic == "TANGENT" || semantic == "TEXTANGENT") return IT_Tangent; - DefaultLogger::get()->warn( format() << "Unknown vertex input type \"" << pSemantic << "\". Ignoring." ); + DefaultLogger::get()->warn( format() << "Unknown vertex input type \"" << semantic << "\". Ignoring." ); return IT_Invalid; } diff --git a/code/ColladaParser.h b/code/ColladaParser.h index bbfad6d93..9193e2027 100644 --- a/code/ColladaParser.h +++ b/code/ColladaParser.h @@ -47,7 +47,7 @@ #include "irrXMLWrapper.h" #include "ColladaHelper.h" -#include "../include/assimp/ai_assert.h" +#include #include "TinyFormatter.h" #include diff --git a/code/ComputeUVMappingProcess.h b/code/ComputeUVMappingProcess.h index fd138ef86..db4287863 100644 --- a/code/ComputeUVMappingProcess.h +++ b/code/ComputeUVMappingProcess.h @@ -44,14 +44,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_COMPUTEUVMAPPING_H_INC #include "BaseProcess.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/material.h" -#include "../include/assimp/types.h" +#include +#include +#include class ComputeUVMappingTest; -namespace Assimp - { +namespace Assimp { // --------------------------------------------------------------------------- /** ComputeUVMappingProcess - converts special mappings, such as spherical, diff --git a/code/ConvertToLHProcess.cpp b/code/ConvertToLHProcess.cpp index 05f8acd14..017282796 100644 --- a/code/ConvertToLHProcess.cpp +++ b/code/ConvertToLHProcess.cpp @@ -49,9 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ConvertToLHProcess.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include using namespace Assimp; diff --git a/code/ConvertToLHProcess.h b/code/ConvertToLHProcess.h index 8c34056f7..0c5f91c96 100644 --- a/code/ConvertToLHProcess.h +++ b/code/ConvertToLHProcess.h @@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_CONVERTTOLHPROCESS_H_INC #define AI_CONVERTTOLHPROCESS_H_INC -#include "../include/assimp/types.h" +#include #include "BaseProcess.h" struct aiMesh; diff --git a/code/D3MFImporter.cpp b/code/D3MFImporter.cpp index f664e972d..1a9716828 100644 --- a/code/D3MFImporter.cpp +++ b/code/D3MFImporter.cpp @@ -40,13 +40,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "D3MFImporter.h" -#include "../include/assimp/scene.h" -#include "../contrib/unzip/unzip.h" -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include +#include +#include #include "irrXMLWrapper.h" #include "StringComparison.h" +#include "StringUtils.h" #include @@ -58,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "../include/assimp/ai_assert.h" +#include #include "D3MFOpcPackage.h" @@ -224,9 +225,9 @@ private: aiVector3D ReadVertex() { aiVector3D vertex; - vertex.x = std::strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr); - vertex.y = std::strtof(xmlReader->getAttributeValue(D3MF::XmlTag::y.c_str()), nullptr); - vertex.z = std::strtof(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr); + vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr); + vertex.y = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::y.c_str()), nullptr); + vertex.z = ai_strtof>(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr); return vertex; } diff --git a/code/D3MFOpcPackage.cpp b/code/D3MFOpcPackage.cpp index acd7619e5..7cc1dd50b 100644 --- a/code/D3MFOpcPackage.cpp +++ b/code/D3MFOpcPackage.cpp @@ -40,6 +40,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "D3MFOpcPackage.h" +#include "Exceptional.h" + +#include +#include +#include +#include +#include #include #include @@ -48,19 +55,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include - -#include "../contrib/unzip/unzip.h" -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" - - -#include "../include/assimp/ai_assert.h" - -#include "Exceptional.h" - - - #ifndef ASSIMP_BUILD_NO_3MF_IMPORTER namespace Assimp { @@ -324,8 +318,8 @@ D3MFZipArchive::D3MFZipArchive(IOSystem* pIOHandler, const std::string& rFile) // ------------------------------------------------------------------------------------------------ // Destructor. D3MFZipArchive::~D3MFZipArchive() { - for( std::map::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it ) { - delete it->second; + for(auto &file : m_ArchiveMap) { + delete file.second; } m_ArchiveMap.clear(); @@ -398,8 +392,8 @@ void D3MFZipArchive::Close(IOStream *pFile) { void D3MFZipArchive::getFileList(std::vector &rFileList) { rFileList.clear(); - for(std::map::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it) { - rFileList.push_back(it->first); + for(const auto &file : m_ArchiveMap) { + rFileList.push_back(file.first); } } diff --git a/code/D3MFOpcPackage.h b/code/D3MFOpcPackage.h index 08e657e6e..dd8a40aab 100644 --- a/code/D3MFOpcPackage.h +++ b/code/D3MFOpcPackage.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "../include/assimp/IOSystem.hpp" +#include #include "irrXMLWrapper.h" namespace Assimp { diff --git a/code/DXFHelper.h b/code/DXFHelper.h index 853e9a201..1947469a8 100644 --- a/code/DXFHelper.h +++ b/code/DXFHelper.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StreamReader.h" #include "fast_atof.h" #include -#include "../include/assimp/DefaultLogger.hpp" +#include namespace Assimp { namespace DXF { diff --git a/code/DXFLoader.cpp b/code/DXFLoader.cpp index 63759465d..3e69eff1e 100644 --- a/code/DXFLoader.cpp +++ b/code/DXFLoader.cpp @@ -52,8 +52,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fast_atof.h" #include "DXFHelper.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" +#include +#include #include using namespace Assimp; diff --git a/code/DeboneProcess.h b/code/DeboneProcess.h index 82f533841..5920473e2 100644 --- a/code/DeboneProcess.h +++ b/code/DeboneProcess.h @@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "BaseProcess.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/scene.h" +#include +#include class DeboneTest; diff --git a/code/DefaultIOStream.cpp b/code/DefaultIOStream.cpp index 31116e697..f1809d894 100644 --- a/code/DefaultIOStream.cpp +++ b/code/DefaultIOStream.cpp @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../include/assimp/ai_assert.h" +#include #include "DefaultIOStream.h" #include #include diff --git a/code/DefaultIOStream.h b/code/DefaultIOStream.h index c83f958d4..510fc1d05 100644 --- a/code/DefaultIOStream.h +++ b/code/DefaultIOStream.h @@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_DEFAULTIOSTREAM_H_INC #include -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/importerdesc.h" +#include +#include #include "Defines.h" namespace Assimp { diff --git a/code/DefaultIOSystem.cpp b/code/DefaultIOSystem.cpp index ef142b178..8c44c8bd0 100644 --- a/code/DefaultIOSystem.cpp +++ b/code/DefaultIOSystem.cpp @@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "DefaultIOStream.h" #include "StringComparison.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/ai_assert.h" +#include +#include #include diff --git a/code/DefaultIOSystem.h b/code/DefaultIOSystem.h index 32d191c2d..49960a847 100644 --- a/code/DefaultIOSystem.h +++ b/code/DefaultIOSystem.h @@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_DEFAULTIOSYSTEM_H_INC #define AI_DEFAULTIOSYSTEM_H_INC -#include "../include/assimp/IOSystem.hpp" +#include namespace Assimp { diff --git a/code/DefaultLogger.cpp b/code/DefaultLogger.cpp index 9a7a81105..5364bd8bc 100644 --- a/code/DefaultLogger.cpp +++ b/code/DefaultLogger.cpp @@ -50,9 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StdOStreamLogStream.h" #include "FileLogStream.h" #include "StringUtils.h" -#include "../include/assimp/NullLogger.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/ai_assert.h" +#include +#include +#include #include #include diff --git a/code/DefaultProgressHandler.h b/code/DefaultProgressHandler.h index 8c0abfbfc..b729e4bfa 100644 --- a/code/DefaultProgressHandler.h +++ b/code/DefaultProgressHandler.h @@ -44,7 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_DEFAULTPROGRESSHANDLER_H #define INCLUDED_AI_DEFAULTPROGRESSHANDLER_H -#include "../include/assimp/ProgressHandler.hpp" +#include + namespace Assimp { // ------------------------------------------------------------------------------------ diff --git a/code/Exporter.cpp b/code/Exporter.cpp index b4a4ae2de..af2267a62 100644 --- a/code/Exporter.cpp +++ b/code/Exporter.cpp @@ -64,10 +64,10 @@ Here we implement only the C++ interface (Assimp::Exporter). #include "Exceptional.h" #include "ScenePrivate.h" #include -#include "../include/assimp/Exporter.hpp" -#include "../include/assimp/mesh.h" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/scene.h" +#include +#include +#include +#include #include namespace Assimp { diff --git a/code/FBXBinaryTokenizer.cpp b/code/FBXBinaryTokenizer.cpp index aaa63d4aa..551b174ed 100644 --- a/code/FBXBinaryTokenizer.cpp +++ b/code/FBXBinaryTokenizer.cpp @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "FBXTokenizer.h" #include "FBXUtil.h" -#include "../include/assimp/defs.h" +#include #include #include "Exceptional.h" #include "ByteSwapper.h" diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index cf2b8dbf2..692cda836 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "FBXImporter.h" #include "StringComparison.h" -#include "../include/assimp/scene.h" +#include #include #include @@ -1062,8 +1062,8 @@ void Converter::GenerateTransformationNodeChain( const Model& model, nd->mName.Set( name ); - for ( size_t i = 0; i < TransformationComp_MAXIMUM; ++i ) { - nd->mTransformation = nd->mTransformation * chain[ i ]; + for (const auto &transform : chain) { + nd->mTransformation = nd->mTransformation * transform; } } diff --git a/code/FBXDocument.cpp b/code/FBXDocument.cpp index 4eef04342..cf5f6da86 100644 --- a/code/FBXDocument.cpp +++ b/code/FBXDocument.cpp @@ -269,8 +269,8 @@ Document::Document(const Parser& parser, const ImportSettings& settings) , parser(parser) { // Cannot use array default initialization syntax because vc8 fails on it - for (unsigned int i = 0; i < sizeof(creationTimeStamp) / sizeof(creationTimeStamp[0]); ++i) { - creationTimeStamp[i] = 0; + for (auto &timeStamp : creationTimeStamp) { + timeStamp = 0; } ReadHeader(); diff --git a/code/FBXDocument.h b/code/FBXDocument.h index 7f19bd295..62d463bab 100644 --- a/code/FBXDocument.h +++ b/code/FBXDocument.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "../include/assimp/mesh.h" +#include #include "FBXProperties.h" #include "FBXParser.h" diff --git a/code/FBXImporter.cpp b/code/FBXImporter.cpp index 9d6c4c021..b319da8b6 100644 --- a/code/FBXImporter.cpp +++ b/code/FBXImporter.cpp @@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StreamReader.h" #include "MemoryIOWrapper.h" -#include "../include/assimp/Importer.hpp" +#include namespace Assimp { template<> const std::string LogFunctions::log_prefix = "FBX: "; diff --git a/code/FBXTokenizer.h b/code/FBXTokenizer.h index 47fa7370e..f9f1fb871 100644 --- a/code/FBXTokenizer.h +++ b/code/FBXTokenizer.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "FBXCompileConfig.h" -#include "../include/assimp/ai_assert.h" +#include #include #include diff --git a/code/FileLogStream.h b/code/FileLogStream.h index 6a59af76b..574a63ed6 100644 --- a/code/FileLogStream.h +++ b/code/FileLogStream.h @@ -1,8 +1,8 @@ #ifndef ASSIMP_FILELOGSTREAM_H_INC #define ASSIMP_FILELOGSTREAM_H_INC -#include "../include/assimp/LogStream.hpp" -#include "../include/assimp/IOStream.hpp" +#include +#include #include "DefaultIOSystem.h" namespace Assimp { diff --git a/code/FindDegenerates.h b/code/FindDegenerates.h index 5dffd8a5e..7b945ea3a 100644 --- a/code/FindDegenerates.h +++ b/code/FindDegenerates.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_FINDDEGENERATESPROCESS_H_INC #include "BaseProcess.h" -#include "../include/assimp/mesh.h" +#include class FindDegeneratesProcessTest; namespace Assimp { diff --git a/code/FindInvalidDataProcess.h b/code/FindInvalidDataProcess.h index 6fdd000ed..371569380 100644 --- a/code/FindInvalidDataProcess.h +++ b/code/FindInvalidDataProcess.h @@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_FINDINVALIDDATA_H_INC #include "BaseProcess.h" -#include "../include/assimp/types.h" -#include "../include/assimp/anim.h" +#include +#include struct aiMesh; class FindInvalidDataProcessTest; diff --git a/code/FixNormalsStep.cpp b/code/FixNormalsStep.cpp index 5360e5b83..9249b13e9 100644 --- a/code/FixNormalsStep.cpp +++ b/code/FixNormalsStep.cpp @@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // internal headers #include "FixNormalsStep.h" #include "StringUtils.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/scene.h" +#include +#include +#include #include diff --git a/code/GenFaceNormalsProcess.cpp b/code/GenFaceNormalsProcess.cpp index d0155e0e2..9218d9db8 100644 --- a/code/GenFaceNormalsProcess.cpp +++ b/code/GenFaceNormalsProcess.cpp @@ -45,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "GenFaceNormalsProcess.h" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include #include "Exceptional.h" #include "qnan.h" diff --git a/code/GenFaceNormalsProcess.h b/code/GenFaceNormalsProcess.h index d1c367e1e..f56570078 100644 --- a/code/GenFaceNormalsProcess.h +++ b/code/GenFaceNormalsProcess.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_GENFACENORMALPROCESS_H_INC #include "BaseProcess.h" -#include "../include/assimp/mesh.h" +#include namespace Assimp { diff --git a/code/GenVertexNormalsProcess.h b/code/GenVertexNormalsProcess.h index a639b6ce1..5d8b61ead 100644 --- a/code/GenVertexNormalsProcess.h +++ b/code/GenVertexNormalsProcess.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_GENVERTEXNORMALPROCESS_H_INC #include "BaseProcess.h" -#include "../include/assimp/mesh.h" +#include class GenNormalsTest; diff --git a/code/GenericProperty.h b/code/GenericProperty.h index 5d9dff3f3..507bfb693 100644 --- a/code/GenericProperty.h +++ b/code/GenericProperty.h @@ -41,8 +41,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_GENERIC_PROPERTY_H_INCLUDED #define AI_GENERIC_PROPERTY_H_INCLUDED -#include "./../include/assimp/Importer.hpp" -#include "./../include/assimp/ai_assert.h" +#include +#include #include "Hash.h" #include diff --git a/code/HMPLoader.cpp b/code/HMPLoader.cpp index 7e879a543..560852691 100644 --- a/code/HMPLoader.cpp +++ b/code/HMPLoader.cpp @@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "HMPLoader.h" #include "MD2FileData.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include using namespace Assimp; diff --git a/code/HMPLoader.h b/code/HMPLoader.h index 9d5c77831..4dd0d9840 100644 --- a/code/HMPLoader.h +++ b/code/HMPLoader.h @@ -45,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_HMPLOADER_H_INCLUDED // public ASSIMP headers -#include "../include/assimp/types.h" -#include "../include/assimp/texture.h" -#include "../include/assimp/material.h" +#include +#include +#include // internal headers #include "BaseImporter.h" diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index bd0ec700f..34977f5b0 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC -# include "../contrib/unzip/unzip.h" +# include #endif #include "IFCLoader.h" @@ -60,8 +60,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StreamReader.h" #include "MemoryIOWrapper.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/Importer.hpp" +#include +#include namespace Assimp { diff --git a/code/IFCMaterial.cpp b/code/IFCMaterial.cpp index 161c414c6..7525db089 100644 --- a/code/IFCMaterial.cpp +++ b/code/IFCMaterial.cpp @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER #include "IFCUtil.h" #include -#include "../include/assimp/material.h" +#include namespace Assimp { namespace IFC { diff --git a/code/IFCUtil.h b/code/IFCUtil.h index 9b0634cf6..43d20a434 100644 --- a/code/IFCUtil.h +++ b/code/IFCUtil.h @@ -48,9 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "IFCReaderGen.h" #include "IFCLoader.h" #include "STEPFile.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/material.h" - +#include +#include struct aiNode; diff --git a/code/IRRLoader.cpp b/code/IRRLoader.cpp index fcf894e6a..2d702523d 100644 --- a/code/IRRLoader.cpp +++ b/code/IRRLoader.cpp @@ -59,12 +59,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // We need MathFunctions.h to compute the lcm/gcd of a number #include "MathFunctions.h" #include -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/mesh.h" -#include "../include/assimp/material.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/postprocess.h" +#include +#include +#include +#include +#include +#include using namespace Assimp; @@ -1372,8 +1372,7 @@ void IRRImporter::InternReadFile( const std::string& pFile, /* Now iterate through all cameras and compute their final (horizontal) FOV */ - for (std::vector::iterator it = cameras.begin(), end = cameras.end();it != end; ++it) { - aiCamera* cam = *it; + for (aiCamera *cam : cameras) { // screen aspect could be missing if (cam->mAspect) { diff --git a/code/IRRLoader.h b/code/IRRLoader.h index e3ad849d3..129e0cc03 100644 --- a/code/IRRLoader.h +++ b/code/IRRLoader.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "SceneCombiner.h" #include "Importer.h" #include "StringUtils.h" -#include "../include/assimp/anim.h" +#include namespace Assimp { diff --git a/code/IRRMeshLoader.cpp b/code/IRRMeshLoader.cpp index e92e5ebdf..0a2a54e84 100644 --- a/code/IRRMeshLoader.cpp +++ b/code/IRRMeshLoader.cpp @@ -49,11 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ParsingUtils.h" #include "fast_atof.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/mesh.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/material.h" -#include "../include/assimp/scene.h" +#include +#include +#include +#include +#include #include "Macros.h" diff --git a/code/IRRMeshLoader.h b/code/IRRMeshLoader.h index 13827d073..6c208224c 100644 --- a/code/IRRMeshLoader.h +++ b/code/IRRMeshLoader.h @@ -48,6 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseImporter.h" #include "IRRShared.h" +#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER + namespace Assimp { // --------------------------------------------------------------------------- @@ -92,4 +94,6 @@ protected: } // end of namespace Assimp +#endif // ASSIMP_BUILD_NO_IRRMESH_IMPORTER + #endif // AI_IRRMESHIMPORTER_H_INC diff --git a/code/IRRShared.cpp b/code/IRRShared.cpp index 9feec3354..e38ad1378 100644 --- a/code/IRRShared.cpp +++ b/code/IRRShared.cpp @@ -51,8 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "IRRShared.h" #include "ParsingUtils.h" #include "fast_atof.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/material.h" +#include +#include using namespace Assimp; diff --git a/code/Importer.cpp b/code/Importer.cpp index a9e95cb27..3599138eb 100644 --- a/code/Importer.cpp +++ b/code/Importer.cpp @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Implementation of the CPP-API class #Importer */ -#include "../include/assimp/version.h" +#include // ------------------------------------------------------------------------------------------------ /* Uncomment this line to prevent Assimp from catching unknown exceptions. diff --git a/code/Importer.h b/code/Importer.h index bb1050c56..750b9bbbd 100644 --- a/code/Importer.h +++ b/code/Importer.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "../include/assimp/matrix4x4.h" +#include struct aiScene; diff --git a/code/ImproveCacheLocality.cpp b/code/ImproveCacheLocality.cpp index 46c2bf06f..9fd76508b 100644 --- a/code/ImproveCacheLocality.cpp +++ b/code/ImproveCacheLocality.cpp @@ -52,9 +52,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ImproveCacheLocality.h" #include "VertexTriangleAdjacency.h" #include "StringUtils.h" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include #include #include diff --git a/code/ImproveCacheLocality.h b/code/ImproveCacheLocality.h index 5523ab2bb..d43f37f50 100644 --- a/code/ImproveCacheLocality.h +++ b/code/ImproveCacheLocality.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_IMPROVECACHELOCALITY_H_INC #include "BaseProcess.h" -#include "../include/assimp/types.h" +#include struct aiMesh; diff --git a/code/JoinVerticesProcess.h b/code/JoinVerticesProcess.h index cad66ac9b..af92040d2 100644 --- a/code/JoinVerticesProcess.h +++ b/code/JoinVerticesProcess.h @@ -44,7 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_JOINVERTICESPROCESS_H_INC #include "BaseProcess.h" -#include "../include/assimp/types.h" +#include + struct aiMesh; namespace Assimp diff --git a/code/LWOAnimation.h b/code/LWOAnimation.h index 34dc5e480..257abecdd 100644 --- a/code/LWOAnimation.h +++ b/code/LWOAnimation.h @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_LWO_ANIMATION_INCLUDED #define AI_LWO_ANIMATION_INCLUDED -#include "../include/assimp/anim.h" +#include #include #include diff --git a/code/LWOFileData.h b/code/LWOFileData.h index 9f69bdd5f..d67cf7ec8 100644 --- a/code/LWOFileData.h +++ b/code/LWOFileData.h @@ -52,7 +52,7 @@ The chunks are taken from the official LightWave SDK headers. #include // public ASSIMP headers -#include "../include/assimp/mesh.h" +#include // internal headers #include "IFF.h" diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index caaf21ecb..222ec8e2c 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -53,8 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ByteSwapper.h" #include "ProcessHelper.h" #include "ConvertToLHProcess.h" +#include #include -#include "../include/assimp/IOSystem.hpp" #include #include @@ -246,8 +246,7 @@ void LWOImporter::InternReadFile( const std::string& pFile, apcMeshes.reserve(mLayers->size()*std::min(((unsigned int)mSurfaces->size()/2u), 1u)); unsigned int iDefaultSurface = UINT_MAX; // index of the default surface - for (LayerList::iterator lit = mLayers->begin(), lend = mLayers->end();lit != lend;++lit) { - LWO::Layer& layer = *lit; + for (LWO::Layer &layer : *mLayers) { if (layer.skip) continue; @@ -909,12 +908,12 @@ void LWOImporter::LoadLWO2PolygonTags(unsigned int length) template VMapEntry* FindEntry(std::vector< T >& list,const std::string& name, bool perPoly) { - for (typename std::vector< T >::iterator it = list.begin(), end = list.end();it != end; ++it) { - if ((*it).name == name) { + for (auto & elem : list) { + if (elem.name == name) { if (!perPoly) { DefaultLogger::get()->warn("LWO2: Found two VMAP sections with equal names"); } - return &(*it); + return &elem; } } list.push_back( T() ); @@ -941,8 +940,8 @@ inline void CreateNewEntry(T& chan, unsigned int srcIdx) template inline void CreateNewEntry(std::vector< T >& list, unsigned int srcIdx) { - for (typename std::vector< T >::iterator it = list.begin(), end = list.end();it != end;++it) { - CreateNewEntry( *it, srcIdx ); + for (auto &elem : list) { + CreateNewEntry( elem, srcIdx ); } } diff --git a/code/LWOLoader.h b/code/LWOLoader.h index b0bcc35dc..09d66cf24 100644 --- a/code/LWOLoader.h +++ b/code/LWOLoader.h @@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_LWOLOADER_H_INCLUDED #define AI_LWOLOADER_H_INCLUDED -#include "../include/assimp/types.h" -#include "../include/assimp/material.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include #include "LWOFileData.h" #include "BaseImporter.h" diff --git a/code/LWOMaterial.cpp b/code/LWOMaterial.cpp index b80dae1e8..24a2458cf 100644 --- a/code/LWOMaterial.cpp +++ b/code/LWOMaterial.cpp @@ -90,8 +90,8 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex aiString s; bool ret = false; - for (TextureList::const_iterator it = in.begin(), end = in.end();it != end;++it) { - if (!(*it).enabled || !(*it).bCanUse) + for (const auto &texture : in) { + if (!texture.enabled || !texture.bCanUse) continue; ret = true; @@ -100,7 +100,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex // channels if they're not there. aiTextureMapping mapping; - switch ((*it).mapMode) + switch (texture.mapMode) { case LWO::Texture::Planar: mapping = aiTextureMapping_PLANE; @@ -120,13 +120,13 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex break; case LWO::Texture::UV: { - if( UINT_MAX == (*it).mRealUVIndex ) { + if( UINT_MAX == texture.mRealUVIndex ) { // We have no UV index for this texture, so we can't display it continue; } // add the UV source index - temp = (*it).mRealUVIndex; + temp = texture.mRealUVIndex; pcMat->AddProperty((int*)&temp,1,AI_MATKEY_UVWSRC(type,cur)); mapping = aiTextureMapping_UV; @@ -139,7 +139,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex if (mapping != aiTextureMapping_UV) { // Setup the main axis aiVector3D v; - switch ((*it).majorAxis) { + switch (texture.majorAxis) { case Texture::AXIS_X: v = aiVector3D(1.f,0.f,0.f); break; @@ -156,8 +156,8 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex // Setup UV scalings for cylindric and spherical projections if (mapping == aiTextureMapping_CYLINDER || mapping == aiTextureMapping_SPHERE) { aiUVTransform trafo; - trafo.mScaling.x = (*it).wrapAmountW; - trafo.mScaling.y = (*it).wrapAmountH; + trafo.mScaling.x = texture.wrapAmountW; + trafo.mScaling.y = texture.wrapAmountH; static_assert(sizeof(aiUVTransform)/sizeof(float) == 5, "sizeof(aiUVTransform)/sizeof(float) == 5"); pcMat->AddProperty(&trafo,1,AI_MATKEY_UVTRANSFORM(type,cur)); @@ -171,7 +171,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex // find the corresponding clip (take the last one if multiple // share the same index) ClipList::iterator end = mClips.end(), candidate = end; - temp = (*it).mClipIdx; + temp = texture.mClipIdx; for (ClipList::iterator clip = mClips.begin(); clip != end; ++clip) { if ((*clip).idx == temp) { candidate = clip; @@ -208,7 +208,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex } else { - std::string ss = (*it).mFileName; + std::string ss = texture.mFileName; if (!ss.length()) { DefaultLogger::get()->error("LWOB: Empty file name"); continue; @@ -219,10 +219,10 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex pcMat->AddProperty(&s,AI_MATKEY_TEXTURE(type,cur)); // add the blend factor - pcMat->AddProperty(&(*it).mStrength,1,AI_MATKEY_TEXBLEND(type,cur)); + pcMat->AddProperty(&texture.mStrength,1,AI_MATKEY_TEXBLEND(type,cur)); // add the blend operation - switch ((*it).blendType) + switch (texture.blendType) { case LWO::Texture::Normal: case LWO::Texture::Multiply: @@ -254,11 +254,11 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex pcMat->AddProperty((int*)&mapping,1,AI_MATKEY_MAPPING(type,cur)); // add the u-wrapping - temp = (unsigned int)GetMapMode((*it).wrapModeWidth); + temp = (unsigned int)GetMapMode(texture.wrapModeWidth); pcMat->AddProperty((int*)&temp,1,AI_MATKEY_MAPPINGMODE_U(type,cur)); // add the v-wrapping - temp = (unsigned int)GetMapMode((*it).wrapModeHeight); + temp = (unsigned int)GetMapMode(texture.wrapModeHeight); pcMat->AddProperty((int*)&temp,1,AI_MATKEY_MAPPINGMODE_V(type,cur)); ++cur; @@ -343,16 +343,14 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat) // Now we need to know which shader to use .. iterate through the shader list of // the surface and search for a name which we know ... - for (ShaderList::const_iterator it = surf.mShaders.begin(), end = surf.mShaders.end();it != end;++it) { - //if (!(*it).enabled)continue; - - if ((*it).functionName == "LW_SuperCelShader" || (*it).functionName == "AH_CelShader") { + for (const auto &shader : surf.mShaders) { + if (shader.functionName == "LW_SuperCelShader" || shader.functionName == "AH_CelShader") { DefaultLogger::get()->info("LWO2: Mapping LW_SuperCelShader/AH_CelShader to aiShadingMode_Toon"); m = aiShadingMode_Toon; break; } - else if ((*it).functionName == "LW_RealFresnel" || (*it).functionName == "LW_FastFresnel") { + else if (shader.functionName == "LW_RealFresnel" || shader.functionName == "LW_FastFresnel") { DefaultLogger::get()->info("LWO2: Mapping LW_RealFresnel/LW_FastFresnel to aiShadingMode_Fresnel"); m = aiShadingMode_Fresnel; @@ -360,7 +358,7 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat) } else { - DefaultLogger::get()->warn("LWO2: Unknown surface shader: " + (*it).functionName); + DefaultLogger::get()->warn("LWO2: Unknown surface shader: " + shader.functionName); } } if (surf.mMaximumSmoothAngle <= 0.0f) @@ -381,20 +379,20 @@ char LWOImporter::FindUVChannels(LWO::TextureList& list, LWO::Layer& /*layer*/,LWO::UVChannel& uv, unsigned int next) { char ret = 0; - for (TextureList::iterator it = list.begin(), end = list.end();it != end;++it) { + for (auto &texture : list) { // Ignore textures with non-UV mappings for the moment. - if (!(*it).enabled || !(*it).bCanUse || (*it).mapMode != LWO::Texture::UV) { + if (!texture.enabled || !texture.bCanUse || texture.mapMode != LWO::Texture::UV) { continue; } - if ((*it).mUVChannelIndex == uv.name) { + if (texture.mUVChannelIndex == uv.name) { ret = 1; // got it. - if ((*it).mRealUVIndex == UINT_MAX || (*it).mRealUVIndex == next) + if (texture.mRealUVIndex == UINT_MAX || texture.mRealUVIndex == next) { - (*it).mRealUVIndex = next; + texture.mRealUVIndex = next; } else { // channel mismatch. need to duplicate the material. diff --git a/code/LWSLoader.cpp b/code/LWSLoader.cpp index 4e8cb8172..a81c15a6e 100644 --- a/code/LWSLoader.cpp +++ b/code/LWSLoader.cpp @@ -55,9 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "SkeletonMeshBuilder.h" #include "ConvertToLHProcess.h" #include "Importer.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/IOSystem.hpp" +#include +#include +#include #include diff --git a/code/LimitBoneWeightsProcess.cpp b/code/LimitBoneWeightsProcess.cpp index 23990272f..e7fd9ab60 100644 --- a/code/LimitBoneWeightsProcess.cpp +++ b/code/LimitBoneWeightsProcess.cpp @@ -43,9 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "LimitBoneWeightsProcess.h" #include "StringUtils.h" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include #include using namespace Assimp; diff --git a/code/LogAux.h b/code/LogAux.h index 4b0c59cd1..f754903c6 100644 --- a/code/LogAux.h +++ b/code/LogAux.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "TinyFormatter.h" #include "Exceptional.h" -#include "../include/assimp/DefaultLogger.hpp" +#include namespace Assimp { diff --git a/code/MD2FileData.h b/code/MD2FileData.h index 4bb5db4ca..f7a494335 100644 --- a/code/MD2FileData.h +++ b/code/MD2FileData.h @@ -45,12 +45,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_MD2FILEHELPER_H_INC #define AI_MD2FILEHELPER_H_INC -#include "../include/assimp/types.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/anim.h" +#include +#include +#include #include -#include "./../include/assimp/Compiler/pushpack1.h" +#include namespace Assimp { namespace MD2 { @@ -147,7 +147,7 @@ struct Skin char name[AI_MD2_MAXQPATH]; /* texture file name */ } PACK_STRUCT; -#include "./../include/assimp/Compiler/poppack1.h" +#include // --------------------------------------------------------------------------- diff --git a/code/MD2Loader.cpp b/code/MD2Loader.cpp index bb171a1bd..b4c124774 100644 --- a/code/MD2Loader.cpp +++ b/code/MD2Loader.cpp @@ -46,18 +46,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "MD2Loader.h" #include "ByteSwapper.h" #include "MD2NormalTable.h" // shouldn't be included by other units -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/Importer.hpp" +#include +#include +#include +#include #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" - - using namespace Assimp; using namespace Assimp::MD2; - // helper macro to determine the size of an array #if (!defined ARRAYSIZE) # define ARRAYSIZE(_array) (int(sizeof(_array) / sizeof(_array[0]))) diff --git a/code/MD2Loader.h b/code/MD2Loader.h index 05acc3ae0..126c16359 100644 --- a/code/MD2Loader.h +++ b/code/MD2Loader.h @@ -45,14 +45,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_MD2LOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include #include "ByteSwapper.h" - #include "MD2FileData.h" + struct aiNode; -namespace Assimp { - +namespace Assimp { using namespace MD2; diff --git a/code/MD3FileData.h b/code/MD3FileData.h index 57dbf990b..88a40f230 100644 --- a/code/MD3FileData.h +++ b/code/MD3FileData.h @@ -51,11 +51,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "../include/assimp/types.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/anim.h" +#include +#include +#include -#include "./../include/assimp/Compiler/pushpack1.h" +#include namespace Assimp { namespace MD3 { diff --git a/code/MD3Loader.cpp b/code/MD3Loader.cpp index 81ab37f70..8294da489 100644 --- a/code/MD3Loader.cpp +++ b/code/MD3Loader.cpp @@ -57,11 +57,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "RemoveComments.h" #include "ParsingUtils.h" #include "Importer.h" -#include "../include/assimp/DefaultLogger.hpp" +#include #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/material.h" -#include "../include/assimp/scene.h" +#include +#include +#include #include diff --git a/code/MD3Loader.h b/code/MD3Loader.h index e5e7dcc07..6b8143a97 100644 --- a/code/MD3Loader.h +++ b/code/MD3Loader.h @@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ByteSwapper.h" #include "MD3FileData.h" #include "StringComparison.h" -#include "../include/assimp/types.h" +#include #include diff --git a/code/MD5Loader.cpp b/code/MD5Loader.cpp index 4c26a9ea2..7927c9ab1 100644 --- a/code/MD5Loader.cpp +++ b/code/MD5Loader.cpp @@ -52,13 +52,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StringComparison.h" #include "fast_atof.h" #include "SkeletonMeshBuilder.h" -#include "../include/assimp/Importer.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include +#include #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" - - using namespace Assimp; diff --git a/code/MD5Loader.h b/code/MD5Loader.h index 9683f6751..9dfc08226 100644 --- a/code/MD5Loader.h +++ b/code/MD5Loader.h @@ -49,7 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseImporter.h" #include "MD5Parser.h" -#include "../include/assimp/types.h" +#include + struct aiNode; struct aiNodeAnim; diff --git a/code/MD5Parser.cpp b/code/MD5Parser.cpp index cf8d5a9f5..df666751b 100644 --- a/code/MD5Parser.cpp +++ b/code/MD5Parser.cpp @@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fast_atof.h" #include "ParsingUtils.h" #include "StringComparison.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/mesh.h" +#include +#include @@ -193,13 +193,13 @@ bool MD5Parser::ParseSection(Section& out) // skip all spaces ... handle EOL correctly #define AI_MD5_SKIP_SPACES() if(!SkipSpaces(&sz)) \ - MD5Parser::ReportWarning("Unexpected end of line",(*eit).iLineNumber); + MD5Parser::ReportWarning("Unexpected end of line",elem.iLineNumber); // read a triple float in brackets: (1.0 1.0 1.0) #define AI_MD5_READ_TRIPLE(vec) \ AI_MD5_SKIP_SPACES(); \ if ('(' != *sz++) \ - MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber); \ + MD5Parser::ReportWarning("Unexpected token: ( was expected",elem.iLineNumber); \ AI_MD5_SKIP_SPACES(); \ sz = fast_atoreal_move(sz,(float&)vec.x); \ AI_MD5_SKIP_SPACES(); \ @@ -208,7 +208,7 @@ bool MD5Parser::ParseSection(Section& out) sz = fast_atoreal_move(sz,(float&)vec.z); \ AI_MD5_SKIP_SPACES(); \ if (')' != *sz++) \ - MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber); + MD5Parser::ReportWarning("Unexpected token: ) was expected",elem.iLineNumber); // parse a string, enclosed in quotation marks or not #define AI_MD5_PARSE_STRING(out) \ @@ -220,7 +220,7 @@ bool MD5Parser::ParseSection(Section& out) szStart++; \ if ('\"' != *(szEnd-=1)) { \ MD5Parser::ReportWarning("Expected closing quotation marks in string", \ - (*eit).iLineNumber); \ + elem.iLineNumber); \ continue; \ } \ } \ @@ -244,11 +244,11 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) } else if ((*iter).mName == "joints") { // "origin" -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 ) - for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end();eit != eitEnd; ++eit){ + for (const auto & elem : (*iter).mElements){ mJoints.push_back(BoneDesc()); BoneDesc& desc = mJoints.back(); - const char* sz = (*eit).szStart; + const char* sz = elem.szStart; AI_MD5_PARSE_STRING(desc.mName); AI_MD5_SKIP_SPACES(); @@ -263,8 +263,8 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) mMeshes.push_back(MeshDesc()); MeshDesc& desc = mMeshes.back(); - for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end();eit != eitEnd; ++eit){ - const char* sz = (*eit).szStart; + for (const auto & elem : (*iter).mElements){ + const char* sz = elem.szStart; // shader attribute if (TokenMatch(sz,"shader",6)) { @@ -297,14 +297,14 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) VertexDesc& vert = desc.mVertices[idx]; if ('(' != *sz++) - MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber); + MD5Parser::ReportWarning("Unexpected token: ( was expected",elem.iLineNumber); AI_MD5_SKIP_SPACES(); sz = fast_atoreal_move(sz,(float&)vert.mUV.x); AI_MD5_SKIP_SPACES(); sz = fast_atoreal_move(sz,(float&)vert.mUV.y); AI_MD5_SKIP_SPACES(); if (')' != *sz++) - MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber); + MD5Parser::ReportWarning("Unexpected token: ) was expected",elem.iLineNumber); AI_MD5_SKIP_SPACES(); vert.mFirstWeight = ::strtoul10(sz,&sz); AI_MD5_SKIP_SPACES(); @@ -357,11 +357,11 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) for (SectionList::const_iterator iter = mSections.begin(), iterEnd = mSections.end();iter != iterEnd;++iter) { if ((*iter).mName == "hierarchy") { // "sheath" 0 63 6 - for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end();eit != eitEnd; ++eit) { + for (const auto & elem : (*iter).mElements) { mAnimatedBones.push_back ( AnimBoneDesc () ); AnimBoneDesc& desc = mAnimatedBones.back(); - const char* sz = (*eit).szStart; + const char* sz = elem.szStart; AI_MD5_PARSE_STRING(desc.mName); AI_MD5_SKIP_SPACES(); @@ -371,7 +371,7 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) // flags (highest is 2^6-1) AI_MD5_SKIP_SPACES(); if(63 < (desc.iFlags = ::strtoul10(sz,&sz))){ - MD5Parser::ReportWarning("Invalid flag combination in hierarchy section",(*eit).iLineNumber); + MD5Parser::ReportWarning("Invalid flag combination in hierarchy section",elem.iLineNumber); } AI_MD5_SKIP_SPACES(); @@ -381,8 +381,8 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) } else if((*iter).mName == "baseframe") { // ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000242 0.707107 ) - for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end(); eit != eitEnd; ++eit) { - const char* sz = (*eit).szStart; + for (const auto & elem : (*iter).mElements) { + const char* sz = elem.szStart; mBaseFrames.push_back ( BaseFrameDesc () ); BaseFrameDesc& desc = mBaseFrames.back(); @@ -407,8 +407,8 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) } // now read all elements (continuous list of floats) - for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end(); eit != eitEnd; ++eit){ - const char* sz = (*eit).szStart; + for (const auto & elem : (*iter).mElements){ + const char* sz = elem.szStart; while (SkipSpacesAndLineEnd(&sz)) { float f;sz = fast_atoreal_move(sz,f); desc.mValues.push_back(f); @@ -455,13 +455,13 @@ MD5CameraParser::MD5CameraParser(SectionList& mSections) cuts.reserve(strtoul10((*iter).mGlobalValue.c_str())); } else if ((*iter).mName == "cuts") { - for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end(); eit != eitEnd; ++eit){ - cuts.push_back(strtoul10((*eit).szStart)+1); + for (const auto & elem : (*iter).mElements){ + cuts.push_back(strtoul10(elem.szStart)+1); } } else if ((*iter).mName == "camera") { - for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end(); eit != eitEnd; ++eit){ - const char* sz = (*eit).szStart; + for (const auto & elem : (*iter).mElements){ + const char* sz = elem.szStart; frames.push_back(CameraAnimFrameDesc()); CameraAnimFrameDesc& cur = frames.back(); diff --git a/code/MD5Parser.h b/code/MD5Parser.h index 5d5e608bb..78ade8430 100644 --- a/code/MD5Parser.h +++ b/code/MD5Parser.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_MD5PARSER_H_INCLUDED #define AI_MD5PARSER_H_INCLUDED -#include "../include/assimp/types.h" +#include #include "ParsingUtils.h" #include #include diff --git a/code/MDCFileData.h b/code/MDCFileData.h index da6735a3e..c98828c28 100644 --- a/code/MDCFileData.h +++ b/code/MDCFileData.h @@ -49,11 +49,11 @@ http://themdcfile.planetwolfenstein.gamespy.com/MDC_File_Format.pdf #ifndef AI_MDCFILEHELPER_H_INC #define AI_MDCFILEHELPER_H_INC -#include "../include/assimp/types.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/anim.h" +#include +#include +#include -#include "./../include/assimp/Compiler/pushpack1.h" +#include #include namespace Assimp { @@ -202,7 +202,7 @@ struct Shader } PACK_STRUCT; -#include "./../include/assimp/Compiler/poppack1.h" +#include // --------------------------------------------------------------------------- diff --git a/code/MDCLoader.cpp b/code/MDCLoader.cpp index 3d988fe25..661447acf 100644 --- a/code/MDCLoader.cpp +++ b/code/MDCLoader.cpp @@ -48,11 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "MDCLoader.h" #include "MD3FileData.h" #include "MDCNormalTable.h" // shouldn't be included by other units -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/Importer.hpp" +#include +#include +#include +#include #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" using namespace Assimp; diff --git a/code/MDCLoader.h b/code/MDCLoader.h index 3cadc4ae4..fcfbc642d 100644 --- a/code/MDCLoader.h +++ b/code/MDCLoader.h @@ -44,13 +44,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_MDCLOADER_H_INCLUDED #define AI_MDCLOADER_H_INCLUDED -#include "../include/assimp/types.h" +#include #include "BaseImporter.h" #include "MDCFileData.h" #include "ByteSwapper.h" -namespace Assimp { +namespace Assimp { + using namespace MDC; // --------------------------------------------------------------------------- diff --git a/code/MDLLoader.cpp b/code/MDLLoader.cpp index a7165828e..ba5c4c32c 100644 --- a/code/MDLLoader.cpp +++ b/code/MDLLoader.cpp @@ -49,16 +49,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_MDL_IMPORTER #include "MDLLoader.h" +#include "Macros.h" +#include "qnan.h" #include "MDLDefaultColorMap.h" #include "MD2FileData.h" #include "StringUtils.h" -#include "../include/assimp/Importer.hpp" +#include +#include +#include +#include + #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "Macros.h" -#include "qnan.h" using namespace Assimp; diff --git a/code/MDLMaterialLoader.cpp b/code/MDLMaterialLoader.cpp index 2499eae64..d1502d6fb 100644 --- a/code/MDLMaterialLoader.cpp +++ b/code/MDLMaterialLoader.cpp @@ -48,10 +48,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "MDLLoader.h" #include "MDLDefaultColorMap.h" #include "StringUtils.h" -#include "../include/assimp/texture.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include +#include #include "qnan.h" #include "Defines.h" diff --git a/code/MS3DLoader.cpp b/code/MS3DLoader.cpp index 6a0d21be8..ef16a756a 100644 --- a/code/MS3DLoader.cpp +++ b/code/MS3DLoader.cpp @@ -50,9 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // internal headers #include "MS3DLoader.h" #include "StreamReader.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/IOSystem.hpp" +#include +#include +#include using namespace Assimp; diff --git a/code/MakeVerboseFormat.cpp b/code/MakeVerboseFormat.cpp index 451a61635..d51642cf6 100644 --- a/code/MakeVerboseFormat.cpp +++ b/code/MakeVerboseFormat.cpp @@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "MakeVerboseFormat.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include using namespace Assimp; diff --git a/code/MaterialSystem.cpp b/code/MaterialSystem.cpp index 02f971737..94ca4364e 100644 --- a/code/MaterialSystem.cpp +++ b/code/MaterialSystem.cpp @@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fast_atof.h" #include "ParsingUtils.h" #include "MaterialSystem.h" -#include "../include/assimp/types.h" -#include "../include/assimp/material.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include #include "Macros.h" using namespace Assimp; diff --git a/code/MemoryIOWrapper.h b/code/MemoryIOWrapper.h index acd6d8633..d6aaafae0 100644 --- a/code/MemoryIOWrapper.h +++ b/code/MemoryIOWrapper.h @@ -43,9 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_MEMORYIOSTREAM_H_INC #define AI_MEMORYIOSTREAM_H_INC -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/ai_assert.h" +#include +#include +#include #include namespace Assimp { diff --git a/code/NDOLoader.cpp b/code/NDOLoader.cpp index 699e97051..f04eb5345 100644 --- a/code/NDOLoader.cpp +++ b/code/NDOLoader.cpp @@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_NDO_IMPORTER #include "NDOLoader.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include #include "StreamReader.h" using namespace Assimp; diff --git a/code/NDOLoader.h b/code/NDOLoader.h index 1a6e333f1..4fd315691 100644 --- a/code/NDOLoader.h +++ b/code/NDOLoader.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_NDO_LOADER_H #define INCLUDED_AI_NDO_LOADER_H -#include "../include/assimp/vector3.h" +#include #include "BaseImporter.h" #include #include diff --git a/code/NFFLoader.cpp b/code/NFFLoader.cpp index a3286b779..8bec63ea3 100644 --- a/code/NFFLoader.cpp +++ b/code/NFFLoader.cpp @@ -48,13 +48,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "NFFLoader.h" #include "ParsingUtils.h" #include "StandardShapes.h" +#include "qnan.h" #include "fast_atof.h" #include "RemoveComments.h" +#include +#include +#include #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" -#include "qnan.h" using namespace Assimp; @@ -673,12 +673,11 @@ void NFFImporter::InternReadFile( const std::string& pFile, if ('t' == line[0]) { currentMeshWithUVCoords = NULL; - for (std::vector::iterator it = meshesWithUVCoords.begin(), end = meshesWithUVCoords.end(); - it != end;++it) + for (auto &mesh : meshesWithUVCoords) { - if ((*it).shader == s) + if (mesh.shader == s) { - currentMeshWithUVCoords = &(*it); + currentMeshWithUVCoords = &mesh; break; } } @@ -695,12 +694,11 @@ void NFFImporter::InternReadFile( const std::string& pFile, else if ('p' == line[1]) { currentMeshWithNormals = NULL; - for (std::vector::iterator it = meshesWithNormals.begin(), end = meshesWithNormals.end(); - it != end;++it) + for (auto &mesh : meshesWithNormals) { - if ((*it).shader == s) + if (mesh.shader == s) { - currentMeshWithNormals = &(*it); + currentMeshWithNormals = &mesh; break; } } @@ -717,12 +715,11 @@ void NFFImporter::InternReadFile( const std::string& pFile, else { currentMesh = NULL; - for (std::vector::iterator it = meshes.begin(), end = meshes.end(); - it != end;++it) + for (auto &mesh : meshes) { - if ((*it).shader == s) + if (mesh.shader == s) { - currentMesh = &(*it); + currentMesh = &mesh; break; } } diff --git a/code/NFFLoader.h b/code/NFFLoader.h index 5339cbe78..2b5232645 100644 --- a/code/NFFLoader.h +++ b/code/NFFLoader.h @@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_NFFLOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" -#include "../include/assimp/material.h" +#include +#include #include diff --git a/code/OFFLoader.cpp b/code/OFFLoader.cpp index be5b383b6..fd0542fdf 100644 --- a/code/OFFLoader.cpp +++ b/code/OFFLoader.cpp @@ -51,9 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ParsingUtils.h" #include "fast_atof.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include using namespace Assimp; diff --git a/code/OFFLoader.h b/code/OFFLoader.h index a4f38c3ae..f01dc6244 100644 --- a/code/OFFLoader.h +++ b/code/OFFLoader.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_OFFLOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include #include namespace Assimp { diff --git a/code/ObjFileData.h b/code/ObjFileData.h index 370d0e4fb..f4abd643f 100644 --- a/code/ObjFileData.h +++ b/code/ObjFileData.h @@ -240,6 +240,8 @@ struct Mesh { unsigned int m_uiMaterialIndex; /// True, if normals are stored. bool m_hasNormals; + /// True, if vertex colors are stored. + bool m_hasVertexColors; /// Constructor explicit Mesh( const std::string &name ) @@ -289,6 +291,8 @@ struct Model std::vector m_Vertices; //! vector with all generated normals std::vector m_Normals; + //! vector with all vertex colors + std::vector m_VertexColors; //! Group map GroupMap m_Groups; //! Group to face id assignment diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index a0e016ba5..082709dc7 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -416,6 +416,10 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel, if ( !pModel->m_Normals.empty() && pObjMesh->m_hasNormals ) pMesh->mNormals = new aiVector3D[ pMesh->mNumVertices ]; + // Allocate buffer for vertex-color vectors + if ( !pModel->m_VertexColors.empty() ) + pMesh->mColors[0] = new aiColor4D[ pMesh->mNumVertices ]; + // Allocate buffer for texture coordinates if ( !pModel->m_TextureCoord.empty() && pObjMesh->m_uiUVCoordinates[0] ) { @@ -449,6 +453,13 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel, pMesh->mNormals[ newIndex ] = pModel->m_Normals[ normal ]; } + // Copy all vertex colors + if ( !pModel->m_VertexColors.empty()) + { + const aiVector3D color = pModel->m_VertexColors[ vertex ]; + pMesh->mColors[0][ newIndex ] = aiColor4D(color.x, color.y, color.z, 1.0); + } + // Copy all texture coordinates if ( !pModel->m_TextureCoord.empty() && vertexIndex < pSourceFace->m_pTexturCoords->size()) { diff --git a/code/ObjFileImporter.h b/code/ObjFileImporter.h index 37420406c..b03d00b9b 100644 --- a/code/ObjFileImporter.h +++ b/code/ObjFileImporter.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define OBJ_FILE_IMPORTER_H_INC #include "BaseImporter.h" -#include "../include/assimp/material.h" +#include #include struct aiMesh; diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index a6f515aba..79bc299bc 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -136,8 +136,14 @@ void ObjFileParser::parseFile() { ++m_DataIt; if (*m_DataIt == ' ' || *m_DataIt == '\t') { - // read in vertex definition - getVector3(m_pModel->m_Vertices); + size_t numComponents = getNumComponentsInLine(); + if (numComponents == 3) { + // read in vertex definition + getVector3(m_pModel->m_Vertices); + } else if (numComponents == 6) { + // read vertex and vertex-color + getTwoVectors3(m_pModel->m_Vertices, m_pModel->m_VertexColors); + } } else if (*m_DataIt == 't') { // read in texture coordinate ( 2D or 3D ) ++m_DataIt; @@ -257,8 +263,7 @@ void ObjFileParser::copyNextLine(char *pBuffer, size_t length) pBuffer[ index ] = '\0'; } -// ------------------------------------------------------------------- -void ObjFileParser::getVector( std::vector &point3d_array ) { +size_t ObjFileParser::getNumComponentsInLine() { size_t numComponents( 0 ); const char* tmp( &m_DataIt[0] ); while( !IsLineEnd( *tmp ) ) { @@ -268,6 +273,12 @@ void ObjFileParser::getVector( std::vector &point3d_array ) { SkipToken( tmp ); ++numComponents; } + return numComponents; +} + +// ------------------------------------------------------------------- +void ObjFileParser::getVector( std::vector &point3d_array ) { + size_t numComponents = getNumComponentsInLine(); float x, y, z; if( 2 == numComponents ) { copyNextWord( m_buffer, Buffersize ); @@ -309,6 +320,35 @@ void ObjFileParser::getVector3( std::vector &point3d_array ) { m_DataIt = skipLine( m_DataIt, m_DataItEnd, m_uiLine ); } +// ------------------------------------------------------------------- +// Get values for two 3D vectors on the same line +void ObjFileParser::getTwoVectors3( std::vector &point3d_array_a, std::vector &point3d_array_b ) { + float x, y, z; + copyNextWord(m_buffer, Buffersize); + x = (float) fast_atof(m_buffer); + + copyNextWord(m_buffer, Buffersize); + y = (float) fast_atof(m_buffer); + + copyNextWord( m_buffer, Buffersize ); + z = ( float ) fast_atof( m_buffer ); + + point3d_array_a.push_back( aiVector3D( x, y, z ) ); + + copyNextWord(m_buffer, Buffersize); + x = (float) fast_atof(m_buffer); + + copyNextWord(m_buffer, Buffersize); + y = (float) fast_atof(m_buffer); + + copyNextWord( m_buffer, Buffersize ); + z = ( float ) fast_atof( m_buffer ); + + point3d_array_b.push_back( aiVector3D( x, y, z ) ); + + m_DataIt = skipLine( m_DataIt, m_DataItEnd, m_uiLine ); +} + // ------------------------------------------------------------------- // Get values for a new 2D vector instance void ObjFileParser::getVector2( std::vector &point2d_array ) { diff --git a/code/ObjFileParser.h b/code/ObjFileParser.h index 7170f0d50..f1be764f0 100644 --- a/code/ObjFileParser.h +++ b/code/ObjFileParser.h @@ -89,6 +89,8 @@ private: void getVector( std::vector &point3d_array ); /// Stores the following 3d vector. void getVector3( std::vector &point3d_array ); + /// Stores the following two 3d vectors on the line. + void getTwoVectors3( std::vector &point3d_array_a, std::vector &point3d_array_b ); /// Stores the following 3d vector. void getVector2(std::vector &point2d_array); /// Stores the following face. @@ -119,6 +121,8 @@ private: bool needsNewMesh( const std::string &rMaterialName ); /// Error report in token void reportErrorTokenInFace(); + /// Get the number of components in a line. + size_t getNumComponentsInLine(); private: // Copy and assignment constructor should be private diff --git a/code/OgreBinarySerializer.cpp b/code/OgreBinarySerializer.cpp index dd0b57c00..ce17cea6a 100644 --- a/code/OgreBinarySerializer.cpp +++ b/code/OgreBinarySerializer.cpp @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OgreParsingUtils.h" #include "TinyFormatter.h" -#include "../include/assimp/DefaultLogger.hpp" +#include #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER @@ -501,10 +501,8 @@ void OgreBinarySerializer::NormalizeBoneWeights(VertexData *vertexData) const Some exporters wont care if the sum of all bone weights for a single vertex equals 1 or not, so validate here. */ const float epsilon = 0.05f; - for(std::set::const_iterator iter=influencedVertices.begin(), end=influencedVertices.end(); iter != end; ++iter) + for (const uint32_t vertexIndex : influencedVertices) { - const uint32_t vertexIndex = (*iter); - float sum = 0.0f; for (VertexBoneAssignmentList::const_iterator baIter=vertexData->boneAssignments.begin(), baEnd=vertexData->boneAssignments.end(); baIter != baEnd; ++baIter) { @@ -513,10 +511,10 @@ void OgreBinarySerializer::NormalizeBoneWeights(VertexData *vertexData) const } if ((sum < (1.0f - epsilon)) || (sum > (1.0f + epsilon))) { - for (VertexBoneAssignmentList::iterator baIter=vertexData->boneAssignments.begin(), baEnd=vertexData->boneAssignments.end(); baIter != baEnd; ++baIter) + for (auto &boneAssign : vertexData->boneAssignments) { - if (baIter->vertexIndex == vertexIndex) - baIter->weight /= sum; + if (boneAssign.vertexIndex == vertexIndex) + boneAssign.weight /= sum; } } } diff --git a/code/OgreImporter.cpp b/code/OgreImporter.cpp index 36d03e677..504f6a96f 100644 --- a/code/OgreImporter.cpp +++ b/code/OgreImporter.cpp @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OgreImporter.h" #include "OgreBinarySerializer.h" #include "OgreXmlSerializer.h" -#include "../include/assimp/Importer.hpp" +#include #include static const aiImporterDesc desc = { diff --git a/code/OgreImporter.h b/code/OgreImporter.h index 60140f673..8b2179502 100644 --- a/code/OgreImporter.h +++ b/code/OgreImporter.h @@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OgreStructs.h" #include "OgreParsingUtils.h" -#include "../include/assimp/material.h" +#include namespace Assimp { diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index 98becbb6d..f9da9d584 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OgreImporter.h" #include "TinyFormatter.h" -#include "../include/assimp/material.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include #include "fast_atof.h" #include diff --git a/code/OgreStructs.cpp b/code/OgreStructs.cpp index 566c51e0f..e2e8c8103 100644 --- a/code/OgreStructs.cpp +++ b/code/OgreStructs.cpp @@ -42,8 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OgreStructs.h" #include "TinyFormatter.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include #include "Exceptional.h" @@ -258,12 +258,11 @@ void IVertexData::AddVertexMapping(uint32_t oldIndex, uint32_t newIndex) void IVertexData::BoneAssignmentsForVertex(uint32_t currentIndex, uint32_t newIndex, VertexBoneAssignmentList &dest) const { - for (VertexBoneAssignmentList::const_iterator iter=boneAssignments.begin(), end=boneAssignments.end(); - iter!=end; ++iter) + for (const auto &boneAssign : boneAssignments) { - if (iter->vertexIndex == currentIndex) + if (boneAssign.vertexIndex == currentIndex) { - VertexBoneAssignment a = (*iter); + VertexBoneAssignment a = boneAssign; a.vertexIndex = newIndex; dest.push_back(a); } @@ -289,10 +288,9 @@ AssimpVertexBoneWeightList IVertexData::AssimpBoneWeights(size_t vertices) std::set IVertexData::ReferencedBonesByWeights() const { std::set referenced; - for (VertexBoneAssignmentList::const_iterator iter=boneAssignments.begin(), end=boneAssignments.end(); - iter!=end; ++iter) + for (const auto &boneAssign : boneAssignments) { - referenced.insert(iter->boneIndex); + referenced.insert(boneAssign.boneIndex); } return referenced; } @@ -318,10 +316,10 @@ void VertexData::Reset() uint32_t VertexData::VertexSize(uint16_t source) const { uint32_t size = 0; - for(VertexElementList::const_iterator iter=vertexElements.begin(), end=vertexElements.end(); iter != end; ++iter) + for(const auto &element : vertexElements) { - if (iter->source == source) - size += iter->Size(); + if (element.source == source) + size += element.Size(); } return size; } @@ -335,9 +333,8 @@ MemoryStream *VertexData::VertexBuffer(uint16_t source) VertexElement *VertexData::GetVertexElement(VertexElement::Semantic semantic, uint16_t index) { - for(VertexElementList::iterator iter=vertexElements.begin(), end=vertexElements.end(); iter != end; ++iter) + for(auto & element : vertexElements) { - VertexElement &element = (*iter); if (element.semantic == semantic && element.index == index) return &element; } @@ -427,16 +424,16 @@ void Mesh::Reset() OGRE_SAFE_DELETE(skeleton) OGRE_SAFE_DELETE(sharedVertexData) - for(size_t i=0, len=subMeshes.size(); iBoneById(children[i]); + Bone *child = skeleton->BoneById(boneId); if (!child) { - throw DeadlyImportError(Formatter::format() << "CalculateWorldMatrixAndDefaultPose: Failed to find child bone " << children[i] << " for parent " << id << " " << name); + throw DeadlyImportError(Formatter::format() << "CalculateWorldMatrixAndDefaultPose: Failed to find child bone " << boneId << " for parent " << id << " " << name); } child->CalculateWorldMatrixAndDefaultPose(skeleton); } diff --git a/code/OgreStructs.h b/code/OgreStructs.h index 430ba672d..c4e86a805 100644 --- a/code/OgreStructs.h +++ b/code/OgreStructs.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "MemoryIOWrapper.h" #include -#include "../include/assimp/mesh.h" +#include #include #include #include diff --git a/code/OgreXmlSerializer.cpp b/code/OgreXmlSerializer.cpp index 030d61d57..494d8e00c 100644 --- a/code/OgreXmlSerializer.cpp +++ b/code/OgreXmlSerializer.cpp @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OgreParsingUtils.h" #include "TinyFormatter.h" -#include "../include/assimp/DefaultLogger.hpp" +#include #include #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER @@ -453,7 +453,7 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest) } else if (uvs > 0 && m_currentNodeName == nnTexCoord) { - for(size_t i=0, len=dest->uvs.size(); iuvs) { if (m_currentNodeName != nnTexCoord) { throw DeadlyImportError("Vertex buffer declared more UVs than can be found in a vertex"); @@ -462,7 +462,7 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest) aiVector3D uv; uv.x = ReadAttribute("u"); uv.y = (ReadAttribute("v") * -1) + 1; // Flip UV from Ogre to Assimp form - dest->uvs[i].push_back(uv); + uvs.push_back(uv); NextNode(); } @@ -657,10 +657,8 @@ void OgreXmlSerializer::ReadBoneAssignments(VertexDataXml *dest) Some exporters wont care if the sum of all bone weights for a single vertex equals 1 or not, so validate here. */ const float epsilon = 0.05f; - for(std::set::const_iterator iter=influencedVertices.begin(), end=influencedVertices.end(); iter != end; ++iter) + for (const uint32_t vertexIndex : influencedVertices) { - const uint32_t vertexIndex = (*iter); - float sum = 0.0f; for (VertexBoneAssignmentList::const_iterator baIter=dest->boneAssignments.begin(), baEnd=dest->boneAssignments.end(); baIter != baEnd; ++baIter) { @@ -669,10 +667,10 @@ void OgreXmlSerializer::ReadBoneAssignments(VertexDataXml *dest) } if ((sum < (1.0f - epsilon)) || (sum > (1.0f + epsilon))) { - for (VertexBoneAssignmentList::iterator baIter=dest->boneAssignments.begin(), baEnd=dest->boneAssignments.end(); baIter != baEnd; ++baIter) + for (auto &boneAssign : dest->boneAssignments) { - if (baIter->vertexIndex == vertexIndex) - baIter->weight /= sum; + if (boneAssign.vertexIndex == vertexIndex) + boneAssign.weight /= sum; } } } diff --git a/code/OpenGEXExporter.h b/code/OpenGEXExporter.h index ac9d9c860..f9757f41c 100644 --- a/code/OpenGEXExporter.h +++ b/code/OpenGEXExporter.h @@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_OPENGEX_EXPORTER_H #define AI_OPENGEX_EXPORTER_H -#include "../include/assimp/types.h" +#include #ifndef ASSIMP_BUILD_NO_OPENGEX_EXPORTER diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index ed08ab379..f3a886a96 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -16,7 +16,7 @@ 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. +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 @@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "DefaultIOSystem.h" #include #include "MakeVerboseFormat.h" +#include "StringComparison.h" #include #include @@ -50,6 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +static const std::string OpenGexExt = "ogex"; + static const aiImporterDesc desc = { "Open Game Engine Exchange", "", @@ -60,7 +63,7 @@ static const aiImporterDesc desc = { 0, 0, 0, - "ogex" + OpenGexExt.c_str() }; namespace Grammar { @@ -133,7 +136,7 @@ namespace Grammar { }; static int isValidMetricType( const char *token ) { - if( NULL == token ) { + if( nullptr == token ) { return false; } @@ -165,8 +168,7 @@ namespace Grammar { return CameraNodeToken; } else if ( LightNodeType == tokenType ) { return LightNodeToken; - } - else if ( GeometryObjectType == tokenType ) { + } else if ( GeometryObjectType == tokenType ) { return GeometryObjectToken; } else if ( CameraObjectType == tokenType ) { return CameraObjectToken; @@ -205,11 +207,11 @@ USE_ODDLPARSER_NS //------------------------------------------------------------------------------------------------ static void propId2StdString( Property *prop, std::string &name, std::string &key ) { name = key = ""; - if ( NULL == prop ) { + if ( nullptr == prop ) { return; } - if ( NULL != prop->m_key ) { + if ( nullptr != prop->m_key ) { name = prop->m_key->m_buffer; if ( Value::ddl_string == prop->m_value->m_type ) { key = prop->m_value->getString(); @@ -220,9 +222,9 @@ static void propId2StdString( Property *prop, std::string &name, std::string &ke //------------------------------------------------------------------------------------------------ OpenGEXImporter::VertexContainer::VertexContainer() : m_numVerts( 0 ) -, m_vertices(NULL) +, m_vertices( nullptr ) , m_numNormals( 0 ) -, m_normals(NULL) +, m_normals( nullptr ) , m_numUVComps() , m_textureCoords() { @@ -234,8 +236,8 @@ OpenGEXImporter::VertexContainer::~VertexContainer() { delete[] m_vertices; delete[] m_normals; - for( size_t i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; i++ ) { - delete [] m_textureCoords[ i ]; + for(auto &texcoords : m_textureCoords) { + delete [] texcoords; } } @@ -254,17 +256,17 @@ OpenGEXImporter::RefInfo::~RefInfo() { //------------------------------------------------------------------------------------------------ OpenGEXImporter::OpenGEXImporter() -: m_root( NULL ) +: m_root( nullptr ) , m_nodeChildMap() , m_meshCache() , m_mesh2refMap() -, m_ctx( NULL ) +, m_ctx( nullptr ) , m_metrics() -, m_currentNode( NULL ) +, m_currentNode( nullptr ) , m_currentVertices() -, m_currentMesh( NULL ) -, m_currentMaterial( NULL ) -, m_currentLight( NULL ) +, m_currentMesh( nullptr ) +, m_currentMaterial( nullptr ) +, m_currentLight( nullptr ) , m_currentCamera( nullptr ) , m_tokenType( Grammar::NoneType ) , m_materialCache() @@ -284,7 +286,7 @@ OpenGEXImporter::~OpenGEXImporter() { bool OpenGEXImporter::CanRead( const std::string &file, IOSystem *pIOHandler, bool checkSig ) const { bool canRead( false ); if( !checkSig ) { - canRead = SimpleExtensionCheck( file, "ogex" ); + canRead = SimpleExtensionCheck( file, OpenGexExt.c_str() ); } else { static const char *token[] = { "Metric", "GeometryNode", "VertexArray (attrib", "IndexArray" }; canRead = BaseImporter::SearchFileHeaderForToken( pIOHandler, file, token, 4 ); @@ -328,14 +330,14 @@ const aiImporterDesc *OpenGEXImporter::GetInfo() const { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::SetupProperties( const Importer *pImp ) { - if( NULL == pImp ) { + if( nullptr == pImp ) { return; } } //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleNodes( DDLNode *node, aiScene *pScene ) { - if( NULL == node ) { + if( nullptr == node ) { return; } @@ -426,7 +428,7 @@ void OpenGEXImporter::handleNodes( DDLNode *node, aiScene *pScene ) { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleMetricNode( DDLNode *node, aiScene *pScene ) { - if( NULL == node || NULL == m_ctx ) { + if( nullptr == node || nullptr == m_ctx ) { return; } @@ -435,14 +437,14 @@ void OpenGEXImporter::handleMetricNode( DDLNode *node, aiScene *pScene ) { } Property *prop( node->getProperties() ); - while( NULL != prop ) { - if( NULL != prop->m_key ) { + while( nullptr != prop ) { + if( nullptr != prop->m_key ) { if( Value::ddl_string == prop->m_value->m_type ) { std::string valName( ( char* ) prop->m_value->m_data ); int type( Grammar::isValidMetricType( valName.c_str() ) ); if( Grammar::NoneType != type ) { Value *val( node->getValue() ); - if( NULL != val ) { + if( nullptr != val ) { if( Value::ddl_float == val->m_type ) { m_metrics[ type ].m_floatValue = val->getFloat(); } else if( Value::ddl_int32 == val->m_type ) { @@ -489,10 +491,10 @@ static void getRefNames( DDLNode *node, std::vector &names ) { ai_assert( NULL != node ); Reference *ref = node->getReferences(); - if( NULL != ref ) { + if( nullptr != ref ) { for( size_t i = 0; i < ref->m_numRefs; i++ ) { Name *currentName( ref->m_referencedName[ i ] ); - if( NULL != currentName && NULL != currentName->m_id ) { + if( nullptr != currentName && nullptr != currentName->m_id ) { const std::string name( currentName->m_id->m_buffer ); if( !name.empty() ) { names.push_back( name ); @@ -504,7 +506,7 @@ static void getRefNames( DDLNode *node, std::vector &names ) { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene *pScene ) { - if( NULL == m_currentNode ) { + if( nullptr == m_currentNode ) { throw DeadlyImportError( "No parent node for name." ); return; } @@ -524,7 +526,7 @@ void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene *pScene ) { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleMaterialRefNode( ODDLParser::DDLNode *node, aiScene *pScene ) { - if( NULL == m_currentNode ) { + if( nullptr == m_currentNode ) { throw DeadlyImportError( "No parent node for name." ); return; } @@ -550,7 +552,6 @@ void OpenGEXImporter::handleGeometryNode( DDLNode *node, aiScene *pScene ) { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleCameraNode( DDLNode *node, aiScene *pScene ) { aiCamera *camera( new aiCamera ); - const size_t camIdx( m_cameraCache.size() ); m_cameraCache.push_back( camera ); m_currentCamera = camera; @@ -569,7 +570,6 @@ void OpenGEXImporter::handleCameraNode( DDLNode *node, aiScene *pScene ) { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleLightNode( ODDLParser::DDLNode *node, aiScene *pScene ) { aiLight *light( new aiLight ); - const size_t lightIdx( m_lightCache.size() ); m_lightCache.push_back( light ); m_currentLight = light; @@ -603,7 +603,7 @@ void OpenGEXImporter::handleLightObject( ODDLParser::DDLNode *node, aiScene *pSc Property *prop( node->findPropertyByName( "type" ) ); if ( nullptr != prop ) { - if ( NULL != prop->m_value ) { + if ( nullptr != prop->m_value ) { std::string typeStr( prop->m_value->getString() ); if ( "point" == typeStr ) { m_currentLight->mType = aiLightSource_POINT; @@ -621,14 +621,14 @@ void OpenGEXImporter::handleLightObject( ODDLParser::DDLNode *node, aiScene *pSc //------------------------------------------------------------------------------------------------ static void setMatrix( aiNode *node, DataArrayList *transformData ) { - ai_assert( NULL != node ); - ai_assert( NULL != transformData ); + ai_assert( nullptr != node ); + ai_assert( nullptr != transformData ); float m[ 16 ]; size_t i( 1 ); Value *next( transformData->m_dataList->m_next ); m[ 0 ] = transformData->m_dataList->getFloat(); - while( next != NULL ) { + while( next != nullptr ) { m[ i ] = next->getFloat(); next = next->m_next; i++; @@ -657,13 +657,13 @@ static void setMatrix( aiNode *node, DataArrayList *transformData ) { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleTransformNode( ODDLParser::DDLNode *node, aiScene *pScene ) { - if( NULL == m_currentNode ) { + if( nullptr == m_currentNode ) { throw DeadlyImportError( "No parent node for name." ); return; } DataArrayList *transformData( node->getDataArrayList() ); - if( NULL != transformData ) { + if( nullptr != transformData ) { if( transformData->m_numItems != 16 ) { throw DeadlyImportError( "Invalid number of data for transform matrix." ); return; @@ -679,7 +679,7 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene m_meshCache.push_back( m_currentMesh ); Property *prop = node->getProperties(); - if( NULL != prop ) { + if( nullptr != prop ) { std::string propName, propKey; propId2StdString( prop, propName, propKey ); if( "primitive" == propName ) { @@ -700,7 +700,7 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene handleNodes( node, pScene ); DDLNode *parent( node->getParent() ); - if( NULL != parent ) { + if( nullptr != parent ) { const std::string &name = parent->getName(); m_mesh2refMap[ name ] = meshidx; } @@ -716,7 +716,7 @@ enum MeshAttribute { //------------------------------------------------------------------------------------------------ static MeshAttribute getAttributeByName( const char *attribName ) { - ai_assert( NULL != attribName ); + ai_assert( nullptr != attribName ); if( 0 == strncmp( "position", attribName, strlen( "position" ) ) ) { return Position; @@ -731,8 +731,8 @@ static MeshAttribute getAttributeByName( const char *attribName ) { //------------------------------------------------------------------------------------------------ static void fillVector3( aiVector3D *vec3, Value *vals ) { - ai_assert( NULL != vec3 ); - ai_assert( NULL != vals ); + ai_assert( nullptr != vec3 ); + ai_assert( nullptr != vals ); float x( 0.0f ), y( 0.0f ), z( 0.0f ); Value *next( vals ); @@ -740,7 +740,7 @@ static void fillVector3( aiVector3D *vec3, Value *vals ) { next = next->m_next; y = next->getFloat(); next = next->m_next; - if( NULL != next ) { + if( nullptr != next ) { z = next->getFloat(); } @@ -750,13 +750,13 @@ static void fillVector3( aiVector3D *vec3, Value *vals ) { //------------------------------------------------------------------------------------------------ static size_t countDataArrayListItems( DataArrayList *vaList ) { size_t numItems( 0 ); - if( NULL == vaList ) { + if( nullptr == vaList ) { return numItems; } DataArrayList *next( vaList ); - while( NULL != next ) { - if( NULL != vaList->m_dataList ) { + while( nullptr != next ) { + if( nullptr != vaList->m_dataList ) { numItems++; } next = next->m_next; @@ -776,13 +776,13 @@ static void copyVectorArray( size_t numItems, DataArrayList *vaList, aiVector3D //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene *pScene ) { - if( NULL == node ) { + if( nullptr == node ) { throw DeadlyImportError( "No parent node for name." ); return; } Property *prop( node->getProperties() ); - if( NULL != prop ) { + if( nullptr != prop ) { std::string propName, propKey; propId2StdString( prop, propName, propKey ); MeshAttribute attribType( getAttributeByName( propKey.c_str() ) ); @@ -791,7 +791,7 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene } DataArrayList *vaList = node->getDataArrayList(); - if( NULL == vaList ) { + if( nullptr == vaList ) { return; } @@ -815,18 +815,18 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene *pScene ) { - if( NULL == node ) { + if( nullptr == node ) { throw DeadlyImportError( "No parent node for name." ); return; } - if( NULL == m_currentMesh ) { + if( nullptr == m_currentMesh ) { throw DeadlyImportError( "No current mesh for index data found." ); return; } DataArrayList *vaList = node->getDataArrayList(); - if( NULL == vaList ) { + if( nullptr == vaList ) { return; } @@ -877,7 +877,7 @@ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene * //------------------------------------------------------------------------------------------------ static void getColorRGB( aiColor3D *pColor, DataArrayList *colList ) { - if( NULL == pColor || NULL == colList ) { + if( nullptr == pColor || nullptr == colList ) { return; } @@ -901,7 +901,7 @@ enum ColorType { //------------------------------------------------------------------------------------------------ static ColorType getColorType( Text *id ) { - if ( NULL == id ) { + if ( nullptr == id ) { return NoneColor; } @@ -928,15 +928,15 @@ void OpenGEXImporter::handleMaterialNode( ODDLParser::DDLNode *node, aiScene *pS //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene *pScene ) { - if( NULL == node ) { + if( nullptr == node ) { return; } Property *prop = node->findPropertyByName( "attrib" ); - if( NULL != prop ) { - if( NULL != prop->m_value ) { + if( nullptr != prop ) { + if( nullptr != prop->m_value ) { DataArrayList *colList( node->getDataArrayList() ); - if( NULL == colList ) { + if( nullptr == colList ) { return; } aiColor3D col; @@ -957,15 +957,15 @@ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene *pScen //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene *pScene ) { - if( NULL == node ) { + if( nullptr == node ) { return; } Property *prop = node->findPropertyByName( "attrib" ); - if( NULL != prop ) { - if( NULL != prop->m_value ) { + if( nullptr != prop ) { + if( nullptr != prop->m_value ) { Value *val( node->getValue() ); - if( NULL != val ) { + if( nullptr != val ) { aiString tex; tex.Set( val->getString() ); if( prop->m_value->getString() == Grammar::DiffuseTextureToken ) { @@ -992,24 +992,28 @@ void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene *pSc //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleParamNode( ODDLParser::DDLNode *node, aiScene *pScene ) { - if ( NULL == node ) { + if ( nullptr == node ) { return; } Property *prop = node->findPropertyByName( "attrib" ); - - if ( nullptr != prop ) { - if ( NULL != prop->m_value ) { - Value *val( node->getValue() ); - const float floatVal( val->getFloat() ); - if ( NULL != val && prop->m_value != NULL ) { - if ( "fov" == prop->m_value->getString() ) { - m_currentCamera->mHorizontalFOV = floatVal; - } else if ( "near" == prop->m_value->getString() ) { - m_currentCamera->mClipPlaneNear = floatVal; - } else if ( "far" == prop->m_value->getString() ) { - m_currentCamera->mClipPlaneFar = floatVal; - } + if ( nullptr == prop ) { + return; + } + + if ( nullptr != prop->m_value ) { + Value *val( node->getValue() ); + if ( nullptr == val ) { + return; + } + const float floatVal( val->getFloat() ); + if ( prop->m_value != nullptr ) { + if ( 0 == ASSIMP_strincmp( "fov", prop->m_value->getString(), 3 ) ) { + m_currentCamera->mHorizontalFOV = floatVal; + } else if ( 0 == ASSIMP_strincmp( "near", prop->m_value->getString(), 3 ) ) { + m_currentCamera->mClipPlaneNear = floatVal; + } else if ( 0 == ASSIMP_strincmp( "far", prop->m_value->getString(), 3 ) ) { + m_currentCamera->mClipPlaneFar = floatVal; } } } @@ -1026,7 +1030,7 @@ void OpenGEXImporter::handleAttenNode( ODDLParser::DDLNode *node, aiScene *pScen if ( nullptr != prop->m_value ) { Value *val( node->getValue() ); const float floatVal( val->getFloat() ); - if ( "scale" == prop->m_value->getString() ) { + if ( 0 == strncmp( "scale", prop->m_value->getString(), strlen( "scale" ) ) ) { m_currentLight->mAttenuationQuadratic = floatVal; } } @@ -1103,7 +1107,7 @@ void OpenGEXImporter::resolveReferences() { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::createNodeTree( aiScene *pScene ) { - if( NULL == m_root ) { + if( nullptr == m_root ) { return; } @@ -1118,13 +1122,13 @@ void OpenGEXImporter::createNodeTree( aiScene *pScene ) { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) { - ai_assert( NULL != pScene ); + ai_assert( nullptr != pScene ); if ( NULL == node ) { return; } - ChildInfo *info( NULL ); + ChildInfo *info( nullptr ); if( m_nodeStack.empty() ) { node->mParent = pScene->mRootNode; NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) ); @@ -1138,7 +1142,7 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) { info->m_children.push_back( node ); } else { aiNode *parent( m_nodeStack.back() ); - ai_assert( NULL != parent ); + ai_assert( nullptr != parent ); node->mParent = parent; NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) ); if( m_nodeChildMap.end() == it ) { @@ -1155,7 +1159,7 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) { //------------------------------------------------------------------------------------------------ aiNode *OpenGEXImporter::popNode() { if( m_nodeStack.empty() ) { - return NULL; + return nullptr; } aiNode *node( top() ); @@ -1167,7 +1171,7 @@ aiNode *OpenGEXImporter::popNode() { //------------------------------------------------------------------------------------------------ aiNode *OpenGEXImporter::top() const { if( m_nodeStack.empty() ) { - return NULL; + return nullptr; } return m_nodeStack.back(); diff --git a/code/OptimizeGraph.h b/code/OptimizeGraph.h index 7ac9b00e8..7b3a1d0de 100644 --- a/code/OptimizeGraph.h +++ b/code/OptimizeGraph.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseProcess.h" #include "ProcessHelper.h" -#include "../include/assimp/types.h" +#include #include struct aiMesh; diff --git a/code/OptimizeMeshes.h b/code/OptimizeMeshes.h index ac7801c0a..fc8b6a10b 100644 --- a/code/OptimizeMeshes.h +++ b/code/OptimizeMeshes.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_OPTIMIZEMESHESPROCESS_H_INC #include "BaseProcess.h" -#include "../include/assimp/types.h" +#include #include struct aiMesh; diff --git a/code/ParsingUtils.h b/code/ParsingUtils.h index 07f2c1846..2371ee606 100644 --- a/code/ParsingUtils.h +++ b/code/ParsingUtils.h @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StringComparison.h" #include "StringUtils.h" -#include "../include/assimp/defs.h" +#include namespace Assimp { diff --git a/code/PlyExporter.cpp b/code/PlyExporter.cpp index c788e19ce..b882521f6 100644 --- a/code/PlyExporter.cpp +++ b/code/PlyExporter.cpp @@ -46,10 +46,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "Exceptional.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/version.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include +#include #include "qnan.h" diff --git a/code/PlyLoader.cpp b/code/PlyLoader.cpp index c1de333e0..d4dc2f864 100644 --- a/code/PlyLoader.cpp +++ b/code/PlyLoader.cpp @@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "PlyLoader.h" #include "Macros.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" +#include +#include using namespace Assimp; diff --git a/code/PlyLoader.h b/code/PlyLoader.h index d83e70be3..71b483c57 100644 --- a/code/PlyLoader.h +++ b/code/PlyLoader.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_PLYLOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include #include "PlyParser.h" #include diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 9ea727915..06e4038f4 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "PlyLoader.h" #include "fast_atof.h" -#include "../include/assimp/DefaultLogger.hpp" +#include #include "ByteSwapper.h" diff --git a/code/PolyTools.h b/code/PolyTools.h index d2539d65d..80e1dd173 100644 --- a/code/PolyTools.h +++ b/code/PolyTools.h @@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_POLYTOOLS_H_INCLUDED #define AI_POLYTOOLS_H_INCLUDED -#include "../include/assimp/material.h" -#include "../include/assimp/ai_assert.h" +#include +#include namespace Assimp { diff --git a/code/PretransformVertices.cpp b/code/PretransformVertices.cpp index d37bfd599..8158bdd6f 100644 --- a/code/PretransformVertices.cpp +++ b/code/PretransformVertices.cpp @@ -618,6 +618,7 @@ void PretransformVertices::Execute( aiScene* pScene) // transformation of the corresponding node l->mPosition = nd->mTransformation * l->mPosition; l->mDirection = aiMatrix3x3( nd->mTransformation ) * l->mDirection; + l->mUp = aiMatrix3x3( nd->mTransformation ) * l->mUp; } if( !configKeepHierarchy ) { diff --git a/code/PretransformVertices.h b/code/PretransformVertices.h index 307c9017e..28bd95a67 100644 --- a/code/PretransformVertices.h +++ b/code/PretransformVertices.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_PRETRANSFORMVERTICES_H_INC #include "BaseProcess.h" -#include "../include/assimp/mesh.h" +#include #include #include diff --git a/code/ProcessHelper.h b/code/ProcessHelper.h index 2a7577610..3f50a46c6 100644 --- a/code/ProcessHelper.h +++ b/code/ProcessHelper.h @@ -41,12 +41,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_PROCESS_HELPER_H_INCLUDED #define AI_PROCESS_HELPER_H_INCLUDED -#include "../include/assimp/postprocess.h" -#include "../include/assimp/anim.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/material.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include +#include +#include +#include #include "SpatialSort.h" #include "BaseProcess.h" diff --git a/code/Profiler.h b/code/Profiler.h index 543642c74..9354339a2 100644 --- a/code/Profiler.h +++ b/code/Profiler.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define INCLUDED_PROFILER_H #include -#include "../include/assimp/DefaultLogger.hpp" +#include #include "TinyFormatter.h" #include diff --git a/code/Q3BSPFileImporter.cpp b/code/Q3BSPFileImporter.cpp index 2526aeb26..47001d06f 100644 --- a/code/Q3BSPFileImporter.cpp +++ b/code/Q3BSPFileImporter.cpp @@ -53,10 +53,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # include "../contrib/zlib/zlib.h" #endif -#include "../include/assimp/types.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/ai_assert.h" +#include +#include +#include +#include #include #include #include "StringComparison.h" @@ -131,11 +131,11 @@ static void normalizePathName( const std::string &rPath, std::string &rNormalize static const unsigned int numDelimiters = 2; const char delimiters[ numDelimiters ] = { '/', '\\' }; rNormalizedPath = rPath; - for ( unsigned int i=0; i -#include "../include/assimp/ai_assert.h" +#include - -namespace Assimp -{ +namespace Assimp { using namespace Q3BSP; diff --git a/code/Q3BSPZipArchive.cpp b/code/Q3BSPZipArchive.cpp index cdc6ea2c5..59e437836 100644 --- a/code/Q3BSPZipArchive.cpp +++ b/code/Q3BSPZipArchive.cpp @@ -46,8 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "../include/assimp/ai_assert.h" - +#include namespace Assimp { namespace Q3BSP { @@ -195,8 +194,8 @@ Q3BSPZipArchive::Q3BSPZipArchive(IOSystem* pIOHandler, const std::string& rFile) // ------------------------------------------------------------------------------------------------ // Destructor. Q3BSPZipArchive::~Q3BSPZipArchive() { - for( std::map::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it ) { - delete it->second; + for(auto &file : m_ArchiveMap) { + delete file.second; } m_ArchiveMap.clear(); @@ -269,8 +268,8 @@ void Q3BSPZipArchive::Close(IOStream *pFile) { void Q3BSPZipArchive::getFileList(std::vector &rFileList) { rFileList.clear(); - for(std::map::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it) { - rFileList.push_back(it->first); + for(auto &file : m_ArchiveMap) { + rFileList.push_back(file.first); } } diff --git a/code/Q3BSPZipArchive.h b/code/Q3BSPZipArchive.h index 3b9bc2b3f..e46a11b4c 100644 --- a/code/Q3BSPZipArchive.h +++ b/code/Q3BSPZipArchive.h @@ -40,9 +40,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_Q3BSP_ZIPARCHIVE_H_INC #define AI_Q3BSP_ZIPARCHIVE_H_INC -#include "../contrib/unzip/unzip.h" -#include "../include/assimp/IOStream.hpp" -#include "../include/assimp/IOSystem.hpp" +#include +#include +#include #include #include #include diff --git a/code/Q3DLoader.cpp b/code/Q3DLoader.cpp index cb73c3fe4..d9dc29672 100644 --- a/code/Q3DLoader.cpp +++ b/code/Q3DLoader.cpp @@ -50,9 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Q3DLoader.h" #include "StreamReader.h" #include "fast_atof.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include using namespace Assimp; diff --git a/code/Q3DLoader.h b/code/Q3DLoader.h index 89f4279fa..fb1dd1818 100644 --- a/code/Q3DLoader.h +++ b/code/Q3DLoader.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_Q3DLOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include #include #include diff --git a/code/RawLoader.cpp b/code/RawLoader.cpp index 654418754..57e0fc119 100644 --- a/code/RawLoader.cpp +++ b/code/RawLoader.cpp @@ -51,9 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ParsingUtils.h" #include "fast_atof.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include using namespace Assimp; @@ -183,12 +183,11 @@ void RAWImporter::InternReadFile( const std::string& pFile, } // search in the list of meshes whether we have one with this texture - for (std::vector< MeshInformation >::iterator it = (*curGroup).meshes.begin(), - end = (*curGroup).meshes.end(); it != end; ++it) + for (auto &mesh : (*curGroup).meshes) { - if (length == (*it).name.length() && (length ? !::strcmp(sz,(*it).name.c_str()) : true)) + if (length == mesh.name.length() && (length ? !::strcmp(sz, mesh.name.c_str()) : true)) { - output = &(*it); + output = &mesh; break; } } @@ -223,13 +222,12 @@ void RAWImporter::InternReadFile( const std::string& pFile, // count the number of valid groups // (meshes can't be empty) - for (std::vector< GroupInformation >::iterator it = outGroups.begin(), end = outGroups.end(); - it != end;++it) + for (auto & outGroup : outGroups) { - if (!(*it).meshes.empty()) + if (!outGroup.meshes.empty()) { ++pScene->mRootNode->mNumChildren; - pScene->mNumMeshes += (unsigned int)(*it).meshes.size(); + pScene->mNumMeshes += (unsigned int) outGroup.meshes.size(); } } @@ -251,10 +249,9 @@ void RAWImporter::InternReadFile( const std::string& pFile, aiMaterial** mats = pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials]; unsigned int meshIdx = 0; - for (std::vector< GroupInformation >::iterator it = outGroups.begin(), end = outGroups.end(); - it != end;++it) + for (auto & outGroup : outGroups) { - if ((*it).meshes.empty())continue; + if (outGroup.meshes.empty())continue; aiNode* node; if (pScene->mRootNode->mNumChildren) @@ -263,13 +260,13 @@ void RAWImporter::InternReadFile( const std::string& pFile, node->mParent = pScene->mRootNode; } else node = *cc;++cc; - node->mName.Set((*it).name); + node->mName.Set(outGroup.name); // add all meshes - node->mNumMeshes = (unsigned int)(*it).meshes.size(); + node->mNumMeshes = (unsigned int) outGroup.meshes.size(); unsigned int* pi = node->mMeshes = new unsigned int[ node->mNumMeshes ]; - for (std::vector< MeshInformation >::iterator it2 = (*it).meshes.begin(), - end2 = (*it).meshes.end(); it2 != end2; ++it2) + for (std::vector< MeshInformation >::iterator it2 = outGroup.meshes.begin(), + end2 = outGroup.meshes.end(); it2 != end2; ++it2) { ai_assert(!(*it2).vertices.empty()); diff --git a/code/RawLoader.h b/code/RawLoader.h index 436966cd9..984141a04 100644 --- a/code/RawLoader.h +++ b/code/RawLoader.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_RAWLOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include #include namespace Assimp { diff --git a/code/RemoveComments.h b/code/RemoveComments.h index 55eab9943..856ed74bf 100644 --- a/code/RemoveComments.h +++ b/code/RemoveComments.h @@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_REMOVE_COMMENTS_H_INC #define AI_REMOVE_COMMENTS_H_INC -#include "../include/assimp/ai_assert.h" -#include "../include/assimp/defs.h" +#include +#include namespace Assimp { diff --git a/code/RemoveRedundantMaterials.h b/code/RemoveRedundantMaterials.h index fe9f564d0..60efad9a4 100644 --- a/code/RemoveRedundantMaterials.h +++ b/code/RemoveRedundantMaterials.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_REMOVEREDUNDANTMATERIALS_H_INC #include "BaseProcess.h" -#include "../include/assimp/mesh.h" +#include class RemoveRedundantMatsTest; namespace Assimp { diff --git a/code/RemoveVCProcess.cpp b/code/RemoveVCProcess.cpp index 17ad5ff33..473460452 100644 --- a/code/RemoveVCProcess.cpp +++ b/code/RemoveVCProcess.cpp @@ -44,14 +44,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "RemoveVCProcess.h" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" - +#include +#include +#include using namespace Assimp; - // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer RemoveVCProcess::RemoveVCProcess() : diff --git a/code/RemoveVCProcess.h b/code/RemoveVCProcess.h index 2a434e9ab..a9173a815 100644 --- a/code/RemoveVCProcess.h +++ b/code/RemoveVCProcess.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_REMOVEVCPROCESS_H_INCLUDED #include "BaseProcess.h" -#include "../include/assimp/mesh.h" +#include class RemoveVCProcessTest; diff --git a/code/SGSpatialSort.h b/code/SGSpatialSort.h index 360037067..59a5c37d6 100644 --- a/code/SGSpatialSort.h +++ b/code/SGSpatialSort.h @@ -38,12 +38,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -/** Small helper classes to optimise finding vertizes close to a given location +/** Small helper classes to optimize finding vertices close to a given location */ #ifndef AI_D3DSSPATIALSORT_H_INC #define AI_D3DSSPATIALSORT_H_INC -#include "../include/assimp/types.h" +#include #include #include diff --git a/code/SIBImporter.cpp b/code/SIBImporter.cpp index 62db27f36..b972f28d6 100644 --- a/code/SIBImporter.cpp +++ b/code/SIBImporter.cpp @@ -58,9 +58,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StreamReader.h" #include "TinyFormatter.h" #include "../contrib/ConvertUTF/ConvertUTF.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include +#include using namespace Assimp; @@ -914,10 +914,12 @@ void SIBImporter::InternReadFile(const std::string& pFile, for (size_t n=0;nmChildren[childIdx++] = node; - node->mName = light->mName; - node->mParent = root; + if ( nullptr != light ) { + aiNode* node = new aiNode; + root->mChildren[ childIdx++ ] = node; + node->mName = light->mName; + node->mParent = root; + } } } diff --git a/code/SIBImporter.h b/code/SIBImporter.h index d31241f79..d82a40da0 100644 --- a/code/SIBImporter.h +++ b/code/SIBImporter.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_SIBIMPORTER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include #include namespace Assimp { diff --git a/code/SMDLoader.cpp b/code/SMDLoader.cpp index 01a229468..7aef7bc56 100644 --- a/code/SMDLoader.cpp +++ b/code/SMDLoader.cpp @@ -50,12 +50,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "SMDLoader.h" #include "fast_atof.h" #include "SkeletonMeshBuilder.h" -#include "../include/assimp/Importer.hpp" -#include "../include/assimp/IOSystem.hpp" +#include +#include +#include +#include #include -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" - using namespace Assimp; diff --git a/code/SMDLoader.h b/code/SMDLoader.h index ab6ab3d9a..0b069cc25 100644 --- a/code/SMDLoader.h +++ b/code/SMDLoader.h @@ -50,10 +50,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ParsingUtils.h" // public Assimp headers -#include "../include/assimp/types.h" -#include "../include/assimp/texture.h" -#include "../include/assimp/anim.h" -#include "../include/assimp/material.h" +#include +#include +#include +#include + struct aiNode; // STL headers @@ -61,7 +62,6 @@ struct aiNode; namespace Assimp { - namespace SMD { // --------------------------------------------------------------------------- diff --git a/code/STEPFile.h b/code/STEPFile.h index 252e75dbb..e09add1eb 100644 --- a/code/STEPFile.h +++ b/code/STEPFile.h @@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "FBXDocument.h" //ObjectMap::value_type -#include "../include/assimp/DefaultLogger.hpp" +#include // #if _MSC_VER > 1500 || (defined __GNUC___) diff --git a/code/STLExporter.cpp b/code/STLExporter.cpp index 7491e6b1b..a5c5484c6 100644 --- a/code/STLExporter.cpp +++ b/code/STLExporter.cpp @@ -43,10 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_STL_EXPORTER) #include "STLExporter.h" -#include "../include/assimp/version.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include +#include #include #include "Exceptional.h" #include "ByteSwapper.h" diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index 99716688b..95fce47e2 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -49,10 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ParsingUtils.h" #include "fast_atof.h" #include -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" - +#include +#include +#include using namespace Assimp; diff --git a/code/STLLoader.h b/code/STLLoader.h index 2d310f65b..a0d82dbe8 100644 --- a/code/STLLoader.h +++ b/code/STLLoader.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_STLLOADER_H_INCLUDED #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include namespace Assimp { diff --git a/code/SceneCombiner.cpp b/code/SceneCombiner.cpp index 5a138f809..b39adbf78 100644 --- a/code/SceneCombiner.cpp +++ b/code/SceneCombiner.cpp @@ -54,8 +54,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fast_atof.h" #include "Hash.h" #include "time.h" -#include "../include/assimp/DefaultLogger.hpp" -#include "../include/assimp/scene.h" +#include +#include #include #include "ScenePrivate.h" diff --git a/code/SceneCombiner.h b/code/SceneCombiner.h index ddb4e8f7d..81e58aaf3 100644 --- a/code/SceneCombiner.h +++ b/code/SceneCombiner.h @@ -44,14 +44,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_SCENE_COMBINER_H_INC #define AI_SCENE_COMBINER_H_INC -#include "../include/assimp/ai_assert.h" -#include "../include/assimp/types.h" +#include +#include #include "Defines.h" #include #include #include #include -//#include "../include/assimp/Compiler/pstdint.h" #include diff --git a/code/ScenePreprocessor.cpp b/code/ScenePreprocessor.cpp index 7f187ad90..a38a9430e 100644 --- a/code/ScenePreprocessor.cpp +++ b/code/ScenePreprocessor.cpp @@ -39,9 +39,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "ScenePreprocessor.h" -#include "../include/assimp/ai_assert.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include using namespace Assimp; diff --git a/code/ScenePreprocessor.h b/code/ScenePreprocessor.h index 1ef2d3e3b..9c4b422a2 100644 --- a/code/ScenePreprocessor.h +++ b/code/ScenePreprocessor.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_SCENE_PREPROCESSOR_H_INC #define AI_SCENE_PREPROCESSOR_H_INC -#include "../include/assimp/defs.h" +#include #include struct aiScene; diff --git a/code/ScenePrivate.h b/code/ScenePrivate.h index 055a7e15d..dd4d0a5e1 100644 --- a/code/ScenePrivate.h +++ b/code/ScenePrivate.h @@ -43,11 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_SCENEPRIVATE_H_INCLUDED #define AI_SCENEPRIVATE_H_INCLUDED -#include "../include/assimp/scene.h" +#include namespace Assimp { - class Importer; +class Importer; struct ScenePrivateData { @@ -61,7 +61,7 @@ struct ScenePrivateData { // If set, this object is owned by this private data instance. Assimp::Importer* mOrigImporter; - // List of postprocessing steps already applied to the scene. + // List of post-processing steps already applied to the scene. unsigned int mPPStepsApplied; // true if the scene is a copy made with aiCopyScene() diff --git a/code/SkeletonMeshBuilder.cpp b/code/SkeletonMeshBuilder.cpp index a3ef75b65..ec7aa8985 100644 --- a/code/SkeletonMeshBuilder.cpp +++ b/code/SkeletonMeshBuilder.cpp @@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Implementation of a little class to construct a dummy mesh for a skeleton */ -#include "../include/assimp/scene.h" +#include #include "SkeletonMeshBuilder.h" using namespace Assimp; diff --git a/code/SkeletonMeshBuilder.h b/code/SkeletonMeshBuilder.h index fe9651088..3c518e8cd 100644 --- a/code/SkeletonMeshBuilder.h +++ b/code/SkeletonMeshBuilder.h @@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_SKELETONMESHBUILDER_H_INC #include -#include "../include/assimp/mesh.h" +#include struct aiMaterial; struct aiScene; diff --git a/code/SmoothingGroups.h b/code/SmoothingGroups.h index a9921e4e2..75c59d1cb 100644 --- a/code/SmoothingGroups.h +++ b/code/SmoothingGroups.h @@ -44,7 +44,7 @@ http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-unofficial.txt */ #ifndef AI_SMOOTHINGGROUPS_H_INC #define AI_SMOOTHINGGROUPS_H_INC -#include "../include/assimp/vector3.h" +#include #include #include diff --git a/code/SortByPTypeProcess.h b/code/SortByPTypeProcess.h index c834bfa3f..f96985cb3 100644 --- a/code/SortByPTypeProcess.h +++ b/code/SortByPTypeProcess.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_SORTBYPTYPEPROCESS_H_INC #include "BaseProcess.h" -#include "../include/assimp/mesh.h" +#include class SortByPTypeProcessTest; namespace Assimp { diff --git a/code/SpatialSort.cpp b/code/SpatialSort.cpp index c536af1b5..c4e4ef2d5 100644 --- a/code/SpatialSort.cpp +++ b/code/SpatialSort.cpp @@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file Implementation of the helper class to quickly find vertices close to a given position */ #include "SpatialSort.h" -#include "../include/assimp/ai_assert.h" +#include using namespace Assimp; diff --git a/code/SpatialSort.h b/code/SpatialSort.h index 983a26c4b..b594fc6d1 100644 --- a/code/SpatialSort.h +++ b/code/SpatialSort.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_SPATIALSORT_H_INC #include -#include "../include/assimp/types.h" +#include namespace Assimp { diff --git a/code/SplitByBoneCountProcess.cpp b/code/SplitByBoneCountProcess.cpp index cbc60beec..58b14ff49 100644 --- a/code/SplitByBoneCountProcess.cpp +++ b/code/SplitByBoneCountProcess.cpp @@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // internal headers of the post-processing framework #include "SplitByBoneCountProcess.h" -#include "../include/assimp/postprocess.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include #include #include "TinyFormatter.h" diff --git a/code/SplitByBoneCountProcess.h b/code/SplitByBoneCountProcess.h index 39f47d043..816d18357 100644 --- a/code/SplitByBoneCountProcess.h +++ b/code/SplitByBoneCountProcess.h @@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "BaseProcess.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/scene.h" +#include +#include namespace Assimp { diff --git a/code/SplitLargeMeshes.cpp b/code/SplitLargeMeshes.cpp index 00bdc2ee3..5e21ec6b8 100644 --- a/code/SplitLargeMeshes.cpp +++ b/code/SplitLargeMeshes.cpp @@ -459,11 +459,9 @@ void SplitLargeMeshesProcess_Vertex::SplitMesh( if (iBase) { // we can't use memset here we unsigned int needn' be 32 bits - for (std::vector::iterator - iter = avWasCopied.begin(),end = avWasCopied.end(); - iter != end;++iter) + for (auto &elem : avWasCopied) { - (*iter) = 0xffffffff; + elem = 0xffffffff; } } diff --git a/code/SplitLargeMeshes.h b/code/SplitLargeMeshes.h index 58575c9a7..9be27a8f1 100644 --- a/code/SplitLargeMeshes.h +++ b/code/SplitLargeMeshes.h @@ -46,10 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "BaseProcess.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/scene.h" +#include +#include class SplitLargeMeshesTest; + namespace Assimp { diff --git a/code/StandardShapes.cpp b/code/StandardShapes.cpp index 359b632bb..d547c04a7 100644 --- a/code/StandardShapes.cpp +++ b/code/StandardShapes.cpp @@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StringComparison.h" #include "Defines.h" #include -#include "../include/assimp/mesh.h" +#include namespace Assimp { diff --git a/code/StandardShapes.h b/code/StandardShapes.h index e310bfd5e..ec53ca30d 100644 --- a/code/StandardShapes.h +++ b/code/StandardShapes.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_STANDARD_SHAPES_H_INC #define AI_STANDARD_SHAPES_H_INC -#include "../include/assimp/vector3.h" +#include #include struct aiMesh; diff --git a/code/StdOStreamLogStream.h b/code/StdOStreamLogStream.h index be1b2c640..20482fef7 100644 --- a/code/StdOStreamLogStream.h +++ b/code/StdOStreamLogStream.h @@ -1,7 +1,47 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2016, 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. +--------------------------------------------------------------------------- +*/ #ifndef AI_STROSTREAMLOGSTREAM_H_INC #define AI_STROSTREAMLOGSTREAM_H_INC -#include "../include/assimp/LogStream.hpp" +#include #include namespace Assimp { diff --git a/code/StepExporter.cpp b/code/StepExporter.cpp index a4ce671a7..cc0a80ac4 100644 --- a/code/StepExporter.cpp +++ b/code/StepExporter.cpp @@ -56,9 +56,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "Exceptional.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/light.h" +#include +#include +#include // #if _MSC_VER > 1500 || (defined __GNUC___) diff --git a/code/StepExporter.h b/code/StepExporter.h index 3d36635e1..b51280c6c 100644 --- a/code/StepExporter.h +++ b/code/StepExporter.h @@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_STEPEXPORTER_H_INC #define AI_STEPEXPORTER_H_INC -#include "../include/assimp/ai_assert.h" -#include "../include/assimp/matrix4x4.h" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include #include diff --git a/code/StreamReader.h b/code/StreamReader.h index b433eaa82..244ad9784 100644 --- a/code/StreamReader.h +++ b/code/StreamReader.h @@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ByteSwapper.h" #include "Exceptional.h" #include -#include "../include/assimp/IOStream.hpp" +#include #include "Defines.h" namespace Assimp { diff --git a/code/StreamWriter.h b/code/StreamWriter.h index 61b129a63..12239bf7f 100644 --- a/code/StreamWriter.h +++ b/code/StreamWriter.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_STREAMWRITER_H_INCLUDED #include "ByteSwapper.h" -#include "../include/assimp/IOStream.hpp" +#include #include #include diff --git a/code/StringComparison.h b/code/StringComparison.h index ea4f761f1..0e1dbe4b8 100644 --- a/code/StringComparison.h +++ b/code/StringComparison.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_STRING_WORKERS_H #define INCLUDED_AI_STRING_WORKERS_H -#include "../include/assimp/ai_assert.h" +#include #include "StringComparison.h" #include diff --git a/code/StringUtils.h b/code/StringUtils.h index 275bcbfb2..99352ebfb 100644 --- a/code/StringUtils.h +++ b/code/StringUtils.h @@ -43,6 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include +#include /// @fn ai_snprintf /// @brief The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier. @@ -80,5 +82,30 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # define ai_snprintf snprintf #endif +template +inline +std::string to_string( T value ) { + std::ostringstream os; + os << value; + return os.str(); +} + +inline +float ai_strtof( const char *begin, const char *end ) { + if ( nullptr == begin ) { + return 0.0f; + } + float val( 0.0f ); + if ( nullptr == end ) { + val = static_cast< float >( ::atof( begin ) ); + } else { + std::string::size_type len( end - begin ); + std::string token( begin, len ); + val = static_cast< float >( ::atof( token.c_str() ) ); + } + + return val; +} + #endif // INCLUDED_AI_STRINGUTILS_H diff --git a/code/TargetAnimation.cpp b/code/TargetAnimation.cpp index 97c757fe9..a78f66bea 100644 --- a/code/TargetAnimation.cpp +++ b/code/TargetAnimation.cpp @@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "TargetAnimation.h" #include -#include "../include/assimp/ai_assert.h" +#include using namespace Assimp; diff --git a/code/TargetAnimation.h b/code/TargetAnimation.h index b177e359b..79cef599e 100644 --- a/code/TargetAnimation.h +++ b/code/TargetAnimation.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_TARGET_ANIMATION_H_INC #define AI_TARGET_ANIMATION_H_INC -#include "../include/assimp/anim.h" +#include #include namespace Assimp { diff --git a/code/TerragenLoader.cpp b/code/TerragenLoader.cpp index b0e450d41..854959f19 100644 --- a/code/TerragenLoader.cpp +++ b/code/TerragenLoader.cpp @@ -44,12 +44,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_TERRAGEN_IMPORTER + #include "TerragenLoader.h" -#include "../include/assimp/Importer.hpp" -#include "../include/assimp/IOSystem.hpp" #include "StreamReader.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" +#include +#include +#include +#include using namespace Assimp; diff --git a/code/TextureTransform.h b/code/TextureTransform.h index e05899dde..ccad3bdd9 100644 --- a/code/TextureTransform.h +++ b/code/TextureTransform.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseImporter.h" #include "BaseProcess.h" -#include "../include/assimp/material.h" +#include #include struct aiNode; diff --git a/code/UnrealLoader.cpp b/code/UnrealLoader.cpp index d7accacea..ad839fb25 100644 --- a/code/UnrealLoader.cpp +++ b/code/UnrealLoader.cpp @@ -171,9 +171,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, // collect triangles std::vector triangles(numTris); - for (std::vector::iterator it = triangles.begin(), end = triangles.end();it != end; ++it) { - Unreal::Triangle& tri = *it; - + for (auto & tri : triangles) { for (unsigned int i = 0; i < 3;++i) { tri.mVertex[i] = d_reader.GetI2(); @@ -222,9 +220,9 @@ void UnrealImporter::InternReadFile( const std::string& pFile, // collect vertices std::vector vertices(numVert); - for (std::vector::iterator it = vertices.begin(), end = vertices.end(); it != end; ++it) { + for (auto &vertex : vertices) { int32_t val = a_reader.GetI4(); - Unreal::DecompressVertex(*it,val); + Unreal::DecompressVertex(vertex ,val); } // list of textures. @@ -330,8 +328,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, materials.reserve(textures.size()*2+5); // find out how many output meshes and materials we'll have and build material indices - for (std::vector::iterator it = triangles.begin(), end = triangles.end();it != end; ++it) { - Unreal::Triangle& tri = *it; + for (Unreal::Triangle &tri : triangles) { Unreal::TempMat mat(tri); std::vector::iterator nt = std::find(materials.begin(),materials.end(),mat); if (nt == materials.end()) { @@ -418,8 +415,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, } // fill them. - for (std::vector::iterator it = triangles.begin(), end = triangles.end();it != end; ++it) { - Unreal::Triangle& tri = *it; + for (const Unreal::Triangle &tri : triangles) { Unreal::TempMat mat(tri); std::vector::iterator nt = std::find(materials.begin(),materials.end(),mat); diff --git a/code/ValidateDataStructure.h b/code/ValidateDataStructure.h index 7472a2b1d..87f158b37 100644 --- a/code/ValidateDataStructure.h +++ b/code/ValidateDataStructure.h @@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_VALIDATEPROCESS_H_INC #define AI_VALIDATEPROCESS_H_INC -#include "../include/assimp/types.h" -#include "../include/assimp/material.h" +#include +#include #include "BaseProcess.h" struct aiBone; diff --git a/code/Vertex.h b/code/Vertex.h index ad850455d..5e2cf6986 100644 --- a/code/Vertex.h +++ b/code/Vertex.h @@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_VERTEX_H_INC #define AI_VERTEX_H_INC -#include "../include/assimp/vector3.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/ai_assert.h" +#include +#include +#include #include namespace Assimp { diff --git a/code/VertexTriangleAdjacency.cpp b/code/VertexTriangleAdjacency.cpp index c0cd209eb..6de55ab34 100644 --- a/code/VertexTriangleAdjacency.cpp +++ b/code/VertexTriangleAdjacency.cpp @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // internal headers #include "VertexTriangleAdjacency.h" -#include "../include/assimp/mesh.h" +#include using namespace Assimp; diff --git a/code/VertexTriangleAdjacency.h b/code/VertexTriangleAdjacency.h index 18571590d..218607508 100644 --- a/code/VertexTriangleAdjacency.h +++ b/code/VertexTriangleAdjacency.h @@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_VTADJACENCY_H_INC #include "BaseProcess.h" -#include "../include/assimp/types.h" -#include "../include/assimp/ai_assert.h" +#include +#include struct aiMesh; struct aiFace; diff --git a/code/Win32DebugLogStream.h b/code/Win32DebugLogStream.h index ef80df69d..c7bd8ca62 100644 --- a/code/Win32DebugLogStream.h +++ b/code/Win32DebugLogStream.h @@ -3,7 +3,7 @@ #ifdef WIN32 -#include "../include/assimp/LogStream.hpp" +#include #include "windows.h" namespace Assimp { diff --git a/code/XFileExporter.cpp b/code/XFileExporter.cpp index 7966ac4df..e865f2305 100644 --- a/code/XFileExporter.cpp +++ b/code/XFileExporter.cpp @@ -53,11 +53,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "Exceptional.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/light.h" - - +#include +#include +#include using namespace Assimp; diff --git a/code/XFileExporter.h b/code/XFileExporter.h index 3389ccd00..c33de3347 100644 --- a/code/XFileExporter.h +++ b/code/XFileExporter.h @@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_XFILEEXPORTER_H_INC #define AI_XFILEEXPORTER_H_INC -#include "../include/assimp/ai_assert.h" -#include "../include/assimp/matrix4x4.h" -#include "../include/assimp/Exporter.hpp" +#include +#include +#include #include struct aiScene; diff --git a/code/XFileHelper.h b/code/XFileHelper.h index b28c8ddfe..484952106 100644 --- a/code/XFileHelper.h +++ b/code/XFileHelper.h @@ -47,10 +47,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "../include/assimp/types.h" -#include "../include/assimp/quaternion.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/anim.h" +#include +#include +#include +#include #include "Defines.h" namespace Assimp diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index f95ba023d..9510ab3de 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -47,14 +47,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "XFileImporter.h" #include "XFileParser.h" -#include "ConvertToLHProcess.h" -#include "../include/assimp/IOSystem.hpp" -#include -#include "../include/assimp/scene.h" -#include "../include/assimp/DefaultLogger.hpp" #include "Defines.h" #include "TinyFormatter.h" +#include "ConvertToLHProcess.h" +#include +#include +#include #include +#include diff --git a/code/XFileImporter.h b/code/XFileImporter.h index 6066d19df..1de56cbc5 100644 --- a/code/XFileImporter.h +++ b/code/XFileImporter.h @@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "XFileHelper.h" #include "BaseImporter.h" -#include "../include/assimp/types.h" +#include struct aiNode; diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index fc3752be8..a820955a8 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -50,7 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Exceptional.h" #include "TinyFormatter.h" #include "ByteSwapper.h" -#include "../include/assimp/DefaultLogger.hpp" +#include "StringUtils.h" +#include using namespace Assimp; diff --git a/code/XFileParser.h b/code/XFileParser.h index 995e5cfeb..14c5ef1cf 100644 --- a/code/XFileParser.h +++ b/code/XFileParser.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "../include/assimp/types.h" +#include namespace Assimp { diff --git a/code/XGLLoader.cpp b/code/XGLLoader.cpp index a6a23110a..fd079ef14 100644 --- a/code/XGLLoader.cpp +++ b/code/XGLLoader.cpp @@ -50,24 +50,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StreamReader.h" #include "MemoryIOWrapper.h" -#include -#include "../include/assimp/mesh.h" -#include "../include/assimp/scene.h" +#include +#include #include - - +#include using namespace Assimp; using namespace irr; using namespace irr::io; - // zlib is needed for compressed XGL files #ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL # ifdef ASSIMP_BUILD_NO_OWN_ZLIB # include # else -# include "../contrib/zlib/zlib.h" +# include # endif #endif diff --git a/code/XGLLoader.h b/code/XGLLoader.h index a27b817f5..757f9d564 100644 --- a/code/XGLLoader.h +++ b/code/XGLLoader.h @@ -47,10 +47,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BaseImporter.h" #include "irrXMLWrapper.h" #include "LogAux.h" -#include "../include/assimp/material.h" -#include "../include/assimp/Importer.hpp" -#include "../include/assimp/mesh.h" -#include "../include/assimp/light.h" +#include +#include +#include +#include struct aiNode; diff --git a/code/fast_atof.h b/code/fast_atof.h index 2e2c9fc75..f65d72ae0 100644 --- a/code/fast_atof.h +++ b/code/fast_atof.h @@ -26,7 +26,7 @@ #ifdef _MSC_VER # include #else -#include "../include/assimp/Compiler/pstdint.h" +# include #endif namespace Assimp diff --git a/code/glTFAsset.inl b/code/glTFAsset.inl index 6bfe288d3..d52c825c4 100644 --- a/code/glTFAsset.inl +++ b/code/glTFAsset.inl @@ -288,7 +288,7 @@ inline void Buffer::Read(Value& obj, Asset& r) } this->mData.reset(new uint8_t[dataURI.dataLength]); - memcmp(dataURI.data, this->mData.get(), dataURI.dataLength); + memcpy( this->mData.get(), dataURI.data, dataURI.dataLength ); } } else { // Local file diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index ca606ecdc..7f0c086cf 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -152,14 +152,14 @@ inline Ref ExportData(Asset& a, std::string& meshName, Ref& bu // bufferView Ref bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view")); bv->buffer = buffer; - bv->byteOffset = 0; + bv->byteOffset = unsigned(offset); bv->byteLength = length; //! The target that the WebGL buffer should be bound to. bv->target = isIndices ? BufferViewTarget_ELEMENT_ARRAY_BUFFER : BufferViewTarget_ARRAY_BUFFER; // accessor Ref acc = a.accessors.Create(a.FindUniqueID(meshName, "accessor")); acc->bufferView = bv; - acc->byteOffset = unsigned(offset); + acc->byteOffset = 0; acc->byteStride = 0; acc->componentType = compType; acc->count = count; @@ -292,7 +292,7 @@ void glTFExporter::ExportMeshes() indices[i*nIndicesPerFace + j] = uint16_t(aim->mFaces[i].mIndices[j]); } } - p.indices = ExportData(*mAsset, meshId, b, unsigned(indices.size()), &indices[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_UNSIGNED_SHORT); + p.indices = ExportData(*mAsset, meshId, b, unsigned(indices.size()), &indices[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_UNSIGNED_SHORT, true); } switch (aim->mPrimitiveTypes) { diff --git a/code/qnan.h b/code/qnan.h index e8d3ab7e2..02412bf21 100644 --- a/code/qnan.h +++ b/code/qnan.h @@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_QNAN_H_INCLUDED #define AI_QNAN_H_INCLUDED -#include "../include/assimp/defs.h" +#include #include #include diff --git a/contrib/openddlparser/code/OpenDDLCommon.cpp b/contrib/openddlparser/code/OpenDDLCommon.cpp index c0a2b0318..13a96f7a8 100644 --- a/contrib/openddlparser/code/OpenDDLCommon.cpp +++ b/contrib/openddlparser/code/OpenDDLCommon.cpp @@ -154,10 +154,17 @@ DataArrayList::~DataArrayList() { size_t DataArrayList::size() { size_t result( 0 ); - DataArrayList *n=m_next; - while( n!=ddl_nullptr ) { + if ( ddl_nullptr == m_next ) { + if ( m_dataList != ddl_nullptr ) { + result = 1; + } + return result; + } + + DataArrayList *n( m_next ); + while( ddl_nullptr != n ) { result++; - n=n->m_next; + n = n->m_next; } return result; } diff --git a/contrib/openddlparser/code/OpenDDLExport.cpp b/contrib/openddlparser/code/OpenDDLExport.cpp index 43e3bcb02..6f1c3449a 100644 --- a/contrib/openddlparser/code/OpenDDLExport.cpp +++ b/contrib/openddlparser/code/OpenDDLExport.cpp @@ -334,7 +334,7 @@ bool OpenDDLExport::writeValue( Value *val, std::string &statement ) { const int i = static_cast< int >( val->getInt64() ); stream << i; statement += stream.str(); - } + } break; case Value::ddl_unsigned_int8: { @@ -378,6 +378,11 @@ bool OpenDDLExport::writeValue( Value *val, std::string &statement ) { } break; case Value::ddl_double: + { + std::stringstream stream; + stream << val->getDouble(); + statement += stream.str(); + } break; case Value::ddl_string: { diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index 921f67aa4..6f471be36 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -948,15 +948,23 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value::ValueType type, return in; } -static DataArrayList *createDataArrayList( Value *currentValue, size_t numValues ) { - DataArrayList *dataList = new DataArrayList; +static DataArrayList *createDataArrayList( Value *currentValue, size_t numValues, + Reference *refs, size_t numRefs ) { + DataArrayList *dataList( new DataArrayList ); dataList->m_dataList = currentValue; dataList->m_numItems = numValues; + dataList->m_refs = refs; + dataList->m_numRefs = numRefs; return dataList; } -char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType type, DataArrayList **dataArrayList ) { +char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType type, + DataArrayList **dataArrayList ) { + if ( ddl_nullptr == dataArrayList ) { + return in; + } + *dataArrayList = ddl_nullptr; if( ddl_nullptr == in || in == end ) { return in; @@ -975,10 +983,10 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType ty in = parseDataList( in, end, type, ¤tValue, numValues, &refs, numRefs ); if( ddl_nullptr != currentValue || 0 != numRefs ) { if( ddl_nullptr == prev ) { - *dataArrayList = createDataArrayList( currentValue, numValues ); + *dataArrayList = createDataArrayList( currentValue, numValues, refs, numRefs ); prev = *dataArrayList; } else { - currentDataList = createDataArrayList( currentValue, numValues ); + currentDataList = createDataArrayList( currentValue, numValues, refs, numRefs ); if( ddl_nullptr != prev ) { prev->m_next = currentDataList; prev = currentDataList; diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h b/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h index ddf36df31..d3e0fb458 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h @@ -209,6 +209,8 @@ struct DLL_ODDLPARSER_EXPORT DataArrayList { size_t m_numItems; ///< The number of items in the list. Value *m_dataList; ///< The data list ( a Value ). DataArrayList *m_next; ///< The next data array list ( ddl_nullptr if last ). + Reference *m_refs; + size_t m_numRefs; /// @brief The default constructor for initialization. DataArrayList(); diff --git a/contrib/rapidjson/include/rapidjson/document.h b/contrib/rapidjson/include/rapidjson/document.h index 7079ef8a2..98053cbd5 100644 --- a/contrib/rapidjson/include/rapidjson/document.h +++ b/contrib/rapidjson/include/rapidjson/document.h @@ -557,7 +557,7 @@ public: flags_ |= kIntFlag; } -#if !defined(__x86_64__) +#if !defined(__x86_64__) && !defined(__arm64__) //! Constructor for size_t value. explicit GenericValue( size_t u ) RAPIDJSON_NOEXCEPT : data_(), flags_( kNumberUintFlag ) { data_.n.u64 = u; diff --git a/include/assimp/color4.h b/include/assimp/color4.h index 2a2c338c8..6bcab45df 100644 --- a/include/assimp/color4.h +++ b/include/assimp/color4.h @@ -86,12 +86,7 @@ public: public: // Red, green, blue and alpha color values - union { - struct { - TReal r, g, b, a; - }; - TReal c[ 4 ]; - }; + TReal r, g, b, a; } PACK_STRUCT; // !struct aiColor4D typedef aiColor4t aiColor4D; @@ -99,12 +94,7 @@ typedef aiColor4t aiColor4D; #else struct aiColor4D { - union { - struct { - float r, g, b, a; - }; - float c[ 4 ]; - }; + float r, g, b, a; } PACK_STRUCT; #endif // __cplusplus diff --git a/include/assimp/light.h b/include/assimp/light.h index cc53a18f4..939d5b6cd 100644 --- a/include/assimp/light.h +++ b/include/assimp/light.h @@ -82,6 +82,10 @@ enum aiLightSourceType //! other properties, just a color. aiLightSource_AMBIENT = 0x4, + //! An area light is a rectangle with predefined size that uniformly + //! emits light from one of its sides. The position is center of the + //! rectangle and direction is its normal vector. + aiLightSource_AREA = 0x5, /** This value is not used. It is just there to force the * compiler to map this enum to a 32 Bit integer. @@ -135,6 +139,14 @@ struct aiLight */ C_STRUCT aiVector3D mDirection; + /** Up direction of the light source in space. Relative to the + * transformation of the node corresponding to the light. + * + * The direction is undefined for point lights. The vector + * may be normalized, but it needn't. + */ + C_STRUCT aiVector3D mUp; + /** Constant light attenuation factor. * * The intensity of the light source at a given distance 'd' from @@ -217,6 +229,9 @@ struct aiLight */ float mAngleOuterCone; + /** Size of area light source. */ + C_STRUCT aiVector2D mSize; + #ifdef __cplusplus aiLight() @@ -226,6 +241,7 @@ struct aiLight , mAttenuationQuadratic (0.f) , mAngleInnerCone ((float)AI_MATH_TWO_PI) , mAngleOuterCone ((float)AI_MATH_TWO_PI) + , mSize (0.f, 0.f) { } diff --git a/include/assimp/matrix3x3.h b/include/assimp/matrix3x3.h index 6b2350efc..725b1c34c 100644 --- a/include/assimp/matrix3x3.h +++ b/include/assimp/matrix3x3.h @@ -160,16 +160,9 @@ public: const aiVector3t& to, aiMatrix3x3t& out); public: - - union { - struct { - TReal a1, a2, a3; - TReal b1, b2, b3; - TReal c1, c2, c3; - }; - TReal m[ 3 ][ 3 ]; - TReal mData[ 9 ]; - }; + TReal a1, a2, a3; + TReal b1, b2, b3; + TReal c1, c2, c3; } PACK_STRUCT; typedef aiMatrix3x3t aiMatrix3x3; @@ -177,15 +170,9 @@ typedef aiMatrix3x3t aiMatrix3x3; #else struct aiMatrix3x3 { - union { - struct { - float a1, a2, a3; - float b1, b2, b3; - float c1, c2, c3; - }; - float m[ 3 ][ 3 ]; - float mData[ 9 ]; - }; + float a1, a2, a3; + float b1, b2, b3; + float c1, c2, c3; } PACK_STRUCT; #endif // __cplusplus diff --git a/include/assimp/matrix4x4.h b/include/assimp/matrix4x4.h index 79ef26774..fc77b6964 100644 --- a/include/assimp/matrix4x4.h +++ b/include/assimp/matrix4x4.h @@ -222,16 +222,10 @@ public: const aiVector3t& to, aiMatrix4x4t& out); public: - union { - struct { - TReal a1, a2, a3, a4; - TReal b1, b2, b3, b4; - TReal c1, c2, c3, c4; - TReal d1, d2, d3, d4; - }; - TReal m[ 4 ][ 4 ]; - TReal mData[ 16 ]; - }; + TReal a1, a2, a3, a4; + TReal b1, b2, b3, b4; + TReal c1, c2, c3, c4; + TReal d1, d2, d3, d4; } PACK_STRUCT; typedef aiMatrix4x4t aiMatrix4x4; @@ -239,16 +233,10 @@ typedef aiMatrix4x4t aiMatrix4x4; #else struct aiMatrix4x4 { - union { - struct { - float a1, a2, a3, a4; - float b1, b2, b3, b4; - float c1, c2, c3, c4; - float d1, d2, d3, d4; - }; - float m[ 4 ][ 4 ]; - float mData[ 16 ]; - }; + float a1, a2, a3, a4; + float b1, b2, b3, b4; + float c1, c2, c3, c4; + float d1, d2, d3, d4; } PACK_STRUCT; diff --git a/include/assimp/vector2.h b/include/assimp/vector2.h index 2342f1ebd..199743e26 100644 --- a/include/assimp/vector2.h +++ b/include/assimp/vector2.h @@ -95,13 +95,7 @@ public: template operator aiVector2t () const; - union { - struct { - TReal x, y; - }; - TReal v[ 2 ]; - }; - + TReal x, y; } PACK_STRUCT; typedef aiVector2t aiVector2D; @@ -109,12 +103,7 @@ typedef aiVector2t aiVector2D; #else struct aiVector2D { - union { - struct { - float x, y; - }; - float v[ 2 ]; - }; + float x, y; }; #endif // __cplusplus diff --git a/include/assimp/vector3.h b/include/assimp/vector3.h index 0358045e3..84f785f8f 100644 --- a/include/assimp/vector3.h +++ b/include/assimp/vector3.h @@ -125,12 +125,7 @@ public: * @param o Second factor */ const aiVector3t SymMul(const aiVector3t& o); - union { - struct { - TReal x, y, z; - }; - TReal v[ 3 ]; - }; + TReal x, y, z; } PACK_STRUCT; @@ -139,12 +134,7 @@ typedef aiVector3t aiVector3D; #else struct aiVector3D { - union { - struct { - float x, y, z; - }; - float v[ 3 ]; - }; + float x, y, z; } PACK_STRUCT; #endif // __cplusplus diff --git a/port/PyAssimp/setup.py b/port/PyAssimp/setup.py index 1d2242fbb..9b30aa7ba 100644 --- a/port/PyAssimp/setup.py +++ b/port/PyAssimp/setup.py @@ -6,7 +6,7 @@ setup(name='pyassimp', version='0.1', license='ISC', description='Python bindings for the Open Asset Import Library (ASSIMP)', - url='http://assimp.sourceforge.net/', + url='https://github.com/assimp/assimp', packages=['pyassimp'], data_files=[('share/pyassimp', ['README.md']), ('share/examples/pyassimp', ['scripts/' + f for f in os.listdir('scripts/')])] diff --git a/port/iOS/build.sh b/port/iOS/build.sh index 96d686445..beca60014 100755 --- a/port/iOS/build.sh +++ b/port/iOS/build.sh @@ -22,6 +22,8 @@ CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min) CPP_DEV_TARGET= CPP_STD_LIB_LIST=(libc++ libstdc++) CPP_STD_LIB= +CPP_STD_LIST=(c++03 c++11 c++14) +CPP_STD= function join { local IFS="$1"; shift; echo "$*"; } @@ -46,7 +48,7 @@ build_arch() export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -$CPP_DEV_TARGET=$IOS_SDK_TARGET -I$SDKROOT/usr/include/" export LDFLAGS="-L$SDKROOT/usr/lib/" export CPPFLAGS=$CFLAGS - export CXXFLAGS=$CFLAGS + export CXXFLAGS="$CFLAGS -std=$CPP_STD" rm CMakeCache.txt @@ -65,11 +67,16 @@ build_arch() echo "[!] $0 - assimp iOS build script" CPP_STD_LIB=${CPP_STD_LIB_LIST[0]} +CPP_STD=${CPP_STD_LIST[0]} DEPLOY_ARCHS=${BUILD_ARCHS_ALL[*]} DEPLOY_FAT=1 for i in "$@"; do case $i in + -s=*|--std=*) + CPP_STD=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + echo "[!] Selecting c++ standard: $CPP_STD" + ;; -l=*|--stdlib=*) CPP_STD_LIB=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` echo "[!] Selecting c++ std lib: $CPP_STD_LIB" @@ -85,7 +92,8 @@ for i in "$@"; do -h|--help) echo " - don't build fat library (--no-fat)." echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')" - echo " - supported C++ STD libs. (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')" + echo " - supported C++ STD libs (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')" + echo " - supported C++ standards (--std): $(echo $(join , ${CPP_STD_LIST[*]}) | sed 's/,/, /g')" exit ;; *) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a6c00dde1..df0139ddc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ # Open Asset Import Library (assimp) # ---------------------------------------------------------------------- -# +# # Copyright (c) 2006-2016, assimp team # All rights reserved. # @@ -54,6 +54,10 @@ SOURCE_GROUP( unit FILES SET( TEST_SRCS unit/AssimpAPITest.cpp + unit/utBlendImportAreaLight.cpp + unit/utBlendImportMaterials.cpp + unit/utColladaExportCamera.cpp + unit/utColladaExportLight.cpp unit/utFastAtof.cpp unit/utFindDegenerates.cpp unit/utFindInvalidData.cpp @@ -62,6 +66,7 @@ SET( TEST_SRCS unit/utImporter.cpp unit/utImproveCacheLocality.cpp unit/utIOSystem.cpp + unit/utIssues.cpp unit/utJoinVertices.cpp unit/utLimitBoneWeights.cpp unit/utMaterialSystem.cpp @@ -73,15 +78,13 @@ SET( TEST_SRCS unit/utRemoveRedundantMaterials.cpp unit/utScenePreprocessor.cpp unit/utSharedPPData.cpp + unit/utStringUtils.cpp unit/utSortByPType.cpp unit/utSplitLargeMeshes.cpp unit/utTargetAnimation.cpp unit/utTextureTransform.cpp unit/utTriangulate.cpp unit/utVertexTriangleAdjacency.cpp - unit/utColladaExportCamera.cpp - unit/utColladaExportLight.cpp - unit/utIssues.cpp ) SOURCE_GROUP( tests FILES ${TEST_SRCS} ) diff --git a/test/models/BLEND/AreaLight_269.blend b/test/models/BLEND/AreaLight_269.blend new file mode 100644 index 000000000..9337d5799 Binary files /dev/null and b/test/models/BLEND/AreaLight_269.blend differ diff --git a/test/models/BLEND/BlenderMaterial_269.blend b/test/models/BLEND/BlenderMaterial_269.blend new file mode 100644 index 000000000..4c00fec9d Binary files /dev/null and b/test/models/BLEND/BlenderMaterial_269.blend differ diff --git a/test/regression/db.zip b/test/regression/db.zip index 6f494ae26..a6ccf0a90 100644 Binary files a/test/regression/db.zip and b/test/regression/db.zip differ diff --git a/test/regression/run.py b/test/regression/run.py index a6d3fb7d6..1ff46fb17 100755 --- a/test/regression/run.py +++ b/test/regression/run.py @@ -58,6 +58,7 @@ import os import subprocess import zipfile import collections +import multiprocessing import settings import utils diff --git a/test/regression/settings.py b/test/regression/settings.py index fce51d803..ad7e67a13 100644 --- a/test/regression/settings.py +++ b/test/regression/settings.py @@ -53,7 +53,7 @@ import os # pond.0.ply - loads with 40k identical triangles, causing postprocessing # to have quadratic runtime. # ------------------------------------------------------------------------------- -files_to_ignore = ["pond.0.ply", "Example.ogex"] +files_to_ignore = ["pond.0.ply"] # ------------------------------------------------------------------------------- # List of file extensions to be excluded from the regression suite diff --git a/test/unit/utBlendImportAreaLight.cpp b/test/unit/utBlendImportAreaLight.cpp new file mode 100644 index 000000000..603a5e513 --- /dev/null +++ b/test/unit/utBlendImportAreaLight.cpp @@ -0,0 +1,113 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2016, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ +#include "UnitTestPCH.h" + +#include +#include +#include +#include + +class BlendImportAreaLight : public ::testing::Test { +public: + + virtual void SetUp() + { + im = new Assimp::Importer(); + } + + virtual void TearDown() + { + delete im; + } + +protected: + + Assimp::Importer* im; +}; + +// ------------------------------------------------------------------------------------------------ +TEST_F(BlendImportAreaLight, testImportLight) +{ + const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/AreaLight_269.blend",0); + ASSERT_TRUE(pTest != NULL); + ASSERT_TRUE(pTest->HasLights()); + + std::vector< std::pair > lightNames; + + for (size_t i = 0; i < pTest->mNumLights; i++) { + lightNames.push_back(std::make_pair(pTest->mLights[i]->mName.C_Str(), i)); + } + + std::sort(lightNames.begin(), lightNames.end()); + + std::vector lights; + + for (size_t i = 0; i < pTest->mNumLights; ++i) { + lights.push_back(*pTest->mLights[lightNames[i].second]); + } + + ASSERT_STREQ(lights[0].mName.C_Str(), "Bar"); + ASSERT_STREQ(lights[1].mName.C_Str(), "Baz"); + ASSERT_STREQ(lights[2].mName.C_Str(), "Foo"); + + ASSERT_EQ(lights[0].mType, aiLightSource_AREA); + ASSERT_EQ(lights[1].mType, aiLightSource_POINT); + ASSERT_EQ(lights[2].mType, aiLightSource_AREA); + + EXPECT_FLOAT_EQ(lights[0].mSize.x, 0.5f); + EXPECT_FLOAT_EQ(lights[0].mSize.y, 2.0f); + EXPECT_FLOAT_EQ(lights[2].mSize.x, 1.0f); + EXPECT_FLOAT_EQ(lights[2].mSize.y, 1.0f); + + EXPECT_FLOAT_EQ(lights[0].mColorDiffuse.r, 42.0f); + EXPECT_FLOAT_EQ(lights[0].mColorDiffuse.g, 42.0f); + EXPECT_FLOAT_EQ(lights[0].mColorDiffuse.b, 42.0f); + EXPECT_FLOAT_EQ(lights[2].mColorDiffuse.r, 1.0f); + EXPECT_FLOAT_EQ(lights[2].mColorDiffuse.g, 1.0f); + EXPECT_FLOAT_EQ(lights[2].mColorDiffuse.b, 1.0f); + + EXPECT_FLOAT_EQ(lights[0].mDirection.x, 0.0f); + EXPECT_FLOAT_EQ(lights[0].mDirection.y, 0.0f); + EXPECT_FLOAT_EQ(lights[0].mDirection.z, -1.0f); + EXPECT_FLOAT_EQ(lights[2].mDirection.x, 0.0f); + EXPECT_FLOAT_EQ(lights[2].mDirection.y, 0.0f); + EXPECT_FLOAT_EQ(lights[2].mDirection.z, -1.0f); +} diff --git a/test/unit/utBlendImportMaterials.cpp b/test/unit/utBlendImportMaterials.cpp new file mode 100644 index 000000000..f45c2a219 --- /dev/null +++ b/test/unit/utBlendImportMaterials.cpp @@ -0,0 +1,124 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2016, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ +#include "UnitTestPCH.h" + +#include +#include +#include + +class BlendImportMaterials : public ::testing::Test { +public: + + virtual void SetUp() + { + im = new Assimp::Importer(); + } + + virtual void TearDown() + { + delete im; + } + +protected: + + Assimp::Importer* im; +}; + +// ------------------------------------------------------------------------------------------------ +TEST_F(BlendImportMaterials, testImportMaterial) +{ + const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderMaterial_269.blend", 0); + ASSERT_TRUE(pTest != NULL); + ASSERT_TRUE(pTest->HasMaterials()); + + ASSERT_EQ(1, pTest->mNumMaterials); + + auto alpha = pTest->mMaterials[0]; + + #define ASSERT_PROPERTY_EQ(expected, key, var) \ + auto var = expected; \ + ASSERT_EQ(aiReturn_SUCCESS, alpha->Get("$mat.blend." key, 0, 0, var)); \ + ASSERT_EQ(expected, var); + + #define ASSERT_PROPERTY_FLOAT_EQ(expected, key, var) \ + auto var = expected; \ + ASSERT_EQ(aiReturn_SUCCESS, alpha->Get("$mat.blend." key, 0, 0, var)); \ + ASSERT_FLOAT_EQ(expected, var); + + ASSERT_PROPERTY_EQ(aiColor3D(0.1f, 0.2f, 0.3f), "diffuse.color", diffuseColor); + ASSERT_PROPERTY_EQ(0.4f, "diffuse.intensity", diffuseIntensity); + ASSERT_PROPERTY_EQ(1, "diffuse.shader", diffuseShader); + ASSERT_PROPERTY_EQ(0, "diffuse.ramp", diffuseRamp); + + ASSERT_PROPERTY_EQ(aiColor3D(0.5f, 0.6f, 0.7f), "specular.color", specularColor); + ASSERT_PROPERTY_EQ(0.8f, "specular.intensity", specularIntensity); + ASSERT_PROPERTY_EQ(1, "specular.shader", specularShader); + ASSERT_PROPERTY_EQ(0, "specular.ramp", specularRamp); + ASSERT_PROPERTY_EQ(9, "specular.hardness", specularHardness); + + ASSERT_PROPERTY_EQ(1, "transparency.use", transparencyUse); + ASSERT_PROPERTY_EQ(2, "transparency.method", transparencyMethod); + ASSERT_PROPERTY_EQ(0.01f, "transparency.alpha", transparencyAlpha); + ASSERT_PROPERTY_EQ(0.02f, "transparency.specular", transparencySpecular); + ASSERT_PROPERTY_EQ(0.03f, "transparency.fresnel", transparencyFresnel); + ASSERT_PROPERTY_EQ(3.14f, "transparency.blend", transparencyBlend); + ASSERT_PROPERTY_EQ(0.85f, "transparency.ior", transparencyIor); + ASSERT_PROPERTY_FLOAT_EQ(0.128f, "transparency.filter", transparencyFilter); + ASSERT_PROPERTY_FLOAT_EQ(1.298f, "transparency.falloff", transparencyFalloff); + ASSERT_PROPERTY_FLOAT_EQ(0.2376f, "transparency.limit", transparencyLimit); + ASSERT_PROPERTY_EQ(7, "transparency.depth", transparencyDepth); + ASSERT_PROPERTY_FLOAT_EQ(0.678f, "transparency.glossAmount", transparencyGlossAmount); + ASSERT_PROPERTY_FLOAT_EQ(0.208f, "transparency.glossThreshold", transparencyGlossThreshold); + ASSERT_PROPERTY_EQ(17, "transparency.glossSamples", transparencyGlossSamples); + + ASSERT_PROPERTY_EQ(1, "mirror.use", mirrorUse); + ASSERT_PROPERTY_FLOAT_EQ(0.28f, "mirror.reflectivity", mirrorReflectivity); + ASSERT_PROPERTY_EQ(aiColor3D(0.25f, 0.5f, 0.128f), "mirror.color", mirrorColor); + ASSERT_PROPERTY_FLOAT_EQ(0.256f, "mirror.fresnel", mirrorFresnel); + ASSERT_PROPERTY_FLOAT_EQ(1.61f, "mirror.blend", mirrorBlend); + ASSERT_PROPERTY_EQ(12, "mirror.depth", mirrorDepth); + ASSERT_PROPERTY_FLOAT_EQ(0.4f, "mirror.maxDist", mirrorMaxDist); + ASSERT_PROPERTY_EQ(1, "mirror.fadeTo", mirrorFadeTo); + ASSERT_PROPERTY_FLOAT_EQ(0.512f, "mirror.glossAmount", mirrorGlossAmount); + ASSERT_PROPERTY_FLOAT_EQ(0.18f, "mirror.glossThreshold", mirrorGlossThreshold); + ASSERT_PROPERTY_EQ(61, "mirror.glossSamples", mirrorGlossSamples); + ASSERT_PROPERTY_FLOAT_EQ(0.87f, "mirror.glossAnisotropic", mirrorGlossAnisotropic); +} diff --git a/test/unit/utIssues.cpp b/test/unit/utIssues.cpp index 7346009ba..499fc80ee 100644 --- a/test/unit/utIssues.cpp +++ b/test/unit/utIssues.cpp @@ -53,7 +53,7 @@ class utIssues : public ::testing::Test { #ifndef ASSIMP_BUILD_NO_EXPORT TEST_F( utIssues, OpacityBugWhenExporting_727 ) { - aiScene *scene( new aiScene ); + /*aiScene *scene( new aiScene ); scene->mNumMaterials = 1; scene->mMaterials = new aiMaterial*; @@ -90,9 +90,9 @@ TEST_F( utIssues, OpacityBugWhenExporting_727 ) { Assimp::Importer importer; Assimp::Exporter exporter; for ( std::size_t i( 0 ); i < exporter.GetExportFormatCount(); ++i ) { - /*const aiExportFormatDesc *desc( exporter.GetExportFormatDescription( i ) ); - std::cout << "[" << desc->id << "] "; - std::string path( "scene." ); + std::string path; + const aiExportFormatDesc *desc( exporter.GetExportFormatDescription( i ) ); + EXPECT_NE( desc, nullptr ); path.append( desc->fileExtension ); ASSERT_EQ( AI_SUCCESS, exporter.Export( scene, desc->id, path ) ); @@ -102,8 +102,8 @@ TEST_F( utIssues, OpacityBugWhenExporting_727 ) { if ( newScene->mNumMaterials > 0 ) { //ASSERT_EQ( AI_SUCCESS, newScene->mMaterials[ 0 ]->Get( AI_MATKEY_OPACITY, newOpacity ) ); //EXPECT_EQ( opacity, newOpacity ); - }*/ - } + } + }*/ } #endif // ASSIMP_BUILD_NO_EXPORT diff --git a/test/unit/utStringUtils.cpp b/test/unit/utStringUtils.cpp new file mode 100644 index 000000000..e75ff8d4b --- /dev/null +++ b/test/unit/utStringUtils.cpp @@ -0,0 +1,68 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2016, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ +#include "UnitTestPCH.h" +#include "StringUtils.h" + +class utStringUtils : public ::testing::Test { +}; + +TEST_F( utStringUtils, to_string_Test ) { + std::string res = to_string( 1 ); + EXPECT_EQ( res, "1" ); + + res = to_string( 1.0f ); + EXPECT_EQ( res, "1" ); +} + +TEST_F( utStringUtils, ai_strtofTest ) { + float res = ai_strtof( nullptr, nullptr ); + EXPECT_FLOAT_EQ( res, 0.0f ); + + std::string testStr1 = "200.0"; + res = ai_strtof( testStr1.c_str(), nullptr ); + EXPECT_FLOAT_EQ( res, 200.0f ); + + std::string testStr2 = "200.0 xxx"; + const char *begin( testStr2.c_str() ); + const char *end( begin + 6 ); + res = ai_strtof( begin, end ); + EXPECT_FLOAT_EQ( res, 200.0f ); +}