I just want to ask if it''s worth controlling all the render-states and texture stage states manually. What I mean is this:
Say I have a tree that holds a structure of type RENDERSTATE
struct RENDERSTATE
{
D3DRENDERSTATETYPE state;
unsigned long value;
RENDERSTATE( const D3DRENDERSTATETYPE& st, const unsigned long& val )
{
state = st;
value = val;
}
bool operator == ( const RENDERSTATE& rhs ) const { return state == rhs.state; }
bool operator > ( const RENDERSTATE& rhs ) const { return state > rhs.state; }
bool operator < ( const RENDERSTATE& rhs ) const { return state < rhs.state; }
};
Then I store all the possible renderstates that D3D supports in a tree with some default values...
// RenderStates is of type Tree<RENDERSTATE>.
RenderStates.InsertNode( RENDERSTATE( D3DRS_ALPHABLENDENABLE, FALSE ) );
RenderStates.InsertNode( RENDERSTATE( D3DRS_LIGHTINGENABLE, FALSE ) );
// Same for all the render states.
So now I have all my render states in a tree. Then I use the tree''s search method to find a renderstate and check if it''s value is the same as the one I want to set. If it''s the same I save a call to IDirect3DDevice::SetRenderStates().
My main concern is, will all the above be worth doing just to save on a call to SetRenderState() ?
Or is there (there must be) a better way of doing this?
:::: [
Triple Buffer V2.0 ]
::::