Skip to content

Commit

Permalink
Client: Correct the ambient lighting for RSW-based scenes
Browse files Browse the repository at this point in the history
That's a copy/paste error if ever I've seen one... The tests didn't catch it because they used identical values for all light components.
  • Loading branch information
rdw-software committed Jan 29, 2024
1 parent 2eff5ed commit 21473bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Core/FileFormats/RagnarokMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function RagnarokMap:Construct(mapID, fileSystem)

local ambient = {
red = self.rsw.ambientLight.diffuseColor.red,
green = self.rsw.ambientLight.diffuseColor.red,
blue = self.rsw.ambientLight.diffuseColor.red,
green = self.rsw.ambientLight.diffuseColor.green,
blue = self.rsw.ambientLight.diffuseColor.blue,
intensity = 1,
}
scene.ambientLight = ambient
Expand Down
12 changes: 6 additions & 6 deletions Tests/FileFormats/RagnarokMap.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ describe("RagnarokMap", function()
assertEquals(map.meshes[3].triangleConnections, waterPlanes[1].surfaceGeometry.triangleConnections)
assertEquals(map.meshes[3].diffuseTextureCoords, waterPlanes[1].surfaceGeometry.diffuseTextureCoords)

assertEqualNumbers(map.ambientLight.red, 0.80000001192093, 1E-3)
assertEqualNumbers(map.ambientLight.green, 0.80000001192093, 1E-3)
assertEqualNumbers(map.ambientLight.blue, 0.80000001192093, 1E-3)
assertEqualNumbers(map.ambientLight.red, 0.25, 1E-3)
assertEqualNumbers(map.ambientLight.green, 0.55, 1E-3)
assertEqualNumbers(map.ambientLight.blue, 0.77, 1E-3)
assertEqualNumbers(map.ambientLight.intensity, 1, 1E-3)

assertEqualNumbers(map.directionalLight.red, 1, 1E-3)
assertEqualNumbers(map.directionalLight.green, 1, 1E-3)
assertEqualNumbers(map.directionalLight.blue, 1, 1E-3)
assertEqualNumbers(map.directionalLight.red, 13, 1E-3)
assertEqualNumbers(map.directionalLight.green, 14, 1E-3)
assertEqualNumbers(map.directionalLight.blue, 15, 1E-3)
assertEqualNumbers(map.directionalLight.intensity, 1, 1E-3)
assertEqualNumbers(map.directionalLight.rayDirection.x, 0.49999997019768, 1E-3)
assertEqualNumbers(map.directionalLight.rayDirection.y, -0.70710676908493, 1E-3)
Expand Down
Binary file modified Tests/Fixtures/Borftopia/borftopia.rsw
Binary file not shown.

0 comments on commit 21473bc

Please sign in to comment.