diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index 18d96c9b28..0dd2930ff2 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -588,7 +588,7 @@ bool FDrawInfo::PutFlatCompat(GLFlat *flat, bool fog) int list = list_indices[masked][foggy]; auto newflat = dldrawlists[list].NewFlat(); *newflat = *flat; - newflat->vboindex = -1; // don't use the vertex buffer with legacy lights to ensure all passes use the same render logic. + newflat->iboindex = -1; // don't use the vertex buffer with legacy lights to ensure all passes use the same render logic. return true; } diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 4f974598dc..70ca080f25 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -216,14 +216,14 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool { if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli); drawcalls.Clock(); - glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + flat->vboindex); + glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + flat->iboindex); drawcalls.Unclock(); flatvertices += vcount; flatprimitives++; } - else if (flat->vboindex >= 0) + else if (flat->iboindex >= 0) { - int index = flat->vboindex; + int index = flat->iboindex; for (int i=0; isector->subsectorcount; i++) { subsector_t * sub = flat->sector->subsectors[i]; diff --git a/src/hwrenderer/data/flatvertices.cpp b/src/hwrenderer/data/flatvertices.cpp index 5771012bc4..1decb2c042 100644 --- a/src/hwrenderer/data/flatvertices.cpp +++ b/src/hwrenderer/data/flatvertices.cpp @@ -177,21 +177,22 @@ int FFlatVertexGenerator::CreateIndexedSectorVertices(sector_t *sec, const secpl int FFlatVertexGenerator::CreateIndexedVertices(int h, sector_t *sec, const secplane_t &plane, int floor, TArray &gen) { + sec->vboindex[h] = vbo_shadowdata.Size(); // First calculate the vertices for the sector itself sec->vboheight[h] = sec->GetPlaneTexZ(h); - sec->vboindex[h] = CreateIndexedSectorVertices(sec, plane, floor, gen[sec->Index()]); + sec->iboindex[h] = CreateIndexedSectorVertices(sec, plane, floor, gen[sec->Index()]); // Next are all sectors using this one as heightsec TArray &fakes = sec->e->FakeFloor.Sectors; - for (unsigned g = 0; gvboindex[2 + h] = CreateIndexedSectorVertices(fsec, plane, false, gen[fsec->Index()]); + fsec->iboindex[2 + h] = CreateIndexedSectorVertices(fsec, plane, false, gen[fsec->Index()]); } // and finally all attached 3D floors TArray &xf = sec->e->XFloor.attached; - for (unsigned g = 0; gvbocount[h] = vbo_shadowdata.Size() - sec->vboindex[h]; - return sec->vboindex[h]; + return sec->iboindex[h]; } @@ -253,11 +254,11 @@ void FFlatVertexGenerator::CreateIndexedFlatVertices() { if (ff->top.model == &sec) { - ff->top.vindex = sec.vboindex[ff->top.isceiling]; + ff->top.vindex = sec.iboindex[ff->top.isceiling]; } if (ff->bottom.model == &sec) { - ff->bottom.vindex = sec.vboindex[ff->top.isceiling]; + ff->bottom.vindex = sec.iboindex[ff->top.isceiling]; } } } diff --git a/src/hwrenderer/scene/hw_bsp.cpp b/src/hwrenderer/scene/hw_bsp.cpp index d01706b6d4..4393424c1c 100644 --- a/src/hwrenderer/scene/hw_bsp.cpp +++ b/src/hwrenderer/scene/hw_bsp.cpp @@ -453,6 +453,10 @@ void HWDrawInfo::DoSubsector(subsector_t * sub) if (sector->validcount != validcount) { + if (sector->Index() == 62) + { + int a = 0; + } mVBO->CheckUpdate(sector); } diff --git a/src/hwrenderer/scene/hw_drawstructs.h b/src/hwrenderer/scene/hw_drawstructs.h index 56c74a8f79..5758cf0b8c 100644 --- a/src/hwrenderer/scene/hw_drawstructs.h +++ b/src/hwrenderer/scene/hw_drawstructs.h @@ -306,7 +306,7 @@ public: bool stack; bool ceiling; uint8_t renderflags; - int vboindex; + int iboindex; //int vboheight; int dynlightindex; diff --git a/src/hwrenderer/scene/hw_fakeflat.cpp b/src/hwrenderer/scene/hw_fakeflat.cpp index 761379851c..e4e986ca8b 100644 --- a/src/hwrenderer/scene/hw_fakeflat.cpp +++ b/src/hwrenderer/scene/hw_fakeflat.cpp @@ -234,7 +234,7 @@ sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac { dest->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false); dest->SetPlaneTexZQuick(sector_t::floor, s->GetPlaneTexZ(sector_t::floor)); - dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::vbo_fakefloor]; + dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakefloor]; dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor]; } else if (s->MoreFlags & SECMF_FAKEFLOORONLY) @@ -260,7 +260,7 @@ sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac dest->SetPlaneTexZQuick(sector_t::floor, s->GetPlaneTexZ(sector_t::floor)); dest->floorplane = s->floorplane; - dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::vbo_fakefloor]; + dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakefloor]; dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor]; } @@ -272,7 +272,7 @@ sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac { dest->SetTexture(sector_t::ceiling, s->GetTexture(sector_t::ceiling), false); dest->SetPlaneTexZQuick(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling)); - dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakeceiling]; + dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakeceiling]; dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling]; } } @@ -280,7 +280,7 @@ sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac { dest->ceilingplane = s->ceilingplane; dest->SetPlaneTexZQuick(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling)); - dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakeceiling]; + dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakeceiling]; dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling]; } } @@ -294,10 +294,10 @@ sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac dest->ceilingplane=s->floorplane; dest->ceilingplane.FlipVert(); - dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::floor]; + dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::floor]; dest->vboheight[sector_t::floor] = sec->vboheight[sector_t::floor]; - dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakefloor]; + dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakefloor]; dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::floor]; dest->ClearPortal(sector_t::ceiling); @@ -347,10 +347,10 @@ sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac dest->floorplane = s->ceilingplane; dest->floorplane.FlipVert(); - dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::vbo_fakeceiling]; + dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakeceiling]; dest->vboheight[sector_t::floor] = s->vboheight[sector_t::ceiling]; - dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::ceiling]; + dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::ceiling]; dest->vboheight[sector_t::ceiling] = sec->vboheight[sector_t::ceiling]; dest->ClearPortal(sector_t::floor); diff --git a/src/hwrenderer/scene/hw_flats.cpp b/src/hwrenderer/scene/hw_flats.cpp index fa1ff287a7..27e31843f3 100644 --- a/src/hwrenderer/scene/hw_flats.cpp +++ b/src/hwrenderer/scene/hw_flats.cpp @@ -229,11 +229,11 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside) renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent; if (plane.model->VBOHeightcheck(plane.isceiling)) { - vboindex = plane.vindex; + iboindex = plane.vindex; } else { - vboindex = -1; + iboindex = -1; } } @@ -298,11 +298,11 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector) { if (frontsector->VBOHeightcheck(sector_t::floor)) { - vboindex = frontsector->vboindex[sector_t::floor]; + iboindex = frontsector->iboindex[sector_t::floor]; } else { - vboindex = -1; + iboindex = -1; } ceiling = false; @@ -358,11 +358,11 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector) { if (frontsector->VBOHeightcheck(sector_t::ceiling)) { - vboindex = frontsector->vboindex[sector_t::ceiling]; + iboindex = frontsector->iboindex[sector_t::ceiling]; } else { - vboindex = -1; + iboindex = -1; } ceiling = true; diff --git a/src/r_defs.h b/src/r_defs.h index 17fcc5cad0..4ba0d45d35 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1087,7 +1087,8 @@ public: vbo_fakeceiling = ceiling+2, }; - int vboindex[4]; // VBO/IBO indices of the 4 planes this sector uses during rendering + int vboindex[4]; // VBO indices of the 4 planes this sector uses during rendering. This is only needed for updating plane heights. + int iboindex[4]; // IBO indices of the 4 planes this sector uses during rendering double vboheight[2]; // Last calculated height for the 2 planes of this actual sector int vbocount[2]; // Total count of vertices belonging to this sector's planes. This is used when a sector height changes and also contains all attached planes. int ibocount; // number of indices per plane (identical for all planes.) If this is -1 the index buffer is not in use.