DTS File Format Specification
by Nick Matthews · in Torque Game Engine · 05/14/2009 (5:46 am) · 1 replies
I know there have been a few of these threads in the past - and I have poured over the majority but they're either incomplete with a "will update tomorrow" edit, or in German. Essentially all I want to do is pull out a list of material filenames from a dts - here's what I've got so far.
I start off by reading in 4 32-bit ints from the top of the DTS file, these denote DTS Version/Exporter Version, Total Buffer Size, Offset to 16 bit buffer, Offset to 8 bit buffer.
The way a DTS is packed is something like this:
[header]
[32 bit buffer]
[16 bit buffer]
[8 bit buffer]
[sequences]
[materials]
The total buffer size allows me to get rid of all the buffer stuff and leaves me with just the sequences and the materials which is nearly perfect. If i'm loading a DTS without sequences it works fine, I just don't understand the sequences spec completely. The sequences section starts with a 32-bit int to say how many sequences exist, then if there are sequences it spews out a bunch of unexplained data of seemingly variable lengths. Then finally comes the MaterialID, Number of Materials and then material names which I've figured out.
(More details in next post)
I start off by reading in 4 32-bit ints from the top of the DTS file, these denote DTS Version/Exporter Version, Total Buffer Size, Offset to 16 bit buffer, Offset to 8 bit buffer.
The way a DTS is packed is something like this:
[header]
[32 bit buffer]
[16 bit buffer]
[8 bit buffer]
[sequences]
[materials]
The total buffer size allows me to get rid of all the buffer stuff and leaves me with just the sequences and the materials which is nearly perfect. If i'm loading a DTS without sequences it works fine, I just don't understand the sequences spec completely. The sequences section starts with a 32-bit int to say how many sequences exist, then if there are sequences it spews out a bunch of unexplained data of seemingly variable lengths. Then finally comes the MaterialID, Number of Materials and then material names which I've figured out.
(More details in next post)
Torque Owner Nick Matthews
So this is curious because it is not using a standard number of bytes per section, and it also doesn't appear to relate to the number of keyframes either. Any ideas yet?
Also here is the write code when creating a dts from the dtsSDK lib:
// Sequences int numSequences = sequences.size() ; out.write ((char *)&FIX_ENDIAN(numSequences), 4) ; for (int seq = 0 ; seq < sequences.size() ; seq++) { const Sequence &p = sequences[seq] ; out.write ((char *) &FIX_ENDIAN(p.nameIndex), 4) ; out.write ((char *) &FIX_ENDIAN(p.flags), 4) ; out.write ((char *) &FIX_ENDIAN(p.numKeyFrames), 4) ; out.write ((char *) &FIX_ENDIAN(p.duration), 4) ; out.write ((char *) &FIX_ENDIAN(p.priority), 4) ; out.write ((char *) &FIX_ENDIAN(p.firstGroundFrame), 4) ; out.write ((char *) &FIX_ENDIAN(p.numGroundFrames), 4) ; out.write ((char *) &FIX_ENDIAN(p.baseRotation), 4) ; out.write ((char *) &FIX_ENDIAN(p.baseTranslation), 4) ; out.write ((char *) &FIX_ENDIAN(p.baseScale), 4) ; out.write ((char *) &FIX_ENDIAN(p.baseObjectState), 4) ; out.write ((char *) &FIX_ENDIAN(p.baseDecalState), 4) ; out.write ((char *) &FIX_ENDIAN(p.firstTrigger), 4) ; out.write ((char *) &FIX_ENDIAN(p.numTriggers), 4) ; out.write ((char *) &FIX_ENDIAN(p.toolBegin), 4) ; write(out,&p.matters.rotation); write(out,&p.matters.translation); write(out,&p.matters.scale); write(out,&p.matters.decal); write(out,&p.matters.ifl); write(out,&p.matters.vis); write(out,&p.matters.frame); write(out,&p.matters.matframe); }I'm not entirely sure what's going on with the write(out,&p.matters.X); stuff - is that being written as individual bits like a mask, or as bytes? Doesn't specify.
Any info on the sequences part of DTS files would be awesome. Thanks.