source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.h @ 3043

Revision 3043, 2.0 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef __RENDERSTATE_H
2#define __RENDERSTATE_H
3
4
5#include "common.h"
6
7
8namespace CHCDemoEngine
9{
10
11class ShaderProgram;
12class Texture;
13class Material;
14
15/** The current render state.
16*/
17class RenderState
18{
19public:
20
21        enum Mode
22        {
23                QUERY,
24                RENDER
25        };
26
27        /// the used render type for this render pass
28        enum RenderPassType
29        {
30                FORWARD,
31                DEPTH_PASS,
32                DEFERRED
33        };
34
35        /** Constructor setting render as default state.
36        */
37        RenderState();
38       
39        ~RenderState() { Reset(); };
40        /** This must be called each time before and after an occlusion test.
41                Mode is one of render mode or query mode. Returns true if a state
42                change was issued.
43        */
44        bool SetMode(Mode mode);
45        /** Sets the current render state.
46        */
47        void SetState(Technique *tech);
48        /** Returns either query or render mode
49        */
50        inline Mode GetMode() const { return mMode; }
51        /** Reset the state.
52        */
53        void Reset();
54        /** Stores the current vbo id.
55        */
56        inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
57        /** Returns the current vbo id.
58        */
59        inline int GetCurrentVboId() const { return mCurrentVboId; }
60        /** Sets the type of rendering used (foreward, depth pass, deferred)
61        */
62        void SetRenderPassType(RenderPassType t);
63        /** See Set
64        */
65        RenderPassType GetRenderPassType() const;
66        /** If alpha to coverage is instead of alpha testing
67        */
68        void SetUseAlphaToCoverage(bool useAlphaToCoverage);
69        /** If true, the current value of cull face enabled / disable will
70                not be changed by the render state.
71        */
72        void LockCullFaceEnabled(bool lockCull);
73       
74
75protected:
76
77        //////////////////
78
79        bool mAlphaTestEnabled;
80        bool mCullFaceEnabled;
81        bool mTexturesEnabled;
82
83        Mode mMode;
84
85        int mCurrentVboId;
86
87        RenderPassType mRenderType;
88
89        bool mUseAlphaToCoverage;
90
91        bool mLockCullFaceEnabled;
92
93        int mCurrentTexId;
94
95        ShaderProgram *mCurrentVertexProgram;
96        ShaderProgram *mCurrentFragmentProgram;
97
98        bool mFragmentProgramEnabled;
99        bool mVertexProgramEnabled;
100};
101
102
103}
104
105#endif // __RENDERSTATE_H
Note: See TracBrowser for help on using the repository browser.