DI-Guy SDK Documentation  13.7
diguyGraphicsState Class Reference

A class that represents a shared material/textures combination. More...

#include <diguyGraphicsState.h>

Inheritance diagram for diguyGraphicsState:
diguyOsgGraphicsState

Public Member Functions

int get_contains_alpha_component () const
 This function returns whether either the material or texture of this state contains an alpha component. More...
 
int get_is_unlit () const
 This function returns whether faces drawn with this state should be lit or unlit. More...
 
void free_loader_memory ()
 This function frees most memory allocated by the DI-Guy geometry loader for this object. 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.

All functions in this section are callable from:

  • C++
  • Script
diguyGraphicsMaterialget_material ()
 This function returns the material of this state. More...
 
int get_num_textures ()
 This function returns the number of textures this state has. More...
 
diguyGraphicsTextureget_texture (int texture_index=0)
 This function returns the nth texture of this state. More...
 
diguyTextureMapType get_texture_type (int index) const
 This function returns the way that a texture is used in the state. More...
 
int get_textures_available () const
 This function returns a bit-wise or'ed mask of available textures in this state. More...
 
diguyGraphicsTextureArrayget_texture_array ()
 return Decal array More...
 
const diguyGraphicsTextureArrayget_texture_array () const
 
diguyGraphicsTextureArrayget_texture_array (diguyTextureMapType map_type)
 return Decal diffuse, specular or normal array More...
 
const diguyGraphicsTextureArrayget_texture_array (diguyTextureMapType map_type) const
 
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 state object to be created. More...
 
virtual void unbuild ()
 This function will be called by DI-Guy when it is time for a renderer-specific state object to be destroyed. More...
 
virtual void bind_now ()
 This function will be called by DI-Guy when the state should be made active, or bound. More...
 
void bind (int texture_mask)
 Calls bind on internal class which will bind materials and appropriate textures. More...
 

Private Functions

The functions and variables past this point are for internal use only.

No external access to them is expected or necessary.

bdiGeometryGeosetStatem_scripted_object
 A pointer to internal data. More...
 
class bdiGeometryGeosetState
 
class bdiGeometryFactory
 
bdiGeometryGeosetStateget_scripted_object ()
 
 diguyGraphicsState (void *internal_data)
 A protected constructor. More...
 
virtual ~diguyGraphicsState ()
 A protected destructor. More...
 

Detailed Description

A class that represents a shared material/textures combination.

Can be subclassed by filling out the diguy_graphics_set_state_create_func().

Constructor & Destructor Documentation

diguyGraphicsState::diguyGraphicsState ( void *  internal_data)
protected

A protected constructor.

Constructors are called automatically by DI-Guy.

virtual diguyGraphicsState::~diguyGraphicsState ( )
protectedvirtual

A protected destructor.

Destructors are called automatically by DI-Guy.

Member Function Documentation

diguyGraphicsMaterial* diguyGraphicsState::get_material ( )

This function returns the material of this state.

Specific information about the material can then be accessed from the returned object.

Returns:

object of type diguyGraphicsMaterial; NULL on failure

int diguyGraphicsState::get_num_textures ( )

This function returns the number of textures this state has.

Returns:

number of textures associated with this state

diguyGraphicsTexture* diguyGraphicsState::get_texture ( int  texture_index = 0)

This function returns the nth texture of this state.

Specific information about the texture can then be accessed from the returned object.

Returns:

object of type diguyGraphicsTexture; NULL on failure

diguyTextureMapType diguyGraphicsState::get_texture_type ( int  index) const

This function returns the way that a texture is used in the state.

Possibilities include diffuse, specular, normal.

Returns:

diguyTextureMapType enum

int diguyGraphicsState::get_textures_available ( ) const

This function returns a bit-wise or'ed mask of available textures in this state.

Possibilities include DIGUY_TEXTURE_MAP_MASK_DIFFUSE, DIGUY_TEXTURE_MAP_MASK_SPECULAR, DIGUY_TEXTURE_MAP_MASK_BUMP, etc. See diguyTextureMapMasks enum for a complete list.

diguyGraphicsTextureArray* diguyGraphicsState::get_texture_array ( )

return Decal array

const diguyGraphicsTextureArray* diguyGraphicsState::get_texture_array ( ) const
diguyGraphicsTextureArray* diguyGraphicsState::get_texture_array ( diguyTextureMapType  map_type)

return Decal diffuse, specular or normal array

const diguyGraphicsTextureArray* diguyGraphicsState::get_texture_array ( diguyTextureMapType  map_type) const
int diguyGraphicsState::get_contains_alpha_component ( ) const

This function returns whether either the material or texture of this state contains an alpha component.

States that have an alpha component can make objects semi-transparent, which can affect when said objects should be drawn.

Returns:

1 if state contains an alpha component, 0 if not; -1 on failure

int diguyGraphicsState::get_is_unlit ( ) const

This function returns whether faces drawn with this state should be lit or unlit.

Returns:

1 if faces unlit, 0 if lit, -1 on failure

void diguyGraphicsState::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.

virtual void diguyGraphicsState::build ( )
virtual

This function will be called by DI-Guy when it is time for a renderer-specific state object to be created.

A subclass of this class isn't always necessary, particularly for immediate mode renderers in which everything might be done in a subclass of diguyGraphicsMaterial and a subclass of diguyGraphicsTexture.

Immediate Mode:

Immediate mode renderers usually do not override this function.

Scene Graph:

Scene graph renderers may override this function, to create a state object that will be associated with diguyGraphicsMesh objects.

The subclass version of this function may need to refer to material and texture objects created by the build() calls of subclasses of diguyGraphicsMaterial and diguyGraphicsTexture objects.

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during the Build Stage)

Reimplemented in diguyOsgGraphicsState.

virtual void diguyGraphicsState::unbuild ( )
virtual

This function will be called by DI-Guy when it is time for a renderer-specific state 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 may override this function, to destroy any object that may have been created by build().

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during the Unbuild Stage)

Reimplemented in diguyOsgGraphicsState.

virtual void diguyGraphicsState::bind_now ( )
virtual

This function will be called by DI-Guy when the state should be made active, or bound.

Immediate Mode:

Immediate mode renderers can override this function, but may not need to. The material and texture of the state will receive their own bind_now() calls.

Scene Graph:

Scene graph renderers usually do not override this function.

Callable From:

  • N/A (automatically called by DI-Guy Graphics API during Draw Stage)
void diguyGraphicsState::bind ( int  texture_mask)

Calls bind on internal class which will bind materials and appropriate textures.

bdiGeometryGeosetState* diguyGraphicsState::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiGeometryGeosetState
friend
friend class bdiGeometryFactory
friend

Member Data Documentation

bdiGeometryGeosetState* diguyGraphicsState::m_scripted_object
private

A pointer to internal data.


The documentation for this class was generated from the following file: