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 |
|
---|
11 | namespace CHCDemoEngine
|
---|
12 | {
|
---|
13 |
|
---|
14 | /** The current render state.
|
---|
15 | */
|
---|
16 | class RenderState
|
---|
17 | {
|
---|
18 | public:
|
---|
19 |
|
---|
20 | enum Mode
|
---|
21 | {
|
---|
22 | QUERY,
|
---|
23 | RENDER
|
---|
24 | };
|
---|
25 |
|
---|
26 | /** Constructor setting render as default state.
|
---|
27 | */
|
---|
28 | RenderState();
|
---|
29 |
|
---|
30 | ~RenderState() { Reset(); };
|
---|
31 |
|
---|
32 | /** This must be called each time before and after an occlusion test.
|
---|
33 | Mode is one of render mode or query mode. Returns true if a state
|
---|
34 | change was issued.
|
---|
35 | */
|
---|
36 | bool SetState(Mode mode);
|
---|
37 | /** Sets the current render state.
|
---|
38 | */
|
---|
39 | void SetState(bool texturing, bool alphaTest);
|
---|
40 | /** Returns wether we are in query or render mode
|
---|
41 | */
|
---|
42 | inline Mode GetMode() const { return mMode; }
|
---|
43 | /** Reset the state.
|
---|
44 | */
|
---|
45 | void Reset();
|
---|
46 | /** Stores the current vbo id.
|
---|
47 | */
|
---|
48 | inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
|
---|
49 | /** Returns the current vbo id.
|
---|
50 | */
|
---|
51 | inline int GetCurrentVboId() { return mCurrentVboId; }
|
---|
52 |
|
---|
53 | void SetDepthPass(bool depthPass) { mIsDepthPass = depthPass; }
|
---|
54 | bool IsDepthPass() { return mIsDepthPass; }
|
---|
55 |
|
---|
56 | static CGprofile sCgFragmentProfile;
|
---|
57 | static CGprofile sCgVertexProfile;
|
---|
58 |
|
---|
59 | static CGprogram sCgMrtFragmentProgram;
|
---|
60 | static CGprogram sCgMrtFragmentTexProgram;
|
---|
61 |
|
---|
62 |
|
---|
63 | protected:
|
---|
64 |
|
---|
65 | bool mAlphaTestEnabled;
|
---|
66 | bool mTexturesEnabled;
|
---|
67 |
|
---|
68 | Mode mMode;
|
---|
69 |
|
---|
70 | int mCurrentVboId;
|
---|
71 |
|
---|
72 | bool mIsDepthPass;
|
---|
73 | };
|
---|
74 |
|
---|
75 |
|
---|
76 | }
|
---|
77 |
|
---|
78 | #endif // __RENDERSTATE_H |
---|
Note: See
TracBrowser
for help on using the repository browser.