Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@loaders.gl/math

Package Overview
Dependencies
9
Maintainers
9
Versions
302
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.4.14 to 3.4.15

44

dist/es5/geometry/attributes/compute-bounding-box.js

@@ -9,32 +9,20 @@ "use strict";

var _assert = require("../utils/assert");
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function computeBoundingBox() {
var positions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var min = [Number(Infinity), Number(Infinity), Number(Infinity)];
var max = [-Infinity, -Infinity, -Infinity];
var _iterator = _createForOfIteratorHelper((0, _attributeIterator.makeAttributeIterator)(positions)),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var position = _step.value;
var x = position[0];
var y = position[1];
var z = position[2];
if (x < min[0]) min[0] = x;
if (y < min[1]) min[1] = y;
if (z < min[2]) min[2] = z;
if (x > max[0]) max[0] = x;
if (y > max[1]) max[1] = y;
if (z > max[2]) max[2] = z;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
let positions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
const min = [Number(Infinity), Number(Infinity), Number(Infinity)];
const max = [-Infinity, -Infinity, -Infinity];
for (const position of (0, _attributeIterator.makeAttributeIterator)(positions)) {
const x = position[0];
const y = position[1];
const z = position[2];
if (x < min[0]) min[0] = x;
if (y < min[1]) min[1] = y;
if (z < min[2]) min[2] = z;
if (x > max[0]) max[0] = x;
if (y > max[1]) max[1] = y;
if (z > max[2]) max[2] = z;
}
var boundingBox = {
min: min,
max: max
const boundingBox = {
min,
max
};

@@ -41,0 +29,0 @@ validateBoundingBox(boundingBox);

@@ -13,42 +13,33 @@ "use strict";

var _getAttributeFromGeometry = require("./get-attribute-from-geometry");
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function computeVertexNormals(geometry) {
(0, _assert.assert)((0, _modes.getPrimitiveModeType)(geometry.mode) === _constants.GL.TRIANGLES, 'TRIANGLES required');
var _getPositions = (0, _getAttributeFromGeometry.getPositions)(geometry),
positions = _getPositions.values;
var normals = new Float32Array(positions.length);
var vectorA = new _core.Vector3();
var vectorB = new _core.Vector3();
var vectorC = new _core.Vector3();
var vectorCB = new _core.Vector3();
var vectorAB = new _core.Vector3();
var _iterator = _createForOfIteratorHelper((0, _primitiveIterator.makePrimitiveIterator)(geometry)),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var primitive = _step.value;
vectorA.fromArray(positions, primitive.i1 * 3);
vectorB.fromArray(positions, primitive.i2 * 3 + 3);
vectorC.fromArray(positions, primitive.i3 * 3 + 6);
vectorCB.subVectors(vectorC, vectorB);
vectorAB.subVectors(vectorA, vectorB);
var normal = vectorCB.cross(vectorAB);
normal.normalize();
var primitiveIndex = primitive.primitiveIndex;
normals[primitiveIndex * 9 + 0] = normal.x;
normals[primitiveIndex * 9 + 1] = normal.y;
normals[primitiveIndex * 9 + 2] = normal.z;
normals[primitiveIndex * 9 + 3] = normal.x;
normals[primitiveIndex * 9 + 4] = normal.y;
normals[primitiveIndex * 9 + 5] = normal.z;
normals[primitiveIndex * 9 + 6] = normal.x;
normals[primitiveIndex * 9 + 7] = normal.y;
normals[primitiveIndex * 9 + 8] = normal.z;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
const {
values: positions
} = (0, _getAttributeFromGeometry.getPositions)(geometry);
const normals = new Float32Array(positions.length);
const vectorA = new _core.Vector3();
const vectorB = new _core.Vector3();
const vectorC = new _core.Vector3();
const vectorCB = new _core.Vector3();
const vectorAB = new _core.Vector3();
for (const primitive of (0, _primitiveIterator.makePrimitiveIterator)(geometry)) {
vectorA.fromArray(positions, primitive.i1 * 3);
vectorB.fromArray(positions, primitive.i2 * 3 + 3);
vectorC.fromArray(positions, primitive.i3 * 3 + 6);
vectorCB.subVectors(vectorC, vectorB);
vectorAB.subVectors(vectorA, vectorB);
const normal = vectorCB.cross(vectorAB);
normal.normalize();
const {
primitiveIndex
} = primitive;
normals[primitiveIndex * 9 + 0] = normal.x;
normals[primitiveIndex * 9 + 1] = normal.y;
normals[primitiveIndex * 9 + 2] = normal.z;
normals[primitiveIndex * 9 + 3] = normal.x;
normals[primitiveIndex * 9 + 4] = normal.y;
normals[primitiveIndex * 9 + 5] = normal.z;
normals[primitiveIndex * 9 + 6] = normal.x;
normals[primitiveIndex * 9 + 7] = normal.y;
normals[primitiveIndex * 9 + 8] = normal.z;
}

@@ -55,0 +46,0 @@ return normals;

@@ -7,15 +7,14 @@ "use strict";

exports.convertBuffersToNonIndexed = convertBuffersToNonIndexed;
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function convertBuffersToNonIndexed(_ref) {
var indices = _ref.indices,
attributes = _ref.attributes;
var geometry2 = new BufferGeometry();
for (var name in attributes) {
var attribute = attributes[name];
var array = attribute.array;
var itemSize = attribute.itemSize;
var array2 = new array.constructor(indices.length * itemSize);
var index = 0,
let {
indices,
attributes
} = _ref;
const geometry2 = new BufferGeometry();
for (const name in attributes) {
const attribute = attributes[name];
const array = attribute.array;
const itemSize = attribute.itemSize;
const array2 = new array.constructor(indices.length * itemSize);
let index = 0,
index2 = 0;

@@ -30,13 +29,4 @@ for (var i = 0, l = indices.length; i < l; i++) {

}
var _iterator = _createForOfIteratorHelper(this.groups),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var group = _step.value;
geometry2.addGroup(group.start, group.count, group.materialIndex);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (const group of this.groups) {
geometry2.addGroup(group.start, group.count, group.materialIndex);
}

@@ -43,0 +33,0 @@ return geometry2;

@@ -12,4 +12,6 @@ "use strict";

if ((0, _isGeometry.default)(geometry)) {
var attributes = geometry.attributes;
var position = attributes.POSITION || attributes.positions;
const {
attributes
} = geometry;
const position = attributes.POSITION || attributes.positions;
(0, _assert.assert)(position);

@@ -16,0 +18,0 @@ return position;

@@ -8,6 +8,6 @@ "use strict";

function normalize() {
var normals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var vector = arguments.length > 1 ? arguments[1] : undefined;
let normals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
let vector = arguments.length > 1 ? arguments[1] : undefined;
normals = this.attributes.normal;
for (var i = 0, il = normals.count; i < il; i++) {
for (let i = 0, il = normals.count; i < il; i++) {
vector.x = normals.getX(i);

@@ -14,0 +14,0 @@ vector.y = normals.getY(i);

@@ -9,6 +9,6 @@ "use strict";

function decodeRGB565(rgb565) {
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
var r5 = rgb565 >> 11 & 31;
var g6 = rgb565 >> 5 & 63;
var b5 = rgb565 & 31;
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
const r5 = rgb565 >> 11 & 31;
const g6 = rgb565 >> 5 & 63;
const b5 = rgb565 & 31;
target[0] = r5 << 3;

@@ -20,7 +20,7 @@ target[1] = g6 << 2;

function encodeRGB565(rgb) {
var r5 = Math.floor(rgb[0] / 8) + 4;
var g6 = Math.floor(rgb[1] / 4) + 2;
var b5 = Math.floor(rgb[2] / 8) + 4;
const r5 = Math.floor(rgb[0] / 8) + 4;
const g6 = Math.floor(rgb[1] / 4) + 2;
const b5 = Math.floor(rgb[2] / 8) + 4;
return r5 + (g6 << 5) + (b5 << 11);
}
//# sourceMappingURL=rgb565.js.map

@@ -22,9 +22,9 @@ "use strict";

var _assert = require("../utils/assert");
var RIGHT_SHIFT = 1.0 / 256.0;
var LEFT_SHIFT = 256.0;
var scratchVector2 = new _core.Vector2();
var scratchVector3 = new _core.Vector3();
var scratchEncodeVector2 = new _core.Vector2();
var octEncodeScratch = new _core.Vector2();
var uint8ForceArray = new Uint8Array(1);
const RIGHT_SHIFT = 1.0 / 256.0;
const LEFT_SHIFT = 256.0;
const scratchVector2 = new _core.Vector2();
const scratchVector3 = new _core.Vector3();
const scratchEncodeVector2 = new _core.Vector2();
const octEncodeScratch = new _core.Vector2();
const uint8ForceArray = new Uint8Array(1);
function forceUint8(value) {

@@ -35,7 +35,7 @@ uint8ForceArray[0] = value;

function fromSNorm(value) {
var rangeMaximum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 255;
let rangeMaximum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 255;
return (0, _core.clamp)(value, 0.0, rangeMaximum) / rangeMaximum * 2.0 - 1.0;
}
function toSNorm(value) {
var rangeMaximum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 255;
let rangeMaximum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 255;
return Math.round(((0, _core.clamp)(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMaximum);

@@ -49,3 +49,3 @@ }

(0, _assert.assert)(result);
var vector3 = scratchVector3.from(vector);
const vector3 = scratchVector3.from(vector);
(0, _assert.assert)(Math.abs(vector3.magnitudeSquared() - 1.0) <= _core._MathUtils.EPSILON6);

@@ -55,4 +55,4 @@ result.x = vector.x / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));

if (vector.z < 0) {
var x = result.x;
var y = result.y;
const x = result.x;
const y = result.y;
result.x = (1.0 - Math.abs(y)) * signNotZero(x);

@@ -85,3 +85,3 @@ result.y = (1.0 - Math.abs(x)) * signNotZero(y);

if (result.z < 0.0) {
var oldVX = result.x;
const oldVX = result.x;
result.x = (1.0 - Math.abs(result.y)) * signNotZero(oldVX);

@@ -98,15 +98,15 @@ result.y = (1.0 - Math.abs(oldVX)) * signNotZero(result.y);

(0, _assert.assert)(result);
var x = encoded.x;
var y = encoded.y;
var z = encoded.z;
var w = encoded.w;
const x = encoded.x;
const y = encoded.y;
const z = encoded.z;
const w = encoded.w;
if (x < 0 || x > 255 || y < 0 || y > 255 || z < 0 || z > 255 || w < 0 || w > 255) {
throw new Error('x, y, z, and w must be unsigned normalized integers between 0 and 255');
}
var xOct16 = x * LEFT_SHIFT + y;
var yOct16 = z * LEFT_SHIFT + w;
const xOct16 = x * LEFT_SHIFT + y;
const yOct16 = z * LEFT_SHIFT + w;
return octDecodeInRange(xOct16, yOct16, 65535, result);
}
function octPackFloat(encoded) {
var vector2 = scratchVector2.from(encoded);
const vector2 = scratchVector2.from(encoded);
return 256.0 * vector2.x + vector2.y;

@@ -120,5 +120,5 @@ }

(0, _assert.assert)(Number.isFinite(value));
var temp = value / 256.0;
var x = Math.floor(temp);
var y = (temp - x) * 256.0;
const temp = value / 256.0;
const x = Math.floor(temp);
const y = (temp - x) * 256.0;
return octDecode(x, y, result);

@@ -131,5 +131,5 @@ }

(0, _assert.assert)(result);
var encoded1 = octEncodeFloat(v1);
var encoded2 = octEncodeFloat(v2);
var encoded3 = octEncode(v3, scratchEncodeVector2);
const encoded1 = octEncodeFloat(v1);
const encoded2 = octEncodeFloat(v2);
const encoded3 = octEncode(v3, scratchEncodeVector2);
result.x = 65536.0 * encoded3.x + encoded1;

@@ -140,8 +140,8 @@ result.y = 65536.0 * encoded3.y + encoded2;

function octUnpack(packed, v1, v2, v3) {
var temp = packed.x / 65536.0;
var x = Math.floor(temp);
var encodedFloat1 = (temp - x) * 65536.0;
let temp = packed.x / 65536.0;
const x = Math.floor(temp);
const encodedFloat1 = (temp - x) * 65536.0;
temp = packed.y / 65536.0;
var y = Math.floor(temp);
var encodedFloat2 = (temp - y) * 65536.0;
const y = Math.floor(temp);
const encodedFloat2 = (temp - y) * 65536.0;
octDecodeFloat(encodedFloat1, v1);

@@ -152,9 +152,9 @@ octDecodeFloat(encodedFloat2, v2);

function compressTextureCoordinates(textureCoordinates) {
var x = textureCoordinates.x * 4095.0 | 0;
var y = textureCoordinates.y * 4095.0 | 0;
const x = textureCoordinates.x * 4095.0 | 0;
const y = textureCoordinates.y * 4095.0 | 0;
return 4096.0 * x + y;
}
function decompressTextureCoordinates(compressed, result) {
var temp = compressed / 4096.0;
var xZeroTo4095 = Math.floor(temp);
const temp = compressed / 4096.0;
const xZeroTo4095 = Math.floor(temp);
result.x = xZeroTo4095 / 4095.0;

@@ -174,6 +174,6 @@ result.y = (compressed - xZeroTo4095 * 4096) / 4095;

}
var u = 0;
var v = 0;
var height = 0;
for (var i = 0; i < uBuffer.length; ++i) {
let u = 0;
let v = 0;
let height = 0;
for (let i = 0; i < uBuffer.length; ++i) {
u += zigZagDecode(uBuffer[i]);

@@ -180,0 +180,0 @@ v += zigZagDecode(vBuffer[i]);

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,6 +7,3 @@ value: true

exports.GL_TYPE = exports.GL_PRIMITIVE_MODE = exports.GL_PRIMITIVE = exports.GL = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var GL_PRIMITIVE = {
const GL_PRIMITIVE = {
POINTS: 0x0000,

@@ -18,3 +14,3 @@ LINES: 0x0001,

exports.GL_PRIMITIVE = GL_PRIMITIVE;
var GL_PRIMITIVE_MODE = {
const GL_PRIMITIVE_MODE = {
POINTS: 0x0000,

@@ -29,3 +25,3 @@ LINES: 0x0001,

exports.GL_PRIMITIVE_MODE = GL_PRIMITIVE_MODE;
var GL_TYPE = {
const GL_TYPE = {
BYTE: 5120,

@@ -41,4 +37,7 @@ UNSIGNED_BYTE: 5121,

exports.GL_TYPE = GL_TYPE;
var GL = _objectSpread(_objectSpread({}, GL_PRIMITIVE_MODE), GL_TYPE);
const GL = {
...GL_PRIMITIVE_MODE,
...GL_TYPE
};
exports.GL = GL;
//# sourceMappingURL=constants.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,9 +7,14 @@ value: true

exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _constants = require("../constants");
var _GL_TYPE_TO_ARRAY_TYP;
var GL_TYPE_TO_ARRAY_TYPE = (_GL_TYPE_TO_ARRAY_TYP = {}, (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.DOUBLE, Float64Array), (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.FLOAT, Float32Array), (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.UNSIGNED_SHORT, Uint16Array), (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.UNSIGNED_INT, Uint32Array), (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.UNSIGNED_BYTE, Uint8Array), (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.BYTE, Int8Array), (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.SHORT, Int16Array), (0, _defineProperty2.default)(_GL_TYPE_TO_ARRAY_TYP, _constants.GL_TYPE.INT, Int32Array), _GL_TYPE_TO_ARRAY_TYP);
var NAME_TO_GL_TYPE = {
const GL_TYPE_TO_ARRAY_TYPE = {
[_constants.GL_TYPE.DOUBLE]: Float64Array,
[_constants.GL_TYPE.FLOAT]: Float32Array,
[_constants.GL_TYPE.UNSIGNED_SHORT]: Uint16Array,
[_constants.GL_TYPE.UNSIGNED_INT]: Uint32Array,
[_constants.GL_TYPE.UNSIGNED_BYTE]: Uint8Array,
[_constants.GL_TYPE.BYTE]: Int8Array,
[_constants.GL_TYPE.SHORT]: Int16Array,
[_constants.GL_TYPE.INT]: Int32Array
};
const NAME_TO_GL_TYPE = {
DOUBLE: _constants.GL_TYPE.DOUBLE,

@@ -25,70 +29,53 @@ FLOAT: _constants.GL_TYPE.FLOAT,

};
var ERR_TYPE_CONVERSION = 'Failed to convert GL type';
var GLType = function () {
function GLType() {
(0, _classCallCheck2.default)(this, GLType);
const ERR_TYPE_CONVERSION = 'Failed to convert GL type';
class GLType {
static fromTypedArray(arrayOrType) {
arrayOrType = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
for (const glType in GL_TYPE_TO_ARRAY_TYPE) {
const ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];
if (ArrayType === arrayOrType) {
return glType;
}
}
throw new Error(ERR_TYPE_CONVERSION);
}
(0, _createClass2.default)(GLType, null, [{
key: "fromTypedArray",
value: function fromTypedArray(arrayOrType) {
arrayOrType = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
for (var glType in GL_TYPE_TO_ARRAY_TYPE) {
var ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];
if (ArrayType === arrayOrType) {
return glType;
}
}
static fromName(name) {
const glType = NAME_TO_GL_TYPE[name];
if (!glType) {
throw new Error(ERR_TYPE_CONVERSION);
}
}, {
key: "fromName",
value: function fromName(name) {
var glType = NAME_TO_GL_TYPE[name];
if (!glType) {
throw new Error(ERR_TYPE_CONVERSION);
}
return glType;
return glType;
}
static getArrayType(glType) {
switch (glType) {
case _constants.GL_TYPE.UNSIGNED_SHORT_5_6_5:
case _constants.GL_TYPE.UNSIGNED_SHORT_4_4_4_4:
case _constants.GL_TYPE.UNSIGNED_SHORT_5_5_5_1:
return Uint16Array;
default:
const ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];
if (!ArrayType) {
throw new Error(ERR_TYPE_CONVERSION);
}
return ArrayType;
}
}, {
key: "getArrayType",
value: function getArrayType(glType) {
switch (glType) {
case _constants.GL_TYPE.UNSIGNED_SHORT_5_6_5:
case _constants.GL_TYPE.UNSIGNED_SHORT_4_4_4_4:
case _constants.GL_TYPE.UNSIGNED_SHORT_5_5_5_1:
return Uint16Array;
default:
var ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];
if (!ArrayType) {
throw new Error(ERR_TYPE_CONVERSION);
}
return ArrayType;
}
}
static getByteSize(glType) {
const ArrayType = GLType.getArrayType(glType);
return ArrayType.BYTES_PER_ELEMENT;
}
static validate(glType) {
return Boolean(GLType.getArrayType(glType));
}
static createTypedArray(glType, buffer) {
let byteOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
let length = arguments.length > 3 ? arguments[3] : undefined;
if (length === undefined) {
length = (buffer.byteLength - byteOffset) / GLType.getByteSize(glType);
}
}, {
key: "getByteSize",
value: function getByteSize(glType) {
var ArrayType = GLType.getArrayType(glType);
return ArrayType.BYTES_PER_ELEMENT;
}
}, {
key: "validate",
value: function validate(glType) {
return Boolean(GLType.getArrayType(glType));
}
}, {
key: "createTypedArray",
value: function createTypedArray(glType, buffer) {
var byteOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var length = arguments.length > 3 ? arguments[3] : undefined;
if (length === undefined) {
length = (buffer.byteLength - byteOffset) / GLType.getByteSize(glType);
}
var ArrayType = GLType.getArrayType(glType);
return new ArrayType(buffer, byteOffset, length);
}
}]);
return GLType;
}();
const ArrayType = GLType.getArrayType(glType);
return new ArrayType(buffer, byteOffset, length);
}
}
exports.default = GLType;
//# sourceMappingURL=gl-type.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,6 +7,5 @@ value: true

exports.default = isGeometry;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
function isGeometry(geometry) {
return geometry && (0, _typeof2.default)(geometry) === 'object' && geometry.mode && geometry.attributes && (0, _typeof2.default)(geometry.attributes) === 'object';
return geometry && typeof geometry === 'object' && geometry.mode && geometry.attributes && typeof geometry.attributes === 'object';
}
//# sourceMappingURL=is-geometry.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,32 +7,12 @@ value: true

exports.makeAttributeIterator = makeAttributeIterator;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _marked = _regenerator.default.mark(makeAttributeIterator);
function makeAttributeIterator(values, size) {
var ArrayType, element, i, j;
return _regenerator.default.wrap(function makeAttributeIterator$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
ArrayType = values.constructor;
element = new ArrayType(size);
i = 0;
case 3:
if (!(i < values.length)) {
_context.next = 10;
break;
}
for (j = 0; j < size; j++) {
element[j] = element[i + j];
}
_context.next = 7;
return element;
case 7:
i += size;
_context.next = 3;
break;
case 10:
case "end":
return _context.stop();
function* makeAttributeIterator(values, size) {
const ArrayType = values.constructor;
const element = new ArrayType(size);
for (let i = 0; i < values.length; i += size) {
for (let j = 0; j < size; j++) {
element[j] = element[i + j];
}
}, _marked);
yield element;
}
}
//# sourceMappingURL=attribute-iterator.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,3 +7,2 @@ value: true

exports.makePrimitiveIterator = makePrimitiveIterator;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _constants = require("../constants");

@@ -14,53 +12,43 @@ var _modes = require("../primitives/modes");

function makePrimitiveIterator(indices) {
var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var mode = arguments.length > 2 ? arguments[2] : undefined;
var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
var end = arguments.length > 4 ? arguments[4] : undefined;
return _regenerator.default.mark(function _callee() {
var info, i;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (indices) {
indices = indices.values || indices.value || indices;
}
if (end === undefined) {
end = indices ? indices.length : start;
}
info = {
attributes: attributes,
type: (0, _modes.getPrimitiveModeType)(mode),
i1: 0,
i2: 0,
i3: 0
};
i = start;
case 4:
if (!(i < end)) {
_context.next = 43;
break;
}
_context.t0 = mode;
_context.next = _context.t0 === _constants.GL.POINTS ? 8 : _context.t0 === _constants.GL.LINES ? 11 : _context.t0 === _constants.GL.LINE_STRIP ? 15 : _context.t0 === _constants.GL.LINE_LOOP ? 19 : _context.t0 === _constants.GL.TRIANGLES ? 23 : _context.t0 === _constants.GL.TRIANGLE_STRIP ? 28 : _context.t0 === _constants.GL.TRIANGLE_FAN ? 32 : 37;
break;
case 8:
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let mode = arguments.length > 2 ? arguments[2] : undefined;
let start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
let end = arguments.length > 4 ? arguments[4] : undefined;
return function* () {
if (indices) {
indices = indices.values || indices.value || indices;
}
if (end === undefined) {
end = indices ? indices.length : start;
}
const info = {
attributes,
type: (0, _modes.getPrimitiveModeType)(mode),
i1: 0,
i2: 0,
i3: 0
};
let i = start;
while (i < end) {
switch (mode) {
case _constants.GL.POINTS:
info.i1 = i;
i += 1;
return _context.abrupt("break", 38);
case 11:
break;
case _constants.GL.LINES:
info.i1 = i;
info.i2 = i + 1;
i += 2;
return _context.abrupt("break", 38);
case 15:
break;
case _constants.GL.LINE_STRIP:
info.i1 = i;
info.i2 = i + 1;
i += 1;
return _context.abrupt("break", 38);
case 19:
break;
case _constants.GL.LINE_LOOP:
info.i1 = i;
info.i2 = i + 1;
i += 1;
return _context.abrupt("break", 38);
case 23:
break;
case _constants.GL.TRIANGLES:
info.i1 = i;

@@ -70,9 +58,9 @@ info.i2 = i + 1;

i += 3;
return _context.abrupt("break", 38);
case 28:
break;
case _constants.GL.TRIANGLE_STRIP:
info.i1 = i;
info.i2 = i + 1;
i += 1;
return _context.abrupt("break", 38);
case 32:
break;
case _constants.GL.TRIANGLE_FAN:
info.i1 = 1;

@@ -82,25 +70,17 @@ info.i2 = i;

i += 1;
return _context.abrupt("break", 38);
case 37:
break;
default:
(0, _loaderUtils.assert)(false);
case 38:
if (indices) {
if ('i1' in info) {
info.i1 = indices[info.i1];
info.i2 = indices[info.i2];
info.i3 = indices[info.i3];
}
}
_context.next = 41;
return info;
case 41:
_context.next = 4;
break;
case 43:
case "end":
return _context.stop();
}
}, _callee);
})();
if (indices) {
if ('i1' in info) {
info.i1 = indices[info.i1];
info.i2 = indices[info.i2];
info.i3 = indices[info.i3];
}
}
yield info;
}
}();
}
//# sourceMappingURL=primitive-iterator.js.map

@@ -8,13 +8,13 @@ "use strict";

function concatTypedArrays() {
var arrays = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var byteLength = 0;
for (var i = 0; i < arrays.length; ++i) {
let arrays = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
let byteLength = 0;
for (let i = 0; i < arrays.length; ++i) {
byteLength += arrays[i].byteLength;
}
var buffer = new Uint8Array(byteLength);
var byteOffset = 0;
for (var _i = 0; _i < arrays.length; ++_i) {
var data = new Uint8Array(arrays[_i].buffer);
const buffer = new Uint8Array(byteLength);
let byteOffset = 0;
for (let i = 0; i < arrays.length; ++i) {
const data = new Uint8Array(arrays[i].buffer);
byteLength = data.length;
for (var j = 0; j < byteLength; ++j) {
for (let j = 0; j < byteLength; ++j) {
buffer[byteOffset++] = data[j];

@@ -21,0 +21,0 @@ }

@@ -9,3 +9,3 @@ "use strict";

enumerable: true,
get: function get() {
get: function () {
return _constants.GL;

@@ -16,3 +16,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _glType.default;

@@ -23,3 +23,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _constants.GL_TYPE;

@@ -30,3 +30,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.compressTextureCoordinates;

@@ -37,3 +37,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _computeVertexNormals.computeVertexNormals;

@@ -44,3 +44,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _typedArrayUtils.concatTypedArrays;

@@ -51,3 +51,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _rgb.decodeRGB565;

@@ -58,3 +58,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.decompressTextureCoordinates;

@@ -65,3 +65,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _rgb.encodeRGB565;

@@ -72,3 +72,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _isGeometry.default;

@@ -79,3 +79,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeIterator.makeAttributeIterator;

@@ -86,3 +86,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _primitiveIterator.makePrimitiveIterator;

@@ -93,3 +93,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octDecode;

@@ -100,3 +100,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octDecodeFloat;

@@ -107,3 +107,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octDecodeFromVector4;

@@ -114,3 +114,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octDecodeInRange;

@@ -121,3 +121,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octEncode;

@@ -128,3 +128,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octEncodeFloat;

@@ -135,3 +135,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octEncodeInRange;

@@ -142,3 +142,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octEncodeToVector4;

@@ -149,3 +149,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octPack;

@@ -156,3 +156,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octPackFloat;

@@ -163,3 +163,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.octUnpack;

@@ -170,3 +170,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _attributeCompression.zigZagDeltaDecode;

@@ -173,0 +173,0 @@ }

{
"name": "@loaders.gl/math",
"version": "3.4.14",
"version": "3.4.15",
"description": "Experimental math classes for loaders.gl",

@@ -34,7 +34,7 @@ "license": "MIT",

"dependencies": {
"@loaders.gl/images": "3.4.14",
"@loaders.gl/loader-utils": "3.4.14",
"@loaders.gl/images": "3.4.15",
"@loaders.gl/loader-utils": "3.4.15",
"@math.gl/core": "^3.5.1"
},
"gitHead": "dffa197c6ae79bac5277d5e8a132f4cd274e74e5"
"gitHead": "19e941d5805568e449ef9092490d6568a4853298"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc