light: pass the sun direction vector into LightFace_Sky
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
ca78568cae
commit
f498ed5ec3
|
|
@ -679,8 +679,8 @@ LightFace_Entity(const entity_t *entity, const lightsample_t *light,
|
|||
* =============
|
||||
*/
|
||||
static void
|
||||
LightFace_Sky(const lightsample_t *light, const lightsurf_t *lightsurf,
|
||||
lightmap_t *lightmaps)
|
||||
LightFace_Sky(const lightsample_t *light, const vec3_t vector,
|
||||
const lightsurf_t *lightsurf, lightmap_t *lightmaps)
|
||||
{
|
||||
const modelinfo_t *modelinfo = lightsurf->modelinfo;
|
||||
const plane_t *plane = &lightsurf->plane;
|
||||
|
|
@ -692,7 +692,7 @@ LightFace_Sky(const lightsample_t *light, const lightsurf_t *lightsurf,
|
|||
lightsample_t *sample;
|
||||
|
||||
/* Don't bother if surface facing away from sun */
|
||||
if (DotProduct(sunvec, plane->normal) < -ANGLE_EPSILON)
|
||||
if (DotProduct(vector, plane->normal) < -ANGLE_EPSILON)
|
||||
return;
|
||||
|
||||
/* if sunlight is set, use a style 0 light map */
|
||||
|
|
@ -707,7 +707,7 @@ LightFace_Sky(const lightsample_t *light, const lightsurf_t *lightsurf,
|
|||
if (mapnum == MAXLIGHTMAPS)
|
||||
return; /* oh well, too many lightmaps... */
|
||||
|
||||
VectorCopy(sunvec, incoming);
|
||||
VectorCopy(vector, incoming);
|
||||
VectorNormalize(incoming);
|
||||
angle = DotProduct(incoming, plane->normal);
|
||||
angle = (1.0 - sun_anglescale) + sun_anglescale * angle;
|
||||
|
|
@ -717,7 +717,7 @@ LightFace_Sky(const lightsample_t *light, const lightsurf_t *lightsurf,
|
|||
sample = lightmaps[mapnum].samples;
|
||||
surfpoint = lightsurf->points[0];
|
||||
for (i = 0; i < lightsurf->numpoints; i++, sample++, surfpoint += 3) {
|
||||
if (!TestSky(surfpoint, sunvec, shadowself))
|
||||
if (!TestSky(surfpoint, vector, shadowself))
|
||||
continue;
|
||||
sample->light += angle * light->light;
|
||||
VectorMA(sample->color, angle * light->light / 255.0f, light->color,
|
||||
|
|
@ -915,7 +915,7 @@ LightFace(dface_t *face, const modelinfo_t *modelinfo)
|
|||
LightFace_Entity(entity, &entity->light, &lightsurf, lightmaps);
|
||||
}
|
||||
if (sunlight.light > 0)
|
||||
LightFace_Sky(&sunlight, &lightsurf, lightmaps);
|
||||
LightFace_Sky(&sunlight, sunvec, &lightsurf, lightmaps);
|
||||
|
||||
/* minlight - Use the greater of global or model minlight. */
|
||||
if (modelinfo->minlight.light > minlight.light)
|
||||
|
|
@ -931,7 +931,7 @@ LightFace(dface_t *face, const modelinfo_t *modelinfo)
|
|||
LightFace_Entity(entity, &entity->light, &lightsurf, lightmaps);
|
||||
}
|
||||
if (sunlight.light < 0)
|
||||
LightFace_Sky(&sunlight, &lightsurf, lightmaps);
|
||||
LightFace_Sky(&sunlight, sunvec, &lightsurf, lightmaps);
|
||||
|
||||
/* Fix any negative values */
|
||||
for (i = 0; i < MAXLIGHTMAPS; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue