From edabe43bca15b80da911ee566e999b21314bb061 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 1 Jun 2018 12:24:29 +0300 Subject: [PATCH 01/10] - fixed typo in previous commit https://forum.zdoom.org/viewtopic.php?t=60739 --- src/hwrenderer/scene/hw_walls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hwrenderer/scene/hw_walls.cpp b/src/hwrenderer/scene/hw_walls.cpp index b70c4ebf8..f8ed6d30d 100644 --- a/src/hwrenderer/scene/hw_walls.cpp +++ b/src/hwrenderer/scene/hw_walls.cpp @@ -1522,7 +1522,7 @@ void GLWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_ } v1 = seg->v1; v2 = seg->v2; - flags |= GLWF_NOSPLITLOWER | GLWF_NOSPLITLOWER; // seg-splitting not needed for single segs. + flags |= GLWF_NOSPLITUPPER | GLWF_NOSPLITLOWER; // seg-splitting not needed for single segs. } From 7b619bc78c3063c4ea3e9828c6314ba051a3e3aa Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 1 Jun 2018 12:28:27 +0300 Subject: [PATCH 02/10] - fixed crash with legacy render path https://forum.zdoom.org/viewtopic.php?t=60727 --- src/gl/data/gl_vertexbuffer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gl/data/gl_vertexbuffer.cpp b/src/gl/data/gl_vertexbuffer.cpp index bf867f13e..cd7549aa8 100644 --- a/src/gl/data/gl_vertexbuffer.cpp +++ b/src/gl/data/gl_vertexbuffer.cpp @@ -249,10 +249,7 @@ void FFlatVertexBuffer::Unmap() void FFlatVertexBuffer::CreateVBO() { vbo_shadowdata.Resize(mNumReserved); - if (!gl.legacyMode) - { - FFlatVertexGenerator::CreateVertices(); - } + FFlatVertexGenerator::CreateVertices(); mCurIndex = mIndex = vbo_shadowdata.Size(); Map(); memcpy(map, &vbo_shadowdata[0], vbo_shadowdata.Size() * sizeof(FFlatVertex)); From 359b13b783c036d1b6dd944ca8370d4ebcf51649 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 1 Jun 2018 20:48:24 +0200 Subject: [PATCH 03/10] - fix rotationSpeed being ignored after the model interpolation fix --- src/r_data/models/models.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/r_data/models/models.cpp b/src/r_data/models/models.cpp index 1a898f062..ca7b02ad3 100644 --- a/src/r_data/models/models.cpp +++ b/src/r_data/models/models.cpp @@ -94,8 +94,16 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s if (smf->flags & MDL_ROTATING) { - double turns = (I_GetTime() % 200 + I_GetTimeFrac()) / 200.0; - rotateOffset = turns * 360.0; + if (smf->rotationSpeed > 0.0000000001) + { + double turns = (I_GetTime() + I_GetTimeFrac()) / (200.0 / smf->rotationSpeed); + turns -= std::floor(turns); + rotateOffset = turns * 360.0; + } + else + { + rotateOffset = 0.0; + } } // Added MDL_USEACTORPITCH and MDL_USEACTORROLL flags processing. From 058c5426cd4413a37c564d45f2ea216174f36716 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 2 Jun 2018 07:25:41 +0200 Subject: [PATCH 04/10] - fixed: OpenGL2 should not use the precalculated vertex buffer data for flat rendering. This wasn't set up properly anymore because the new index-based buffer code is not efficient on GL2, but the render function forgot to skip the buffer checks and jump right to the fallback path. --- src/gl/scene/gl_flats.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 70ca080f2..e9a3314e0 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -209,7 +209,11 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool int dli = flat->dynlightindex; gl_RenderState.Apply(); - if (gl.legacyMode) processlights = false; + if (gl.legacyMode) + { + processlights = false; + goto legacy; + } auto vcount = flat->sector->ibocount; if (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive()) @@ -243,6 +247,7 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool } else { + legacy: // Draw the subsectors belonging to this sector for (int i=0; isector->subsectorcount; i++) { From 7d515e72c2f8e63a6310eec7fbf7611874e7ebcb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 2 Jun 2018 07:50:23 +0200 Subject: [PATCH 05/10] - fixed: FxFloatCast must transfer the outer expression's value type to the inner expression if it performs a float->float cast. This violated an important rule that a cast may not alter the expression's type and led to failed asserts elsewhere. --- src/scripting/backend/codegen.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index e7180afd1..8dfe5d8f8 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -1060,6 +1060,7 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx) if (basex->IsFloat()) { FxExpression *x = basex; + x->ValueType = ValueType; basex = nullptr; delete this; return x; From 81f042f08bc0fc818c4bef819aeec0af7559a2d6 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 2 Jun 2018 09:43:33 +0300 Subject: [PATCH 06/10] - fixed compilation with Clang and GCC src/gl/scene/gl_flats.cpp:215:3: error: cannot jump from this goto statement to its label src/r_data/models/models.cpp:100:18: error: no member named 'floor' in namespace 'std' --- src/gl/scene/gl_flats.cpp | 2 +- src/r_data/models/models.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index e9a3314e0..63c4f9a01 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -207,6 +207,7 @@ void FDrawInfo::ProcessLights(GLFlat *flat, bool istrans) void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool istrans) { int dli = flat->dynlightindex; + auto vcount = flat->sector->ibocount; gl_RenderState.Apply(); if (gl.legacyMode) @@ -215,7 +216,6 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool goto legacy; } - auto vcount = flat->sector->ibocount; if (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive()) { if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli); diff --git a/src/r_data/models/models.cpp b/src/r_data/models/models.cpp index ca7b02ad3..b8b324524 100644 --- a/src/r_data/models/models.cpp +++ b/src/r_data/models/models.cpp @@ -97,7 +97,7 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s if (smf->rotationSpeed > 0.0000000001) { double turns = (I_GetTime() + I_GetTimeFrac()) / (200.0 / smf->rotationSpeed); - turns -= std::floor(turns); + turns -= floor(turns); rotateOffset = turns * 360.0; } else From d419bf33477835c62549636278e16051f8b2235d Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 2 Jun 2018 03:36:53 -0400 Subject: [PATCH 07/10] - There really isn't an "or greater" for the GPL v3 license - if the license needs to be upgraded in the future then it should be done so explicitly. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f04f324f7..f78cfbfc6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Please see license files for individual contributor licenses Special thanks to Coraline of the 3DGE team for allowing us to use her README.md as a template for this one. -### Licensed under the GPL v3 (or greater) +### Licensed under the GPL v3 ##### https://www.gnu.org/licenses/quick-guide-gplv3.en.html --- From 58f4af6ded52ff4e41adaa92eac819c01f1400b9 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Mon, 28 May 2018 08:53:53 +0200 Subject: [PATCH 08/10] Transform UE1 vertex coords to GZDoom's when importing, rather than leaving it up to the end user. --- src/r_data/models/models_ue1.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/r_data/models/models_ue1.cpp b/src/r_data/models/models_ue1.cpp index 98ea08a19..682b5c37e 100644 --- a/src/r_data/models/models_ue1.cpp +++ b/src/r_data/models/models_ue1.cpp @@ -29,11 +29,11 @@ float unpackuvert( uint32_t n, int c ) switch( c ) { case 2: - return ((int16_t)((n&0x7ff)<<5))/127.f; + return ((int16_t)((n&0x7ff)<<5))/128.f; case 1: - return ((int16_t)(((n>>11)&0x7ff)<<5))/127.f; + return ((int16_t)(((n>>11)&0x7ff)<<5))/128.f; case 0: - return ((int16_t)(((n>>22)&0x3ff)<<6))/127.f; + return ((int16_t)(((n>>22)&0x3ff)<<6))/128.f; default: return 0.f; } @@ -98,9 +98,9 @@ void FUE1Model::LoadGeometry() { UE1Vertex Vert; // unpack position - Vert.Pos = FVector3(unpackuvert(averts[j+i*numVerts],0), - unpackuvert(averts[j+i*numVerts],1), - unpackuvert(averts[j+i*numVerts],2)); + Vert.Pos = FVector3(unpackuvert(averts[j+i*numVerts],2), + unpackuvert(averts[j+i*numVerts],0), + -unpackuvert(averts[j+i*numVerts],1)); // push vertex (without normals, will be calculated later) verts.Push(Vert); } @@ -136,8 +136,6 @@ void FUE1Model::LoadGeometry() vert[l] = verts[polys[k].V[l]+numVerts*i].Pos; dir[0] = vert[1]-vert[0]; dir[1] = vert[2]-vert[0]; - dir[0].MakeUnit(); - dir[1].MakeUnit(); norm = dir[0]^dir[1]; nsum += norm.Unit(); } @@ -223,7 +221,7 @@ void FUE1Model::BuildVertexBuffer( FModelRenderer *renderer ) { for ( int k=0; k=0; l-- ) + for ( int l=0; l<3; l++ ) { UE1Vertex V = verts[polys[groups[j].P[k]].V[l]+i*numVerts]; FVector2 C = polys[groups[j].P[k]].C[l]; From 4e968d9c4c458d76b14be5b4a57644a67979b7f4 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 2 Jun 2018 05:03:27 -0400 Subject: [PATCH 09/10] - activate r_line_distance_cull in the hardware renderer --- src/hwrenderer/scene/hw_bsp.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/hwrenderer/scene/hw_bsp.cpp b/src/hwrenderer/scene/hw_bsp.cpp index 4393424c1..8f561c289 100644 --- a/src/hwrenderer/scene/hw_bsp.cpp +++ b/src/hwrenderer/scene/hw_bsp.cpp @@ -75,6 +75,21 @@ void HWDrawInfo::UnclipSubsector(subsector_t *sub) // //========================================================================== +EXTERN_CVAR(Float, r_line_distance_cull) + +inline bool IsDistanceCulled(seg_t *line) +{ + double dist3 = r_line_distance_cull * r_line_distance_cull; + if (dist3 <= 0.0) + return false; + + double dist1 = (line->v1->fPos() - r_viewpoint.Pos).LengthSquared(); + double dist2 = (line->v2->fPos() - r_viewpoint.Pos).LengthSquared(); + if ((dist1 > dist3) && (dist2 > dist3)) + return true; + return false; +} + void HWDrawInfo::AddLine (seg_t *seg, bool portalclip) { #ifdef _DEBUG @@ -123,6 +138,8 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip) uint8_t ispoly = uint8_t(seg->sidedef->Flags & WALLF_POLYOBJ); + if (IsDistanceCulled(seg)) { clipper.SafeAddClipRange(startAngle, endAngle); return; } + if (!seg->backsector) { clipper.SafeAddClipRange(startAngle, endAngle); From 2395defccd525e8861c6a2a5882f3852e85fab41 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 2 Jun 2018 05:21:50 -0400 Subject: [PATCH 10/10] - make GL version of line distance culling use a separate CVAR, which, for now, is turned off. --- src/hwrenderer/scene/hw_bsp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hwrenderer/scene/hw_bsp.cpp b/src/hwrenderer/scene/hw_bsp.cpp index 8f561c289..1c7041d46 100644 --- a/src/hwrenderer/scene/hw_bsp.cpp +++ b/src/hwrenderer/scene/hw_bsp.cpp @@ -75,11 +75,11 @@ void HWDrawInfo::UnclipSubsector(subsector_t *sub) // //========================================================================== -EXTERN_CVAR(Float, r_line_distance_cull) +CVAR(Float, gl_line_distance_cull, 0.0, 0 /*CVAR_ARCHIVE|CVAR_GLOBALCONFIG*/) // this is deactivated, for now inline bool IsDistanceCulled(seg_t *line) { - double dist3 = r_line_distance_cull * r_line_distance_cull; + double dist3 = gl_line_distance_cull * gl_line_distance_cull; if (dist3 <= 0.0) return false;