[wip] Define manually Globe dayTime until automatic calculation

This commit is contained in:
2022-09-27 00:23:15 +02:00
parent 395de99e63
commit d921f699b2

View File

@@ -1,6 +1,5 @@
// @ts-nocheck
import { Renderer, Camera, Vec3, Orbit, Sphere, Transform, Program, Mesh, Texture } from 'ogl'
import { map } from '$utils/functions'
// Shaders
import VERTEX_SHADER from '$modules/globe/vertex.glsl?raw'
import FRAGMENT_SHADER from '$modules/globe/frag.glsl?raw'
@@ -18,20 +17,20 @@ export class Globe {
this.zoom = 1.3075
// Calculate the current sun position from a given location
const locations = [
{
lat: -37.840935,
lng: 144.946457,
tz: 'Australia/Melbourne',
},
{
lat: 48.856614,
lng: 2.3522219,
tz: 'Europe/Paris',
}
]
const location = locations[1]
const localDate = new Date(new Date().toLocaleString('en-US', { timeZone: location.tz }))
// const locations = [
// {
// lat: -37.840935,
// lng: 144.946457,
// tz: 'Australia/Melbourne',
// },
// {
// lat: 48.856614,
// lng: 2.3522219,
// tz: 'Europe/Paris',
// }
// ]
// const location = locations[1]
// const localDate = new Date(new Date().toLocaleString('en-US', { timeZone: location.tz }))
// Parameters
this.params = {
@@ -122,8 +121,7 @@ export class Globe {
imgDark.src = this.options.mapFileDark
// Create light
const dayTime = map(5, 0, 24, 0, 1, true)
const lightD = degToRad(360 / dayTime)
const lightD = degToRad(7 * 360 / 24)
const sunPosition = new Vec3(
Math.cos(lightD),
Math.sin(lightD) * Math.sin(0),