Started to add a notification div

We just need to correctly implement Jquery and we will be able to show notifications in the game
Also updated npm modules
This commit is contained in:
2024-01-08 23:34:32 +01:00
parent e1f711e03c
commit 02cf36a131
6 changed files with 163 additions and 4 deletions

View File

@@ -3,6 +3,20 @@ import { getCamera } from './cameras/PerspectiveCamera.js';
import {addAssetsOnScene} from './utils/addAssetsOnScene.js';
import * as PlayerMovement from './utils/playerMovement.js';
import * as Animations from './utils/animateMesh.js';
/*TODO*/
import $ from 'jquery'
function showNotification(HTMLText, color){
$("#notification_bar p").html(HTMLText);
$("#notification_bar").css( 'opacity', 0.9 ).animate({
width:320
}, 500);
}
showNotification("oui")
/*TODO*/
let Clock = new THREE.Clock();
THREE.Cache.enabled = true;//So we can request several time the same file without worrying : https://threejs.org/docs/#api/en/loaders/FileLoader

View File

@@ -374,6 +374,17 @@ export async function addAssetsOnScene(scene){
scene.add(signPlane);
}
/* --------------------
ADDING LINK PLATES
-------------------- */
const linkPlate = await loadModel('src/objects/models/linkPlate.gltf');
linkPlate.scene.scale.set(0.4,0.05,0.4);
linkPlate.scene.rotateOnWorldAxis(new THREE.Vector3(1,0,0), MathUtils.degToRad(90));//Must be standing up
alignGround(ground, linkPlate.scene);
linkPlate.scene.position.y = 2;
scene.add( linkPlate.scene );
/* --------------------
ADDING GRASS
-------------------- */
@@ -382,7 +393,7 @@ export async function addAssetsOnScene(scene){
const grass3 = await loadModel('src/objects/models/grass/grass3.gltf');
const grass4 = await loadModel('src/objects/models/grass/grass4.gltf');
const grass5 = await loadModel('src/objects/models/grass/grass5.gltf');
const grassModels = [grass1,grass2,grass3,grass4,grass5];//https://threejs.org/docs/#api/en/objects/InstancedMesh
const grassModels = [grass1,grass2,grass3,grass4,grass5];// Planned for later : https://threejs.org/docs/#api/en/objects/InstancedMesh
grassModels.forEach(item => {
//Prepare models before placing them

13
src/vite.config.js Normal file
View File

@@ -0,0 +1,13 @@
import { defineConfig } from 'vite';
import inject from "@rollup/plugin-inject";
export default defineConfig({
plugins: [
inject({
jQuery: 'jquery',
}),
],
optimizeDeps: {
include: ['jquery'],
},
});