Try light trace from entity origin first

Fixes issues described at https://github.com/Novum/vkQuake/issues/550.
This commit is contained in:
Andrei Drexler 2022-08-28 20:28:02 +03:00 committed by Ozkan Sezer
parent b26707b2ff
commit 7e4c88aed9
1 changed files with 10 additions and 7 deletions

View File

@ -547,14 +547,17 @@ void R_SetupAliasLighting (entity_t *e)
int i; int i;
int quantizedangle; int quantizedangle;
float radiansangle; float radiansangle;
vec3_t lpos;
VectorCopy (e->origin, lpos); // if the initial trace is completely black, try again from above
// start the light trace from slightly above the origin // this helps with models whose origin is slightly below ground level
// this helps with models whose origin is below ground level, but are otherwise visible // (e.g. some of the candles in the DOTM start map)
// (e.g. some of the candles in the DOTM start map, which would otherwise appear black) if (!R_LightPoint (e->origin))
lpos[2] += e->model->maxs[2] * 0.5f; {
R_LightPoint (lpos); vec3_t lpos;
VectorCopy (e->origin, lpos);
lpos[2] += e->model->maxs[2] * 0.5f;
R_LightPoint (lpos);
}
//add dlights //add dlights
for (i=0 ; i<MAX_DLIGHTS ; i++) for (i=0 ; i<MAX_DLIGHTS ; i++)