Minor improvements: clipping, state management
Warning: potentially very buggy!!
This commit is contained in:
22
js/state.js
22
js/state.js
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user