@@ -13,9 +13,9 @@ const scene3D = () => {
1313
1414const sceneThreeJS = ( ) => {
1515 PLYLoader ( THREE )
16- let plyLoader = new THREE . PLYLoader ( )
17- let scene = new THREE . Scene ( )
18- let textureLoader = new THREE . TextureLoader ( )
16+ const plyLoader = new THREE . PLYLoader ( )
17+ const scene = new THREE . Scene ( )
18+ const textureLoader = new THREE . TextureLoader ( )
1919 const camera = camera3D ( )
2020 const renderer = renderer3D ( )
2121 const orbit = orbitsControls ( camera , renderer )
@@ -81,7 +81,7 @@ const bunny = () => new Object3D(
8181)
8282
8383const orbitsControls = ( camera , renderer ) => {
84- let controls = new OrbitControls ( camera , renderer . domElement )
84+ const controls = new OrbitControls ( camera , renderer . domElement )
8585 controls . enableZoom = false
8686 controls . autoRotate = true
8787 controls . enablePan = false
@@ -115,15 +115,15 @@ const lights = (scene) => {
115115}
116116
117117const camera3D = ( ) => {
118- let camera = new THREE . PerspectiveCamera ( 75 , window . innerWidth / window . innerHeight , 0.1 , 1000 )
118+ const camera = new THREE . PerspectiveCamera ( 75 , window . innerWidth / window . innerHeight , 0.1 , 1000 )
119119 camera . position . z = 8
120120 camera . position . y = 0
121121 camera . position . x = 0
122122 return camera
123123}
124124
125125const pointLight = ( ) => {
126- let light = new THREE . PointLight ( 0xffffff , 1 , 20 , 2 )
126+ const light = new THREE . PointLight ( 0xffffff , 1 , 20 , 2 )
127127 light . power = 1700
128128 light . castShadow = true
129129 light . shadow . mapSize . width = 512
@@ -134,7 +134,7 @@ const pointLight = () => {
134134}
135135
136136const renderer3D = ( ) => {
137- let renderer = new THREE . WebGLRenderer ( { alpha : true } )
137+ const renderer = new THREE . WebGLRenderer ( { alpha : true } )
138138 renderer . physicallyCorrectLights = true
139139 renderer . gammaInput = true
140140 renderer . gammaOutput = true
@@ -146,28 +146,28 @@ const renderer3D = () => {
146146
147147const stars = ( textureLoader , completeLoad ) => {
148148 textureLoader . load ( 'assets/models/textures/circle.png' , function ( texture ) {
149- let starsGeometry = new THREE . Geometry ( )
149+ const starsGeometry = new THREE . Geometry ( )
150150 for ( let i = 0 ; i < 10000 ; i ++ ) {
151- let star = new THREE . Vector3 ( )
151+ const star = new THREE . Vector3 ( )
152152 star . x = 2000 * Math . random ( ) - 1000
153153 star . y = 2000 * Math . random ( )
154154 star . z = 2000 * Math . random ( ) - 1000
155155 starsGeometry . vertices . push ( star )
156156 }
157- let starsMaterial = new THREE . PointsMaterial ( {
157+ const starsMaterial = new THREE . PointsMaterial ( {
158158 color : 0x888888 ,
159159 map : texture ,
160160 transparent : true
161161 } )
162- let stars = new THREE . Points ( starsGeometry , starsMaterial )
162+ const stars = new THREE . Points ( starsGeometry , starsMaterial )
163163 completeLoad ( stars )
164164 } )
165165}
166166
167167const meshWithPBRMaterial = ( plyLoader , object , completeLoad ) => {
168168 plyLoader . load ( object . path , geometry => {
169- let material = new THREE . MeshPhysicalMaterial ( object . properties )
170- let mesh = new THREE . Mesh ( geometry , material )
169+ const material = new THREE . MeshPhysicalMaterial ( object . properties )
170+ const mesh = new THREE . Mesh ( geometry , material )
171171 mesh . position . set ( object . position . x , object . position . y , object . position . z )
172172 mesh . rotation . set ( object . rotation . x , object . rotation . y , object . rotation . z )
173173 mesh . castShadow = true
@@ -182,13 +182,13 @@ const floor = (textureLoader, completionFunction) => {
182182 texture . wrapS = THREE . RepeatWrapping
183183 texture . wrapT = THREE . RepeatWrapping
184184 texture . repeat . set ( 100 , 100 )
185- let floorMat = new THREE . MeshStandardMaterial ( {
185+ const floorMat = new THREE . MeshStandardMaterial ( {
186186 roughness : 0.7 ,
187187 metalness : 0.1 ,
188188 map : texture
189189 } )
190- let floorGeometry = new THREE . PlaneGeometry ( 1000 , 1000 )
191- let floorMesh = new THREE . Mesh ( floorGeometry , floorMat )
190+ const floorGeometry = new THREE . PlaneGeometry ( 1000 , 1000 )
191+ const floorMesh = new THREE . Mesh ( floorGeometry , floorMat )
192192 floorMesh . receiveShadow = true
193193 floorMesh . rotation . x = - Math . PI / 2.0
194194 floorMesh . position . y = - 3
0 commit comments