DI-Guy SDK Documentation  13.1
diguyViewFog.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2015 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************/
13 #ifndef __diguyViewFog_H
14 #define __diguyViewFog_H
15 
16 #ifdef SWIG
17 %module diguyViewFog
18 #else
19 #define CPLUSPLUS_ONLY
20 #endif
21 
22 #ifdef CPLUSPLUS_ONLY
23 class bdiFog;
24 class diguyViewFog;
26 
27 #include <stdio.h> // for NULL definition
28 #include <diguy_constants.h>
29 #include <diguy_typedefs.h>
30 
31 #endif
32 
33 
34 #include <declspec_diguy.h>
35 
36 /****************************************************************************/
37 class BDI_DECLSPEC_diguy diguyViewFog
38 {
39 
40 public:
41 
42 /*****************************************************************************/
52  /*l
53  *b Description:
54  **
55  ** Returns the name of the object. This pointer will
56  ** never be NULL.
57  **
58  *b Returns:
59  **
60  ** name of the object
61  */
62  const char* get_name();
63 
64  /*l
65  *b Description:
66  **
67  ** Returns the type name of the object. This pointer will
68  ** never be NULL.
69  **
70  *b Returns:
71  **
72  ** type name of the object
73  **
74  */
75  const char* get_type_name();
76 
77  /*l
78  *b Description:
79  **
80  ** This sets the density of the fog.
81  **
82  *b Arguments:
83  **
84  *a density - distance of this fog; higher causes more opaque fog
85  */
86  void set_density(float density);
87 
88  /*l
89  *b Returns:
90  **
91  ** density of fog
92  */
93  float get_density();
94 
95  /*l
96  *b Description:
97  **
98  ** This sets the distance at which fog begins to affect the scene.
99  ** Colors of objects before this distance will not be affected.
100  ** Colors of objects after this distance will start to be modulated
101  ** toward to fog color.
102  **
103  *b Arguments:
104  **
105  *a start - distance to where fog starts, in meters
106  */
107  void set_start(float start);
108 
109  /*l
110  *b Returns:
111  **
112  ** distance to where fog starts, in meters; see set_start()
113  */
114  float get_start();
115 
116  /*l
117  *b Description:
118  **
119  ** This sets the distance at which the fog completely overrides
120  ** the colors of objects in the scene.
121  **
122  *b Arguments:
123  **
124  *a end - distance to where fog ends, in meters
125  */
126  void set_end(float end);
127 
128  /*l
129  *b Returns:
130  **
131  ** distance to where fog ends, in meters; see set_end()
132  */
133  float get_end();
134 
135  /*l
136  *b Description:
137  **
138  ** This function sets the color of this fog.
139  **
140  *b Arguments:
141  **
142  *a r, g, b, a - red, green, blue, and alpha components
143  */
144  void set_color(float r, float g, float b, float a);
145 
146  /*l
147  *b Description:
148  **
149  ** This function gets the color of this fog.
150  ** Values are returned via the passed pointers.
151  **
152  *b Arguments:
153  **
154  *a r, g, b, a - red, green, blue, and alpha components
155  */
156  void get_color(float* r, float* g, float* b, float* a);
157 
158  /*l
159  *b Description:
160  **
161  ** This function sets the fog mode.
162  **
163  *b Arguments:
164  **
165  *a mode - new mode for fog calculations
166  **
167  *a DIGUY_FOG_MODE_DISABLED - fog is completely turned off
168  *a DIGUY_FOG_MODE_EXP - per-vertex exponential
169  *a DIGUY_FOG_MODE_EXP2 - per-vertex exponential style 2
170  *a DIGUY_FOG_MODE_LINEAR - per-vertex linear
171  **
172  *b Returns:
173  **
174  ** 0 on success, -1 on failure
175  */
176  void set_fog_mode(int mode);
177 
178  /*l
179  *b Returns:
180  **
181  ** the most recent setting made by set_fog_mode()
182  */
183  int get_fog_mode();
184 
185 
186 /*****************************************************************************/
196  /*l
197  *b Description:
198  **
199  ** Loads the specified settings into this fog.
200  **
201  *b Returns:
202  **
203  ** 0 on success, -1 on failure
204  */
205  int load_settings(const char* settings_name);
206 
207  /*l
208  *b Description:
209  **
210  ** Loads the specified settings into this fog.
211  **
212  *b Returns:
213  **
214  ** 0 on success, -1 on failure
215  */
216  int load_settings(diguyViewFogSettings* settings);
217 
218 
219 
220 /*****************************************************************************/
226  /*l
227  *b Description:
228  **
229  ** This is an enumeration of the different callbacks
230  ** that can be registered with add_callback() and
231  ** add_callback_script().
232  **
233  *b Usable From:
234  **
235  *- - C++
236  *- - Script
237  */
238  enum {
239  CALLBACK_ID_SETTINGS_CHANGED = 1
240  };
241 
242 #ifdef CPLUSPLUS_ONLY
243 
244  /*l
245  *b Description:
246  **
247  ** This function adds a user callback.
248  **
249  *b Arguments:
250  **
251  *a callback - pointer to function with prototype
252  *a diguyViewFogCallback (typedefed above)
253  *a callback_id - integer id of when this callback is to be called
254  *a callback_params - struct containing additional parameters
255  *a needed by some callbacks; actual type depends
256  *a on callback_id
257  *a callback_user_data - pointer for user's own use; DI-Guy will
258  *a do nothing to the contents of this pointer
259  *a beyond passing it back when the callback is
260  *a invoked
261  **
262  ** callback_id should be one of the following values:
263  **
264  *i CALLBACK_ID_SETTINGS_CHANGED
265  **
266  ** This callback will be called if the current settings of
267  ** this fog change
268  **
269  ** Callbacks return a value of type diguyCallbackReturn,
270  ** which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE.
271  ** If the callback returns DIGUY_CALLBACK_STOP, the default handler
272  ** of the function will not be called; the callback is asserting
273  ** that it has done everything necessary for the function call.
274  ** If the callback returns DIGUY_CALLBACK_CONTINUE, the default
275  ** handler for the function will be called after the callback.
276  **
277  *b Returns:
278  **
279  ** 0 on success, -1 on failure
280  **
281  *b Callable From:
282  **
283  *- - C++
284  */
285  int add_callback(int callback_id,
286  diguyViewFogCallback* callback,
287  void* callback_params = 0,
288  void* callback_user_data = 0);
289 
290  /*l
291  *b Description:
292  **
293  ** This function removes a user callback. All callbacks matching
294  ** the specified callback_id and callback function will be removed.
295  **
296  *b Arguments:
297  **
298  *a callback_id - integer id of when this callback is to be called
299  *a callback - pointer to function with prototype
300  *a diguyViewFogCallback (typedefed above)
301  **
302  *b Returns:
303  **
304  ** 0 on success, -1 on failure
305  **
306  *b Callable From:
307  **
308  *- - C++
309  */
310  int remove_callback(int callback_id,
311  diguyViewFogCallback* callback);
312 
313  /*l
314  *b Description:
315  **
316  ** This function removes a user callback. All callbacks matching
317  ** the specified callback_id and callback_user_data pointer will
318  ** be removed.
319  **
320  *b Arguments:
321  **
322  *a callback_id - integer id of when this callback is to be called
323  *a callback_user_data - pointer for user's own use
324  **
325  *b Returns:
326  **
327  ** 0 on success, -1 on failure
328  **
329  *b Callable From:
330  **
331  *- - C++
332  */
333  int remove_callback_with_user_data(int callback_id,
334  void* callback_user_data);
335 
336 #endif
337 
338  /*l
339  *b Description:
340  **
341  ** This function adds a user callback script. Callback scripts can
342  ** be removed with remove_callback_script().
343  **
344  *b Arguments:
345  **
346  *a callback_id - integer id of the callback
347  *a callback_script - script text of callback to be added
348  *a callback_script_type - the type of script contained in
349  *a callback_script
350  **
351  ** If NULL is passed for callback_script_type, a default script type
352  ** will be derived based on the default script interpreter of the
353  ** scenario.
354  **
355  *i lua specific:
356  **
357  ** When the script is called, the object for which it is being called
358  ** will be in the callback_object global.
359  **
360  ** To pass NULL when calling from a lua script, use nil.
361  **
362  *b Returns:
363  **
364  ** 0 on success, -1 on failure
365  **
366  *b Callable From:
367  **
368  *- - C++
369  *- - Script
370  */
371  int add_callback_script(int callback_id,
372  const char* callback_script,
373  const char* callback_script_type = NULL);
374 
375  /*l
376  *b Description:
377  **
378  ** This function removes a user callback script previously added with
379  ** add_callback_script().
380  **
381  *b Arguments:
382  **
383  *a callback_id - integer id of the callback
384  *a callback_script - script text of callback previously added
385  *a callback_script_type - the type of script contained in
386  *a callback_script
387  **
388  ** If NULL is passed for callback_script, all callback
389  ** scripts whose ids match callback_id and whose types match
390  ** callback_script_type will be removed.
391  **
392  ** If NULL is passed for callback_script_type, a default script type
393  ** will be derived based on the default script interpreter of the
394  ** scenario.
395  **
396  *i lua specific:
397  **
398  ** To pass NULL when calling from a lua script, use nil.
399  **
400  *b Returns:
401  **
402  ** 0 on success, -1 on failure
403  **
404  *b Callable From:
405  **
406  *- - C++
407  *- - Script
408  */
409  int remove_callback_script(int callback_id,
410  const char* callback_script,
411  const char* callback_script_type = NULL);
412 
417 #ifdef CPLUSPLUS_ONLY
418 
419  bdiFog* get_scripted_object() {return m_fog;}
420 
421 private:
422 
423  /*l
424  ** A private constructor.
425  */
426  diguyViewFog(bdiFog* fog);
427 
428  /*l
429  ** A pointer to internal data.
430  */
431  bdiFog* m_fog;
432 
433  friend class bdiFog;
434 
435 #endif
436 
437 };
438 
439 #endif /* __diguyViewFog_H */
440 
diguyCallbackReturn diguyViewFogCallback(diguyViewFog *fog, int callback_id, void *callback_params, void *callback_user_data)
Definition: diguy_typedefs.h:216
The diguyViewFogSettings class holds camera settings data that can be loaded into a diguyViewFog usin...
Definition: diguyViewFogSettings.h:43
Definition: diguyViewFog.h:35