@luma.gl/shadertools
Version:
Shader module system for luma.gl
1,862 lines (1,525 loc) • 485 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/bundle.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js":
/*!**************************************************************************************************!*\
!*** /Users/missx/Source/luma.gl/node_modules/@math.gl/core/dist/esm/classes/base/math-array.js ***!
\**************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return MathArray; });
/* harmony import */ var _lib_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../lib/common */ "../../node_modules/@math.gl/core/dist/esm/lib/common.js");
/* harmony import */ var _lib_assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../lib/assert */ "../../node_modules/@math.gl/core/dist/esm/lib/assert.js");
function _extendableBuiltin(cls) {
function ExtendableBuiltin() {
var instance = Reflect.construct(cls, Array.from(arguments));
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
return instance;
}
ExtendableBuiltin.prototype = Object.create(cls.prototype, {
constructor: {
value: cls,
enumerable: false,
writable: true,
configurable: true
}
});
if (Object.setPrototypeOf) {
Object.setPrototypeOf(ExtendableBuiltin, cls);
} else {
ExtendableBuiltin.__proto__ = cls;
}
return ExtendableBuiltin;
}
class MathArray extends _extendableBuiltin(Array) {
get ELEMENTS() {
Object(_lib_assert__WEBPACK_IMPORTED_MODULE_1__["default"])(false);
return 0;
}
clone() {
return new this.constructor().copy(this);
}
from(arrayOrObject) {
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
}
fromArray(array, offset = 0) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = array[i + offset];
}
return this.check();
}
to(arrayOrObject) {
if (arrayOrObject === this) {
return this;
}
return Object(_lib_common__WEBPACK_IMPORTED_MODULE_0__["isArray"])(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
}
toTarget(target) {
return target ? this.to(target) : this;
}
toArray(array = [], offset = 0) {
for (let i = 0; i < this.ELEMENTS; ++i) {
array[offset + i] = this[i];
}
return array;
}
toFloat32Array() {
return new Float32Array(this);
}
toString() {
return this.formatString(_lib_common__WEBPACK_IMPORTED_MODULE_0__["config"]);
}
formatString(opts) {
let string = '';
for (let i = 0; i < this.ELEMENTS; ++i) {
string += (i > 0 ? ', ' : '') + Object(_lib_common__WEBPACK_IMPORTED_MODULE_0__["formatValue"])(this[i], opts);
}
return "".concat(opts.printTypes ? this.constructor.name : '', "[").concat(string, "]");
}
equals(array) {
if (!array || this.length !== array.length) {
return false;
}
for (let i = 0; i < this.ELEMENTS; ++i) {
if (!Object(_lib_common__WEBPACK_IMPORTED_MODULE_0__["equals"])(this[i], array[i])) {
return false;
}
}
return true;
}
exactEquals(array) {
if (!array || this.length !== array.length) {
return false;
}
for (let i = 0; i < this.ELEMENTS; ++i) {
if (this[i] !== array[i]) {
return false;
}
}
return true;
}
negate() {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = -this[i];
}
return this.check();
}
lerp(a, b, t) {
if (t === undefined) {
t = b;
b = a;
a = this;
}
for (let i = 0; i < this.ELEMENTS; ++i) {
const ai = a[i];
this[i] = ai + t * (b[i] - ai);
}
return this.check();
}
min(vector) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(vector[i], this[i]);
}
return this.check();
}
max(vector) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.max(vector[i], this[i]);
}
return this.check();
}
clamp(minVector, maxVector) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(Math.max(this[i], minVector[i]), maxVector[i]);
}
return this.check();
}
add(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] += vector[i];
}
}
return this.check();
}
subtract(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] -= vector[i];
}
}
return this.check();
}
scale(scale) {
if (Array.isArray(scale)) {
return this.multiply(scale);
}
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] *= scale;
}
return this.check();
}
sub(a) {
return this.subtract(a);
}
setScalar(a) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = a;
}
return this.check();
}
addScalar(a) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] += a;
}
return this.check();
}
subScalar(a) {
return this.addScalar(-a);
}
multiplyScalar(scalar) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] *= scalar;
}
return this.check();
}
divideScalar(a) {
return this.scale(1 / a);
}
clampScalar(min, max) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(Math.max(this[i], min), max);
}
return this.check();
}
multiplyByScalar(scalar) {
return this.scale(scalar);
}
get elements() {
return this;
}
check() {
if (_lib_common__WEBPACK_IMPORTED_MODULE_0__["config"].debug && !this.validate()) {
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
}
return this;
}
validate() {
let valid = this.length === this.ELEMENTS;
for (let i = 0; i < this.ELEMENTS; ++i) {
valid = valid && Number.isFinite(this[i]);
}
return valid;
}
}
//# sourceMappingURL=math-array.js.map
/***/ }),
/***/ "../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js":
/*!**********************************************************************************************!*\
!*** /Users/missx/Source/luma.gl/node_modules/@math.gl/core/dist/esm/classes/base/matrix.js ***!
\**********************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Matrix; });
/* harmony import */ var _math_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-array */ "../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js");
/* harmony import */ var _lib_validators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../lib/validators */ "../../node_modules/@math.gl/core/dist/esm/lib/validators.js");
/* harmony import */ var _lib_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/common */ "../../node_modules/@math.gl/core/dist/esm/lib/common.js");
/* harmony import */ var _lib_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../lib/assert */ "../../node_modules/@math.gl/core/dist/esm/lib/assert.js");
class Matrix extends _math_array__WEBPACK_IMPORTED_MODULE_0__["default"] {
get ELEMENTS() {
Object(_lib_assert__WEBPACK_IMPORTED_MODULE_3__["default"])(false);
return 0;
}
get RANK() {
Object(_lib_assert__WEBPACK_IMPORTED_MODULE_3__["default"])(false);
return 0;
}
toString() {
let string = '[';
if (_lib_common__WEBPACK_IMPORTED_MODULE_2__["config"].printRowMajor) {
string += 'row-major:';
for (let row = 0; row < this.RANK; ++row) {
for (let col = 0; col < this.RANK; ++col) {
string += " ".concat(this[col * this.RANK + row]);
}
}
} else {
string += 'column-major:';
for (let i = 0; i < this.ELEMENTS; ++i) {
string += " ".concat(this[i]);
}
}
string += ']';
return string;
}
getElementIndex(row, col) {
return col * this.RANK + row;
}
getElement(row, col) {
return this[col * this.RANK + row];
}
setElement(row, col, value) {
this[col * this.RANK + row] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["checkNumber"])(value);
return this;
}
getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {
const firstIndex = columnIndex * this.RANK;
for (let i = 0; i < this.RANK; ++i) {
result[i] = this[firstIndex + i];
}
return result;
}
setColumn(columnIndex, columnVector) {
const firstIndex = columnIndex * this.RANK;
for (let i = 0; i < this.RANK; ++i) {
this[firstIndex + i] = columnVector[i];
}
return this;
}
}
//# sourceMappingURL=matrix.js.map
/***/ }),
/***/ "../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js":
/*!**********************************************************************************************!*\
!*** /Users/missx/Source/luma.gl/node_modules/@math.gl/core/dist/esm/classes/base/vector.js ***!
\**********************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Vector; });
/* harmony import */ var _math_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-array */ "../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js");
/* harmony import */ var _lib_validators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../lib/validators */ "../../node_modules/@math.gl/core/dist/esm/lib/validators.js");
/* harmony import */ var _lib_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/assert */ "../../node_modules/@math.gl/core/dist/esm/lib/assert.js");
class Vector extends _math_array__WEBPACK_IMPORTED_MODULE_0__["default"] {
get ELEMENTS() {
Object(_lib_assert__WEBPACK_IMPORTED_MODULE_2__["default"])(false);
return 0;
}
copy(vector) {
Object(_lib_assert__WEBPACK_IMPORTED_MODULE_2__["default"])(false);
return this;
}
get x() {
return this[0];
}
set x(value) {
this[0] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["checkNumber"])(value);
}
get y() {
return this[1];
}
set y(value) {
this[1] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["checkNumber"])(value);
}
len() {
return Math.sqrt(this.lengthSquared());
}
magnitude() {
return this.len();
}
lengthSquared() {
let length = 0;
for (let i = 0; i < this.ELEMENTS; ++i) {
length += this[i] * this[i];
}
return length;
}
magnitudeSquared() {
return this.lengthSquared();
}
distance(mathArray) {
return Math.sqrt(this.distanceSquared(mathArray));
}
distanceSquared(mathArray) {
let length = 0;
for (let i = 0; i < this.ELEMENTS; ++i) {
const dist = this[i] - mathArray[i];
length += dist * dist;
}
return Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["checkNumber"])(length);
}
dot(mathArray) {
let product = 0;
for (let i = 0; i < this.ELEMENTS; ++i) {
product += this[i] * mathArray[i];
}
return Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["checkNumber"])(product);
}
normalize() {
const length = this.magnitude();
if (length !== 0) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] /= length;
}
}
return this.check();
}
multiply(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] *= vector[i];
}
}
return this.check();
}
divide(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] /= vector[i];
}
}
return this.check();
}
lengthSq() {
return this.lengthSquared();
}
distanceTo(vector) {
return this.distance(vector);
}
distanceToSquared(vector) {
return this.distanceSquared(vector);
}
getComponent(i) {
Object(_lib_assert__WEBPACK_IMPORTED_MODULE_2__["default"])(i >= 0 && i < this.ELEMENTS, 'index is out of range');
return Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["checkNumber"])(this[i]);
}
setComponent(i, value) {
Object(_lib_assert__WEBPACK_IMPORTED_MODULE_2__["default"])(i >= 0 && i < this.ELEMENTS, 'index is out of range');
this[i] = value;
return this.check();
}
addVectors(a, b) {
return this.copy(a).add(b);
}
subVectors(a, b) {
return this.copy(a).subtract(b);
}
multiplyVectors(a, b) {
return this.copy(a).multiply(b);
}
addScaledVector(a, b) {
return this.add(new this.constructor(a).multiplyScalar(b));
}
}
//# sourceMappingURL=vector.js.map
/***/ }),
/***/ "../../node_modules/@math.gl/core/dist/esm/classes/euler.js":
/*!****************************************************************************************!*\
!*** /Users/missx/Source/luma.gl/node_modules/@math.gl/core/dist/esm/classes/euler.js ***!
\****************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Euler; });
/* harmony import */ var _base_math_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base/math-array */ "../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js");
/* harmony import */ var _lib_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/common */ "../../node_modules/@math.gl/core/dist/esm/lib/common.js");
/* harmony import */ var _lib_validators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/validators */ "../../node_modules/@math.gl/core/dist/esm/lib/validators.js");
/* harmony import */ var _quaternion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./quaternion */ "../../node_modules/@math.gl/core/dist/esm/classes/quaternion.js");
const ERR_UNKNOWN_ORDER = 'Unknown Euler angle order';
const ALMOST_ONE = 0.99999;
function validateOrder(value) {
return value >= 0 && value < 6;
}
function checkOrder(value) {
if (value < 0 && value >= 6) {
throw new Error(ERR_UNKNOWN_ORDER);
}
return value;
}
class Euler extends _base_math_array__WEBPACK_IMPORTED_MODULE_0__["default"] {
static get ZYX() {
return 0;
}
static get YXZ() {
return 1;
}
static get XZY() {
return 2;
}
static get ZXY() {
return 3;
}
static get YZX() {
return 4;
}
static get XYZ() {
return 5;
}
static get RollPitchYaw() {
return 0;
}
static get DefaultOrder() {
return Euler.ZYX;
}
static get RotationOrders() {
return ['ZYX', 'YXZ', 'XZY', 'ZXY', 'YZX', 'XYZ'];
}
static rotationOrder(order) {
return Euler.RotationOrders[order];
}
get ELEMENTS() {
return 4;
}
constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) {
super(-0, -0, -0, -0);
if (arguments.length > 0 && Array.isArray(arguments[0])) {
this.fromVector3(...arguments);
} else {
this.set(x, y, z, order);
}
}
fromQuaternion(quaternion) {
const [x, y, z, w] = quaternion;
const ysqr = y * y;
const t0 = -2.0 * (ysqr + z * z) + 1.0;
const t1 = +2.0 * (x * y + w * z);
let t2 = -2.0 * (x * z - w * y);
const t3 = +2.0 * (y * z + w * x);
const t4 = -2.0 * (x * x + ysqr) + 1.0;
t2 = t2 > 1.0 ? 1.0 : t2;
t2 = t2 < -1.0 ? -1.0 : t2;
const roll = Math.atan2(t3, t4);
const pitch = Math.asin(t2);
const yaw = Math.atan2(t1, t0);
return new Euler(roll, pitch, yaw, Euler.RollPitchYaw);
}
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = Number.isFinite(array[3]) || this.order;
return this.check();
}
set(x = 0, y = 0, z = 0, order) {
this[0] = x;
this[1] = y;
this[2] = z;
this[3] = Number.isFinite(order) ? order : this[3];
return this.check();
}
validate() {
return validateOrder(this[3]) && Number.isFinite(this[0]) && Number.isFinite(this[1]) && Number.isFinite(this[2]);
}
toArray(array = [], offset = 0) {
array[offset] = this[0];
array[offset + 1] = this[1];
array[offset + 2] = this[2];
return array;
}
toArray4(array = [], offset = 0) {
array[offset] = this[0];
array[offset + 1] = this[1];
array[offset + 2] = this[2];
array[offset + 3] = this[3];
return array;
}
toVector3(result = [-0, -0, -0]) {
result[0] = this[0];
result[1] = this[1];
result[2] = this[2];
return result;
}
get x() {
return this[0];
}
set x(value) {
this[0] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get y() {
return this[1];
}
set y(value) {
this[1] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get z() {
return this[2];
}
set z(value) {
this[2] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get alpha() {
return this[0];
}
set alpha(value) {
this[0] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get beta() {
return this[1];
}
set beta(value) {
this[1] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get gamma() {
return this[2];
}
set gamma(value) {
this[2] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get phi() {
return this[0];
}
set phi(value) {
this[0] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get theta() {
return this[1];
}
set theta(value) {
this[1] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get psi() {
return this[2];
}
set psi(value) {
this[2] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get roll() {
return this[0];
}
set roll(value) {
this[0] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get pitch() {
return this[1];
}
set pitch(value) {
this[1] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get yaw() {
return this[2];
}
set yaw(value) {
this[2] = Object(_lib_validators__WEBPACK_IMPORTED_MODULE_2__["checkNumber"])(value);
}
get order() {
return this[3];
}
set order(value) {
this[3] = checkOrder(value);
}
fromVector3(v, order) {
return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
}
fromArray(array, offset = 0) {
this[0] = array[0 + offset];
this[1] = array[1 + offset];
this[2] = array[2 + offset];
if (array[3] !== undefined) {
this[3] = array[3];
}
return this.check();
}
fromRollPitchYaw(roll, pitch, yaw) {
return this.set(roll, pitch, yaw, Euler.ZYX);
}
fromRotationMatrix(m, order = Euler.DefaultOrder) {
this._fromRotationMatrix(m, order);
return this.check();
}
getRotationMatrix(m) {
return this._getRotationMatrix(m);
}
getQuaternion() {
const q = new _quaternion__WEBPACK_IMPORTED_MODULE_3__["default"]();
switch (this[4]) {
case Euler.XYZ:
return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
case Euler.YXZ:
return q.rotateY(this[0]).rotateX(this[1]).rotateZ(this[2]);
case Euler.ZXY:
return q.rotateZ(this[0]).rotateX(this[1]).rotateY(this[2]);
case Euler.ZYX:
return q.rotateZ(this[0]).rotateY(this[1]).rotateX(this[2]);
case Euler.YZX:
return q.rotateY(this[0]).rotateZ(this[1]).rotateX(this[2]);
case Euler.XZY:
return q.rotateX(this[0]).rotateZ(this[1]).rotateY(this[2]);
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
}
_fromRotationMatrix(m, order = Euler.DefaultOrder) {
const te = m.elements;
const m11 = te[0],
m12 = te[4],
m13 = te[8];
const m21 = te[1],
m22 = te[5],
m23 = te[9];
const m31 = te[2],
m32 = te[6],
m33 = te[10];
order = order || this[3];
switch (order) {
case Euler.XYZ:
this[1] = Math.asin(Object(_lib_common__WEBPACK_IMPORTED_MODULE_1__["clamp"])(m13, -1, 1));
if (Math.abs(m13) < ALMOST_ONE) {
this[0] = Math.atan2(-m23, m33);
this[2] = Math.atan2(-m12, m11);
} else {
this[0] = Math.atan2(m32, m22);
this[2] = 0;
}
break;
case Euler.YXZ:
this[0] = Math.asin(-Object(_lib_common__WEBPACK_IMPORTED_MODULE_1__["clamp"])(m23, -1, 1));
if (Math.abs(m23) < ALMOST_ONE) {
this[1] = Math.atan2(m13, m33);
this[2] = Math.atan2(m21, m22);
} else {
this[1] = Math.atan2(-m31, m11);
this[2] = 0;
}
break;
case Euler.ZXY:
this[0] = Math.asin(Object(_lib_common__WEBPACK_IMPORTED_MODULE_1__["clamp"])(m32, -1, 1));
if (Math.abs(m32) < ALMOST_ONE) {
this[1] = Math.atan2(-m31, m33);
this[2] = Math.atan2(-m12, m22);
} else {
this[1] = 0;
this[2] = Math.atan2(m21, m11);
}
break;
case Euler.ZYX:
this[1] = Math.asin(-Object(_lib_common__WEBPACK_IMPORTED_MODULE_1__["clamp"])(m31, -1, 1));
if (Math.abs(m31) < ALMOST_ONE) {
this[0] = Math.atan2(m32, m33);
this[2] = Math.atan2(m21, m11);
} else {
this[0] = 0;
this[2] = Math.atan2(-m12, m22);
}
break;
case Euler.YZX:
this[2] = Math.asin(Object(_lib_common__WEBPACK_IMPORTED_MODULE_1__["clamp"])(m21, -1, 1));
if (Math.abs(m21) < ALMOST_ONE) {
this[0] = Math.atan2(-m23, m22);
this[1] = Math.atan2(-m31, m11);
} else {
this[0] = 0;
this[1] = Math.atan2(m13, m33);
}
break;
case Euler.XZY:
this[2] = Math.asin(-Object(_lib_common__WEBPACK_IMPORTED_MODULE_1__["clamp"])(m12, -1, 1));
if (Math.abs(m12) < ALMOST_ONE) {
this[0] = Math.atan2(m32, m22);
this[1] = Math.atan2(m13, m11);
} else {
this[0] = Math.atan2(-m23, m33);
this[1] = 0;
}
break;
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
this[3] = order;
return this;
}
_getRotationMatrix(result) {
const te = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
const x = this.x,
y = this.y,
z = this.z;
const a = Math.cos(x);
const c = Math.cos(y);
const e = Math.cos(z);
const b = Math.sin(x);
const d = Math.sin(y);
const f = Math.sin(z);
switch (this[3]) {
case Euler.XYZ:
{
const ae = a * e,
af = a * f,
be = b * e,
bf = b * f;
te[0] = c * e;
te[4] = -c * f;
te[8] = d;
te[1] = af + be * d;
te[5] = ae - bf * d;
te[9] = -b * c;
te[2] = bf - ae * d;
te[6] = be + af * d;
te[10] = a * c;
break;
}
case Euler.YXZ:
{
const ce = c * e,
cf = c * f,
de = d * e,
df = d * f;
te[0] = ce + df * b;
te[4] = de * b - cf;
te[8] = a * d;
te[1] = a * f;
te[5] = a * e;
te[9] = -b;
te[2] = cf * b - de;
te[6] = df + ce * b;
te[10] = a * c;
break;
}
case Euler.ZXY:
{
const ce = c * e,
cf = c * f,
de = d * e,
df = d * f;
te[0] = ce - df * b;
te[4] = -a * f;
te[8] = de + cf * b;
te[1] = cf + de * b;
te[5] = a * e;
te[9] = df - ce * b;
te[2] = -a * d;
te[6] = b;
te[10] = a * c;
break;
}
case Euler.ZYX:
{
const ae = a * e,
af = a * f,
be = b * e,
bf = b * f;
te[0] = c * e;
te[4] = be * d - af;
te[8] = ae * d + bf;
te[1] = c * f;
te[5] = bf * d + ae;
te[9] = af * d - be;
te[2] = -d;
te[6] = b * c;
te[10] = a * c;
break;
}
case Euler.YZX:
{
const ac = a * c,
ad = a * d,
bc = b * c,
bd = b * d;
te[0] = c * e;
te[4] = bd - ac * f;
te[8] = bc * f + ad;
te[1] = f;
te[5] = a * e;
te[9] = -b * e;
te[2] = -d * e;
te[6] = ad * f + bc;
te[10] = ac - bd * f;
break;
}
case Euler.XZY:
{
const ac = a * c,
ad = a * d,
bc = b * c,
bd = b * d;
te[0] = c * e;
te[4] = -f;
te[8] = d * e;
te[1] = ac * f + bd;
te[5] = a * e;
te[9] = ad * f - bc;
te[2] = bc * f - ad;
te[6] = b * e;
te[10] = bd * f + ac;
break;
}
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
te[3] = 0;
te[7] = 0;
te[11] = 0;
te[12] = 0;
te[13] = 0;
te[14] = 0;
te[15] = 1;
return te;
}
toQuaternion() {
const cy = Math.cos(this.yaw * 0.5);
const sy = Math.sin(this.yaw * 0.5);
const cr = Math.cos(this.roll * 0.5);
const sr = Math.sin(this.roll * 0.5);
const cp = Math.cos(this.pitch * 0.5);
const sp = Math.sin(this.pitch * 0.5);
const w = cy * cr * cp + sy * sr * sp;
const x = cy * sr * cp - sy * cr * sp;
const y = cy * cr * sp + sy * sr * cp;
const z = sy * cr * cp - cy * sr * sp;
return new _quaternion__WEBPACK_IMPORTED_MODULE_3__["default"](x, y, z, w);
}
}
//# sourceMappingURL=euler.js.map
/***/ }),
/***/ "../../node_modules/@math.gl/core/dist/esm/classes/matrix3.js":
/*!******************************************************************************************!*\
!*** /Users/missx/Source/luma.gl/node_modules/@math.gl/core/dist/esm/classes/matrix3.js ***!
\******************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Matrix3; });
/* harmony import */ var _base_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base/matrix */ "../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js");
/* harmony import */ var _lib_validators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/validators */ "../../node_modules/@math.gl/core/dist/esm/lib/validators.js");
/* harmony import */ var _lib_gl_matrix_extras__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/gl-matrix-extras */ "../../node_modules/@math.gl/core/dist/esm/lib/gl-matrix-extras.js");
/* harmony import */ var gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! gl-matrix/mat3 */ "../../node_modules/gl-matrix/esm/mat3.js");
/* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
/* harmony import */ var gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! gl-matrix/vec3 */ "../../node_modules/gl-matrix/esm/vec3.js");
const IDENTITY = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
const ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0]);
const INDICES = Object.freeze({
COL0ROW0: 0,
COL0ROW1: 1,
COL0ROW2: 2,
COL1ROW0: 3,
COL1ROW1: 4,
COL1ROW2: 5,
COL2ROW0: 6,
COL2ROW1: 7,
COL2ROW2: 8
});
const constants = {};
class Matrix3 extends _base_matrix__WEBPACK_IMPORTED_MODULE_0__["default"] {
static get IDENTITY() {
constants.IDENTITY = constants.IDENTITY || Object.freeze(new Matrix3(IDENTITY));
return constants.IDENTITY;
}
static get ZERO() {
constants.ZERO = constants.ZERO || Object.freeze(new Matrix3(ZERO));
return constants.ZERO;
}
get ELEMENTS() {
return 9;
}
get RANK() {
return 3;
}
get INDICES() {
return INDICES;
}
constructor(array) {
super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
if (arguments.length === 1 && Array.isArray(array)) {
this.copy(array);
} else {
this.identity();
}
}
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
this[4] = array[4];
this[5] = array[5];
this[6] = array[6];
this[7] = array[7];
this[8] = array[8];
return this.check();
}
set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m01;
this[4] = m11;
this[5] = m21;
this[6] = m02;
this[7] = m12;
this[8] = m22;
return this.check();
}
setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m01;
this[4] = m11;
this[5] = m21;
this[6] = m02;
this[7] = m12;
this[8] = m22;
return this.check();
}
determinant() {
return gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["determinant"](this);
}
identity() {
return this.copy(IDENTITY);
}
fromQuaternion(q) {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["fromQuat"](this, q);
return this.check();
}
transpose() {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["transpose"](this, this);
return this.check();
}
invert() {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["invert"](this, this);
return this.check();
}
multiplyLeft(a) {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["multiply"](this, a, this);
return this.check();
}
multiplyRight(a) {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["multiply"](this, this, a);
return this.check();
}
rotate(radians) {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["rotate"](this, this, radians);
return this.check();
}
scale(factor) {
if (Array.isArray(factor)) {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["scale"](this, this, factor);
} else {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["scale"](this, this, [factor, factor, factor]);
}
return this.check();
}
translate(vec) {
gl_matrix_mat3__WEBPACK_IMPORTED_MODULE_3__["translate"](this, this, vec);
return this.check();
}
transform(vector, result) {
switch (vector.length) {
case 2:
result = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_4__["transformMat3"](result || [-0, -0], vector, this);
break;
case 3:
result = gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_5__["transformMat3"](result || [-0, -0, -0], vector, this);
break;
case 4:
result = Object(_lib_gl_matrix_extras__WEBPACK_IMPORTED_MODULE_2__["vec4_transformMat3"])(result || [-0, -0, -0, -0], vector, this);
break;
default:
throw new Error('Illegal vector');
}
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["checkVector"])(result, vector.length);
return result;
}
transformVector(vector, result) {
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["deprecated"])('Matrix3.transformVector');
return this.transform(vector, result);
}
transformVector2(vector, result) {
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["deprecated"])('Matrix3.transformVector');
return this.transform(vector, result);
}
transformVector3(vector, result) {
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_1__["deprecated"])('Matrix3.transformVector');
return this.transform(vector, result);
}
}
//# sourceMappingURL=matrix3.js.map
/***/ }),
/***/ "../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js":
/*!******************************************************************************************!*\
!*** /Users/missx/Source/luma.gl/node_modules/@math.gl/core/dist/esm/classes/matrix4.js ***!
\******************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Matrix4; });
/* harmony import */ var _lib_validators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/validators */ "../../node_modules/@math.gl/core/dist/esm/lib/validators.js");
/* harmony import */ var _base_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base/matrix */ "../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js");
/* harmony import */ var _lib_gl_matrix_extras__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/gl-matrix-extras */ "../../node_modules/@math.gl/core/dist/esm/lib/gl-matrix-extras.js");
/* harmony import */ var gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! gl-matrix/mat4 */ "../../node_modules/gl-matrix/esm/mat4.js");
/* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
/* harmony import */ var gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! gl-matrix/vec3 */ "../../node_modules/gl-matrix/esm/vec3.js");
/* harmony import */ var gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! gl-matrix/vec4 */ "../../node_modules/gl-matrix/esm/vec4.js");
const IDENTITY = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
const ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
const INDICES = Object.freeze({
COL0ROW0: 0,
COL0ROW1: 1,
COL0ROW2: 2,
COL0ROW3: 3,
COL1ROW0: 4,
COL1ROW1: 5,
COL1ROW2: 6,
COL1ROW3: 7,
COL2ROW0: 8,
COL2ROW1: 9,
COL2ROW2: 10,
COL2ROW3: 11,
COL3ROW0: 12,
COL3ROW1: 13,
COL3ROW2: 14,
COL3ROW3: 15
});
const constants = {};
class Matrix4 extends _base_matrix__WEBPACK_IMPORTED_MODULE_1__["default"] {
static get IDENTITY() {
constants.IDENTITY = constants.IDENTITY || Object.freeze(new Matrix4(IDENTITY));
return constants.IDENTITY;
}
static get ZERO() {
constants.ZERO = constants.ZERO || Object.freeze(new Matrix4(ZERO));
return constants.ZERO;
}
get INDICES() {
return INDICES;
}
get ELEMENTS() {
return 16;
}
get RANK() {
return 4;
}
constructor(array) {
super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
if (arguments.length === 1 && Array.isArray(array)) {
this.copy(array);
} else {
this.identity();
}
}
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
this[4] = array[4];
this[5] = array[5];
this[6] = array[6];
this[7] = array[7];
this[8] = array[8];
this[9] = array[9];
this[10] = array[10];
this[11] = array[11];
this[12] = array[12];
this[13] = array[13];
this[14] = array[14];
this[15] = array[15];
return this.check();
}
set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m30;
this[4] = m01;
this[5] = m11;
this[6] = m21;
this[7] = m31;
this[8] = m02;
this[9] = m12;
this[10] = m22;
this[11] = m32;
this[12] = m03;
this[13] = m13;
this[14] = m23;
this[15] = m33;
return this.check();
}
setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m30;
this[4] = m01;
this[5] = m11;
this[6] = m21;
this[7] = m31;
this[8] = m02;
this[9] = m12;
this[10] = m22;
this[11] = m32;
this[12] = m03;
this[13] = m13;
this[14] = m23;
this[15] = m33;
return this.check();
}
toRowMajor(result) {
result[0] = this[0];
result[1] = this[4];
result[2] = this[8];
result[3] = this[12];
result[4] = this[1];
result[5] = this[5];
result[6] = this[9];
result[7] = this[13];
result[8] = this[2];
result[9] = this[6];
result[10] = this[10];
result[11] = this[14];
result[12] = this[3];
result[13] = this[7];
result[14] = this[11];
result[15] = this[15];
return result;
}
identity() {
return this.copy(IDENTITY);
}
fromQuaternion(q) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["fromQuat"](this, q);
return this.check();
}
frustum({
left,
right,
bottom,
top,
near,
far
}) {
if (far === Infinity) {
Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
} else {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["frustum"](this, left, right, bottom, top, near, far);
}
return this.check();
}
static _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
const column0Row0 = 2.0 * near / (right - left);
const column1Row1 = 2.0 * near / (top - bottom);
const column2Row0 = (right + left) / (right - left);
const column2Row1 = (top + bottom) / (top - bottom);
const column2Row2 = -1.0;
const column2Row3 = -1.0;
const column3Row2 = -2.0 * near;
result[0] = column0Row0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = column1Row1;
result[6] = 0.0;
result[7] = 0.0;
result[8] = column2Row0;
result[9] = column2Row1;
result[10] = column2Row2;
result[11] = column2Row3;
result[12] = 0.0;
result[13] = 0.0;
result[14] = column3Row2;
result[15] = 0.0;
return result;
}
lookAt(eye, center, up) {
if (arguments.length === 1) {
({
eye,
center,
up
} = eye);
}
center = center || [0, 0, 0];
up = up || [0, 1, 0];
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["lookAt"](this, eye, center, up);
return this.check();
}
ortho({
left,
right,
bottom,
top,
near = 0.1,
far = 500
}) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["ortho"](this, left, right, bottom, top, near, far);
return this.check();
}
orthographic({
fovy = 45 * Math.PI / 180,
aspect = 1,
focalDistance = 1,
near = 0.1,
far = 500
}) {
if (fovy > Math.PI * 2) {
throw Error('radians');
}
const halfY = fovy / 2;
const top = focalDistance * Math.tan(halfY);
const right = top * aspect;
return new Matrix4().ortho({
left: -right,
right,
bottom: -top,
top,
near,
far
});
}
perspective({
fovy = undefined,
fov = 45 * Math.PI / 180,
aspect = 1,
near = 0.1,
far = 500
} = {}) {
fovy = fovy || fov;
if (fovy > Math.PI * 2) {
throw Error('radians');
}
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["perspective"](this, fovy, aspect, near, far);
return this.check();
}
determinant() {
return gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["determinant"](this);
}
getScale(result = [-0, -0, -0]) {
result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
return result;
}
getTranslation(result = [-0, -0, -0]) {
result[0] = this[12];
result[1] = this[13];
result[2] = this[14];
return result;
}
getRotation(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
const scale = this.getScale(scaleResult || [-0, -0, -0]);
const inverseScale0 = 1 / scale[0];
const inverseScale1 = 1 / scale[1];
const inverseScale2 = 1 / scale[2];
result[0] = this[0] * inverseScale0;
result[1] = this[1] * inverseScale1;
result[2] = this[2] * inverseScale2;
result[3] = 0;
result[4] = this[4] * inverseScale0;
result[5] = this[5] * inverseScale1;
result[6] = this[6] * inverseScale2;
result[7] = 0;
result[8] = this[8] * inverseScale0;
result[9] = this[9] * inverseScale1;
result[10] = this[10] * inverseScale2;
result[11] = 0;
result[12] = 0;
result[13] = 0;
result[14] = 0;
result[15] = 1;
return result;
}
getRotationMatrix3(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
const scale = this.getScale(scaleResult || [-0, -0, -0]);
const inverseScale0 = 1 / scale[0];
const inverseScale1 = 1 / scale[1];
const inverseScale2 = 1 / scale[2];
result[0] = this[0] * inverseScale0;
result[1] = this[1] * inverseScale1;
result[2] = this[2] * inverseScale2;
result[3] = this[4] * inverseScale0;
result[4] = this[5] * inverseScale1;
result[5] = this[6] * inverseScale2;
result[6] = this[8] * inverseScale0;
result[7] = this[9] * inverseScale1;
result[8] = this[10] * inverseScale2;
return result;
}
transpose() {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["transpose"](this, this);
return this.check();
}
invert() {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["invert"](this, this);
return this.check();
}
multiplyLeft(a) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["multiply"](this, a, this);
return this.check();
}
multiplyRight(a) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["multiply"](this, this, a);
return this.check();
}
rotateX(radians) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["rotateX"](this, this, radians);
return this.check();
}
rotateY(radians) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["rotateY"](this, this, radians);
return this.check();
}
rotateZ(radians) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["rotateZ"](this, this, radians);
return this.check();
}
rotateXYZ([rx, ry, rz]) {
return this.rotateX(rx).rotateY(ry).rotateZ(rz);
}
rotateAxis(radians, axis) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["rotate"](this, this, radians, axis);
return this.check();
}
scale(factor) {
if (Array.isArray(factor)) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["scale"](this, this, factor);
} else {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["scale"](this, this, [factor, factor, factor]);
}
return this.check();
}
translate(vec) {
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_3__["translate"](this, this, vec);
return this.check();
}
transform(vector, result) {
if (vector.length === 4) {
result = gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_6__["transformMat4"](result || [-0, -0, -0, -0], vector, this);
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_0__["checkVector"])(result, 4);
return result;
}
return this.transformAsPoint(vector, result);
}
transformAsPoint(vector, result) {
const {
length
} = vector;
switch (length) {
case 2:
result = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_4__["transformMat4"](result || [-0, -0], vector, this);
break;
case 3:
result = gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_5__["transformMat4"](result || [-0, -0, -0], vector, this);
break;
default:
throw new Error('Illegal vector');
}
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_0__["checkVector"])(result, vector.length);
return result;
}
transformAsVector(vector, result) {
switch (vector.length) {
case 2:
result = Object(_lib_gl_matrix_extras__WEBPACK_IMPORTED_MODULE_2__["vec2_transformMat4AsVector"])(result || [-0, -0], vector, this);
break;
case 3:
result = Object(_lib_gl_matrix_extras__WEBPACK_IMPORTED_MODULE_2__["vec3_transformMat4AsVector"])(result || [-0, -0, -0], vector, this);
break;
default:
throw new Error('Illegal vector');
}
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_0__["checkVector"])(result, vector.length);
return result;
}
makeRotationX(radians) {
return this.identity().rotateX(radians);
}
makeTranslation(x, y, z) {
return this.identity().translate([x, y, z]);
}
transformPoint(vector, result) {
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_0__["deprecated"])('Matrix4.transformPoint', '3.0');
return this.transformAsPoint(vector, result);
}
transformVector(vector, result) {
Object(_lib_validators__WEBPACK_IMPORTED_MODULE_0__["deprecated"])('Matrix4.transformVector', '3.0');