light: lit water: receive light from either side of the face
This commit is contained in:
parent
5edc647128
commit
7f182cf107
|
|
@ -143,6 +143,9 @@ typedef struct {
|
||||||
vec_t starts, startt, st_step;
|
vec_t starts, startt, st_step;
|
||||||
texorg_t texorg;
|
texorg_t texorg;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
|
/* for lit water. receive light from either front or back. */
|
||||||
|
bool twosided;
|
||||||
} lightsurf_t;
|
} lightsurf_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
||||||
|
|
@ -1311,7 +1311,7 @@ LightFace_Entity(const bsp2_t *bsp,
|
||||||
normal may be facing such that it receives some light, so we can't use this
|
normal may be facing such that it receives some light, so we can't use this
|
||||||
test in the curved case.
|
test in the curved case.
|
||||||
*/
|
*/
|
||||||
if (planedist < 0 && !entity->bleed && !lightsurf->curved)
|
if (planedist < 0 && !entity->bleed && !lightsurf->curved && !lightsurf->twosided)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* sphere cull surface and light */
|
/* sphere cull surface and light */
|
||||||
|
|
@ -1337,7 +1337,7 @@ LightFace_Entity(const bsp2_t *bsp,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
angle = DotProduct(surfpointToLightDir, surfnorm);
|
angle = DotProduct(surfpointToLightDir, surfnorm);
|
||||||
if (entity->bleed) {
|
if (entity->bleed || lightsurf->twosided) {
|
||||||
if (angle < 0) {
|
if (angle < 0) {
|
||||||
angle = -angle; // ericw -- support "_bleed" option
|
angle = -angle; // ericw -- support "_bleed" option
|
||||||
}
|
}
|
||||||
|
|
@ -1415,7 +1415,7 @@ LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmap_t *lightm
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Don't bother if surface facing away from sun */
|
/* Don't bother if surface facing away from sun */
|
||||||
if (DotProduct(sun->sunvec, plane->normal) < -ANGLE_EPSILON && !curved)
|
if (DotProduct(sun->sunvec, plane->normal) < -ANGLE_EPSILON && !curved && !lightsurf->twosided)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* if sunlight is set, use a style 0 light map */
|
/* if sunlight is set, use a style 0 light map */
|
||||||
|
|
@ -1434,6 +1434,12 @@ LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmap_t *lightm
|
||||||
vec_t value;
|
vec_t value;
|
||||||
|
|
||||||
angle = DotProduct(incoming, surfnorm);
|
angle = DotProduct(incoming, surfnorm);
|
||||||
|
if (lightsurf->twosided) {
|
||||||
|
if (angle < 0) {
|
||||||
|
angle = -angle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (angle < 0)
|
if (angle < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -2095,6 +2101,14 @@ LightFace(bsp2_dface_t *face, facesup_t *facesup, const modelinfo_t *modelinfo,
|
||||||
/* don't save lightmaps for "skip" texture */
|
/* don't save lightmaps for "skip" texture */
|
||||||
if (!Q_strcasecmp(texname, "skip"))
|
if (!Q_strcasecmp(texname, "skip"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* if liquid doesn't have the TEX_SPECIAL flag set, the map was qbsp'ed with
|
||||||
|
* lit water in mind. In that case receive light from both top and bottom.
|
||||||
|
* (lit will only be rendered in compatible engines, but degrades gracefully.)
|
||||||
|
*/
|
||||||
|
if (texname[0] == '*') {
|
||||||
|
lightsurf->twosided = true;
|
||||||
|
}
|
||||||
|
|
||||||
Lightsurf_Init(modelinfo, face, bsp, lightsurf, facesup);
|
Lightsurf_Init(modelinfo, face, bsp, lightsurf, facesup);
|
||||||
Lightmaps_Init(lightsurf, lightmaps, MAXLIGHTMAPS + 1);
|
Lightmaps_Init(lightsurf, lightmaps, MAXLIGHTMAPS + 1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue