You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DTS is the native binary format used by the Torque engine to store shape, mesh and (optionally) sequence data. This document serves as a basic specification for the DTS file format. Very little context is given to the shape, mesh and sequence data fields read from the DTS file so it is recommended that this resource be read along with the Torque
3D source code.
The DTS file format stores most data in separate buffers for 8, 16 or 32-bit sized values in order to speed up loading
on non-Intel platforms. A DTS file can be read as shown below; after the 3 data buffers have been created in memory, they are read in interleaved order as needed to extract the desired values (see Data Buffers).
Note: that all values are stored as little-endian, so on non-Intel platforms you will have to handle perform endian conversion for 16 and 32-bit values.
DTS Format
Name
# bytes
Data Type
Description
DTS version number
2
S16
DTS version of this file. Note that the current DTS version (for files saved by Torque 3D) is 26. Most DTS exporters and the ShowToolPro tool only read/write version 24.
Exporter version number
2
S16
For tracking version of the exporter that generated this file. Can usually be ignored.
sizeAll
4
S32
Size (in 32-bit words) of the 3 data buffers (sum of 8, 16 and 32-bit data buffers). The 32-bit data buffer starts at offset 0x0.
start16
4
S32
32-bit word offset into the memory buffer of the start of the 16-bit data.
start8
4
S32
32-bit word offset into the memory buffer of the start of the 8-bit data.
data32
size32
U32*
Data buffer for 32-bit values. Size (in bytes) is equal to start16*4
data16
size16
U16*
Data buffer for 16-bit values. Size (in bytes) is equal to (start8 - start16)*4
data8
size8
U8*
Data buffer for 8-bit values. Size (in bytes) is equal to (sizeAll - start8)*4
numSequences
4
S32
Number of sequences in the shape
sequences
numSequences * ?
Sequence
Array of numSequences Sequences - size of each sequence depends on which nodes and objects are affected etc. See Sequences for more information
matStreamType
1
S8
Type of material stream (text or binary). Should be 0x1 (binary) for DTS files
numMaterials
4
S32
Number of materials in the shape
matNames
numMaterials * ?
S32 and char[]
Names of the materials in the shape. Each name is stored as a 4-byte length followed by the N characters in the string (terminating NULL is not included in the length or N characters).
matFlags
numMaterials * 4
U32
Flags for each material*
matReflectanceMaps
numMaterials * 4
S32
Index of the material to use as a reflectance map for each material* (or -1 for none)
matBumpMaps
numMaterials * 4
S32
Index of the material to use as a bump map for each material* (or -1 for none)
matDetailMaps
numMaterials * 4
S32
Index of the material to use as a detail map for each material* (or -1 for none)
dummy
numMaterials * 4
S32
Dummy value. Only present in DTS v25.
matDetailScales
numMaterials * 4
F32
Detail scale for each material*
matReflectance
numMaterials * 4
F32
Reflectance value for each material*
Note: that all material settings (beside the name) are superceded by script Material definitions in T3D.
The 3space shape data is extracted from the 3 data buffers by maintaining a pointer into each buffer, then reading from the appropriate buffer in order as shown in the table below. The code sample below demonstrates how an array of structures might be read from the 3 buffers.
The GUARD entries indicate a buffer checkpoint that verifies the buffers are being accessed correctly. Each time the GUARD entry is encountered, an incrementing value should be read from each of the 3 buffers. For example, the first GUARD should read 32-bit 0x0, 16-bit 0x0 and 8-bit 0x0, the next GUARD should read 32-bit 0x1, 16-bit 0x1 and 8-bit 0x1 and so on.
Name
Buffer
Data Type
Description
numNodes
32-bit
S32
Number of nodes in the shape
numObjects
32-bit
S32
Number of objects in the shape
numDecals
32-bit
S32
Number of decals in the shape
numSubShapes
32-bit
S32
Number of subshapes in the shape
numIFLs
32-bit
S32
Number of IFL materials in the shape
numNodeRotations
32-bit
S32
Number of node rotation keyframes
numNodeTranslations
32-bit
S32
Number of node translation keyframes
numNodeUniformScales
32-bit
S32
Number of node uniform scale keyframes
numNodeAlignedScales
32-bit
S32
Number of node aligned scale keyframes
numNodeArbScales
32-bit
S32
Number of node arbitrary scale keyframes
numGroundFrames
32-bit
S32
Number of ground transform keyframes
numObjectStates
32-bit
S32
Number of object state keyframes
numDecalStates
32-bit
S32
Number of decal state keyframes
numTriggers
32-bit
S32
Number of triggers (all sequences)
numDetails
32-bit
S32
Number of detail levels in the shape
numMeshes
32-bit
S32
Number of meshes (all detail levels) in the shape
numNames
32-bit
S32
Number of name strings in the shape
smallestVisibleSize
32-bit
F32
Size of the smallest visible detai level
smallestVisibleDL
32-bit
S32
Index of the smallest visible detail level
GUARD
ALL
S32, S16, S8
Buffer checkpoint (incrementing unit in each buffer)
radius
32-bit
F32
Shape bounding sphere radius
tubeRadius
32-bit
F32
Shape bounding cylinder radius
center
32-bit
Point3F { F32 x, F32 y, F32 z }
Center of the shape bounds
bounds
32-bit
BoxF { Point3F min, Point3F max }
Shape bounding box
GUARD
ALL
S32, S16, S8
Buffer checkpoint (incrementing unit in each buffer)