DI-Guy SDK Documentation  13.5
diguyViewFog.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2020 MAK Technologies, Inc.
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() const;
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() const;
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() const;
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) const;
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() const;
184 
186  void apply();
187 
188 /*****************************************************************************/
198  /*l
199  *b Description:
200  **
201  ** Loads the specified settings into this fog.
202  **
203  *b Returns:
204  **
205  ** 0 on success, -1 on failure
206  */
207  int load_settings(const char* settings_name);
208 
209  /*l
210  *b Description:
211  **
212  ** Loads the specified settings into this fog.
213  **
214  *b Returns:
215  **
216  ** 0 on success, -1 on failure
217  */
218  int load_settings(diguyViewFogSettings* settings);
219 
220 
221 
222 /*****************************************************************************/
228  /*l
229  *b Description:
230  **
231  ** This is an enumeration of the different callbacks
232  ** that can be registered with add_callback() and
233  ** add_callback_script().
234  **
235  *b Usable From:
236  **
237  *- - C++
238  *- - Script
239  */
240  enum {
241  CALLBACK_ID_SETTINGS_CHANGED = 1
242  };
243 
244 #ifdef CPLUSPLUS_ONLY
245 
246  /*l
247  *b Description:
248  **
249  ** This function adds a user callback.
250  **
251  *b Arguments:
252  **
253  *a callback - pointer to function with prototype
254  *a diguyViewFogCallback (typedefed above)
255  *a callback_id - integer id of when this callback is to be called
256  *a callback_params - struct containing additional parameters
257  *a needed by some callbacks; actual type depends
258  *a on callback_id
259  *a callback_user_data - pointer for user's own use; DI-Guy will
260  *a do nothing to the contents of this pointer
261  *a beyond passing it back when the callback is
262  *a invoked
263  **
264  ** callback_id should be one of the following values:
265  **
266  *i CALLBACK_ID_SETTINGS_CHANGED
267  **
268  ** This callback will be called if the current settings of
269  ** this fog change
270  **
271  ** Callbacks return a value of type diguyCallbackReturn,
272  ** which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE.
273  ** If the callback returns DIGUY_CALLBACK_STOP, the default handler
274  ** of the function will not be called; the callback is asserting
275  ** that it has done everything necessary for the function call.
276  ** If the callback returns DIGUY_CALLBACK_CONTINUE, the default
277  ** handler for the function will be called after the callback.
278  **
279  *b Returns:
280  **
281  ** 0 on success, -1 on failure
282  **
283  *b Callable From:
284  **
285  *- - C++
286  */
287  int add_callback(int callback_id,
288  diguyViewFogCallback* callback,
289  void* callback_params = 0,
290  void* callback_user_data = 0);
291 
292  /*l
293  *b Description:
294  **
295  ** This function removes a user callback. All callbacks matching
296  ** the specified callback_id and callback function will be removed.
297  **
298  *b Arguments:
299  **
300  *a callback_id - integer id of when this callback is to be called
301  *a callback - pointer to function with prototype
302  *a diguyViewFogCallback (typedefed above)
303  **
304  *b Returns:
305  **
306  ** 0 on success, -1 on failure
307  **
308  *b Callable From:
309  **
310  *- - C++
311  */
312  int remove_callback(int callback_id,
313  diguyViewFogCallback* callback);
314 
315  /*l
316  *b Description:
317  **
318  ** This function removes a user callback. All callbacks matching
319  ** the specified callback_id and callback_user_data pointer will
320  ** be removed.
321  **
322  *b Arguments:
323  **
324  *a callback_id - integer id of when this callback is to be called
325  *a callback_user_data - pointer for user's own use
326  **
327  *b Returns:
328  **
329  ** 0 on success, -1 on failure
330  **
331  *b Callable From:
332  **
333  *- - C++
334  */
335  int remove_callback_with_user_data(int callback_id,
336  void* callback_user_data);
337 
338 #endif
339 
340  /*l
341  *b Description:
342  **
343  ** This function adds a user callback script. Callback scripts can
344  ** be removed with remove_callback_script().
345  **
346  *b Arguments:
347  **
348  *a callback_id - integer id of the callback
349  *a callback_script - script text of callback to be added
350  *a callback_script_type - the type of script contained in
351  *a callback_script
352  **
353  ** If NULL is passed for callback_script_type, a default script type
354  ** will be derived based on the default script interpreter of the
355  ** scenario.
356  **
357  *i lua specific:
358  **
359  ** When the script is called, the object for which it is being called
360  ** will be in the callback_object global.
361  **
362  ** To pass NULL when calling from a lua script, use nil.
363  **
364  *b Returns:
365  **
366  ** 0 on success, -1 on failure
367  **
368  *b Callable From:
369  **
370  *- - C++
371  *- - Script
372  */
373  int add_callback_script(int callback_id,
374  const char* callback_script,
375  const char* callback_script_type = NULL);
376 
377  /*l
378  *b Description:
379  **
380  ** This function removes a user callback script previously added with
381  ** add_callback_script().
382  **
383  *b Arguments:
384  **
385  *a callback_id - integer id of the callback
386  *a callback_script - script text of callback previously added
387  *a callback_script_type - the type of script contained in
388  *a callback_script
389  **
390  ** If NULL is passed for callback_script, all callback
391  ** scripts whose ids match callback_id and whose types match
392  ** callback_script_type will be removed.
393  **
394  ** If NULL is passed for callback_script_type, a default script type
395  ** will be derived based on the default script interpreter of the
396  ** scenario.
397  **
398  *i lua specific:
399  **
400  ** To pass NULL when calling from a lua script, use nil.
401  **
402  *b Returns:
403  **
404  ** 0 on success, -1 on failure
405  **
406  *b Callable From:
407  **
408  *- - C++
409  *- - Script
410  */
411  int remove_callback_script(int callback_id,
412  const char* callback_script,
413  const char* callback_script_type = NULL);
414 
419 #ifdef CPLUSPLUS_ONLY
420 
421  bdiFog* get_scripted_object() {return m_fog;}
422 
423 private:
424 
425  /*l
426  ** A private constructor.
427  */
428  diguyViewFog(bdiFog* fog);
429 
430  /*l
431  ** A pointer to internal data.
432  */
433  bdiFog* m_fog;
434 
435  friend class bdiFog;
436 
437 #endif
438 
439 };
440 
441 #endif /* __diguyViewFog_H */
442 
diguyCallbackReturn diguyViewFogCallback(diguyViewFog *fog, int callback_id, void *callback_params, void *callback_user_data)
Definition: diguy_typedefs.h:217
The diguyViewFogSettings class holds camera settings data that can be loaded into a diguyViewFog usin...
Definition: diguyViewFogSettings.h:43
Definition: diguyViewFog.h:35