mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- fixed: NewDecal should not be called unless it is guaranteed that the decal will be rendered.
This left partially initialized items in the render list.
This commit is contained in:
parent
4d72214fd5
commit
1345c8e7b4
1 changed files with 30 additions and 28 deletions
|
@ -112,34 +112,9 @@ void GLWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal)
|
|||
zpos = decal->Z + frontsector->GetPlaneTexZ(sector_t::ceiling);
|
||||
}
|
||||
}
|
||||
FMaterial *tex = FMaterial::ValidateTexture(texture, true);
|
||||
|
||||
GLDecal &gldecal = *di->AddDecal(type == RENDERWALL_MIRRORSURFACE);
|
||||
gldecal.gltexture = FMaterial::ValidateTexture(texture, true);
|
||||
gldecal.wall = this;
|
||||
gldecal.decal = decal;
|
||||
|
||||
if (decal->RenderFlags & RF_FULLBRIGHT)
|
||||
{
|
||||
gldecal.light = 255;
|
||||
gldecal.rel = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gldecal.light = lightlevel;
|
||||
gldecal.rel = rellight + getExtraLight();
|
||||
}
|
||||
|
||||
gldecal.colormap = Colormap;
|
||||
|
||||
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)
|
||||
{
|
||||
gldecal.colormap.Decolorize();
|
||||
}
|
||||
|
||||
gldecal.a = decal->Alpha;
|
||||
|
||||
// now clip the decal to the actual polygon
|
||||
FMaterial *tex = gldecal.gltexture;
|
||||
|
||||
float decalwidth = tex->TextureWidth() * decal->ScaleX;
|
||||
float decalheight = tex->TextureHeight() * decal->ScaleY;
|
||||
|
@ -178,13 +153,15 @@ void GLWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal)
|
|||
right = decalpixpos + decalwidth;
|
||||
righttex = decalwidth;
|
||||
}
|
||||
if (right <= left) return; // nothing to draw
|
||||
if (right <= left)
|
||||
return; // nothing to draw
|
||||
|
||||
|
||||
// one texture unit on the wall as vector
|
||||
float vx = (glseg.x2 - glseg.x1) / linelength;
|
||||
float vy = (glseg.y2 - glseg.y1) / linelength;
|
||||
|
||||
DecalVertex *dv = gldecal.dv;
|
||||
DecalVertex dv[4];
|
||||
dv[1].x = dv[0].x = glseg.x1 + vx * left;
|
||||
dv[1].y = dv[0].y = glseg.y1 + vy * left;
|
||||
|
||||
|
@ -251,7 +228,32 @@ void GLWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal)
|
|||
for (i = 0; i < 4; i++) dv[i].v = vb - dv[i].v;
|
||||
}
|
||||
|
||||
GLDecal &gldecal = *di->AddDecal(type == RENDERWALL_MIRRORSURFACE);
|
||||
gldecal.gltexture = tex;
|
||||
gldecal.wall = this;
|
||||
gldecal.decal = decal;
|
||||
|
||||
if (decal->RenderFlags & RF_FULLBRIGHT)
|
||||
{
|
||||
gldecal.light = 255;
|
||||
gldecal.rel = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gldecal.light = lightlevel;
|
||||
gldecal.rel = rellight + getExtraLight();
|
||||
}
|
||||
|
||||
gldecal.colormap = Colormap;
|
||||
|
||||
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)
|
||||
{
|
||||
gldecal.colormap.Decolorize();
|
||||
}
|
||||
|
||||
gldecal.a = decal->Alpha;
|
||||
gldecal.zcenter = zpos - decalheight * 0.5f;
|
||||
memcpy(gldecal.dv, dv, sizeof(dv));
|
||||
|
||||
auto verts = di->AllocVertices(4);
|
||||
gldecal.vertindex = verts.second;
|
||||
|
|
Loading…
Reference in a new issue