From 925305aa051157709ae6a98f21c6d2497ec4b9f9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 27 Jul 2014 17:57:53 +0200 Subject: [PATCH] - fixed: The code for updating vertex dirty state had been completely missing. I have no idea when it disappeared... --- src/gl/data/gl_setup.cpp | 28 +++++++++++++++++++++++++++- src/gl/system/gl_menu.cpp | 2 -- src/r_defs.h | 18 ++++++++++++++++-- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/gl/data/gl_setup.cpp b/src/gl/data/gl_setup.cpp index a76e618d9..cf2f62d74 100644 --- a/src/gl/data/gl_setup.cpp +++ b/src/gl/data/gl_setup.cpp @@ -625,12 +625,38 @@ void gl_PreprocessLevel() PrepareSegs(); PrepareSectorData(); InitVertexData(); + int *checkmap = new int[numvertexes]; + memset(checkmap, -1, sizeof(int)*numvertexes); for(i=0;isidedef[0]->Flags & WALLF_POLYOBJ) continue; // don't bother with polyobjects + + int vtnum1 = int(l->v1 - vertexes); + int vtnum2 = int(l->v2 - vertexes); + + if (checkmap[numsectors + vtnum1] < i) + { + checkmap[numsectors + vtnum1] = i; + sectors[i].e->vertices.Push(&vertexes[vtnum1]); + vertexes[vtnum1].dirty = true; + } + + if (checkmap[numsectors + vtnum2] < i) + { + checkmap[numsectors + vtnum2] = i; + sectors[i].e->vertices.Push(&vertexes[vtnum2]); + vertexes[vtnum2].dirty = true; + } + } } + delete[] checkmap; gl_InitPortals(); diff --git a/src/gl/system/gl_menu.cpp b/src/gl/system/gl_menu.cpp index 75436209c..2ec515300 100644 --- a/src/gl/system/gl_menu.cpp +++ b/src/gl/system/gl_menu.cpp @@ -18,7 +18,6 @@ CVAR(Bool, gl_portals, true, 0) CVAR(Bool, gl_noquery, false, 0) CVAR(Bool,gl_mirrors,true,0) // This is for debugging only! CVAR(Bool,gl_mirror_envmap, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) -CVAR(Bool, gl_render_segs, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, gl_seamless, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR(Int, r_mirror_recursions,4,CVAR_GLOBALCONFIG|CVAR_ARCHIVE) @@ -34,7 +33,6 @@ CUSTOM_CVAR(Bool, gl_plane_reflection, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) CUSTOM_CVAR(Bool, gl_render_precise, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { - //gl_render_segs=self; gl_seamless=self; } diff --git a/src/r_defs.h b/src/r_defs.h index a87d46cc2..2a76510f8 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -438,6 +438,8 @@ struct extsector_t TArray lightlist; // 3D light list TArray attached; // 3D floors attached to this sector } XFloor; + + TArray vertices; void Serialize(FArchive &arc); }; @@ -635,14 +637,28 @@ struct sector_t return planes[pos].TexZ; } + void SetVerticesDirty() + { + for (unsigned i = 0; i < e->vertices.Size(); i++) e->vertices[i]->dirty = true; + } + + void SetAllVerticesDirty() + { + SetVerticesDirty(); + for (unsigned i = 0; i < e->FakeFloor.Sectors.Size(); i++) e->FakeFloor.Sectors[i]->SetVerticesDirty(); + for (unsigned i = 0; i < e->XFloor.attached.Size(); i++) e->XFloor.attached[i]->SetVerticesDirty(); + } + void SetPlaneTexZ(int pos, fixed_t val) { planes[pos].TexZ = val; + SetAllVerticesDirty(); } void ChangePlaneTexZ(int pos, fixed_t val) { planes[pos].TexZ += val; + SetAllVerticesDirty(); } static inline short ClampLight(int level) @@ -765,8 +781,6 @@ struct sector_t // GL only stuff starts here float reflect[2]; - int dirtyframe[3]; // last frame this sector was marked dirty - bool dirty; // marked for recalculation bool transdoor; // For transparent door hacks fixed_t transdoorheight; // for transparent door hacks int subsectorcount; // list of subsectors