Rev | Line | |
---|
[2769] | 1 | #ifndef __RENDERSTATE_H
|
---|
| 2 | #define __RENDERSTATE_H
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | #include "common.h"
|
---|
| 6 |
|
---|
| 7 |
|
---|
[2776] | 8 | namespace CHCDemoEngine
|
---|
[2769] | 9 | {
|
---|
| 10 |
|
---|
| 11 | /** The current render state.
|
---|
| 12 | */
|
---|
| 13 | class RenderState
|
---|
| 14 | {
|
---|
| 15 | public:
|
---|
| 16 |
|
---|
| 17 | enum Mode
|
---|
| 18 | {
|
---|
| 19 | QUERY,
|
---|
| 20 | RENDER
|
---|
| 21 | };
|
---|
| 22 |
|
---|
| 23 | /** Constructor setting render as default state.
|
---|
| 24 | */
|
---|
| 25 | RenderState();
|
---|
| 26 |
|
---|
| 27 | ~RenderState() { Reset(); };
|
---|
| 28 |
|
---|
| 29 | /** This must be called each time before and after an occlusion test.
|
---|
| 30 | Mode is one of render mode or query mode. Returns true if a state
|
---|
| 31 | change was issued.
|
---|
| 32 | */
|
---|
| 33 | bool SetState(Mode mode);
|
---|
| 34 | /** Sets the current render state.
|
---|
| 35 | */
|
---|
| 36 | void SetState(bool texturing, bool alphaTest);
|
---|
| 37 | /** Returns wether we are in query or render mode
|
---|
| 38 | */
|
---|
| 39 | inline Mode GetMode() const { return mMode; }
|
---|
| 40 | /** Reset the state.
|
---|
| 41 | */
|
---|
| 42 | void Reset();
|
---|
[2773] | 43 | /** Stores the current vbo id.
|
---|
| 44 | */
|
---|
| 45 | inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
|
---|
| 46 | /** Returns the current vbo id.
|
---|
| 47 | */
|
---|
| 48 | inline int GetCurrentVboId() { return mCurrentVboId; }
|
---|
[2769] | 49 |
|
---|
[2801] | 50 | void SetDepthPass(bool depthPass) { mIsDepthPass = depthPass; }
|
---|
| 51 | bool IsDepthPass() { return mIsDepthPass; }
|
---|
[2800] | 52 |
|
---|
[2769] | 53 | protected:
|
---|
| 54 |
|
---|
| 55 | bool mAlphaTestEnabled;
|
---|
| 56 | bool mTexturesEnabled;
|
---|
| 57 |
|
---|
| 58 | Mode mMode;
|
---|
[2773] | 59 |
|
---|
| 60 | int mCurrentVboId;
|
---|
[2801] | 61 |
|
---|
| 62 | bool mIsDepthPass;
|
---|
[2769] | 63 | };
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | #endif // __RENDERSTATE_H |
---|
Note: See
TracBrowser
for help on using the repository browser.