From 34710e92e1143801c30542bd70b1fbe3f96b6a5a Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sun, 1 Feb 2026 10:13:50 -0600 Subject: [PATCH] feat(immersive): integrate WebGL2 renderer into ImmersiveBackground - ImmersiveBackground now checks WebGL2 availability on mount - Dynamically imports ImmersiveAmbientCanvas when WebGL2 available - Falls back to CSS blur when WebGL2 unavailable - New props: enableAmbient (default true), ambientIntensity Automatic renderer selection: 1. Check BUILD_IMMERSIVE_ENABLED (compile-time) 2. Check isRuntimeEnabled() (user preference) 3. Check isWebGL2Available() (browser capability) 4. If all pass: use WebGL2 with ambient motion 5. Otherwise: use CSS fallback (original behavior) --- .../immersive/ImmersiveBackground.svelte | 127 ++++++++++++++---- 1 file changed, 100 insertions(+), 27 deletions(-) diff --git a/src/lib/components/immersive/ImmersiveBackground.svelte b/src/lib/components/immersive/ImmersiveBackground.svelte index f31e88a32..a53493038 100644 --- a/src/lib/components/immersive/ImmersiveBackground.svelte +++ b/src/lib/components/immersive/ImmersiveBackground.svelte @@ -1,17 +1,70 @@ -
- - +
+ {#if useWebGL && WebGLCanvas} + + + {:else if useFallback} + +
+ +
+ {:else} + +
+ {/if}
@@ -93,19 +157,21 @@ background-color: #0a0a0b; } + /* CSS Fallback styles */ + .fallback-container { + position: absolute; + inset: 0; + } + .background-canvas { position: absolute; - /* Extend beyond viewport to hide blur edges */ inset: -80px; width: calc(100% + 160px); height: calc(100% + 160px); - /* Smooth interpolation when scaling up */ image-rendering: auto; - /* Small blur to smooth out the 64x64 canvas - MUCH cheaper than 120px on full image */ filter: blur(40px); - /* GPU layer for performance */ transform: scale(1.15) translateZ(0); - will-change: opacity, filter; + will-change: opacity; transition: opacity 500ms ease-out; } @@ -113,11 +179,18 @@ opacity: 0; } - /* Subtle dark overlay */ + .loading-placeholder { + position: absolute; + inset: 0; + background-color: #0a0a0b; + } + + /* Dark overlay */ .dark-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.15); pointer-events: none; + z-index: 1; }