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

Revision 2844, 1.6 KB checked in by mattausch, 16 years ago (diff)

lod starting to work

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 wether we are in 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() { return mCurrentVboId; }
59
60        void SetRenderType(RenderType type) { mRenderType = type; }
61        RenderType GetRenderType() { return mRenderType; }
62
63
64        ///////////////////
65
66        static CGprofile sCgFragmentProfile;
67        static CGprofile sCgVertexProfile;
68
69        static CGprogram sCgMrtFragmentProgram;
70        static CGprogram sCgMrtFragmentTexProgram;
71
72
73protected:
74
75        bool mAlphaTestEnabled;
76        bool mCullFaceEnabled;
77        bool mTexturesEnabled;
78
79        Mode mMode;
80
81        int mCurrentVboId;
82
83        RenderType mRenderType;
84};
85
86
87}
88
89#endif // __RENDERSTATE_H
Note: See TracBrowser for help on using the repository browser.