本文整理汇总了C#中Matrix4x4.DecomposeNoScaling方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix4x4.DecomposeNoScaling方法的具体用法?C# Matrix4x4.DecomposeNoScaling怎么用?C# Matrix4x4.DecomposeNoScaling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4.DecomposeNoScaling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: exportJoint
static void exportJoint(BinaryWriter dest, Assimp.Node node)
{
byte flags = 0;
dest.Write(flags);
byte[] nameBlock = getStringBytes(node.Name, 32);
dest.Write(nameBlock);
String parentName = "";
if (node.Parent!=null)
parentName = node.Parent.Name;
byte[] parentBlock = getStringBytes(parentName, 32);
dest.Write(parentBlock);
Vector3D relativePosition, relativeRotation, rot;
Quaternion q;
Matrix4x4 mat = new Matrix4x4(node.Transform.A1, node.Transform.A2, node.Transform.A3, node.Transform.A4, node.Transform.B1, node.Transform.B2, node.Transform.B3, node.Transform.B4, node.Transform.C1, node.Transform.C2, node.Transform.C3, node.Transform.C4, node.Transform.D1, node.Transform.D2, node.Transform.D3, node.Transform.D4);
mat.DecomposeNoScaling(out q, out relativePosition);
relativeRotation.X = (float)-Math.Atan2(2f * q.X * q.W + 2f * q.Y * q.Z, 1 - 2f * (q.Z * q.Z + q.W * q.W)); // Yaw
relativeRotation.Z = (float)Math.Asin(2f * (q.X * q.Z - q.W * q.Y)); // Pitch
relativeRotation.Y = (float)Math.Atan2(2f * q.X * q.Y + 2f * q.Y * q.W, 1 - 2f * (q.Y * q.Y + q.Z * q.Z)); // Roll
dest.Write(relativeRotation.X);
dest.Write(relativeRotation.Y);
dest.Write(relativeRotation.Z);
dest.Write(relativePosition.X);
dest.Write(relativePosition.Y);
dest.Write(relativePosition.Z);
UInt16 numKeyFramesTrans = 0;
dest.Write(numKeyFramesTrans);
UInt16 numKeyFramesRot = 0;
dest.Write(numKeyFramesRot);
for (int i = 0; i < node.ChildCount; i++)
{
exportJoint(dest, node.Children[i]);
}
}