Skip to content

Commit

Permalink
Merge pull request #348 from RagnarokResearchLab/simplify-sunray-dire…
Browse files Browse the repository at this point in the history
…ction

Simplify the RSW directional light computation
  • Loading branch information
rdw-software authored Jan 30, 2024
2 parents 9ba4550 + 743dc11 commit 4554318
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Core/FileFormats/RagnarokRSW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,14 @@ function RagnarokRSW:DecodeEnvironmentalLightSources()
end

function RagnarokRSW:ComputeSunRayDirection(latitudeInDegrees, longitudeInDegrees)
local sunRayDirection = Vector3D(0, 1, 0)
local sunRayDirection = Vector3D(0, -1, 0)

local rotationAroundX = Matrix3D:CreateAxisRotationX(latitudeInDegrees)
local rotationAroundX = Matrix3D:CreateAxisRotationX(-latitudeInDegrees) -- Account for inverted Y axis
local rotationAroundY = Matrix3D:CreateAxisRotationY(longitudeInDegrees)

sunRayDirection:Transform(rotationAroundX)
sunRayDirection:Transform(rotationAroundY)

sunRayDirection.y = -1 * sunRayDirection.y

return sunRayDirection
end

Expand Down

0 comments on commit 4554318

Please sign in to comment.