Skip to content

Commit

Permalink
Cleanup: Remove the obsolete contrast color computation
Browse files Browse the repository at this point in the history
This is now done in the shader and there's no reason to keep it here.
  • Loading branch information
rdw-software committed Feb 1, 2024
1 parent 4695908 commit 52ff47a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 36 deletions.
11 changes: 0 additions & 11 deletions Core/FileFormats/RagnarokRSW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,8 @@ function RagnarokRSW:DecodeEnvironmentalLightSources()
},
}

-- Composite blending (additive + multiplicative components) ~> scenewide color tint
local contrastCorrectionColor = {
red = (directionalLight.diffuseColor.red + ambientLight.diffuseColor.red)
- directionalLight.diffuseColor.red * ambientLight.diffuseColor.red,
green = (directionalLight.diffuseColor.green + ambientLight.diffuseColor.green)
- directionalLight.diffuseColor.green * ambientLight.diffuseColor.green,
blue = (directionalLight.diffuseColor.blue + ambientLight.diffuseColor.blue)
- directionalLight.diffuseColor.blue * ambientLight.diffuseColor.blue,
}

self.directionalLight = directionalLight
self.ambientLight = ambientLight
self.contrastCorrectionColor = contrastCorrectionColor
self.prebakedShadowmapAlpha = tonumber(environmentalLightInfo.shadowmap_alpha)
end

Expand Down
24 changes: 0 additions & 24 deletions Tests/FileFormats/RagnarokRSW.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ describe("RagnarokRSW", function()
assertEqualNumbers(rsw.ambientLight.diffuseColor.blue, 0.35, 1E-3)
assertEquals(rsw.prebakedShadowmapAlpha, 0.5)

assertEqualNumbers(rsw.contrastCorrectionColor.red, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.green, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.blue, 0.5775, 1E-3)

assertEquals(rsw.boundingBox.top, 12)
assertEquals(rsw.boundingBox.bottom, 777)
assertEquals(rsw.boundingBox.left, 512)
Expand Down Expand Up @@ -200,10 +196,6 @@ describe("RagnarokRSW", function()
assertEqualNumbers(rsw.ambientLight.diffuseColor.blue, 0.35, 1E-3)
assertEquals(rsw.prebakedShadowmapAlpha, 0.5)

assertEqualNumbers(rsw.contrastCorrectionColor.red, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.green, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.blue, 0.5775, 1E-3)

assertEquals(rsw.boundingBox.top, 12)
assertEquals(rsw.boundingBox.bottom, 777)
assertEquals(rsw.boundingBox.left, 512)
Expand Down Expand Up @@ -351,10 +343,6 @@ describe("RagnarokRSW", function()
assertEqualNumbers(rsw.ambientLight.diffuseColor.blue, 0.35, 1E-3)
assertEquals(rsw.prebakedShadowmapAlpha, 0.5)

assertEqualNumbers(rsw.contrastCorrectionColor.red, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.green, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.blue, 0.5775, 1E-3)

assertEquals(rsw.boundingBox.top, 12)
assertEquals(rsw.boundingBox.bottom, 777)
assertEquals(rsw.boundingBox.left, 512)
Expand Down Expand Up @@ -502,10 +490,6 @@ describe("RagnarokRSW", function()
assertEqualNumbers(rsw.ambientLight.diffuseColor.blue, 0.35, 1E-3)
assertEquals(rsw.prebakedShadowmapAlpha, 0.5)

assertEqualNumbers(rsw.contrastCorrectionColor.red, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.green, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.blue, 0.5775, 1E-3)

assertEquals(rsw.boundingBox.top, 12)
assertEquals(rsw.boundingBox.bottom, 777)
assertEquals(rsw.boundingBox.left, 512)
Expand Down Expand Up @@ -645,10 +629,6 @@ describe("RagnarokRSW", function()
assertEqualNumbers(rsw.ambientLight.diffuseColor.blue, 0.35, 1E-3)
assertEqualNumbers(rsw.prebakedShadowmapAlpha, 0.5, 1E-3)

assertEqualNumbers(rsw.contrastCorrectionColor.red, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.green, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.blue, 0.5775, 1E-3)

assertEquals(rsw.boundingBox.top, 12)
assertEquals(rsw.boundingBox.bottom, 777)
assertEquals(rsw.boundingBox.left, 512)
Expand Down Expand Up @@ -788,10 +768,6 @@ describe("RagnarokRSW", function()
assertEqualNumbers(rsw.ambientLight.diffuseColor.blue, 0.35, 1E-3)
assertEqualNumbers(rsw.prebakedShadowmapAlpha, 0.5, 1E-3)

assertEqualNumbers(rsw.contrastCorrectionColor.red, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.green, 0.5775, 1E-3)
assertEqualNumbers(rsw.contrastCorrectionColor.blue, 0.5775, 1E-3)

assertEquals(rsw.boundingBox.top, 12)
assertEquals(rsw.boundingBox.bottom, 777)
assertEquals(rsw.boundingBox.left, 512)
Expand Down
1 change: 0 additions & 1 deletion Tools/rsw-to-json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ local sceneObjects = {
buildNumber = rsw.buildNumber,
directionalLight = rsw.directionalLight,
ambientLight = rsw.ambientLight,
contrastCorrectionColor = rsw.contrastCorrectionColor,
prebakedShadowmapAlpha = rsw.prebakedShadowmapAlpha,
animatedProps = rsw.animatedProps,
spatialAudioSources = rsw.spatialAudioSources,
Expand Down

0 comments on commit 52ff47a

Please sign in to comment.