Browse Source

Merge branch 'master' of github.com:assimp/assimp

Faule Socke 12 years ago
parent
commit
853a5f9bbc
3 changed files with 20 additions and 16 deletions
  1. 16 15
      code/ColladaLoader.cpp
  2. 1 0
      code/ColladaLoader.h
  3. 3 1
      include/assimp/config.h

+ 16 - 15
code/ColladaLoader.cpp

@@ -73,7 +73,7 @@ static const aiImporterDesc desc = {
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 // Constructor to be privately used by Importer
 ColladaLoader::ColladaLoader()
 ColladaLoader::ColladaLoader()
-: noSkeletonMesh()
+: noSkeletonMesh(), ignoreUpDirection(false)
 {}
 {}
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
@@ -108,6 +108,7 @@ bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, boo
 void ColladaLoader::SetupProperties(const Importer* pImp)
 void ColladaLoader::SetupProperties(const Importer* pImp)
 {
 {
 	noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
 	noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
+	ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION,0) != 0;
 }
 }
 
 
 
 
@@ -160,21 +161,21 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
                                                           0,  parser.mUnitSize,  0,  0,
                                                           0,  parser.mUnitSize,  0,  0,
                                                           0,  0,  parser.mUnitSize,  0,
                                                           0,  0,  parser.mUnitSize,  0,
                                                           0,  0,  0,  1);
                                                           0,  0,  0,  1);
-
+        if( !ignoreUpDirection ) {
         // Convert to Y_UP, if different orientation
         // Convert to Y_UP, if different orientation
-	if( parser.mUpDirection == ColladaParser::UP_X)
-		pScene->mRootNode->mTransformation *= aiMatrix4x4( 
-			 0, -1,  0,  0, 
-			 1,  0,  0,  0,
-			 0,  0,  1,  0,
-			 0,  0,  0,  1);
-	else if( parser.mUpDirection == ColladaParser::UP_Z)
-		pScene->mRootNode->mTransformation *= aiMatrix4x4( 
-			 1,  0,  0,  0, 
-			 0,  0,  1,  0,
-			 0, -1,  0,  0,
-			 0,  0,  0,  1);
-
+		if( parser.mUpDirection == ColladaParser::UP_X)
+			pScene->mRootNode->mTransformation *= aiMatrix4x4( 
+				 0, -1,  0,  0, 
+				 1,  0,  0,  0,
+				 0,  0,  1,  0,
+				 0,  0,  0,  1);
+		else if( parser.mUpDirection == ColladaParser::UP_Z)
+			pScene->mRootNode->mTransformation *= aiMatrix4x4( 
+				 1,  0,  0,  0, 
+				 0,  0,  1,  0,
+				 0, -1,  0,  0,
+				 0,  0,  0,  1);
+        }
 	// store all meshes
 	// store all meshes
 	StoreSceneMeshes( pScene);
 	StoreSceneMeshes( pScene);
 
 

+ 1 - 0
code/ColladaLoader.h

@@ -234,6 +234,7 @@ protected:
 	std::vector<aiAnimation*> mAnims;
 	std::vector<aiAnimation*> mAnims;
 
 
 	bool noSkeletonMesh;
 	bool noSkeletonMesh;
+	bool ignoreUpDirection;
 };
 };
 
 
 } // end of namespace Assimp
 } // end of namespace Assimp

+ 3 - 1
include/assimp/config.h

@@ -841,4 +841,6 @@ enum aiComponent
  */
  */
 #define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION"
 #define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION"
 
 
-#endif // !! AI_CONFIG_H_INC
+#define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION"
+
+#endif // !! AI_CONFIG_H_INC