DI-Guy SDK Documentation  13.1
diguyViewPainter Class Reference

#include <diguyViewPainter.h>

Public Member Functions

State-Setting Functions

Unless otherwise noted all functions in this class section are callable from:

  • C++
  • Script
virtual void set_line_width (float width)
 Sets the current width of lines drawn by the painter. More...
 
virtual void set_pen_color (float red, float green, float blue, float alpha=1.0f)
 Sets the color of the default pen. More...
 
virtual void set_pen2_color (float red, float green, float blue, float alpha=1.0f)
 Sets the color of the secondary pen. More...
 
virtual void set_brush_color (float red, float green, float blue, float alpha=1.0f)
 Sets the color of the brush. More...
 
View Functions
virtual void get_viewport_size (float *width, float *height)
 Fills out the width and height arguments with the dimensions of the primary 3D view. More...
 
virtual void world_to_screen (float world_x, float world_y, float world_z, float *view_x, float *view_y, float *view_z)
 This function converts a world (x, y, z) coordinate into a view (x, y, z) coordinate. More...
 
3D Draw Functions

In all 3D draw functions, if there are edges to be drawn they are drawn with the current pen color as set by set_pen_color().

If there is an area to be filled it will be filled with the current brush color, as set by set_brush_color().

Unless otherwise noted all functions in this class section are callable from:

  • C++
  • Script
virtual void draw_line (float x1, float y1, float z1, float x2, float y2, float z2)
 Draws a line from (x1, y1, z1) to (x2, y2, z2) using the pen color. More...
 
virtual void draw_line_2c (float x1, float y1, float z1, float x2, float y2, float z2)
 Draws a line from (x1, y1, z1) to (x2, y2, z2) using both of the pen colors. More...
 
virtual void draw_sphere (float x, float y, float z, float radius, int draw_edges=1, int draw_fill=1)
 Draws a sphere with its center at (x, y, z), with radius radius. More...
 
virtual void draw_box (float x1, float y1, float z1, float x2, float y2, float z2, int draw_edges=1, int draw_fill=1)
 Draws an axis aligned bounding box with one corner at (x1, y1, z1), the other at (x2, y2, z2). More...
 
virtual void draw_rotated_box (float x1, float y1, float z1, float x2, float y2, float z2, float yaw, float roll, float pitch, float xc, float yc, float zc, int edges=1, int fill=1)
 Draws a rotated bounding box with one corner at unrotated (x1, y1, z1), and another at unrotated (x2, y2, z2), applying the rotation Euler angles (given in BDI_EULER_ANGLE_ORDER_ZXY order in degrees). More...
 
virtual void draw_arrow (float x1, float y1, float z1, float x2, float y2, float z2, float shaft_width=0.02, float arrow_width=0.05, int draw_edges=1, int draw_fill=1)
 Draws an arrow from (x1, y1, z1) to (x2, y2, z2). More...
 
virtual void draw_disc (float x, float y, float z, float radius, int draw_edges=1, int draw_fill=1, int num_sides=12)
 Draws a disc with its center at (x, y, z), and the given radius. More...
 
virtual void draw_circle (float x, float y, float z, float normal_x, float normal_y, float normal_z, float radius, int draw_edges=1, int draw_fill=1, int num_sides=12)
 Draws a circle at (x, y, z), with normal (normal_x, normal_y, normal_z), and the given radius. More...
 
virtual void draw_torus (float x, float y, float z, float inner_radius, float outer_radius, int draw_edges=1, int draw_fill=1, int num_sides=12)
 Draws a torus at (x, y, z), with normal (normal_x, normal_y, normal_z), and the given radius. More...
 
virtual void draw_cylinder (float x, float y, float z, float radius, float height, int draw_edges=1, int draw_fill=1)
 Draws a Z-axis-up cylinder, with its bottom cap centered at (x1, y1, z). More...
 
virtual void draw_wedge (float x, float y, float z, float target_x, float target_y, float target_z, float inner_radius, float width, int draw_edges=1, int draw_fill=1)
 Draws wedge. More...
 
virtual void draw_wedge_with_normal (float x, float y, float z, float target_x, float target_y, float target_z, float nx, float ny, float nz, float inner_radius, float width, int draw_edges=1, int draw_fill=1)
 
2D Draw Functions

Before 2D drawing functions are called the view must be put into a 2D drawing state by calling begin_2d_text_mode().

Unless otherwise noted all functions in this class section are callable from:

  • C++
  • Script
virtual void begin_2d_text_mode ()
 Puts the OpenGL view matrix into a 2D orthogonal state so that 2D primitives will be drawn in 2D view coordinates rather than in 3D world coordinates. More...
 
virtual void end_2d_text_mode ()
 Returns the OpenGL view matrix back into a 3D perspective state. More...
 
virtual void draw_text (float screen_x, float screen_y, const char *text)
 Draws the passed text string at view coordinates (x, y). More...
 
virtual void draw_2d_rect (float x0, float y0, float x1, float y1, int draw_edges=1, int draw_fill=1)
 Draws a 2D rectangle with the given points as the corners. More...
 
virtual void draw_private_path_shape (diguyCharacter *diguy_character, int include_waypoints=0)
 Draws a character's private path shape, typically generated from path planner. More...
 
virtual void debug_pa_add_2d_point (const char *name, float x, float y)
 
virtual void debug_pa_add_3d_point (const char *name, float x, float y, float z)
 
virtual void debug_pa_set_param_color (const char *name, float r, float g, float b, float a=1.0f)
 
virtual void debug_pa_set_param_style (const char *name, const char *param, int value)
 
virtual void debug_pa_reset (const char *name)
 
virtual void draw_point_arrays ()
 

Private Functions

The functions and variables past this point are for internal use only.

No external access to them is expected or necessary.

class bdiScenarioApp
 
 diguyViewPainter ()
 A protected constructor. More...
 

Constructor & Destructor Documentation

diguyViewPainter::diguyViewPainter ( )
protected

A protected constructor.

Use the DI-Guy function diguyApp:get_view_painter() to obtain a diguyViewPainter object pointer.

Member Function Documentation

virtual void diguyViewPainter::set_line_width ( float  width)
virtual

Sets the current width of lines drawn by the painter.

virtual void diguyViewPainter::set_pen_color ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)
virtual

Sets the color of the default pen.

Pens typically draw lines and borders around shapes. Color values should be between 0.0 and 1.0.

virtual void diguyViewPainter::set_pen2_color ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)
virtual

Sets the color of the secondary pen.

Color values should be between 0.0 and 1.0.

virtual void diguyViewPainter::set_brush_color ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)
virtual

Sets the color of the brush.

Brushes are typically used for filling shapes. Color values should be between 0.0 and 1.0.

virtual void diguyViewPainter::get_viewport_size ( float *  width,
float *  height 
)
virtual

Fills out the width and height arguments with the dimensions of the primary 3D view.

virtual void diguyViewPainter::world_to_screen ( float  world_x,
float  world_y,
float  world_z,
float *  view_x,
float *  view_y,
float *  view_z 
)
virtual

This function converts a world (x, y, z) coordinate into a view (x, y, z) coordinate.

**

Note
this function must be called ** efore* 2d text mode is entered with the begin_2d_text_mode() function.

If the returned view z value is greater then 1, the returned coordinate is behind the camera.

virtual void diguyViewPainter::draw_line ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)
virtual

Draws a line from (x1, y1, z1) to (x2, y2, z2) using the pen color.

virtual void diguyViewPainter::draw_line_2c ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)
virtual

Draws a line from (x1, y1, z1) to (x2, y2, z2) using both of the pen colors.

The color of the line is interpolated from point 1 to point 2.

virtual void diguyViewPainter::draw_sphere ( float  x,
float  y,
float  z,
float  radius,
int  draw_edges = 1,
int  draw_fill = 1 
)
virtual

Draws a sphere with its center at (x, y, z), with radius radius.

virtual void diguyViewPainter::draw_box ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
int  draw_edges = 1,
int  draw_fill = 1 
)
virtual

Draws an axis aligned bounding box with one corner at (x1, y1, z1), the other at (x2, y2, z2).

virtual void diguyViewPainter::draw_rotated_box ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  yaw,
float  roll,
float  pitch,
float  xc,
float  yc,
float  zc,
int  edges = 1,
int  fill = 1 
)
virtual

Draws a rotated bounding box with one corner at unrotated (x1, y1, z1), and another at unrotated (x2, y2, z2), applying the rotation Euler angles (given in BDI_EULER_ANGLE_ORDER_ZXY order in degrees).

The box is drawn at center point (xc, yc, zc) in global space, and then rotated.

virtual void diguyViewPainter::draw_arrow ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  shaft_width = 0.02,
float  arrow_width = 0.05,
int  draw_edges = 1,
int  draw_fill = 1 
)
virtual

Draws an arrow from (x1, y1, z1) to (x2, y2, z2).

virtual void diguyViewPainter::draw_disc ( float  x,
float  y,
float  z,
float  radius,
int  draw_edges = 1,
int  draw_fill = 1,
int  num_sides = 12 
)
virtual

Draws a disc with its center at (x, y, z), and the given radius.

virtual void diguyViewPainter::draw_circle ( float  x,
float  y,
float  z,
float  normal_x,
float  normal_y,
float  normal_z,
float  radius,
int  draw_edges = 1,
int  draw_fill = 1,
int  num_sides = 12 
)
virtual

Draws a circle at (x, y, z), with normal (normal_x, normal_y, normal_z), and the given radius.

virtual void diguyViewPainter::draw_torus ( float  x,
float  y,
float  z,
float  inner_radius,
float  outer_radius,
int  draw_edges = 1,
int  draw_fill = 1,
int  num_sides = 12 
)
virtual

Draws a torus at (x, y, z), with normal (normal_x, normal_y, normal_z), and the given radius.

virtual void diguyViewPainter::draw_cylinder ( float  x,
float  y,
float  z,
float  radius,
float  height,
int  draw_edges = 1,
int  draw_fill = 1 
)
virtual

Draws a Z-axis-up cylinder, with its bottom cap centered at (x1, y1, z).

The cylinder will have the given radius and height.

virtual void diguyViewPainter::draw_wedge ( float  x,
float  y,
float  z,
float  target_x,
float  target_y,
float  target_z,
float  inner_radius,
float  width,
int  draw_edges = 1,
int  draw_fill = 1 
)
virtual

Draws wedge.

virtual void diguyViewPainter::draw_wedge_with_normal ( float  x,
float  y,
float  z,
float  target_x,
float  target_y,
float  target_z,
float  nx,
float  ny,
float  nz,
float  inner_radius,
float  width,
int  draw_edges = 1,
int  draw_fill = 1 
)
virtual
virtual void diguyViewPainter::begin_2d_text_mode ( )
virtual

Puts the OpenGL view matrix into a 2D orthogonal state so that 2D primitives will be drawn in 2D view coordinates rather than in 3D world coordinates.

This call must be balanced by a call to end_2d_text_mode(), or overall drawing will be broken.

virtual void diguyViewPainter::end_2d_text_mode ( )
virtual

Returns the OpenGL view matrix back into a 3D perspective state.

This call must be balanced by a call to begin_2d_text_mode(), or overall drawing will be broken.

virtual void diguyViewPainter::draw_text ( float  screen_x,
float  screen_y,
const char *  text 
)
virtual

Draws the passed text string at view coordinates (x, y).

Should only be called inside of a begin_2d_text_mode() and end_2d_text_mode() block.

The text is drawn with the current pen color.

virtual void diguyViewPainter::draw_2d_rect ( float  x0,
float  y0,
float  x1,
float  y1,
int  draw_edges = 1,
int  draw_fill = 1 
)
virtual

Draws a 2D rectangle with the given points as the corners.

Should only be called inside of a begin_2d_text_mode() and end_2d_text_mode() block.

The edges are drawn with the current pen color, the fill is drawn with the current brush color.

virtual void diguyViewPainter::draw_private_path_shape ( diguyCharacter diguy_character,
int  include_waypoints = 0 
)
virtual

Draws a character's private path shape, typically generated from path planner.

virtual void diguyViewPainter::debug_pa_add_2d_point ( const char *  name,
float  x,
float  y 
)
virtual
virtual void diguyViewPainter::debug_pa_add_3d_point ( const char *  name,
float  x,
float  y,
float  z 
)
virtual
virtual void diguyViewPainter::debug_pa_set_param_color ( const char *  name,
float  r,
float  g,
float  b,
float  a = 1.0f 
)
virtual
virtual void diguyViewPainter::debug_pa_set_param_style ( const char *  name,
const char *  param,
int  value 
)
virtual
virtual void diguyViewPainter::debug_pa_reset ( const char *  name)
virtual
virtual void diguyViewPainter::draw_point_arrays ( )
virtual

Friends And Related Function Documentation

friend class bdiScenarioApp
friend

The documentation for this class was generated from the following file: