DTS SDK import fixes
by Tony Peguero · 08/22/2005 (12:24 am) · 9 comments
Download Code File
While the export code in the DTS SDK has been well excercised in plugins for various applications, the import code has always been very badly broken. Even the simplest shape file would cause the Shape::read function to choke. I set about trying to fix it, and I recently discovered that Tom Spilman had been working on it too. He sent me his fixes and I've merged them with mine to produce this resource. There is still much work to be done, but it can now load all of the shape files from the example folders. I'm not sure yet if they are loading 100% correctly, but the read function no longer crashes or asserts.
Oh by the way, so far I haven't paid any attention to endian-ness, so it may not work on Macs.
While the export code in the DTS SDK has been well excercised in plugins for various applications, the import code has always been very badly broken. Even the simplest shape file would cause the Shape::read function to choke. I set about trying to fix it, and I recently discovered that Tom Spilman had been working on it too. He sent me his fixes and I've merged them with mine to produce this resource. There is still much work to be done, but it can now load all of the shape files from the example folders. I'm not sure yet if they are loading 100% correctly, but the read function no longer crashes or asserts.
Oh by the way, so far I haven't paid any attention to endian-ness, so it may not work on Macs.
#2
08/22/2005 (7:06 pm)
Excellent! Glad someone has some time to tackle this issue. I am very much following your progress.
#3
Thanks in advance!
08/09/2006 (7:19 am)
How can i use this patch properly? Does it go into Torque Game Engine or it is for something else? I need some guidelines, i am not sure what to do with them.Thanks in advance!
#4
Just to be clear, the DTS SDK is used for integrating dts import/export functionality into non-torque applications. The Torque engine itself uses completely different code for dts loading, so this fix does not improve the engine in any way. Also, the fixes included in this resource only affect the import functionality; the export side works fine as it is. So this resource is only useful if you intend to write something like a stand-alone dts model loader, or a dts import plugin for a modelling application.
08/09/2006 (2:40 pm)
Baris, it's a fix to the DTS SDK that is found in Torque\SDK\lib\dtsSDK. The files from this resource should simply replace those found in that folder.Just to be clear, the DTS SDK is used for integrating dts import/export functionality into non-torque applications. The Torque engine itself uses completely different code for dts loading, so this fix does not improve the engine in any way. Also, the fixes included in this resource only affect the import functionality; the export side works fine as it is. So this resource is only useful if you intend to write something like a stand-alone dts model loader, or a dts import plugin for a modelling application.
#5
I have examined the ms2dts exporter and understood the basics of what's going on and I am trying to build a simple (to load meshes and joints, for starters) DTS importer for MilkShape, however i am not much experienced in C++ and have a simple problem.
I couldn't figure out how to use the "Shape::read (std::istream &in)" function. I just want to read dts file into a "MilkshapeShape" object. Can you post a few example lines to read from a dts file to MilkshapeShape?
Thanks again, sorry to bother with the noobish question.
08/11/2006 (2:40 am)
Thank you very much. But i got some more questions :) .I have examined the ms2dts exporter and understood the basics of what's going on and I am trying to build a simple (to load meshes and joints, for starters) DTS importer for MilkShape, however i am not much experienced in C++ and have a simple problem.
I couldn't figure out how to use the "Shape::read (std::istream &in)" function. I just want to read dts file into a "MilkshapeShape" object. Can you post a few example lines to read from a dts file to MilkshapeShape?
Thanks again, sorry to bother with the noobish question.
#6
Bear in mind that there are still some bugs in there. The DTS::Mesh::readSharedData function that I created turns out to be a Very Bad Thing. It was based on an incorrect assumption and I haven't had a chance to fix it yet. Most of the sample models work OK, but a couple, the buggy and the crossbow, end up with some bad data in the vectors. I suggest that you avoid using those models for your experiments.
08/13/2006 (7:13 pm)
Ok, the way I do it is to create a new class derived from DTS::Shape, which will function as a bridge between the DTS format and the target API, in your case MilkShape. Call DTS::Shape::read() to populate all those std::vectors that are inherited from the Shape class (see DTSShape.h). You will need to create a function that then interprets the contents of those vectors and calls whatever MilkShape API functions are required to build a scene from that information. I don't know anything about the MilkShape API, so I can't help you with that part. As for interpreting the vectors, the comments in the DTSShape.h file should help you get started, but to be honest, I don't really know what they are all for. Trial and error may be the order of the day.Bear in mind that there are still some bugs in there. The DTS::Mesh::readSharedData function that I created turns out to be a Very Bad Thing. It was based on an incorrect assumption and I haven't had a chance to fix it yet. Most of the sample models work OK, but a couple, the buggy and the crossbow, end up with some bad data in the vectors. I suggest that you avoid using those models for your experiments.
#7
>>Bear in mind that there are still some bugs in there. The DTS::Mesh::readSharedData function that I
>>created turns out to be a Very Bad Thing. It was based on an incorrect assumption and I haven't had a
>>chance to fix it yet. Most of the sample models work OK, but a couple, the buggy and the crossbow,
>>end up with some bad data in the vectors. I suggest that you avoid using those models for your
>> experiments.
Any news on this subject would be welcome as i have a lot of models which get stuck here while reading out the number of texture vertices
====================================
// Vertexes
int numVertexes ;
stream >> numVertexes ;
verts.resize (numVertexes) ;
readSharedData(stream, Shared_Verts, verts);
// Texture coordinates
int numTVerts ;
stream >> numTVerts; --> This returns a faulted result leading to a crash when trying to load numTVerts
tverts.resize (numTVerts) ;
readSharedData(stream, Shared_TVerts, tverts);
=======================================
Greets
04/25/2007 (3:49 am)
Hi Tony,>>Bear in mind that there are still some bugs in there. The DTS::Mesh::readSharedData function that I
>>created turns out to be a Very Bad Thing. It was based on an incorrect assumption and I haven't had a
>>chance to fix it yet. Most of the sample models work OK, but a couple, the buggy and the crossbow,
>>end up with some bad data in the vectors. I suggest that you avoid using those models for your
>> experiments.
Any news on this subject would be welcome as i have a lot of models which get stuck here while reading out the number of texture vertices
====================================
// Vertexes
int numVertexes ;
stream >> numVertexes ;
verts.resize (numVertexes) ;
readSharedData(stream, Shared_Verts, verts);
// Texture coordinates
int numTVerts ;
stream >> numTVerts; --> This returns a faulted result leading to a crash when trying to load numTVerts
tverts.resize (numTVerts) ;
readSharedData(stream, Shared_TVerts, tverts);
=======================================
Greets
#8
04/25/2007 (6:30 pm)
No news, I'm afraid. I have been trying to set aside some time to get back into this, but real world priorities keep interfering.
#9
05/30/2007 (7:25 am)
Are these fixes still relevant with the TGE 1.5.2 SDK? If so, why haven't they been included? 
Associate Tom Spilman
Sickhead Games