Game Development Community

SimObject vs DataBlock uses

by William Gooding · in Torque 3D Professional · 11/27/2009 (4:00 pm) · 3 replies

I am trying to display a series of grids in an editor I am working on inside the World Editor....

For that, I am thinking in 2 options:

- Creating those grids based on EditTSCtrl methods which rely on gfxDrawUtil or directly from gfxDrawUtil methods and manage them through SimObjects.
- Create DataBlocks and load a texture of a grid on a quad as a Static Shape, and somehow manage the texture to represent correctly the number of rows and columns intended to be displayed.

I expect some basic interaction between the grids and the user (move, rotate, stretch them, etc), and possibly the objects in the mission level being edited (intersection or the grid with the terrain, objects, etc).

Which approach is better? which approach creates less impact in performance? better yet, Is there a better way to this than the ones I am proposing....

#1
11/27/2009 (4:41 pm)
If you want user interaction with the grid, I suggest making it an actual object and just placing a texture on it. I would make copies of the RenderMeshExample in "T3D/examples" and change the name to form your new grid class. You would control the number of grid rows and columns by simply changing the UV coordinates.
#2
11/27/2009 (5:02 pm)
Stretching / scaling of a grid texture is going to affect the width and quality of the lines.

Assuming that this grid is an overlay that renders over the scene and does not need to conform to terrain or anything more complex like that, I would look at the grid rendering which already exists in the WorldEditor and Gizmo ( and DrawUtils ).

I suspect it is already pretty close to what you want actually, the editor's grid rendering is disabled by default so you may not have noticed it.

If you have more than one grid rendering at the same time you might consider making a SceneObject derived class and perform the rendering with an ObjectRenderInst callback.
#3
11/27/2009 (10:57 pm)
Hello James and Ryan:

Thank you for your help. I managed to get the renderGrid function from EditTSCtrl to work. Now I am going to explore James option of making a SceneObject