@@ -292,7 +292,7 @@ export default function CourseScene({
292292 raycasterRef . current . setFromCamera ( pointerRef . current , cameraRef . current ) ;
293293 const meshes = surfacesRef . current . map ( s => s . mesh ) ;
294294 const hits = raycasterRef . current . intersectObjects ( meshes , false ) ;
295-
295+ console . log ( hits ) ;
296296 const layer = hits . length > 0 ? project . _meshes . find ( l => l . id === hits [ 0 ] . object . name ) : null ;
297297 if ( onSelect ) onSelect ( layer ) ;
298298 } , [ project . _meshes ] ) ;
@@ -324,11 +324,12 @@ export default function CourseScene({
324324 }
325325 } , [ project . _meshes ] ) ;
326326
327+
327328 useEffect ( ( ) => {
328329 const ctx = sceneRef . current ;
329- if ( ! ctx || ! skySettings ) return ;
330+ if ( ! ctx || ! rendererReady || ! skySettings ) return ;
330331 const { scene, camera } = ctx ;
331-
332+ console . log ( "SKY SETTINGS CHANGED" ) ;
332333 // Update background
333334 scene . background = new THREE . Color ( skySettings . clouds . skyColor ) ;
334335
@@ -337,16 +338,17 @@ export default function CourseScene({
337338 scene . remove ( cloudsRef . current . object ) ;
338339 }
339340
340- // const clouds = new VolumetricClouds(camera, {
341- // radius: 800,
342- // skyColor: new THREE.Color(skySettings.clouds.skyColor),
343- // cloudColor: new THREE.Color(skySettings.clouds.cloudColor),
344- // density: skySettings.clouds.density,
345- // scale: 4,
346- // });
347- // scene.add(clouds.object);
348- // cloudsRef.current = clouds;
349- } , [ skySettings ] ) ;
341+ const clouds = new VolumetricClouds ( camera , {
342+ radius : 800 ,
343+ skyColor : new THREE . Color ( skySettings . clouds . skyColor ) ,
344+ cloudColor : new THREE . Color ( skySettings . clouds . cloudColor ) ,
345+ fogColor : new THREE . Color ( skySettings . clouds . fogColor ) ,
346+ density : skySettings . clouds . density ,
347+ scale : 4 ,
348+ } ) ;
349+ scene . add ( clouds . object ) ;
350+ cloudsRef . current = clouds ;
351+ } , [ skySettings , rendererReady ] ) ;
350352
351353 useEffect ( ( ) => {
352354 const container = containerRef . current ;
@@ -635,6 +637,8 @@ export default function CourseScene({
635637 const neighborMesh = new THREE . Mesh ( new THREE . BufferGeometry ( ) , neighborMaterial ) ;
636638 neighborMesh . userData . tileSize = TEXTURE_MAP [ neighborSurface ] ?. tileSize || 2.0 ;
637639
640+ mesh . receiveShadow = true ;
641+
638642 // SandMaterial reads from both meshes and replaces the material
639643 new SandMaterial (
640644 mesh ,
@@ -690,7 +694,7 @@ export default function CourseScene({
690694 mesh . name = layer . id ;
691695 mesh . visible = layer . visible !== false ;
692696 mesh . receiveShadow = true ;
693-
697+ console . log ( `Add base texture ${ layer . surface } ` , layer . id ) ;
694698 scene . add ( mesh ) ;
695699 surfacesRef . current . push ( { mesh, geometry, material } ) ;
696700 }
0 commit comments