diff options
Diffstat (limited to 'apps/plugins/sdl/progs/quake/r_misc.c')
-rw-r--r-- | apps/plugins/sdl/progs/quake/r_misc.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/apps/plugins/sdl/progs/quake/r_misc.c b/apps/plugins/sdl/progs/quake/r_misc.c index c0aa7e991d..349f760140 100644 --- a/apps/plugins/sdl/progs/quake/r_misc.c +++ b/apps/plugins/sdl/progs/quake/r_misc.c | |||
@@ -286,8 +286,18 @@ void R_TransformFrustum (void) | |||
286 | v2[2] = v[1]*vright[2] + v[2]*vup[2] + v[0]*vpn[2]; | 286 | v2[2] = v[1]*vright[2] + v[2]*vup[2] + v[0]*vpn[2]; |
287 | 287 | ||
288 | VectorCopy (v2, view_clipplanes[i].normal); | 288 | VectorCopy (v2, view_clipplanes[i].normal); |
289 | |||
290 | view_clipplanes[i].dist = DotProduct (modelorg, v2); | 289 | view_clipplanes[i].dist = DotProduct (modelorg, v2); |
290 | |||
291 | #ifdef USE_PQ_OPT2 | ||
292 | if (!v2[0]) view_clipplanes_fxp[i].normal[0]=2<29; | ||
293 | else view_clipplanes_fxp[i].normal[0]=(int)(4096.0f/v2[0]); | ||
294 | if (!v2[1]) view_clipplanes_fxp[i].normal[1]=2<29; | ||
295 | else view_clipplanes_fxp[i].normal[1]=(int)(4096.0f/v2[1]); | ||
296 | if (!v2[2]) view_clipplanes_fxp[i].normal[2]=2<29; | ||
297 | else view_clipplanes_fxp[i].normal[2]=(int)(4096.0f/v2[2]); | ||
298 | |||
299 | view_clipplanes_fxp[i].dist=(int)(view_clipplanes[i].dist*128.0); | ||
300 | #endif | ||
291 | } | 301 | } |
292 | } | 302 | } |
293 | 303 | ||
@@ -306,6 +316,38 @@ void TransformVector (vec3_t in, vec3_t out) | |||
306 | out[2] = DotProduct(in,vpn); | 316 | out[2] = DotProduct(in,vpn); |
307 | } | 317 | } |
308 | 318 | ||
319 | #ifdef USE_PQ_OPT | ||
320 | //JB: Optimization | ||
321 | static float last; | ||
322 | static fpvec3 fpvright, fpvup, fpvpn; | ||
323 | void FPTransformVector( fpvec3 in, fpvec3 out ) | ||
324 | { | ||
325 | if (last != vright[0]) | ||
326 | { | ||
327 | last = vright[0]; | ||
328 | fpvright[0] = (int)(16384.0f * vright[0]); | ||
329 | fpvright[1] = (int)(16384.0f * vright[1]); | ||
330 | fpvright[2] = (int)(16384.0f * vright[2]); | ||
331 | fpvup[0] = (int)(16384.0f * vup[0]); | ||
332 | fpvup[1] = (int)(16384.0f * vup[1]); | ||
333 | fpvup[2] = (int)(16384.0f * vup[2]); | ||
334 | fpvpn[0] = (int)(16384.0f * vpn[0]); | ||
335 | fpvpn[1] = (int)(16384.0f * vpn[1]); | ||
336 | fpvpn[2] = (int)(16384.0f * vpn[2]); | ||
337 | } | ||
338 | out[0] = (in[0] * fpvright[0] + | ||
339 | in[1] * fpvright[1] + | ||
340 | in[2] * fpvright[2]) >> 4; | ||
341 | out[1] = (in[0] * fpvup[0] + | ||
342 | in[1] * fpvup[1] + | ||
343 | in[2] * fpvup[2]) >> 4; | ||
344 | out[2] = (in[0] * fpvpn[0] + | ||
345 | in[1] * fpvpn[1] + | ||
346 | in[2] * fpvpn[2]) >> 4; | ||
347 | } | ||
348 | |||
349 | #endif | ||
350 | |||
309 | #endif | 351 | #endif |
310 | 352 | ||
311 | 353 | ||