From 6438416adbef9984cab217ff83754134d0b95e42 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Jan 2018 16:29:40 +0100 Subject: [PATCH] - fixed: The culling mode for translucent models must be inverted when rendering a mirror. --- src/gl/models/gl_models.cpp | 3 ++- src/gl/scene/gl_portal.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index f6ee0e936..3bceeedf7 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -46,6 +46,7 @@ #include "gl/system/gl_interface.h" #include "gl/renderer/gl_renderer.h" #include "gl/scene/gl_drawinfo.h" +#include "gl/scene/gl_portal.h" #include "gl/models/gl_models.h" #include "gl/textures/gl_material.h" #include "gl/utility/gl_convert.h" @@ -100,7 +101,7 @@ void FGLModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectTo if (!(actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])) { glEnable(GL_CULL_FACE); - glFrontFace(GL_CCW); + glFrontFace(GLPortal::isMirrored()? GL_CW : GL_CCW); } gl_RenderState.mModelMatrix = objectToWorldMatrix; diff --git a/src/gl/scene/gl_portal.h b/src/gl/scene/gl_portal.h index 010472c97..4eade59d2 100644 --- a/src/gl/scene/gl_portal.h +++ b/src/gl/scene/gl_portal.h @@ -167,6 +167,8 @@ public: return recursion; } + static bool isMirrored() { return !!((MirrorFlag ^ PlaneMirrorFlag) & 1); } + virtual int ClipSeg(seg_t *seg) { return PClip_Inside; } virtual int ClipSubsector(subsector_t *sub) { return PClip_Inside; } virtual int ClipPoint(const DVector2 &pos) { return PClip_Inside; }