|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions
gameplay::RenderState::StateBlock Class Reference

`#include <RenderState.h>`

Inheritance diagram for gameplay::RenderState::StateBlock:

List of all members.

## Public Member Functions

void | bind ()
void | setBlend (bool enabled)
void | setBlendSrc (Blend blend)
void | setBlendDst (Blend blend)
void | setCullFace (bool enabled)
void | setCullFaceSide (CullFaceSide side)
void | setFrontFace (FrontFace winding)
void | setDepthTest (bool enabled)
void | setDepthWrite (bool enabled)
void | setDepthFunction (DepthFunction func)
void | setStencilTest (bool enabled)
void | setStencilWrite (unsigned int mask)
void | setStencilFunction (StencilFunction func, int ref, unsigned int mask)
void | setStencilOperation (StencilOperation sfail, StencilOperation dpfail, StencilOperation dppass)
void | setState (const char *name, const char *value)

## Static Public Member Functions

static StateBlock * | create ()

## Detailed Description

Defines a block of fixed-function render states that can be applied to a RenderState object.

## Member Function Documentation

void gameplay::RenderState::StateBlock::bind | ( |  | ) |

Binds the state in this StateBlock to the renderer.

This method handles both setting and restoring of render states to ensure that only the state explicitly defined by this StateBlock is applied to the renderer.

static StateBlock* gameplay::RenderState::StateBlock::create | ( |  | ) | `[static]`

Creates a new StateBlock with default render state settings.

void gameplay::RenderState::StateBlock::setBlend | ( | bool | enabled | ) |

Toggles blending.

Parameters:

  enabled | true to enable, false to disable.

void gameplay::RenderState::StateBlock::setBlendDst | ( | Blend | blend | ) |

Explicitly sets the source used in the blend function for this render state.

Note that the blend function is only applied when blending is enabled.

Parameters:

  blend | Specifies how the destination blending factors are computed.

void gameplay::RenderState::StateBlock::setBlendSrc | ( | Blend | blend | ) |

Explicitly sets the source used in the blend function for this render state.

Note that the blend function is only applied when blending is enabled.

Parameters:

  blend | Specifies how the source blending factors are computed.

void gameplay::RenderState::StateBlock::setCullFace | ( | bool | enabled | ) |

Explicitly enables or disables backface culling.

Parameters:

  enabled | true to enable, false to disable.

void gameplay::RenderState::StateBlock::setCullFaceSide | ( | CullFaceSide | side | ) |

Sets the side of the facets to cull.

When not explicitly set, the default is to cull back-facing facets.

Parameters:

  side | The side to cull.

void gameplay::RenderState::StateBlock::setDepthFunction | ( | DepthFunction | func | ) |

Sets the depth function to use when depth testing is enabled.

When not explicitly set and when depth testing is enabled, the default depth function is DEPTH_LESS.

Parameters:

  func | The depth function.

void gameplay::RenderState::StateBlock::setDepthTest | ( | bool | enabled | ) |

Toggles depth testing.

By default, depth testing is disabled.

Parameters:

  enabled | true to enable, false to disable.

void gameplay::RenderState::StateBlock::setDepthWrite | ( | bool | enabled | ) |

Toggles depth writing.

Parameters:

  enabled | true to enable, false to disable.

void gameplay::RenderState::StateBlock::setFrontFace | ( | FrontFace | winding | ) |

Sets the winding for front facing polygons.

By default, counter-clockwise wound polygons are considered front facing.

Parameters:

  winding | The winding for front facing polygons.

void gameplay::RenderState::StateBlock::setState | ( | const char * | name,
|  | const char * | value
| ) |  |

Sets a render state from the given name and value strings.

This method attempts to interpret the passed in strings as render state name and value. This is normally used when loading render states from material files.

Parameters:

  name | Name of the render state to set.
  value | Value of the specified render state.

void gameplay::RenderState::StateBlock::setStencilFunction | ( | StencilFunction | func,
|  | int | ref,
|  | unsigned int | mask
| ) |  |

Sets the stencil function.

By default, the function is set to STENCIL_ALWAYS, the reference value is 0, and the mask is all 1's.

Parameters:

  func | The stencil function.
  ref | The stencil reference value.
  mask | The stencil mask.

void gameplay::RenderState::StateBlock::setStencilOperation | ( | StencilOperation | sfail,
|  | StencilOperation | dpfail,
|  | StencilOperation | dppass
| ) |  |

Sets the stencil operation.

By default, stencil fail, stencil pass/depth fail, and stencil and depth pass are set to STENCIL_OP_KEEP.

Parameters:

  sfail | The stencil operation if the stencil test fails.
  dpfail | The stencil operation if the stencil test passes, but the depth test fails.
  dppass | The stencil operation if both the stencil test and depth test pass.

void gameplay::RenderState::StateBlock::setStencilTest | ( | bool | enabled | ) |

Toggles stencil testing.

By default, stencil testing is disabled.

Parameters:

  enabled | true to enable, false to disable.

void gameplay::RenderState::StateBlock::setStencilWrite | ( | unsigned int | mask | ) |

Sets the stencil writing mask.

By default, the stencil writing mask is all 1's.

Parameters:

  mask | Bit mask controlling writing to individual stencil planes.

All Classes Functions Variables Typedefs Enumerations Enumerator