own-tiles-renderer2
Version:
https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification
30 lines (16 loc) • 425 B
JavaScript
export function readMagicBytes( bufferOrDataView ) {
let view;
if ( bufferOrDataView instanceof DataView ) {
view = bufferOrDataView;
} else {
view = new DataView( bufferOrDataView );
}
if ( String.fromCharCode( view.getUint8( 0 ) ) === '{' ) {
return null;
}
let magicBytes = '';
for ( let i = 0; i < 4; i ++ ) {
magicBytes += String.fromCharCode( view.getUint8( i ) );
}
return magicBytes;
}