Open GoogleCodeExporter opened 9 years ago
I'm sorry for the late reply!
I just took a quick look into your code and I didn't find any obvious mistake.
Is it because you forget to update to show the result after the replacement?
Try to add this single line to newModelLoaded():
var newModelLoaded = function(scene) {
...
if (++newLoaded == components.length)
viewer.replaceScene(newScene);
};
=>
var newModelLoaded = function(scene) {
...
if (++newLoaded == components.length) {
viewer.replaceScene(newScene);
viewer.update();
}
};
It tells the viewer to render a new frame using the new scene.
Besides, I suggest you move the initialization codes to be prior to any
functional operation of the viewer instance to avoid unnecessary troubles.
Original comment by Humu2...@gmail.com
on 27 Jun 2014 at 11:38
Thanks for the reply.
I actually went with a "properties" approach. Because I am displaying multiple
canvases on the same page the whole thing is wrapped in a for loop, j counter.
function updateview (name,value) {
// Show/hide parts of the models. Will change all canvases at once.
var newScene = [];
var changeMesh = []
for (var j = 1; j<= numlabs; j++) {
newScene[j] = viewer[j].getScene();
changeMesh[j] = newScene[j].getChildren()[name];
if (value == 1) {changeMesh[j].visible = true;}
else {changeMesh[j].visible = false;}
viewer[j].update();
}
};
Original comment by madb...@gmail.com
on 9 Jul 2014 at 8:56
Good! I think this approach should work fine in your application circumstance.
When a mesh is set to invisible, its runtime cost is trivial.
Original comment by Humu2...@gmail.com
on 10 Jul 2014 at 11:32
Original issue reported on code.google.com by
madb...@gmail.com
on 19 Jun 2014 at 9:09Attachments: