00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLRENDERER_RENDERSTATES_H__
00024 #define __PLRENDERER_RENDERSTATES_H__
00025 #pragma once
00026
00027
00028
00029
00030
00031 #include <PLCore/Base/Object.h>
00032 #include "PLRenderer/PLRenderer.h"
00033 #include "PLRenderer/Renderer/Types.h"
00034
00035
00036
00037
00038
00039 namespace PLRenderer {
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 class RenderStates : public PLCore::Object {
00050
00051
00052
00053
00054
00055 pl_class(PLRENDERER_RTTI_EXPORT, RenderStates, "PLRenderer", PLCore::Object, "Render states RTTI wrapper class")
00056
00057
00058 pl_attribute(FillMode, pl_enum_type(Fill::Enum), Fill::Solid, ReadWrite, GetSet, "Fill mode", "")
00059 pl_attribute(CullMode, pl_enum_type(Cull::Enum), Cull::CCW, ReadWrite, GetSet, "Cull mode", "")
00060
00061 pl_attribute(ZEnable, bool, true, ReadWrite, GetSet, "Enable/disable z buffer test", "")
00062 pl_attribute(ZWriteEnable, bool, true, ReadWrite, GetSet, "Enable/disable z buffer writing", "")
00063 pl_attribute(ZFunc, pl_enum_type(Compare::Enum), Compare::LessEqual, ReadWrite, GetSet, "Z buffer function", "")
00064 pl_attribute(ZBias, float, 0.0f, ReadWrite, GetSet, "Z bias/polygon offset factor", "")
00065 pl_attribute(SlopeScaleDepthBias, float, 0.0f, ReadWrite, GetSet, "Slope scale bias/polygon offset factor", "")
00066 pl_attribute(DepthBias, float, 0.0f, ReadWrite, GetSet, "Depth bias/polygon offset units", "")
00067
00068 pl_attribute(BlendEnable, bool, false, ReadWrite, GetSet, "Enable/disable blending", "")
00069 pl_attribute(SrcBlendFunc, pl_enum_type(BlendFunc::Enum), BlendFunc::SrcAlpha, ReadWrite, GetSet, "Source blend function", "")
00070 pl_attribute(DstBlendFunc, pl_enum_type(BlendFunc::Enum), BlendFunc::InvSrcAlpha, ReadWrite, GetSet, "Destination blend function", "")
00071
00072 pl_attribute(StencilEnable, bool, false, ReadWrite, GetSet, "Enable/disable stencil test", "")
00073 pl_attribute(StencilFunc, pl_enum_type(Compare::Enum), Compare::Always, ReadWrite, GetSet, "Stencil test passes if ((ref & mask) stencilfn (stencil & mask)) is true", "")
00074 pl_attribute(StencilRef, PLCore::uint32, 0, ReadWrite, GetSet, "Reference value used in stencil test", "")
00075 pl_attribute(StencilMask, PLCore::uint32, 0xFFFFFFFF, ReadWrite, GetSet, "Mask value used in stencil test", "")
00076 pl_attribute(StencilFail, pl_enum_type(StencilOp::Enum), StencilOp::Keep, ReadWrite, GetSet, "Operation to perform if stencil test fails", "")
00077 pl_attribute(StencilZFail, pl_enum_type(StencilOp::Enum), StencilOp::Keep, ReadWrite, GetSet, "Operation to perform if stencil test passes and Z test fails", "")
00078 pl_attribute(StencilPass, pl_enum_type(StencilOp::Enum), StencilOp::Keep, ReadWrite, GetSet, "Operation to perform if both stencil and Z tests pass", "")
00079 pl_attribute(TwoSidedStencilMode, bool, false, ReadWrite, GetSet, "Enable/disable 2 sided stenciling", "")
00080 pl_attribute(CCWStencilFunc, pl_enum_type(Compare::Enum), Compare::Always, ReadWrite, GetSet, "Stencil test passes if ((ref & mask) stencilfn (stencil & mask)) is true", "")
00081 pl_attribute(CCWStencilFail, pl_enum_type(StencilOp::Enum), StencilOp::Keep, ReadWrite, GetSet, "Operation to perform if ccw stencil test fails", "")
00082 pl_attribute(CCWStencilZFail, pl_enum_type(StencilOp::Enum), StencilOp::Keep, ReadWrite, GetSet, "Operation to perform if ccw stencil test passes and Z test fails", "")
00083 pl_attribute(CCWStencilPass, pl_enum_type(StencilOp::Enum), StencilOp::Keep, ReadWrite, GetSet, "Operation to perform if both ccw stencil and Z tests pass", "")
00084
00085 pl_attribute(PointSize, float, 1.0f, ReadWrite, GetSet, "Point size when it is not specified for each vertex", "")
00086 pl_attribute(PointScaleEnable, bool, false, ReadWrite, GetSet, "Controls computation of size for point primitives", "")
00087 pl_attribute(PointSizeMin, float, 1.0f, ReadWrite, GetSet, "Minimum size of point primitives", "")
00088 pl_attribute(PointSizeMax, float, 64.0f, ReadWrite, GetSet, "Maximum size of point primitives, must be greater than or equal to m_fPointSizeMin", "")
00089 pl_attribute(PointScaleA, float, 1.0f, ReadWrite, GetSet, "Controls for distance-based size attenuation for point primitives", "")
00090 pl_attribute(PointScaleB, float, 0.0f, ReadWrite, GetSet, "Controls for distance-based size attenuation for point primitives", "")
00091 pl_attribute(PointScaleC, float, 0.0f, ReadWrite, GetSet, "Controls for distance-based size attenuation for point primitives", "")
00092 pl_attribute(LineWidth, float, 1.0f, ReadWrite, GetSet, "Line width", "")
00093
00094 pl_attribute(TessellationFactor, PLCore::uint32, 1, ReadWrite, GetSet, "Tessellation factor", "Min=1")
00095
00096
00097
00098 pl_attribute(PointSpriteEnable, bool, false, ReadWrite, GetSet, "When true, use point texture mapping", "")
00099 pl_attribute(DitherEnable, bool, false, ReadWrite, GetSet, "Enable/disable dithering", "")
00100 pl_attribute(ScissorTestEnable, bool, false, ReadWrite, GetSet, "Enable/disable the scissor test", "")
00101 pl_attribute(MultisampleEnable, bool, true, ReadWrite, GetSet, "When true, use multisample", "")
00102 pl_attribute(InvCullMode, bool, false, ReadWrite, GetSet, "Controls computation of size for point primitives", "")
00103 pl_attribute(FixedFillMode, pl_enum_type(Fill::Enum), Fill::Unknown, ReadWrite, GetSet, "General fill mode which is normally set once", "")
00104 pl_class_end
00105
00106
00107
00108
00109
00110 public:
00111
00112 inline Fill::Enum GetFillMode() const;
00113 inline void SetFillMode(Fill::Enum nValue);
00114 inline Cull::Enum GetCullMode() const;
00115 inline void SetCullMode(Cull::Enum nValue);
00116
00117 inline bool GetZEnable() const;
00118 inline void SetZEnable(bool bValue);
00119 inline bool GetZWriteEnable() const;
00120 inline void SetZWriteEnable(bool bValue);
00121 inline Compare::Enum GetZFunc() const;
00122 inline void SetZFunc(Compare::Enum nValue);
00123 inline float GetZBias() const;
00124 inline void SetZBias(float fValue);
00125 inline float GetSlopeScaleDepthBias() const;
00126 inline void SetSlopeScaleDepthBias(float fValue);
00127 inline float GetDepthBias() const;
00128 inline void SetDepthBias(float fValue);
00129
00130 inline bool GetBlendEnable() const;
00131 inline void SetBlendEnable(bool bValue);
00132 inline BlendFunc::Enum GetSrcBlendFunc() const;
00133 inline void SetSrcBlendFunc(BlendFunc::Enum nValue);
00134 inline BlendFunc::Enum GetDstBlendFunc() const;
00135 inline void SetDstBlendFunc(BlendFunc::Enum nValue);
00136
00137 inline bool GetStencilEnable() const;
00138 inline void SetStencilEnable(bool bValue);
00139 inline Compare::Enum GetStencilFunc() const;
00140 inline void SetStencilFunc(Compare::Enum nValue);
00141 inline PLCore::uint32 GetStencilRef() const;
00142 inline void SetStencilRef(PLCore::uint32 nValue);
00143 inline PLCore::uint32 GetStencilMask() const;
00144 inline void SetStencilMask(PLCore::uint32 nValue);
00145 inline StencilOp::Enum GetStencilFail() const;
00146 inline void SetStencilFail(StencilOp::Enum nValue);
00147 inline StencilOp::Enum GetStencilZFail() const;
00148 inline void SetStencilZFail(StencilOp::Enum nValue);
00149 inline StencilOp::Enum GetStencilPass() const;
00150 inline void SetStencilPass(StencilOp::Enum nValue);
00151 inline bool GetTwoSidedStencilMode() const;
00152 inline void SetTwoSidedStencilMode(bool bValue);
00153 inline Compare::Enum GetCCWStencilFunc() const;
00154 inline void SetCCWStencilFunc(Compare::Enum nValue);
00155 inline StencilOp::Enum GetCCWStencilFail() const;
00156 inline void SetCCWStencilFail(StencilOp::Enum nValue);
00157 inline StencilOp::Enum GetCCWStencilZFail() const;
00158 inline void SetCCWStencilZFail(StencilOp::Enum nValue);
00159 inline StencilOp::Enum GetCCWStencilPass() const;
00160 inline void SetCCWStencilPass(StencilOp::Enum nValue);
00161
00162 inline float GetPointSize() const;
00163 inline void SetPointSize(float fValue);
00164 inline bool GetPointScaleEnable() const;
00165 inline void SetPointScaleEnable(bool bValue);
00166 inline float GetPointSizeMin() const;
00167 inline void SetPointSizeMin(float fValue);
00168 inline float GetPointSizeMax() const;
00169 inline void SetPointSizeMax(float fValue);
00170 inline float GetPointScaleA() const;
00171 inline void SetPointScaleA(float fValue);
00172 inline float GetPointScaleB() const;
00173 inline void SetPointScaleB(float fValue);
00174 inline float GetPointScaleC() const;
00175 inline void SetPointScaleC(float fValue);
00176 inline float GetLineWidth() const;
00177 inline void SetLineWidth(float fValue);
00178
00179 inline PLCore::uint32 GetTessellationFactor() const;
00180 inline void SetTessellationFactor(PLCore::uint32 nValue);
00181
00182
00183
00184
00185
00186
00187 inline bool GetPointSpriteEnable() const;
00188 inline void SetPointSpriteEnable(bool bValue);
00189 inline bool GetDitherEnable() const;
00190 inline void SetDitherEnable(bool bValue);
00191 inline bool GetScissorTestEnable() const;
00192 inline void SetScissorTestEnable(bool bValue);
00193 inline bool GetMultisampleEnable() const;
00194 inline void SetMultisampleEnable(bool bValue);
00195 inline bool GetInvCullMode() const;
00196 inline void SetInvCullMode(bool bValue);
00197 inline Fill::Enum GetFixedFillMode() const;
00198 inline void SetFixedFillMode(Fill::Enum nValue);
00199
00200
00201
00202
00203
00204 public:
00205
00206
00207
00208
00209 PLRENDERER_API RenderStates();
00210
00211
00212
00213
00214
00215
00216
00217
00218 PLRENDERER_API RenderStates(const RenderStates &cSource);
00219
00220
00221
00222
00223
00224 PLRENDERER_API virtual ~RenderStates();
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241 inline PLCore::uint32 Get(RenderState::Enum nState) const;
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260 inline bool Set(RenderState::Enum nState, PLCore::uint32 nValue);
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272 inline RenderStates &operator =(const RenderStates &cSource);
00273
00274
00275
00276
00277
00278 private:
00279
00280 PLCore::uint32 m_nRS[RenderState::Number];
00281
00282
00283 };
00284
00285
00286
00287
00288
00289 }
00290
00291
00292
00293
00294
00295 #include "PLRenderer/Renderer/RenderStates.inl"
00296
00297
00298 #endif // __PLRENDERER_RENDERSTATES_H__