52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
export const AppState = {
|
|
// The root scene object
|
|
root: null,
|
|
initialRotation: null,
|
|
scenes : [],
|
|
ambientOcclusion : true,
|
|
shadows : true,
|
|
lightProbe : false,
|
|
map : null,
|
|
clipping : {
|
|
enabled: false,
|
|
helper : null,
|
|
rootBoundingBox: null,
|
|
listenerAdded: false,
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @todo Buggyyyyy!!!!
|
|
* @param {String} id
|
|
* @returns {Boolean}
|
|
*/
|
|
export function getSceneStatus(id) {
|
|
return AppState.scenes.find(s => s.id === id).active;
|
|
}
|
|
|
|
/**
|
|
* @todo Buggyyyyy!!!!
|
|
* @param {String} id
|
|
* @param {Boolean} status
|
|
* @returns {Boolean}
|
|
*/
|
|
export function setSceneStatus(id, 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;
|
|
} |