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