Merge branch 'master' into timmmeh-gltf2-validation-patch

pull/2261/head
Kim Kulling 2018-12-11 07:59:11 +01:00 committed by GitHub
commit ae7a045396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 20 deletions

View File

@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@/ exec_prefix=@CMAKE_INSTALL_PREFIX@/
libdir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_LIB_INSTALL_DIR@ libdir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_LIB_INSTALL_DIR@
includedir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_INCLUDE_INSTALL_DIR@ includedir=@CMAKE_INSTALL_PREFIX@/../include/@ASSIMP_INCLUDE_INSTALL_DIR@
Name: @CMAKE_PROJECT_NAME@ Name: @CMAKE_PROJECT_NAME@
Description: Import various well-known 3D model formats in an uniform manner. Description: Import various well-known 3D model formats in an uniform manner.

View File

@ -727,7 +727,7 @@ ADD_ASSIMP_IMPORTER( MMD
MMDVmdParser.h MMDVmdParser.h
) )
SET( Step_SRCS ADD_ASSIMP_IMPORTER( STEP
STEPFile.h STEPFile.h
Importer/StepFile/StepFileImporter.h Importer/StepFile/StepFileImporter.h
Importer/StepFile/StepFileImporter.cpp Importer/StepFile/StepFileImporter.cpp
@ -738,7 +738,6 @@ SET( Step_SRCS
StepExporter.h StepExporter.h
StepExporter.cpp StepExporter.cpp
) )
SOURCE_GROUP( Step FILES ${Step_SRCS})
SET( Exporter_SRCS SET( Exporter_SRCS
Exporter.cpp Exporter.cpp

View File

@ -1533,7 +1533,23 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
// write transformation - we can directly put the matrix there // write transformation - we can directly put the matrix there
// TODO: (thom) decompose into scale - rot - quad to allow addressing it by animations afterwards // TODO: (thom) decompose into scale - rot - quad to allow addressing it by animations afterwards
const aiMatrix4x4& mat = pNode->mTransformation; aiMatrix4x4 mat = pNode->mTransformation;
// If this node is a Camera node, the camera coordinate system needs to be multiplied in.
// When importing from Collada, the mLookAt is set to 0, 0, -1, and the node transform is unchanged.
// When importing from a different format, mLookAt is set to 0, 0, 1. Therefore, the local camera
// coordinate system must be changed to matche the Collada specification.
for (size_t i = 0; i<mScene->mNumCameras; i++){
if (mScene->mCameras[i]->mName == pNode->mName){
aiMatrix4x4 sourceView;
mScene->mCameras[i]->GetCameraMatrix(sourceView);
aiMatrix4x4 colladaView;
colladaView.a1 = colladaView.c3 = -1; // move into -z space.
mat *= (sourceView * colladaView);
break;
}
}
// customized, sid should be 'matrix' to match with loader code. // customized, sid should be 'matrix' to match with loader code.
//mOutput << startstr << "<matrix sid=\"transform\">"; //mOutput << startstr << "<matrix sid=\"transform\">";

View File

@ -1559,8 +1559,7 @@ void FBXConverter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMa
} }
const Texture* const tex = ( *it ).second; const Texture* const tex = ( *it ).second;
if ( tex != 0 ) if ( tex != nullptr ) {
{
aiString path = GetTexturePath(tex); aiString path = GetTexturePath(tex);
out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, 0 ); out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, 0 );
@ -1794,10 +1793,9 @@ void FBXConverter::SetTextureProperties( aiMaterial* out_mat, const TextureMap&
{ {
TrySetTextureProperties( out_mat, textures, "DiffuseColor", aiTextureType_DIFFUSE, mesh ); TrySetTextureProperties( out_mat, textures, "DiffuseColor", aiTextureType_DIFFUSE, mesh );
TrySetTextureProperties( out_mat, textures, "AmbientColor", aiTextureType_AMBIENT, mesh ); TrySetTextureProperties( out_mat, textures, "AmbientColor", aiTextureType_AMBIENT, mesh );
TrySetTextureProperties( out_mat, textures, "EmissiveColor", aiTextureType_EMISSIVE, mesh ); TrySetTextureProperties( out_mat, textures, "EmissiveFactor", aiTextureType_EMISSIVE, mesh );
TrySetTextureProperties( out_mat, textures, "SpecularColor", aiTextureType_SPECULAR, mesh );
TrySetTextureProperties( out_mat, textures, "SpecularFactor", aiTextureType_SPECULAR, mesh); TrySetTextureProperties( out_mat, textures, "SpecularFactor", aiTextureType_SPECULAR, mesh);
TrySetTextureProperties( out_mat, textures, "TransparentColor", aiTextureType_OPACITY, mesh ); TrySetTextureProperties( out_mat, textures, "TransparencyFactor", aiTextureType_OPACITY, mesh );
TrySetTextureProperties( out_mat, textures, "ReflectionColor", aiTextureType_REFLECTION, mesh ); TrySetTextureProperties( out_mat, textures, "ReflectionColor", aiTextureType_REFLECTION, mesh );
TrySetTextureProperties( out_mat, textures, "DisplacementColor", aiTextureType_DISPLACEMENT, mesh ); TrySetTextureProperties( out_mat, textures, "DisplacementColor", aiTextureType_DISPLACEMENT, mesh );
TrySetTextureProperties( out_mat, textures, "NormalMap", aiTextureType_NORMALS, mesh ); TrySetTextureProperties( out_mat, textures, "NormalMap", aiTextureType_NORMALS, mesh );
@ -1809,10 +1807,9 @@ void FBXConverter::SetTextureProperties( aiMaterial* out_mat, const LayeredTextu
{ {
TrySetTextureProperties( out_mat, layeredTextures, "DiffuseColor", aiTextureType_DIFFUSE, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "DiffuseColor", aiTextureType_DIFFUSE, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "AmbientColor", aiTextureType_AMBIENT, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "AmbientColor", aiTextureType_AMBIENT, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "EmissiveColor", aiTextureType_EMISSIVE, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "EmissiveFactor", aiTextureType_EMISSIVE, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "SpecularColor", aiTextureType_SPECULAR, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "SpecularFactor", aiTextureType_SPECULAR, mesh); TrySetTextureProperties( out_mat, layeredTextures, "SpecularFactor", aiTextureType_SPECULAR, mesh);
TrySetTextureProperties( out_mat, layeredTextures, "TransparentColor", aiTextureType_OPACITY, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "TransparencyFactor", aiTextureType_OPACITY, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "ReflectionColor", aiTextureType_REFLECTION, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "ReflectionColor", aiTextureType_REFLECTION, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "DisplacementColor", aiTextureType_DISPLACEMENT, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "DisplacementColor", aiTextureType_DISPLACEMENT, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "NormalMap", aiTextureType_NORMALS, mesh ); TrySetTextureProperties( out_mat, layeredTextures, "NormalMap", aiTextureType_NORMALS, mesh );

View File

@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */ /** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
#include "code/Importer/StepFile/StepReaderGen.h" #include "code/Importer/StepFile/StepReaderGen.h"

View File

@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
#include "StepFileImporter.h" #include "StepFileImporter.h"
#include "../../Importer/STEPParser/STEPFileReader.h" #include "../../Importer/STEPParser/STEPFileReader.h"
@ -110,5 +110,5 @@ void StepFileImporter::InternReadFile(const std::string &file, aiScene* pScene,
} // Namespace StepFile } // Namespace StepFile
} // Namespace Assimp } // Namespace Assimp
#endif // ASSIMP_BUILD_NO_STEPFILE_IMPORTER #endif // ASSIMP_BUILD_NO_STEP_IMPORTER

View File

@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
#include <assimp/BaseImporter.h> #include <assimp/BaseImporter.h>
@ -66,4 +66,4 @@ private:
} // Namespace StepFile } // Namespace StepFile
} // Namespace Assimp } // Namespace Assimp
#endif // ASSIMP_BUILD_NO_STEPFILE_IMPORTER #endif // ASSIMP_BUILD_NO_STEP_IMPORTER

View File

@ -197,7 +197,7 @@ corresponding preprocessor flag to selectively disable formats.
#ifndef ASSIMP_BUILD_NO_MMD_IMPORTER #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
# include "MMDImporter.h" # include "MMDImporter.h"
#endif #endif
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
# include "Importer/StepFile/StepFileImporter.h" # include "Importer/StepFile/StepFileImporter.h"
#endif #endif
@ -355,7 +355,7 @@ void GetImporterInstanceList(std::vector< BaseImporter* >& out)
#ifndef ASSIMP_BUILD_NO_MMD_IMPORTER #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
out.push_back( new MMDImporter() ); out.push_back( new MMDImporter() );
#endif #endif
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
out.push_back(new StepFile::StepFileImporter()); out.push_back(new StepFile::StepFileImporter());
#endif #endif
} }

View File

@ -439,6 +439,12 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
} }
for (size_t tc = 0; tc < attr.texcoord.size() && tc < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++tc) { for (size_t tc = 0; tc < attr.texcoord.size() && tc < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++tc) {
if (!attr.texcoord[tc]) {
DefaultLogger::get()->warn("NULL texcoord encountered in mesh \"" + mesh.name +
"\" and will be ignored");
continue;
}
if (attr.texcoord[tc]->count != aim->mNumVertices) { if (attr.texcoord[tc]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Texcoord stream size in mesh \"" + mesh.name + DefaultLogger::get()->warn("Texcoord stream size in mesh \"" + mesh.name +
"\" does not match the vertex count"); "\" does not match the vertex count");

View File

@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */ /** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER #ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
#include "code/Importer/StepFile/StepReaderGen.h" #include "code/Importer/StepFile/StepReaderGen.h"