diff --git a/demos/html5/template.html b/demos/html5/template.html
index 0a0fcbe..659ba5c 100644
--- a/demos/html5/template.html
+++ b/demos/html5/template.html
@@ -104,7 +104,7 @@
canvas.height = window.innerHeight;
window.addEventListener('resize', () => {
- if (canvas.canResize) {
+ if (canvas.canResize && !window.isFullscreen) {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
@@ -143,7 +143,19 @@
} else if (elem.msRequestFullscreen) { /* IE11 */
elem.msRequestFullscreen();
}
+
+ // window.isFullscreen = 1; /* assume we have entered fullscreen mode. */
}
+
+ function exitFullscreen() {
+ if (!document.webkitIsFullScreen && !document.mozFullScreen && !document.msFullscreenElement)
+ window.isFullscreen = 0;
+ }
+
+ // document.addEventListener('fullscreenchange', exitFullscreen, false);
+ // document.addEventListener('mozfullscreenchange', exitFullscreen, false);
+ // document.addEventListener('MSFullscreenChange', exitFullscreen, false);
+ // document.addEventListener('webkitfullscreenchange', exitFullscreen, false);
diff --git a/engine/art/shaders/fs_3_4_skybox_rayleigh.glsl b/engine/art/shaders/fs_3_4_skybox_rayleigh.glsl
index f0ce359..8f09732 100644
--- a/engine/art/shaders/fs_3_4_skybox_rayleigh.glsl
+++ b/engine/art/shaders/fs_3_4_skybox_rayleigh.glsl
@@ -1,4 +1,13 @@
-uniform vec3 uSunPos;// = vec3( 0, 0.1, -1 ); // = [0, Math.cos(theta) * 0.3 + 0.2, -1];
+uniform vec3 uSunPos;
+uniform vec3 uRayOrigin;
+uniform float uSunIntensity;
+uniform float uPlanetRadius;
+uniform float uAtmosphereRadius;
+uniform vec3 uRayleighScattering;
+uniform float uMieScattering;
+uniform float uRayleighScaleHeight;
+uniform float uMieScaleHeight;
+uniform float uMiePreferredDirection;
in vec3 v_direction;
@@ -10,17 +19,17 @@ vec3 atmosphere(vec3 r, vec3 r0, vec3 pSun, float iSun, float rPlanet, float rAt
void main() {
vec3 color = atmosphere(
- normalize(v_direction), // normalized ray direction
- vec3(0,6372e3,0), // ray origin
- uSunPos, // position of the sun
- 22.0, // intensity of the sun
- 6371e3, // radius of the planet in meters
- 6471e3, // radius of the atmosphere in meters
- vec3(5.5e-6, 13.0e-6, 22.4e-6), // Rayleigh scattering coefficient
- 21e-6, // Mie scattering coefficient
- 8e3, // Rayleigh scale height
- 1.2e3, // Mie scale height
- 0.758 // Mie preferred scattering direction
+ normalize(v_direction), // normalized ray direction
+ uRayOrigin, // ray origin
+ uSunPos, // position of the sun
+ uSunIntensity, // intensity of the sun
+ uPlanetRadius, // radius of the planet in meters
+ uAtmosphereRadius, // radius of the atmosphere in meters
+ uRayleighScattering, // Rayleigh scattering coefficient
+ uMieScattering, // Mie scattering coefficient
+ uRayleighScaleHeight, // Rayleigh scale height
+ uMieScaleHeight, // Mie scale height
+ uMiePreferredDirection // Mie preferred scattering direction
);
// Apply exposure.
diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h
index 0b35d4b..182822d 100644
--- a/engine/joint/v4k.h
+++ b/engine/joint/v4k.h
@@ -341713,6 +341713,15 @@ skybox_t skybox(const char *asset, int flags) {
// set up mie defaults
shader_bind(sky.program);
shader_vec3("uSunPos", vec3( 0, 0.1, -1 ));
+ shader_vec3("uRayOrigin", vec3(0.0, 6372000.0, 0.0));
+ shader_float("uSunIntensity", 22.0);
+ shader_float("uPlanetRadius", 6371000.0);
+ shader_float("uAtmosphereRadius", 6471000.0);
+ shader_vec3("uRayleighScattering", vec3(5.5e-6, 13.0e-6, 22.4e-6));
+ shader_float("uMieScattering", 21e-6);
+ shader_float("uRayleighScaleHeight", 8000.0);
+ shader_float("uMieScaleHeight", 1200.0);
+ shader_float("uMiePreferredDirection", 0.758);
}
return sky;
diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c
index 728d34a..36bd292 100644
--- a/engine/split/v4k_render.c
+++ b/engine/split/v4k_render.c
@@ -2399,6 +2399,15 @@ skybox_t skybox(const char *asset, int flags) {
// set up mie defaults
shader_bind(sky.program);
shader_vec3("uSunPos", vec3( 0, 0.1, -1 ));
+ shader_vec3("uRayOrigin", vec3(0.0, 6372000.0, 0.0));
+ shader_float("uSunIntensity", 22.0);
+ shader_float("uPlanetRadius", 6371000.0);
+ shader_float("uAtmosphereRadius", 6471000.0);
+ shader_vec3("uRayleighScattering", vec3(5.5e-6, 13.0e-6, 22.4e-6));
+ shader_float("uMieScattering", 21e-6);
+ shader_float("uRayleighScaleHeight", 8000.0);
+ shader_float("uMieScaleHeight", 1200.0);
+ shader_float("uMiePreferredDirection", 0.758);
}
return sky;
diff --git a/engine/v4k.c b/engine/v4k.c
index 2d73a23..fcd4a49 100644
--- a/engine/v4k.c
+++ b/engine/v4k.c
@@ -12623,6 +12623,15 @@ skybox_t skybox(const char *asset, int flags) {
// set up mie defaults
shader_bind(sky.program);
shader_vec3("uSunPos", vec3( 0, 0.1, -1 ));
+ shader_vec3("uRayOrigin", vec3(0.0, 6372000.0, 0.0));
+ shader_float("uSunIntensity", 22.0);
+ shader_float("uPlanetRadius", 6371000.0);
+ shader_float("uAtmosphereRadius", 6471000.0);
+ shader_vec3("uRayleighScattering", vec3(5.5e-6, 13.0e-6, 22.4e-6));
+ shader_float("uMieScattering", 21e-6);
+ shader_float("uRayleighScaleHeight", 8000.0);
+ shader_float("uMieScaleHeight", 1200.0);
+ shader_float("uMiePreferredDirection", 0.758);
}
return sky;