diff --git a/src/common/rendering/hwrenderer/data/flatvertices.cpp b/src/common/rendering/hwrenderer/data/flatvertices.cpp index 4f7dadd647..3005db288c 100644 --- a/src/common/rendering/hwrenderer/data/flatvertices.cpp +++ b/src/common/rendering/hwrenderer/data/flatvertices.cpp @@ -128,10 +128,3 @@ void FFlatVertexBuffer::Copy(int start, int count) mVertexBuffer = old; } - -//========================================================================== - -std::pair FRenderState::AllocVertices(unsigned int count) -{ - return screen->mVertexData->AllocVertices(count); -} diff --git a/src/common/rendering/hwrenderer/data/hw_meshbuilder.cpp b/src/common/rendering/hwrenderer/data/hw_meshbuilder.cpp index 8a8a9faf40..586ef1b483 100644 --- a/src/common/rendering/hwrenderer/data/hw_meshbuilder.cpp +++ b/src/common/rendering/hwrenderer/data/hw_meshbuilder.cpp @@ -22,6 +22,12 @@ MeshBuilder::MeshBuilder() mVertices = screen->mVertexData->vbo_shadowdata; } +void MeshBuilder::SetShadowData(const TArray& vertices, const TArray& indexes) +{ + mVertices = vertices; + mIndexes = indexes; +} + void MeshBuilder::Draw(int dt, int index, int count, bool apply) { if (apply) diff --git a/src/common/rendering/hwrenderer/data/hw_meshbuilder.h b/src/common/rendering/hwrenderer/data/hw_meshbuilder.h index 9ca0813efd..09382c9bc0 100644 --- a/src/common/rendering/hwrenderer/data/hw_meshbuilder.h +++ b/src/common/rendering/hwrenderer/data/hw_meshbuilder.h @@ -69,6 +69,8 @@ public: // Vertices std::pair AllocVertices(unsigned int count) override; + void SetShadowData(const TArray& vertices, const TArray& indexes) override; + void UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count) { } // Buffers int SetViewpoint(const HWViewpointUniforms& vp) override { return 0; } @@ -115,6 +117,7 @@ private: DrawLists* mDrawLists = nullptr; TArray mVertices; + TArray mIndexes; int mDepthFunc = 0; VSMatrix mTextureMatrix = VSMatrix::identity(); diff --git a/src/common/rendering/hwrenderer/data/hw_renderstate.h b/src/common/rendering/hwrenderer/data/hw_renderstate.h index 1c8dfdbbdb..ee83ef7159 100644 --- a/src/common/rendering/hwrenderer/data/hw_renderstate.h +++ b/src/common/rendering/hwrenderer/data/hw_renderstate.h @@ -734,7 +734,9 @@ public: // API-dependent render interface // Vertices - virtual std::pair AllocVertices(unsigned int count); + virtual std::pair AllocVertices(unsigned int count) = 0; + virtual void SetShadowData(const TArray& vertices, const TArray& indexes) = 0; + virtual void UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count) = 0; // Buffers virtual int SetViewpoint(const HWViewpointUniforms& vp) = 0; diff --git a/src/common/rendering/vulkan/vk_renderstate.cpp b/src/common/rendering/vulkan/vk_renderstate.cpp index eb5b332688..52c08eecb2 100644 --- a/src/common/rendering/vulkan/vk_renderstate.cpp +++ b/src/common/rendering/vulkan/vk_renderstate.cpp @@ -620,6 +620,30 @@ int VkRenderState::UploadBones(const TArray& bones) } } +std::pair VkRenderState::AllocVertices(unsigned int count) +{ + return fb->mVertexData->AllocVertices(count); +} + +void VkRenderState::SetShadowData(const TArray& vertices, const TArray& indexes) +{ + FFlatVertexBuffer* fvb = fb->mVertexData; + fvb->vbo_shadowdata = vertices; + fvb->ibo_data = indexes; + fvb->mCurIndex = fvb->vbo_shadowdata.Size(); + fvb->mIndex = fvb->vbo_shadowdata.Size(); + fvb->Copy(0, fvb->mIndex); + fvb->mIndexBuffer->SetData(fvb->ibo_data.Size() * sizeof(uint32_t), &fvb->ibo_data[0], BufferUsageType::Static); +} + +void VkRenderState::UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count) +{ + FFlatVertexBuffer* fvb = fb->mVertexData; + FFlatVertex* mapvt = fvb->GetBuffer(index); + memcpy(mapvt, vertices, count * sizeof(FFlatVertex)); + fvb->mVertexBuffer->Upload(index * sizeof(FFlatVertex), count * sizeof(FFlatVertex)); +} + void VkRenderState::BeginFrame() { mMaterial.Reset(); diff --git a/src/common/rendering/vulkan/vk_renderstate.h b/src/common/rendering/vulkan/vk_renderstate.h index 5214d1963c..7b90b65736 100644 --- a/src/common/rendering/vulkan/vk_renderstate.h +++ b/src/common/rendering/vulkan/vk_renderstate.h @@ -55,6 +55,11 @@ public: int UploadLights(const FDynLightData& lightdata) override; int UploadBones(const TArray& bones) override; + // Vertices + std::pair AllocVertices(unsigned int count) override; + void SetShadowData(const TArray& vertices, const TArray& indexes) override; + void UpdateShadowData(unsigned int index, const FFlatVertex* vertices, unsigned int count) override; + protected: void Apply(int dt); void ApplyRenderPass(int dt); diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index 8c56c656d2..74858907cc 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -706,7 +706,7 @@ struct sector_t 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[HW_MAX_PIPELINE_BUFFERS][2]; // Last calculated height for the 2 planes of this actual sector + 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. diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 4a93078fdc..75ccd056f5 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -3243,7 +3243,7 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position) InitRenderInfo(); // create hardware independent renderer resources for the level. This must be done BEFORE the PolyObj Spawn!!! Level->ClearDynamic3DFloorData(); // CreateVBO must be run on the plain 3D floor data. - CreateVBO(screen->mVertexData, Level->sectors); + CreateVBO(*screen->RenderState(), Level->sectors); meshcache.Clear(); screen->InitLightmap(Level->LMTextureSize, Level->LMTextureCount, Level->LMTextureData); diff --git a/src/rendering/hwrenderer/hw_vertexbuilder.cpp b/src/rendering/hwrenderer/hw_vertexbuilder.cpp index c044175dd6..89f5476ad5 100644 --- a/src/rendering/hwrenderer/hw_vertexbuilder.cpp +++ b/src/rendering/hwrenderer/hw_vertexbuilder.cpp @@ -24,10 +24,14 @@ #include "g_levellocals.h" #include "hw_vertexbuilder.h" +#include "hw_renderstate.h" #include "flatvertices.h" #include "earcut.hpp" #include "v_video.h" +TArray sector_vertices; +TArray sector_indexes; + //============================================================================= // // Creates vertex meshes for sector planes @@ -210,12 +214,12 @@ static void SetFlatVertex(FFlatVertex& ffv, vertex_t* vt, const secplane_t& plan // //========================================================================== -static int CreateIndexedSectorVerticesLM(FFlatVertexBuffer* fvb, sector_t* sec, const secplane_t& plane, int floor, int h, int lightmapIndex) +static int CreateIndexedSectorVerticesLM(FRenderState& renderstate, sector_t* sec, const secplane_t& plane, int floor, int h, int lightmapIndex) { int i, pos; float diff; - auto& ibo_data = fvb->ibo_data; + auto& ibo_data = sector_indexes; int rt = ibo_data.Size(); if (sec->transdoor && floor) diff = -1.f; @@ -227,7 +231,7 @@ static int CreateIndexedSectorVerticesLM(FFlatVertexBuffer* fvb, sector_t* sec, pos += sec->subsectors[i]->numlines; } - auto& vbo_shadowdata = fvb->vbo_shadowdata; + auto& vbo_shadowdata = sector_vertices; int vi = vbo_shadowdata.Reserve(pos); int idx = ibo_data.Reserve((pos - 2 * sec->subsectorcount) * 3); @@ -276,12 +280,12 @@ static int CreateIndexedSectorVerticesLM(FFlatVertexBuffer* fvb, sector_t* sec, return rt; } -static int CreateIndexedSectorVertices(FFlatVertexBuffer* fvb, sector_t* sec, const secplane_t& plane, int floor, VertexContainer& verts, int h, int lightmapIndex) +static int CreateIndexedSectorVertices(FRenderState& renderstate, sector_t* sec, const secplane_t& plane, int floor, VertexContainer& verts, int h, int lightmapIndex) { if (sec->HasLightmaps && lightmapIndex != -1) - return CreateIndexedSectorVerticesLM(fvb, sec, plane, floor, h, lightmapIndex); + return CreateIndexedSectorVerticesLM(renderstate, sec, plane, floor, h, lightmapIndex); - auto& vbo_shadowdata = fvb->vbo_shadowdata; + auto& vbo_shadowdata = sector_vertices; unsigned vi = vbo_shadowdata.Reserve(verts.vertices.Size()); float diff; @@ -294,7 +298,7 @@ static int CreateIndexedSectorVertices(FFlatVertexBuffer* fvb, sector_t* sec, co vbo_shadowdata[vi + i].z += diff; } - auto& ibo_data = fvb->ibo_data; + auto& ibo_data = sector_indexes; unsigned rt = ibo_data.Reserve(verts.indices.Size()); for (unsigned i = 0; i < verts.indices.Size(); i++) { @@ -309,22 +313,21 @@ static int CreateIndexedSectorVertices(FFlatVertexBuffer* fvb, sector_t* sec, co // //========================================================================== -static int CreateIndexedVertices(FFlatVertexBuffer* fvb, int h, sector_t* sec, const secplane_t& plane, int floor, VertexContainers& verts) +static int CreateIndexedVertices(FRenderState& renderstate, int h, sector_t* sec, const secplane_t& plane, int floor, VertexContainers& verts) { - auto& vbo_shadowdata = fvb->vbo_shadowdata; + auto& vbo_shadowdata = sector_vertices; sec->vboindex[h] = vbo_shadowdata.Size(); // First calculate the vertices for the sector itself - for (int n = 0; n < screen->mPipelineNbr; n++) - sec->vboheight[n][h] = sec->GetPlaneTexZ(h); + sec->vboheight[h] = sec->GetPlaneTexZ(h); sec->ibocount = verts[sec->Index()].indices.Size(); - sec->iboindex[h] = CreateIndexedSectorVertices(fvb, sec, plane, floor, verts[sec->Index()], h, 0); + sec->iboindex[h] = CreateIndexedSectorVertices(renderstate, sec, plane, floor, verts[sec->Index()], h, 0); // Next are all sectors using this one as heightsec TArray& fakes = sec->e->FakeFloor.Sectors; for (unsigned g = 0; g < fakes.Size(); g++) { sector_t* fsec = fakes[g]; - fsec->iboindex[2 + h] = CreateIndexedSectorVertices(fvb, fsec, plane, false, verts[fsec->Index()], h, -1); + fsec->iboindex[2 + h] = CreateIndexedSectorVertices(renderstate, fsec, plane, false, verts[fsec->Index()], h, -1); } // and finally all attached 3D floors @@ -342,7 +345,7 @@ static int CreateIndexedVertices(FFlatVertexBuffer* fvb, int h, sector_t* sec, c if (dotop || dobottom) { - auto ndx = CreateIndexedSectorVertices(fvb, fsec, plane, false, verts[fsec->Index()], h, ffloorIndex + 1); + auto ndx = CreateIndexedSectorVertices(renderstate, fsec, plane, false, verts[fsec->Index()], h, ffloorIndex + 1); if (dotop) ffloor->top.vindex = ndx; if (dobottom) ffloor->bottom.vindex = ndx; } @@ -359,7 +362,7 @@ static int CreateIndexedVertices(FFlatVertexBuffer* fvb, int h, sector_t* sec, c // //========================================================================== -static void CreateIndexedFlatVertices(FFlatVertexBuffer* fvb, TArray& sectors) +static void CreateIndexedFlatVertices(FRenderState& renderstate, TArray& sectors) { auto verts = BuildVertices(sectors); @@ -388,7 +391,7 @@ static void CreateIndexedFlatVertices(FFlatVertexBuffer* fvb, TArray& { for (auto& sec : sectors) { - CreateIndexedVertices(fvb, h, &sec, sec.GetSecPlane(h), h == sector_t::floor, verts); + CreateIndexedVertices(renderstate, h, &sec, sec.GetSecPlane(h), h == sector_t::floor, verts); } } @@ -416,21 +419,19 @@ static void CreateIndexedFlatVertices(FFlatVertexBuffer* fvb, TArray& // //========================================================================== -static void UpdatePlaneVertices(FFlatVertexBuffer *fvb, sector_t* sec, int plane) +static void UpdatePlaneVertices(FRenderState& renderstate, sector_t* sec, int plane) { int startvt = sec->vboindex[plane]; int countvt = sec->vbocount[plane]; secplane_t& splane = sec->GetSecPlane(plane); - FFlatVertex* vt = &fvb->vbo_shadowdata[startvt]; - FFlatVertex* mapvt = fvb->GetBuffer(startvt); - for (int i = 0; i < countvt; i++, vt++, mapvt++) + FFlatVertex* vt = §or_vertices[startvt]; + for (int i = 0; i < countvt; i++, vt++) { vt->z = (float)splane.ZatPoint(vt->x, vt->y); if (plane == sector_t::floor && sec->transdoor) vt->z -= 1; - mapvt->z = vt->z; } - fvb->mVertexBuffer->Upload(startvt * sizeof(FFlatVertex), countvt * sizeof(FFlatVertex)); + renderstate.UpdateShadowData(startvt, §or_vertices[startvt], countvt); } //========================================================================== @@ -439,10 +440,10 @@ static void UpdatePlaneVertices(FFlatVertexBuffer *fvb, sector_t* sec, int plane // //========================================================================== -static void CreateVertices(FFlatVertexBuffer* fvb, TArray& sectors) +static void CreateVertices(FRenderState& renderstate, TArray& sectors) { - fvb->vbo_shadowdata.Clear(); - CreateIndexedFlatVertices(fvb, sectors); + sector_vertices.Clear(); + CreateIndexedFlatVertices(renderstate, sectors); } //========================================================================== @@ -451,17 +452,17 @@ static void CreateVertices(FFlatVertexBuffer* fvb, TArray& sectors) // //========================================================================== -static void CheckPlanes(FFlatVertexBuffer* fvb, sector_t* sector) +static void CheckPlanes(FRenderState& renderstate, sector_t* sector) { - if (sector->GetPlaneTexZ(sector_t::ceiling) != sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::ceiling]) + if (sector->GetPlaneTexZ(sector_t::ceiling) != sector->vboheight[sector_t::ceiling]) { - UpdatePlaneVertices(fvb, sector, sector_t::ceiling); - sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::ceiling] = sector->GetPlaneTexZ(sector_t::ceiling); + UpdatePlaneVertices(renderstate, sector, sector_t::ceiling); + sector->vboheight[sector_t::ceiling] = sector->GetPlaneTexZ(sector_t::ceiling); } - if (sector->GetPlaneTexZ(sector_t::floor) != sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::floor]) + if (sector->GetPlaneTexZ(sector_t::floor) != sector->vboheight[sector_t::floor]) { - UpdatePlaneVertices(fvb, sector, sector_t::floor); - sector->vboheight[screen->mVertexData->GetPipelinePos()][sector_t::floor] = sector->GetPlaneTexZ(sector_t::floor); + UpdatePlaneVertices(renderstate, sector, sector_t::floor); + sector->vboheight[sector_t::floor] = sector->GetPlaneTexZ(sector_t::floor); } } @@ -472,13 +473,13 @@ static void CheckPlanes(FFlatVertexBuffer* fvb, sector_t* sector) // //========================================================================== -void CheckUpdate(FFlatVertexBuffer* fvb, sector_t* sector) +void CheckUpdate(FRenderState& renderstate, sector_t* sector) { - CheckPlanes(fvb, sector); + CheckPlanes(renderstate, sector); sector_t* hs = sector->GetHeightSec(); - if (hs != NULL) CheckPlanes(fvb, hs); + if (hs != NULL) CheckPlanes(renderstate, hs); for (unsigned i = 0; i < sector->e->XFloor.ffloors.Size(); i++) - CheckPlanes(fvb, sector->e->XFloor.ffloors[i]->model); + CheckPlanes(renderstate, sector->e->XFloor.ffloors[i]->model); } //========================================================================== @@ -487,11 +488,9 @@ void CheckUpdate(FFlatVertexBuffer* fvb, sector_t* sector) // //========================================================================== -void CreateVBO(FFlatVertexBuffer* fvb, TArray& sectors) +void CreateVBO(FRenderState& renderstate, TArray& sectors) { - fvb->vbo_shadowdata.Clear(); - CreateVertices(fvb, sectors); - fvb->mCurIndex = fvb->mIndex = fvb->vbo_shadowdata.Size(); - fvb->Copy(0, fvb->mIndex); - fvb->mIndexBuffer->SetData(fvb->ibo_data.Size() * sizeof(uint32_t), &fvb->ibo_data[0], BufferUsageType::Static); + sector_vertices.Clear(); + CreateVertices(renderstate, sectors); + renderstate.SetShadowData(sector_vertices, sector_indexes); } diff --git a/src/rendering/hwrenderer/hw_vertexbuilder.h b/src/rendering/hwrenderer/hw_vertexbuilder.h index 0444613be6..6bfe10709e 100644 --- a/src/rendering/hwrenderer/hw_vertexbuilder.h +++ b/src/rendering/hwrenderer/hw_vertexbuilder.h @@ -1,7 +1,9 @@ #pragma once #include "tarray.h" #include "r_defs.h" + struct vertex_t; +struct FFlatVertex; struct FQualifiedVertex { @@ -67,7 +69,9 @@ using VertexContainers = TArray; VertexContainers BuildVertices(TArray §ors); -class FFlatVertexBuffer; -void CheckUpdate(FFlatVertexBuffer* fvb, sector_t* sector); -void CreateVBO(FFlatVertexBuffer* fvb, TArray& sectors); +class FRenderState; +void CheckUpdate(FRenderState& renderstate, sector_t* sector); +void CreateVBO(FRenderState& renderstate, TArray& sectors); +extern TArray sector_vertices; +extern TArray sector_indexes; diff --git a/src/rendering/hwrenderer/scene/hw_bsp.cpp b/src/rendering/hwrenderer/scene/hw_bsp.cpp index 84c7e11ff4..9665127023 100644 --- a/src/rendering/hwrenderer/scene/hw_bsp.cpp +++ b/src/rendering/hwrenderer/scene/hw_bsp.cpp @@ -664,7 +664,7 @@ void HWDrawInfo::DoSubsector(subsector_t * sub, FRenderState& state) if (sector->validcount != validcount) { - CheckUpdate(screen->mVertexData, sector); + CheckUpdate(state, sector); } // [RH] Add particles diff --git a/src/rendering/hwrenderer/scene/hw_fakeflat.cpp b/src/rendering/hwrenderer/scene/hw_fakeflat.cpp index d56e9926e3..bc51fb3dd8 100644 --- a/src/rendering/hwrenderer/scene/hw_fakeflat.cpp +++ b/src/rendering/hwrenderer/scene/hw_fakeflat.cpp @@ -266,8 +266,7 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca dest->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false); dest->SetPlaneTexZQuick(sector_t::floor, s->GetPlaneTexZ(sector_t::floor)); dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakefloor]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::floor] = s->vboheight[n][sector_t::floor]; + dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor]; } else if (s->MoreFlags & SECMF_FAKEFLOORONLY) { @@ -293,8 +292,7 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca dest->floorplane = s->floorplane; dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakefloor]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::floor] = s->vboheight[n][sector_t::floor]; + dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor]; } if (!(s->MoreFlags&SECMF_FAKEFLOORONLY)) @@ -306,8 +304,7 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca dest->SetTexture(sector_t::ceiling, s->GetTexture(sector_t::ceiling), false); dest->SetPlaneTexZQuick(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling)); dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakeceiling]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::ceiling]; + dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling]; } } else @@ -315,8 +312,7 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca dest->ceilingplane = s->ceilingplane; dest->SetPlaneTexZQuick(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling)); dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakeceiling]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::ceiling]; + dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling]; } } @@ -330,12 +326,10 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca dest->ceilingplane.FlipVert(); dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::floor]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::floor] = sec->vboheight[n][sector_t::floor]; + dest->vboheight[sector_t::floor] = sec->vboheight[sector_t::floor]; dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::vbo_fakefloor]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::floor]; + dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::floor]; dest->ClearPortal(sector_t::ceiling); @@ -385,12 +379,10 @@ sector_t * hw_FakeFlat(sector_t * sec, area_t in_area, bool back, sector_t *loca dest->floorplane.FlipVert(); dest->iboindex[sector_t::floor] = sec->iboindex[sector_t::vbo_fakeceiling]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::floor] = sec->vboheight[n][sector_t::ceiling]; + dest->vboheight[sector_t::floor] = sec->vboheight[sector_t::ceiling]; dest->iboindex[sector_t::ceiling] = sec->iboindex[sector_t::ceiling]; - for (int n = 0; n < screen->mPipelineNbr; n++) - dest->vboheight[n][sector_t::ceiling] = s->vboheight[n][sector_t::ceiling]; + dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling]; dest->ClearPortal(sector_t::floor); diff --git a/src/rendering/hwrenderer/scene/hw_meshcache.cpp b/src/rendering/hwrenderer/scene/hw_meshcache.cpp index 0395a64deb..c838ee21d5 100644 --- a/src/rendering/hwrenderer/scene/hw_meshcache.cpp +++ b/src/rendering/hwrenderer/scene/hw_meshcache.cpp @@ -78,6 +78,7 @@ void HWMeshCache::Update(FRenderViewpoint& vp) di->MeshBuilding = true; MeshBuilder state; + state.SetShadowData(sector_vertices, sector_indexes); // Add to the draw lists @@ -86,7 +87,7 @@ void HWMeshCache::Update(FRenderViewpoint& vp) { auto sector = &level->sectors[i]; - CheckUpdate(screen->mVertexData, sector); + // CheckUpdate(state, sector); std::unordered_set seenSections; for (int i = 0, count = sector->subsectorcount; i < count; i++) {