![]() |
DI-Guy SDK Documentation
13.6
|
Describes basic fog model that is used by DI-Guy Scenario and our default ogl renderer Most users will want to implement their own fog system. More...
#include <diguyViewFog.h>
Public Member Functions | |
General Functions | |
All functions in this section are callable from:
| |
| const char * | get_name () |
| Returns the name of the object. More... | |
| const char * | get_type_name () |
| Returns the type name of the object. More... | |
| void | set_density (float density) |
| This sets the density of the fog. More... | |
| float | get_density () const |
| Returns: density of fog. More... | |
| void | set_start (float start) |
| This sets the distance at which fog begins to affect the scene. More... | |
| float | get_start () const |
| Returns: distance to where fog starts, in meters; see set_start() More... | |
| void | set_end (float end) |
| This sets the distance at which the fog completely overrides the colors of objects in the scene. More... | |
| float | get_end () const |
| Returns: distance to where fog ends, in meters; see set_end() More... | |
| void | set_color (float r, float g, float b, float a) |
| This function sets the color of this fog. More... | |
| void | get_color (float *r, float *g, float *b, float *a) const |
| This function gets the color of this fog. More... | |
| void | set_fog_mode (int mode) |
| This function sets the fog mode. More... | |
| int | get_fog_mode () const |
| Returns: the most recent setting made by set_fog_mode() More... | |
| void | apply () |
| Sends the values to the video card shaders. More... | |
Load and Apply Functions | |
All functions in this section are callable from:
| |
| int | load_settings (const char *settings_name) |
| Loads the specified settings into this fog. More... | |
| int | load_settings (diguyViewFogSettings *settings) |
| Loads the specified settings into this fog. More... | |
Callback Functions | |
| enum | { CALLBACK_ID_SETTINGS_CHANGED = 1 } |
| This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script(). More... | |
| int | add_callback (int callback_id, diguyViewFogCallback *callback, void *callback_params=0, void *callback_user_data=0) |
| This function adds a user callback. More... | |
| int | remove_callback (int callback_id, diguyViewFogCallback *callback) |
| This function removes a user callback. More... | |
| int | remove_callback_with_user_data (int callback_id, void *callback_user_data) |
| This function removes a user callback. More... | |
| int | add_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| This function adds a user callback script. More... | |
| int | remove_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| This function removes a user callback script previously added with add_callback_script(). More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiFog * | m_fog |
| A pointer to internal data. More... | |
| class | bdiFog |
| bdiFog * | get_scripted_object () |
| diguyViewFog (bdiFog *fog) | |
| A private constructor. More... | |
Describes basic fog model that is used by DI-Guy Scenario and our default ogl renderer Most users will want to implement their own fog system.
| anonymous enum |
This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script().
Usable From:
| Enumerator | |
|---|---|
| CALLBACK_ID_SETTINGS_CHANGED | |
|
private |
A private constructor.
| const char* diguyViewFog::get_name | ( | ) |
Returns the name of the object.
This pointer will never be NULL.
Returns:
name of the object
| const char* diguyViewFog::get_type_name | ( | ) |
Returns the type name of the object.
This pointer will never be NULL.
Returns:
type name of the object
| void diguyViewFog::set_density | ( | float | density | ) |
This sets the density of the fog.
| density | distance of this fog; higher causes more opaque fog |
| float diguyViewFog::get_density | ( | ) | const |
Returns: density of fog.
| void diguyViewFog::set_start | ( | float | start | ) |
This sets the distance at which fog begins to affect the scene.
Colors of objects before this distance will not be affected. Colors of objects after this distance will start to be modulated toward to fog color.
| start | distance to where fog starts, in meters |
| float diguyViewFog::get_start | ( | ) | const |
Returns: distance to where fog starts, in meters; see set_start()
| void diguyViewFog::set_end | ( | float | end | ) |
This sets the distance at which the fog completely overrides the colors of objects in the scene.
| end | distance to where fog ends, in meters |
| float diguyViewFog::get_end | ( | ) | const |
Returns: distance to where fog ends, in meters; see set_end()
| void diguyViewFog::set_color | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a | ||
| ) |
This function sets the color of this fog.
| r,g,b,a | red, green, blue, and alpha components |
| void diguyViewFog::get_color | ( | float * | r, |
| float * | g, | ||
| float * | b, | ||
| float * | a | ||
| ) | const |
This function gets the color of this fog.
Values are returned via the passed pointers.
| r,g,b,a | red, green, blue, and alpha components |
| void diguyViewFog::set_fog_mode | ( | int | mode | ) |
This function sets the fog mode.
| mode | new mode for fog calculations |
| DIGUY_FOG_MODE_DISABLED | fog is completely turned off |
| DIGUY_FOG_MODE_EXP | per-vertex exponential |
| DIGUY_FOG_MODE_EXP2 | per-vertex exponential style 2 |
| DIGUY_FOG_MODE_LINEAR | per-vertex linear |
Returns:
0 on success, -1 on failure
| int diguyViewFog::get_fog_mode | ( | ) | const |
Returns: the most recent setting made by set_fog_mode()
| void diguyViewFog::apply | ( | ) |
Sends the values to the video card shaders.
| int diguyViewFog::load_settings | ( | const char * | settings_name | ) |
Loads the specified settings into this fog.
Returns:
0 on success, -1 on failure
| int diguyViewFog::load_settings | ( | diguyViewFogSettings * | settings | ) |
Loads the specified settings into this fog.
Returns:
0 on success, -1 on failure
| int diguyViewFog::add_callback | ( | int | callback_id, |
| diguyViewFogCallback * | callback, | ||
| void * | callback_params = 0, |
||
| void * | callback_user_data = 0 |
||
| ) |
This function adds a user callback.
| callback | pointer to function with prototype diguyViewFogCallback (typedefed above) |
| callback_id | integer id of when this callback is to be called |
| callback_params | struct containing additional parameters needed by some callbacks; actual type depends on callback_id |
| callback_user_data | pointer for user's own use; DI-Guy will do nothing to the contents of this pointer beyond passing it back when the callback is invoked |
callback_id should be one of the following values:
CALLBACK_ID_SETTINGS_CHANGED
This callback will be called if the current settings of this fog change
Callbacks return a value of type diguyCallbackReturn, which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the callback returns DIGUY_CALLBACK_STOP, the default handler of the function will not be called; the callback is asserting that it has done everything necessary for the function call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default handler for the function will be called after the callback.
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewFog::remove_callback | ( | int | callback_id, |
| diguyViewFogCallback * | callback | ||
| ) |
This function removes a user callback.
All callbacks matching the specified callback_id and callback function will be removed.
| callback_id | integer id of when this callback is to be called |
| callback | pointer to function with prototype diguyViewFogCallback (typedefed above) |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewFog::remove_callback_with_user_data | ( | int | callback_id, |
| void * | callback_user_data | ||
| ) |
This function removes a user callback.
All callbacks matching the specified callback_id and callback_user_data pointer will be removed.
| callback_id | integer id of when this callback is to be called |
| callback_user_data | pointer for user's own use |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewFog::add_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
This function adds a user callback script.
Callback scripts can be removed with remove_callback_script().
| callback_id | integer id of the callback |
| callback_script | script text of callback to be added |
| callback_script_type | the type of script contained in callback_script |
If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.
lua specific:
When the script is called, the object for which it is being called will be in the callback_object global.
To pass NULL when calling from a lua script, use nil.
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewFog::remove_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
This function removes a user callback script previously added with add_callback_script().
| callback_id | integer id of the callback |
| callback_script | script text of callback previously added |
| callback_script_type | the type of script contained in callback_script |
If NULL is passed for callback_script, all callback scripts whose ids match callback_id and whose types match callback_script_type will be removed.
If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.
lua specific:
To pass NULL when calling from a lua script, use nil.
Returns:
0 on success, -1 on failure
Callable From:
|
inline |
|
friend |
|
private |
A pointer to internal data.