فهرست منبع

Merge commit 'c0871b35c0ab7091f68c794eb954493722522d4c' into contrib

Léo Terziman 11 سال پیش
والد
کامیت
7372bf2467
2فایلهای تغییر یافته به همراه38 افزوده شده و 7 حذف شده
  1. 0 1
      code/ColladaParser.cpp
  2. 38 6
      code/FBXConverter.cpp

+ 0 - 1
code/ColladaParser.cpp

@@ -1660,7 +1660,6 @@ void ColladaParser::ReadDataArray()
 	std::string id = mReader->getAttributeValue( indexID);
 	std::string id = mReader->getAttributeValue( indexID);
 	int indexCount = GetAttribute( "count");
 	int indexCount = GetAttribute( "count");
 	unsigned int count = (unsigned int) mReader->getAttributeValueAsInt( indexCount);
 	unsigned int count = (unsigned int) mReader->getAttributeValueAsInt( indexCount);
-	if (count == 0) { return; } // some exporters write empty data arrays with count="0"
 	const char* content = TestTextContent();
 	const char* content = TestTextContent();
 
 
   // read values and store inside an array in the data library
   // read values and store inside an array in the data library

+ 38 - 6
code/FBXConverter.cpp

@@ -88,6 +88,9 @@ public:
 		TransformationComp_ScalingPivot,
 		TransformationComp_ScalingPivot,
 		TransformationComp_Scaling,
 		TransformationComp_Scaling,
 		TransformationComp_ScalingPivotInverse,
 		TransformationComp_ScalingPivotInverse,
+		TransformationComp_GeometricTranslation,
+		TransformationComp_GeometricRotation,
+		TransformationComp_GeometricScaling,
 
 
 		TransformationComp_MAXIMUM
 		TransformationComp_MAXIMUM
 	};
 	};
@@ -419,6 +422,12 @@ private:
 			return "Scaling";
 			return "Scaling";
 		case TransformationComp_ScalingPivotInverse:
 		case TransformationComp_ScalingPivotInverse:
 			return "ScalingPivotInverse";
 			return "ScalingPivotInverse";
+		case TransformationComp_GeometricScaling:
+			return "GeometricScaling";
+		case TransformationComp_GeometricRotation:
+			return "GeometricRotation";
+		case TransformationComp_GeometricTranslation:
+			return "GeometricTranslation";
 		case TransformationComp_MAXIMUM: // this is to silence compiler warnings
 		case TransformationComp_MAXIMUM: // this is to silence compiler warnings
 			break;
 			break;
 		}
 		}
@@ -456,6 +465,12 @@ private:
 			return "Lcl Scaling";
 			return "Lcl Scaling";
 		case TransformationComp_ScalingPivotInverse:
 		case TransformationComp_ScalingPivotInverse:
 			return "ScalingPivotInverse";
 			return "ScalingPivotInverse";
+		case TransformationComp_GeometricScaling:
+			return "GeometricScaling";
+		case TransformationComp_GeometricRotation:
+			return "GeometricRotation";
+		case TransformationComp_GeometricTranslation:
+			return "GeometricTranslation";
 		case TransformationComp_MAXIMUM: // this is to silence compiler warnings
 		case TransformationComp_MAXIMUM: // this is to silence compiler warnings
 			break;
 			break;
 		}
 		}
@@ -577,9 +592,8 @@ private:
 		for (size_t i = 0; i < TransformationComp_MAXIMUM; ++i) {
 		for (size_t i = 0; i < TransformationComp_MAXIMUM; ++i) {
 			const TransformationComp comp = static_cast<TransformationComp>(i);
 			const TransformationComp comp = static_cast<TransformationComp>(i);
 
 
-			if(comp == TransformationComp_Rotation || comp == TransformationComp_Scaling || 
-				comp == TransformationComp_Translation) {
-
+			if( comp == TransformationComp_Rotation || comp == TransformationComp_Scaling || comp == TransformationComp_Translation ||
+				comp == TransformationComp_GeometricScaling || comp == TransformationComp_GeometricRotation || comp == TransformationComp_GeometricTranslation ) { 
 				continue;
 				continue;
 			}
 			}
 
 
@@ -676,6 +690,21 @@ private:
 		if(ok && Rotation.SquareLength() > zero_epsilon) {
 		if(ok && Rotation.SquareLength() > zero_epsilon) {
 			GetRotationMatrix(rot, Rotation, chain[TransformationComp_Rotation]);
 			GetRotationMatrix(rot, Rotation, chain[TransformationComp_Rotation]);
 		}
 		}
+		
+		const aiVector3D& GeometricScaling = PropertyGet<aiVector3D>(props, "GeometricScaling", ok);
+		if (ok && fabs(GeometricScaling.SquareLength() - 1.0f) > zero_epsilon) {
+			aiMatrix4x4::Scaling(GeometricScaling, chain[TransformationComp_GeometricScaling]);
+		}
+		
+		const aiVector3D& GeometricRotation = PropertyGet<aiVector3D>(props, "GeometricRotation", ok);
+		if (ok && GeometricRotation.SquareLength() > zero_epsilon) {
+			GetRotationMatrix(rot, GeometricRotation, chain[TransformationComp_GeometricRotation]);
+		}
+
+		const aiVector3D& GeometricTranslation = PropertyGet<aiVector3D>(props, "GeometricTranslation", ok);
+		if (ok && GeometricTranslation.SquareLength() > zero_epsilon){
+			aiMatrix4x4::Translation(GeometricTranslation, chain[TransformationComp_GeometricTranslation]);
+		}
 
 
 		// is_complex needs to be consistent with NeedsComplexTransformationChain()
 		// is_complex needs to be consistent with NeedsComplexTransformationChain()
 		// or the interplay between this code and the animation converter would
 		// or the interplay between this code and the animation converter would
@@ -1900,9 +1929,9 @@ private:
 
 
 				has_any = true;
 				has_any = true;
 
 
-				if (comp != TransformationComp_Rotation && comp != TransformationComp_Scaling &&
-					comp != TransformationComp_Translation) {
-
+				if (comp != TransformationComp_Rotation && comp != TransformationComp_Scaling && comp != TransformationComp_Translation &&
+					comp != TransformationComp_GeometricScaling && comp != TransformationComp_GeometricRotation && comp != TransformationComp_GeometricTranslation )
+				{
 					has_complex = true;
 					has_complex = true;
 				}
 				}
 			}
 			}
@@ -1955,6 +1984,7 @@ private:
 				case TransformationComp_Rotation:
 				case TransformationComp_Rotation:
 				case TransformationComp_PreRotation:
 				case TransformationComp_PreRotation:
 				case TransformationComp_PostRotation:
 				case TransformationComp_PostRotation:
+				case TransformationComp_GeometricRotation:
 					na = GenerateRotationNodeAnim(chain_name, 
 					na = GenerateRotationNodeAnim(chain_name, 
 						target, 
 						target, 
 						(*chain[i]).second,
 						(*chain[i]).second,
@@ -1969,6 +1999,7 @@ private:
 				case TransformationComp_ScalingOffset:
 				case TransformationComp_ScalingOffset:
 				case TransformationComp_ScalingPivot:
 				case TransformationComp_ScalingPivot:
 				case TransformationComp_Translation:
 				case TransformationComp_Translation:
+				case TransformationComp_GeometricTranslation:
 					na = GenerateTranslationNodeAnim(chain_name, 
 					na = GenerateTranslationNodeAnim(chain_name, 
 						target, 
 						target, 
 						(*chain[i]).second,
 						(*chain[i]).second,
@@ -2017,6 +2048,7 @@ private:
 					break;
 					break;
 
 
 				case TransformationComp_Scaling:
 				case TransformationComp_Scaling:
+				case TransformationComp_GeometricScaling:
 					na = GenerateScalingNodeAnim(chain_name, 
 					na = GenerateScalingNodeAnim(chain_name, 
 						target, 
 						target, 
 						(*chain[i]).second,
 						(*chain[i]).second,