| 314 | } |
| 315 | |
| 316 | void drawstencilshadows() |
| 317 | { |
| 318 | glDisable(GL_FOG); |
| 319 | glEnable(GL_STENCIL_TEST); |
| 320 | glDisable(GL_TEXTURE_2D); |
| 321 | |
| 322 | glDepthMask(GL_FALSE); |
| 323 | glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); |
| 324 | |
| 325 | stenciling = 1; |
| 326 | |
| 327 | shadowcasters = 0; |
| 328 | shadowx2 = shadowy2 = -1; |
| 329 | shadowx1 = shadowy1 = 1; |
| 330 | memset(shadowtiles, 0, sizeof(shadowtiles)); |
| 331 | |
| 332 | if(hasST2 || hasSTS) |
| 333 | { |
| 334 | glDisable(GL_CULL_FACE); |
| 335 | |
| 336 | if(hasST2) |
| 337 | { |
| 338 | glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); |
| 339 | |
| 340 | glActiveStencilFace_(GL_BACK); |
| 341 | glStencilFunc(GL_ALWAYS, 0, ~0U); |
| 342 | glStencilOp(GL_KEEP, GL_KEEP, hasSTW ? GL_INCR_WRAP_EXT : GL_INCR); |
| 343 | |
| 344 | glActiveStencilFace_(GL_FRONT); |
| 345 | glStencilFunc(GL_ALWAYS, 0, ~0U); |
| 346 | glStencilOp(GL_KEEP, GL_KEEP, hasSTW ? GL_DECR_WRAP_EXT : GL_DECR); |
| 347 | } |
| 348 | else |
| 349 | { |
| 350 | glStencilFuncSeparate_(GL_ALWAYS, GL_ALWAYS, 0, ~0U); |
| 351 | glStencilOpSeparate_(GL_BACK, GL_KEEP, GL_KEEP, hasSTW ? GL_INCR_WRAP_EXT : GL_INCR); |
| 352 | glStencilOpSeparate_(GL_FRONT, GL_KEEP, GL_KEEP, hasSTW ? GL_DECR_WRAP_EXT : GL_DECR); |
| 353 | } |
| 354 | |
| 355 | startmodelbatches(); |
| 356 | rendermapmodels(); |
| 357 | renderentities(); |
| 358 | renderclients(); |
| 359 | renderbounceents(); |
| 360 | endmodelbatches(); |
| 361 | |
| 362 | if(hasST2) glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT); |
| 363 | glEnable(GL_CULL_FACE); |
| 364 | } |
| 365 | else |
| 366 | { |
| 367 | glStencilFunc(GL_ALWAYS, 0, ~0U); |
| 368 | glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); |
| 369 | |
| 370 | startmodelbatches(); |
| 371 | rendermapmodels(); |
| 372 | renderentities(); |
| 373 | renderclients(); |
no test coverage detected