UNPKG

loaders.gl

Version:

Framework-independent loaders for 3D graphics formats

25 lines (20 loc) 759 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAccessorType = getAccessorType; exports.getAccessorComponentType = getAccessorComponentType; var TYPES = ['SCALAR', 'VEC2', 'VEC3', 'VEC4']; var ARRAY_TO_COMPONENT_TYPE = new Map([[Int8Array, 5120], [Uint8Array, 5121], [Int16Array, 5122], [Uint16Array, 5123], [Uint32Array, 5125], [Float32Array, 5126]]); function getAccessorType(size) { var type = TYPES[size - 1]; return type || TYPES[0]; } function getAccessorComponentType(typedArray) { var componentType = ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor); if (!componentType) { throw new Error('Illegal typed array'); } return componentType; } //# sourceMappingURL=glb-accessor-utils.js.map