T2dShape3D bounds-related bug and fix
by Fyodor -bank- Osokin · in Torque Game Builder · 02/08/2008 (5:41 pm) · 2 replies
First, to describe my problem I'm going to show you image:
If you load wheel.dts (from racing starter kit) into t2d you will see it narrowed:

If you load DTS where the bounds are far from "cube" it will display the dts scaled by one or two axis.
I can assume that Torque shifts the model trying to display the model while keeping it's bounds close to "cube"?
Digging into source I found that if I replace the dglSetFrustum call with the following:

This makes life a bit easier, though I'm not sure if it's ideal solution. It would be nice to integrate the same routine that performed in ShowTool Pro, so the model is "fit" right when scaled 1x1x1.
P.S. I'm using core of T2D1.1.3, but this fix can/should be applied to all versions of TGB (where t2dShape3d is implemented) - even latest 1.7.2.
If you load wheel.dts (from racing starter kit) into t2d you will see it narrowed:

If you load DTS where the bounds are far from "cube" it will display the dts scaled by one or two axis.
I can assume that Torque shifts the model trying to display the model while keeping it's bounds close to "cube"?
Digging into source I found that if I replace the dglSetFrustum call with the following:
const F32 maxSize = getMax(boxHalfX, getMax(boxHalfY, boxHalfZ)); dglSetFrustum(-maxSize, +maxSize, -maxSize, +maxSize, -shapeRadius*depthScale, 10.0f * shapeRadius * depthScale, true);Result:

This makes life a bit easier, though I'm not sure if it's ideal solution. It would be nice to integrate the same routine that performed in ShowTool Pro, so the model is "fit" right when scaled 1x1x1.
P.S. I'm using core of T2D1.1.3, but this fix can/should be applied to all versions of TGB (where t2dShape3d is implemented) - even latest 1.7.2.
About the author
Game developer.
Recent Threads
#2
I'm in situation where half of my DTS files are displayed wrong in t2d, so I decided to fix it engine, as re-exporting everything with "cube" bounds wont work for me.
02/09/2008 (3:22 am)
The tire is just an example (a clean one).I'm in situation where half of my DTS files are displayed wrong in t2d, so I decided to fix it engine, as re-exporting everything with "cube" bounds wont work for me.
Torque Owner Joe Rossi
Indri Games