DI-Guy SDK Documentation  13.7
diguyViewPainter.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2022 MAK Technologies, Inc.
4  ** All rights reserved.
5  *********************************************************************/
6 
7 
8 #ifndef __diguyViewPainter_H
9 #define __diguyViewPainter_H
10 
11 #ifdef SWIG
12 %module diguyViewPainter
13 #else
14 #define CPLUSPLUS_ONLY
15 #endif
16 
17 #include <declspec_diguy.h>
18 
19 class diguyCharacter;
21 
38 class BDI_DECLSPEC_diguy diguyViewPainter
39 {
40 
41 public:
42 
43 /*****************************************************************************/
54  /*l
55  *b Description:
56  **
57  ** Sets the current width of lines drawn by the painter.
58  */
59  virtual void set_line_width(float width);
60 
61  /*l
62  *b Description:
63  **
64  ** Sets the color of the default pen. Pens typically draw lines and
65  ** borders around shapes. Color values should be between 0.0 and
66  ** 1.0.
67  */
68  virtual void set_pen_color(float red, float green, float blue, float alpha = 1.0f);
69 
70  /*l
71  *b Description:
72  **
73  ** Sets the color of the secondary pen. Color values should be
74  ** between 0.0 and 1.0.
75  */
76  virtual void set_pen2_color(float red, float green, float blue, float alpha = 1.0f);
77 
78  /*l
79  *b Description:
80  **
81  ** Sets the color of the brush. Brushes are typically used for
82  ** filling shapes. Color values should be between 0.0 and 1.0.
83  */
84  virtual void set_brush_color(float red, float green, float blue, float alpha = 1.0f);
85 
86 
87 /*****************************************************************************/
93  /*l
94  *b Description:
95  **
96  ** Fills out the width and height arguments with the dimensions of
97  ** the primary 3D view.
98  */
99  virtual void get_viewport_size(float* width, float* height);
100 
101  /*l
102  *b Description:
103  **
104  ** This function converts a world (x, y, z) coordinate into a view
105  ** (x, y, z) coordinate.
106  **
107  ** Note: this function must be called *before* 2d text mode is
108  ** entered with the begin_2d_text_mode() function.
109  **
110  ** If the returned view z value is greater then 1, the returned
111  ** coordinate is behind the camera.
112  */
113  virtual void world_to_screen(float world_x, float world_y, float world_z,
114  float* view_x, float* view_y, float* view_z);
115 
116 
117 /*****************************************************************************/
133  /*l
134  *b Description:
135  **
136  ** Draws a line from (x1, y1, z1) to (x2, y2, z2) using the pen color.
137  */
138  virtual void draw_line(float x1, float y1, float z1,
139  float x2, float y2, float z2);
140 
141  /*l
142  *b Description:
143  **
144  ** Draws a line from (x1, y1, z1) to (x2, y2, z2) using both of the
145  ** pen colors. The color of the line is interpolated from point 1 to
146  ** point 2.
147  */
148  virtual void draw_line_2c(float x1, float y1, float z1,
149  float x2, float y2, float z2);
150 
151  /*l
152  *b Description:
153  **
154  ** Draws a sphere with its center at (x, y, z), with radius radius.
155  */
156  virtual void draw_sphere(float x, float y, float z,
157  float radius,
158  int draw_edges = 1,
159  int draw_fill = 1);
160 
161  /*l
162  *b Description:
163  **
164  ** Draws an axis aligned bounding box with one corner at (x1, y1, z1),
165  ** the other at (x2, y2, z2).
166  */
167  virtual void draw_box(float x1, float y1, float z1,
168  float x2, float y2, float z2,
169  int draw_edges = 1,
170  int draw_fill = 1);
171 
172  /*l
173  *b Description:
174  **
175  ** Draws a rotated bounding box with one corner at unrotated (x1,
176  ** y1, z1), and another at unrotated (x2, y2, z2), applying the
177  ** rotation Euler angles (given in BDI_EULER_ANGLE_ORDER_ZXY order in
178  ** degrees). The box is drawn at center point (xc, yc, zc) in global
179  ** space, and then rotated.
180  */
181  virtual void draw_rotated_box(float x1, float y1, float z1,
182  float x2, float y2, float z2,
183  float yaw, float roll, float pitch,
184  float xc, float yc, float zc,
185  int edges = 1,
186  int fill = 1);
187 
188  /*l
189  *b Description:
190  **
191  ** Draws an arrow from (x1, y1, z1) to (x2, y2, z2).
192  */
193  virtual void draw_arrow(float x1, float y1, float z1,
194  float x2, float y2, float z2,
195  float shaft_width = 0.02,
196  float arrow_width = 0.05,
197  int draw_edges = 1,
198  int draw_fill = 1);
199 
200  /*l
201  *b Description:
202  **
203  ** Draws a disc with its center at (x, y, z), and the given radius.
204  */
205  virtual void draw_disc(float x, float y, float z,
206  float radius,
207  int draw_edges = 1,
208  int draw_fill = 1,
209  int num_sides = 12);
210 
211  /*l
212  *b Description:
213  **
214  ** Draws a circle at (x, y, z), with normal (normal_x, normal_y,
215  ** normal_z), and the given radius.
216  */
217  virtual void draw_circle(float x, float y, float z,
218  float normal_x, float normal_y, float normal_z,
219  float radius,
220  int draw_edges = 1,
221  int draw_fill = 1,
222  int num_sides = 12);
223 
224  /*l
225  *b Description:
226  **
227  ** Draws a torus at (x, y, z), with normal (normal_x, normal_y,
228  ** normal_z), and the given radius.
229  */
230  virtual void draw_torus(float x, float y, float z,
231  float inner_radius,
232  float outer_radius,
233  int draw_edges = 1,
234  int draw_fill = 1,
235  int num_sides = 12);
236 
237  /*l
238  *b Description:
239  **
240  ** Draws a Z-axis-up cylinder, with its bottom cap centered at
241  ** (x1, y1, z). The cylinder will have the given radius and height.
242  */
243  virtual void draw_cylinder(float x, float y, float z,
244  float radius,
245  float height,
246  int draw_edges = 1,
247  int draw_fill = 1);
248 
249 
250  /*l
251  *b Description:
252  **
253  ** Draws wedge.
254  */
255  virtual void draw_wedge(float x, float y, float z,
256  float target_x, float target_y, float target_z,
257  float inner_radius,
258  float width,
259  int draw_edges = 1,
260  int draw_fill = 1);
261 
262  virtual void draw_wedge_with_normal(float x, float y, float z,
263  float target_x, float target_y, float target_z,
264  float nx, float ny, float nz,
265  float inner_radius,
266  float width,
267  int draw_edges = 1,
268  int draw_fill = 1);
269 
270 
271 /*****************************************************************************/
285  /*l
286  *b Description:
287  **
288  ** Puts the OpenGL view matrix into a 2D orthogonal state so that
289  ** 2D primitives will be drawn in 2D view coordinates rather than in
290  ** 3D world coordinates.
291  ** This call *must* be balanced by a call to end_2d_text_mode(), or
292  ** overall drawing will be broken.
293  */
294  virtual void begin_2d_mode();
295 
296  /*l
297  *b Description:
298  **
299  ** same as begin_2d_mode() but also binds font texture
300  */
301  virtual void begin_2d_text_mode();
302 
303 
304  /*l
305  *b Description:
306  **
307  ** Returns the OpenGL view matrix back into a 3D perspective state.
308  **
309  ** This call *must* be balanced by a call to begin_2d_text_mode(), or
310  ** overall drawing will be broken.
311  */
312  virtual void end_2d_text_mode();
313 
314  /*l
315  *b Description:
316  **
317  ** Draws the passed text string at view coordinates (x, y).
318  **
319  ** Should only be called inside of a begin_2d_text_mode() and
320  ** end_2d_text_mode() block.
321  **
322  ** The text is drawn with the current pen color.
323  */
324  virtual void draw_text(float screen_x, float screen_y, const char* text);
325 
326  /*l
327  *b Description:
328  **
329  ** Draws a 2D rectangle with the given points as the corners.
330  **
331  ** Should only be called inside of a begin_2d_text_mode() and
332  ** end_2d_text_mode() block.
333  **
334  ** The edges are drawn with the current pen color, the fill is
335  ** drawn with the current brush color.
336  */
337  virtual void draw_2d_rect(float x0,
338  float y0,
339  float x1,
340  float y1,
341  float z0 = 0.0f,
342  int draw_edges = 1,
343  int draw_fill = 1);
344 
346  virtual void draw_buffered_data();
347 
349  virtual void draw_private_path_shape(diguyCharacter* diguy_character,
350  int include_waypoints = 0);
351 
352  virtual void debug_pa_add_2d_point( const char * name, float x, float y );
353  virtual void debug_pa_add_3d_point( const char * name, float x, float y, float z );
354  virtual void debug_pa_set_param_color( const char * name, float r, float g, float b, float a = 1.0f );
355  virtual void debug_pa_set_param_style( const char * name, const char * param, int value );
356 
358  virtual void debug_pa_reset(const char * name);
359 
360  virtual void draw_point_arrays();
361 
362 #ifdef CPLUSPLUS_ONLY
363 
364  virtual void draw_opengl_primitive( diguyGraphicsShaderProgram * shader, int primitive_type,
365  int vertex_count, float * verts, float * colors = NULL, float * normals = NULL, float * uvs = NULL );
366  virtual void draw_opengl_primitive( int primative_type, int vertex_count, float * verts,
367  float * colors = NULL, float * normals = NULL, float * uvs = NULL );
368 
375 protected:
376 
377  /*l
378  ** A protected constructor. Use the DI-Guy function
379  ** diguyApp:get_view_painter() to obtain a diguyViewPainter object
380  ** pointer.
381  */
383  virtual ~diguyViewPainter() { ; }
384 private:
385 
386 
387  friend class bdiScenarioApp;
388 
389 #endif
390 
391 };
392 
393 #endif /* __diguyViewPainter_H */
394 
The diguyViewPainter class acts as a helper for drawing various graphics primitives in DI-Guy Scenari...
Definition: diguyViewPainter.h:36
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:81
This class implements shader programs for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderProgram.h:94