@luma.gl/shadertools 9.0.11 → 9.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ luma.gl is provided under the MIT license
2
+
3
+ Copyright (c) 2020 vis.gl contributors
4
+
5
+ This software includes parts initially developed by Uber and open sourced under MIT license.
6
+ Copyright (c) 2015 Uber Technologies, Inc.
7
+
8
+ This software includes parts of PhiloGL (https://github.com/philogb/philogl)
9
+ under MIT license. PhiloGL parts Copyright © 2013 Sencha Labs.
10
+
11
+ This software includes adaptations of some postprocessing code from
12
+ THREE.js (https://github.com/mrdoob/three.js/) under MIT license.
13
+ THREE.js parts Copyright © 2010-2018 three.js authors.
14
+
15
+ Additional attribution given in specific source files.
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in
25
+ all copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
+ THE SOFTWARE.
34
+
package/dist/dist.dev.js CHANGED
@@ -356,6 +356,7 @@ ${inject[key]}` : inject[key];
356
356
  vs: vs6,
357
357
  fs: fs28,
358
358
  dependencies = [],
359
+ uniformTypes = {},
359
360
  uniformPropTypes = {},
360
361
  getUniforms: getUniforms9,
361
362
  deprecations = [],
@@ -371,6 +372,7 @@ ${inject[key]}` : inject[key];
371
372
  this.deprecations = this._parseDeprecationDefinitions(deprecations);
372
373
  this.defines = defines;
373
374
  this.injections = normalizeInjections(inject);
375
+ this.uniformTypes = uniformTypes;
374
376
  if (uniformPropTypes) {
375
377
  this.uniforms = makePropValidators(uniformPropTypes);
376
378
  }
@@ -7845,17 +7847,11 @@ vec3 geometry_getNormal() {
7845
7847
  printRowMajor: true,
7846
7848
  _cartographicRadians: false
7847
7849
  };
7848
- globalThis.mathgl = globalThis.mathgl || {
7849
- config: {
7850
- ...DEFAULT_CONFIG
7851
- }
7852
- };
7850
+ globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
7853
7851
  var config = globalThis.mathgl.config;
7854
- function formatValue(value, {
7855
- precision = config.precision
7856
- } = {}) {
7852
+ function formatValue(value, { precision = config.precision } = {}) {
7857
7853
  value = round(value);
7858
- return "".concat(parseFloat(value.toPrecision(precision)));
7854
+ return `${parseFloat(value.toPrecision(precision))}`;
7859
7855
  }
7860
7856
  function isArray(value) {
7861
7857
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
@@ -7899,28 +7895,12 @@ vec3 geometry_getNormal() {
7899
7895
  }
7900
7896
 
7901
7897
  // ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
7902
- function _extendableBuiltin(cls) {
7903
- function ExtendableBuiltin() {
7904
- var instance = Reflect.construct(cls, Array.from(arguments));
7905
- Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
7906
- return instance;
7907
- }
7908
- ExtendableBuiltin.prototype = Object.create(cls.prototype, {
7909
- constructor: {
7910
- value: cls,
7911
- enumerable: false,
7912
- writable: true,
7913
- configurable: true
7914
- }
7915
- });
7916
- if (Object.setPrototypeOf) {
7917
- Object.setPrototypeOf(ExtendableBuiltin, cls);
7918
- } else {
7919
- ExtendableBuiltin.__proto__ = cls;
7920
- }
7921
- return ExtendableBuiltin;
7922
- }
7923
- var MathArray = class extends _extendableBuiltin(Array) {
7898
+ var MathArray = class extends Array {
7899
+ // Common methods
7900
+ /**
7901
+ * Clone the current object
7902
+ * @returns a new copy of this object
7903
+ */
7924
7904
  clone() {
7925
7905
  return new this.constructor().copy(this);
7926
7906
  }
@@ -7940,7 +7920,10 @@ vec3 geometry_getNormal() {
7940
7920
  return targetObject;
7941
7921
  }
7942
7922
  from(arrayOrObject) {
7943
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
7923
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
7924
+ // @ts-ignore
7925
+ this.fromObject(arrayOrObject)
7926
+ );
7944
7927
  }
7945
7928
  to(arrayOrObject) {
7946
7929
  if (arrayOrObject === this) {
@@ -7951,18 +7934,20 @@ vec3 geometry_getNormal() {
7951
7934
  toTarget(target) {
7952
7935
  return target ? this.to(target) : this;
7953
7936
  }
7937
+ /** @deprecated */
7954
7938
  toFloat32Array() {
7955
7939
  return new Float32Array(this);
7956
7940
  }
7957
7941
  toString() {
7958
7942
  return this.formatString(config);
7959
7943
  }
7944
+ /** Formats string according to options */
7960
7945
  formatString(opts) {
7961
7946
  let string = "";
7962
7947
  for (let i = 0; i < this.ELEMENTS; ++i) {
7963
7948
  string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
7964
7949
  }
7965
- return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
7950
+ return `${opts.printTypes ? this.constructor.name : ""}[${string}]`;
7966
7951
  }
7967
7952
  equals(array) {
7968
7953
  if (!array || this.length !== array.length) {
@@ -7986,6 +7971,8 @@ vec3 geometry_getNormal() {
7986
7971
  }
7987
7972
  return true;
7988
7973
  }
7974
+ // Modifiers
7975
+ /** Negates all values in this object */
7989
7976
  negate() {
7990
7977
  for (let i = 0; i < this.ELEMENTS; ++i) {
7991
7978
  this[i] = -this[i];
@@ -8003,12 +7990,14 @@ vec3 geometry_getNormal() {
8003
7990
  }
8004
7991
  return this.check();
8005
7992
  }
7993
+ /** Minimal */
8006
7994
  min(vector) {
8007
7995
  for (let i = 0; i < this.ELEMENTS; ++i) {
8008
7996
  this[i] = Math.min(vector[i], this[i]);
8009
7997
  }
8010
7998
  return this.check();
8011
7999
  }
8000
+ /** Maximal */
8012
8001
  max(vector) {
8013
8002
  for (let i = 0; i < this.ELEMENTS; ++i) {
8014
8003
  this[i] = Math.max(vector[i], this[i]);
@@ -8049,18 +8038,25 @@ vec3 geometry_getNormal() {
8049
8038
  }
8050
8039
  return this.check();
8051
8040
  }
8041
+ /**
8042
+ * Multiplies all elements by `scale`
8043
+ * Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
8044
+ */
8052
8045
  multiplyByScalar(scalar) {
8053
8046
  for (let i = 0; i < this.ELEMENTS; ++i) {
8054
8047
  this[i] *= scalar;
8055
8048
  }
8056
8049
  return this.check();
8057
8050
  }
8051
+ // Debug checks
8052
+ /** Throws an error if array length is incorrect or contains illegal values */
8058
8053
  check() {
8059
8054
  if (config.debug && !this.validate()) {
8060
- throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
8055
+ throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
8061
8056
  }
8062
8057
  return this;
8063
8058
  }
8059
+ /** Returns false if the array length is incorrect or contains illegal values */
8064
8060
  validate() {
8065
8061
  let valid = this.length === this.ELEMENTS;
8066
8062
  for (let i = 0; i < this.ELEMENTS; ++i) {
@@ -8068,39 +8064,48 @@ vec3 geometry_getNormal() {
8068
8064
  }
8069
8065
  return valid;
8070
8066
  }
8067
+ // three.js compatibility
8068
+ /** @deprecated */
8071
8069
  sub(a) {
8072
8070
  return this.subtract(a);
8073
8071
  }
8072
+ /** @deprecated */
8074
8073
  setScalar(a) {
8075
8074
  for (let i = 0; i < this.ELEMENTS; ++i) {
8076
8075
  this[i] = a;
8077
8076
  }
8078
8077
  return this.check();
8079
8078
  }
8079
+ /** @deprecated */
8080
8080
  addScalar(a) {
8081
8081
  for (let i = 0; i < this.ELEMENTS; ++i) {
8082
8082
  this[i] += a;
8083
8083
  }
8084
8084
  return this.check();
8085
8085
  }
8086
+ /** @deprecated */
8086
8087
  subScalar(a) {
8087
8088
  return this.addScalar(-a);
8088
8089
  }
8090
+ /** @deprecated */
8089
8091
  multiplyScalar(scalar) {
8090
8092
  for (let i = 0; i < this.ELEMENTS; ++i) {
8091
8093
  this[i] *= scalar;
8092
8094
  }
8093
8095
  return this.check();
8094
8096
  }
8097
+ /** @deprecated */
8095
8098
  divideScalar(a) {
8096
8099
  return this.multiplyByScalar(1 / a);
8097
8100
  }
8101
+ /** @deprecated */
8098
8102
  clampScalar(min, max) {
8099
8103
  for (let i = 0; i < this.ELEMENTS; ++i) {
8100
8104
  this[i] = Math.min(Math.max(this[i], min), max);
8101
8105
  }
8102
8106
  return this.check();
8103
8107
  }
8108
+ /** @deprecated */
8104
8109
  get elements() {
8105
8110
  return this;
8106
8111
  }
@@ -8120,13 +8125,13 @@ vec3 geometry_getNormal() {
8120
8125
  }
8121
8126
  function checkNumber(value) {
8122
8127
  if (!Number.isFinite(value)) {
8123
- throw new Error("Invalid number ".concat(JSON.stringify(value)));
8128
+ throw new Error(`Invalid number ${JSON.stringify(value)}`);
8124
8129
  }
8125
8130
  return value;
8126
8131
  }
8127
8132
  function checkVector(v, length, callerName = "") {
8128
8133
  if (config.debug && !validateVector(v, length)) {
8129
- throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
8134
+ throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
8130
8135
  }
8131
8136
  return v;
8132
8137
  }
@@ -8251,19 +8256,29 @@ vec3 geometry_getNormal() {
8251
8256
 
8252
8257
  // ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
8253
8258
  var Matrix = class extends MathArray {
8259
+ // fromObject(object) {
8260
+ // const array = object.elements;
8261
+ // return this.fromRowMajor(array);
8262
+ // }
8263
+ // toObject(object) {
8264
+ // const array = object.elements;
8265
+ // this.toRowMajor(array);
8266
+ // return object;
8267
+ // }
8268
+ // TODO better override formatString?
8254
8269
  toString() {
8255
8270
  let string = "[";
8256
8271
  if (config.printRowMajor) {
8257
8272
  string += "row-major:";
8258
8273
  for (let row = 0; row < this.RANK; ++row) {
8259
8274
  for (let col = 0; col < this.RANK; ++col) {
8260
- string += " ".concat(this[col * this.RANK + row]);
8275
+ string += ` ${this[col * this.RANK + row]}`;
8261
8276
  }
8262
8277
  }
8263
8278
  } else {
8264
8279
  string += "column-major:";
8265
8280
  for (let i = 0; i < this.ELEMENTS; ++i) {
8266
- string += " ".concat(this[i]);
8281
+ string += ` ${this[i]}`;
8267
8282
  }
8268
8283
  }
8269
8284
  string += "]";
@@ -8272,9 +8287,11 @@ vec3 geometry_getNormal() {
8272
8287
  getElementIndex(row, col) {
8273
8288
  return col * this.RANK + row;
8274
8289
  }
8290
+ // By default assumes row major indices
8275
8291
  getElement(row, col) {
8276
8292
  return this[col * this.RANK + row];
8277
8293
  }
8294
+ // By default assumes row major indices
8278
8295
  setElement(row, col, value) {
8279
8296
  this[col * this.RANK + row] = checkNumber(value);
8280
8297
  return this;
@@ -9040,6 +9057,7 @@ vec3 geometry_getNormal() {
9040
9057
  this[15] = array[15];
9041
9058
  return this.check();
9042
9059
  }
9060
+ // eslint-disable-next-line max-params
9043
9061
  set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
9044
9062
  this[0] = m00;
9045
9063
  this[1] = m10;
@@ -9059,6 +9077,8 @@ vec3 geometry_getNormal() {
9059
9077
  this[15] = m33;
9060
9078
  return this.check();
9061
9079
  }
9080
+ // accepts row major order, stores as column major
9081
+ // eslint-disable-next-line max-params
9062
9082
  setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
9063
9083
  this[0] = m00;
9064
9084
  this[1] = m10;
@@ -9097,25 +9117,41 @@ vec3 geometry_getNormal() {
9097
9117
  result[15] = this[15];
9098
9118
  return result;
9099
9119
  }
9120
+ // Constructors
9121
+ /** Set to identity matrix */
9100
9122
  identity() {
9101
9123
  return this.copy(IDENTITY_MATRIX);
9102
9124
  }
9125
+ /**
9126
+ *
9127
+ * @param object
9128
+ * @returns self
9129
+ */
9130
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9103
9131
  fromObject(object) {
9104
9132
  return this.check();
9105
9133
  }
9134
+ /**
9135
+ * Calculates a 4x4 matrix from the given quaternion
9136
+ * @param quaternion Quaternion to create matrix from
9137
+ * @returns self
9138
+ */
9106
9139
  fromQuaternion(quaternion) {
9107
9140
  fromQuat(this, quaternion);
9108
9141
  return this.check();
9109
9142
  }
9143
+ /**
9144
+ * Generates a frustum matrix with the given bounds
9145
+ * @param view.left - Left bound of the frustum
9146
+ * @param view.right - Right bound of the frustum
9147
+ * @param view.bottom - Bottom bound of the frustum
9148
+ * @param view.top - Top bound of the frustum
9149
+ * @param view.near - Near bound of the frustum
9150
+ * @param view.far - Far bound of the frustum. Can be set to Infinity.
9151
+ * @returns self
9152
+ */
9110
9153
  frustum(view) {
9111
- const {
9112
- left,
9113
- right,
9114
- bottom,
9115
- top,
9116
- near = DEFAULT_NEAR,
9117
- far = DEFAULT_FAR
9118
- } = view;
9154
+ const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
9119
9155
  if (far === Infinity) {
9120
9156
  computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
9121
9157
  } else {
@@ -9123,35 +9159,47 @@ vec3 geometry_getNormal() {
9123
9159
  }
9124
9160
  return this.check();
9125
9161
  }
9162
+ /**
9163
+ * Generates a look-at matrix with the given eye position, focal point,
9164
+ * and up axis
9165
+ * @param view.eye - (vector) Position of the viewer
9166
+ * @param view.center - (vector) Point the viewer is looking at
9167
+ * @param view.up - (vector) Up axis
9168
+ * @returns self
9169
+ */
9126
9170
  lookAt(view) {
9127
- const {
9128
- eye,
9129
- center = [0, 0, 0],
9130
- up = [0, 1, 0]
9131
- } = view;
9171
+ const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
9132
9172
  lookAt(this, eye, center, up);
9133
9173
  return this.check();
9134
9174
  }
9175
+ /**
9176
+ * Generates a orthogonal projection matrix with the given bounds
9177
+ * from "traditional" view space parameters
9178
+ * @param view.left - Left bound of the frustum
9179
+ * @param view.right number Right bound of the frustum
9180
+ * @param view.bottom - Bottom bound of the frustum
9181
+ * @param view.top number Top bound of the frustum
9182
+ * @param view.near - Near bound of the frustum
9183
+ * @param view.far number Far bound of the frustum
9184
+ * @returns self
9185
+ */
9135
9186
  ortho(view) {
9136
- const {
9137
- left,
9138
- right,
9139
- bottom,
9140
- top,
9141
- near = DEFAULT_NEAR,
9142
- far = DEFAULT_FAR
9143
- } = view;
9187
+ const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
9144
9188
  ortho(this, left, right, bottom, top, near, far);
9145
9189
  return this.check();
9146
9190
  }
9191
+ /**
9192
+ * Generates an orthogonal projection matrix with the same parameters
9193
+ * as a perspective matrix (plus focalDistance)
9194
+ * @param view.fovy Vertical field of view in radians
9195
+ * @param view.aspect Aspect ratio. Typically viewport width / viewport height
9196
+ * @param view.focalDistance Distance in the view frustum used for extent calculations
9197
+ * @param view.near Near bound of the frustum
9198
+ * @param view.far Far bound of the frustum
9199
+ * @returns self
9200
+ */
9147
9201
  orthographic(view) {
9148
- const {
9149
- fovy = DEFAULT_FOVY,
9150
- aspect = DEFAULT_ASPECT,
9151
- focalDistance = 1,
9152
- near = DEFAULT_NEAR,
9153
- far = DEFAULT_FAR
9154
- } = view;
9202
+ const { fovy = DEFAULT_FOVY, aspect = DEFAULT_ASPECT, focalDistance = 1, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
9155
9203
  checkRadians(fovy);
9156
9204
  const halfY = fovy / 2;
9157
9205
  const top = focalDistance * Math.tan(halfY);
@@ -9165,32 +9213,53 @@ vec3 geometry_getNormal() {
9165
9213
  far
9166
9214
  });
9167
9215
  }
9216
+ /**
9217
+ * Generates a perspective projection matrix with the given bounds
9218
+ * @param view.fovy Vertical field of view in radians
9219
+ * @param view.aspect Aspect ratio. typically viewport width/height
9220
+ * @param view.near Near bound of the frustum
9221
+ * @param view.far Far bound of the frustum
9222
+ * @returns self
9223
+ */
9168
9224
  perspective(view) {
9169
- const {
9170
- fovy = 45 * Math.PI / 180,
9171
- aspect = 1,
9172
- near = 0.1,
9173
- far = 500
9174
- } = view;
9225
+ const { fovy = 45 * Math.PI / 180, aspect = 1, near = 0.1, far = 500 } = view;
9175
9226
  checkRadians(fovy);
9176
9227
  perspective(this, fovy, aspect, near, far);
9177
9228
  return this.check();
9178
9229
  }
9230
+ // Accessors
9179
9231
  determinant() {
9180
9232
  return determinant(this);
9181
9233
  }
9234
+ /**
9235
+ * Extracts the non-uniform scale assuming the matrix is an affine transformation.
9236
+ * The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
9237
+ * @param result
9238
+ * @returns self
9239
+ */
9182
9240
  getScale(result = [-0, -0, -0]) {
9183
9241
  result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
9184
9242
  result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
9185
9243
  result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
9186
9244
  return result;
9187
9245
  }
9246
+ /**
9247
+ * Gets the translation portion, assuming the matrix is a affine transformation matrix.
9248
+ * @param result
9249
+ * @returns self
9250
+ */
9188
9251
  getTranslation(result = [-0, -0, -0]) {
9189
9252
  result[0] = this[12];
9190
9253
  result[1] = this[13];
9191
9254
  result[2] = this[14];
9192
9255
  return result;
9193
9256
  }
9257
+ /**
9258
+ * Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
9259
+ * @param result
9260
+ * @param scaleResult
9261
+ * @returns self
9262
+ */
9194
9263
  getRotation(result, scaleResult) {
9195
9264
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
9196
9265
  scaleResult = scaleResult || [-0, -0, -0];
@@ -9216,6 +9285,12 @@ vec3 geometry_getNormal() {
9216
9285
  result[15] = 1;
9217
9286
  return result;
9218
9287
  }
9288
+ /**
9289
+ *
9290
+ * @param result
9291
+ * @param scaleResult
9292
+ * @returns self
9293
+ */
9219
9294
  getRotationMatrix3(result, scaleResult) {
9220
9295
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
9221
9296
  scaleResult = scaleResult || [-0, -0, -0];
@@ -9234,6 +9309,7 @@ vec3 geometry_getNormal() {
9234
9309
  result[8] = this[10] * inverseScale2;
9235
9310
  return result;
9236
9311
  }
9312
+ // Modifiers
9237
9313
  transpose() {
9238
9314
  transpose(this, this);
9239
9315
  return this.check();
@@ -9242,6 +9318,7 @@ vec3 geometry_getNormal() {
9242
9318
  invert(this, this);
9243
9319
  return this.check();
9244
9320
  }
9321
+ // Operations
9245
9322
  multiplyLeft(a) {
9246
9323
  multiply(this, a, this);
9247
9324
  return this.check();
@@ -9250,33 +9327,68 @@ vec3 geometry_getNormal() {
9250
9327
  multiply(this, this, a);
9251
9328
  return this.check();
9252
9329
  }
9330
+ // Rotates a matrix by the given angle around the X axis
9253
9331
  rotateX(radians) {
9254
9332
  rotateX(this, this, radians);
9255
9333
  return this.check();
9256
9334
  }
9335
+ // Rotates a matrix by the given angle around the Y axis.
9257
9336
  rotateY(radians) {
9258
9337
  rotateY(this, this, radians);
9259
9338
  return this.check();
9260
9339
  }
9340
+ /**
9341
+ * Rotates a matrix by the given angle around the Z axis.
9342
+ * @param radians
9343
+ * @returns self
9344
+ */
9261
9345
  rotateZ(radians) {
9262
9346
  rotateZ(this, this, radians);
9263
9347
  return this.check();
9264
9348
  }
9349
+ /**
9350
+ *
9351
+ * @param param0
9352
+ * @returns self
9353
+ */
9265
9354
  rotateXYZ(angleXYZ) {
9266
9355
  return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
9267
9356
  }
9357
+ /**
9358
+ *
9359
+ * @param radians
9360
+ * @param axis
9361
+ * @returns self
9362
+ */
9268
9363
  rotateAxis(radians, axis) {
9269
9364
  rotate(this, this, radians, axis);
9270
9365
  return this.check();
9271
9366
  }
9367
+ /**
9368
+ *
9369
+ * @param factor
9370
+ * @returns self
9371
+ */
9272
9372
  scale(factor) {
9273
9373
  scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
9274
9374
  return this.check();
9275
9375
  }
9376
+ /**
9377
+ *
9378
+ * @param vec
9379
+ * @returns self
9380
+ */
9276
9381
  translate(vector) {
9277
9382
  translate(this, this, vector);
9278
9383
  return this.check();
9279
9384
  }
9385
+ // Transforms
9386
+ /**
9387
+ * Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
9388
+ * @param vector
9389
+ * @param result
9390
+ * @returns self
9391
+ */
9280
9392
  transform(vector, result) {
9281
9393
  if (vector.length === 4) {
9282
9394
  result = transformMat43(result || [-0, -0, -0, -0], vector, this);
@@ -9285,10 +9397,14 @@ vec3 geometry_getNormal() {
9285
9397
  }
9286
9398
  return this.transformAsPoint(vector, result);
9287
9399
  }
9400
+ /**
9401
+ * Transforms any 2 or 3 element array as point (w implicitly 1)
9402
+ * @param vector
9403
+ * @param result
9404
+ * @returns self
9405
+ */
9288
9406
  transformAsPoint(vector, result) {
9289
- const {
9290
- length
9291
- } = vector;
9407
+ const { length } = vector;
9292
9408
  let out;
9293
9409
  switch (length) {
9294
9410
  case 2:
@@ -9303,6 +9419,12 @@ vec3 geometry_getNormal() {
9303
9419
  checkVector(out, vector.length);
9304
9420
  return out;
9305
9421
  }
9422
+ /**
9423
+ * Transforms any 2 or 3 element array as vector (w implicitly 0)
9424
+ * @param vector
9425
+ * @param result
9426
+ * @returns self
9427
+ */
9306
9428
  transformAsVector(vector, result) {
9307
9429
  let out;
9308
9430
  switch (vector.length) {
@@ -9318,15 +9440,19 @@ vec3 geometry_getNormal() {
9318
9440
  checkVector(out, vector.length);
9319
9441
  return out;
9320
9442
  }
9443
+ /** @deprecated */
9321
9444
  transformPoint(vector, result) {
9322
9445
  return this.transformAsPoint(vector, result);
9323
9446
  }
9447
+ /** @deprecated */
9324
9448
  transformVector(vector, result) {
9325
9449
  return this.transformAsPoint(vector, result);
9326
9450
  }
9451
+ /** @deprecated */
9327
9452
  transformDirection(vector, result) {
9328
9453
  return this.transformAsVector(vector, result);
9329
9454
  }
9455
+ // three.js math API compatibility
9330
9456
  makeRotationX(radians) {
9331
9457
  return this.identity().rotateX(radians);
9332
9458
  }