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