i think i'm getting familiar with this library.
1) i want to do a volume rendering like in lesson 10
i want to check whether the user pressed "v" and run a function
this is what i have tried:
window.onload = function() {
var r = new X.renderer3D();
r.init();
var volume = new X.volume();
volume.file = 'http://lessons.goXTK.com/data/avf.nrrd';
var vr = false;
function vRender() {
if (vr) {
volume.volumeRendering = true;
volume.opacity = 0.15;
r.render();
}
}
r.interactor.onKey = function(event) {
if (event.keyCode == 86) {
vr = true;
vRender();
}
}
r.add(volume);
r.camera.position = [120, 80, 160];
r.render();
};
2) how can i grab one of the slice-layers or disable two of the three axis? does it work in a similar way like what i've tried?
var volume = new X.volume();
volume.file = 'http://lessons.goXTK.com/data/avf.nrrd';
volume.sliceX.visible = false;
volume.sliceZ.visible = false;
any help would be appreciated!
2)
Yes, it is possible in a similiar way. Check out the JSFiddle
http://jsfiddle.net/haehn/qxMtk/
The difference is that
volume._sliceXis not available (not exported during compilation) so you have to go through the children. EachX.volumehas 3 children 0,1,2 which are the X,Y,Z slices.Also, the volume has to be created (which happens during parsing initiated by
r.render()) before you can access the children so we have to do the stuff inonShowtimeor after.