C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyViewFog.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 /*********************************************************************/
33 #ifndef __diguyViewFog_H
34 #define __diguyViewFog_H
35 
36 #ifdef SWIG
37 %module diguyViewFog
38 #else
39 #define CPLUSPLUS_ONLY
40 #endif
41 
42 #ifdef CPLUSPLUS_ONLY
43 class bdiFog;
44 class diguyViewFog;
46 
47 #include <stdio.h> // for NULL definition
48 #include <diguy_constants.h>
49 #include <diguy_typedefs.h>
50 
51 #endif
52 
53 
54 #include <declspec_diguy.h>
55 
56 /****************************************************************************/
57 class BDI_DECLSPEC_diguy diguyViewFog
58 {
59 
60 public:
61 
62 /*****************************************************************************/
68  /*l
69  *b Description:
70  **
71  ** Returns the name of the object. This pointer will
72  ** never be NULL.
73  **
74  *b Returns:
75  **
76  ** name of the object
77  **
78  *b Callable From:
79  **
80  *- - C++
81  *- - Script
82  */
83  const char* get_name();
84 
85  /*l
86  *b Description:
87  **
88  ** Returns the type name of the object. This pointer will
89  ** never be NULL.
90  **
91  *b Returns:
92  **
93  ** type name of the object
94  **
95  *b Callable From:
96  **
97  *- - C++
98  *- - Script
99  */
100  const char* get_type_name();
101 
102  /*l
103  *b Description:
104  **
105  ** This sets the density of the fog.
106  **
107  *b Arguments:
108  **
109  *a density - distance of this fog; higher causes more opaque fog
110  **
111  *b Callable From:
112  **
113  *- - C++
114  *- - Script
115  */
116  void set_density(float density);
117 
118  /*l
119  *b Returns:
120  **
121  ** density of fog
122  **
123  *b Callable From:
124  **
125  *- - C++
126  *- - Script
127  */
128  float get_density();
129 
130  /*l
131  *b Description:
132  **
133  ** This sets the distance at which fog begins to affect the scene.
134  ** Colors of objects before this distance will not be affected.
135  ** Colors of objects after this distance will start to be modulated
136  ** toward to fog color.
137  **
138  *b Arguments:
139  **
140  *a start - distance to where fog starts, in meters
141  **
142  *b Callable From:
143  **
144  *- - C++
145  *- - Script
146  */
147  void set_start(float start);
148 
149  /*l
150  *b Returns:
151  **
152  ** distance to where fog starts, in meters; see set_start()
153  **
154  *b Callable From:
155  **
156  *- - C++
157  *- - Script
158  */
159  float get_start();
160 
161  /*l
162  *b Description:
163  **
164  ** This sets the distance at which the fog completely overrides
165  ** the colors of objects in the scene.
166  **
167  *b Arguments:
168  **
169  *a end - distance to where fog ends, in meters
170  **
171  *b Callable From:
172  **
173  *- - C++
174  *- - Script
175  */
176  void set_end(float end);
177 
178  /*l
179  *b Returns:
180  **
181  ** distance to where fog ends, in meters; see set_end()
182  **
183  *b Callable From:
184  **
185  *- - C++
186  *- - Script
187  */
188  float get_end();
189 
190  /*l
191  *b Description:
192  **
193  ** This function sets the color of this fog.
194  **
195  *b Arguments:
196  **
197  *a r - red component
198  *a g - blue component
199  *a b - green component
200  *a a - alpha component
201  **
202  *b Callable From:
203  **
204  *- - C++
205  *- - Script
206  */
207  void set_color(float r, float g, float b, float a);
208 
209  /*l
210  *b Description:
211  **
212  ** This function gets the color of this fog.
213  ** Values are returned via the passed pointers.
214  **
215  *b Arguments:
216  **
217  *a r - red component
218  *a g - blue component
219  *a b - green component
220  *a a - alpha component
221  **
222  *b Callable From:
223  **
224  *- - C++
225  *- - Script
226  */
227  void get_color(float* r, float* g, float* b, float* a);
228 
229  /*l
230  *b Description:
231  **
232  ** This function sets the fog mode.
233  **
234  *b Arguments:
235  **
236  *a mode - new mode for fog calculations
237  **
238  *a DIGUY_FOG_MODE_DISABLED - fog is completely turned off
239  *a DIGUY_FOG_MODE_EXP - per-vertex exponential
240  *a DIGUY_FOG_MODE_EXP2 - per-vertex exponential style 2
241  *a DIGUY_FOG_MODE_LINEAR - per-vertex linear
242  **
243  *b Returns:
244  **
245  ** 0 on success, -1 on failure
246  **
247  *b Callable From:
248  **
249  *- - C++
250  *- - Script
251  */
252  void set_fog_mode(int mode);
253 
254  /*l
255  *b Returns:
256  **
257  ** the most recent setting made by set_fog_mode()
258  **
259  *b Callable From:
260  **
261  *- - C++
262  *- - Script
263  */
264  int get_fog_mode();
265 
266 
267 /*****************************************************************************/
273  /*l
274  *b Description:
275  **
276  ** Loads the specified settings into this fog.
277  **
278  *b Returns:
279  **
280  ** 0 on success, -1 on failure
281  **
282  *b Callable From:
283  **
284  *- - C++
285  *- - Script
286  */
287  int load_settings(const char* settings_name);
288 
289 #ifdef CPLUSPLUS_ONLY
290 
291  /*l
292  *b Description:
293  **
294  ** Loads the specified settings into this fog.
295  **
296  *b Returns:
297  **
298  ** 0 on success, -1 on failure
299  **
300  *b Callable From:
301  **
302  *- - C++
303  *- - Script
304  */
305  int load_settings(diguyViewFogSettings* settings);
306 
307 #endif
308 
309 
310 /*****************************************************************************/
316  /*l
317  *b Description:
318  **
319  ** This is an enumeration of the different callbacks
320  ** that can be registered with add_callback() and
321  ** add_callback_script().
322  **
323  *b Usable From:
324  **
325  *- - C++
326  *- - Script
327  */
328  enum {
329  CALLBACK_ID_SETTINGS_CHANGED = 1
330  };
331 
332 #ifdef CPLUSPLUS_ONLY
333 
334  /*l
335  *b Description:
336  **
337  ** This function adds a user callback.
338  **
339  *b Arguments:
340  **
341  *a callback - pointer to function with prototype
342  *a diguyViewFogCallback (typedefed above)
343  *a callback_id - integer id of when this callback is to be called
344  *a callback_params - struct containing additional parameters
345  *a needed by some callbacks; actual type depends
346  *a on callback_id
347  *a callback_user_data - pointer for user's own use; DI-Guy will
348  *a do nothing to the contents of this pointer
349  *a beyond passing it back when the callback is
350  *a invoked
351  **
352  ** callback_id should be one of the following values:
353  **
354  *i CALLBACK_ID_SETTINGS_CHANGED
355  **
356  ** This callback will be called if the current settings of
357  ** this fog change
358  **
359  ** Callbacks return a value of type diguyCallbackReturn,
360  ** which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE.
361  ** If the callback returns DIGUY_CALLBACK_STOP, the default handler
362  ** of the function will not be called; the callback is asserting
363  ** that it has done everything necessary for the function call.
364  ** If the callback returns DIGUY_CALLBACK_CONTINUE, the default
365  ** handler for the function will be called after the callback.
366  **
367  *b Returns:
368  **
369  ** 0 on success, -1 on failure
370  **
371  *b Callable From:
372  **
373  *- - C++
374  */
375  int add_callback(int callback_id,
376  diguyViewFogCallback* callback,
377  void* callback_params = 0,
378  void* callback_user_data = 0);
379 
380  /*l
381  *b Description:
382  **
383  ** This function removes a user callback. All callbacks matching
384  ** the specified callback_id and callback function will be removed.
385  **
386  *b Arguments:
387  **
388  *a callback_id - integer id of when this callback is to be called
389  *a callback - pointer to function with prototype
390  *a diguyViewFogCallback (typedefed above)
391  **
392  *b Returns:
393  **
394  ** 0 on success, -1 on failure
395  **
396  *b Callable From:
397  **
398  *- - C++
399  */
400  int remove_callback(int callback_id,
401  diguyViewFogCallback* callback);
402 
403  /*l
404  *b Description:
405  **
406  ** This function removes a user callback. All callbacks matching
407  ** the specified callback_id and callback_user_data pointer will
408  ** be removed.
409  **
410  *b Arguments:
411  **
412  *a callback_id - integer id of when this callback is to be called
413  *a callback_user_data - pointer for user's own use
414  **
415  *b Returns:
416  **
417  ** 0 on success, -1 on failure
418  **
419  *b Callable From:
420  **
421  *- - C++
422  */
423  int remove_callback_with_user_data(int callback_id,
424  void* callback_user_data);
425 
426 #endif
427 
428  /*l
429  *b Description:
430  **
431  ** This function adds a user callback script. Callback scripts can
432  ** be removed with remove_callback_script().
433  **
434  *b Arguments:
435  **
436  *a callback_id - integer id of the callback
437  *a callback_script - script text of callback to be added
438  *a callback_script_type - the type of script contained in
439  *a callback_script
440  **
441  ** If NULL is passed for callback_script_type, a default script type
442  ** will be derived based on the default script interpreter of the
443  ** scenario.
444  **
445  *i lua specific:
446  **
447  ** When the script is called, the object for which it is being called
448  ** will be in the callback_object global.
449  **
450  ** To pass NULL when calling from a lua script, use nil.
451  **
452  *b Returns:
453  **
454  ** 0 on success, -1 on failure
455  **
456  *b Callable From:
457  **
458  *- - C++
459  *- - Script
460  */
461  int add_callback_script(int callback_id,
462  const char* callback_script,
463  const char* callback_script_type = NULL);
464 
465  /*l
466  *b Description:
467  **
468  ** This function removes a user callback script previously added with
469  ** add_callback_script().
470  **
471  *b Arguments:
472  **
473  *a callback_id - integer id of the callback
474  *a callback_script - script text of callback previously added
475  *a callback_script_type - the type of script contained in
476  *a callback_script
477  **
478  ** If NULL is passed for callback_script, all callback
479  ** scripts whose ids match callback_id and whose types match
480  ** callback_script_type will be removed.
481  **
482  ** If NULL is passed for callback_script_type, a default script type
483  ** will be derived based on the default script interpreter of the
484  ** scenario.
485  **
486  *i lua specific:
487  **
488  ** To pass NULL when calling from a lua script, use nil.
489  **
490  *b Returns:
491  **
492  ** 0 on success, -1 on failure
493  **
494  *b Callable From:
495  **
496  *- - C++
497  *- - Script
498  */
499  int remove_callback_script(int callback_id,
500  const char* callback_script,
501  const char* callback_script_type = NULL);
507 #ifdef CPLUSPLUS_ONLY
508 
509  bdiFog* get_scripted_object() {return m_fog;}
510 
511 private:
512 
513  /*l
514  ** A private constructor.
515  */
516  diguyViewFog(bdiFog* fog);
517 
518  /*l
519  ** A pointer to internal data.
520  */
521  bdiFog* m_fog;
522 
523  friend class bdiFog;
524 
525 #endif
526 
527 };
528 
529 #endif /* __diguyViewFog_H */
530