![]() |
DI-Guy SDK Documentation
13.1
|
A class that represents a shared material. More...
#include <diguyGraphicsMaterial.h>
Public Member Functions | |
Virtual Functions | |
The functions in this section are all virtual functions that will be called by DI-Guy at various times during DI-Guy execution. Because the functions are all virtual, DI-Guy programmers can create a subclass of this class and override them. Unless otherwise stated, the base class functions do not need to be called. | |
| virtual void | build () |
| This function will be called by DI-Guy when it is time for a renderer-specific material object to be created. More... | |
| virtual void | unbuild () |
| This function will be called by DI-Guy when it is time for a renderer-specific material object to be destroyed. More... | |
| virtual void | bind_now () |
| This function will be called by DI-Guy when the material should be made active, or bound. More... | |
Accessor Functions | |
The functions in this section provide access to data in this object. They are designed to be called by DI-Guy programmers. | |
| const char * | get_name () |
| Returns the name of the texture. More... | |
| void | get_ambient (float *rgba) |
| This function returns the red, green, blue, and alpha components of the material's ambient setting. More... | |
| void | get_diffuse (float *rgba) |
| This function returns the red, green, blue, and alpha components of the material's diffuse setting. More... | |
| void | get_specular (float *rgba) |
| This function returns the red, green, blue, and alpha components of the material's specular setting. More... | |
| void | get_emission (float *rgba) |
| This function returns the red, green, blue, and alpha components of the material's emission setting. More... | |
| void | get_shininess (float *s) |
| This function returns the material's shininess setting. More... | |
| void | free_loader_memory () |
| This function frees most memory allocated by the DI-Guy geometry loader for this object. More... | |
| int | get_contains_alpha_component () |
| This function returns whether the material contains an alpha component. More... | |
| static diguyGraphicsMaterial * | get_last_bound_material () |
| This function returns the last material that was bound. More... | |
| static void | clear_last_bound_material () |
| This function clears out the last bound material pointer. More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiGeometryMtl * | m_scripted_object |
| A pointer to internal data. More... | |
| class | bdiGeometryMtl |
| class | bdiGeometryFactory |
| bdiGeometryMtl * | get_scripted_object () |
| diguyGraphicsMaterial (void *internal_data) | |
| A protected constructor. More... | |
| virtual | ~diguyGraphicsMaterial () |
| A protected destructor. More... | |
A class that represents a shared material.
Can be subclassed by filling out the diguy_graphics_set_material_create_func().
|
protected |
A protected constructor.
Constructors are called automatically by DI-Guy.
|
protectedvirtual |
A protected destructor.
Destructors are called automatically by DI-Guy.
| const char* diguyGraphicsMaterial::get_name | ( | ) |
Returns the name of the texture.
This pointer will never be NULL.
Returns:
name of the texture
Callable From:
| void diguyGraphicsMaterial::get_ambient | ( | float * | rgba | ) |
This function returns the red, green, blue, and alpha components of the material's ambient setting.
All returned values will be between 0 (least intensity) and 1 (highest intensity).
| rgba | pointer to an array of four floats into which results should be copied |
Callable From:
| void diguyGraphicsMaterial::get_diffuse | ( | float * | rgba | ) |
This function returns the red, green, blue, and alpha components of the material's diffuse setting.
All returned values will be between 0 (least intensity) and 1 (highest intensity).
| rgba | pointer to an array of four floats into which results should be copied |
Callable From:
| void diguyGraphicsMaterial::get_specular | ( | float * | rgba | ) |
This function returns the red, green, blue, and alpha components of the material's specular setting.
All returned values will be between 0 (least intensity) and 1 (highest intensity).
| rgba | pointer to an array of four floats into which results should be copied |
Callable From:
| void diguyGraphicsMaterial::get_emission | ( | float * | rgba | ) |
This function returns the red, green, blue, and alpha components of the material's emission setting.
All returned values will be between 0 (least intensity) and 1 (highest intensity).
| rgba | pointer to an array of four floats into which results should be copied |
Callable From:
| void diguyGraphicsMaterial::get_shininess | ( | float * | s | ) |
This function returns the material's shininess setting.
| s | pointer to float into which result should be copied |
Callable From:
| void diguyGraphicsMaterial::free_loader_memory | ( | ) |
This function frees most memory allocated by the DI-Guy geometry loader for this object.
This function should only be called during or after the object's build() function has been called. After it has been called, calls to many accessor functions will fail.
Callable From:
| int diguyGraphicsMaterial::get_contains_alpha_component | ( | ) |
This function returns whether the material contains an alpha component.
Materials that have an alpha component can make objects semi-transparent, which can affect when said objects should be drawn.
Returns:
1 if texture contains an alpha component, 0 if not; -1 on failure
Callable From:
|
static |
This function returns the last material that was bound.
In bind_now() the current material can be checked against the last bound material; if the values are the same the bind_now() function can most often immediately return. This is desirable because rendering state changes can have significant performance overhead.
Callable From:
|
static |
This function clears out the last bound material pointer.
diguyScenario::draw() calls it automatically, but it's recommended that this function also be called when the drawing of a new character is beginning. This can be done in diguyGraphicsLink::begin_character_draw().
Callable From:
|
virtual |
This function will be called by DI-Guy when it is time for a renderer-specific material object to be created.
At that point all material information has been read and is available via the Accessor Functions above.
Immediate Mode:
Immediate mode renderers may override this function, to create an object that may be invoked by bind_now() to set material attributes.
Scene Graph:
Scene graph renderers usually do override this function, to create a material object that will be associated with diguyGraphicsMesh objects.
Callable From:
Reimplemented in diguyOsgGraphicsMaterial, and diguyOglGraphicsMaterial.
|
virtual |
This function will be called by DI-Guy when it is time for a renderer-specific material object to be destroyed.
Immediate Mode:
Immediate mode renderers may override this function, to destroy any object that may have been created by build().
Scene Graph:
Scene graph renderers usually do override this function, to destroy any object that may have been created by build().
Callable From:
Reimplemented in diguyOsgGraphicsMaterial, and diguyOglGraphicsMaterial.
|
virtual |
This function will be called by DI-Guy when the material should be made active, or bound.
Note that this material should be checked against the material returned by get_last_bound_material(). If they're the same this function should return early.
Immediate Mode:
Immediate mode renderers usually do override this function, to invoke the object created by build(), or make calls to the renderer to set appropriate material state.
Scene Graph:
Scene graph renderers usually do not override this function.
Callable From:
Reimplemented in diguyOglGraphicsMaterial.
|
inline |
|
friend |
|
friend |
|
private |
A pointer to internal data.