00001
00002 #ifndef RC_RENDERSTATE_H
00003 #define RC_RENDERSTATE_H
00004
00005
00006 #define STATE_DEPTH 0x01
00007 #define STATE_DEPTH_WRITE 0x02
00008 #define STATE_STENCIL 0x04
00009 #define STATE_BLEND 0x08
00010 #define STATE_CULL 0x10
00011 #define STATE_SCISSOR 0x20
00012 #define STATE_FRUSTUM_CULL 0x40
00013
00014
00015
00026 class RenderState {
00027 friend class SceneGraph;
00028
00029 friend class Renderer;
00030 #ifdef RC_OPENGL
00031 friend class RendererGL;
00032 #endif
00033
00034 friend class ShaderProgram;
00035
00036
00037
00038 public:
00039 RenderState();
00040
00041 ~RenderState();
00042
00043 public:
00044
00045
00046
00047 void enableDepthTest(
00048 StateCompare_t depth_test
00049 );
00050
00051 void disableDepthTest();
00052
00053
00054
00055
00056 void enableDepthWrite();
00057
00058 void disableDepthWrite();
00059
00060
00061
00062
00063 void enableStencil(
00064 StateCompare_t stencil_test,
00065 i32 ref,
00066 u32 mask
00067 );
00068
00069 void disableStencil();
00070
00071
00072
00073
00074 void enableBlend(
00075 StateSrcBlend_t src_blend,
00076 StateDstBlend_t dst_blend
00077 );
00078
00079 void disableBlend();
00080
00081
00082
00083
00084 void enableCulling(
00085 StateCulling_t cull_strategy
00086 );
00087
00088 void disableCulling();
00089
00090
00091
00092
00093 void enableFrustumCulling();
00094
00095 void disableFrustumCulling();
00096
00097
00098
00099
00100 void enableScissor(
00101 i32 x,
00102 i32 y,
00103 u32 width,
00104 u32 height
00105 );
00106
00107 void disableScissor();
00108
00110 void setDefault();
00111
00112
00113
00114
00115 private:
00116 i32 stencilRef;
00117 u32 stencilMask;
00118 StateCompare_t stencilTest;
00119
00120 StateCompare_t depthTest;
00121
00122 StateSrcBlend_t srcBlend;
00123 StateDstBlend_t dstBlend;
00124
00125 StateCulling_t cull;
00126
00127 i32 scissorX, scissorY;
00128 u32 scissorW, scissorH;
00129
00130 u8 flags;
00131
00132 };
00133
00134
00135 #endif
00136