Structured layers menu (WIP)
This commit is contained in:
18
js/scene.js
18
js/scene.js
@@ -232,18 +232,21 @@ Scene.resetClipping = function () {
|
||||
}
|
||||
/**
|
||||
* @param {Object} marker - The marker object from config
|
||||
* @param {Object[]} nodes - The flat list of nodes for this scene
|
||||
*/
|
||||
Scene.openScene = function(marker) {
|
||||
Scene.openScene = function(marker, nodes) {
|
||||
Scene.init();
|
||||
// TODO: move to init logic
|
||||
Scene.UI.toggleClipperBar('#clipper', '#clipper-bar');
|
||||
|
||||
// Filter nodes with models first
|
||||
nodes = nodes.filter(n => n.model);
|
||||
// Load 3D models and create nodes
|
||||
Scene.loadNodes(marker.nodes);
|
||||
Scene.loadNodes(nodes);
|
||||
|
||||
ATON.setMainPanorama(marker.pano);
|
||||
// TODO: hardcoded...
|
||||
AppState.initialRotation = new THREE.Vector3(0, 1.5, 0);
|
||||
//Scene.showEdges(mainNode);
|
||||
|
||||
ATON.setAutoLP(config.scene.autoLP);
|
||||
AppState.lightProbe = config.scene.autoLP;
|
||||
@@ -254,7 +257,7 @@ Scene.openScene = function(marker) {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Array} nodes
|
||||
* @param {Object[]} nodes
|
||||
*/
|
||||
Scene.loadNodes = function (nodes) {
|
||||
nodes.forEach(n => {
|
||||
@@ -264,7 +267,11 @@ Scene.loadNodes = function (nodes) {
|
||||
|
||||
// Apply any transparency before attaching to scene
|
||||
if (n.opacity) {
|
||||
node.setMaterial(new THREE.MeshPhongMaterial({transparent: true, opacity: n.opacity, color: '#fff'}));
|
||||
node.setMaterial(new THREE.MeshPhongMaterial({
|
||||
transparent: true,
|
||||
opacity: n.opacity,
|
||||
color: '#fff'
|
||||
}));
|
||||
}
|
||||
|
||||
node.attachToRoot();
|
||||
@@ -275,7 +282,6 @@ Scene.loadNodes = function (nodes) {
|
||||
AppState.clipping.boundingSphere = node.getBound();
|
||||
}
|
||||
|
||||
|
||||
AppState.nodes.push({id: n.label, active: true});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user