Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Draw Class Reference

Useful routines for rendering primitives when debugging. More...

#include <Draw.h>

List of all members.

Static Public Member Functions

static void arrow (const Vector3 &start, const Vector3 &direction, RenderDevice *renderDevice, const Color4 &color=Color3::orange(), float scale=1.0f)
static void axes (RenderDevice *renderDevice, const Color4 &xColor=Color3::red(), const Color4 &yColor=Color3::green(), const Color4 &zColor=Color3::blue(), float scale=1.0f)
static void axes (const class CoordinateFrame &cframe, RenderDevice *renderDevice, const Color4 &xColor=Color3::red(), const Color4 &yColor=Color3::green(), const Color4 &zColor=Color3::blue(), float scale=1.0f)
static void box (const AABox &box, RenderDevice *rd, const Color4 &solidColor=Color4(1,.2f,.2f,.5f), const Color4 &wireColor=Color3::black())
static void box (const Box &box, RenderDevice *rd, const Color4 &solidColor=Color4(1,.2f,.2f,.5f), const Color4 &wireColor=Color3::black())
static void capsule (const Capsule &capsule, RenderDevice *renderDevice, const Color4 &solidColor=Color4(1, 0, 1,.5), const Color4 &wireColor=Color3::black())
static void cylinder (const Cylinder &cylinder, RenderDevice *renderDevice, const Color4 &solidColor=Color4(1, 1, 0,.5), const Color4 &wireColor=Color3::black())
static void fastRect2D (const Rect2D &rect, RenderDevice *rd, const Color4 &color=Color3::white())
static void frustum (const class GCamera::Frustum &frustum, RenderDevice *rd, const Color4 &color=Color4(1,.4f,.4f, 0.2f), const Color4 &wire=Color3::black())
static void fullScreenImage (const class GImage &im, RenderDevice *renderDevice)
static void line (const Line &line, RenderDevice *rd, const Color4 &color=Color3::black())
static void lineSegment (const LineSegment &lineSegment, RenderDevice *rd, const Color4 &color=Color3::black(), float scale=1)
static void plane (const Plane &plane, RenderDevice *rd, const Color4 &solidColor=Color4(.2f,.2f, 1,.5f), const Color4 &wireColor=Color3::black())
static void poly2D (const Array< Vector2 > &polygon, RenderDevice *renderDevice, const Color4 &color=Color3::yellow())
static void poly2DOutline (const Array< Vector2 > &polygon, RenderDevice *renderDevice, const Color4 &color=Color3::yellow())
static void ray (const class Ray &ray, RenderDevice *renderDevice, const Color4 &color=Color3::orange(), float scale=1)
static void rect2D (const class Rect2D &rect, RenderDevice *rd, const Color4 &color, const Rect2D &texCoord0, const Rect2D &texCoord1=Rect2D::xywh(0, 0, 1, 1), const Rect2D &texCoord2=Rect2D::xywh(0, 0, 1, 1), const Rect2D &texCoord3=Rect2D::xywh(0, 0, 1, 1))
static void rect2D (const class Rect2D &rect, RenderDevice *rd, const Color4 &color=Color3::white(), const Vector2 &texCoord0=Vector2(1, 1), const Vector2 &texCoord1=Vector2(1, 1), const Vector2 &texCoord2=Vector2(1, 1), const Vector2 &texCoord3=Vector2(1, 1))
static void rect2DBorder (const class Rect2D &rect, RenderDevice *rd, const Color4 &color=Color3::black(), float innerBorder=0, float outerBorder=1)
static void sphere (const Sphere &sphere, RenderDevice *rd, const Color4 &solidColor=Color4(1, 1, 0,.5f), const Color4 &wireColor=Color3::black())
static void vertexNormals (const G3D::MeshAlg::Geometry &geometry, RenderDevice *renderDevice, const Color4 &color=Color3::green()*.5, float scale=1)
static void vertexVectors (const Array< Vector3 > &vertexArray, const Array< Vector3 > &directionArray, RenderDevice *renderDevice, const Color4 &color=Color3::red()*0.5, float scale=1)


Detailed Description

Useful routines for rendering primitives when debugging.

Compared to the optimized RenderDevice::beginIndexedPrimitives calls used by IFSModel, these routines are slow.

When rendering translucent bounding objects, depth write is automatically disabled. Render from back to front for proper transparency.


Member Function Documentation

static void G3D::Draw::arrow ( const Vector3 start,
const Vector3 direction,
RenderDevice renderDevice,
const Color4 color = Color3::orange(),
float  scale = 1.0f 
) [static]

static void G3D::Draw::axes ( RenderDevice renderDevice,
const Color4 xColor = Color3::red(),
const Color4 yColor = Color3::green(),
const Color4 zColor = Color3::blue(),
float  scale = 1.0f 
) [static]

static void G3D::Draw::axes ( const class CoordinateFrame cframe,
RenderDevice renderDevice,
const Color4 xColor = Color3::red(),
const Color4 yColor = Color3::green(),
const Color4 zColor = Color3::blue(),
float  scale = 1.0f 
) [static]

static void G3D::Draw::box ( const AABox box,
RenderDevice rd,
const Color4 solidColor = Color4(1,.2f,.2f,.5f),
const Color4 wireColor = Color3::black() 
) [static]

static void G3D::Draw::box ( const Box box,
RenderDevice rd,
const Color4 solidColor = Color4(1,.2f,.2f,.5f),
const Color4 wireColor = Color3::black() 
) [static]

Set the solid color or wire color to Color4::clear() to prevent rendering of surfaces or lines.

static void G3D::Draw::capsule ( const Capsule capsule,
RenderDevice renderDevice,
const Color4 solidColor = Color4(1, 0, 1,.5),
const Color4 wireColor = Color3::black() 
) [static]

static void G3D::Draw::cylinder ( const Cylinder cylinder,
RenderDevice renderDevice,
const Color4 solidColor = Color4(1, 1, 0,.5),
const Color4 wireColor = Color3::black() 
) [static]

static void G3D::Draw::fastRect2D ( const Rect2D rect,
RenderDevice rd,
const Color4 color = Color3::white() 
) [static]

Leaves the renderDevice color and texture coordinates modified.

Does not allow custom texture coordinates and only sets texture coordinate 0.

static void G3D::Draw::frustum ( const class GCamera::Frustum frustum,
RenderDevice rd,
const Color4 color = Color4(1,.4f,.4f, 0.2f),
const Color4 wire = Color3::black() 
) [static]

static void G3D::Draw::fullScreenImage ( const class GImage im,
RenderDevice renderDevice 
) [static]

This method is as hideously slow as it is convenient.

If you care about performance, make a rectangular texture (without MIPMaps) and draw using that.

static void G3D::Draw::line ( const Line line,
RenderDevice rd,
const Color4 color = Color3::black() 
) [static]

static void G3D::Draw::lineSegment ( const LineSegment lineSegment,
RenderDevice rd,
const Color4 color = Color3::black(),
float  scale = 1 
) [static]

static void G3D::Draw::plane ( const Plane plane,
RenderDevice rd,
const Color4 solidColor = Color4(.2f,.2f, 1,.5f),
const Color4 wireColor = Color3::black() 
) [static]

static void G3D::Draw::poly2D ( const Array< Vector2 > &  polygon,
RenderDevice renderDevice,
const Color4 color = Color3::yellow() 
) [static]

static void G3D::Draw::poly2DOutline ( const Array< Vector2 > &  polygon,
RenderDevice renderDevice,
const Color4 color = Color3::yellow() 
) [static]

Renders exact corners of a 2D polygon using lines.

Assumes you already called push2D().

static void G3D::Draw::ray ( const class Ray ray,
RenderDevice renderDevice,
const Color4 color = Color3::orange(),
float  scale = 1 
) [static]

static void G3D::Draw::rect2D ( const class Rect2D rect,
RenderDevice rd,
const Color4 color,
const Rect2D texCoord0,
const Rect2D texCoord1 = Rect2D::xywh(0, 0, 1, 1),
const Rect2D texCoord2 = Rect2D::xywh(0, 0, 1, 1),
const Rect2D texCoord3 = Rect2D::xywh(0, 0, 1, 1) 
) [static]

Draws the specified rectangle, setting coordinates for the first four texture units as specified.

static void G3D::Draw::rect2D ( const class Rect2D rect,
RenderDevice rd,
const Color4 color = Color3::white(),
const Vector2 texCoord0 = Vector2(1, 1),
const Vector2 texCoord1 = Vector2(1, 1),
const Vector2 texCoord2 = Vector2(1, 1),
const Vector2 texCoord3 = Vector2(1, 1) 
) [static]

Draws a rectangle using the current textures and texture coordinates that by default stretch the textures to fill the rectangle.

Provided texture coordinates are upper bounds for each of four textures. The actual tex coords will vary from (0, 0) to those bounds.

static void G3D::Draw::rect2DBorder ( const class Rect2D rect,
RenderDevice rd,
const Color4 color = Color3::black(),
float  innerBorder = 0,
float  outerBorder = 1 
) [static]

Draws a border of size width about the rectangle using polygons (since RenderDevice::LINE_STRIP doesn't guarantee pixel widths).

static void G3D::Draw::sphere ( const Sphere sphere,
RenderDevice rd,
const Color4 solidColor = Color4(1, 1, 0,.5f),
const Color4 wireColor = Color3::black() 
) [static]

static void G3D::Draw::vertexNormals ( const G3D::MeshAlg::Geometry geometry,
RenderDevice renderDevice,
const Color4 color = Color3::green()*.5,
float  scale = 1 
) [static]

Renders per-vertex normals as thin arrows.

The length of the normals is scaled inversely to the number of normals rendered.

static void G3D::Draw::vertexVectors ( const Array< Vector3 > &  vertexArray,
const Array< Vector3 > &  directionArray,
RenderDevice renderDevice,
const Color4 color = Color3::red()*0.5,
float  scale = 1 
) [static]

Convenient for rendering tangent space basis vectors.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:45 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo