- Updated all path import
This commit is contained in:
Kum1ta
2024-08-24 23:53:11 +02:00
parent b5d13ccf6f
commit 4d2362c203
2094 changed files with 792 additions and 1360546 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 MiB

After

Width:  |  Height:  |  Size: 7.7 MiB

View File

Before

Width:  |  Height:  |  Size: 5.8 MiB

After

Width:  |  Height:  |  Size: 5.8 MiB

View File

Before

Width:  |  Height:  |  Size: 6.1 MiB

After

Width:  |  Height:  |  Size: 6.1 MiB

View File

Before

Width:  |  Height:  |  Size: 4.9 MiB

After

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

View File

@ -6,27 +6,36 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 23:13:53 by edbernar #+# #+# */
/* Updated: 2024/08/24 20:44:14 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:27:42 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import * as THREE from '/static/three/build/three.module.js'
import { GLTFLoader } from '/static/three/examples/jsm/loaders/GLTFLoader.js';
import * as THREE from '/static/javascript/three/build/three.module.js'
import { GLTFLoader } from '/static/javascript/three/examples/jsm/loaders/GLTFLoader.js';
const tvModel = '/static/models3D/homePage/tv.glb';
const sVideo = '/static/video/homePage/pong.mp4';
const loader = new GLTFLoader();
let light = {
point: 1,
};
class Screen
{
screen = null;
tv = null;
pointLightIntensity = 1;
screenMaterial = null;
canvasVideo = null;
interval = null;
constructor(scene)
{
this.screen = this.#createScreen(scene);
loader.load( '/static/modeles/tv.glb', (gltf) => {
loader.load(tvModel, (gltf) => {
const tv = gltf.scene.children[0];
const boundingBox = new THREE.Box3().setFromObject(tv);
const center = boundingBox.getCenter(new THREE.Vector3());
@ -34,17 +43,17 @@ class Screen
this.tv = tv;
tv.position.set(0, 0.99, 2);
tv.material = new THREE.MeshPhysicalMaterial({color: 0xaaaaaa});
tv.material.roughness = 10;
tv.material.metalness = 1;
tv.material.roughness = 1;
tv.material.metalness = 1.05;
tv.scale.set(0.05, 0.05, 0.05);
tv.castShadow = true;
tv.receiveShadow = true;
scene.add(tv);
this.showVideo(sVideo);
}, undefined, function ( error ) {
console.error( error );
throw Error("Can't open file 'tv.glb'");
} );
this.#showVideo('/static/modeles/pong.mp4')
}
#createScreen(scene)
@ -54,7 +63,7 @@ class Screen
const vertices = positionAttribute.array;
const material = new THREE.MeshStandardMaterial({color: 0xbbbbbb});
const mesh = new THREE.Mesh(geometry, material);
const pointLight = new THREE.PointLight( 0xffffff, 10 * this.pointLightIntensity, 0, 2);
const pointLight = new THREE.SpotLight(0xffffff, 10 * light.point, 0, Math.PI / 1.6);
for (let i = 0; i < vertices.length; i += 3)
{
@ -74,17 +83,27 @@ class Screen
pointLight.castShadow = true;
pointLight.shadow.mapSize.width = 2048;
pointLight.shadow.mapSize.height = 2048;
console.log(pointLight.shadow)
const targetObject = new THREE.Object3D();
targetObject.position.set(0, 1.2, 0);
pointLight.target = targetObject;
pointLight.target.updateMatrixWorld();
scene.add(pointLight);
setInterval(() => {
const intensity = Math.random() * 2 + 10;
pointLight.intensity = intensity * this.pointLightIntensity > 13 * this.pointLightIntensity ? 13 * this.pointLightIntensity : intensity * this.pointLightIntensity;
pointLight.intensity = intensity * light.point > 13 * light.point ? 13 * light.point : intensity * light.point;
}, 100);
return (mesh);
}
#showVideo(path)
changeVideo(path)
{
this.#disposeVideo();
this.showVideo(path);
}
showVideo(path)
{
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d', { willReadFrequently: true });
@ -92,9 +111,12 @@ class Screen
const texture = new THREE.CanvasTexture(canvas);
const material = new THREE.MeshBasicMaterial({ map: texture,color: 0xffffff, transparent: true, opacity: 1 });
canvas.video = video;
canvas.context = context;
canvas.width = 534;
canvas.height = 360;
video.src = path + '?t=' + new Date().getTime();
this.canvasVideo = canvas;
video.src = path;
video.loop = true;
video.muted = true;
video.crossOrigin = 'anonymous';
@ -107,37 +129,53 @@ class Screen
}).catch(err => console.error("Error playing video: ", err));
});
function addNoiseOnImage(context)
{
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
for (let i = 0; i < data.length; i += 4)
{
const r = data[i];
const g = data[i + 1];
const b = data[i + 2];
const brightness = (3 * r + 4 * g + b) >>> 3;
const noise = Math.random() * 128 - 32;
data[i] = data[i + 1] = data[i + 2] = brightness + noise;
}
context.putImageData(imageData, 0, 0);
}
function updateCanvas()
{
if (!video.paused && !video.ended)
if (canvas.video != null || canvas.video == undefined)
{
context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(video, 0, 0, canvas.width, canvas.height);
addNoiseOnImage(context);
texture.needsUpdate = true;
if (canvas.video && !canvas.video.paused && !canvas.video.ended)
{
context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(canvas.video, 0, 0, canvas.width, canvas.height);
texture.needsUpdate = true;
}
requestAnimationFrame(updateCanvas);
}
requestAnimationFrame(updateCanvas);
}
texture.offset.set(0.02, 0);
texture.offset.set(0.05, 0);
this.screen.material = material;
video.load();
canvas.video.load();
}
#disposeVideo()
{
if (this.canvasVideo)
{
const canvas = this.canvasVideo;
const video = canvas.video;
const texture = this.screen.material.map;
if (video)
{
video.pause();
video.src = '';
video.removeAttribute('src');
video.load();
}
if (texture)
texture.dispose();
canvas.video = null;
canvas.context = null;
if (this.screen)
{
this.screen.material.map = null;
this.screen.material.dispose();
}
this.canvasVideo = null;
}
}
};
export { Screen };
export { Screen, light };

View File

@ -6,16 +6,17 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:19:17 by edbernar #+# #+# */
/* Updated: 2024/08/24 20:44:31 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:24:22 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import * as THREE from '/static/three/build/three.module.js'
import { Screen } from '/static/home3D/Screen.js'
import * as THREE from '/static/javascript/three/build/three.module.js'
import { Screen, light } from '/static/javascript/home3D/Screen.js'
import { EffectComposer } from '/static/javascript/three/examples/jsm/postprocessing/EffectComposer.js';
import { RenderPass } from '/static/javascript/three/examples/jsm/postprocessing/RenderPass.js';
import { BokehPass } from '/static/javascript/three/examples/jsm/postprocessing/BokehPass.js';
import { EffectComposer } from '/static/three/examples/jsm/postprocessing/EffectComposer.js';
import { RenderPass } from '/static/three/examples/jsm/postprocessing/RenderPass.js';
import { BokehPass } from '/static/three/examples/jsm/postprocessing/BokehPass.js';
const scene = new THREE.Scene();
const renderer = new THREE.WebGLRenderer({antialias: true});
@ -41,7 +42,7 @@ composer.addPass(new RenderPass(scene, camera));
const dofPass = new BokehPass(scene, camera, {
focus: 10.0,
aperture: 0.020,
aperture: 0.02,
maxblur: 0.01,
});
composer.addPass(dofPass);
@ -102,18 +103,23 @@ function fadeInOut()
let interval = null;
isInFade = true;
interval = setInterval(() => {
screen.pointLightIntensity -= 0.2;
light.point -= 0.2;
screen.screen.material.opacity -= 0.05;
if (screen.screen.material.opacity <= 0)
{
clearInterval(interval);
setTimeout(() => {
interval = setInterval(() => {
screen.pointLightIntensity += 0.2;
light.point += 0.2;
screen.screen.material.opacity += 0.05;
if (screen.screen.material.opacity >= 1)
{
clearInterval(interval);
interval = setInterval(() => {
light.point += 0.2;
if (light.point >= 1)
clearInterval(interval);
}, 10);
isInFade = false;
}
}, 20);
@ -132,6 +138,15 @@ function createCube()
scene.add(mesh);
}
const raycaster = new THREE.Raycaster();
const mouse = new THREE.Vector2();
document.addEventListener( 'mousemove', (event) => {
event.preventDefault();
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
});
function home3D()
{
@ -151,11 +166,51 @@ function createPlane()
scene.add(mesh);
}
const video = {
pong: '/static/video/homePage/pong.mp4',
login: '/static/video/homePage/notLogin.webm'
}
let actualVideo = -1;
if (Math.random() % 100 > 0.97)
video.pong = '/static/video/homePage/easteregg.webm'
setTimeout(() => {
screen.changeVideo(video.pong);
actualVideo = 0;
}, 100);
function loop()
{
raycaster.setFromCamera( mouse, camera );
const intersects = raycaster.intersectObjects( scene.children, false );
if (!screen.canvasVideo)
{
composer.render();
return ;
}
if (intersects.length === 0)
{
if (actualVideo != 0)
{
screen.changeVideo(video.pong);
actualVideo = 0;
}
}
else if (intersects[0].object == screen.screen)
{
if (actualVideo != 1)
{
screen.changeVideo(video.login);
actualVideo = 1;
}
}
else if (actualVideo != 0)
{
screen.changeVideo(video.pong);
actualVideo = 0;
}
composer.render();
// renderer.render(scene, camera);
}

View File

@ -6,13 +6,13 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:19:10 by edbernar #+# #+# */
/* Updated: 2024/08/04 23:10:18 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:22:20 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { infoPanel } from "../typeResponse/typePrivateListMessage.js";
import { showActualGameMessage } from "./showActualGameMessage.js";
import { showListUser } from "./showUserList.js";
import { infoPanel } from "/static/javascript/typeResponse/typePrivateListMessage.js";
import { showActualGameMessage } from "/static/javascript/liveChat/showActualGameMessage.js";
import { showListUser } from "/static/javascript/liveChat/showUserList.js";
/*
Todo (Eddy) :

View File

@ -6,11 +6,11 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:21:55 by edbernar #+# #+# */
/* Updated: 2024/08/06 23:19:51 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:28:45 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { sendRequest } from "../websocket.js";
import { sendRequest } from "/static/javascript/websocket.js";
function showActualGameMessage()
{

View File

@ -6,14 +6,14 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:17:54 by edbernar #+# #+# */
/* Updated: 2024/08/06 23:32:35 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:49:04 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { messageList, infoPanel, waitForMessageList } from "../typeResponse/typePrivateListMessage.js";
import { userMeInfo } from "../typeResponse/typeLogin.js";
import { showListUser } from "./showUserList.js";
import { sendRequest } from "../websocket.js";
import { messageList, infoPanel, waitForMessageList } from "/static/javascript/typeResponse/typePrivateListMessage.js";
import { userMeInfo } from "/static/javascript/typeResponse/typeLogin.js";
import { showListUser } from "/static/javascript/liveChat/showUserList.js";
import { sendRequest } from "/static/javascript/websocket.js";
let savedButtons = [];

View File

@ -3,17 +3,17 @@
/* ::: :::::::: */
/* showUserList.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edbernar <edbernar@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */
/* Updated: 2024/08/05 14:28:31 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:31:19 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { waitForUserList } from "../typeResponse/typePrivateListUser.js";
import { userList } from "../typeResponse/typePrivateListUser.js";
import { showPrivateChat } from "./showPrivateChat.js";
import { sendRequest } from "../websocket.js";
import { waitForUserList } from "/static/javascript/typeResponse/typePrivateListUser.js";
import { userList } from "/static/javascript/typeResponse/typePrivateListUser.js";
import { showPrivateChat } from "/static/javascript/liveChat/showPrivateChat.js";
import { sendRequest } from "/static/javascript/websocket.js";
async function showListUser() {
const divMessageListChatHome = document.getElementById("messageListChatHome");

View File

@ -3,15 +3,15 @@
/* ::: :::::::: */
/* main.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: madegryc <madegryc@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/07 17:40:15 by edbernar #+# #+# */
/* Updated: 2024/08/23 18:35:44 by madegryc ### ########.fr */
/* Updated: 2024/08/24 23:42:45 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { createNotification as CN } from "../notification/main.js";
import { userMeInfo, waitForLogin } from "../typeResponse/typeLogin.js";
import { createNotification as CN } from "/static/javascript/notification/main.js";
import { userMeInfo, waitForLogin } from "/static/javascript/typeResponse/typeLogin.js";
function login()
{

View File

@ -6,13 +6,13 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/30 13:50:35 by edbernar #+# #+# */
/* Updated: 2024/08/24 20:40:04 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:24:33 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { liveChat } from "/static/liveChat/main.js";
import { login } from "/static/login/main.js";
import { home3D } from "/static/home3D/home3D.js"
import { liveChat } from "/static/javascript/liveChat/main.js";
import { login } from "/static/javascript/login/main.js";
import { home3D } from "/static/javascript/home3D/home3D.js"
window.addEventListener('scroll', () => {
const scrollPosition = window.scrollY;

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 23:32:52 by edbernar #+# #+# */
/* Updated: 2024/08/06 23:34:39 by edbernar ### ########.fr */
/* Updated: 2024/08/24 23:41:57 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -151,10 +151,10 @@ class notification
{
timer = 5000;
defaultIcon = {
"warning": "/site/notification/ico/warning.png",
"error": "/site/notification/ico/error.png",
"success": "/site/notification/ico/success.png",
"info": "/site/notification/ico/info.png"
"warning": "/static/img/notification/ico/warning.png",
"error": "/static/img/notification/ico/error.png",
"success": "/static/img/notification/ico/success.png",
"info": "/static/img/notification/ico/info.png"
};
constructor() {}

View File

@ -28,7 +28,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';

View File

@ -33,7 +33,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js';
import { PDBLoader } from 'three/addons/loaders/PDBLoader.js';

View File

@ -31,7 +31,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js';

View File

@ -102,7 +102,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import TWEEN from 'three/addons/libs/tween.module.js';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js';

View File

@ -27,7 +27,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js';
import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js';

View File

@ -31,7 +31,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import TWEEN from 'three/addons/libs/tween.module.js';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js';

View File

@ -34,7 +34,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js';
import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js';

View File

@ -25,7 +25,7 @@
<script type="module">
import * as THREE from '/static/three/build/three.module.js';
import * as THREE from '/static/javascript/three/build/three.module.js';
import Stats from 'three/addons/libs/stats.module.js';

View File

@ -5,7 +5,7 @@ import {
NumberKeyframeTrack,
Vector3,
VectorKeyframeTrack
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
class AnimationClipCreator {

View File

@ -11,7 +11,7 @@ import {
Quaternion,
SphereGeometry,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
const _q = new Quaternion();
const _targetPos = new Vector3();

View File

@ -3,7 +3,7 @@ import {
Object3D,
Quaternion,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
import { CCDIKSolver } from '../animation/CCDIKSolver.js';
import { MMDPhysics } from '../animation/MMDPhysics.js';

View File

@ -11,7 +11,7 @@ import {
Quaternion,
SphereGeometry,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
/**
* Dependencies

View File

@ -7,7 +7,7 @@ import {
ShaderMaterial,
UniformsUtils,
WebGLRenderTarget
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
import { BokehShader, BokehDepthShader } from '../shaders/BokehShader2.js';

View File

@ -14,7 +14,7 @@ import {
Matrix4,
MathUtils,
EventDispatcher
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
//trackball state
const STATE = {

View File

@ -5,7 +5,7 @@ import {
Raycaster,
Vector2,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
const _plane = new Plane();
const _raycaster = new Raycaster();

View File

@ -2,7 +2,7 @@ import {
MathUtils,
Spherical,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
const _lookDirection = new Vector3();
const _spherical = new Spherical();

View File

@ -2,7 +2,7 @@ import {
EventDispatcher,
Quaternion,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
const _changeEvent = { type: 'change' };

View File

@ -1,4 +1,4 @@
import { MOUSE, TOUCH } from '/static/three/build/three.module.js';
import { MOUSE, TOUCH } from '/static/javascript/three/build/three.module.js';
import { OrbitControls } from './OrbitControls.js';

View File

@ -9,7 +9,7 @@ import {
Plane,
Ray,
MathUtils
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
// OrbitControls performs orbiting, dollying (zooming), and panning.
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).

View File

@ -2,7 +2,7 @@ import {
Euler,
EventDispatcher,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
const _euler = new Euler( 0, 0, 0, 'YXZ' );
const _vector = new Vector3();

View File

@ -5,7 +5,7 @@ import {
Quaternion,
Vector2,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
const _changeEvent = { type: 'change' };
const _startEvent = { type: 'start' };

View File

@ -18,7 +18,7 @@ import {
SphereGeometry,
TorusGeometry,
Vector3
} from '/static/three/build/three.module.js';
} from '/static/javascript/three/build/three.module.js';
const _raycaster = new Raycaster();

Some files were not shown because too many files have changed in this diff Show More