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

Revision 2854, 1.7 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#include "glInterface.h"
7#include <Cg/cg.h>
8#include <Cg/cgGL.h>
9
10
11namespace CHCDemoEngine
12{
13
14/** The current render state.
15*/
16class RenderState
17{
18public:
19
20        enum Mode
21        {
22                QUERY,
23                RENDER
24        };
25
26        enum RenderType
27        {
28                FIXED,
29                DEPTH_PASS,
30                DEFERRED
31        };
32
33        /** Constructor setting render as default state.
34        */
35        RenderState();
36       
37        ~RenderState() { Reset(); };
38
39        /** This must be called each time before and after an occlusion test.
40                Mode is one of render mode or query mode. Returns true if a state
41                change was issued.
42        */
43        bool SetState(Mode mode);
44        /** Sets the current render state.
45        */
46        void SetState(bool texturing, bool alphaTest, bool cullFace);
47        /** Returns either query or render mode
48        */
49        inline Mode GetMode() const { return mMode; }
50        /** Reset the state.
51        */
52        void Reset();
53        /** Stores the current vbo id.
54        */
55        inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
56        /** Returns the current vbo id.
57        */
58        inline int GetCurrentVboId() const { return mCurrentVboId; }
59
60        void SetRenderType(RenderType type) { mRenderType = type; }
61        RenderType GetRenderType() const { return mRenderType; }
62
63
64        ///////////////////
65
66
67        ///////////////////
68        //-- for deferred shading, we have to switch shaders on and off
69
70        static CGprofile sCgFragmentProfile;
71        static CGprofile sCgVertexProfile;
72
73        static CGprogram sCgMrtFragmentProgram;
74        static CGprogram sCgMrtFragmentTexProgram;
75
76
77protected:
78
79        bool mAlphaTestEnabled;
80        bool mCullFaceEnabled;
81        bool mTexturesEnabled;
82
83        Mode mMode;
84
85        int mCurrentVboId;
86
87        RenderType mRenderType;
88};
89
90
91}
92
93#endif // __RENDERSTATE_H
Note: See TracBrowser for help on using the repository browser.