#ifndef __RENDERSTATE_H #define __RENDERSTATE_H #include "common.h" namespace CHCDemoEngine { class ShaderProgram; class Texture; class Material; /** The current render state. */ class RenderState { public: enum Mode { QUERY, RENDER }; /// the used render type for this render pass enum RenderPassType { FORWARD, DEPTH_PASS, DEFERRED }; /** Constructor setting render as default state. */ RenderState(); ~RenderState() { Reset(); }; /** This must be called each time before and after an occlusion test. Mode is one of render mode or query mode. Returns true if a state change was issued. */ bool SetMode(Mode mode); /** Sets the current render state. */ void SetState(Technique *tech); /** Returns either query or render mode */ inline Mode GetMode() const { return mMode; } /** Reset the state. */ void Reset(); /** Stores the current vbo id. */ inline void SetCurrentVboId(int id) { mCurrentVboId = id; } /** Returns the current vbo id. */ inline int GetCurrentVboId() const { return mCurrentVboId; } /** Sets the type of rendering used (foreward, depth pass, deferred) */ void SetRenderPassType(RenderPassType t); /** See Set */ RenderPassType GetRenderPassType() const; /** If alpha to coverage is instead of alpha testing */ void SetUseAlphaToCoverage(bool useAlphaToCoverage); /** If true, the current value of cull face enabled / disable will not be changed by the render state. */ void LockCullFaceEnabled(bool lockCull); protected: ////////////////// bool mAlphaTestEnabled; bool mCullFaceEnabled; bool mTexturesEnabled; Mode mMode; int mCurrentVboId; RenderPassType mRenderType; bool mUseAlphaToCoverage; bool mLockCullFaceEnabled; int mCurrentTexId; ShaderProgram *mCurrentVertexProgram; ShaderProgram *mCurrentFragmentProgram; bool mFragmentProgramEnabled; bool mVertexProgramEnabled; bool mUseLighting; bool mColorWriteEnabled; }; } #endif // __RENDERSTATE_H