Fix lightmaps got applied to model meshes

This commit is contained in:
Magnus Norddahl 2021-10-14 06:11:54 +02:00
commit 6a804cd4c7
4 changed files with 11 additions and 7 deletions

View file

@ -172,12 +172,6 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
di->GetDynSpriteLight(gl_light_sprites ? actor : nullptr, gl_light_particles ? particle : nullptr, out);
state.SetDynLight(out[0], out[1], out[2]);
}
else if (di->Level->LightProbes.Size() > 0)
{
LightProbe* probe = FindLightProbe(di->Level, actor->X(), actor->Y(), actor->Center());
if (probe)
state.SetDynLight(probe->Red, probe->Green, probe->Blue);
}
}
sector_t *cursec = actor ? actor->Sector : particle ? particle->subsector->sector : nullptr;
if (cursec != nullptr)
@ -298,6 +292,13 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
}
else
{
if (actor && di->Level->LightProbes.Size() > 0)
{
LightProbe* probe = FindLightProbe(di->Level, actor->X(), actor->Y(), actor->Center());
if (probe)
state.SetDynLight(probe->Red, probe->Green, probe->Blue);
}
FHWModelRenderer renderer(di, state, dynlightindex);
RenderModel(&renderer, x, y, z, modelframe, actor, di->Viewpoint.TicFrac);
state.SetVertexBuffer(screen->mVertexData);

View file

@ -641,7 +641,6 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
{
hw_GetDynModelLight(playermo, lightdata);
hudsprite.lightindex = screen->mLights->UploadLights(lightdata);
LightProbe* probe = FindLightProbe(playermo->Level, playermo->X(), playermo->Y(), playermo->Center());
if (probe)
{