EmitWaterPolys Does a water warp on the pre-fragmented glpoly_t chain
(msurface_t fa)
| 275 | * Does a water warp on the pre-fragmented glpoly_t chain |
| 276 | */ |
| 277 | void EmitWaterPolys(msurface_t fa) |
| 278 | { |
| 279 | float rdt = r_newrefdef.time; |
| 280 | |
| 281 | float scroll; |
| 282 | if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0) |
| 283 | scroll = -64 * ( (r_newrefdef.time*0.5f) - (int)(r_newrefdef.time*0.5f) ); |
| 284 | else |
| 285 | scroll = 0; |
| 286 | |
| 287 | int i; |
| 288 | float s, t, os, ot; |
| 289 | glpoly_t p, bp; |
| 290 | for (bp = fa.polys; bp != null; bp = bp.next) { |
| 291 | p = bp; |
| 292 | |
| 293 | gl.glBegin(GL_TRIANGLE_FAN); |
| 294 | for (i = 0; i < p.numverts; i++) { |
| 295 | os = p.s1(i); |
| 296 | ot = p.t1(i); |
| 297 | |
| 298 | s = os |
| 299 | + Warp.SIN[(int) ((ot * 0.125f + r_newrefdef.time) * TURBSCALE) & 255]; |
| 300 | s += scroll; |
| 301 | s *= (1.0f / 64); |
| 302 | |
| 303 | t = ot |
| 304 | + Warp.SIN[(int) ((os * 0.125f + rdt) * TURBSCALE) & 255]; |
| 305 | t *= (1.0f / 64); |
| 306 | |
| 307 | gl.glTexCoord2f(s, t); |
| 308 | gl.glVertex3f(p.x(i), p.y(i), p.z(i)); |
| 309 | } |
| 310 | gl.glEnd(); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | // =================================================================== |
| 315 |
nothing calls this directly
no test coverage detected