153
153
void CheckRenderStatesConformity();
156
void SetRenderStates(t_u32 rs, t_u32 value);
156
void SetRenderStates(unsigned int rs, unsigned int value);
159
159
inline void SetAlphaTest(
160
160
bool EnableAlphaTest_,
161
t_u32 AlphaTestFunc_ = GL_ALWAYS,
161
unsigned int AlphaTestFunc_ = GL_ALWAYS,
162
162
BYTE AlphaTestRef_ = 0);
164
164
inline void SetBlend(bool AlphaBlendEnable_);
165
165
inline void SetBlend(bool AlphaBlendEnable_,
166
t_u32 SrcBlendFactor_ /*= GL_ONE*/,
167
t_u32 DestBlendFactor_ /*= GL_ZERO*/);
166
unsigned int SrcBlendFactor_ /*= GL_ONE*/,
167
unsigned int DestBlendFactor_ /*= GL_ZERO*/);
169
inline void GetBlend(t_u32& AlphaBlendEnable_,
170
t_u32& SrcBlendFactor_,
171
t_u32& DestBlendFactor_);
169
inline void GetBlend(unsigned int& AlphaBlendEnable_,
170
unsigned int& SrcBlendFactor_,
171
unsigned int& DestBlendFactor_);
173
173
inline void SetSeparateBlend(bool _bEnable,
174
t_u32 SrcBlendFactor_ /*= GL_ONE*/,
175
t_u32 DestBlendFactor_ /*= GL_ZERO*/,
176
t_u32 SrcFactorAlpha_ /*= GL_ONE*/,
177
t_u32 DestFactorAlpha_ /*= GL_ZERO*/);
174
unsigned int SrcBlendFactor_ /*= GL_ONE*/,
175
unsigned int DestBlendFactor_ /*= GL_ZERO*/,
176
unsigned int SrcFactorAlpha_ /*= GL_ONE*/,
177
unsigned int DestFactorAlpha_ /*= GL_ZERO*/);
179
179
inline void SetPremultipliedBlend(PorterDuffOperator op);
181
181
inline void SetBlendOp(
182
t_u32 BlendOp = GL_FUNC_ADD);
182
unsigned int BlendOp = GL_FUNC_ADD);
184
184
inline void SetSeparateBlendOp(
185
t_u32 BlendOpRGB_ = GL_FUNC_ADD,
186
t_u32 BlendOpAlpha_ = GL_FUNC_ADD);
185
unsigned int BlendOpRGB_ = GL_FUNC_ADD,
186
unsigned int BlendOpAlpha_ = GL_FUNC_ADD);
188
188
inline void SetCullMode(bool EnableCullFace,
189
t_u32 FrontFace_ = GL_CCW,
190
t_u32 Cullface_ = GL_BACK);
189
unsigned int FrontFace_ = GL_CCW,
190
unsigned int Cullface_ = GL_BACK);
192
192
inline void SetDepthTest(bool EnableDepthTest,
193
t_u32 WriteEnable_ = GL_TRUE,
194
t_u32 DepthFunc_ = GL_LEQUAL);
193
unsigned int WriteEnable_ = GL_TRUE,
194
unsigned int DepthFunc_ = GL_LEQUAL);
196
196
inline void SetDepthRange(
197
197
float zNear = 0.0f,
201
201
inline void SetStencil(bool enable_stencil);
202
inline void SetStencilFunc(t_u32 func, int ref, t_u32 mask);
203
inline void SetStencilOp(t_u32 stencil_fail, t_u32 stencil_pass_depth_fail, t_u32 stencil_pass_depth_pass);
202
inline void SetStencilFunc(unsigned int func, int ref, unsigned int mask);
203
inline void SetStencilOp(unsigned int stencil_fail, unsigned int stencil_pass_depth_fail, unsigned int stencil_pass_depth_pass);
206
206
// If two sided stencil is not activated, the setting is also used for the back face.
207
207
inline void SetStencilFrontFace(
208
208
bool EnableStencil_, // GL_TRUE enable stencil test
209
t_u32 Func_ = GL_ALWAYS,
210
t_u32 FailOp_ = GL_KEEP,
211
t_u32 ZFailOp_ = GL_KEEP,
212
t_u32 ZPassOp_ = GL_KEEP,
214
t_u32 Mask_ = 0xffffffff);
209
unsigned int Func_ = GL_ALWAYS,
210
unsigned int FailOp_ = GL_KEEP,
211
unsigned int ZFailOp_ = GL_KEEP,
212
unsigned int ZPassOp_ = GL_KEEP,
213
unsigned int Ref_ = 0,
214
unsigned int Mask_ = 0xffffffff);
216
216
// Set stencil test for the back face.
217
217
inline void SetStencilBackFace(
218
218
bool EnableTwoSideStencil_, // GL_TRUE enable Two Sided Stencil test
219
t_u32 Func_ = GL_ALWAYS,
220
t_u32 FailOp_ = GL_KEEP,
221
t_u32 ZFailOp_ = GL_KEEP,
222
t_u32 ZPassOp_ = GL_KEEP,
224
t_u32 Mask_ = 0xffffffff);
219
unsigned int Func_ = GL_ALWAYS,
220
unsigned int FailOp_ = GL_KEEP,
221
unsigned int ZFailOp_ = GL_KEEP,
222
unsigned int ZPassOp_ = GL_KEEP,
223
unsigned int Ref_ = 0,
224
unsigned int Mask_ = 0xffffffff);
226
226
inline void SetFrontFaceStencilWriteMask(
227
t_u32 WriteMask_ = 0xffffffff);
227
unsigned int WriteMask_ = 0xffffffff);
229
229
inline void SetBackFaceStencilWriteMask(
230
t_u32 WriteMask_ = 0xffffffff);
230
unsigned int WriteMask_ = 0xffffffff);
233
233
inline void EnableLineSmooth(
234
234
bool EnableLineSmooth = TRUE,
236
t_u32 HINT = GL_FASTEST);
235
unsigned int LineWidth = 1,
236
unsigned int HINT = GL_FASTEST);
238
238
inline void EnablePointSmooth(
239
239
bool EnablePointSmooth = TRUE,
241
t_u32 HINT = GL_FASTEST);
240
unsigned int PointSize = 1,
241
unsigned int HINT = GL_FASTEST);
243
243
inline void SetColorMask(
247
t_u32 bAlpha = TRUE);
244
unsigned int bRed = TRUE,
245
unsigned int bGreen = TRUE,
246
unsigned int bBlue = TRUE,
247
unsigned int bAlpha = TRUE);
249
249
inline void GetColorMask(
251
unsigned int& bGreen,
253
unsigned int& bAlpha);
255
inline void SetDepthMask(t_u32 bDepth = TRUE);
255
inline void SetDepthMask(unsigned int bDepth = TRUE);
257
inline void EnableScissor(t_u32 bScissor = FALSE);
258
inline void EnableFog(t_u32 bFog = FALSE);
257
inline void EnableScissor(unsigned int bScissor = FALSE);
258
inline void EnableFog(unsigned int bFog = FALSE);
259
259
#ifndef NUX_OPENGLES_20
260
inline void SetPolygonMode(t_u32 FrontMode = GL_FILL, t_u32 BackMode = GL_FILL);
260
inline void SetPolygonMode(unsigned int FrontMode = GL_FILL, unsigned int BackMode = GL_FILL);
262
inline void SetPolygonMode(t_u32 FrontMode, t_u32 BackMode);
262
inline void SetPolygonMode(unsigned int FrontMode, unsigned int BackMode);
265
inline void SetPolygonOffset(t_u32 bEnable,
265
inline void SetPolygonOffset(unsigned int bEnable,
266
266
float Factor = 0.0f, float Units = 0.0f);
270
270
GpuBrand _gpu_brand;
271
271
GpuInfo *_gpu_info;
273
inline void HW__EnableAlphaTest(t_u32 b);
273
inline void HW__EnableAlphaTest(unsigned int b);
275
275
inline void HW__SetAlphaTestFunc(
276
t_u32 AlphaTestFunc_,
276
unsigned int AlphaTestFunc_,
277
277
BYTE AlphaTestRef_);
279
inline void HW__EnableAlphaBlend(t_u32 b);
279
inline void HW__EnableAlphaBlend(unsigned int b);
281
inline void HW__SetSeparateAlphaBlend_Enable(t_u32 b);
281
inline void HW__SetSeparateAlphaBlend_Enable(unsigned int b);
283
283
inline void HW__SetSeparateAlphaBlendFactors(
284
t_u32 SrcBlendFactor_,
285
t_u32 DestBlendFactor_,
286
t_u32 SrcFactorAlpha_,
287
t_u32 DestFactorAlpha_);
289
inline void HW__SetAlphaBlendOp(t_u32 BlendOpRGB_,
290
t_u32 BlendOpAlpha_);
292
inline void HW__EnableCulling(t_u32 b);
294
inline void HW__SetFrontFace(t_u32 FrontFace_);
296
inline void HW__SetCullFace(t_u32 CullFace_);
298
inline void HW__SetEnableDepthTest(t_u32 b);
299
inline void HW__SetDepthFunc(t_u32 Func);
284
unsigned int SrcBlendFactor_,
285
unsigned int DestBlendFactor_,
286
unsigned int SrcFactorAlpha_,
287
unsigned int DestFactorAlpha_);
289
inline void HW__SetAlphaBlendOp(unsigned int BlendOpRGB_,
290
unsigned int BlendOpAlpha_);
292
inline void HW__EnableCulling(unsigned int b);
294
inline void HW__SetFrontFace(unsigned int FrontFace_);
296
inline void HW__SetCullFace(unsigned int CullFace_);
298
inline void HW__SetEnableDepthTest(unsigned int b);
299
inline void HW__SetDepthFunc(unsigned int Func);
300
300
inline void HW__SetDepthRange(float zNear, float zFar);
303
inline void HW__EnableStencil(t_u32 b);
304
inline void HW__SetStencilOp(t_u32 FailOp_, t_u32 ZFailOp_, t_u32 ZPassOp_);
305
inline void HW__SetStencilFunc(t_u32 func, int ref, t_u32 mask);
303
inline void HW__EnableStencil(unsigned int b);
304
inline void HW__SetStencilOp(unsigned int FailOp_, unsigned int ZFailOp_, unsigned int ZPassOp_);
305
inline void HW__SetStencilFunc(unsigned int func, int ref, unsigned int mask);
308
inline void HW__EnableTwoSidedStencil(t_u32 b);
309
inline void HW__SetStencilFrontFaceWriteMask(t_u32 WriteMask_);
310
inline void HW__SetStencilBackFaceWriteMask(t_u32 WriteMask_);
308
inline void HW__EnableTwoSidedStencil(unsigned int b);
309
inline void HW__SetStencilFrontFaceWriteMask(unsigned int WriteMask_);
310
inline void HW__SetStencilBackFaceWriteMask(unsigned int WriteMask_);
312
inline void HW__SetFrontFaceStencilFunc(t_u32 Func_,
312
inline void HW__SetFrontFaceStencilFunc(unsigned int Func_,
316
316
inline void HW__SetBackFaceStencilFunc(
321
321
inline void HW__SetFrontFaceStencilOp(
322
unsigned int FailOp_,
323
unsigned int ZFailOp_,
324
unsigned int ZPassOp_);
326
326
inline void HW__SetBackFaceStencilOp(
327
unsigned int FailOp_,
328
unsigned int ZFailOp_,
329
unsigned int ZPassOp_);
332
inline void HW__EnableLineSmooth(t_u32 EnableLineSmooth);
333
inline void HW__SetLineWidth(t_u32 width, t_u32 HINT);
335
inline void HW__EnablePointSmooth(t_u32 EnablePointSmooth);
336
inline void HW__SetPointSize(t_u32 size, t_u32 HINT);
338
inline void HW__SetColorMask(t_u32 bRed, t_u32 bGreen, t_u32 bBlue, t_u32 bAlpha);
339
inline void HW__SetDepthMask(t_u32 bDepth);
341
inline void HW__EnableScissor(t_u32 bScissor);
342
inline void HW__EnableFog(t_u32 bFog);
344
inline void HW__SetPolygonMode(t_u32 FrontMode, t_u32 BackMode);
345
inline void HW__EnablePolygonOffset(t_u32 EnablePolygonOffset);
332
inline void HW__EnableLineSmooth(unsigned int EnableLineSmooth);
333
inline void HW__SetLineWidth(unsigned int width, unsigned int HINT);
335
inline void HW__EnablePointSmooth(unsigned int EnablePointSmooth);
336
inline void HW__SetPointSize(unsigned int size, unsigned int HINT);
338
inline void HW__SetColorMask(unsigned int bRed, unsigned int bGreen, unsigned int bBlue, unsigned int bAlpha);
339
inline void HW__SetDepthMask(unsigned int bDepth);
341
inline void HW__EnableScissor(unsigned int bScissor);
342
inline void HW__EnableFog(unsigned int bFog);
344
inline void HW__SetPolygonMode(unsigned int FrontMode, unsigned int BackMode);
345
inline void HW__EnablePolygonOffset(unsigned int EnablePolygonOffset);
346
346
inline void HW__SetPolygonOffset(float Factor, float Units);
1039
1039
inline void GpuRenderStates::HW__SetDepthRange(float zNear, float zFar)
1041
1041
CHECKGL(glDepthRange(zNear, zFar));
1042
SET_RS_VALUE(m_RenderStateChanges[GFXRS_ZNEAR], static_cast<t_u32> (Clamp(zNear, 0.0f, 1.0f)));
1043
SET_RS_VALUE(m_RenderStateChanges[GFXRS_ZFAR], static_cast<t_u32> (Clamp(zFar, 0.0f, 1.0f)));
1042
SET_RS_VALUE(m_RenderStateChanges[GFXRS_ZNEAR], static_cast<unsigned int> (Clamp(zNear, 0.0f, 1.0f)));
1043
SET_RS_VALUE(m_RenderStateChanges[GFXRS_ZFAR], static_cast<unsigned int> (Clamp(zFar, 0.0f, 1.0f)));
1046
inline void GpuRenderStates::HW__SetDepthFunc(t_u32 Func)
1046
inline void GpuRenderStates::HW__SetDepthFunc(unsigned int Func)
1049
1049
(Func == GL_NEVER) ||
1165
1165
SET_RS_VALUE(m_RenderStateChanges[GFXRS_TWOSIDEDSTENCILENABLE], b ? GL_TRUE : GL_FALSE);
1168
inline void GpuRenderStates::HW__SetStencilFrontFaceWriteMask(t_u32 WriteMask_)
1168
inline void GpuRenderStates::HW__SetStencilFrontFaceWriteMask(unsigned int WriteMask_)
1170
1170
CHECKGL(glActiveStencilFaceEXT(GL_FRONT));
1171
1171
CHECKGL(glStencilMask(WriteMask_));
1172
1172
SET_RS_VALUE(m_RenderStateChanges[GFXRS_FRONT_STENCILWRITEMASK], WriteMask_);
1175
inline void GpuRenderStates::HW__SetStencilBackFaceWriteMask(t_u32 WriteMask_)
1175
inline void GpuRenderStates::HW__SetStencilBackFaceWriteMask(unsigned int WriteMask_)
1177
1177
CHECKGL(glActiveStencilFaceEXT(GL_BACK));
1178
1178
CHECKGL(glStencilMask(WriteMask_));
1179
1179
SET_RS_VALUE(m_RenderStateChanges[GFXRS_BACK_STENCILWRITEMASK], WriteMask_);
1182
inline void GpuRenderStates::HW__SetFrontFaceStencilFunc(t_u32 Func_,
1182
inline void GpuRenderStates::HW__SetFrontFaceStencilFunc(unsigned int Func_,
1187
1187
(Func_ == GL_NEVER) ||