Spaces:
Running
Running
cutechicken
commited on
Update game.js
Browse files
game.js
CHANGED
@@ -336,8 +336,7 @@ class Game {
|
|
336 |
|
337 |
// ํ์๊ด ์ค์ - ๊ทธ๋ฆผ์ ํ์ง ๋ฎ์ถค
|
338 |
const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2);
|
339 |
-
directionalLight.position.set(
|
340 |
-
directionalLight.intensity = 2.0; // ๊ฐ๋ ์ฆ๊ฐ
|
341 |
directionalLight.castShadow = true;
|
342 |
directionalLight.shadow.mapSize.width = 1024; // ๊ทธ๋ฆผ์ ํด์๋ ๋ฎ์ถค
|
343 |
directionalLight.shadow.mapSize.height = 1024;
|
@@ -352,18 +351,16 @@ class Game {
|
|
352 |
groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping;
|
353 |
groundTexture.repeat.set(25, 25); // ํ
์ค์ฒ ๋ฐ๋ณต ํ์ ๊ฐ์
|
354 |
|
355 |
-
// ์ฌ๋ง ์ฌ์ง ์ต์ ํ
|
356 |
-
const groundMaterial = new THREE.
|
357 |
map: groundTexture,
|
358 |
-
color: 0xF4D03F, //
|
359 |
-
|
360 |
-
metalness: 0.0, // ๊ธ์์ฑ ์ ๊ฑฐ
|
361 |
-
bumpScale: 0.2 // ๋ฒํ ํจ๊ณผ ๊ฐ์
|
362 |
});
|
363 |
|
364 |
const ground = new THREE.Mesh(groundGeometry, groundMaterial);
|
365 |
ground.rotation.x = -Math.PI / 2;
|
366 |
-
ground.receiveShadow =
|
367 |
|
368 |
// ์งํ์ ๊ธฐ๋ณต ์ถ๊ฐ (๋จ์ํ)
|
369 |
const vertices = ground.geometry.attributes.position.array;
|
@@ -371,7 +368,8 @@ class Game {
|
|
371 |
for (let i = 0; i < vertices.length; i += 3) {
|
372 |
const x = vertices[i] / 100;
|
373 |
const y = vertices[i + 1] / 100;
|
374 |
-
vertices[i + 2] =
|
|
|
375 |
}
|
376 |
ground.geometry.attributes.position.needsUpdate = true;
|
377 |
ground.geometry.computeVertexNormals();
|
|
|
336 |
|
337 |
// ํ์๊ด ์ค์ - ๊ทธ๋ฆผ์ ํ์ง ๋ฎ์ถค
|
338 |
const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2);
|
339 |
+
directionalLight.position.set(100, 100, 50);
|
|
|
340 |
directionalLight.castShadow = true;
|
341 |
directionalLight.shadow.mapSize.width = 1024; // ๊ทธ๋ฆผ์ ํด์๋ ๋ฎ์ถค
|
342 |
directionalLight.shadow.mapSize.height = 1024;
|
|
|
351 |
groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping;
|
352 |
groundTexture.repeat.set(25, 25); // ํ
์ค์ฒ ๋ฐ๋ณต ํ์ ๊ฐ์
|
353 |
|
354 |
+
// ์ฌ๋ง ์ฌ์ง ์ต์ ํ - MeshLambertMaterial ์ฌ์ฉ
|
355 |
+
const groundMaterial = new THREE.MeshLambertMaterial({
|
356 |
map: groundTexture,
|
357 |
+
color: 0xF4D03F, // ๋ฐ์ ๋ชจ๋์
|
358 |
+
emissive: 0x222222 // ์ฝ๊ฐ์ ์์ฒด ๋ฐ๊ด ์ถ๊ฐ
|
|
|
|
|
359 |
});
|
360 |
|
361 |
const ground = new THREE.Mesh(groundGeometry, groundMaterial);
|
362 |
ground.rotation.x = -Math.PI / 2;
|
363 |
+
ground.receiveShadow = false; // ๊ทธ๋ฆผ์ ๋ฐ์ง ์๋๋ก ์ค์
|
364 |
|
365 |
// ์งํ์ ๊ธฐ๋ณต ์ถ๊ฐ (๋จ์ํ)
|
366 |
const vertices = ground.geometry.attributes.position.array;
|
|
|
368 |
for (let i = 0; i < vertices.length; i += 3) {
|
369 |
const x = vertices[i] / 100;
|
370 |
const y = vertices[i + 1] / 100;
|
371 |
+
vertices[i + 2] =
|
372 |
+
(Math.sin(x + seed) * Math.cos(y + seed) * 1.0);
|
373 |
}
|
374 |
ground.geometry.attributes.position.needsUpdate = true;
|
375 |
ground.geometry.computeVertexNormals();
|