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

Revision 3047, 2.0 KB checked in by mattausch, 16 years ago (diff)

adding special technique for depth pass (not working yet)

RevLine 
[2769]1#ifndef __RENDERSTATE_H
2#define __RENDERSTATE_H
3
4
5#include "common.h"
6
7
[2776]8namespace CHCDemoEngine
[2769]9{
10
[3028]11class ShaderProgram;
12class Texture;
[3034]13class Material;
[3028]14
[2769]15/** The current render state.
16*/
17class RenderState
18{
19public:
20
21        enum Mode
22        {
23                QUERY,
24                RENDER
25        };
26
[2955]27        /// the used render type for this render pass
28        enum RenderPassType
[2825]29        {
[3043]30                FORWARD,
[2825]31                DEPTH_PASS,
[2955]32                DEFERRED
[2825]33        };
34
[2769]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        */
[3031]44        bool SetMode(Mode mode);
[2769]45        /** Sets the current render state.
46        */
[3042]47        void SetState(Technique *tech);
[2854]48        /** Returns either query or render mode
[2769]49        */
50        inline Mode GetMode() const { return mMode; }
51        /** Reset the state.
52        */
53        void Reset();
[2773]54        /** Stores the current vbo id.
55        */
56        inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
57        /** Returns the current vbo id.
58        */
[2854]59        inline int GetCurrentVboId() const { return mCurrentVboId; }
[2955]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;
[3034]66        /** If alpha to coverage is instead of alpha testing
67        */
68        void SetUseAlphaToCoverage(bool useAlphaToCoverage);
[2955]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);
[3034]73       
[2854]74
[2769]75protected:
76
[3034]77        //////////////////
78
[2769]79        bool mAlphaTestEnabled;
[2844]80        bool mCullFaceEnabled;
[2769]81        bool mTexturesEnabled;
82
83        Mode mMode;
[2773]84
85        int mCurrentVboId;
[2801]86
[2955]87        RenderPassType mRenderType;
[2943]88
89        bool mUseAlphaToCoverage;
[2955]90
91        bool mLockCullFaceEnabled;
[3034]92
93        int mCurrentTexId;
94
95        ShaderProgram *mCurrentVertexProgram;
96        ShaderProgram *mCurrentFragmentProgram;
[3043]97
98        bool mFragmentProgramEnabled;
99        bool mVertexProgramEnabled;
[3047]100
101        bool mUseLighting;
102        bool mColorWriteEnabled;
[2769]103};
104
105
106}
107
108#endif // __RENDERSTATE_H
Note: See TracBrowser for help on using the repository browser.