Game Development Community

Wireframe Terrain

by Ryan Dey (not Tom Watson) · in Torque Game Engine Advanced · 10/04/2006 (10:15 am) · 7 replies

Jus a quick question...

I know (believe) that TSE can render the terrain as wireframe. How do you turn that on?

I'm working on building "performant" terrain in MS4 (Ben: Huge improvements over TS3.5, thanks), and would like it see my polysoup to get an idea of how much detail I have.

#1
10/04/2006 (10:55 am)
I have never been in the Atlas codebase before, but a quick look in atlasInstance.cpp shows this inside renderObject ():

if(smRenderWireframe)
      GFX->setFillMode(GFXFillWireframe);

Either comment it out or set smRenderWireframe to true.
#2
10/04/2006 (11:17 am)
In AtlasInstance2.cpp, I see:
bool AtlasInstance2::smRenderWireframe = false;
which I am sure I could set to true... but it sure would be nice to toggle it on and off without recompiling the engine :)

I'll keep looking.
#3
10/04/2006 (12:26 pm)
For now, I compiled two versions of TSE.exe, one with the variable set to true, one with it set to false, and will run the wireframe version when I want to look at at that.

The wireframe is pretty neat, by the way. You oughta try it.
#4
10/04/2006 (12:59 pm)
Just make a console function which toggles it on and off, much like renderBoundsBoxes (or whatever) does it. Or keep your two versions :)
#5
10/04/2006 (2:37 pm)
$AtlasInstance2::renderWireframe=1;

There are several more render modes that I don't think have been mentioned in the TDN docs yet, but it's always a good idea to take a look at the ::initPersistFields() and ::consoleInit() methods of a class to see what has been mapped to script.
#6
10/04/2006 (2:48 pm)
Thanks Stephen. Works like a charm.

Here is the ConsoleInit():

void AtlasInstance2::consoleInit()
{
   Con::addVariable("AtlasInstance2::rayCollisionDebugLevel", TypeS32, &smRayCollisionDebugLevel);
   Con::addVariable("AtlasInstance2::renderChunkBoundsDebugLevel", TypeS32, &smRenderChunkBoundsDebugLevel);
   Con::addVariable("AtlasInstance2::lockFrustrum", TypeBool, &smLockFrustrum);
   Con::addVariable("AtlasInstance2::renderWireframe", TypeBool, &smRenderWireframe);
   Con::addVariable("AtlasInstance2::renderDebugTextures", TypeBool, &AtlasClipMapBatcher::smRenderDebugTextures);
}

I had a feeling the ChunkBounds thing existed somewhere, but I guess this proves it. I'm going to try that one next (after I move from 1km terrains to 4km terrins).
#7
10/23/2006 (10:38 am)
Once the terrain loads open a console and type:

$AtlasInstance2::renderWireFrame = 1 to render the terrain as wireframe and

$AtlasInstance2::renderWireFrame = 0 to return to normal rendering

If you need to do this alot you could map it to a key...