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

Revision 3114, 2.2 KB checked in by mattausch, 16 years ago (diff)

worked on dynamic objects: now ook, but have to work on render queue

RevLine 
[2769]1#ifndef __RENDERSTATE_H
2#define __RENDERSTATE_H
3
4
5#include "common.h"
6
7
[2776]8namespace CHCDemoEngine
[2769]9{
10
[3028]11class ShaderProgram;
12class Texture;
[3034]13class Material;
[3028]14
[3061]15/** Class representing the current render state.
[2769]16*/
17class RenderState
18{
19public:
20
21        enum Mode
22        {
23                QUERY,
24                RENDER
25        };
26
27        /** Constructor setting render as default state.
28        */
29        RenderState();
30        /** This must be called each time before and after an occlusion test.
31                Mode is one of render mode or query mode. Returns true if a state
32                change was issued.
33        */
[3031]34        bool SetMode(Mode mode);
[3114]35        /** Sets the current render state with the current technique + scene entity
[2769]36        */
[3114]37        void SetState(Technique *tech, SceneEntity *ent = NULL);
[3066]38        /** Returns the current render state.
39        */
40        Technique *GetState() { return mCurrentTechnique; }
[2854]41        /** Returns either query or render mode
[2769]42        */
43        inline Mode GetMode() const { return mMode; }
44        /** Reset the state.
45        */
46        void Reset();
[2773]47        /** Stores the current vbo id.
48        */
49        inline void SetCurrentVboId(int id) { mCurrentVboId = id; }
50        /** Returns the current vbo id.
51        */
[2854]52        inline int GetCurrentVboId() const { return mCurrentVboId; }
[3068]53        /** Sets the index of the render technique that is used to render a material.
54                Initially we use foreward = 0, deferred = 1, depth pass = 1
[2955]55        */
[3068]56        void SetRenderTechnique(int t);
[2955]57        /** See Set
58        */
[3068]59        int GetRenderTechnique() const;
[3034]60        /** If alpha to coverage is instead of alpha testing
61        */
62        void SetUseAlphaToCoverage(bool useAlphaToCoverage);
[2955]63        /** If true, the current value of cull face enabled / disable will
64                not be changed by the render state.
65        */
66        void LockCullFaceEnabled(bool lockCull);
[3034]67       
[2854]68
[2769]69protected:
70
[3050]71
[3034]72        //////////////////
73
[2769]74        bool mAlphaTestEnabled;
[2844]75        bool mCullFaceEnabled;
[2769]76        bool mTexturesEnabled;
[3055]77        /// Render or query mode
[2769]78        Mode mMode;
[2773]79
80        int mCurrentVboId;
[3048]81        /// the current render technique
[3068]82        int mRenderTechnique;
[2801]83
[2943]84        bool mUseAlphaToCoverage;
[2955]85
86        bool mLockCullFaceEnabled;
[3034]87
88        int mCurrentTexId;
89
90        ShaderProgram *mCurrentVertexProgram;
91        ShaderProgram *mCurrentFragmentProgram;
[3043]92
93        bool mFragmentProgramEnabled;
94        bool mVertexProgramEnabled;
[3047]95
[3048]96        bool mLightingEnabled;
[3047]97        bool mColorWriteEnabled;
[3050]98
99        Technique *mCurrentTechnique;
100        bool mDepthWriteEnabled;
[2769]101};
102
103
104}
105
106#endif // __RENDERSTATE_H
Note: See TracBrowser for help on using the repository browser.