]> Creatis software - creaWT.git/blob - wt/bbtk_wt_PKG/src/nn/js/demo/demo2.js~
2498 BBTK FeatureNewNormal wt-version PackageWt
[creaWT.git] / wt / bbtk_wt_PKG / src / nn / js / demo / demo2.js~
1 window.onload = function() {
2
3   // create and initialize a 3D renderer
4   var r = new X.renderer3D();
5   r.init();
6   
7   // create a new X.mesh
8   var skull = new X.mesh();
9 //var fibers = new X.fibers();
10   // .. and associate the .vtk file to it
11   skull.file = 'http://x.babymri.org/?skull.vtk';
12   // .. make it transparent
13   skull.opacity = 0.7;
14   
15 //      fibers.file = 'http://x.babymri.org/?cctracks.trk';
16  // fibers.caption = 'The Corpus Callosum:<br>connecting the two hemispheres<br>of the human brain.';
17
18   // .. add the mesh
19   r.add(skull);
20 //      r.add(fibers);
21   
22   // re-position the camera to face the skull
23   r.camera.position = [0, 400, 0];
24   
25   // animate..
26   r.onRender = function() {
27
28     // rotate the skull around the Z axis
29     // since we moved the camera, it is Z not X
30    //skull.transform.rotateZ(1);
31     
32     // we could also rotate the camera instead which is better in case
33     // we have a lot of objects and want to rotate them all:
34     //
35     // r.camera.rotate([1,0]);
36     
37   };
38   
39   r.render();
40   
41 };
42
43
44
45
46
47
48
49