We should be able to build the website
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@ node_modules/
|
||||
|
||||
#backup files from Blender
|
||||
*.blend1
|
||||
dist/
|
||||
dist/index.html
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "vite build"
|
||||
},
|
||||
"author": "",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
|
||||
42
src/main.js
42
src/main.js
@@ -22,27 +22,27 @@ renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
document.body.appendChild( renderer.domElement );
|
||||
|
||||
//Here, we create/load every asset used, and add it in the scene
|
||||
let assets = await addAssetsOnScene(scene);
|
||||
addAssetsOnScene(scene).then(assets => {
|
||||
|
||||
/* --------------------- */
|
||||
/* | MOVEMENT | */
|
||||
/* --------------------- */
|
||||
// Events to listen keyboard inputs
|
||||
document.addEventListener('keydown', PlayerMovement.handleKeyDown);
|
||||
document.addEventListener('keyup', PlayerMovement.handleKeyUp);
|
||||
/* --------------------- */
|
||||
/* | MOVEMENT | */
|
||||
/* --------------------- */
|
||||
// Events to listen keyboard inputs
|
||||
document.addEventListener('keydown', PlayerMovement.handleKeyDown);
|
||||
document.addEventListener('keyup', PlayerMovement.handleKeyUp);
|
||||
|
||||
/* --------------------- */
|
||||
/* | ANIMATIONS | */
|
||||
/* --------------------- */
|
||||
//We can add an animationMixer on objects, and define ready to play actions on objects
|
||||
//https://threejs.org/docs/#api/en/animation/AnimationAction
|
||||
Animations.addAnimationMixerOnMesh(assets.player, ["Walk"]);
|
||||
Animations.addAnimationMixerOnMesh(assets.nameplateModel, ["Animation"]);assets.nameplateModel.animationActions.Animation.play();
|
||||
Animations.addAnimationMixerOnMesh(assets.worldStatue, ["Animation"]);assets.worldStatue.animationActions.Animation.play();
|
||||
Animations.addAnimationMixerOnMesh(assets.printerStatue, ["Printing"]);assets.printerStatue.animationActions.Printing.play();
|
||||
/* --------------------- */
|
||||
/* | ANIMATIONS | */
|
||||
/* --------------------- */
|
||||
//We can add an animationMixer on objects, and define ready to play actions on objects
|
||||
//https://threejs.org/docs/#api/en/animation/AnimationAction
|
||||
Animations.addAnimationMixerOnMesh(assets.player, ["Walk"]);
|
||||
Animations.addAnimationMixerOnMesh(assets.nameplateModel, ["Animation"]);assets.nameplateModel.animationActions.Animation.play();
|
||||
Animations.addAnimationMixerOnMesh(assets.worldStatue, ["Animation"]);assets.worldStatue.animationActions.Animation.play();
|
||||
Animations.addAnimationMixerOnMesh(assets.printerStatue, ["Printing"]);assets.printerStatue.animationActions.Printing.play();
|
||||
|
||||
|
||||
function animate() {
|
||||
function animate() {
|
||||
requestAnimationFrame( animate );
|
||||
|
||||
if(APP_DEBUG)console.log("Player position X : "+assets.player.scene.position.x+ " Y : "+assets.player.scene.position.y);
|
||||
@@ -53,6 +53,8 @@ function animate() {
|
||||
|
||||
renderer.render( scene, camera );//Calculating and redering new frame
|
||||
|
||||
}
|
||||
console.log("Ready to render scene, placed objects : "+scene.children.length);
|
||||
animate();
|
||||
}
|
||||
console.log("Ready to render scene, placed objects : "+scene.children.length);
|
||||
animate();
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user