- trunc username if > 8 in loginButton
    - reduct vague effect on home page
    - replace ground by infinite wall home page
    - change pong video
This commit is contained in:
Kum1ta
2024-10-06 17:04:45 +02:00
parent bcb10e8a36
commit aabf888e25
9 changed files with 25 additions and 54 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:19:17 by edbernar #+# #+# */
/* Updated: 2024/10/03 02:39:58 by edbernar ### ########.fr */
/* Updated: 2024/10/06 16:58:43 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -101,7 +101,7 @@ function home3D()
const loader = new GLTFLoader();
let actualVideo = -1;
let globalSpeed = 0.75;
const ambiantLight = new THREE.AmbientLight(0xffffff, 35);
const ambiantLight = new THREE.AmbientLight(0xffffff, 1);
const video = {
pong: files.pongVideo,
login: files.notLoginVideo
@ -117,7 +117,7 @@ function home3D()
isInFade = false;
spotLight = new THREE.SpotLight(0xffffff, 1000);
spotLight.angle = Math.PI / 6; // angle d'ouverture
spotLight.angle = Math.PI / 6;
spotLight.penumbra = 0.5;
spotLight.decay = 2;
spotLight.distance = 50;
@ -128,10 +128,10 @@ function home3D()
if (Math.random() % 100 > 0.99)
video.pong = files.easterEggVideo;
// newBgWall();
putObject(files.lampModel, -2.5, 0, 2.5, 3, 0, Math.PI + Math.PI / 8, 0);
putObject(files.plantModel, 1.5, 0, 3, 0.5, 0, 0, 0);
putObject(files.gameboyModel, -0.5, -0.075, 0.5, 0.1, 0, 0.4, 0);
putObject(files.infinitPlane, -1, 0, 0, 10, 0, Math.PI / 2 + 0.5, 0, 0x252525);
renderer.toneMapping = THREE.LinearToneMapping;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
@ -141,7 +141,7 @@ function home3D()
scene.background = new THREE.Color(0x020202)
scene.add(ambiantLight);
createPlane();
// createPlane();
createCube();
document.body.getElementsByClassName('homeSection')[0].appendChild(renderer.domElement);
@ -172,7 +172,7 @@ function home3D()
if (camera.position.x < 3.3 && interval)
fadeInOut();
if (dofPass.materialBokeh.uniforms.aperture.value > 0 && interval)
dofPass.materialBokeh.uniforms.aperture.value -= 0.0001;
dofPass.materialBokeh.uniforms.aperture.value -= 0.0003;
if (camera.position.x < 3 && interval)
{
clearInterval(interval);
@ -271,10 +271,11 @@ function home3D()
composer.render();
}
function putObject(objUrl, x, y, z, scale, rX, rY, rZ) {
function putObject(objUrl, x, y, z, scale, rX, rY, rZ, color = 0x080808)
{
loader.load(objUrl, (gltf) => {
const group = new THREE.Group();
const material = new THREE.MeshPhysicalMaterial({color: 0x080808});
const material = new THREE.MeshPhysicalMaterial({color: color});
gltf.scene.children.forEach(elem => {
elem.traverse((child) => {
@ -294,21 +295,6 @@ function home3D()
});
}
function newBgWall()
{
const geometry = new THREE.BoxGeometry(100, 100, 0.1);
const material = new THREE.MeshStandardMaterial({color: 0x020202});
const mesh = new THREE.Mesh(geometry, material);
const geometry2 = new THREE.BoxGeometry(10, 10, 0.1);
const material2 = new THREE.MeshStandardMaterial({color: 0x020202});
const mesh2 = new THREE.Mesh(geometry2, material2);
mesh.position.set(0, 0, 5);
scene.add(mesh);
mesh2.position.set(-5, 0, 0);
mesh2.rotateY(Math.PI / 2);
scene.add(mesh2);
}
function createCube()
{
const geometry = new THREE.BoxGeometry(5, 5, 0.1);
@ -319,18 +305,6 @@ function home3D()
scene.add(mesh);
}
function createPlane()
{
const geometry = new THREE.PlaneGeometry(500, 500);
const material = new THREE.MeshPhysicalMaterial({side: THREE.DoubleSide, color: 0x020202});
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(0, 0, 0);
mesh.rotateX(-(Math.PI / 2));
mesh.receiveShadow = true;
scene.add(mesh);
}
function fadeInOut() {
if (isInFade)
return;