Compare commits
No commits in common. "75a173d0afce3d0d0f227dcde7b951474e647d8e" and "b318adb469dbd7beef4c2a054467b07f94b977ef" have entirely different histories.
75a173d0af
...
b318adb469
@ -12,8 +12,8 @@
|
|||||||
<script type="importmap">
|
<script type="importmap">
|
||||||
{
|
{
|
||||||
"imports": {
|
"imports": {
|
||||||
"three": "https://unpkg.com/three@0.155/build/three.module.js?module",
|
"three": "https://unpkg.com/three@0.154/build/three.module.js?module",
|
||||||
"three/addons/": "https://unpkg.com/three@0.155/examples/jsm/"
|
"three/addons/": "https://unpkg.com/three@0.154/examples/jsm/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
39
main.js
39
main.js
@ -62,8 +62,11 @@ const renderer = new THREE.WebGLRenderer({
|
|||||||
renderer.setPixelRatio(window.devicePixelRatio);
|
renderer.setPixelRatio(window.devicePixelRatio);
|
||||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||||
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
||||||
|
//renderer.toneMappingExposure = 0.5;
|
||||||
renderer.shadowMap.enabled = true;
|
renderer.shadowMap.enabled = true;
|
||||||
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
||||||
|
renderer.useLegacyLights = false;
|
||||||
|
//renderer.outputColorSpace = THREE.sRGBEncoding;
|
||||||
|
|
||||||
container.appendChild(renderer.domElement);
|
container.appendChild(renderer.domElement);
|
||||||
|
|
||||||
@ -98,6 +101,7 @@ const wallMaterial = new THREE.MeshStandardMaterial({
|
|||||||
aoMap : loader.load('textures/Poly-cobblestone-wall/ao_map.jpg'),
|
aoMap : loader.load('textures/Poly-cobblestone-wall/ao_map.jpg'),
|
||||||
roughnessMap : loader.load('textures/Poly-cobblestone-wall/roughness_map.jpg'),
|
roughnessMap : loader.load('textures/Poly-cobblestone-wall/roughness_map.jpg'),
|
||||||
roughness : 1,
|
roughness : 1,
|
||||||
|
envMapIntensity: 0.5
|
||||||
})
|
})
|
||||||
|
|
||||||
const maze = new MazeMesh(mazeWidth, mazeWidth, 1, wallMaterial);
|
const maze = new MazeMesh(mazeWidth, mazeWidth, 1, wallMaterial);
|
||||||
@ -132,37 +136,38 @@ const groundMaterial = new THREE.MeshStandardMaterial({
|
|||||||
'textures/angled-blocks-vegetation/albedo.png',
|
'textures/angled-blocks-vegetation/albedo.png',
|
||||||
texture => {
|
texture => {
|
||||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
||||||
texture.repeat.set(mazeWidth / 4, mazeWidth / 4)
|
texture.repeat.set(mazeWidth / 2, mazeWidth / 2)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
aoMap: loader.load(
|
aoMap: loader.load(
|
||||||
'textures/angled-blocks-vegetation/ao.png',
|
'textures/angled-blocks-vegetation/ao.png',
|
||||||
texture => {
|
texture => {
|
||||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
||||||
texture.repeat.set(mazeWidth / 4, mazeWidth / 4)
|
texture.repeat.set(mazeWidth / 2, mazeWidth / 2)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
metalnessMap: loader.load(
|
metalnessMap: loader.load(
|
||||||
'textures/angled-blocks-vegetation/metallic.png',
|
'textures/angled-blocks-vegetation/metallic.png',
|
||||||
texture => {
|
texture => {
|
||||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
||||||
texture.repeat.set(mazeWidth / 4, mazeWidth / 4)
|
texture.repeat.set(mazeWidth / 2, mazeWidth / 2)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
normalMap: loader.load(
|
normalMap: loader.load(
|
||||||
'textures/angled-blocks-vegetation/normal-dx.png',
|
'textures/angled-blocks-vegetation/normal-dx.png',
|
||||||
texture => {
|
texture => {
|
||||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
||||||
texture.repeat.set(mazeWidth / 4, mazeWidth / 4)
|
texture.repeat.set(mazeWidth / 2, mazeWidth / 2)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
roughnessMap: loader.load(
|
roughnessMap: loader.load(
|
||||||
'textures/angled-blocks-vegetation/roughness.png',
|
'textures/angled-blocks-vegetation/roughness.png',
|
||||||
texture => {
|
texture => {
|
||||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
|
||||||
texture.repeat.set(mazeWidth / 4, mazeWidth / 4)
|
texture.repeat.set(mazeWidth / 2, mazeWidth / 2)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
envMapIntensity : 0.6
|
||||||
})
|
})
|
||||||
|
|
||||||
const sideGroundMaterial = new THREE.MeshStandardMaterial({
|
const sideGroundMaterial = new THREE.MeshStandardMaterial({
|
||||||
@ -172,6 +177,7 @@ const sideGroundMaterial = new THREE.MeshStandardMaterial({
|
|||||||
aoMap : wallMaterial.aoMap.clone(),
|
aoMap : wallMaterial.aoMap.clone(),
|
||||||
roughnessMap : wallMaterial.roughnessMap.clone(),
|
roughnessMap : wallMaterial.roughnessMap.clone(),
|
||||||
roughness : 1,
|
roughness : 1,
|
||||||
|
envMapIntensity : 0.5
|
||||||
})
|
})
|
||||||
sideGroundMaterial.map.wrapS = sideGroundMaterial.map.wrapT = THREE.RepeatWrapping
|
sideGroundMaterial.map.wrapS = sideGroundMaterial.map.wrapT = THREE.RepeatWrapping
|
||||||
sideGroundMaterial.normalMap.wrapS = sideGroundMaterial.normalMap.wrapT = THREE.RepeatWrapping
|
sideGroundMaterial.normalMap.wrapS = sideGroundMaterial.normalMap.wrapT = THREE.RepeatWrapping
|
||||||
@ -276,7 +282,7 @@ const sun = new THREE.Vector3();
|
|||||||
//const ambientLight = new THREE.AmbientLight(0x404040, 7);
|
//const ambientLight = new THREE.AmbientLight(0x404040, 7);
|
||||||
//scene.add(ambientLight);
|
//scene.add(ambientLight);
|
||||||
|
|
||||||
const sunLight = new THREE.DirectionalLight(0xffffff, 1);
|
const sunLight = new THREE.DirectionalLight(0xfffae8, 2);
|
||||||
sunLight.castShadow = true;
|
sunLight.castShadow = true;
|
||||||
sunLight.shadow.camera.near = 0.1;
|
sunLight.shadow.camera.near = 0.1;
|
||||||
sunLight.shadow.camera.far = 1.4 * mazeWidth;
|
sunLight.shadow.camera.far = 1.4 * mazeWidth;
|
||||||
@ -337,6 +343,7 @@ const raftMaterial = new THREE.MeshStandardMaterial({
|
|||||||
}),
|
}),
|
||||||
displacementScale: -0.3,
|
displacementScale: -0.3,
|
||||||
displacementBias: 0.15,
|
displacementBias: 0.15,
|
||||||
|
envMapIntensity: 0.5
|
||||||
})
|
})
|
||||||
const raft = new THREE.Mesh(raftGeometry, raftMaterial)
|
const raft = new THREE.Mesh(raftGeometry, raftMaterial)
|
||||||
raft.position.set( .25, ocean.position.y, -mazeWidth/2 - 1.1 )
|
raft.position.set( .25, ocean.position.y, -mazeWidth/2 - 1.1 )
|
||||||
@ -611,7 +618,7 @@ function gameEnd() {
|
|||||||
piano.play();
|
piano.play();
|
||||||
|
|
||||||
document.exitPointerLock();
|
document.exitPointerLock();
|
||||||
//container.style.cursor = "default";
|
container.style.cursor = "default";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,6 +708,22 @@ function controls(deltaTime) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function teleportPlayerIfOob() {
|
||||||
|
|
||||||
|
if (camera.position.y <= - 25) {
|
||||||
|
|
||||||
|
playerCollider.start.set(0, 25, 0);
|
||||||
|
playerCollider.end.set(0, 25.5, 0);
|
||||||
|
playerCollider.radius = 0.3;
|
||||||
|
camera.position.copy(playerCollider.end);
|
||||||
|
camera.rotation.set(0, 0, 0);
|
||||||
|
message.className = ""
|
||||||
|
escaped = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function getWaveInfo(x, z, time) {
|
function getWaveInfo(x, z, time) {
|
||||||
|
|
||||||
const pos = new THREE.Vector3();
|
const pos = new THREE.Vector3();
|
||||||
@ -780,6 +803,8 @@ function animate() {
|
|||||||
|
|
||||||
updatePlayer(deltaTime);
|
updatePlayer(deltaTime);
|
||||||
|
|
||||||
|
teleportPlayerIfOob();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera.position.y > 3.5)
|
if (camera.position.y > 3.5)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user