@@ -25,59 +25,8 @@ export const flockScene = {
2525 flock . sky = null ;
2626 }
2727
28- // Dispose any previous background layer
29- if ( flock . backgroundLayer ) {
30- flock . backgroundLayer . dispose ( ) ;
31- flock . backgroundLayer = null ;
32- }
33-
34- // --- BACKGROUND ONLY (flat clear color or gradient) ---
28+ // --- BACKGROUND ONLY (flat clear color) ---
3529 if ( clear === true ) {
36- // For arrays, create a flat gradient background layer (not a dome)
37- if ( Array . isArray ( color ) && color . length >= 2 ) {
38- // Create a vertical gradient texture
39- const size = 512 ;
40- const dt = new flock . BABYLON . DynamicTexture (
41- "backgroundGradientDT" ,
42- { width : 1 , height : size } ,
43- flock . scene ,
44- false
45- ) ;
46- const ctx = dt . getContext ( ) ;
47- const h = dt . getSize ( ) . height ;
48-
49- // Build canvas gradient (top to bottom)
50- const grad = ctx . createLinearGradient ( 0 , 0 , 0 , h ) ;
51- const n = Math . max ( 2 , color . length ) ;
52- for ( let i = 0 ; i < n ; i ++ ) {
53- const stop = i / ( n - 1 ) ;
54- const hex = flock . getColorFromString ( color [ i ] ) ;
55- const c3 = flock . BABYLON . Color3 . FromHexString ( hex ) ;
56- const rgb = `rgb(${ Math . round ( c3 . r * 255 ) } , ${ Math . round ( c3 . g * 255 ) } , ${ Math . round ( c3 . b * 255 ) } )` ;
57- grad . addColorStop ( stop , rgb ) ;
58- }
59-
60- // Paint the gradient
61- ctx . fillStyle = grad ;
62- ctx . fillRect ( 0 , 0 , 1 , h ) ;
63- dt . update ( false ) ;
64-
65- // Create a background layer with the gradient texture
66- const layer = new flock . BABYLON . Layer ( "backgroundGradientLayer" , null , flock . scene , true ) ;
67- layer . texture = dt ;
68- layer . isBackground = true ;
69-
70- // Ensure the layer is completely unlit and unaffected by scene lighting
71- layer . alphaBlendingMode = flock . BABYLON . Constants . ALPHA_DISABLE ;
72- dt . hasAlpha = false ;
73- dt . wrapU = flock . BABYLON . Texture . CLAMP_ADDRESSMODE ;
74- dt . wrapV = flock . BABYLON . Texture . CLAMP_ADDRESSMODE ;
75-
76- flock . backgroundLayer = layer ;
77- return ;
78- }
79-
80- // Single color - just set clear color
8130 const c3 = flock . BABYLON . Color3 . FromHexString ( flock . getColorFromString ( color ) ) ;
8231 flock . scene . clearColor = c3 ;
8332 return ;
0 commit comments