@@ -23,15 +23,15 @@ export function initThreeJS(canvasId = "myCanvas") {
2323 200
2424 ) ;
2525 const scene = new Scene ( ) ;
26- scene . background = new Color ( 0x1a1c1f ) ; // Set background color
26+ scene . background = new Color ( 0x1a1c1f ) ;
2727
2828 scene . fog = new Fog ( 0x1a1c1f , 30 , 80 ) ;
29- const light = new HemisphereLight ( 0xffffff , 0x444444 , 2 ) ; // Adjusted intensity
29+ const light = new HemisphereLight ( 0xffffff , 0x444444 , 2 ) ;
3030 scene . add ( light ) ;
3131
3232 const renderer = new WebGLRenderer ( { antialias : true , canvas : domNode } ) ;
3333 renderer . setSize ( window . innerWidth , window . innerHeight ) ;
34- renderer . setPixelRatio ( window . devicePixelRatio ) ; // Consider devicePixelRatio for sharpness
34+ renderer . setPixelRatio ( window . devicePixelRatio ) ;
3535 renderer . shadowMap . enabled = true ;
3636 renderer . shadowMap . type = VSMShadowMap ;
3737
@@ -63,7 +63,7 @@ export function initThreeJS(canvasId = "myCanvas") {
6363
6464 createDirLightsAndGround ( scene ) ;
6565
66- return { scene, camera, renderer } ; // Return renderer and camera if needed elsewhere
66+ return { scene, camera, renderer } ;
6767}
6868
6969function createDirLightsAndGround ( scene : Scene ) {
@@ -83,7 +83,7 @@ function createDirLightsAndGround(scene: Scene) {
8383 dirLight . shadow . radius = 2 ;
8484 dirLight . shadow . bias = - 0.0005 ;
8585
86- scene ? .add ( dirLight ) ;
86+ scene . add ( dirLight ) ;
8787
8888 const dirLight2 = new DirectionalLight ( 0xffffff , 2 ) ;
8989 dirLight2 . position . set ( - 5 , 10 , - 5 ) ;
@@ -94,7 +94,7 @@ function createDirLightsAndGround(scene: Scene) {
9494 dirLight2 . shadow . camera . top = dist ;
9595 dirLight2 . shadow . camera . bottom = - dist ;
9696
97- scene ? .add ( dirLight2 ) ;
97+ scene . add ( dirLight2 ) ;
9898
9999 const material = new MeshPhongMaterial ( { color : 0x444444 } ) ;
100100 material . shininess = 0 ;
@@ -104,5 +104,5 @@ function createDirLightsAndGround(scene: Scene) {
104104 const ground = new Mesh ( new PlaneGeometry ( 50 , 50 , 1 , 1 ) , material ) ;
105105 ground . rotateX ( - Math . PI / 2 ) ;
106106 ground . receiveShadow = true ;
107- scene ? .add ( ground ) ;
107+ scene . add ( ground ) ;
108108}
0 commit comments