Hello s4e,
In an x file, the FrameTransformMatrix template is used for two things basically, it defines the location, scale, and orientation intially of a mesh (3d object):
The template is often in the form:
Frame {
FrameTransformMatrix {
}
Mesh {
<various mesh info>
}
}
and the second thing, is it uses AnimationKeys to transform the object over a series of interpolated frames based on a series of key frames.
So far maybe this sounds a bit like mumbo jumbo, but it's not too tricky. It helps to understand what is happening if you know a little vector and matrix math.
The animation keys give the clearest example. Basically, animation in the x file is identified by a number that represents it's type. If you are talking DBC (direct x 7) then there are 3 types, position, scale, and rotation (orientation). From direct x 8.1 (and DBPro) and on there is a fourth type, matrix transformation which is specific to vertex rotation-manipulation or bone animation, skin meshing, blah blah blah. For DBC, we can't even use the fourth so we'll only worry about the 3.
The matrix that you displayed:
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;
is called an identity matrix because it has that series of diagonal 1s and all the other values are zero. Basically, this type of matrix means that what ever coordinates, vectors, or other matrices you put into it, you are going to get the same thing back out of it - i.e., it's not going to change anything.
Let's say you changed the matrix to look like:
2, 0, 0, 0
0, 2, 0, 0
0, 0, 2, 0
0, 0, 0, 1
This means you are now scaling whatever you put into the matrix by two. So if you had coordinates of (10,0,5), they would be scaled to (20,0,10)
Now what about:
1, 0, 0, 0
0, 1, 0, 0
0, 0, 1, 0
2, 2, 2, 1
This means that what ever coordinates are put into the matrix will be translated by (2,2,2). So (10,0,5) becomes (12,2,7). To understand all of the details of how these nubers are changing, you have to know some basic matrix math. So I will summarize what the matrices are for various states:
1 0 0 0
0 1 0 0
0 0 1 0
X Y Z 1 = Translation
X 0 0 0
0 Y 0 0
0 0 Z 0
0 0 0 1 = Scale
1 0 0 0
0 cos() -sin() 0
0 sin() cos() 0
0 0 0 1 = rotate around x
cos() 0 -sin() 0
0 1 0 0
sin() 0 cos() 0
0 0 0 1 = rotate around y
cos() -sin() 0 0
sin() cos() 0 0
0 0 1 0
0 0 0 1 = rotate around z
Now like I said, the FrameTransformMatrix is used for two things, for intial position,scale, and orientation of a mesh, and for animation. When the animation keyframes are fed through the FrameTransformMatrix (FTM), they are transformed according to the matrices I've shown above. If the FTM is the identity matrix, then the animation keys won't be transformed then interpolated, they will just be interpolated by the direct x application (in this case DarkBASIC). Without a FTM, there can be no animation - the animationkeys in a direct x file specifically reference a Frame template which contains an FTM which in turn references mesh information. (may want to research if a missing FTM would prohibit animation - some apps might generate one automatically if it isn't present in the x file)
One thing I should mention, the rotation key in the Animation section of a direct x file is represented by quaternions. That's why it has 4 values - that's another topic in and of itself.
Enjoy your day.