DI-Guy C++ SDK Reference  13.0
 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-2014 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 - red component
143  *a g - blue component
144  *a b - green component
145  *a a - alpha component
146  */
147  void set_color(float r, float g, float b, float a);
148 
149  /*l
150  *b Description:
151  **
152  ** This function gets the color of this fog.
153  ** Values are returned via the passed pointers.
154  **
155  *b Arguments:
156  **
157  *a r - red component
158  *a g - blue component
159  *a b - green component
160  *a a - alpha component
161  */
162  void get_color(float* r, float* g, float* b, float* a);
163 
164  /*l
165  *b Description:
166  **
167  ** This function sets the fog mode.
168  **
169  *b Arguments:
170  **
171  *a mode - new mode for fog calculations
172  **
173  *a DIGUY_FOG_MODE_DISABLED - fog is completely turned off
174  *a DIGUY_FOG_MODE_EXP - per-vertex exponential
175  *a DIGUY_FOG_MODE_EXP2 - per-vertex exponential style 2
176  *a DIGUY_FOG_MODE_LINEAR - per-vertex linear
177  **
178  *b Returns:
179  **
180  ** 0 on success, -1 on failure
181  */
182  void set_fog_mode(int mode);
183 
184  /*l
185  *b Returns:
186  **
187  ** the most recent setting made by set_fog_mode()
188  */
189  int get_fog_mode();
190 
191 
192 /*****************************************************************************/
202  /*l
203  *b Description:
204  **
205  ** Loads the specified settings into this fog.
206  **
207  *b Returns:
208  **
209  ** 0 on success, -1 on failure
210  */
211  int load_settings(const char* settings_name);
212 
213  /*l
214  *b Description:
215  **
216  ** Loads the specified settings into this fog.
217  **
218  *b Returns:
219  **
220  ** 0 on success, -1 on failure
221  */
222  int load_settings(diguyViewFogSettings* settings);
223 
224 
225 
226 /*****************************************************************************/
232  /*l
233  *b Description:
234  **
235  ** This is an enumeration of the different callbacks
236  ** that can be registered with add_callback() and
237  ** add_callback_script().
238  **
239  *b Usable From:
240  **
241  *- - C++
242  *- - Script
243  */
244  enum {
245  CALLBACK_ID_SETTINGS_CHANGED = 1
246  };
247 
248 #ifdef CPLUSPLUS_ONLY
249 
250  /*l
251  *b Description:
252  **
253  ** This function adds a user callback.
254  **
255  *b Arguments:
256  **
257  *a callback - pointer to function with prototype
258  *a diguyViewFogCallback (typedefed above)
259  *a callback_id - integer id of when this callback is to be called
260  *a callback_params - struct containing additional parameters
261  *a needed by some callbacks; actual type depends
262  *a on callback_id
263  *a callback_user_data - pointer for user's own use; DI-Guy will
264  *a do nothing to the contents of this pointer
265  *a beyond passing it back when the callback is
266  *a invoked
267  **
268  ** callback_id should be one of the following values:
269  **
270  *i CALLBACK_ID_SETTINGS_CHANGED
271  **
272  ** This callback will be called if the current settings of
273  ** this fog change
274  **
275  ** Callbacks return a value of type diguyCallbackReturn,
276  ** which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE.
277  ** If the callback returns DIGUY_CALLBACK_STOP, the default handler
278  ** of the function will not be called; the callback is asserting
279  ** that it has done everything necessary for the function call.
280  ** If the callback returns DIGUY_CALLBACK_CONTINUE, the default
281  ** handler for the function will be called after the callback.
282  **
283  *b Returns:
284  **
285  ** 0 on success, -1 on failure
286  **
287  *b Callable From:
288  **
289  *- - C++
290  */
291  int add_callback(int callback_id,
292  diguyViewFogCallback* callback,
293  void* callback_params = 0,
294  void* callback_user_data = 0);
295 
296  /*l
297  *b Description:
298  **
299  ** This function removes a user callback. All callbacks matching
300  ** the specified callback_id and callback function will be removed.
301  **
302  *b Arguments:
303  **
304  *a callback_id - integer id of when this callback is to be called
305  *a callback - pointer to function with prototype
306  *a diguyViewFogCallback (typedefed above)
307  **
308  *b Returns:
309  **
310  ** 0 on success, -1 on failure
311  **
312  *b Callable From:
313  **
314  *- - C++
315  */
316  int remove_callback(int callback_id,
317  diguyViewFogCallback* callback);
318 
319  /*l
320  *b Description:
321  **
322  ** This function removes a user callback. All callbacks matching
323  ** the specified callback_id and callback_user_data pointer will
324  ** be removed.
325  **
326  *b Arguments:
327  **
328  *a callback_id - integer id of when this callback is to be called
329  *a callback_user_data - pointer for user's own use
330  **
331  *b Returns:
332  **
333  ** 0 on success, -1 on failure
334  **
335  *b Callable From:
336  **
337  *- - C++
338  */
339  int remove_callback_with_user_data(int callback_id,
340  void* callback_user_data);
341 
342 #endif
343 
344  /*l
345  *b Description:
346  **
347  ** This function adds a user callback script. Callback scripts can
348  ** be removed with remove_callback_script().
349  **
350  *b Arguments:
351  **
352  *a callback_id - integer id of the callback
353  *a callback_script - script text of callback to be added
354  *a callback_script_type - the type of script contained in
355  *a callback_script
356  **
357  ** If NULL is passed for callback_script_type, a default script type
358  ** will be derived based on the default script interpreter of the
359  ** scenario.
360  **
361  *i lua specific:
362  **
363  ** When the script is called, the object for which it is being called
364  ** will be in the callback_object global.
365  **
366  ** To pass NULL when calling from a lua script, use nil.
367  **
368  *b Returns:
369  **
370  ** 0 on success, -1 on failure
371  **
372  *b Callable From:
373  **
374  *- - C++
375  *- - Script
376  */
377  int add_callback_script(int callback_id,
378  const char* callback_script,
379  const char* callback_script_type = NULL);
380 
381  /*l
382  *b Description:
383  **
384  ** This function removes a user callback script previously added with
385  ** add_callback_script().
386  **
387  *b Arguments:
388  **
389  *a callback_id - integer id of the callback
390  *a callback_script - script text of callback previously added
391  *a callback_script_type - the type of script contained in
392  *a callback_script
393  **
394  ** If NULL is passed for callback_script, all callback
395  ** scripts whose ids match callback_id and whose types match
396  ** callback_script_type will be removed.
397  **
398  ** If NULL is passed for callback_script_type, a default script type
399  ** will be derived based on the default script interpreter of the
400  ** scenario.
401  **
402  *i lua specific:
403  **
404  ** To pass NULL when calling from a lua script, use nil.
405  **
406  *b Returns:
407  **
408  ** 0 on success, -1 on failure
409  **
410  *b Callable From:
411  **
412  *- - C++
413  *- - Script
414  */
415  int remove_callback_script(int callback_id,
416  const char* callback_script,
417  const char* callback_script_type = NULL);
418 
423 #ifdef CPLUSPLUS_ONLY
424 
425  bdiFog* get_scripted_object() {return m_fog;}
426 
427 private:
428 
429  /*l
430  ** A private constructor.
431  */
432  diguyViewFog(bdiFog* fog);
433 
434  /*l
435  ** A pointer to internal data.
436  */
437  bdiFog* m_fog;
438 
439  friend class bdiFog;
440 
441 #endif
442 
443 };
444 
445 #endif /* __diguyViewFog_H */
446