C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyViewPainter.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************
28  **
29  *t diguyViewPainter
30  **
31  *b Link against: libdiguy
32  **
33  *b Summary:
34  **
35  ** The diguyViewPainter class acts as a helper for drawing various
36  ** graphics primitives in DI-Guy Scenario 3D views.
37  **
38  ** Currently this class is only supported in DI-Guy Scenario, and should
39  ** be utilized only inside of a diguyScenario::CALLBACK_ID_POST_DRAW
40  ** callback, or inside of a mind draw function.
41  **
42  ** There is only one diguyViewPainter. Retrieve a pointer to it by
43  ** calling diguyApp::get_view_painter().
44  */
45 
46 #ifndef __diguyViewPainter_H
47 #define __diguyViewPainter_H
48 
49 #ifdef SWIG
50 %module diguyViewPainter
51 #else
52 #define CPLUSPLUS_ONLY
53 #endif
54 
55 #include <declspec_diguy.h>
56 
57 class diguyCharacter;
58 
59 /****************************************************************************/
60 class BDI_DECLSPEC_diguy diguyViewPainter
61 {
62 
63 public:
64 
65 /*****************************************************************************/
71  /*l
72  *b Description:
73  **
74  ** Sets the current width of lines drawn by the painter.
75  **
76  *b Callable From:
77  **
78  *- - C++
79  *- - Script
80  */
81  virtual void set_line_width(float width);
82 
83  /*l
84  *b Description:
85  **
86  ** Sets the color of the default pen. Pens typically draw lines and
87  ** borders around shapes. Color values should be between 0.0 and
88  ** 1.0.
89  **
90  *b Callable From:
91  **
92  *- - C++
93  *- - Script
94  */
95  virtual void set_pen_color(float red, float green, float blue, float alpha = 1.0f);
96 
97  /*l
98  *b Description:
99  **
100  ** Sets the color of the secondary pen. Color values should be
101  ** between 0.0 and 1.0.
102  **
103  *b Callable From:
104  **
105  *- - C++
106  *- - Script
107  */
108  virtual void set_pen2_color(float red, float green, float blue, float alpha = 1.0f);
109 
110  /*l
111  *b Description:
112  **
113  ** Sets the color of the brush. Brushes are typically used for
114  ** filling shapes. Color values should be between 0.0 and 1.0.
115  **
116  *b Callable From:
117  **
118  *- - C++
119  *- - Script
120  */
121  virtual void set_brush_color(float red, float green, float blue, float alpha = 1.0f);
122 
123 
124 /*****************************************************************************/
130  /*l
131  *b Description:
132  **
133  ** Fills out the width and height arguments with the dimensions of
134  ** the primary 3D view.
135  **
136  *b Callable From:
137  **
138  *- - C++
139  *- - Script
140  */
141  virtual void get_viewport_size(float* width, float* height);
142 
143  /*l
144  *b Description:
145  **
146  ** This function converts a world (x, y, z) coordinate into a view
147  ** (x, y, z) coordinate.
148  **
149  ** Note: this function must be called *before* 2d text mode is
150  ** entered with the begin_2d_text_mode() function.
151  **
152  ** If the returned view z value is greater then 1, the returned
153  ** coordinate is behind the camera.
154  */
155  virtual void world_to_screen(float world_x, float world_y, float world_z,
156  float* view_x, float* view_y, float* view_z);
157 
158 
159 /*****************************************************************************/
170  /*l
171  *b Description:
172  **
173  ** Draws a line from (x1, y1, z1) to (x2, y2, z2) using the pen color.
174  **
175  *b Callable From:
176  **
177  *- - C++
178  *- - Script
179  */
180  virtual void draw_line(float x1, float y1, float z1,
181  float x2, float y2, float z2);
182 
183  /*l
184  *b Description:
185  **
186  ** Draws a line from (x1, y1, z1) to (x2, y2, z2) using both of the
187  ** pen colors. The color of the line is interpolated from point 1 to
188  ** point 2.
189  **
190  *b Callable From:
191  **
192  *- - C++
193  *- - Script
194  */
195  virtual void draw_line_2c(float x1, float y1, float z1,
196  float x2, float y2, float z2);
197 
198  /*l
199  *b Description:
200  **
201  ** Draws a sphere with its center at (x, y, z), with radius radius.
202  **
203  *b Callable From:
204  **
205  *- - C++
206  *- - Script
207  */
208  virtual void draw_sphere(float x, float y, float z,
209  float radius,
210  int draw_edges = 1,
211  int draw_fill = 1);
212 
213  /*l
214  *b Description:
215  **
216  ** Draws an axis aligned bounding box with one corner at (x1, y1, z1),
217  ** the other at (x2, y2, z2).
218  **
219  *b Callable From:
220  **
221  *- - C++
222  *- - Script
223  */
224  virtual void draw_box(float x1, float y1, float z1,
225  float x2, float y2, float z2,
226  int draw_edges = 1,
227  int draw_fill = 1);
228 
229  /*l
230  *b Description:
231  **
232  ** Draws a rotated bounding box with one corner at unrotated (x1,
233  ** y1, z1), and another at unrotated (x2, y2, z2), applying the
234  ** rotation Euler angles (given in BDI_EULER_ANGLE_ORDER_ZXY order in
235  ** degrees). The box is drawn at center point (xc, yc, zc) in global
236  ** space, and then rotated.
237  **
238  *b Callable From:
239  **
240  *- - C++
241  *- - Script
242  */
243  virtual void draw_rotated_box(float x1, float y1, float z1,
244  float x2, float y2, float z2,
245  float yaw, float roll, float pitch,
246  float xc, float yc, float zc,
247  int edges = 1,
248  int fill = 1);
249 
250  /*l
251  *b Description:
252  **
253  ** Draws an arrow from (x1, y1, z1) to (x2, y2, z2).
254  **
255  *b Callable From:
256  **
257  *- - C++
258  *- - Script
259  */
260  virtual void draw_arrow(float x1, float y1, float z1,
261  float x2, float y2, float z2,
262  float shaft_width = 0.02,
263  float arrow_width = 0.05,
264  int draw_edges = 1,
265  int draw_fill = 1);
266 
267  /*l
268  *b Description:
269  **
270  ** Draws a disc with its center at (x, y, z), and the given radius.
271  **
272  *b Callable From:
273  **
274  *- - C++
275  *- - Script
276  */
277  virtual void draw_disc(float x, float y, float z,
278  float radius,
279  int draw_edges = 1,
280  int draw_fill = 1,
281  int num_sides = 12);
282 
283  /*l
284  *b Description:
285  **
286  ** Draws a circle at (x, y, z), with normal (normal_x, normal_y,
287  ** normal_z), and the given radius.
288  **
289  *b Callable From:
290  **
291  *- - C++
292  *- - Script
293  */
294  virtual void draw_circle(float x, float y, float z,
295  float normal_x, float normal_y, float normal_z,
296  float radius,
297  int draw_edges = 1,
298  int draw_fill = 1,
299  int num_sides = 12);
300 
301  /*l
302  *b Description:
303  **
304  ** Draws a torus at (x, y, z), with normal (normal_x, normal_y,
305  ** normal_z), and the given radius.
306  **
307  *b Callable From:
308  **
309  *- - C++
310  *- - Script
311  */
312  virtual void draw_torus(float x, float y, float z,
313  float inner_radius,
314  float outer_radius,
315  int draw_edges = 1,
316  int draw_fill = 1,
317  int num_sides = 12);
318 
319  /*l
320  *b Description:
321  **
322  ** Draws a Z-axis-up cylinder, with its bottom cap centered at
323  ** (x1, y1, z). The cylinder will have the given radius and height.
324  **
325  *b Callable From:
326  **
327  *- - C++
328  *- - Script
329  */
330  virtual void draw_cylinder(float x, float y, float z,
331  float radius,
332  float height,
333  int draw_edges = 1,
334  int draw_fill = 1);
335 
336 
337  /*l
338  *b Description:
339  **
340  ** Draws wedge.
341  **
342  *b Callable From:
343  **
344  *- - C++
345  *- - Script
346  */
347  virtual void draw_wedge(float x, float y, float z,
348  float target_x, float target_y, float target_z,
349  float inner_radius,
350  float width,
351  int draw_edges = 1,
352  int draw_fill = 1);
353 
354  virtual void draw_wedge_with_normal(float x, float y, float z,
355  float target_x, float target_y, float target_z,
356  float nx, float ny, float nz,
357  float inner_radius,
358  float width,
359  int draw_edges = 1,
360  int draw_fill = 1);
361 
362 
363 /*****************************************************************************/
371  /*l
372  *b Description:
373  **
374  ** Puts the OpenGL view matrix into a 2D orthogonal state so that
375  ** 2D primitives will be drawn in 2D view coordinates rather than in
376  ** 3D world coordinates.
377  **
378  ** This call *must* be balanced by a call to end_2d_text_mode(), or
379  ** overall drawing will be broken.
380  **
381  *b Callable From:
382  **
383  *- - C++
384  *- - Script
385  */
386  virtual void begin_2d_text_mode();
387 
388  /*l
389  *b Description:
390  **
391  ** Returns the OpenGL view matrix back into a 3D perspective state.
392  **
393  ** This call *must* be balanced by a call to begin_2d_text_mode(), or
394  ** overall drawing will be broken.
395  **
396  *b Callable From:
397  **
398  *- - C++
399  *- - Script
400  */
401  virtual void end_2d_text_mode();
402 
403  /*l
404  *b Description:
405  **
406  ** Draws the passed text string at view coordinates (x, y).
407  **
408  ** Should only be called inside of a begin_2d_text_mode() and
409  ** end_2d_text_mode() block.
410  **
411  ** The text is drawn with the current pen color.
412  **
413  *b Callable From:
414  **
415  *- - C++
416  *- - Script
417  */
418  virtual void draw_text(float screen_x, float screen_y, const char* text);
419 
420  /*l
421  *b Description:
422  **
423  ** Draws a 2D rectangle with the given points as the corners.
424  **
425  ** Should only be called inside of a begin_2d_text_mode() and
426  ** end_2d_text_mode() block.
427  **
428  ** The edges are drawn with the current pen color, the fill is
429  ** drawn with the current brush color.
430  **
431  *b Callable From:
432  **
433  *- - C++
434  *- - Script
435  */
436  virtual void draw_2d_rect(float x0,
437  float y0,
438  float x1,
439  float y1,
440  int draw_edges = 1,
441  int draw_fill = 1);
442 
443  /*
444  * Documentation Pending.
445  */
446  virtual void draw_private_path_shape(diguyCharacter* diguy_character,
447  int include_waypoints = 0);
448 
453 #ifdef CPLUSPLUS_ONLY
454 
455 protected:
456 
457  /*l
458  ** A protected constructor. Use the DI-Guy function
459  ** diguyApp:get_view_painter() to obtain a diguyViewPainter object
460  ** pointer.
461  */
463 
464 private:
465 
466 
467  friend class bdiScenarioApp;
468 
469 #endif
470 
471 };
472 
473 #endif /* __diguyViewPainter_H */
474