From f5f7cd9fed688d0cb06d192997a9b941c9d4bc76 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 11 Sep 2017 12:22:22 +0300 Subject: [PATCH 1/3] Fixed broken FOV in SetCameraToTexture() ACS function --- src/p_acs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index ce21871a6..2dfbec49b 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -10041,7 +10041,7 @@ scriptwait: } else { - FCanvasTextureInfo::Add (camera, picnum, ACSToDouble(STACK(1))); + FCanvasTextureInfo::Add (camera, picnum, STACK(1)); } } sp -= 3; From 3e12884720c0e812e653b5ef433ec4b7dfcdcc1e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 11 Sep 2017 13:14:34 +0300 Subject: [PATCH 2/3] Updated Travis CI configuration to use Clang 5.0 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3de14e1d9..7bfb4c527 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,15 +56,15 @@ matrix: - os: linux compiler: clang env: - - CLANG_VERSION=4.0 + - CLANG_VERSION=5.0 - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=MinSizeRel -DDYN_OPENAL=NO -DDYN_SNDFILE=NO -DDYN_MPG123=NO -DDYN_FLUIDSYNTH=NO" addons: apt: sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-4.0 + - llvm-toolchain-trusty-5.0 packages: - - clang-4.0 + - clang-5.0 - libstdc++-5-dev - libsdl2-dev - libgme-dev From 70220fb4ccf99723df8b098ddb65d5e7e837fba1 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 12 Sep 2017 02:40:09 +0200 Subject: [PATCH 3/3] - Slightly improve softpoly opaque pass performance --- src/polyrenderer/scene/poly_plane.cpp | 94 +++++++++++++-------------- src/polyrenderer/scene/poly_plane.h | 16 ++++- src/polyrenderer/scene/poly_wall.cpp | 2 +- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/src/polyrenderer/scene/poly_plane.cpp b/src/polyrenderer/scene/poly_plane.cpp index bc7d46d9e..668053a01 100644 --- a/src/polyrenderer/scene/poly_plane.cpp +++ b/src/polyrenderer/scene/poly_plane.cpp @@ -187,18 +187,40 @@ void RenderPolyPlane::Render(PolyRenderThread *thread, const TriMatrix &worldToC if (ceiling) { - for (uint32_t i = 0; i < sub->numlines; i++) + if (!isSky) { - seg_t *line = &sub->firstline[i]; - vertices[sub->numlines - 1 - i] = transform.GetVertex(line->v1, isSky ? skyHeight : frontsector->ceilingplane.ZatPoint(line->v1)); + for (uint32_t i = 0; i < sub->numlines; i++) + { + seg_t *line = &sub->firstline[i]; + vertices[sub->numlines - 1 - i] = transform.GetVertex(line->v1, frontsector->ceilingplane.ZatPoint(line->v1)); + } + } + else + { + for (uint32_t i = 0; i < sub->numlines; i++) + { + seg_t *line = &sub->firstline[i]; + vertices[sub->numlines - 1 - i] = transform.GetVertex(line->v1, skyHeight); + } } } else { - for (uint32_t i = 0; i < sub->numlines; i++) + if (!isSky) { - seg_t *line = &sub->firstline[i]; - vertices[i] = transform.GetVertex(line->v1, isSky ? skyHeight : frontsector->floorplane.ZatPoint(line->v1)); + for (uint32_t i = 0; i < sub->numlines; i++) + { + seg_t *line = &sub->firstline[i]; + vertices[i] = transform.GetVertex(line->v1, frontsector->floorplane.ZatPoint(line->v1)); + } + } + else + { + for (uint32_t i = 0; i < sub->numlines; i++) + { + seg_t *line = &sub->firstline[i]; + vertices[i] = transform.GetVertex(line->v1, skyHeight); + } } } @@ -259,42 +281,40 @@ void RenderPolyPlane::RenderSkyWalls(PolyRenderThread *thread, PolyDrawArgs &arg { for (uint32_t i = 0; i < sub->numlines; i++) { - TriVertex *wallvert = thread->FrameMemory->AllocMemory(4); - seg_t *line = &sub->firstline[i]; double skyBottomz1 = frontsector->ceilingplane.ZatPoint(line->v1); double skyBottomz2 = frontsector->ceilingplane.ZatPoint(line->v2); if (line->backsector) { - sector_t *backsector = (line->backsector != line->frontsector) ? line->backsector : line->frontsector; - - double frontceilz1 = frontsector->ceilingplane.ZatPoint(line->v1); - double frontfloorz1 = frontsector->floorplane.ZatPoint(line->v1); - double frontceilz2 = frontsector->ceilingplane.ZatPoint(line->v2); - double frontfloorz2 = frontsector->floorplane.ZatPoint(line->v2); + sector_t *backsector = line->backsector; double backceilz1 = backsector->ceilingplane.ZatPoint(line->v1); double backfloorz1 = backsector->floorplane.ZatPoint(line->v1); double backceilz2 = backsector->ceilingplane.ZatPoint(line->v2); double backfloorz2 = backsector->floorplane.ZatPoint(line->v2); - double topceilz1 = frontceilz1; - double topceilz2 = frontceilz2; - double topfloorz1 = MIN(backceilz1, frontceilz1); - double topfloorz2 = MIN(backceilz2, frontceilz2); - double bottomceilz1 = MAX(frontfloorz1, backfloorz1); - double bottomceilz2 = MAX(frontfloorz2, backfloorz2); - double middleceilz1 = topfloorz1; - double middleceilz2 = topfloorz2; - double middlefloorz1 = MIN(bottomceilz1, middleceilz1); - double middlefloorz2 = MIN(bottomceilz2, middleceilz2); - bool bothSkyCeiling = frontsector->GetTexture(sector_t::ceiling) == skyflatnum && backsector->GetTexture(sector_t::ceiling) == skyflatnum; bool closedSector = backceilz1 == backfloorz1 && backceilz2 == backfloorz2; if (ceiling && bothSkyCeiling && closedSector) { + double frontceilz1 = frontsector->ceilingplane.ZatPoint(line->v1); + double frontfloorz1 = frontsector->floorplane.ZatPoint(line->v1); + double frontceilz2 = frontsector->ceilingplane.ZatPoint(line->v2); + double frontfloorz2 = frontsector->floorplane.ZatPoint(line->v2); + + double topceilz1 = frontceilz1; + double topceilz2 = frontceilz2; + double topfloorz1 = MIN(backceilz1, frontceilz1); + double topfloorz2 = MIN(backceilz2, frontceilz2); + double bottomceilz1 = MAX(frontfloorz1, backfloorz1); + double bottomceilz2 = MAX(frontfloorz2, backfloorz2); + double middleceilz1 = topfloorz1; + double middleceilz2 = topfloorz2; + double middlefloorz1 = MIN(bottomceilz1, middleceilz1); + double middlefloorz2 = MIN(bottomceilz2, middleceilz2); + skyBottomz1 = middlefloorz1; skyBottomz2 = middlefloorz2; } @@ -310,6 +330,8 @@ void RenderPolyPlane::RenderSkyWalls(PolyRenderThread *thread, PolyDrawArgs &arg skyBottomz2 = frontsector->floorplane.ZatPoint(line->v2); } + TriVertex *wallvert = thread->FrameMemory->AllocMemory(4); + if (ceiling) { wallvert[0] = transform.GetVertex(line->v1, skyHeight); @@ -361,28 +383,6 @@ PolyPlaneUVTransform::PolyPlaneUVTransform(const FTransform &transform, FTexture } } -TriVertex PolyPlaneUVTransform::GetVertex(vertex_t *v1, double height) const -{ - TriVertex v; - v.x = (float)v1->fPos().X; - v.y = (float)v1->fPos().Y; - v.z = (float)height; - v.w = 1.0f; - v.u = GetU(v.x, v.y); - v.v = GetV(v.x, v.y); - return v; -} - -float PolyPlaneUVTransform::GetU(float x, float y) const -{ - return (xOffs + x * cosine - y * sine) * xscale; -} - -float PolyPlaneUVTransform::GetV(float x, float y) const -{ - return (yOffs - x * sine - y * cosine) * yscale; -} - ///////////////////////////////////////////////////////////////////////////// void Render3DFloorPlane::RenderPlanes(PolyRenderThread *thread, const TriMatrix &worldToClip, const PolyClipPlane &clipPlane, subsector_t *sub, uint32_t stencilValue, uint32_t subsectorDepth, std::vector &translucentObjects) diff --git a/src/polyrenderer/scene/poly_plane.h b/src/polyrenderer/scene/poly_plane.h index 27f671f56..918640369 100644 --- a/src/polyrenderer/scene/poly_plane.h +++ b/src/polyrenderer/scene/poly_plane.h @@ -31,11 +31,21 @@ class PolyPlaneUVTransform public: PolyPlaneUVTransform(const FTransform &transform, FTexture *tex); - TriVertex GetVertex(vertex_t *v1, double height) const; + TriVertex GetVertex(vertex_t *v1, double height) const + { + TriVertex v; + v.x = (float)v1->fX(); + v.y = (float)v1->fY(); + v.z = (float)height; + v.w = 1.0f; + v.u = GetU(v.x, v.y); + v.v = GetV(v.x, v.y); + return v; + } private: - float GetU(float x, float y) const; - float GetV(float x, float y) const; + float GetU(float x, float y) const { return (xOffs + x * cosine - y * sine) * xscale; } + float GetV(float x, float y) const { return (yOffs - x * sine - y * cosine) * yscale; } float xscale; float yscale; diff --git a/src/polyrenderer/scene/poly_wall.cpp b/src/polyrenderer/scene/poly_wall.cpp index 7da63b18e..57e24da37 100644 --- a/src/polyrenderer/scene/poly_wall.cpp +++ b/src/polyrenderer/scene/poly_wall.cpp @@ -112,7 +112,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const TriMatrix &world } else { - sector_t *backsector = (line->backsector != line->frontsector) ? line->backsector : line->frontsector; + sector_t *backsector = line->backsector; double backceilz1 = backsector->ceilingplane.ZatPoint(line->v1); double backfloorz1 = backsector->floorplane.ZatPoint(line->v1);