[wip] Globe: Define lighting from a specific hour

This commit is contained in:
2022-09-26 20:02:02 +02:00
parent 7cc778e1cc
commit 407836c44e
5 changed files with 83 additions and 97 deletions

View File

@@ -22,17 +22,16 @@
"motion": "^10.14.2", "motion": "^10.14.2",
"ogl": "^0.0.99", "ogl": "^0.0.99",
"sanitize.css": "^13.0.0", "sanitize.css": "^13.0.0",
"suncalc": "^1.9.0",
"swell-js": "^3.17.6", "swell-js": "^3.17.6",
"tweakpane": "^3.1.0" "tweakpane": "^3.1.0"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-auto": "^1.0.0-next.80", "@sveltejs/adapter-auto": "^1.0.0-next.80",
"@sveltejs/adapter-node": "^1.0.0-next.95", "@sveltejs/adapter-node": "^1.0.0-next.96",
"@sveltejs/adapter-vercel": "^1.0.0-next.77", "@sveltejs/adapter-vercel": "^1.0.0-next.77",
"@sveltejs/kit": "^1.0.0-next.503", "@sveltejs/kit": "^1.0.0-next.504",
"@typescript-eslint/eslint-plugin": "^5.38.0", "@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.0", "@typescript-eslint/parser": "^5.38.1",
"base-64": "^1.0.0", "base-64": "^1.0.0",
"browserslist": "^4.21.4", "browserslist": "^4.21.4",
"cssnano": "^5.1.13", "cssnano": "^5.1.13",
@@ -45,7 +44,7 @@
"postcss-sort-media-queries": "^4.3.0", "postcss-sort-media-queries": "^4.3.0",
"sass": "^1.55.0", "sass": "^1.55.0",
"svelte": "^3.50.1", "svelte": "^3.50.1",
"svelte-check": "^2.9.0", "svelte-check": "^2.9.1",
"svelte-preprocess": "^4.10.7", "svelte-preprocess": "^4.10.7",
"tslib": "^2.4.0", "tslib": "^2.4.0",
"typescript": "^4.8.3", "typescript": "^4.8.3",

128
pnpm-lock.yaml generated
View File

@@ -3,11 +3,11 @@ lockfileVersion: 5.4
specifiers: specifiers:
'@studio-freight/lenis': ^0.2.6 '@studio-freight/lenis': ^0.2.6
'@sveltejs/adapter-auto': ^1.0.0-next.80 '@sveltejs/adapter-auto': ^1.0.0-next.80
'@sveltejs/adapter-node': ^1.0.0-next.95 '@sveltejs/adapter-node': ^1.0.0-next.96
'@sveltejs/adapter-vercel': ^1.0.0-next.77 '@sveltejs/adapter-vercel': ^1.0.0-next.77
'@sveltejs/kit': ^1.0.0-next.503 '@sveltejs/kit': ^1.0.0-next.504
'@typescript-eslint/eslint-plugin': ^5.38.0 '@typescript-eslint/eslint-plugin': ^5.38.1
'@typescript-eslint/parser': ^5.38.0 '@typescript-eslint/parser': ^5.38.1
base-64: ^1.0.0 base-64: ^1.0.0
browserslist: ^4.21.4 browserslist: ^4.21.4
cssnano: ^5.1.13 cssnano: ^5.1.13
@@ -25,9 +25,8 @@ specifiers:
postcss-sort-media-queries: ^4.3.0 postcss-sort-media-queries: ^4.3.0
sanitize.css: ^13.0.0 sanitize.css: ^13.0.0
sass: ^1.55.0 sass: ^1.55.0
suncalc: ^1.9.0
svelte: ^3.50.1 svelte: ^3.50.1
svelte-check: ^2.9.0 svelte-check: ^2.9.1
svelte-preprocess: ^4.10.7 svelte-preprocess: ^4.10.7
swell-js: ^3.17.6 swell-js: ^3.17.6
tslib: ^2.4.0 tslib: ^2.4.0
@@ -43,17 +42,16 @@ dependencies:
motion: 10.14.2 motion: 10.14.2
ogl: 0.0.99 ogl: 0.0.99
sanitize.css: 13.0.0 sanitize.css: 13.0.0
suncalc: 1.9.0
swell-js: 3.17.6 swell-js: 3.17.6
tweakpane: 3.1.0 tweakpane: 3.1.0
devDependencies: devDependencies:
'@sveltejs/adapter-auto': 1.0.0-next.80 '@sveltejs/adapter-auto': 1.0.0-next.80
'@sveltejs/adapter-node': 1.0.0-next.95 '@sveltejs/adapter-node': 1.0.0-next.96
'@sveltejs/adapter-vercel': 1.0.0-next.77 '@sveltejs/adapter-vercel': 1.0.0-next.77
'@sveltejs/kit': 1.0.0-next.503_svelte@3.50.1+vite@3.1.3 '@sveltejs/kit': 1.0.0-next.504_svelte@3.50.1+vite@3.1.3
'@typescript-eslint/eslint-plugin': 5.38.0_4gkcvl6qsi23tqqawfqgcwtp54 '@typescript-eslint/eslint-plugin': 5.38.1_qatzzi2vqzjqg2tq57nszrvcfi
'@typescript-eslint/parser': 5.38.0_7ilbxdl5iguzcjriqqcg2m5cku '@typescript-eslint/parser': 5.38.1_7ilbxdl5iguzcjriqqcg2m5cku
base-64: 1.0.0 base-64: 1.0.0
browserslist: 4.21.4 browserslist: 4.21.4
cssnano: 5.1.13_postcss@8.4.16 cssnano: 5.1.13_postcss@8.4.16
@@ -66,7 +64,7 @@ devDependencies:
postcss-sort-media-queries: 4.3.0_postcss@8.4.16 postcss-sort-media-queries: 4.3.0_postcss@8.4.16
sass: 1.55.0 sass: 1.55.0
svelte: 3.50.1 svelte: 3.50.1
svelte-check: 2.9.0_yvs2ufmgd7w5odpvp3nw2pbb7y svelte-check: 2.9.1_yvs2ufmgd7w5odpvp3nw2pbb7y
svelte-preprocess: 4.10.7_stzz5n57hyiugj4ntsptwutnlu svelte-preprocess: 4.10.7_stzz5n57hyiugj4ntsptwutnlu
tslib: 2.4.0 tslib: 2.4.0
typescript: 4.8.3 typescript: 4.8.3
@@ -514,8 +512,8 @@ packages:
set-cookie-parser: 2.5.1 set-cookie-parser: 2.5.1
dev: true dev: true
/@sveltejs/adapter-node/1.0.0-next.95: /@sveltejs/adapter-node/1.0.0-next.96:
resolution: {integrity: sha512-RrAsFjb8qG9Q0yWusGLBB5OhejR6RfRG3X7b/V65fcIB4t3IP7hkwgNOyuXQd5jQ24lbt+Tyx3fguEfQvhMrhw==} resolution: {integrity: sha512-tIHaRolUYy2PiHl4RUWaOsYxEjK5lN9501qzCzFbYr/uoLnZcnPGSXNJICwX0AX9AUkV6cvkZey6bLbUQcwH0Q==}
dependencies: dependencies:
'@rollup/plugin-commonjs': 22.0.2_rollup@2.79.1 '@rollup/plugin-commonjs': 22.0.2_rollup@2.79.1
'@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-json': 4.1.0_rollup@2.79.1
@@ -533,8 +531,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@sveltejs/kit/1.0.0-next.503_svelte@3.50.1+vite@3.1.3: /@sveltejs/kit/1.0.0-next.504_svelte@3.50.1+vite@3.1.3:
resolution: {integrity: sha512-QSEHe40qMOYjXirxS57dIa9NU4FntlYh+KYslBzasjMCfSiUkHGaWMJRz8uU+R4BWnThD9SdCo7F/NwDxu5LRQ==} resolution: {integrity: sha512-KrhlSHT3aCVnhRgUoN6aGIjIw3nWEdNwfoZcE1x65F5D7Ju/K9D8dQwyal9v0aBAZyN9nFuXxsYGaMLE9sppfw==}
engines: {node: '>=16.14'} engines: {node: '>=16.14'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true
@@ -606,8 +604,8 @@ packages:
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
dev: true dev: true
/@types/node/18.7.20: /@types/node/18.7.22:
resolution: {integrity: sha512-adzY4vLLr5Uivmx8+zfSJ5fbdgKxX8UMtjtl+17n0B1q1Nz8JEmE151vefMdpD+1gyh+77weN4qEhej/O7budQ==} resolution: {integrity: sha512-TsmoXYd4zrkkKjJB0URF/mTIKPl+kVcbqClB2F/ykU7vil1BfWZVndOnpEIozPv4fURD28gyPFeIkW2G+KXOvw==}
dev: true dev: true
/@types/pug/2.0.6: /@types/pug/2.0.6:
@@ -617,17 +615,17 @@ packages:
/@types/resolve/1.17.1: /@types/resolve/1.17.1:
resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==}
dependencies: dependencies:
'@types/node': 18.7.20 '@types/node': 18.7.22
dev: true dev: true
/@types/sass/1.43.1: /@types/sass/1.43.1:
resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
dependencies: dependencies:
'@types/node': 18.7.20 '@types/node': 18.7.22
dev: true dev: true
/@typescript-eslint/eslint-plugin/5.38.0_4gkcvl6qsi23tqqawfqgcwtp54: /@typescript-eslint/eslint-plugin/5.38.1_qatzzi2vqzjqg2tq57nszrvcfi:
resolution: {integrity: sha512-GgHi/GNuUbTOeoJiEANi0oI6fF3gBQc3bGFYj40nnAPCbhrtEDf2rjBmefFadweBmO1Du1YovHeDP2h5JLhtTQ==} resolution: {integrity: sha512-ky7EFzPhqz3XlhS7vPOoMDaQnQMn+9o5ICR9CPr/6bw8HrFkzhMSxuA3gRfiJVvs7geYrSeawGJjZoZQKCOglQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
'@typescript-eslint/parser': ^5.0.0 '@typescript-eslint/parser': ^5.0.0
@@ -637,10 +635,10 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.38.0_7ilbxdl5iguzcjriqqcg2m5cku '@typescript-eslint/parser': 5.38.1_7ilbxdl5iguzcjriqqcg2m5cku
'@typescript-eslint/scope-manager': 5.38.0 '@typescript-eslint/scope-manager': 5.38.1
'@typescript-eslint/type-utils': 5.38.0_7ilbxdl5iguzcjriqqcg2m5cku '@typescript-eslint/type-utils': 5.38.1_7ilbxdl5iguzcjriqqcg2m5cku
'@typescript-eslint/utils': 5.38.0_7ilbxdl5iguzcjriqqcg2m5cku '@typescript-eslint/utils': 5.38.1_7ilbxdl5iguzcjriqqcg2m5cku
debug: 4.3.4 debug: 4.3.4
eslint: 8.24.0 eslint: 8.24.0
ignore: 5.2.0 ignore: 5.2.0
@@ -652,8 +650,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser/5.38.0_7ilbxdl5iguzcjriqqcg2m5cku: /@typescript-eslint/parser/5.38.1_7ilbxdl5iguzcjriqqcg2m5cku:
resolution: {integrity: sha512-/F63giJGLDr0ms1Cr8utDAxP2SPiglaD6V+pCOcG35P2jCqdfR7uuEhz1GIC3oy4hkUF8xA1XSXmd9hOh/a5EA==} resolution: {integrity: sha512-LDqxZBVFFQnQRz9rUZJhLmox+Ep5kdUmLatLQnCRR6523YV+XhRjfYzStQ4MheFA8kMAfUlclHSbu+RKdRwQKw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
@@ -662,9 +660,9 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/scope-manager': 5.38.0 '@typescript-eslint/scope-manager': 5.38.1
'@typescript-eslint/types': 5.38.0 '@typescript-eslint/types': 5.38.1
'@typescript-eslint/typescript-estree': 5.38.0_typescript@4.8.3 '@typescript-eslint/typescript-estree': 5.38.1_typescript@4.8.3
debug: 4.3.4 debug: 4.3.4
eslint: 8.24.0 eslint: 8.24.0
typescript: 4.8.3 typescript: 4.8.3
@@ -672,16 +670,16 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/scope-manager/5.38.0: /@typescript-eslint/scope-manager/5.38.1:
resolution: {integrity: sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==} resolution: {integrity: sha512-BfRDq5RidVU3RbqApKmS7RFMtkyWMM50qWnDAkKgQiezRtLKsoyRKIvz1Ok5ilRWeD9IuHvaidaLxvGx/2eqTQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies: dependencies:
'@typescript-eslint/types': 5.38.0 '@typescript-eslint/types': 5.38.1
'@typescript-eslint/visitor-keys': 5.38.0 '@typescript-eslint/visitor-keys': 5.38.1
dev: true dev: true
/@typescript-eslint/type-utils/5.38.0_7ilbxdl5iguzcjriqqcg2m5cku: /@typescript-eslint/type-utils/5.38.1_7ilbxdl5iguzcjriqqcg2m5cku:
resolution: {integrity: sha512-iZq5USgybUcj/lfnbuelJ0j3K9dbs1I3RICAJY9NZZpDgBYXmuUlYQGzftpQA9wC8cKgtS6DASTvF3HrXwwozA==} resolution: {integrity: sha512-UU3j43TM66gYtzo15ivK2ZFoDFKKP0k03MItzLdq0zV92CeGCXRfXlfQX5ILdd4/DSpHkSjIgLLLh1NtkOJOAw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
eslint: '*' eslint: '*'
@@ -690,8 +688,8 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/typescript-estree': 5.38.0_typescript@4.8.3 '@typescript-eslint/typescript-estree': 5.38.1_typescript@4.8.3
'@typescript-eslint/utils': 5.38.0_7ilbxdl5iguzcjriqqcg2m5cku '@typescript-eslint/utils': 5.38.1_7ilbxdl5iguzcjriqqcg2m5cku
debug: 4.3.4 debug: 4.3.4
eslint: 8.24.0 eslint: 8.24.0
tsutils: 3.21.0_typescript@4.8.3 tsutils: 3.21.0_typescript@4.8.3
@@ -700,13 +698,13 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/types/5.38.0: /@typescript-eslint/types/5.38.1:
resolution: {integrity: sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==} resolution: {integrity: sha512-QTW1iHq1Tffp9lNfbfPm4WJabbvpyaehQ0SrvVK2yfV79SytD9XDVxqiPvdrv2LK7DGSFo91TB2FgWanbJAZXg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true dev: true
/@typescript-eslint/typescript-estree/5.38.0_typescript@4.8.3: /@typescript-eslint/typescript-estree/5.38.1_typescript@4.8.3:
resolution: {integrity: sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==} resolution: {integrity: sha512-99b5e/Enoe8fKMLdSuwrfH/C0EIbpUWmeEKHmQlGZb8msY33qn1KlkFww0z26o5Omx7EVjzVDCWEfrfCDHfE7g==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
typescript: '*' typescript: '*'
@@ -714,8 +712,8 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/types': 5.38.0 '@typescript-eslint/types': 5.38.1
'@typescript-eslint/visitor-keys': 5.38.0 '@typescript-eslint/visitor-keys': 5.38.1
debug: 4.3.4 debug: 4.3.4
globby: 11.1.0 globby: 11.1.0
is-glob: 4.0.3 is-glob: 4.0.3
@@ -726,16 +724,16 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils/5.38.0_7ilbxdl5iguzcjriqqcg2m5cku: /@typescript-eslint/utils/5.38.1_7ilbxdl5iguzcjriqqcg2m5cku:
resolution: {integrity: sha512-6sdeYaBgk9Fh7N2unEXGz+D+som2QCQGPAf1SxrkEr+Z32gMreQ0rparXTNGRRfYUWk/JzbGdcM8NSSd6oqnTA==} resolution: {integrity: sha512-oIuUiVxPBsndrN81oP8tXnFa/+EcZ03qLqPDfSZ5xIJVm7A9V0rlkQwwBOAGtrdN70ZKDlKv+l1BeT4eSFxwXA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies: dependencies:
'@types/json-schema': 7.0.11 '@types/json-schema': 7.0.11
'@typescript-eslint/scope-manager': 5.38.0 '@typescript-eslint/scope-manager': 5.38.1
'@typescript-eslint/types': 5.38.0 '@typescript-eslint/types': 5.38.1
'@typescript-eslint/typescript-estree': 5.38.0_typescript@4.8.3 '@typescript-eslint/typescript-estree': 5.38.1_typescript@4.8.3
eslint: 8.24.0 eslint: 8.24.0
eslint-scope: 5.1.1 eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@8.24.0 eslint-utils: 3.0.0_eslint@8.24.0
@@ -744,11 +742,11 @@ packages:
- typescript - typescript
dev: true dev: true
/@typescript-eslint/visitor-keys/5.38.0: /@typescript-eslint/visitor-keys/5.38.1:
resolution: {integrity: sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==} resolution: {integrity: sha512-bSHr1rRxXt54+j2n4k54p4fj8AHJ49VDWtjpImOpzQj4qjAiOpPni+V1Tyajh19Api1i844F757cur8wH3YvOA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies: dependencies:
'@typescript-eslint/types': 5.38.0 '@typescript-eslint/types': 5.38.1
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
dev: true dev: true
@@ -861,7 +859,7 @@ packages:
postcss: ^8.1.0 postcss: ^8.1.0
dependencies: dependencies:
browserslist: 4.21.4 browserslist: 4.21.4
caniuse-lite: 1.0.30001411 caniuse-lite: 1.0.30001412
fraction.js: 4.2.0 fraction.js: 4.2.0
normalize-range: 0.1.2 normalize-range: 0.1.2
picocolors: 1.0.0 picocolors: 1.0.0
@@ -911,8 +909,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true hasBin: true
dependencies: dependencies:
caniuse-lite: 1.0.30001411 caniuse-lite: 1.0.30001412
electron-to-chromium: 1.4.261 electron-to-chromium: 1.4.262
node-releases: 2.0.6 node-releases: 2.0.6
update-browserslist-db: 1.0.9_browserslist@4.21.4 update-browserslist-db: 1.0.9_browserslist@4.21.4
dev: true dev: true
@@ -942,13 +940,13 @@ packages:
resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==}
dependencies: dependencies:
browserslist: 4.21.4 browserslist: 4.21.4
caniuse-lite: 1.0.30001411 caniuse-lite: 1.0.30001412
lodash.memoize: 4.1.2 lodash.memoize: 4.1.2
lodash.uniq: 4.5.0 lodash.uniq: 4.5.0
dev: true dev: true
/caniuse-lite/1.0.30001411: /caniuse-lite/1.0.30001412:
resolution: {integrity: sha512-HPnJKESKuhKpHvMY1/ux7J3nG7xG8jRuL4lbyCjDRm0doTNV91tcRk60xrP7Ym9DtJH/yuqntDWBJCqpXB4b7g==} resolution: {integrity: sha512-+TeEIee1gS5bYOiuf+PS/kp2mrXic37Hl66VY6EAfxasIk5fELTktK2oOezYed12H8w7jt3s512PpulQidPjwA==}
dev: true dev: true
/chalk/4.1.2: /chalk/4.1.2:
@@ -1258,8 +1256,8 @@ packages:
domhandler: 4.3.1 domhandler: 4.3.1
dev: true dev: true
/electron-to-chromium/1.4.261: /electron-to-chromium/1.4.262:
resolution: {integrity: sha512-fVXliNUGJ7XUVJSAasPseBbVgJIeyw5M1xIkgXdTSRjlmCqBbiSTsEdLOCJS31Fc8B7CaloQ/BFAg8By3ODLdg==} resolution: {integrity: sha512-Ckn5haqmGh/xS8IbcgK3dnwAVnhDyo/WQnklWn6yaMucYTq7NNxwlGE8ElzEOnonzRLzUCo2Ot3vUb2GYUF2Hw==}
dev: true dev: true
/embla-carousel/7.0.3: /embla-carousel/7.0.3:
@@ -3286,10 +3284,6 @@ packages:
postcss-selector-parser: 6.0.10 postcss-selector-parser: 6.0.10
dev: true dev: true
/suncalc/1.9.0:
resolution: {integrity: sha512-vMJ8Byp1uIPoj+wb9c1AdK4jpkSKVAywgHX0lqY7zt6+EWRRC3Z+0Ucfjy/0yxTVO1hwwchZe4uoFNqrIC24+A==}
dev: false
/supports-color/7.2.0: /supports-color/7.2.0:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'} engines: {node: '>=8'}
@@ -3302,8 +3296,8 @@ packages:
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dev: true dev: true
/svelte-check/2.9.0_yvs2ufmgd7w5odpvp3nw2pbb7y: /svelte-check/2.9.1_yvs2ufmgd7w5odpvp3nw2pbb7y:
resolution: {integrity: sha512-9AVrtP7WbfDgCdqTZNPdj5CCCy1OrYMxFVWAWzNw7fl93c9klFJFtqzVXa6fovfQ050CcpUyJE2dPFL9TFAREw==} resolution: {integrity: sha512-+BFPsj6irZ+t2pVSVo//2Ic1mI3A52xCwbkSTVhTqYZqgawcyZd9pYZoEac3fIWbEeTyCb5X82ORKI/gjn+P7A==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
svelte: ^3.24.0 svelte: ^3.24.0

View File

@@ -1,7 +1,6 @@
// @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 SunCalc from 'suncalc' import { map } from '$utils/functions'
import { map } from '$utils/functions/index'
// 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'
@@ -32,13 +31,7 @@ export class Globe {
} }
] ]
const location = locations[1] const location = locations[1]
const localDate = new Date(now.toLocaleString('en-US', { timeZone: location.tz })) const localDate = new Date(new Date().toLocaleString('en-US', { timeZone: location.tz }))
this.sunPosition = SunCalc.getPosition(localDate, location.lat, location.lng)
var times = SunCalc.getTimes(new Date(), location.lat, location.lng);
var sunrisePos = SunCalc.getPosition(times.sunrise, location.lat, location.lng);
this.sunriseAzimuth = sunrisePos.azimuth * 180 / Math.PI;
// Parameters // Parameters
this.params = { this.params = {
@@ -128,7 +121,14 @@ export class Globe {
imgDark.onload = () => (mapDark.image = imgDark) imgDark.onload = () => (mapDark.image = imgDark)
imgDark.src = this.options.mapFileDark imgDark.src = this.options.mapFileDark
const azimuthValue = map(this.sunriseAzimuth, -180, 180, -Math.PI, Math.PI); // Create light
const dayTime = map(5, 0, 24, 0, 1, true)
const lightD = degToRad(360 / dayTime)
const sunPosition = new Vec3(
Math.cos(lightD),
Math.sin(lightD) * Math.sin(0),
Math.sin(lightD) * Math.cos(0)
)
// Create program // Create program
const program = new Program(this.gl, { const program = new Program(this.gl, {
@@ -138,16 +138,11 @@ export class Globe {
u_dt: { value: 0 }, u_dt: { value: 0 },
map: { value: mapWorld }, // Map Texture map: { value: mapWorld }, // Map Texture
mapDark: { value: mapDark }, // Map Dark Texture mapDark: { value: mapDark }, // Map Dark Texture
altitude: { value: 0 }, sunPosition: { value: sunPosition },
azimuth: { value: 0 },
}, },
cullFace: null, cullFace: null,
}) })
// Create light
program.uniforms.altitude.value = this.sunPosition.altitude
program.uniforms.azimuth.value = this.sunPosition.azimuth
// Create globe mesh // Create globe mesh
this.globe = new Mesh(this.gl, { this.globe = new Mesh(this.gl, {
geometry: this.geometry, geometry: this.geometry,

View File

@@ -6,19 +6,17 @@ attribute vec3 normal;
uniform mat4 modelViewMatrix; uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix; uniform mat4 projectionMatrix;
uniform mat3 normalMatrix; uniform mat3 normalMatrix;
uniform float azimuth; uniform vec3 sunPosition;
uniform float altitude;
varying vec2 vUv; varying vec2 vUv;
varying vec3 vSunDir; varying vec3 vSunDir;
void main() { void main() {
vUv = uv; vUv = uv;
// float px = sin(rotation) * 1.0; float px = sunPosition.x;
// float pz = cos(rotation) * 1.0; float py = sunPosition.y;
float px = sin(0.0) * 1.0; float pz = sunPosition.z;
float pz = cos(0.0) * 1.0; vec3 uLightPos = vec3(px, py, pz);
vec3 uLightPos = vec3(px, 0.0, pz);
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0); vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);