Code: Select all
virtual bool SetBlendMode(BlendMode type)
virtual bool SetDepthTest(bool enabled)
virtual bool SetDepthWrite(bool enabled)
virtual bool SetWireFrameMode(bool enabled)
//twoSided property in MaterialDesc
//may be others scattered around
Code: Select all
//at init time
RenderStateDesc desc;
desc.depthTest = false;
desc.blendMode = BLEND_SOLID;
RenderState* state = renderer->CreateRenderState(desc);
//at each render call
renderer->SetRenderState(state);
renderer->DrawStuff(...)
- there are no leaks as everyone is expected to set the correct state before drawing
- redundant changes can be avoided by just comparing pointers. State sets are shared, and
cached by renderer.
Implementing this is simple but I'm asking first because I would update all the current use cases at the same time and that's some amount of work.