- fixed: translucency detection in multipatch textures did not work.

- fixed: The flat drawer never checked if a texture had translucent parts.
This commit is contained in:
Christoph Oelckers 2016-09-08 12:18:09 +02:00
parent 5a64307ad1
commit b9ca3c85f8
3 changed files with 22 additions and 4 deletions

View File

@ -419,15 +419,17 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
gl_SetColor(lightlevel, rel, Colormap, alpha);
gl_SetFog(lightlevel, rel, &Colormap, false);
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
if (!gltexture)
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.EnableTexture(false);
DrawSubsectors(pass, false, true);
gl_RenderState.EnableTexture(true);
}
else
{
if (!gltexture->GetTransparent()) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
else gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
gl_SetPlaneTextureRotation(&plane, gltexture);
DrawSubsectors(pass, !gl.legacyMode, true);
@ -477,6 +479,21 @@ inline void GLFlat::PutFlat(bool fog)
// translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list.
list = (renderflags&SSRF_RENDER3DPLANES) ? GLDL_TRANSLUCENT : GLDL_TRANSLUCENTBORDER;
}
else if (gltexture->GetTransparent())
{
if (stack)
{
list = GLDL_TRANSLUCENTBORDER;
}
else if ((renderflags&SSRF_RENDER3DPLANES) && !plane.plane.isSlope())
{
list = GLDL_TRANSLUCENT;
}
else
{
list = GLDL_PLAINFLATS;
}
}
else
{
bool masked = gltexture->isMasked() && ((renderflags&SSRF_RENDER3DPLANES) || stack);

View File

@ -380,7 +380,7 @@ struct bCopyAlpha
};
struct bOverlay
{
{
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; }
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = MAX(s,d); }
static __forceinline bool ProcessAlpha0() { return false; }

View File

@ -628,8 +628,9 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota
{
ret = Parts[i].Texture->CopyTrueColorPixels(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate, &info);
}
if (ret > retv) retv = ret;
// treat -1 (i.e. unknown) as absolute. We have no idea if this may have overwritten previous info so a real check needs to be done.
if (ret == -1) retv = ret;
else if (retv != -1 && ret > retv) retv = ret;
}
// Restore previous clipping rectangle.
bmp->SetClipRect(saved_cr);