UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

25 lines (22 loc) 1.09 kB
import { F as F32, ai as U32, U as U16, j as U8 } from './index-By0tcgYN.esm.js'; const FLOAT = 5126; const UNSIGNED_SHORT = 5123; const UNSIGNED_INT = 5125; function copyStridedAttribute(accessor, bufferView, binChunk, componentCount, componentBytes) { const ct = accessor.componentType; const count = accessor.count; const Ctor = ct === FLOAT ? F32 : ct === UNSIGNED_INT ? U32 : ct === UNSIGNED_SHORT ? U16 : U8; const out = new Ctor(count * componentCount); const base = (bufferView.byteOffset ?? 0) + (accessor.byteOffset ?? 0); const stride = bufferView.byteStride; for (let v = 0; v < count; v++) { const row = base + v * stride; for (let c = 0; c < componentCount; c++) { const off = row + c * componentBytes; out[v * componentCount + c] = ct === FLOAT ? binChunk.getFloat32(off, true) : ct === UNSIGNED_INT ? binChunk.getUint32(off, true) : ct === UNSIGNED_SHORT ? binChunk.getUint16(off, true) : binChunk.getUint8(off); } } return out; } export { copyStridedAttribute }; //# sourceMappingURL=gltf-strided-attribute-BaBDvhqc.esm.js.map