IRenderStateManager Class Reference
 
 
 
IRenderStateManager Class Reference

This reference page is linked to from the following overview topics: Nitrous Graphics SDK Extensions.


#include <IRenderStateManager.h>

Inheritance diagram for IRenderStateManager:
MaxHeapOperators

Class Description

IRenderStateManager controls primitive renderer's current render style.

It defines set-up states for all kinds of vertex and pixel processing. Some render states set up vertex processing, and some set up pixel processing. This interface is acquired from IPrimitiveRenderer::GetRenderStates()

Public Member Functions

Alpha blending methods

Methods for controlling the alpha blending algorithm

virtual GraphicsDriverAPI void  SetBlendEnable (bool bEnable)=0
  Set alpha blend status The blend state controls how a primitive mixing with current back-buffer.
virtual GraphicsDriverAPI bool  GetBlendEnable ()=0
  Get alpha blend status.
virtual GraphicsDriverAPI void  SetSourceBlend (BlendSelector value)=0
  Set source element of alpha blend.
virtual GraphicsDriverAPI
BlendSelector 
GetSourceBlend ()=0
  Get source element.
virtual GraphicsDriverAPI void  SetDestinationBlend (BlendSelector value)=0
  Set destination element of alpha blend.
virtual GraphicsDriverAPI
BlendSelector 
GetDestinationBlend ()=0
  Get destination element.
virtual GraphicsDriverAPI void  SetBlendOperation (BlendOperation value)=0
  Set alpha blend method The alpha blend operations controls how to mix the alpha value with back-buffer's alpha.
virtual GraphicsDriverAPI
BlendOperation 
GetBlendOperation ()=0
  Get alpha blend method.
virtual GraphicsDriverAPI void  SetAlphaSourceBlend (BlendSelector value)=0
  Set source element of alpha value blend.
virtual GraphicsDriverAPI
BlendSelector 
GetAlphaSourceBlend ()=0
  Get source element.
virtual GraphicsDriverAPI void  SetAlphaDestBlend (BlendSelector value)=0
  Set destination element of alpha value blend.
virtual GraphicsDriverAPI
BlendSelector 
GetAlphaDestBlend ()=0
  Get destination element.
virtual GraphicsDriverAPI void  SetAlphaBlendOperation (BlendOperation value)=0
  Set alpha value blend method.
virtual GraphicsDriverAPI
BlendOperation 
GetAlphaBlendOperation ()=0
  Get alpha blend method.
virtual GraphicsDriverAPI void  SetBlendFactor (const Point4 &factor)=0
  Set alpha value blend factor.
virtual GraphicsDriverAPI Point4  GetBlendFactor ()=0
  Get blend factor.
Rasterizer state methods

Set basic rasterizing states such as culling

virtual GraphicsDriverAPI void  SetCullMode (CullMode value)=0
  Set polygon cull method.
virtual GraphicsDriverAPI CullMode  GetCullMode ()=0
  Get polygon cull method.
virtual GraphicsDriverAPI void  SetFillMode (FillMode value)=0
  Set polygon fill mode.
virtual GraphicsDriverAPI FillMode  GetFillMode ()=0
  Get current polygon fill method.
virtual GraphicsDriverAPI void  SetPointSize (float value)=0
  Set point size when using point primitive.
virtual GraphicsDriverAPI float  GetPointSize ()=0
  Get current point size.
Depth state methods

Enable and set depth based methods

virtual GraphicsDriverAPI void  SetDepthEnable (bool bEnable)=0
  Set whether enable depth compare and culling.
virtual GraphicsDriverAPI bool  GetDepthEnable ()=0
  Get current depth culling status.
virtual GraphicsDriverAPI void  SetDepthFunction (CompareFunction value)=0
  Set depth compare function.
virtual GraphicsDriverAPI
CompareFunction 
GetDepthFunction ()=0
  Get compare function.
virtual GraphicsDriverAPI void  SetDepthWriteEnable (bool bEnable)=0
  Set whether write Z value when drawing primitives.
virtual GraphicsDriverAPI bool  GetDepthWriteEnable ()=0
  Get current depth write status.
Render state management

Method for controlling the life time of render states

virtual GraphicsDriverAPI void  PushRenderStates ()=0
  Push all render states into internal stack.
virtual GraphicsDriverAPI void  PopRenderStates ()=0
  Restore render states to internal stack's topmost render states and pop it out of stack you can use this function to restore previous pushed states.
virtual GraphicsDriverAPI void  ApplyRenderStates ()=0
  Apply current render states to real render device.

Protected Member Functions

virtual GraphicsDriverAPI  ~IRenderStateManager ()

Friends

class  IPrimitiveRenderer

Constructor & Destructor Documentation

virtual GraphicsDriverAPI ~IRenderStateManager ( ) [inline, protected, virtual]
{}

Member Function Documentation

virtual GraphicsDriverAPI void SetBlendEnable ( bool  bEnable ) [pure virtual]

Set alpha blend status The blend state controls how a primitive mixing with current back-buffer.

When disabling blend, the primitive's pixel will write to back-buffer without any additional operation. When enable it, the final color will be computed via SourceBlend, DestintaionBlend and BlendOperation.

Remarks:
An example, when SourceBlend is BlendSelector_SourceColor, DestinationBlend is BlendSelector_DestinationColor and BlendOperation is BlendOperation_Add, then the FinalColor = PrimitiveColor + BackBufferColor.
Parameters:
bEnable true to enable alpha blend, false to disable alpha blend
virtual GraphicsDriverAPI bool GetBlendEnable ( ) [pure virtual]

Get alpha blend status.

virtual GraphicsDriverAPI void SetSourceBlend ( BlendSelector  value ) [pure virtual]

Set source element of alpha blend.

Parameters:
value source element
virtual GraphicsDriverAPI BlendSelector GetSourceBlend ( ) [pure virtual]

Get source element.

virtual GraphicsDriverAPI void SetDestinationBlend ( BlendSelector  value ) [pure virtual]

Set destination element of alpha blend.

Parameters:
value destination element
virtual GraphicsDriverAPI BlendSelector GetDestinationBlend ( ) [pure virtual]

Get destination element.

virtual GraphicsDriverAPI void SetBlendOperation ( BlendOperation  value ) [pure virtual]

Set alpha blend method The alpha blend operations controls how to mix the alpha value with back-buffer's alpha.

Parameters:
value type of alpha operation
virtual GraphicsDriverAPI BlendOperation GetBlendOperation ( ) [pure virtual]

Get alpha blend method.

virtual GraphicsDriverAPI void SetAlphaSourceBlend ( BlendSelector  value ) [pure virtual]

Set source element of alpha value blend.

Parameters:
value source element
virtual GraphicsDriverAPI BlendSelector GetAlphaSourceBlend ( ) [pure virtual]

Get source element.

virtual GraphicsDriverAPI void SetAlphaDestBlend ( BlendSelector  value ) [pure virtual]

Set destination element of alpha value blend.

Parameters:
value destination element
virtual GraphicsDriverAPI BlendSelector GetAlphaDestBlend ( ) [pure virtual]

Get destination element.

virtual GraphicsDriverAPI void SetAlphaBlendOperation ( BlendOperation  value ) [pure virtual]

Set alpha value blend method.

Parameters:
value type of alpha operation
virtual GraphicsDriverAPI BlendOperation GetAlphaBlendOperation ( ) [pure virtual]

Get alpha blend method.

virtual GraphicsDriverAPI void SetBlendFactor ( const Point4 factor ) [pure virtual]

Set alpha value blend factor.

Parameters:
blend factor
virtual GraphicsDriverAPI Point4 GetBlendFactor ( ) [pure virtual]

Get blend factor.

virtual GraphicsDriverAPI void SetCullMode ( CullMode  value ) [pure virtual]

Set polygon cull method.

Parameters:
value the cull mode
virtual GraphicsDriverAPI CullMode GetCullMode ( ) [pure virtual]

Get polygon cull method.

virtual GraphicsDriverAPI void SetFillMode ( FillMode  value ) [pure virtual]

Set polygon fill mode.

Parameters:
value the fill mode
virtual GraphicsDriverAPI FillMode GetFillMode ( ) [pure virtual]

Get current polygon fill method.

virtual GraphicsDriverAPI void SetPointSize ( float  value ) [pure virtual]

Set point size when using point primitive.

Parameters:
value size of the point in pixel.
virtual GraphicsDriverAPI float GetPointSize ( ) [pure virtual]

Get current point size.

virtual GraphicsDriverAPI void SetDepthEnable ( bool  bEnable ) [pure virtual]

Set whether enable depth compare and culling.

Parameters:
bEnable true to enable Z buffer function, false to disable Z buffer.
virtual GraphicsDriverAPI bool GetDepthEnable ( ) [pure virtual]

Get current depth culling status.

virtual GraphicsDriverAPI void SetDepthFunction ( CompareFunction  value ) [pure virtual]

Set depth compare function.

Parameters:
value compare function
virtual GraphicsDriverAPI CompareFunction GetDepthFunction ( ) [pure virtual]

Get compare function.

virtual GraphicsDriverAPI void SetDepthWriteEnable ( bool  bEnable ) [pure virtual]

Set whether write Z value when drawing primitives.

Parameters:
bEnable true to allow writing z values. false to disable it.
virtual GraphicsDriverAPI bool GetDepthWriteEnable ( ) [pure virtual]

Get current depth write status.

virtual GraphicsDriverAPI void PushRenderStates ( ) [pure virtual]

Push all render states into internal stack.

You can then change the states and restore them by calling PopRenderStates. If there's only a few states to change, it's better to manage them by yourself.

virtual GraphicsDriverAPI void PopRenderStates ( ) [pure virtual]

Restore render states to internal stack's topmost render states and pop it out of stack you can use this function to restore previous pushed states.

virtual GraphicsDriverAPI void ApplyRenderStates ( ) [pure virtual]

Apply current render states to real render device.

                        A typical usage of render stack may like this:
                        PushRenderStates()...
                        SetRenderState()
                        ...
                        ApplyRenderStates()
                        DrawPrimitive()...
                        DrawPrimitive()...
                        PopRenderStates()...

Friends And Related Function Documentation