Create TSShape programmatically
by Thierry Faucounau · in Torque Game Engine · 01/10/2006 (6:10 am) · 4 replies
Hi,
I have a project for which we would like to use the Torque engine, however the original art assets have long been lost. As it is, I have all of the assets locked up in a non-dts format. No problem I figured, I'll just add a new ResourceManager extension loader and create the TSShape directly from the data I have. So far so good, I get called when the scripts load one of my files, I parse my data but now I am a bit stuck. The loading of the dts files (which I am using as a template) is a bit convoluted :)
Are there any examples floating out there which demonstrate how to properly initialize a TSShape from raw data?
Thierry
I have a project for which we would like to use the Torque engine, however the original art assets have long been lost. As it is, I have all of the assets locked up in a non-dts format. No problem I figured, I'll just add a new ResourceManager extension loader and create the TSShape directly from the data I have. So far so good, I get called when the scripts load one of my files, I parse my data but now I am a bit stuck. The loading of the dts files (which I am using as a template) is a bit convoluted :)
Are there any examples floating out there which demonstrate how to properly initialize a TSShape from raw data?
Thierry
#2
01/10/2006 (9:52 am)
My suggestion is to build a loader from the dtssdkplus, you can then save out as dts or simply load the final stream into memory. This would ensure your geometry would be compliant and tri-stripped for fast rendering (although it can take some time with lots of polies). See the 3dsmax and milkshape exporter source for useage examples, it is pretty easy to get ahold of if you are solid with 3d, animation and uv data.
#4
After a bit of fiddling to account for the fact that I am on a big endian system (ie. make the 3ds loading code endian agnostic. Love convertLEndianToHost :) and accounting for some directory differences between 1.4 and version 1.2 (which this was written against), I can now import .3ds models directly into Torque (I have seen, and can even jump over, on top, or dash around the dragon textured teapot included with the sample code).
This gives me a pretty good template to follow for my own non dts data loading problem :)
Thanks everyone who answered for all of the very good suggestions.
01/10/2006 (2:40 pm)
Thanks Dirk. After a bit of fiddling to account for the fact that I am on a big endian system (ie. make the 3ds loading code endian agnostic. Love convertLEndianToHost :) and accounting for some directory differences between 1.4 and version 1.2 (which this was written against), I can now import .3ds models directly into Torque (I have seen, and can even jump over, on top, or dash around the dragon textured teapot included with the sample code).
This gives me a pretty good template to follow for my own non dts data loading problem :)
Thanks everyone who answered for all of the very good suggestions.
Associate Manoel Neto
Default Studio Name
My advice: feeding a TSMesh with foreign geometry is too much trouble. The format is tightly put together and is hard to decypher. Plus DTS files are barely TSMeshes structures saved to a binary file, and suffer almost no conversions or parsing during load.
I'd recommend you write a custom class to load your files. It's praobably going to take less time than fighting with the DTS. You might even be able to hook your own file into Shapebase and TSStatic.