I am trying to use XTK to display VTK files that are dynamically generated as a result of some scientific calculation.
For this, I am attempting to call the following JavaScript function with a new result_file
every time I submit a form (using jQuery's .submit() event handler).
function renderResult(result_file) {
var r = new X.renderer3D();
r.container = 'visualization';
r.init();
r.camera.position = [0, 0, 2.5];
r.camera.focus = [0, 0, 0];
var solution = new X.mesh();
solution.file = result_file;
r.add(solution);
r.render();
}
Unfortunately, while the XTK progress bar indicates that a new render is triggered, the visualization stays fixed to the original rendering. Is there some way to reset or reload a renderer3d
with new data?
You can reuse the old X.mesh, update the file property and then call a mesh.modified() event.