fix: make Globe light position accurate
Takes UTC current time with timezone difference, based on noon I guess thanks again ChatGPT + StackOverflow?
This commit is contained in:
@@ -17,4 +17,4 @@ void main() {
|
||||
vec3 color = mix(nightColor, dayColor, mixAmount);
|
||||
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ export class Globe {
|
||||
|
||||
// Calculate local time for sun position
|
||||
const date = new Date()
|
||||
const localHour = date.getHours() + date.getTimezoneOffset() / 60
|
||||
this.options.sunAngle = (localHour - 12) / 12
|
||||
const localHour = date.getUTCHours() + date.getTimezoneOffset() / 60
|
||||
this.options.sunAngle = 2 * Math.PI * (localHour - 12) / 24
|
||||
|
||||
// Parameters
|
||||
this.params = {
|
||||
|
||||
Reference in New Issue
Block a user