Closed Abeer-Alsaiari closed 6 years ago
I tried a bunny VTK model and it worked. I had to upgrade ThreeJS to the latest version to get some utils function that the VTK loader needed.
I created a branch with a new VTK loader sample: develop/vtk-loader I added the VTK loader sample to the samples website: v5 samples
Please try your VTK model with the VTK loader sample. If you still get the error, is it possible for you to share the model?
I upgraded ThreeJS. Now it works with vtk ASCII files but not the BINARY vtk models as this.
URIError: The URI to be decoded is not a valid encoding at LoaderUtils.decodeText (three.js:36111:4) at parse (VTKLoader.js:1189:3)
HoloJS does not implement TextDecoder. In the absence of TextDecoder, ThreeJS falls back to
decodeURIComponent(
escape( s ) )
to decode the string. However, the string to be decoded is not a valid URL and it throws an exception.
Chrome and Firefox implement TextDecoder so it works. Edge does not implement it so the web sample does not work in Edge. If I were to remove the TextDecoder option from ThreeJS, all browsers would throw the same exception about invalid URL.
I'll look into finding or implementing a TextDecoder class.
I picked up a simple JavaScript utf8 decoder from stackoverflow courtesy of the user fakedrake and I used it for a TextDecoder. Seems to load the VTK binary model you were having trouble with.
I updated the branch with the changes above.
I tried the utf8 decoder courtesy of fakedrake at stackoverflow and it worked perfectly. Can you put a link to the updated branch so I can get officially updated version?
This is now merged into master.
Hi All,
I'm trying to load a vtk model into the ThreeJSApp under HoloJS. The file is small about 1.5MB. I'm using THREE.VTKLoader() assuming its supported as FBXloader etc. However, VTKLoader throws an error at:
function parseBinary( data ){
--> var buffer = new Uint8Array( data );
//TypeError: Typed array constructor argument is invalid
The header of the vtk file is: vtk DataFile Version 4.0 vtk output BINARY DATASET POLYDATA POINTS 33950 float
The THREE.VTKLoader() works fine with threejs web based examples but couldn't fix the problem to make it works with HoloJS. Any idea?