xtk / X

The X Toolkit
http://www.goXTK.com
Other
786 stars 263 forks source link

Not accepting offline image and its continuosly loading in JS Fiddle #207

Closed amir201808 closed 5 years ago

amir201808 commented 5 years ago

Hello Developers,

I have successfully used this package. When providing online image it works perfectly. When I use downloaded image instead of link, it continuously loads (skull,vtx - 8MB), it goes on loading and does not show image.uid

Code:

window.onload = function() {

  // create and initialize a 3D renderer
  var r = new X.renderer3D();
  r.init();

  // create a new X.mesh
  var skull = new X.mesh();
  // .. and associate the .vtk file to it
  // skull.file = 'http://x.babymri.org/?skull.vtk';  // online image link 
      skull.file = 'project/path/skull.vtk';               // downloaded image file (same as above)
  // .. make it transparent
  skull.opacity = 0.7;

  // .. add the mesh
  r.add(skull);

  // re-position the camera to face the skull
  r.camera.position = [0, 400, 0];

  // animate..
  r.onRender = function() {

    // rotate the skull around the Z axis
    // since we moved the camera, it is Z not X
    skull.transform.rotateZ(1);

    // we could also rotate the camera instead which is better in case
    // we have a lot of objects and want to rotate them all:
    //
    // r.camera.rotate([1,0]);

  };

  r.render();

};

Please guide me. Thank you for your help

amir201808 commented 5 years ago

Hello,

This answer is for someone who may face similar issue in future

This issue was fixed by me. Since the page size is more of heavy images, try downloading the page instead of loading the source code.

Earlier I did Ctrl + U (i.e. opening the source code ), since the image was bigger the URL was loading again and again. So just right click on the web page and download it.

Cheers !!