Skip to content

Commit

Permalink
Client: Add a toggle for debugging terrain normals
Browse files Browse the repository at this point in the history
They are currently placeholders, but while implementing smooth shading for terrain surfaces this tool came in handy - might want to re-enable it later if some changes have to be made here.
  • Loading branch information
rdw-software committed Jan 27, 2024
1 parent d01b484 commit a1a79e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Core/FileFormats/RagnarokMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ local RagnarokGND = require("Core.FileFormats.RagnarokGND")
local RagnarokGRF = require("Core.FileFormats.RagnarokGRF")
local RagnarokRSW = require("Core.FileFormats.RagnarokRSW")

local NormalsVisualization = require("Core.NativeClient.DebugDraw.NormalsVisualization")

local uv = require("uv")

local format = string.format
Expand All @@ -12,6 +14,7 @@ local RagnarokMap = {
MAP_DATABASE = require("DB.Maps"),
ERROR_INVALID_MAP_ID = "No such entry exists in the map database",
ERROR_INVALID_FILE_SYSTEM = "Cannot fetch resources without a registered file system handler",
DEBUG_TERRAIN_NORMALS = false,
}

function RagnarokMap:Construct(mapID, fileSystem)
Expand All @@ -33,6 +36,10 @@ function RagnarokMap:Construct(mapID, fileSystem)
local groundMeshSections = self:LoadTerrainGeometry(mapID)
for sectionID, groundMeshSection in ipairs(groundMeshSections) do
table_insert(scene.meshes, groundMeshSection)
if self.DEBUG_TERRAIN_NORMALS then
local normalsVisualization = NormalsVisualization(groundMeshSection)
table_insert(scene.meshes, normalsVisualization)
end
end

local waterPlanes = self:LoadWaterSurface(mapID)
Expand Down

0 comments on commit a1a79e5

Please sign in to comment.