---------------------------------------------------------------
| 1035 | |
| 1036 | //--------------------------------------------------------------- |
| 1037 | void VisualSceneExporter::exportRotation ( |
| 1038 | const String name, |
| 1039 | const MEulerRotation& rotation ) |
| 1040 | { |
| 1041 | RotateHelper rotateHelper ( rotation ); |
| 1042 | std::vector<std::vector<double> >& matrixRotate = rotateHelper.getRotationMatrix (); |
| 1043 | std::vector<String>& rotateParams = rotateHelper.getRotationParameters (); |
| 1044 | |
| 1045 | // Set zero flags, where the rotation is zero. The order of rotation is ZYX. |
| 1046 | bool isZero[3] = { COLLADABU::Math::Utils::equalsZero ( matrixRotate[0][3], getTolerance () ), |
| 1047 | COLLADABU::Math::Utils::equalsZero ( matrixRotate[1][3], getTolerance () ), |
| 1048 | COLLADABU::Math::Utils::equalsZero ( matrixRotate[2][3], getTolerance () ) }; |
| 1049 | |
| 1050 | // Get a pointer to the animation exporter. |
| 1051 | AnimationExporter* animationExporter = mDocumentExporter->getAnimationExporter(); |
| 1052 | |
| 1053 | // The array for the animations. |
| 1054 | bool isAnimated[3] = { false, false, false }; |
| 1055 | |
| 1056 | // Go through the axes for the animations. |
| 1057 | for ( uint i=0; i<3; ++i ) |
| 1058 | { |
| 1059 | // Add the animation in the order XYZ |
| 1060 | isAnimated[i] = animationExporter->addNodeAnimation ( mTransformObject, name + rotateParams[i], ( SampleType ) ( kSingle | kQualifiedAngle ), ANGLE_PARAMETER ); |
| 1061 | } |
| 1062 | |
| 1063 | // Go through the axes for the rotations. |
| 1064 | for ( uint i=0; i<3; ++i ) |
| 1065 | { |
| 1066 | bool rotationIsNecessary = false; |
| 1067 | |
| 1068 | // Check, if we have to write the rotation. |
| 1069 | if ( mIsJoint && COLLADABU::Utils::equalsIgnoreCase ( name, ATTR_JOINT_ORIENT )) |
| 1070 | { |
| 1071 | // A joint must always have a rotation. |
| 1072 | rotationIsNecessary = true; |
| 1073 | } |
| 1074 | else |
| 1075 | { |
| 1076 | // You have to write the rotation, if the element is animated. |
| 1077 | rotationIsNecessary = ( isAnimated[i] || !( !mIsFirstRotation && isZero[i] )); |
| 1078 | } |
| 1079 | |
| 1080 | if ( mTransformObject != MObject::kNullObj && rotationIsNecessary ) |
| 1081 | { |
| 1082 | // Add the rotation in the order ZYX |
| 1083 | mVisualSceneNode->addRotate ( |
| 1084 | name + rotateParams[i], |
| 1085 | COLLADABU::Math::Utils::equalsZero( matrixRotate[i][0], getTolerance () ) ? 0 : matrixRotate[i][0], |
| 1086 | COLLADABU::Math::Utils::equalsZero( matrixRotate[i][1], getTolerance () ) ? 0 : matrixRotate[i][1], |
| 1087 | COLLADABU::Math::Utils::equalsZero( matrixRotate[i][2], getTolerance () ) ? 0 : matrixRotate[i][2], |
| 1088 | COLLADABU::Math::Utils::equalsZero( matrixRotate[i][3], getTolerance () ) ? 0 : matrixRotate[i][3] ); |
| 1089 | } |
| 1090 | } |
| 1091 | |
| 1092 | mIsFirstRotation = false; |
| 1093 | } |
| 1094 |
nothing calls this directly
no test coverage detected