-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
194 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { Theme } from "@mui/material" | ||
|
||
declare interface Window { | ||
setAuthCode(code: string): void | ||
getTheme(): Theme; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
uniform float rColor; | ||
uniform float gColor; | ||
uniform float bColor; | ||
|
||
varying vec3 vPosition; | ||
|
||
#include "/node_modules/lygia/generative/snoise.glsl" // no other known way to include this file | ||
|
||
vec3 getColor(float noiseValue, float rColor, float gColor, float bColor) { | ||
vec3 blueAccent = vec3(16.0/255.0, 35.0/255.0, 110.0/255.0); | ||
|
||
vec3 skyColor = vec3(rColor, gColor, bColor); | ||
vec3 horizonColor = mix(vec3(0.0, 0.0, 0.0), blueAccent, noiseValue); | ||
vec3 voidColor = vec3(0.0, 0.0, 0.0); | ||
|
||
float tHorizon = smoothstep(200.0, 700.0, vPosition.y); | ||
float tVoid = smoothstep(-700.0, -200.0, vPosition.y); | ||
|
||
vec3 blendedColor = mix(horizonColor, skyColor, tHorizon); | ||
vec3 finalColor = mix(voidColor, blendedColor, tVoid); | ||
|
||
return finalColor; | ||
} | ||
|
||
// passing noise function through x^2(3-2x) to get more cloud-like results | ||
float func(float x) { | ||
return x*x*(3.0-2.0*x); | ||
} | ||
|
||
|
||
void main() { | ||
vec4 noiseCoord = vec4(vPosition.xz * 0.001, 1.0, 1.0); | ||
float noiseValue = snoise(noiseCoord) * 0.5 + 0.5; | ||
noiseValue = func(noiseValue); | ||
|
||
vec3 color = getColor(noiseValue, rColor, gColor, bColor); | ||
|
||
gl_FragColor = vec4(color, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
varying vec3 vPosition; | ||
varying vec2 vUv; | ||
|
||
void main() { | ||
vPosition = position; | ||
vUv = uv; | ||
|
||
vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0); | ||
gl_Position = projectionMatrix * modelViewPosition; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import World from "@/systems/World"; | ||
import { useTheme } from "../ThemeContext"; | ||
|
||
const Skybox = () => { | ||
const { currentTheme, themes } = useTheme(); | ||
if (World.SceneRenderer) { World.SceneRenderer.updateSkyboxColors(themes[currentTheme]) } | ||
return ( | ||
<></> | ||
); | ||
} | ||
|
||
export default Skybox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters