mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-03 06:11:03 +00:00
Fix lightmaps got applied to model meshes
This commit is contained in:
parent
764a08752f
commit
6a804cd4c7
4 changed files with 11 additions and 7 deletions
|
@ -46,6 +46,7 @@ FModelVertexBuffer::FModelVertexBuffer(bool needindex, bool singleframe)
|
|||
{ 0, VATTR_VERTEX, VFmt_Float3, (int)myoffsetof(FModelVertex, x) },
|
||||
{ 0, VATTR_TEXCOORD, VFmt_Float2, (int)myoffsetof(FModelVertex, u) },
|
||||
{ 0, VATTR_NORMAL, VFmt_Packed_A2R10G10B10, (int)myoffsetof(FModelVertex, packedNormal) },
|
||||
{ 0, VATTR_LIGHTMAP, VFmt_Float3, (int)myoffsetof(FModelVertex, lu) },
|
||||
{ 1, VATTR_VERTEX2, VFmt_Float3, (int)myoffsetof(FModelVertex, x) },
|
||||
{ 1, VATTR_NORMAL2, VFmt_Packed_A2R10G10B10, (int)myoffsetof(FModelVertex, packedNormal) }
|
||||
};
|
||||
|
|
|
@ -7,6 +7,8 @@ struct FModelVertex
|
|||
float x, y, z; // world position
|
||||
float u, v; // texture coordinates
|
||||
unsigned packedNormal; // normal vector as GL_INT_2_10_10_10_REV.
|
||||
float lu, lv; // lightmap texture coordinates
|
||||
float lindex; // lightmap texture index
|
||||
|
||||
void Set(float xx, float yy, float zz, float uu, float vv)
|
||||
{
|
||||
|
@ -15,6 +17,7 @@ struct FModelVertex
|
|||
z = zz;
|
||||
u = uu;
|
||||
v = vv;
|
||||
lindex = -1.0f;
|
||||
}
|
||||
|
||||
void SetNormal(float nx, float ny, float nz)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue