Support Forum       G3D Web Page     
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())
 
static void box (const AABox &box, RenderDevice *rd, const Color4 &solidColor=Color4(1,.2f,.2f,.5f), const Color4 &wireColor=Color3::black())
 
static void boxes (const Array< Box > &boxes, RenderDevice *renderDevice, 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. More...
 
static void boxes (const Array< AABox > &aaboxes, RenderDevice *renderDevice, const Color4 &solidColor=Color4(1,.2f,.2f,.5f), const Color4 &wireColor=Color3::black())
 Converts all AABox to Boxes first, so not optimized. More...
 
static void camera (shared_ptr< Camera > camera, RenderDevice *rd)
 Draws a symbolic representation of the camera. More...
 
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 frustum (const class Frustum &frustum, RenderDevice *rd, const Color4 &color=Color4(1,.4f,.4f, 0.2f), const Color4 &wire=Color3::black())
 
static void histogram (const Rect2D &area, const Array< float > &values, float binSize, RenderDevice *rd, shared_ptr< GFont > font, const Color4 &boxColor=Color3::black(), const Color4 &labelColor=Color3::black(), float fontSize=12.0f, bool useLogScale=false)
 The actual histogram will only be 95% as wide and 80% as tall as. More...
 
static void light (const shared_ptr< Light > &light, RenderDevice *rd, RenderPassType passType, float dirDist=1000.0f)
 Visualize a single light (simple version) dirDist is the distance away to draw the geometry for a directional light. More...
 
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 point (const Point3 &point, RenderDevice *rd, const Color4 &color=Color3::white(), float pixelRadius=0.5f)
 Draw a single point. More...
 
static void point (const Point2 &point, RenderDevice *rd, const Color4 &color=Color3::white(), float pixelRadius=0.5f)
 
static void points (const Array< Point3 > &points, RenderDevice *rd, const Array< Color3 > &colors, float pixelRadius=0.5f)
 Draw a colored point cloud. More...
 
static void points (const Array< Point3 > &points, RenderDevice *rd, const Color4 &color=Color3::white(), float pixelRadius=0.5f)
 Draw a point cloud. More...
 
static void points (const Array< Point2 > &points, RenderDevice *rd, const Color4 &color=Color3::white(), float pixelRadius=0.5f)
 
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. More...
 
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 shared_ptr< Texture > &textureMap=nullptr, const Sampler &sampler=Sampler::video(), bool invertY=false, float gammaAdjust=1.0f)
 Draws a rectangle with dimensions specified by the input rect that contains either the passed in texture or if the textureMap is null then the color specified is drawn. More...
 
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). More...
 
static void skyBox (RenderDevice *renderDevice, const shared_ptr< Texture > &cubeMap)
 Render a skybox using cubeMap, and the set of 6 cube map faces in texture if cubeMap is nullptr. More...
 
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. More...
 
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. More...
 
static void visualizeCameraGeometry (shared_ptr< Camera > camera, RenderDevice *rd)
 Draws relevant geometry information for the camera. More...
 
static void visualizeLightGeometry (const shared_ptr< Light > &light, RenderDevice *rd, RenderPassType passType)
 Visualize a the geometry of the effect of a single light. More...
 

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

◆ arrow()

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.

◆ axes() [1/2]

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

◆ axes() [2/2]

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

◆ box() [1/2]

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

◆ box() [2/2]

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

◆ boxes() [1/2]

static void G3D::Draw::boxes ( const Array< Box > &  boxes,
RenderDevice renderDevice,
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.

◆ boxes() [2/2]

static void G3D::Draw::boxes ( const Array< AABox > &  aaboxes,
RenderDevice renderDevice,
const Color4 solidColor = Color4(1,.2f,.2f,.5f),
const Color4 wireColor = Color3::black() 
)
static

Converts all AABox to Boxes first, so not optimized.

◆ camera()

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

Draws a symbolic representation of the camera.

◆ capsule()

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

◆ cylinder()

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

◆ frustum()

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

◆ histogram()

static void G3D::Draw::histogram ( const Rect2D area,
const Array< float > &  values,
float  binSize,
RenderDevice rd,
shared_ptr< GFont font,
const Color4 boxColor = Color3::black(),
const Color4 labelColor = Color3::black(),
float  fontSize = 12.0f,
bool  useLogScale = false 
)
static

The actual histogram will only be 95% as wide and 80% as tall as.

Parameters
areadue to labels

◆ light()

static void G3D::Draw::light ( const shared_ptr< Light > &  light,
RenderDevice rd,
RenderPassType  passType,
float  dirDist = 1000.0f 
)
static

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

◆ line()

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

◆ lineSegment()

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

◆ physicsFrameSpline()

static void G3D::Draw::physicsFrameSpline ( const class PhysicsFrameSpline spline,
RenderDevice rd,
int  highlightedIndex = -1 
)
static

◆ plane()

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

◆ point() [1/2]

static void G3D::Draw::point ( const Point3 point,
RenderDevice rd,
const Color4 color = Color3::white(),
float  pixelRadius = 0.5f 
)
static

Draw a single point.

◆ point() [2/2]

static void G3D::Draw::point ( const Point2 point,
RenderDevice rd,
const Color4 color = Color3::white(),
float  pixelRadius = 0.5f 
)
static

◆ points() [1/3]

static void G3D::Draw::points ( const Array< Point3 > &  points,
RenderDevice rd,
const Array< Color3 > &  colors,
float  pixelRadius = 0.5f 
)
static

Draw a colored point cloud.

Parameters
pointsand
colorsmust be of equal size

◆ points() [2/3]

static void G3D::Draw::points ( const Array< Point3 > &  points,
RenderDevice rd,
const Color4 color = Color3::white(),
float  pixelRadius = 0.5f 
)
static

Draw a point cloud.

◆ points() [3/3]

static void G3D::Draw::points ( const Array< Point2 > &  points,
RenderDevice rd,
const Color4 color = Color3::white(),
float  pixelRadius = 0.5f 
)
static

◆ poly2D()

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

◆ poly2DOutline()

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().

◆ ray()

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

◆ rect2D()

static void G3D::Draw::rect2D ( const class Rect2D rect,
RenderDevice rd,
const Color4 color = Color3::white(),
const shared_ptr< Texture > &  textureMap = nullptr,
const Sampler sampler = Sampler::video(),
bool  invertY = false,
float  gammaAdjust = 1.0f 
)
static

Draws a rectangle with dimensions specified by the input rect that contains either the passed in texture or if the textureMap is null then the color specified is drawn.

Parameters
gammaAdjustsourceFBGamma / targetFBGamma
invertYIf true, flip the Y axis of the texture (but not the rectangle coordinates)

◆ rect2DBorder()

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).

◆ skyBox()

static void G3D::Draw::skyBox ( RenderDevice renderDevice,
const shared_ptr< Texture > &  cubeMap 
)
static

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

See also
SkyboxSurface

◆ sphere()

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

◆ vertexNormals()

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.

◆ vertexVectors()

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.

◆ visualizeCameraGeometry()

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.

◆ visualizeLightGeometry()

static void G3D::Draw::visualizeLightGeometry ( const shared_ptr< Light > &  light,
RenderDevice rd,
RenderPassType  passType 
)
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 Wed Nov 24 2021 08:01:54 using doxygen 1.8.15