Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | List of all members
G3D::Draw Class Reference

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

Static Public Member Functions

static void arrow (const Point3 &start, const Vector3 &vector, RenderDevice *renderDevice, const Color4 &color=Color3::orange(), 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 axes (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 Box &box, RenderDevice *rd, const Color4 &solidColor=Color4(1,.2f,.2f,.5f), const Color4 &wireColor=Color3::black())
 Set the solid color or wire color to Color4::clear() to prevent rendering of surfaces or lines.
 
static void box (const AABox &box, RenderDevice *rd, const Color4 &solidColor=Color4(1,.2f,.2f,.5f), const Color4 &wireColor=Color3::black())
 
static void camera (shared_ptr< Camera > camera, RenderDevice *rd)
 Draws a symbolic representation of the camera.
 
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())
 Leaves the renderDevice color and texture coordinates modified.
 
static void frustum (const class Frustum &frustum, RenderDevice *rd, const Color4 &color=Color4(1,.4f,.4f, 0.2f), const Color4 &wire=Color3::black())
 
static void light (shared_ptr< Light > light, RenderDevice *rd, float dirDist=1000.0f)
 Visualize a single light (simple version) dirDist is the distance away to draw the geometry for a directional light.
 
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 physicsFrameSpline (const class PhysicsFrameSpline &spline, RenderDevice *rd, int highlightedIndex=-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())
 Renders exact corners of a 2D polygon using lines.
 
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=Color3::white(), const Vector2 &texCoord0=Vector2(1, 1), const Vector2 &texCoord1=Vector2(1, 1))
 Draws a rectangle using the current textures and texture coordinates that by default stretch the textures to fill the rectangle.
 
static void rect2D (const class Rect2D &rect, RenderDevice *rd, const Color4 &color, const Rect2D &texCoord0, const Rect2D &texCoord1=Rect2D::xywh(0, 0, 1, 1))
 
static void rect2D (const class Rect2D &rect, RenderDevice *rd, const shared_ptr< Texture > &textureMap, const Color4 &color)
 
static void rect2DBorder (const class Rect2D &rect, RenderDevice *rd, const Color4 &color=Color3::black(), float innerBorder=0, float outerBorder=1)
 Draws a border about the rectangle using polygons (since PrimitiveType::LINE_STRIP doesn't guarantee pixel widths).
 
static void skyBox (RenderDevice *renderDevice, const shared_ptr< Texture > &cubeMap, float radianceScale=1.0f, float gammaAdjust=1.0f)
 Render a skybox using cubeMap, and the set of 6 cube map faces in texture if cubeMap is NULL.
 
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)
 Renders per-vertex normals as thin arrows.
 
static void vertexVectors (const Array< Vector3 > &vertexArray, const Array< Vector3 > &directionArray, RenderDevice *renderDevice, const Color4 &color=Color3::red()*0.5, float scale=1)
 Convenient for rendering tangent space basis vectors.
 
static void visualizeCameraGeometry (shared_ptr< Camera > camera, RenderDevice *rd)
 Draws relevant geometry information for the camera.
 
static void visualizeLightGeometry (shared_ptr< Light > light, RenderDevice *rd)
 Visualize a the geometry of the effect of a single light.
 

Detailed Description

Useful routines for rendering primitives when debugging.

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

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

See Also
debugDraw, Shape

Member Function Documentation

static void G3D::Draw::arrow ( const Point3 start,
const Vector3 vector,
RenderDevice renderDevice,
const Color4 color = Color3::orange(),
float  scale = 1.0f 
)
static
Parameters
vectorCan be non-unit length.
scaleMagnify vector by this amount.
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::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::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::box ( const AABox box,
RenderDevice rd,
const Color4 solidColor = Color4(1,.2f,.2f,.5f),
const Color4 wireColor = Color3::black() 
)
static
static void G3D::Draw::camera ( shared_ptr< Camera camera,
RenderDevice rd 
)
static

Draws a symbolic representation of the camera.

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.

Deprecated:
static void G3D::Draw::frustum ( const class Frustum frustum,
RenderDevice rd,
const Color4 color = Color4(1,.4f,.4f, 0.2f),
const Color4 wire = Color3::black() 
)
static
static void G3D::Draw::light ( shared_ptr< Light light,
RenderDevice rd,
float  dirDist = 1000.0f 
)
static

Visualize a single light (simple version) dirDist is the distance away to draw the geometry for a directional light.

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::physicsFrameSpline ( const class PhysicsFrameSpline spline,
RenderDevice rd,
int  highlightedIndex = -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 = Color3::white(),
const Vector2 texCoord0 = Vector2(1, 1),
const Vector2 texCoord1 = 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.

Deprecated:
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) 
)
static
static void G3D::Draw::rect2D ( const class Rect2D rect,
RenderDevice rd,
const shared_ptr< Texture > &  textureMap,
const Color4 color 
)
static
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 about the rectangle using polygons (since PrimitiveType::LINE_STRIP doesn't guarantee pixel widths).

static void G3D::Draw::skyBox ( RenderDevice renderDevice,
const shared_ptr< Texture > &  cubeMap,
float  radianceScale = 1.0f,
float  gammaAdjust = 1.0f 
)
static

Render a skybox using cubeMap, and the set of 6 cube map faces in texture if cubeMap is NULL.

Parameters
gammaAdjustExponent to apply to texels before radiance scale. See Texture::Preprocess::gamma().
See Also
SkyboxSurface
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.

static void G3D::Draw::visualizeCameraGeometry ( shared_ptr< Camera camera,
RenderDevice rd 
)
static

Draws relevant geometry information for the camera.

Currently simply draws the camera frustum.

static void G3D::Draw::visualizeLightGeometry ( shared_ptr< Light light,
RenderDevice rd 
)
static

Visualize a the geometry of the effect of a single light.

Currently does nothing for directional lights and shows a full effect sphere for both spot and omni lights


documentation generated on Mon Aug 19 2013 22:12:45 using doxygen 1.8.2