- fixed some uninitialized stuff in particle rendering.

- added gl_ClampLight to all places where the light level is set.
This commit is contained in:
Christoph Oelckers 2016-04-06 14:03:21 +02:00
parent 9196683e4f
commit a0d0d9339e
4 changed files with 12 additions and 6 deletions

View file

@ -447,7 +447,7 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
// FF_FOG requires an inverted logic where to get the light from
lightlist_t *light = P_GetPlaneLight(sector, plane.plane, underside);
lightlevel = *light->p_lightlevel;
lightlevel = gl_ClampLight(*light->p_lightlevel);
if (rover->flags & FF_FOG) Colormap.LightColor = (light->extra_colormap)->Fade;
else Colormap.CopyFrom3DLight(light);
@ -544,7 +544,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if ((!(sector->GetFlags(sector_t::floor)&PLANEF_ABSLIGHTING) || light->lightsource == NULL)
&& (light->p_lightlevel != &frontsector->lightlevel))
{
lightlevel = *light->p_lightlevel;
lightlevel = gl_ClampLight(*light->p_lightlevel);
}
Colormap.CopyFrom3DLight(light);
@ -607,7 +607,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if ((!(sector->GetFlags(sector_t::ceiling)&PLANEF_ABSLIGHTING))
&& (light->p_lightlevel != &frontsector->lightlevel))
{
lightlevel = *light->p_lightlevel;
lightlevel = gl_ClampLight(*light->p_lightlevel);
}
Colormap.CopyFrom3DLight(light);
}

View file

@ -866,11 +866,15 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
if (lightbottom < particle->Pos.Z)
{
lightlevel = *lightlist[i].p_lightlevel;
lightlevel = gl_ClampLight(*lightlist[i].p_lightlevel);
Colormap.LightColor = (lightlist[i].extra_colormap)->Color;
break;
}
}
if (glset.nocoloredspritelighting)
{
Colormap.Decolorize(); // ZDoom never applies colored light to particles.
}
}
else
{
@ -884,6 +888,7 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
OverrideShader = 0;
ThingColor = particle->color;
ThingColor.g = 255;
ThingColor.a = 255;
modelframe=NULL;
@ -939,6 +944,7 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
actor=NULL;
this->particle=particle;
fullbright = !!particle->bright;
// [BB] Translucent particles have to be rendered without the alpha test.
if (gl_particles_style != 2 && trans>=1.0f-FLT_EPSILON) hw_styleflags = STYLEHW_Solid;

View file

@ -314,7 +314,7 @@ public:
friend struct GLDrawList;
friend void Mod_RenderModel(GLSprite * spr, model_t * mdl, int framenumber);
BYTE lightlevel;
int lightlevel;
BYTE foglevel;
BYTE hw_styleflags;
bool fullbright;

View file

@ -272,7 +272,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
if (lightbottom<player->viewz)
{
cm = lightlist[i].extra_colormap;
lightlevel = *lightlist[i].p_lightlevel;
lightlevel = gl_ClampLight(*lightlist[i].p_lightlevel);
break;
}
}