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

Revision 3068, 2.2 KB checked in by mattausch, 16 years ago (diff)

working on dynamic stuff again

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/** Class representing the current render state.
16*/
17class RenderState
18{
19public:
20
21        enum Mode
22        {
23                QUERY,
24                RENDER
25        };
26
27        /** Constructor setting render as default state.
28        */
29        RenderState();
30        /** This must be called each time before and after an occlusion test.
31                Mode is one of render mode or query mode. Returns true if a state
32                change was issued.
33        */
34        bool SetMode(Mode mode);
35        /** Sets the current render state.
36        */
37        void SetState(Technique *tech);
38        /** Returns the current render state.
39        */
40        Technique *GetState() { return mCurrentTechnique; }
41        /** Returns either query or render mode
42        */
43        inline Mode GetMode() const { return mMode; }
44        /** Reset the state.
45        */
46        void Reset();
47        /** Stores the current vbo id.
48        */
49        inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
50        /** Returns the current vbo id.
51        */
52        inline int GetCurrentVboId() const { return mCurrentVboId; }
53        /** Sets the index of the render technique that is used to render a material.
54                Initially we use foreward = 0, deferred = 1, depth pass = 1
55        */
56        void SetRenderTechnique(int t);
57        /** See Set
58        */
59        int GetRenderTechnique() const;
60        /** If alpha to coverage is instead of alpha testing
61        */
62        void SetUseAlphaToCoverage(bool useAlphaToCoverage);
63        /** If true, the current value of cull face enabled / disable will
64                not be changed by the render state.
65        */
66        void LockCullFaceEnabled(bool lockCull);
67       
68
69protected:
70
71
72        //////////////////
73
74        bool mAlphaTestEnabled;
75        bool mCullFaceEnabled;
76        bool mTexturesEnabled;
77        /// Render or query mode
78        Mode mMode;
79
80        int mCurrentVboId;
81        /// the current render technique
82        int mRenderTechnique;
83
84        bool mUseAlphaToCoverage;
85
86        bool mLockCullFaceEnabled;
87
88        int mCurrentTexId;
89
90        ShaderProgram *mCurrentVertexProgram;
91        ShaderProgram *mCurrentFragmentProgram;
92
93        bool mFragmentProgramEnabled;
94        bool mVertexProgramEnabled;
95
96        bool mLightingEnabled;
97        bool mColorWriteEnabled;
98
99        Technique *mCurrentTechnique;
100        bool mDepthWriteEnabled;
101};
102
103
104}
105
106#endif // __RENDERSTATE_H
Note: See TracBrowser for help on using the repository browser.