From e5a4e6c85abce42dd772c147cccefcbc05514a0e Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 19 Sep 2023 00:47:47 +0200 Subject: [PATCH] Remove LightmapOrigin, LightmapStepX and LightmapStepY as we no longer use them --- src/common/rendering/hwrenderer/data/hw_levelmesh.h | 5 ----- .../rendering/vulkan/accelstructs/vk_lightmap.cpp | 3 --- .../rendering/vulkan/accelstructs/vk_lightmap.h | 12 +++--------- src/rendering/hwrenderer/doom_levelmesh.cpp | 9 +-------- wadsrc/static/shaders/lightmap/frag_raytrace.glsl | 12 +++--------- wadsrc/static/shaders/lightmap/vert_raytrace.glsl | 12 +++--------- 6 files changed, 10 insertions(+), 43 deletions(-) diff --git a/src/common/rendering/hwrenderer/data/hw_levelmesh.h b/src/common/rendering/hwrenderer/data/hw_levelmesh.h index 4bb581ea8..ba21a8c38 100644 --- a/src/common/rendering/hwrenderer/data/hw_levelmesh.h +++ b/src/common/rendering/hwrenderer/data/hw_levelmesh.h @@ -68,11 +68,6 @@ struct LevelMeshSurface BBox bounds; uint16_t sampleDimension = 0; - // Lightmap world coordinates for the texture - FVector3 worldOrigin = { 0.f, 0.f, 0.f }; - FVector3 worldStepX = { 0.f, 0.f, 0.f }; - FVector3 worldStepY = { 0.f, 0.f, 0.f }; - // Calculate world coordinates to UV coordinates FVector3 translateWorldToLocal = { 0.f, 0.f, 0.f }; FVector3 projLocalToU = { 0.f, 0.f, 0.f }; diff --git a/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp b/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp index 4e1e2887e..9855377a0 100644 --- a/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp +++ b/src/common/rendering/vulkan/accelstructs/vk_lightmap.cpp @@ -200,9 +200,6 @@ void VkLightmap::RenderBakeImage() pc.TileY = (float)selectedSurface.Y; pc.SurfaceIndex = mesh->GetSurfaceIndex(targetSurface); pc.TextureSize = (float)bakeImageSize; - pc.LightmapOrigin = targetSurface->worldOrigin - targetSurface->worldStepX - targetSurface->worldStepY; - pc.LightmapStepX = targetSurface->worldStepX * viewport.width; - pc.LightmapStepY = targetSurface->worldStepY * viewport.height; pc.TileWidth = (float)targetSurface->texWidth; pc.TileHeight = (float)targetSurface->texHeight; pc.WorldToLocal = targetSurface->translateWorldToLocal; diff --git a/src/common/rendering/vulkan/accelstructs/vk_lightmap.h b/src/common/rendering/vulkan/accelstructs/vk_lightmap.h index d0ebbcf64..b3ff45d81 100644 --- a/src/common/rendering/vulkan/accelstructs/vk_lightmap.h +++ b/src/common/rendering/vulkan/accelstructs/vk_lightmap.h @@ -23,18 +23,12 @@ struct LightmapPushConstants uint32_t LightEnd; int32_t SurfaceIndex; int32_t PushPadding1; - FVector3 LightmapOrigin; - float TextureSize; - FVector3 LightmapStepX; - float PushPadding3; - FVector3 LightmapStepY; - float PushPadding4; FVector3 WorldToLocal; - float PushPadding5; + float TextureSize; FVector3 ProjLocalToU; - float PushPadding6; + float PushPadding2; FVector3 ProjLocalToV; - float PushPadding7; + float PushPadding3; float TileX; float TileY; float TileWidth; diff --git a/src/rendering/hwrenderer/doom_levelmesh.cpp b/src/rendering/hwrenderer/doom_levelmesh.cpp index 3e89e8921..ae7070a70 100644 --- a/src/rendering/hwrenderer/doom_levelmesh.cpp +++ b/src/rendering/hwrenderer/doom_levelmesh.cpp @@ -1194,7 +1194,6 @@ void DoomLevelMesh::BuildSurfaceParams(int lightMapTextureWidth, int lightMapTex { BBox bounds; FVector3 roundedSize; - FVector3 tOrigin; int width; int height; float d; @@ -1287,11 +1286,8 @@ void DoomLevelMesh::BuildSurfaceParams(int lightMapTextureWidth, int lightMapTex } - tOrigin = bounds.min; - - // project tOrigin and tCoords so they lie on the plane + // project tCoords so they lie on the plane d = ((bounds.min | FVector3(plane.X, plane.Y, plane.Z)) - plane.W) / plane[axis]; //d = (plane->PointToDist(bounds.min)) / plane->Normal()[axis]; - tOrigin[axis] -= d; for (int i = 0; i < 2; i++) { @@ -1302,7 +1298,4 @@ void DoomLevelMesh::BuildSurfaceParams(int lightMapTextureWidth, int lightMapTex surface.texWidth = width; surface.texHeight = height; - surface.worldOrigin = tOrigin; - surface.worldStepX = tCoords[0] * (float)surface.sampleDimension; - surface.worldStepY = tCoords[1] * (float)surface.sampleDimension; } diff --git a/wadsrc/static/shaders/lightmap/frag_raytrace.glsl b/wadsrc/static/shaders/lightmap/frag_raytrace.glsl index eb743505a..4e0225ba3 100644 --- a/wadsrc/static/shaders/lightmap/frag_raytrace.glsl +++ b/wadsrc/static/shaders/lightmap/frag_raytrace.glsl @@ -74,18 +74,12 @@ layout(push_constant) uniform PushConstants uint LightEnd; int SurfaceIndex; int PushPadding1; - vec3 LightmapOrigin; - float TextureSize; - vec3 LightmapStepX; - float PushPadding3; - vec3 LightmapStepY; - float PushPadding4; vec3 WorldToLocal; - float PushPadding5; + float TextureSize; vec3 ProjLocalToU; - float PushPadding6; + float PushPadding2; vec3 ProjLocalToV; - float PushPadding7; + float PushPadding3; float TileX; float TileY; float TileWidth; diff --git a/wadsrc/static/shaders/lightmap/vert_raytrace.glsl b/wadsrc/static/shaders/lightmap/vert_raytrace.glsl index e59b84029..e6a9bfefc 100644 --- a/wadsrc/static/shaders/lightmap/vert_raytrace.glsl +++ b/wadsrc/static/shaders/lightmap/vert_raytrace.glsl @@ -5,18 +5,12 @@ layout(push_constant) uniform PushConstants uint LightEnd; int SurfaceIndex; int PushPadding1; - vec3 LightmapOrigin; - float TextureSize; - vec3 LightmapStepX; - float PushPadding3; - vec3 LightmapStepY; - float PushPadding4; vec3 WorldToLocal; - float PushPadding5; + float TextureSize; vec3 ProjLocalToU; - float PushPadding6; + float PushPadding2; vec3 ProjLocalToV; - float PushPadding7; + float PushPadding3; float TileX; float TileY; float TileWidth;