Torque 3D - Script Manual: DebugDrawer Class Reference

TorqueScript

Main   Class List   Namespace List   Online

DebugDrawer Class Reference
[GFX]

A debug helper for rendering debug primitives to the scene. More...

Inheritance diagram for DebugDrawer:

List of all members.

Public Member Functions

void drawBox (Point3F a, Point3F b, ColorF color=ColorF::WHITE)
 Draws an axis aligned box primitive within the two 3d points.
void drawLine (Point3F a, Point3F b, ColorF color=ColorF::WHITE)
 Draws a line primitive between two 3d points.
void setLastTTL (int ms)
 Sets the "time to live" (TTL) for the last rendered primitive.
void setLastZTest (bool enabled)
 Sets the z buffer reading state for the last rendered primitive.
void toggleDrawing ()
 Toggles the rendering of DebugDrawer primitives.
void toggleFreeze ()
 Toggles freeze mode which keeps the currently rendered primitives from expiring.

Detailed Description

A debug helper for rendering debug primitives to the scene.

The DebugDrawer is used to render debug primitives to the scene for testing. It is often useful when debugging collision code or complex 3d algorithms to have them draw debug information, like culling hulls or bounding volumes, normals, simple lines, and so forth.

A key feature of the DebugDrawer is that each primitive gets a "time to live" (TTL) which allows them to continue to render to the scene for a fixed period of time. You can freeze or resume the system at any time to allow you to examine the output.

Example:
DebugDraw.drawLine( %player.getMuzzlePoint( 0 ), %hitPoint );
DebugDraw.setLastTTL( 5000 ); // 5 seconds.

The DebugDrawer renders solely in world space and all primitives are rendered with the cull mode disabled.

Note:
This feature can easily be used to cheat in online games, so you should be sure it is disabled in your shipping game. By default the DebugDrawer is disabled in all TORQUE_SHIPPING builds.

Member Function Documentation

void DebugDrawer::drawBox ( Point3F  a,
Point3F  b,
ColorF  color = ColorF::WHITE 
)

Draws an axis aligned box primitive within the two 3d points.

void DebugDrawer::drawLine ( Point3F  a,
Point3F  b,
ColorF  color = ColorF::WHITE 
)

Draws a line primitive between two 3d points.

void DebugDrawer::setLastTTL ( int  ms  ) 

Sets the "time to live" (TTL) for the last rendered primitive.

void DebugDrawer::setLastZTest ( bool  enabled  ) 

Sets the z buffer reading state for the last rendered primitive.

void DebugDrawer::toggleDrawing (  ) 

Toggles the rendering of DebugDrawer primitives.

void DebugDrawer::toggleFreeze (  ) 

Toggles freeze mode which keeps the currently rendered primitives from expiring.



Copyright © GarageGames, LLC. All Rights Reserved.