- fixed: The code for updating vertex dirty state had been completely missing. I have no idea when it disappeared...

This commit is contained in:
Christoph Oelckers 2014-07-27 17:57:53 +02:00
parent 7ae25906fd
commit 925305aa05
3 changed files with 43 additions and 5 deletions

View File

@ -625,13 +625,39 @@ void gl_PreprocessLevel()
PrepareSegs();
PrepareSectorData();
InitVertexData();
int *checkmap = new int[numvertexes];
memset(checkmap, -1, sizeof(int)*numvertexes);
for(i=0;i<numsectors;i++)
{
sectors[i].dirty = true;
sectors[i].sectornum = i;
PrepareTransparentDoors(&sectors[i]);
// This ignores vertices only used for seg splitting because those aren't needed here
for(int j = 0; j < sectors[i].linecount; j++)
{
line_t *l = sectors[i].lines[j];
if (l->sidedef[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();
if (GLRenderer != NULL)

View File

@ -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;
}

View File

@ -439,6 +439,8 @@ struct extsector_t
TArray<sector_t*> attached; // 3D floors attached to this sector
} XFloor;
TArray<vertex_t *> 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