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

Revision 2948, 1.9 KB checked in by mattausch, 16 years ago (diff)

depth pass for shadows not working at all

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                DEPTH_PASS_DEFERRED,
32                NUM_RENDER_TYPES
33        };
34
35        /** Constructor setting render as default state.
36        */
37        RenderState();
38       
39        ~RenderState() { Reset(); };
40
41        /** This must be called each time before and after an occlusion test.
42                Mode is one of render mode or query mode. Returns true if a state
43                change was issued.
44        */
45        bool SetState(Mode mode);
46        /** Sets the current render state.
47        */
48        void SetState(bool texturing, bool alphaTest, bool cullFace);
49        /** Returns either query or render mode
50        */
51        inline Mode GetMode() const { return mMode; }
52        /** Reset the state.
53        */
54        void Reset();
55        /** Stores the current vbo id.
56        */
57        inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
58        /** Returns the current vbo id.
59        */
60        inline int GetCurrentVboId() const { return mCurrentVboId; }
61        /** If alpha to coverage is instead of alpha testing
62        */
63        void SetUseAlphaToCoverage(bool useAlphaToCoverage);
64
65        void SetRenderType(RenderType type) { mRenderType = type; }
66        RenderType GetRenderType() const { return mRenderType; }
67
68
69        ///////////////////
70
71
72        ///////////////////
73        //-- for deferred shading, we have to switch shaders on and off
74
75        static CGprofile sCgFragmentProfile;
76        static CGprofile sCgVertexProfile;
77
78        static CGprogram sCgMrtFragmentProgram;
79        static CGprogram sCgMrtFragmentTexProgram;
80
81
82protected:
83
84        bool mAlphaTestEnabled;
85        bool mCullFaceEnabled;
86        bool mTexturesEnabled;
87
88        Mode mMode;
89
90        int mCurrentVboId;
91
92        RenderType mRenderType;
93
94        bool mUseAlphaToCoverage;
95};
96
97
98}
99
100#endif // __RENDERSTATE_H
Note: See TracBrowser for help on using the repository browser.