Added render mode.

This commit is contained in:
Quicksticks-oss committed 2024-03-20 17:54:19 -04:00
1 parent 1b4dc59843
commit 734ef542a0
2 files changed
+33 -7

No files matched your search

+33 -6
View File
@@ -47,6 +47,7 @@ class Editor {
this.selected = null;
this.last_selected = null;
this.transform_interaction;
this.rendering = false;
this.locked = false;
@@ -113,7 +114,7 @@ class Editor {
window.addEventListener('mousemove', this.onMouseMove.bind(this), false);
window.addEventListener('click', this.onMouseClick.bind(this), false);
window.addEventListener("keydown", this._setup_keys.bind(this), false)
window.addEventListener("keyup", this._setup_keys.bind(this), false)
//window.addEventListener('contextmenu', this.onContextMenu.bind(this), false);
//window.addEventListener("mouseup", this.onMouseUp.bind(this), false);
@@ -176,15 +177,26 @@ class Editor {
maxblur: 0.01
});
//this.composer.addPass(this.saoPass);
//this.composer.addPass(this.bloomPass);
//this.composer.addPass(this.smaaPass);
//this.composer.addPass(this.bokehPass);
this._add_post_processing();
this.outputPass = new OutputPass();
this.composer.addPass(this.outputPass);
}
_add_post_processing() {
this.composer.addPass(this.saoPass);
this.composer.addPass(this.bloomPass);
this.composer.addPass(this.smaaPass);
this.composer.addPass(this.bokehPass);
}
_remove_post_processing() {
this.composer.removePass(this.saoPass);
this.composer.removePass(this.bloomPass);
this.composer.removePass(this.smaaPass);
this.composer.removePass(this.bokehPass);
}
_setup_keys(event) {
let boundTranlationMode = this.change_mode.bind(this);
console.log(event.key);
@@ -202,6 +214,9 @@ class Editor {
console.log("Saving...")
this.save();
break;
case 'n':
this.render_mode();
break;
case ' ':
//this.startPlayback();
break;
@@ -236,6 +251,18 @@ class Editor {
document.getElementById("render-btn").addEventListener("click", this.togglePlayback.bind(this));
}
render_mode() {
this.rendering = !this.rendering;
console.log(this.rendering);
this.activeScene.render_mode(this.rendering);
if(this.rendering) {
this._remove_post_processing();
} else {
this._add_post_processing();
}
}
togglePlay() {
this.playback = !this.playback;
this.playback_location = 0;
@@ -243,7 +270,7 @@ class Editor {
this.stopPlayback();
} else {
// REMOVE THIS NEXT LINE IN PROD ONLY FOR TEST!!!!!
this.activeScene.play_anim_demo(this.activeScene.activeCharacter);
//this.activeScene.play_anim_demo(this.activeScene.activeCharacter);
}
}
-1
View File
@@ -18,7 +18,6 @@ class Scene {
this._createGrid();
this._create_base_lighting();
this._create_skybox();
this.render_mode();
}
instantiate(name) {