Browse Source

Merge branch 'master' into 3mf_basematerial_support

Kim Kulling 7 years ago
parent
commit
e668b97453
4 changed files with 32 additions and 2 deletions
  1. 16 0
      code/ColladaParser.cpp
  2. 3 0
      code/ColladaParser.h
  3. 2 2
      code/FBXConverter.cpp
  4. 11 0
      code/PlyExporter.cpp

+ 16 - 0
code/ColladaParser.cpp

@@ -222,6 +222,7 @@ void ColladaParser::ReadStructure()
     }
 
 	PostProcessRootAnimations();
+    PostProcessControllers();
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -360,6 +361,21 @@ void ColladaParser::ReadAnimationClipLibrary()
 	}
 }
 
+void ColladaParser::PostProcessControllers()
+{
+  for (ControllerLibrary::iterator it = mControllerLibrary.begin(); it != mControllerLibrary.end(); ++it)
+  {
+    std::string meshId = it->second.mMeshId;
+    ControllerLibrary::iterator findItr = mControllerLibrary.find(meshId);
+    while(findItr != mControllerLibrary.end()) {
+      meshId = findItr->second.mMeshId;
+      findItr = mControllerLibrary.find(meshId);
+    }
+    
+    it->second.mMeshId = meshId;
+  }
+}
+
 // ------------------------------------------------------------------------------------------------
 // Re-build animations from animation clip library, if present, otherwise combine single-channel animations
 void ColladaParser::PostProcessRootAnimations()

+ 3 - 0
code/ColladaParser.h

@@ -87,6 +87,9 @@ namespace Assimp
 		/** Reads the animation clip library */
 		void ReadAnimationClipLibrary();
 
+        /** Unwrap controllers dependency hierarchy */
+        void PostProcessControllers();
+    
 		/** Re-build animations from animation clip library, if present, otherwise combine single-channel animations */
 		void PostProcessRootAnimations();
 

+ 2 - 2
code/FBXConverter.cpp

@@ -643,14 +643,14 @@ void Converter::GenerateTransformationNodeChain( const Model& model, std::vector
     if ( ok && PreRotation.SquareLength() > zero_epsilon ) {
         is_complex = true;
 
-        GetRotationMatrix( rot, PreRotation, chain[ TransformationComp_PreRotation ] );
+        GetRotationMatrix( Model::RotOrder::RotOrder_EulerXYZ, PreRotation, chain[ TransformationComp_PreRotation ] );
     }
 
     const aiVector3D& PostRotation = PropertyGet<aiVector3D>( props, "PostRotation", ok );
     if ( ok && PostRotation.SquareLength() > zero_epsilon ) {
         is_complex = true;
 
-        GetRotationMatrix( rot, PostRotation, chain[ TransformationComp_PostRotation ] );
+        GetRotationMatrix( Model::RotOrder::RotOrder_EulerXYZ, PostRotation, chain[ TransformationComp_PostRotation ] );
     }
 
     const aiVector3D& RotationPivot = PropertyGet<aiVector3D>( props, "RotationPivot", ok );

+ 11 - 0
code/PlyExporter.cpp

@@ -148,6 +148,17 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina
         << aiGetVersionMajor() << '.' << aiGetVersionMinor() << '.'
         << aiGetVersionRevision() << ")" << endl;
 
+    // Look through materials for a diffuse texture, and add it if found
+    for ( unsigned int i = 0; i < pScene->mNumMaterials; ++i )
+    {
+        const aiMaterial* const mat = pScene->mMaterials[i];
+        aiString s;
+        if ( AI_SUCCESS == mat->Get( AI_MATKEY_TEXTURE_DIFFUSE( 0 ), s ) )
+        {
+            mOutput << "comment TextureFile " << s.data << endl;
+        }
+    }
+
     // TODO: probably want to check here rather than just assume something
     //       definitely not good to always write float even if we might have double precision