Skip to content

Commit 5b55178

Browse files
committed
Merge pull request mrdoob#8209 from stity/binaryVTKLoader
Fix VTK parser pull request
2 parents 224b6ad + 627f7ee commit 5b55178

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

examples/js/loaders/VTKLoader.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ THREE.VTKLoader.prototype = {
259259

260260
// Nodal. Use BufferGeometry
261261
geometry = new THREE.BufferGeometry();
262-
geometry.setIndex( new THREE.BufferAttribute( new ( indices.length > 65535 ? Uint32Array : Uint16Array )( indices ), 1 ) );
262+
geometry.setIndex( new THREE.BufferAttribute( new Uint32Array( indices ), 1 ) );
263263
geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( positions ), 3 ) );
264264

265265
if ( colors.length == positions.length ) {
@@ -532,11 +532,18 @@ THREE.VTKLoader.prototype = {
532532

533533
var meta = String.fromCharCode.apply( null, new Uint8Array( data, 0, 250 ) ).split( '\n' );
534534

535-
// console.log( meta );
536535

537-
if ( meta[ 2 ] === 'ASCII' ) {
536+
if ( meta[ 2 ].includes( 'ASCII' ) ) {
538537

539-
return parseASCII( String.fromCharCode.apply( null, new Uint8Array( data ) ) );
538+
var stringFile = '';
539+
var charArray = new Uint8Array( data );
540+
for ( var i = 0; i < charArray.length; i ++ ) {
541+
542+
stringFile += String.fromCharCode( charArray[ i ] );
543+
544+
}
545+
546+
return parseASCII( stringFile );
540547

541548
} else {
542549

0 commit comments

Comments
 (0)