Skip to content

Commit

Permalink
Merge pull request #10274 from stity/nrrdLoader2
Browse files Browse the repository at this point in the history
fix Nrrd loader : handle raw encoded data
  • Loading branch information
mrdoob committed Dec 2, 2016
2 parents f7d6b23 + 86142f7 commit 4b64beb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/js/loaders/NRRDLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ Object.assign( THREE.NRRDLoader.prototype, THREE.EventDispatcher.prototype, {
_data = parseDataAsText( _data );

}
else if (headerObject.encoding === 'raw')
{
//we need to copy the array to create a new array buffer, else we retrieve the original arraybuffer with the header
var _copy = new Uint8Array(_data.length);
for (var i = 0; i < _data.length; i++) {
_copy[i] = _data[i];
}
_data = _copy;
}
// .. let's use the underlying array buffer
_data = _data.buffer;

Expand Down

0 comments on commit 4b64beb

Please sign in to comment.