From 3b7a5da83e547b679ab2a8872245f94be9a36fa4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Oct 2018 00:38:56 +0200 Subject: [PATCH] - moved AddFlat to gl_drawinfo.cpp and deleted gl_flats.cpp. --- src/CMakeLists.txt | 1 - src/gl/scene/gl_drawinfo.cpp | 48 +++++++++++++++++++ src/gl/scene/gl_flats.cpp | 91 ------------------------------------ 3 files changed, 48 insertions(+), 92 deletions(-) delete mode 100644 src/gl/scene/gl_flats.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 40f11a9fe..7320f22f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -821,7 +821,6 @@ set( FASTMATH_SOURCES textures/hires/xbr/xbrz.cpp textures/hires/xbr/xbrz_old.cpp gl/scene/gl_drawinfo.cpp - gl/scene/gl_flats.cpp gl/scene/gl_sprite.cpp gl/scene/gl_skydome.cpp gl/scene/gl_weapon.cpp diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index 8f56f4a89..1a1735e4d 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -273,6 +273,12 @@ bool FDrawInfo::SetDepthClamp(bool on) return gl_RenderState.SetDepthClamp(on); } +//========================================================================== +// +// +// +//========================================================================== + static int dt2gl[] = { GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP }; void FDrawInfo::Draw(EDrawType dt, FRenderState &state, int index, int count, bool apply) @@ -303,3 +309,45 @@ void FDrawInfo::DrawIndexed(EDrawType dt, FRenderState &state, int index, int co +//========================================================================== +// +// FDrawInfo::AddFlat +// +// Checks texture, lighting and translucency settings and puts this +// plane in the appropriate render list. +// +//========================================================================== + +void FDrawInfo::AddFlat(GLFlat *flat, bool fog) +{ + int list; + + if (flat->renderstyle != STYLE_Translucent || flat->alpha < 1.f - FLT_EPSILON || fog || flat->gltexture == nullptr) + { + // translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list. + list = (flat->renderflags&SSRF_RENDER3DPLANES) ? GLDL_TRANSLUCENT : GLDL_TRANSLUCENTBORDER; + } + else if (flat->gltexture->tex->GetTranslucency()) + { + if (flat->stack) + { + list = GLDL_TRANSLUCENTBORDER; + } + else if ((flat->renderflags&SSRF_RENDER3DPLANES) && !flat->plane.plane.isSlope()) + { + list = GLDL_TRANSLUCENT; + } + else + { + list = GLDL_PLAINFLATS; + } + } + else + { + bool masked = flat->gltexture->isMasked() && ((flat->renderflags&SSRF_RENDER3DPLANES) || flat->stack); + list = masked ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS; + } + auto newflat = drawlists[list].NewFlat(); + *newflat = *flat; +} + diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp deleted file mode 100644 index 464d19ac3..000000000 --- a/src/gl/scene/gl_flats.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -//--------------------------------------------------------------------------- -// -// Copyright(C) 2000-2016 Christoph Oelckers -// All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see http://www.gnu.org/licenses/ -// -//-------------------------------------------------------------------------- -// -/* -** gl_flat.cpp -** Flat rendering -** -*/ - -#include "gl_load/gl_system.h" -#include "a_sharedglobal.h" -#include "r_defs.h" -#include "r_sky.h" -#include "r_utility.h" -#include "doomstat.h" -#include "d_player.h" -#include "g_levellocals.h" -#include "actorinlines.h" -#include "p_lnspec.h" -#include "hwrenderer/dynlights/hw_dynlightdata.h" - -#include "gl_load/gl_interface.h" -#include "hwrenderer/utility/hw_cvars.h" -#include "gl/renderer/gl_renderer.h" -#include "gl/renderer/gl_lightdata.h" -#include "gl/renderer/gl_renderstate.h" -#include "gl/data/gl_vertexbuffer.h" -#include "gl/dynlights/gl_lightbuffer.h" -#include "gl/scene/gl_drawinfo.h" - - -//========================================================================== -// -// FDrawInfo::AddFlat -// -// Checks texture, lighting and translucency settings and puts this -// plane in the appropriate render list. -// -//========================================================================== - -void FDrawInfo::AddFlat(GLFlat *flat, bool fog) -{ - int list; - - if (flat->renderstyle != STYLE_Translucent || flat->alpha < 1.f - FLT_EPSILON || fog || flat->gltexture == nullptr) - { - // translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list. - list = (flat->renderflags&SSRF_RENDER3DPLANES) ? GLDL_TRANSLUCENT : GLDL_TRANSLUCENTBORDER; - } - else if (flat->gltexture->tex->GetTranslucency()) - { - if (flat->stack) - { - list = GLDL_TRANSLUCENTBORDER; - } - else if ((flat->renderflags&SSRF_RENDER3DPLANES) && !flat->plane.plane.isSlope()) - { - list = GLDL_TRANSLUCENT; - } - else - { - list = GLDL_PLAINFLATS; - } - } - else - { - bool masked = flat->gltexture->isMasked() && ((flat->renderflags&SSRF_RENDER3DPLANES) || flat->stack); - list = masked ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS; - } - auto newflat = drawlists[list].NewFlat(); - *newflat = *flat; -} -