diff --git a/pointlightshadow0.js b/pointlightshadow0.js deleted file mode 100644 index 9b7577bf7eafa7165ac4d48cc6d00c05d97daed6..0000000000000000000000000000000000000000 --- a/pointlightshadow0.js +++ /dev/null @@ -1,25 +0,0 @@ -const function_0 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.z = 10; // (0,0,z)에서 (0,0,0)을 보고있는 것 - -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas0}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -renderer2.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap - -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -light2.position.set( 0, 0, 0 ); -scene2.add( light2 ); - -const planeGeometry2 = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial2 = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane2 = new THREE.Mesh( planeGeometry2, planeMaterial2 ); -plane2.position.z = -30; -scene2.add( plane2 ); - -renderer2.render( scene2, camera2 ); -} -function_0(); \ No newline at end of file diff --git a/pointlightshadow1.js b/pointlightshadow1.js deleted file mode 100644 index c50cb5ff53394c6cd35697c183719717573d20ce..0000000000000000000000000000000000000000 --- a/pointlightshadow1.js +++ /dev/null @@ -1,82 +0,0 @@ -const function_1 = function(){ - const h_scr2 = window.innerWidth; - const v_scr2 = window.innerHeight; - const scene2 = new THREE.Scene(); - const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); - camera2.position.z = 10; // (0,0,z)에서 (0,0,0)을 보고있는 것 - - const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas1}); - renderer2.setSize( h_scr2, v_scr2 ); - - const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); - light2.position.set( 0, 0, 0 ); - scene2.add( light2 ); - - - const sphereGeometry = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); - sphere.position.set(0,8,0); - scene2.add( sphere ); - - const sphereGeometry2 = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial2 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere2 = new THREE.Mesh( sphereGeometry2, sphereMaterial2 ); - sphere2.position.set(-8,8,0); - scene2.add( sphere2 ); - - const sphereGeometry3 = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial3 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere3 = new THREE.Mesh( sphereGeometry3, sphereMaterial3 ); - sphere3.position.set(-8,0,0); - scene2.add( sphere3 ); - - const sphereGeometry4 = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial4 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere4 = new THREE.Mesh( sphereGeometry4, sphereMaterial4 ); - sphere4.position.set(-8,-8,0); - scene2.add( sphere4 ); - - const sphereGeometry5 = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial5 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere5 = new THREE.Mesh( sphereGeometry5, sphereMaterial5 ); - sphere5.position.set(0,-8,0); - scene2.add( sphere5 ); - - const sphereGeometry6 = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial6 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere6 = new THREE.Mesh( sphereGeometry6, sphereMaterial6 ); - sphere6.position.set(8,-8,0); - scene2.add( sphere6 ); - - const sphereGeometry7 = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial7 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere7 = new THREE.Mesh( sphereGeometry7, sphereMaterial7 ); - sphere7.position.set(8,0,0); - scene2.add( sphere7 ); - - const sphereGeometry8 = new THREE.SphereGeometry( 2, 32, 32 ); - const sphereMaterial8 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); - const sphere8 = new THREE.Mesh( sphereGeometry8, sphereMaterial8 ); - sphere8.position.set(8,8,0); - scene2.add( sphere8 ); - - - const planeGeometry2 = new THREE.PlaneGeometry( 60, 60, 32, 32 ); - const planeMaterial2 = new THREE.MeshStandardMaterial( { color: 0xffffff } ) - const plane2 = new THREE.Mesh( planeGeometry2, planeMaterial2 ); - plane2.position.z = -30; - scene2.add( plane2 ); - - - renderer2.render( scene2, camera2 ); - } - function_1(); \ No newline at end of file diff --git a/pointlightshadow2.js b/pointlightshadow2.js deleted file mode 100644 index 1faebf4c08ced88fb69ad3749f22c15672a491c7..0000000000000000000000000000000000000000 --- a/pointlightshadow2.js +++ /dev/null @@ -1,74 +0,0 @@ -const function0 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.y = 15; -camera2.lookAt(0,0,0); - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -//light2.autoUpdate = false; -scene2.add( light2 ); - -//Set up shadow properties for the light -//light2.shadow.mapSize.width = 128; // default -//light2.shadow.mapSize.height = 128; // default -//light2.shadow.camera.near = 0.5; // default -//light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene2.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -plane.rotation.x = -1.57; -plane.position.set(0,-5,0); -scene2.add( plane ); - -//Create a helper for the shadow camera (optional) -const helper = new THREE.CameraHelper( light2.shadow.camera ); -scene2.add( helper ); - - -var x = -12; -var x_trans = 0; -const animate = function () { - requestAnimationFrame( animate ); - - if(x>=12) - { - x_trans = -0.1; - } - else if(x<=-12) - { - x_trans = +0.1; - } - - x += x_trans; - - - light2.position.set( x, 10, 0 ); - - renderer2.render( scene2, camera2 ); -}; -animate(); -} -function0(); \ No newline at end of file diff --git a/pointlightshadow3.js b/pointlightshadow3.js deleted file mode 100644 index 97a317d44bbc260ac85a3907fe5e85dce2e85545..0000000000000000000000000000000000000000 --- a/pointlightshadow3.js +++ /dev/null @@ -1,68 +0,0 @@ -const function1 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.y = 15; -camera2.lookAt(0,0,0); - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas2}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -light2.position.set(0,5,0); -//light2.autoUpdate = false; -scene2.add( light2 ); - -//Set up shadow properties for the light -//light2.shadow.mapSize.width = 128; // default -//light2.shadow.mapSize.height = 128; // default -//light2.shadow.camera.near = 0.5; // default -//light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene2.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -plane.rotation.x = -1.57; -plane.position.set(0,-5,0); -scene2.add( plane ); - - - - -var x = -12; -var x_trans = 0; -const animate = function () { - requestAnimationFrame( animate ); - if(light2.position.y <= 10) - { - light2.position.y += 0.01; - } - else - { - light2.position.y = 5; - } - - - renderer2.render( scene2, camera2 ); -}; -animate(); -} -function1(); \ No newline at end of file diff --git a/pointlightshadow4.js b/pointlightshadow4.js deleted file mode 100644 index f665704952bf9f0113e1b044e990edbae7d4536f..0000000000000000000000000000000000000000 --- a/pointlightshadow4.js +++ /dev/null @@ -1,74 +0,0 @@ -const function4 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.y = 15; -camera2.lookAt(0,0,0); - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas4}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -//light2.autoUpdate = false; -scene2.add( light2 ); - -//Set up shadow properties for the light -//light2.shadow.mapSize.width = 128; // default -//light2.shadow.mapSize.height = 128; // default -light2.shadow.camera.near = 20; -//light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene2.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -plane.rotation.x = -1.57; -plane.position.set(0,-5,0); -scene2.add( plane ); - -//Create a helper for the shadow camera (optional) -const helper = new THREE.CameraHelper( light2.shadow.camera ); -scene2.add( helper ); - - -var x = -12; -var x_trans = 0; -const animate = function () { - requestAnimationFrame( animate ); - - if(x>=12) - { - x_trans = -0.1; - } - else if(x<=-12) - { - x_trans = +0.1; - } - - x += x_trans; - - - light2.position.set( x, 10, 0 ); - - renderer2.render( scene2, camera2 ); -}; -animate(); -} -function4(); \ No newline at end of file diff --git a/pointlightshadow5.js b/pointlightshadow5.js deleted file mode 100644 index f0e9735beb44c7825dc3e666cf97ec6ab17cbb3f..0000000000000000000000000000000000000000 --- a/pointlightshadow5.js +++ /dev/null @@ -1,54 +0,0 @@ -const function5 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.y = 15; -camera2.lookAt(0,0,0); - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas5}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -scene2.add( light2 ); - - -//Set up shadow properties for the light -light2.shadow.mapSize.width = 128; // default -light2.shadow.mapSize.height = 128; // default -//light2.shadow.camera.near = 0.5; // default -//light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene2.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -plane.rotation.x = -1.57; -plane.position.set(0,-5,0); -scene2.add( plane ); - - -var x = -12; -light2.position.set( x, 10, 0 ); - - - - renderer2.render( scene2, camera2 ); -} -function5(); \ No newline at end of file diff --git a/pointlightshadow6.js b/pointlightshadow6.js deleted file mode 100644 index b5079e62c4aaebe9e1c8ae337446bada6790e39c..0000000000000000000000000000000000000000 --- a/pointlightshadow6.js +++ /dev/null @@ -1,54 +0,0 @@ -const function6 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.y = 15; -camera2.lookAt(0,0,0); - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas6}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -scene2.add( light2 ); - - -//Set up shadow properties for the light -light2.shadow.mapSize.width = 1024; // default -light2.shadow.mapSize.height = 1024; // default -//light2.shadow.camera.near = 0.5; // default -//light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene2.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -plane.rotation.x = -1.57; -plane.position.set(0,-5,0); -scene2.add( plane ); - - -var x = -12; -light2.position.set( x, 10, 0 ); - - - - renderer2.render( scene2, camera2 ); -} -function6(); \ No newline at end of file diff --git a/pointlightshadow7.js b/pointlightshadow7.js deleted file mode 100644 index 918af98b9b428af8d37497ebab695dc7f92780ae..0000000000000000000000000000000000000000 --- a/pointlightshadow7.js +++ /dev/null @@ -1,55 +0,0 @@ -const function7 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.y = 15; -camera2.lookAt(0,0,0); - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas7}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -scene2.add( light2 ); - - -//Set up shadow properties for the light -light2.shadow.mapSize.width = 1024; // default -light2.shadow.mapSize.height = 1024; // default -light2.shadow.radius = 20; -//light2.shadow.camera.near = 0.5; // default -//light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene2.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -plane.rotation.x = -1.57; -plane.position.set(0,-5,0); -scene2.add( plane ); - - -var x = -12; -light2.position.set( x, 10, 0 ); - - - - renderer2.render( scene2, camera2 ); -} -function7(); \ No newline at end of file diff --git a/pointlightshadow8.js b/pointlightshadow8.js deleted file mode 100644 index 8a746e879d091d1f423d5ce495f5cd475e2b4d7a..0000000000000000000000000000000000000000 --- a/pointlightshadow8.js +++ /dev/null @@ -1,55 +0,0 @@ -const function8 = function(){ -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.y = 15; -camera2.lookAt(0,0,0); - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas8}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -scene2.add( light2 ); - - -//Set up shadow properties for the light -light2.shadow.mapSize.width = 1024; // default -light2.shadow.mapSize.height = 1024; // default -light2.shadow.radius = 100; -//light2.shadow.camera.near = 0.5; // default -//light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial = new THREE.MeshPhongMaterial( { - color: 0xff0000, shininess : 90.0 }); -const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene2.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -plane.rotation.x = -1.57; -plane.position.set(0,-5,0); -scene2.add( plane ); - - -var x = -12; -light2.position.set( x, 10, 0 ); - - - - renderer2.render( scene2, camera2 ); -} -function8(); \ No newline at end of file diff --git a/pointlightshadowelse.js b/pointlightshadowelse.js deleted file mode 100644 index d798c8a44c210a1834aebc4984fc960fcdf898a4..0000000000000000000000000000000000000000 --- a/pointlightshadowelse.js +++ /dev/null @@ -1,104 +0,0 @@ -const function1 = function(){ -//그림자옵션이 꺼질 때의 점광원 테스트 -//그 테스트는 구에서 시행할 것 -//그림자로 인해 도형이 어두워지는 것과 그냥 빛을 받지않아 도형이 어두워진 것을 표현하는 것과의 차이를 분석할 것. -//그렇게 점광원과 점광원 그림자에 대한 테스트를 진행한 후 점광원 그림자 관련 함수들을 사용해보면서 변화를 설명할 것. -//변수명의 뒤에는 종류와 무관하게 파일 번호를 입력할 것. -const h_scr2 = window.innerWidth; -const v_scr2 = window.innerHeight; -//const h_scr = 800; -//const v_scr = 750; -const scene2 = new THREE.Scene(); -const camera2 = new THREE.PerspectiveCamera(120, h_scr2/v_scr2, 0.1, 1000); -camera2.position.z = 10; // (0,0,z)에서 (0,0,0)을 보고있는 것 -camera2.position.x = 30; - -//Create a WebGLRenderer and turn on shadows in the renderer -const renderer2 = new THREE.WebGLRenderer({canvas: HelloCanvas2}); -renderer2.setSize( h_scr2, v_scr2 ); -renderer2.shadowMap.enabled = true; -renderer2.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap - -//Create a PointLight and turn on shadows for the light -const light2 = new THREE.PointLight( 0xffffff, 1, 100 ); -//const light2 = new THREE.DirectionalLight( 0xffffff, 1); -light2.position.set( 0, 0, 0 ); -//light2.position.set( 0, 0, 1 ); -//directioanl은 항상 위에서 온다. -//light2.rotaion.x = 90; -light2.castShadow = true; // default false -scene2.add( light2 ); - -//Set up shadow properties for the light -light2.shadow.mapSize.width = 512; // default -light2.shadow.mapSize.height = 512; // default -light2.shadow.camera.near = 0.5; // default -light2.shadow.camera.far = 500; // default - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry2 = new THREE.SphereGeometry( 1, 32, 32 ); -const sphereMaterial2 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere2 = new THREE.Mesh( sphereGeometry2, sphereMaterial2 ); -sphere2.castShadow = true; //default is false -sphere2.receiveShadow = true; //default -sphere2.position.z = -5 -//sphere2.position.z = -5 -scene2.add( sphere2 ); - -//Create a sphere that cast shadows (but does not receive them) -const sphereGeometry2_1 = new THREE.SphereGeometry( 5, 32, 32 ); -const sphereMaterial2_1 = new THREE.MeshPhongMaterial( { - color: 0xffff00, shininess : 90.0 }); -const sphere2_1 = new THREE.Mesh( sphereGeometry2_1, sphereMaterial2_1 ); -sphere2_1.castShadow = true; //default is false -sphere2_1.receiveShadow = true; //default -sphere2_1.position.z = -15 -//sphere2_1.position.z = -15 -scene2.add( sphere2_1 ); - - - -//Create a plane that receives shadows (but does not cast them) -const planeGeometry2 = new THREE.PlaneGeometry( 60, 60, 32, 32 ); -const planeMaterial2 = new THREE.MeshStandardMaterial( { color: 0xffffff } ) -const plane2 = new THREE.Mesh( planeGeometry2, planeMaterial2 ); -plane2.receiveShadow = true; -plane2.position.z = -30; -scene2.add( plane2 ); - -//Create a helper for the shadow camera (optional) -const helper2 = new THREE.CameraHelper( light2.shadow.camera ); -scene2.add( helper2 ); - - -var x2 = -8; -var z2 = 0; -var x_trans2 = 0; - -const animate2 = function () { - requestAnimationFrame( animate2 ); -/* - if(x2>=8) - { - x_trans2 = -0.1; - } - else if(x2<=-8) - { - x_trans2 = +0.1; - } - - x2 += x_trans2; - - - light2.position.set( x, 0, 0 ); - plane2.position.z = -30; - */ - plane2.position.z -= 0.05; - - renderer2.render( scene2, camera2 ); -}; -//animate2(); -renderer2.render( scene2, camera2 ); -} -function1(); \ No newline at end of file