Buffer data now in Levelmesh

This commit is contained in:
RaveYard 2023-08-31 19:28:58 +02:00 committed by Christoph Oelckers
parent 52220a5004
commit 88e6d459ef
2 changed files with 23 additions and 1 deletions

View file

@ -22,7 +22,7 @@ struct SurfaceInfo // This is the structure of the buffer inside the shader
struct PortalInfo // This is the structure of the buffer inside the shader
{
float transformation[16]; // mat4
float transformation[16]; // mat4
};
namespace hwrenderer

View file

@ -491,6 +491,20 @@ int DoomLevelMesh::SetupLightmapUvs(int lightmapSize)
sortedSurfaces.push_back(&surface);
}
{
this->portalInfo.Clear(); // TODO portals
PortalInfo portalInfo;
hwrenderer::Portal portal;
for (int i = 0; i < 16; ++i)
{
portalInfo.transformation[i] = (&portal.transformation[0][0])[i];
}
this->portalInfo.Push(portalInfo);
}
for (const auto& surface : Surfaces)
{
auto hwSurface = std::make_unique<hwrenderer::Surface>();
@ -517,6 +531,14 @@ int DoomLevelMesh::SetupLightmapUvs(int lightmapSize)
// TODO push
surfaces.push_back(std::move(hwSurface));
SurfaceInfo info;
info.Normal = FVector3(surface.plane.Normal());
info.PortalIndex = 0;
info.SamplingDistance = surface.sampleDimension;
info.Sky = surface.bSky;
surfaceInfo.Push(info);
}
std::sort(sortedSurfaces.begin(), sortedSurfaces.end(), [](Surface* a, Surface* b) { return a->texHeight != b->texHeight ? a->texHeight > b->texHeight : a->texWidth > b->texWidth; });