mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
make SURF_LIGHTBOTHSIDES work and fix a bug in Mod_PointInLeaf that was
preventing grenades from lighting up surfaces when using the vis lighting
This commit is contained in:
parent
8883bbb369
commit
dcc6a76313
3 changed files with 14 additions and 11 deletions
|
@ -102,6 +102,9 @@ typedef struct texture_s
|
||||||
#define SURF_DRAWBACKGROUND 0x40
|
#define SURF_DRAWBACKGROUND 0x40
|
||||||
#define SURF_UNDERWATER 0x80
|
#define SURF_UNDERWATER 0x80
|
||||||
#define SURF_DONTWARP 0x100
|
#define SURF_DONTWARP 0x100
|
||||||
|
#define SURF_DRAWNOALPHA 0x200
|
||||||
|
#define SURF_DRAWFULLBRIGHT 0x400
|
||||||
|
#define SURF_LIGHTBOTHSIDES 0x800
|
||||||
|
|
||||||
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -80,7 +80,7 @@ Mod_PointInLeaf (vec3_t p, model_t *model)
|
||||||
return (mleaf_t *) node;
|
return (mleaf_t *) node;
|
||||||
plane = node->plane;
|
plane = node->plane;
|
||||||
d = DotProduct (p, plane->normal) - plane->dist;
|
d = DotProduct (p, plane->normal) - plane->dist;
|
||||||
if (d > 0)
|
if (d >= 0)
|
||||||
node = node->children[0];
|
node = node->children[0];
|
||||||
else
|
else
|
||||||
node = node->children[1];
|
node = node->children[1];
|
||||||
|
@ -537,7 +537,9 @@ Mod_LoadFaces (lump_t *l)
|
||||||
|
|
||||||
if (out->texinfo->texture->name[0] == '*') // turbulent
|
if (out->texinfo->texture->name[0] == '*') // turbulent
|
||||||
{
|
{
|
||||||
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
|
out->flags |= (SURF_DRAWTURB
|
||||||
|
| SURF_DRAWTILED
|
||||||
|
| SURF_LIGHTBOTHSIDES);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
out->extents[i] = 16384;
|
out->extents[i] = 16384;
|
||||||
out->texturemins[i] = -8192;
|
out->texturemins[i] = -8192;
|
||||||
|
|
|
@ -288,23 +288,21 @@ static void
|
||||||
mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light,
|
mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light,
|
||||||
int bit)
|
int bit)
|
||||||
{
|
{
|
||||||
float dist, dist2, d;
|
float dist;
|
||||||
|
#if 1
|
||||||
|
float dist2, d;
|
||||||
float maxdist = light->radius * light->radius;
|
float maxdist = light->radius * light->radius;
|
||||||
vec3_t impact;
|
vec3_t impact;
|
||||||
|
#endif
|
||||||
|
|
||||||
surf->dlightframe = r_framecount;
|
surf->dlightframe = r_framecount;
|
||||||
dist = PlaneDiff(lightorigin, surf->plane);
|
dist = PlaneDiff(lightorigin, surf->plane);
|
||||||
if (surf->flags & SURF_PLANEBACK)
|
if (surf->flags & SURF_PLANEBACK)
|
||||||
dist = -dist;
|
dist = -dist;
|
||||||
#if 0
|
|
||||||
//FIXME SURF_LIGHTBOTHSIDES seems to be a darkplaces thing. need to investigate
|
|
||||||
if ((dist < -0.25f && !(surf->flags & SURF_LIGHTBOTHSIDES))
|
if ((dist < -0.25f && !(surf->flags & SURF_LIGHTBOTHSIDES))
|
||||||
|| dist > radius)
|
|| dist > light->radius)
|
||||||
return;
|
return;
|
||||||
#else
|
#if 1
|
||||||
if (dist < -0.25f || dist > light->radius)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
dist2 = dist * dist;
|
dist2 = dist * dist;
|
||||||
dist = -dist;
|
dist = -dist;
|
||||||
VectorMA (light->origin, dist, surf->plane->normal, impact);
|
VectorMA (light->origin, dist, surf->plane->normal, impact);
|
||||||
|
@ -337,7 +335,7 @@ mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (surf->dlightframe != r_framecount) {
|
if (surf->dlightframe != r_framecount) {
|
||||||
surf->dlightbits = 0;
|
surf->dlightbits = 0;
|
||||||
surf->dlightframe = r_framecount;
|
surf->dlightframe = r_framecount;
|
||||||
|
|
Loading…
Reference in a new issue