![]() |
DI-Guy SDK Documentation
13.1
|
#include <diguy_api.h>#include <bdigraphics/graphics_init_ogl.h>#include <declspec_diguy_graphics.h>Go to the source code of this file.
Functions | |
| int | diguy_ogl_initialize (bdiGraphicsInitOgl *init) |
| This function initializes the DI-Guy Runtime API for the OpenGL environment. More... | |
| int | diguy_ogl_get_defaults (bdiGraphicsInitOgl *init) |
| Fills out the init structure with default values. More... | |
| int | diguy_default_fire_weapon_intersection_function (diguyImpact *impact, float from_x, float from_y, float from_z, float to_x, float to_y, float to_z, diguyScenario *scenario) |
| This function is the default fire intersection function. More... | |
Experimental Functions | |
The following functions are experimental and may change or disappear with no warning. | |
| int | diguy_ogl_generate_character_texture_list (diguyScenario *scenario, int character_index) |
| This function queries the character for the OpenGL texture objects it is using and stores them in an internal list. More... | |
| int | diguy_ogl_release_character_texture_list (diguyScenario *scenario, int character_index) |
| This function releases a texture list generated by diguy_ogl_generate_character_texture_list(). More... | |
| int | diguy_ogl_get_character_texture_list_num_textures (diguyScenario *scenario, int character_index) |
| This function returns the number of textures used by the specified character. More... | |
| GLuint | diguy_ogl_get_character_texture_list_texture_object_at_index (diguyScenario *scenario, int character_index, int texture_list_index) |
| This function returns the OpenGL texture object at the specified index. More... | |
| const char * | diguy_ogl_get_character_texture_list_texture_filename_at_index (diguyScenario *scenario, int character_index, int texture_list_index) |
| This function returns the filename of the texture at the specified index. More... | |
| int | diguy_ogl_set_character_texture_objects_modified (diguyScenario *scenario, int character_index) |
| This function notifies the character that its texture objects have been modified and that it should take any steps necessary to update its internal state to ensure proper display. More... | |
| int | diguy_ogl_get_texture_unit () |
| This function returns the texture unit that DI-Guy is currently set to use. More... | |
| int | diguy_ogl_set_texture_unit (int texture_unit) |
| This function sets the texture unit that DI-Guy should use. More... | |
| void | diguy_ogl_set_use_far_positions (int val) |
| This function turns far position rendering on or off. More... | |
| int | diguy_ogl_get_use_far_positions () |
| Returns: 1 if far positions are in use, else 0. More... | |
| void | diguy_ogl_set_default_shader_source_files (const char *shader_name, const char *vert_filename, const char *pixel_filename) |
| This function sets the shader source files that will be used for the specified shader. More... | |
| int | diguy_ogl_render_shadow_map (unsigned int texture_unit, diguyViewLight *light, diguyScenario *scenario, float pos_above_terrain) |
| Renders a shadow pass of the world and binds into the target texture unit. More... | |
| int | diguy_ogl_apply_active_lights (diguyScenario *scenario) |
| Applies active lights to the OpenGL state, also updates default shader uniforms and calls diguyScenario::set_num_active_point_lights() More... | |
| void | diguy_ogl_draw_aim_trajectories (diguyScenario *scenario, diguyView *view) |
| helper function not really for end users More... | |
Experimental Heads-Up Display Functions | |
The following functions are experimental and may change or disappear with no warning. | |
| int | diguy_ogl_2d_set_color (float r, float g, float b, float a) |
| int | diguy_ogl_2d_draw_filled_rect (int x0, int y0, int x1, int y1) |
| int | diguy_ogl_2d_draw_text (int x, int y, const char *text) |
| int | diguy_ogl_2d_get_text_width (const char *text) |
| int | diguy_ogl_2d_get_text_height (const char *text) |
| int | diguy_ogl_get_fbo_texture_id () |
| int | diguy_ogl_reload_changed_textures () |
Experimental frame stats API | |
Currently available stats:
| |
| int | diguy_ogl_get_num_frame_stats () |
| const char * | diguy_ogl_frame_stat_name (int index) |
| int | diguy_ogl_get_frame_stat (const char *stat_name) |
| int | diguy_ogl_clear_all_frame_stats () |
| int | diguy_ogl_draw_frame_stats (int sx, int sy) |
| int diguy_ogl_initialize | ( | bdiGraphicsInitOgl * | init | ) |
This function initializes the DI-Guy Runtime API for the OpenGL environment.
This function should only be called once per program execution. Do not call this function again, even after calling diguy_deinitialize().
Use diguy_ogl_get_defaults() to fill out the init structure before changing specific entries.
| init | pointer to type bdiGraphicsInitOgl; passing NULL will cause defaults to be used for all values |
Returns:
0 on success, non-zero error code on failure
Refer to diguy_constants.h for error code values.
| int diguy_ogl_get_defaults | ( | bdiGraphicsInitOgl * | init | ) |
Fills out the init structure with default values.
Selected entries can then be changed before calling diguy_ogl_initialize().
| init | pointer to type bdiGraphicsInitOgl |
Returns:
0 on success, -1 on failure
| int diguy_default_fire_weapon_intersection_function | ( | diguyImpact * | impact, |
| float | from_x, | ||
| float | from_y, | ||
| float | from_z, | ||
| float | to_x, | ||
| float | to_y, | ||
| float | to_z, | ||
| diguyScenario * | scenario | ||
| ) |
This function is the default fire intersection function.
It uses a minimal render of the scene and characters into the back buffer to fill out the impact structure.
It may be useful to combine your intersection results with the results from this function.
| int diguy_ogl_generate_character_texture_list | ( | diguyScenario * | scenario, |
| int | character_index | ||
| ) |
This function queries the character for the OpenGL texture objects it is using and stores them in an internal list.
This internal list can then be accessed via the following functions:
The function diguy_ogl_release_character_texture_list() should be called once query calls are complete to avoid a resource leak.
Note that there is currently only one internal texture list; there are not separate lists per character. Calling this function again, even with a different scenario pointer and/or character index, will clobber the previous texture list.
| scenario | pointer to character's scenario |
| character_index | index of character to be queried |
Returns:
0 on success, -1 on failure
C++ Example:
| int diguy_ogl_release_character_texture_list | ( | diguyScenario * | scenario, |
| int | character_index | ||
| ) |
This function releases a texture list generated by diguy_ogl_generate_character_texture_list().
| scenario | pointer to character's scenario |
| character_index | index of character to be queried |
Returns:
0 on success, -1 on failure
| int diguy_ogl_get_character_texture_list_num_textures | ( | diguyScenario * | scenario, |
| int | character_index | ||
| ) |
This function returns the number of textures used by the specified character.
The function diguy_ogl_generate_character_texture_list() must be called before this function. The scenario and character_index arguments passed to this function must match those passed to the generate function.
| scenario | pointer to character's scenario |
| character_index | index of character to be queried |
Returns:
number of textures in texture list
| GLuint diguy_ogl_get_character_texture_list_texture_object_at_index | ( | diguyScenario * | scenario, |
| int | character_index, | ||
| int | texture_list_index | ||
| ) |
This function returns the OpenGL texture object at the specified index.
The function diguy_ogl_generate_character_texture_list() must be called before this function. The scenario and character_index arguments passed to this function must match those passed to the generate function.
| scenario | pointer to character's scenario |
| character_index | index of character to be queried |
| texture_list_index | index of texture in texture list |
Returns:
OpenGL texture object
| const char* diguy_ogl_get_character_texture_list_texture_filename_at_index | ( | diguyScenario * | scenario, |
| int | character_index, | ||
| int | texture_list_index | ||
| ) |
This function returns the filename of the texture at the specified index.
The function diguy_ogl_generate_character_texture_list() must be called before this function. The scenario and character_index arguments passed to this function must match those passed to the generate function.
| scenario | pointer to character's scenario |
| character_index | index of character to be queried |
| texture_list_index | index of texture in texture list |
Returns:
filename of the texture
| int diguy_ogl_set_character_texture_objects_modified | ( | diguyScenario * | scenario, |
| int | character_index | ||
| ) |
This function notifies the character that its texture objects have been modified and that it should take any steps necessary to update its internal state to ensure proper display.
| scenario | pointer to character's scenario |
| character_index | index of character to be queried |
Returns:
0 on success, -1 on failure
| int diguy_ogl_get_texture_unit | ( | ) |
This function returns the texture unit that DI-Guy is currently set to use.
Returns:
integer identifying texture unit; e.g., 0 for texture unit 0
| int diguy_ogl_set_texture_unit | ( | int | texture_unit | ) |
This function sets the texture unit that DI-Guy should use.
| texture_unit | integer identifying texture unit |
Possible values are:
| 0 | use GL_TEXTURE0 |
| 1 | use GL_TEXTURE1 |
| 2 | use GL_TEXTURE2 |
| 3 | use GL_TEXTURE3 |
Returns:
0 on success, -1 on failure
| void diguy_ogl_set_use_far_positions | ( | int | val | ) |
This function turns far position rendering on or off.
See diguyViewCamera for more information on far positions.
| val | pass 1 to use far positions, 0 to not use them |
| int diguy_ogl_get_use_far_positions | ( | ) |
Returns: 1 if far positions are in use, else 0.
| void diguy_ogl_set_default_shader_source_files | ( | const char * | shader_name, |
| const char * | vert_filename, | ||
| const char * | pixel_filename | ||
| ) |
This function sets the shader source files that will be used for the specified shader.
The default filenames for the "diguy_character" shader are "diguy_character_glsl.vert" and "diguy_character_glsl.frag".
| shader_name | name with which vertex/pixel shader pair can be referenced |
| vert_filename | name of vertex shader source file |
| pixel_filename | name of pixel (fragment) shader source file |
| int diguy_ogl_render_shadow_map | ( | unsigned int | texture_unit, |
| diguyViewLight * | light, | ||
| diguyScenario * | scenario, | ||
| float | pos_above_terrain | ||
| ) |
Renders a shadow pass of the world and binds into the target texture unit.
| int diguy_ogl_apply_active_lights | ( | diguyScenario * | scenario | ) |
Applies active lights to the OpenGL state, also updates default shader uniforms and calls diguyScenario::set_num_active_point_lights()
Returns:
The number of active lights
| void diguy_ogl_draw_aim_trajectories | ( | diguyScenario * | scenario, |
| diguyView * | view | ||
| ) |
helper function not really for end users
| int diguy_ogl_2d_set_color | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a | ||
| ) |
| int diguy_ogl_2d_draw_filled_rect | ( | int | x0, |
| int | y0, | ||
| int | x1, | ||
| int | y1 | ||
| ) |
| int diguy_ogl_2d_draw_text | ( | int | x, |
| int | y, | ||
| const char * | text | ||
| ) |
| int diguy_ogl_2d_get_text_width | ( | const char * | text | ) |
| int diguy_ogl_2d_get_text_height | ( | const char * | text | ) |
| int diguy_ogl_get_fbo_texture_id | ( | ) |
| int diguy_ogl_reload_changed_textures | ( | ) |
| int diguy_ogl_get_num_frame_stats | ( | ) |
| const char* diguy_ogl_frame_stat_name | ( | int | index | ) |
| int diguy_ogl_get_frame_stat | ( | const char * | stat_name | ) |
| int diguy_ogl_clear_all_frame_stats | ( | ) |
| int diguy_ogl_draw_frame_stats | ( | int | sx, |
| int | sy | ||
| ) |