diff options
Diffstat (limited to 'NW4RTools')
-rw-r--r-- | NW4RTools/ColladaWriter.cs | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/NW4RTools/ColladaWriter.cs b/NW4RTools/ColladaWriter.cs index c9412d3..a292ba0 100644 --- a/NW4RTools/ColladaWriter.cs +++ b/NW4RTools/ColladaWriter.cs @@ -79,39 +79,32 @@ namespace NW4RTools { //cNode.type = NodeType.JOINT; cNode.node1 = new node[0]; - /*var origMatrix = origNode.NodeMatrix; + float cosX = Math.Cos(origNode.Rotation.x / 180 * Math.PI); + float cosY = Math.Cos(origNode.Rotation.y / 180 * Math.PI); + float cosZ = Math.Cos(origNode.Rotation.z / 180 * Math.PI); + float sinX = Math.Sin(origNode.Rotation.x / 180 * Math.PI); + float sinY = Math.Sin(origNode.Rotation.y / 180 * Math.PI); + float sinZ = Math.Sin(origNode.Rotation.z / 180 * Math.PI); + var nodeMatrix = new matrix(); nodeMatrix.Values = new double[] { - origMatrix.v00, origMatrix.v01, origMatrix.v02, origMatrix.v03, - origMatrix.v10, origMatrix.v11, origMatrix.v12, origMatrix.v13, - origMatrix.v20, origMatrix.v21, origMatrix.v22, origMatrix.v23, - 0.0, 0.0, 0.0, 1.0 + origNode.Scale.X * cosY * cosZ, + origNode.Scale.Y * (sinX * cosZ * sinY - cosX * sinZ), + origNode.Scale.Z * (sinX * sinZ + cosX * cosZ * sinY), + origNode.Translation.x, + origNode.Scale.X * sinZ * cosY, + origNode.Scale.Y * (sinX * sinZ * sinY + cosZ * cosX), + origNode.Scale.Z * (cosX * sinZ * sinY - sinX * cosZ), + origNode.Translation.y, + -origNode.Scale.X * sinY, + origNode.Scale.Y * sinX * cosY, + origNode.Scale.Z * cosX * cosY, + origNode.Translation.z, + 0, 0, 0, 1 }; cNode.Items = new object[] { nodeMatrix }; - cNode.ItemsElementName = new ItemsChoiceType2[] { ItemsChoiceType2.matrix };*/ - - var tScale = new TargetableFloat3(); - var tRotate = new rotate(); - var tTranslate = new TargetableFloat3(); - - tScale.Values = new double[] { - origNode.Scale.x, origNode.Scale.y, origNode.Scale.z - }; - - tRotate.Values = new double[] { - 0, 0, 0, 0 // TODO - }; - - tTranslate.Values = new double[] { - origNode.Translation.x, origNode.Translation.y, origNode.Translation.z - }; - - cNode.Items = new object[] { tScale, tRotate, tTranslate }; - cNode.ItemsElementName = new ItemsChoiceType2[] { - ItemsChoiceType2.scale, ItemsChoiceType2.rotate, - ItemsChoiceType2.translate - }; + cNode.ItemsElementName = new ItemsChoiceType2[] { ItemsChoiceType2.matrix }; NodeDefs[origNode] = cNode; } |