From 526110e18873689fd4fb17fafe3c646b0160b9f8 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 16 Oct 2023 18:30:18 +0200 Subject: [PATCH] Fix UV coordinates --- src/lightmapper/doom_levelmesh.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lightmapper/doom_levelmesh.cpp b/src/lightmapper/doom_levelmesh.cpp index 3e4c0e5..fc41b3e 100644 --- a/src/lightmapper/doom_levelmesh.cpp +++ b/src/lightmapper/doom_levelmesh.cpp @@ -186,8 +186,8 @@ void DoomLevelMesh::AddLightmapLump(FLevel& doomMap, FWadWriter& wadFile) float offsetU = surface->AtlasTile.X / (float)submesh->LMTextureSize; float offsetV = surface->AtlasTile.Y / (float)submesh->LMTextureSize; - float scaleU = surface->AtlasTile.Width / (float)submesh->LMTextureSize; - float scaleV = surface->AtlasTile.Height / (float)submesh->LMTextureSize; + float scaleU = (float)submesh->LMTextureSize; + float scaleV = (float)submesh->LMTextureSize; FVector2* texcoords = (FVector2*)surface->TexCoords; for (int j = 0, count = surface->numVerts; j < count; j++) { @@ -438,7 +438,7 @@ void DoomLevelSubmesh::BindLightmapSurfacesToGeometry(FLevel& doomMap) // Reorder vertices into renderer format for (DoomLevelMeshSurface& surface : Surfaces) { - if (surface.Type == ST_FLOOR) + /*if (surface.Type == ST_FLOOR) { // reverse vertices on floor for (int j = surface.startUvIndex + surface.numVerts - 1, k = surface.startUvIndex; j > k; j--, k++) @@ -452,7 +452,7 @@ void DoomLevelSubmesh::BindLightmapSurfacesToGeometry(FLevel& doomMap) // to 0 2 1 3 std::swap(LightmapUvs[surface.startUvIndex + 1], LightmapUvs[surface.startUvIndex + 2]); std::swap(LightmapUvs[surface.startUvIndex + 2], LightmapUvs[surface.startUvIndex + 3]); - } + }*/ surface.TexCoords = (float*)&LightmapUvs[surface.startUvIndex]; }