This commit is contained in:
Adrien MALINGREY 2023-06-30 02:02:31 +02:00
parent f95f23562e
commit 3f84ddd8df

24
main.js
View File

@ -24,8 +24,7 @@ const waves = {
C: { direction: 60, steepness: 0.05, wavelength: 1.5 },
};
const showParam = window.location.search.includes("param")
const showStats = window.location.search.includes("stats")
const debug = window.location.search.includes("debug")
const ambiance = new Audio("snd/ambiance.mp3")
ambiance.loop = true
@ -114,9 +113,12 @@ scene.add(maze)
console.log(String(maze))
if (!debug) {
const invisibleWall = new THREE.Mesh(new THREE.BoxGeometry( .9, 1.8, .9 ));
invisibleWall.material.visible = false;
let matrix = new THREE.Matrix4()
for (let i = 0; i < maze.count; i++) {
maze.getMatrixAt(i, matrix)
const clone = invisibleWall.clone()
@ -125,6 +127,8 @@ for (let i = 0; i < maze.count; i++) {
mazeCollisionner.add(clone);
}
}
// Ground
const groundGeometry = new THREE.BoxGeometry(mazeWidth, mazeWidth, 1)
@ -349,21 +353,19 @@ const raft = new THREE.Mesh(raftGeometry, [
raftFaceMaterial,
raftFaceMaterial,
])
raft.position.set( .2, ocean.position.y, -mazeWidth/2 - 1 );
raft.rotation.y = 1.4
raft.position.set( .25, ocean.position.y, -mazeWidth/2 - 1.1 );
raft.castShadow = true;
scene.add(raft);
const raftOctree = new Octree().fromGraphNode(raft);
//
const stats = new Stats();
if (showStats) container.appendChild(stats.dom);
// GUI
if (showParam) {
const stats = new Stats();
if (debug) {
container.appendChild(stats.dom);
const gui = new GUI();
@ -790,6 +792,6 @@ function animate() {
renderer.render(scene, camera);
if (showStats) stats.update();
if (debug) stats.update();
}