Download node_modules/three-mesh-bvh/src/utils/BufferUtils.js from SimWorld-AI/industrial-harbor-viewer: direct link, hf CLI and curl.
- Browser
- Download file 753 Bytes
-
https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three-mesh-bvh/src/utils/BufferUtils.js
- Command line
-
hf download hf://spaces/SimWorld-AI/industrial-harbor-viewer/node_modules/three-mesh-bvh/src/utils/BufferUtils.js
-
curl -L -o BufferUtils.js https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three-mesh-bvh/src/utils/BufferUtils.js
753 Bytes
| export function isSharedArrayBufferSupported() { | |
| return typeof SharedArrayBuffer !== 'undefined'; | |
| } | |
| export function convertToBufferType( array, BufferConstructor ) { | |
| if ( array === null ) { | |
| return array; | |
| } else if ( array.buffer ) { | |
| const buffer = array.buffer; | |
| if ( buffer.constructor === BufferConstructor ) { | |
| return array; | |
| } | |
| const ArrayConstructor = array.constructor; | |
| const result = new ArrayConstructor( new BufferConstructor( buffer.byteLength ) ); | |
| result.set( array ); | |
| return result; | |
| } else { | |
| if ( array.constructor === BufferConstructor ) { | |
| return array; | |
| } | |
| const result = new BufferConstructor( array.byteLength ); | |
| new Uint8Array( result ).set( new Uint8Array( array ) ); | |
| return result; | |
| } | |
| } | |