Small optimisation
This commit is contained in:
parent
9bfb0c6eea
commit
d932811be4
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
/* Lighting will not be calculated if the attenuation
|
/* Lighting will not be calculated if the attenuation
|
||||||
* multiplier ends up less than this value */
|
* multiplier ends up less than this value */
|
||||||
#define ATTENUATION_THRESHOLD 0.01f
|
#define ATTENUATION_THRESHOLD 100.0f
|
||||||
|
|
||||||
static GLfloat SCENE_AMBIENT [] = {0.2f, 0.2f, 0.2f, 1.0f};
|
static GLfloat SCENE_AMBIENT [] = {0.2f, 0.2f, 0.2f, 1.0f};
|
||||||
static GLboolean VIEWER_IN_EYE_COORDINATES = GL_TRUE;
|
static GLboolean VIEWER_IN_EYE_COORDINATES = GL_TRUE;
|
||||||
|
@ -553,9 +553,12 @@ void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const int32_t count)
|
||||||
) + (LIGHTS[i].quadratic_attenuation * D * D)
|
) + (LIGHTS[i].quadratic_attenuation * D * D)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Anything over the attenuation threshold will
|
||||||
|
* be a tiny value after inversion (< 0.01f) so
|
||||||
|
* let's just skip the lighting at that point */
|
||||||
|
if(att < ATTENUATION_THRESHOLD) {
|
||||||
att = MATH_Fast_Invert(att);
|
att = MATH_Fast_Invert(att);
|
||||||
|
|
||||||
if(att >= ATTENUATION_THRESHOLD) {
|
|
||||||
float Hx = (Lx + Vx);
|
float Hx = (Lx + Vx);
|
||||||
float Hy = (Ly + Vy);
|
float Hy = (Ly + Vy);
|
||||||
float Hz = (Lz + Vz);
|
float Hz = (Lz + Vz);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user