Axmol Engine 2.4.0-258ceca
Loading...
Searching...
No Matches
RenderState::StateBlock Class Reference

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

#include <RenderState.h>

Public Types

enum  
 StateBlock bits to be used with invalidate.
 

Public Member Functions

 StateBlock ()=default
 Creates a new StateBlock with default render state settings.
 
void bind (PipelineDescriptor *programState)
 Binds the state in this StateBlock to the renderer.
 
void setBlendFunc (const BlendFunc &blendFunc)
 Explicitly sets the source and destination used in the blend function for this render state.
 
void setBlend (bool enabled)
 Toggles blending.
 
void setBlendSrc (backend::BlendFactor blend)
 Explicitly sets the source used in the blend function for this render state.
 
void setBlendDst (backend::BlendFactor blend)
 Explicitly sets the source used in the blend function for this render state.
 
void setCullFace (bool enabled)
 Explicitly enables or disables backface culling.
 
void setCullFaceSide (CullFaceSide side)
 Sets the side of the facets to cull.
 
void setFrontFace (FrontFace winding)
 Sets the winding for front facing polygons.
 
void setDepthTest (bool enabled)
 Toggles depth testing.
 
void setDepthWrite (bool enabled)
 Toggles depth writing.
 
void setDepthFunction (DepthFunction func)
 Sets the depth function to use when depth testing is enabled.
 
void setState (std::string_view name, std::string_view value)
 Sets a render state from the given name and value strings.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ StateBlock()

StateBlock ( )
default

Creates a new StateBlock with default render state settings.

The recommended way to create StateBlocks is by calling create. Don't use new or delete on them.

Member Function Documentation

◆ bind()

void bind ( PipelineDescriptor * programState)

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.

◆ setBlendFunc()

void setBlendFunc ( const BlendFunc & blendFunc)

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

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

Parameters
blendFuncSpecifies how the blending factors are computed.

◆ setBlend()

void setBlend ( bool enabled)

Toggles blending.

Parameters
enabledtrue to enable, false to disable.

◆ setBlendSrc()

void setBlendSrc ( backend::BlendFactor 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
blendSpecifies how the source blending factors are computed.

◆ setBlendDst()

void setBlendDst ( backend::BlendFactor 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
blendSpecifies how the destination blending factors are computed.

◆ setCullFace()

void setCullFace ( bool enabled)

Explicitly enables or disables backface culling.

Parameters
enabledtrue to enable, false to disable.

◆ setCullFaceSide()

void setCullFaceSide ( CullFaceSide side)

Sets the side of the facets to cull.

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

Parameters
sideThe side to cull.

◆ setFrontFace()

void setFrontFace ( FrontFace winding)

Sets the winding for front facing polygons.

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

Parameters
windingThe winding for front facing polygons.

◆ setDepthTest()

void setDepthTest ( bool enabled)

Toggles depth testing.

By default, depth testing is disabled.

Parameters
enabledtrue to enable, false to disable.

◆ setDepthWrite()

void setDepthWrite ( bool enabled)

Toggles depth writing.

Parameters
enabledtrue to enable, false to disable.

◆ setDepthFunction()

void 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
funcThe depth function.

◆ setState()

void setState ( std::string_view name,
std::string_view 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
nameName of the render state to set.
valueValue of the specified render state.

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