mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
Call R_SetFrustum in all renderers.
It turns out glsl, sw and sw32 weren't getting any benefit from R_CullBox because the frustum wasn't setup :P. Get another 8% out of bigass1 (174->184fps). bigass1 now runs 2x as fast as it did before I started this optimisation run :)
This commit is contained in:
parent
e58cd75660
commit
a8e0bcabf9
7 changed files with 47 additions and 42 deletions
|
@ -139,6 +139,7 @@ extern vec3_t r_worldmodelorg;
|
||||||
extern mat4_t glsl_projection;
|
extern mat4_t glsl_projection;
|
||||||
extern mat4_t glsl_view;
|
extern mat4_t glsl_view;
|
||||||
|
|
||||||
|
void R_SetFrustum (void);
|
||||||
|
|
||||||
void R_SpriteBegin (void);
|
void R_SpriteBegin (void);
|
||||||
void R_SpriteEnd (void);
|
void R_SpriteEnd (void);
|
||||||
|
|
|
@ -332,46 +332,6 @@ R_DrawViewModel (void)
|
||||||
qfglDepthRange (gldepthmin, gldepthmax);
|
qfglDepthRange (gldepthmin, gldepthmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
|
||||||
SignbitsForPlane (plane_t *out)
|
|
||||||
{
|
|
||||||
int bits, j;
|
|
||||||
|
|
||||||
// for fast box on planeside test
|
|
||||||
|
|
||||||
bits = 0;
|
|
||||||
for (j = 0; j < 3; j++) {
|
|
||||||
if (out->normal[j] < 0)
|
|
||||||
bits |= 1 << j;
|
|
||||||
}
|
|
||||||
return bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
R_SetFrustum (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// rotate VPN right by FOV_X/2 degrees
|
|
||||||
RotatePointAroundVector (frustum[0].normal, vup, vpn,
|
|
||||||
-(90 - r_refdef.fov_x / 2));
|
|
||||||
// rotate VPN left by FOV_X/2 degrees
|
|
||||||
RotatePointAroundVector (frustum[1].normal, vup, vpn,
|
|
||||||
90 - r_refdef.fov_x / 2);
|
|
||||||
// rotate VPN up by FOV_Y/2 degrees
|
|
||||||
RotatePointAroundVector (frustum[2].normal, vright, vpn,
|
|
||||||
90 - r_refdef.fov_y / 2);
|
|
||||||
// rotate VPN down by FOV_Y/2 degrees
|
|
||||||
RotatePointAroundVector (frustum[3].normal, vright, vpn,
|
|
||||||
-(90 - r_refdef.fov_y / 2));
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
|
||||||
frustum[i].type = PLANE_ANYZ;
|
|
||||||
frustum[i].dist = DotProduct (r_origin, frustum[i].normal);
|
|
||||||
frustum[i].signbits = SignbitsForPlane (&frustum[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gl_R_SetupFrame (void)
|
gl_R_SetupFrame (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -145,10 +145,11 @@ calc_lighting (entity_t *ent, float *ambient, float *shadelight,
|
||||||
unsigned i;
|
unsigned i;
|
||||||
float add;
|
float add;
|
||||||
vec3_t dist;
|
vec3_t dist;
|
||||||
|
int light;
|
||||||
|
|
||||||
VectorSet ( -1, 0, 0, lightvec); //FIXME
|
VectorSet ( -1, 0, 0, lightvec); //FIXME
|
||||||
*ambient = max (R_LightPoint (ent->origin), max (ent->model->min_light,
|
light = R_LightPoint (ent->origin);
|
||||||
ent->min_light) * 128);
|
*ambient = max (light, max (ent->model->min_light, ent->min_light) * 128);
|
||||||
*shadelight = *ambient;
|
*shadelight = *ambient;
|
||||||
|
|
||||||
for (i = 0; i < r_maxdlights; i++) {
|
for (i = 0; i < r_maxdlights; i++) {
|
||||||
|
|
|
@ -108,6 +108,7 @@ glsl_R_SetupFrame (void)
|
||||||
|
|
||||||
VectorCopy (r_refdef.vieworg, r_origin);
|
VectorCopy (r_refdef.vieworg, r_origin);
|
||||||
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
||||||
|
R_SetFrustum ();
|
||||||
|
|
||||||
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
|
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,3 +85,43 @@ int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||||
|
|
||||||
byte color_white[4] = { 255, 255, 255, 0 }; // alpha will be explicitly set
|
byte color_white[4] = { 255, 255, 255, 0 }; // alpha will be explicitly set
|
||||||
byte color_black[4] = { 0, 0, 0, 0 }; // alpha will be explicitly set
|
byte color_black[4] = { 0, 0, 0, 0 }; // alpha will be explicitly set
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
SignbitsForPlane (plane_t *out)
|
||||||
|
{
|
||||||
|
int bits, j;
|
||||||
|
|
||||||
|
// for fast box on planeside test
|
||||||
|
|
||||||
|
bits = 0;
|
||||||
|
for (j = 0; j < 3; j++) {
|
||||||
|
if (out->normal[j] < 0)
|
||||||
|
bits |= 1 << j;
|
||||||
|
}
|
||||||
|
return bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
R_SetFrustum (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// rotate VPN right by FOV_X/2 degrees
|
||||||
|
RotatePointAroundVector (frustum[0].normal, vup, vpn,
|
||||||
|
-(90 - r_refdef.fov_x / 2));
|
||||||
|
// rotate VPN left by FOV_X/2 degrees
|
||||||
|
RotatePointAroundVector (frustum[1].normal, vup, vpn,
|
||||||
|
90 - r_refdef.fov_x / 2);
|
||||||
|
// rotate VPN up by FOV_Y/2 degrees
|
||||||
|
RotatePointAroundVector (frustum[2].normal, vright, vpn,
|
||||||
|
90 - r_refdef.fov_y / 2);
|
||||||
|
// rotate VPN down by FOV_Y/2 degrees
|
||||||
|
RotatePointAroundVector (frustum[3].normal, vright, vpn,
|
||||||
|
-(90 - r_refdef.fov_y / 2));
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
frustum[i].type = PLANE_ANYZ;
|
||||||
|
frustum[i].dist = DotProduct (r_origin, frustum[i].normal);
|
||||||
|
frustum[i].signbits = SignbitsForPlane (&frustum[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -240,6 +240,7 @@ R_SetupFrame (void)
|
||||||
VectorCopy (r_refdef.vieworg, r_origin);
|
VectorCopy (r_refdef.vieworg, r_origin);
|
||||||
|
|
||||||
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
||||||
|
R_SetFrustum ();
|
||||||
|
|
||||||
// current viewleaf
|
// current viewleaf
|
||||||
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
|
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
|
||||||
|
|
|
@ -237,6 +237,7 @@ sw32_R_SetupFrame (void)
|
||||||
VectorCopy (r_refdef.vieworg, r_origin);
|
VectorCopy (r_refdef.vieworg, r_origin);
|
||||||
|
|
||||||
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
||||||
|
R_SetFrustum ();
|
||||||
|
|
||||||
// current viewleaf
|
// current viewleaf
|
||||||
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
|
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
|
||||||
|
|
Loading…
Reference in a new issue