63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
export const AppState = {
|
|
// The root scene object
|
|
root: null,
|
|
mainNodeId: null,
|
|
initialRotation: null,
|
|
camera: ATON.Nav._camera,
|
|
renderer: ATON._renderer,
|
|
scenes : [],
|
|
ambientOcclusion : true,
|
|
shadows : true,
|
|
lightProbe : false,
|
|
map : null,
|
|
clipping : {
|
|
enabled: false,
|
|
plane : null,
|
|
controls: null,
|
|
onDrag: null,
|
|
helper : null,
|
|
// Change to boundingSphere
|
|
boundingSphere: null,
|
|
listeners: {
|
|
button: false,
|
|
plane: false,
|
|
},
|
|
vector: null,
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @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;
|
|
} |