From 4f21ff275c639de4b92f039868c1a637a8e43f49 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 29 Dec 2016 11:44:07 +0100 Subject: [PATCH 1/3] - removed duplicate portal_ceil_alpha and portal_floor_alpha UDMF properties. These already existed as 'alphafloor' and 'alphaceiling' and got accidentally duplicated by Eternity. --- specs/udmf_zdoom.txt | 2 -- src/namedef.h | 2 -- src/p_udmf.cpp | 8 -------- 3 files changed, 12 deletions(-) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 835f3780e..775d67907 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -215,13 +215,11 @@ Note: All fields default to false unless mentioned otherwise. floorterrain = ; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.' ceilingterrain = ; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.' - portal_ceil_alpha = // translucency of ceiling portal (default is 0 (not visible)) portal_ceil_blocksound = // ceiling portal blocks sound. portal_ceil_disabled = // ceiling portal disabled. portal_ceil_nopass = // ceiling portal blocks movement if true. portal_ceil_norender = // ceiling portal not rendered. portal_ceil_overlaytype = // defines translucency style, can either be "translucent" or "additive". Default is "translucent". - portal_floor_alpha = // translucency of floor portal (default is 0 (not visible)) portal_floor_blocksound = // floor portal blocks sound. portal_floor_disabled = // floor portal disabled. portal_floor_nopass = // ceiling portal blocks movement if true. diff --git a/src/namedef.h b/src/namedef.h index 62d513437..a1b603995 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -518,14 +518,12 @@ xx(Alphaceiling) xx(Renderstylefloor) xx(Renderstyleceiling) xx(Waterzone) -xx(portal_ceil_alpha) xx(portal_ceil_blocksound) xx(portal_ceil_disabled) xx(portal_ceil_nopass) xx(portal_ceil_norender) xx(portal_ceil_overlaytype) xx(portal_ceil_useglobaltex) -xx(portal_floor_alpha) xx(portal_floor_blocksound) xx(portal_floor_disabled) xx(portal_floor_nopass) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 2ef8a9ced..783f1cdf4 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1569,10 +1569,6 @@ public: tagstring = CheckString(key); break; - case NAME_portal_ceil_alpha: - sec->planes[sector_t::ceiling].alpha = CheckFloat(key); - break; - case NAME_portal_ceil_blocksound: Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_BLOCKSOUND, key); break; @@ -1594,10 +1590,6 @@ public: else if (!stricmp(CheckString(key), "additive")) sec->planes[sector_t::ceiling].Flags |= PLANEF_ADDITIVE; break; - case NAME_portal_floor_alpha: - sec->planes[sector_t::floor].alpha = CheckFloat(key); - break; - case NAME_portal_floor_blocksound: Flag(sec->planes[sector_t::floor].Flags, PLANEF_BLOCKSOUND, key); break; From a3070e8846ce5268fa5201eabb154c53db65aaca Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 29 Dec 2016 14:33:53 +0100 Subject: [PATCH 2/3] - fixed: FGLTexture::CreateTexBuffer needs to be more careful with setting the texture's translucency information. First, if it has already been determined the value should be left alone and second, for translated textures the generated buffer is inconclusive so in that case it cannot be used at all. --- src/gl/scene/gl_sprite.cpp | 2 +- src/gl/textures/gl_material.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index f79549a39..642e31c91 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -916,7 +916,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) RenderStyle = LegacyRenderStyles[STYLE_Translucent]; OverrideShader = gl_fuzztype + 4; trans = 0.99f; // trans may not be 1 here - hw_styleflags |= STYLEHW_NoAlphaTest; + hw_styleflags = STYLEHW_NoAlphaTest; } else { diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index dd224b8e0..5aa1d75b9 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -187,6 +187,7 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F { unsigned char * buffer; int W, H; + int isTransparent = -1; // Textures that are already scaled in the texture lump will not get replaced @@ -224,14 +225,16 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F int trans = tex->CopyTrueColorPixels(&imgCreate, exx, exx); bmp.CopyPixelDataRGB(0, 0, imgCreate.GetPixels(), W, H, 4, W * 4, 0, CF_BGRA); tex->CheckTrans(buffer, W*H, trans); - bIsTransparent = tex->gl_info.mIsTransparent; + isTransparent = tex->gl_info.mIsTransparent; + if (bIsTransparent == -1) bIsTransparent = isTransparent; } } else if (translation<=0) { int trans = tex->CopyTrueColorPixels(&bmp, exx, exx); tex->CheckTrans(buffer, W*H, trans); - bIsTransparent = tex->gl_info.mIsTransparent; + isTransparent = tex->gl_info.mIsTransparent; + if (bIsTransparent == -1) bIsTransparent = isTransparent; } else { @@ -239,7 +242,8 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F // Since FTexture's method is doing exactly that by calling GetPixels let's use that here // to do all the dirty work for us. ;) tex->FTexture::CopyTrueColorPixels(&bmp, exx, exx); - bIsTransparent = 0; + isTransparent = 0; + // This is not conclusive for setting the texture's transparency info. } // if we just want the texture for some checks there's no need for upsampling. @@ -247,7 +251,7 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F // [BB] The hqnx upsampling (not the scaleN one) destroys partial transparency, don't upsamle textures using it. // [BB] Potentially upsample the buffer. - return gl_CreateUpsampledTextureBuffer ( tex, buffer, W, H, w, h, !!bIsTransparent); + return gl_CreateUpsampledTextureBuffer ( tex, buffer, W, H, w, h, !!isTransparent); } From f52744e8a4edcda1fa55699ad0d3651291956ddd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 29 Dec 2016 19:54:38 +0100 Subject: [PATCH 3/3] - fixed: When looking through a plane mirror the portal plane exclusion logic needs to be flipped, because the mirror inverts the vertical view direction. --- src/gl/scene/gl_portal.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 02fd9b452..86ea68b39 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -777,6 +777,8 @@ void GLPlaneMirrorPortal::DrawContents() ClearScreen(); return; } + // A plane mirror needs to flip the portal exclusion logic because inside the mirror, up is down and down is up. + std::swap(instack[sector_t::floor], instack[sector_t::ceiling]); int old_pm=PlaneMirrorMode; @@ -794,6 +796,7 @@ void GLPlaneMirrorPortal::DrawContents() gl_RenderState.SetClipHeight(0.f, 0.f); PlaneMirrorFlag--; PlaneMirrorMode=old_pm; + std::swap(instack[sector_t::floor], instack[sector_t::ceiling]); } void GLPlaneMirrorPortal::PushState()