Minor improvements: clipping, state management

Warning: potentially very buggy!!
This commit is contained in:
2025-12-31 19:50:36 +01:00
parent bc703623e8
commit db689c0fa3
4 changed files with 185 additions and 85 deletions

View File

@@ -1,6 +1,7 @@
export const AppState = {
// The root scene object
root: null,
initialRotation: null,
scenes : [],
ambientOcclusion : true,
shadows : true,
@@ -9,6 +10,8 @@ export const AppState = {
clipping : {
enabled: false,
helper : null,
rootBoundingBox: null,
listenerAdded: false,
}
}
@@ -28,5 +31,22 @@ export function getSceneStatus(id) {
* @returns {Boolean}
*/
export function setSceneStatus(id, status) {
return AppState.scenes.find(s => s.id === id).active = status;
AppState.scenes.find(s => s.id === id).active = status;
}
export function getCurrentScene() {
return AppState.scenes.find(s => s.current);
}
/**
*
* @param {String} id The scene's id
* @returns
*/
export function setCurrentScene(id) {
// First set the correct status for the other scenes
let otherScenes = AppState.scenes.filter(s => s.id !== id);
otherScenes.forEach(scene => scene.current = false)
AppState.scenes.find(s => s.id === id).current = true;
}