@luma.gl/shadertools 9.0.9 → 9.0.10

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/dist/dist.dev.js CHANGED
@@ -7845,11 +7845,17 @@ vec3 geometry_getNormal() {
7845
7845
  printRowMajor: true,
7846
7846
  _cartographicRadians: false
7847
7847
  };
7848
- globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
7848
+ globalThis.mathgl = globalThis.mathgl || {
7849
+ config: {
7850
+ ...DEFAULT_CONFIG
7851
+ }
7852
+ };
7849
7853
  var config = globalThis.mathgl.config;
7850
- function formatValue(value, { precision = config.precision } = {}) {
7854
+ function formatValue(value, {
7855
+ precision = config.precision
7856
+ } = {}) {
7851
7857
  value = round(value);
7852
- return `${parseFloat(value.toPrecision(precision))}`;
7858
+ return "".concat(parseFloat(value.toPrecision(precision)));
7853
7859
  }
7854
7860
  function isArray(value) {
7855
7861
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
@@ -7893,12 +7899,28 @@ vec3 geometry_getNormal() {
7893
7899
  }
7894
7900
 
7895
7901
  // ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
7896
- var MathArray = class extends Array {
7897
- // Common methods
7898
- /**
7899
- * Clone the current object
7900
- * @returns a new copy of this object
7901
- */
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) {
7902
7924
  clone() {
7903
7925
  return new this.constructor().copy(this);
7904
7926
  }
@@ -7918,10 +7940,7 @@ vec3 geometry_getNormal() {
7918
7940
  return targetObject;
7919
7941
  }
7920
7942
  from(arrayOrObject) {
7921
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
7922
- // @ts-ignore
7923
- this.fromObject(arrayOrObject)
7924
- );
7943
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
7925
7944
  }
7926
7945
  to(arrayOrObject) {
7927
7946
  if (arrayOrObject === this) {
@@ -7932,20 +7951,18 @@ vec3 geometry_getNormal() {
7932
7951
  toTarget(target) {
7933
7952
  return target ? this.to(target) : this;
7934
7953
  }
7935
- /** @deprecated */
7936
7954
  toFloat32Array() {
7937
7955
  return new Float32Array(this);
7938
7956
  }
7939
7957
  toString() {
7940
7958
  return this.formatString(config);
7941
7959
  }
7942
- /** Formats string according to options */
7943
7960
  formatString(opts) {
7944
7961
  let string = "";
7945
7962
  for (let i = 0; i < this.ELEMENTS; ++i) {
7946
7963
  string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
7947
7964
  }
7948
- return `${opts.printTypes ? this.constructor.name : ""}[${string}]`;
7965
+ return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
7949
7966
  }
7950
7967
  equals(array) {
7951
7968
  if (!array || this.length !== array.length) {
@@ -7969,8 +7986,6 @@ vec3 geometry_getNormal() {
7969
7986
  }
7970
7987
  return true;
7971
7988
  }
7972
- // Modifiers
7973
- /** Negates all values in this object */
7974
7989
  negate() {
7975
7990
  for (let i = 0; i < this.ELEMENTS; ++i) {
7976
7991
  this[i] = -this[i];
@@ -7988,14 +8003,12 @@ vec3 geometry_getNormal() {
7988
8003
  }
7989
8004
  return this.check();
7990
8005
  }
7991
- /** Minimal */
7992
8006
  min(vector) {
7993
8007
  for (let i = 0; i < this.ELEMENTS; ++i) {
7994
8008
  this[i] = Math.min(vector[i], this[i]);
7995
8009
  }
7996
8010
  return this.check();
7997
8011
  }
7998
- /** Maximal */
7999
8012
  max(vector) {
8000
8013
  for (let i = 0; i < this.ELEMENTS; ++i) {
8001
8014
  this[i] = Math.max(vector[i], this[i]);
@@ -8036,25 +8049,18 @@ vec3 geometry_getNormal() {
8036
8049
  }
8037
8050
  return this.check();
8038
8051
  }
8039
- /**
8040
- * Multiplies all elements by `scale`
8041
- * Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
8042
- */
8043
8052
  multiplyByScalar(scalar) {
8044
8053
  for (let i = 0; i < this.ELEMENTS; ++i) {
8045
8054
  this[i] *= scalar;
8046
8055
  }
8047
8056
  return this.check();
8048
8057
  }
8049
- // Debug checks
8050
- /** Throws an error if array length is incorrect or contains illegal values */
8051
8058
  check() {
8052
8059
  if (config.debug && !this.validate()) {
8053
- throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
8060
+ throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
8054
8061
  }
8055
8062
  return this;
8056
8063
  }
8057
- /** Returns false if the array length is incorrect or contains illegal values */
8058
8064
  validate() {
8059
8065
  let valid = this.length === this.ELEMENTS;
8060
8066
  for (let i = 0; i < this.ELEMENTS; ++i) {
@@ -8062,48 +8068,39 @@ vec3 geometry_getNormal() {
8062
8068
  }
8063
8069
  return valid;
8064
8070
  }
8065
- // three.js compatibility
8066
- /** @deprecated */
8067
8071
  sub(a) {
8068
8072
  return this.subtract(a);
8069
8073
  }
8070
- /** @deprecated */
8071
8074
  setScalar(a) {
8072
8075
  for (let i = 0; i < this.ELEMENTS; ++i) {
8073
8076
  this[i] = a;
8074
8077
  }
8075
8078
  return this.check();
8076
8079
  }
8077
- /** @deprecated */
8078
8080
  addScalar(a) {
8079
8081
  for (let i = 0; i < this.ELEMENTS; ++i) {
8080
8082
  this[i] += a;
8081
8083
  }
8082
8084
  return this.check();
8083
8085
  }
8084
- /** @deprecated */
8085
8086
  subScalar(a) {
8086
8087
  return this.addScalar(-a);
8087
8088
  }
8088
- /** @deprecated */
8089
8089
  multiplyScalar(scalar) {
8090
8090
  for (let i = 0; i < this.ELEMENTS; ++i) {
8091
8091
  this[i] *= scalar;
8092
8092
  }
8093
8093
  return this.check();
8094
8094
  }
8095
- /** @deprecated */
8096
8095
  divideScalar(a) {
8097
8096
  return this.multiplyByScalar(1 / a);
8098
8097
  }
8099
- /** @deprecated */
8100
8098
  clampScalar(min, max) {
8101
8099
  for (let i = 0; i < this.ELEMENTS; ++i) {
8102
8100
  this[i] = Math.min(Math.max(this[i], min), max);
8103
8101
  }
8104
8102
  return this.check();
8105
8103
  }
8106
- /** @deprecated */
8107
8104
  get elements() {
8108
8105
  return this;
8109
8106
  }
@@ -8123,13 +8120,13 @@ vec3 geometry_getNormal() {
8123
8120
  }
8124
8121
  function checkNumber(value) {
8125
8122
  if (!Number.isFinite(value)) {
8126
- throw new Error(`Invalid number ${JSON.stringify(value)}`);
8123
+ throw new Error("Invalid number ".concat(JSON.stringify(value)));
8127
8124
  }
8128
8125
  return value;
8129
8126
  }
8130
8127
  function checkVector(v, length, callerName = "") {
8131
8128
  if (config.debug && !validateVector(v, length)) {
8132
- throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
8129
+ throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
8133
8130
  }
8134
8131
  return v;
8135
8132
  }
@@ -8254,29 +8251,19 @@ vec3 geometry_getNormal() {
8254
8251
 
8255
8252
  // ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
8256
8253
  var Matrix = class extends MathArray {
8257
- // fromObject(object) {
8258
- // const array = object.elements;
8259
- // return this.fromRowMajor(array);
8260
- // }
8261
- // toObject(object) {
8262
- // const array = object.elements;
8263
- // this.toRowMajor(array);
8264
- // return object;
8265
- // }
8266
- // TODO better override formatString?
8267
8254
  toString() {
8268
8255
  let string = "[";
8269
8256
  if (config.printRowMajor) {
8270
8257
  string += "row-major:";
8271
8258
  for (let row = 0; row < this.RANK; ++row) {
8272
8259
  for (let col = 0; col < this.RANK; ++col) {
8273
- string += ` ${this[col * this.RANK + row]}`;
8260
+ string += " ".concat(this[col * this.RANK + row]);
8274
8261
  }
8275
8262
  }
8276
8263
  } else {
8277
8264
  string += "column-major:";
8278
8265
  for (let i = 0; i < this.ELEMENTS; ++i) {
8279
- string += ` ${this[i]}`;
8266
+ string += " ".concat(this[i]);
8280
8267
  }
8281
8268
  }
8282
8269
  string += "]";
@@ -8285,11 +8272,9 @@ vec3 geometry_getNormal() {
8285
8272
  getElementIndex(row, col) {
8286
8273
  return col * this.RANK + row;
8287
8274
  }
8288
- // By default assumes row major indices
8289
8275
  getElement(row, col) {
8290
8276
  return this[col * this.RANK + row];
8291
8277
  }
8292
- // By default assumes row major indices
8293
8278
  setElement(row, col, value) {
8294
8279
  this[col * this.RANK + row] = checkNumber(value);
8295
8280
  return this;
@@ -9055,7 +9040,6 @@ vec3 geometry_getNormal() {
9055
9040
  this[15] = array[15];
9056
9041
  return this.check();
9057
9042
  }
9058
- // eslint-disable-next-line max-params
9059
9043
  set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
9060
9044
  this[0] = m00;
9061
9045
  this[1] = m10;
@@ -9075,8 +9059,6 @@ vec3 geometry_getNormal() {
9075
9059
  this[15] = m33;
9076
9060
  return this.check();
9077
9061
  }
9078
- // accepts row major order, stores as column major
9079
- // eslint-disable-next-line max-params
9080
9062
  setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
9081
9063
  this[0] = m00;
9082
9064
  this[1] = m10;
@@ -9115,41 +9097,25 @@ vec3 geometry_getNormal() {
9115
9097
  result[15] = this[15];
9116
9098
  return result;
9117
9099
  }
9118
- // Constructors
9119
- /** Set to identity matrix */
9120
9100
  identity() {
9121
9101
  return this.copy(IDENTITY_MATRIX);
9122
9102
  }
9123
- /**
9124
- *
9125
- * @param object
9126
- * @returns self
9127
- */
9128
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
9129
9103
  fromObject(object) {
9130
9104
  return this.check();
9131
9105
  }
9132
- /**
9133
- * Calculates a 4x4 matrix from the given quaternion
9134
- * @param quaternion Quaternion to create matrix from
9135
- * @returns self
9136
- */
9137
9106
  fromQuaternion(quaternion) {
9138
9107
  fromQuat(this, quaternion);
9139
9108
  return this.check();
9140
9109
  }
9141
- /**
9142
- * Generates a frustum matrix with the given bounds
9143
- * @param view.left - Left bound of the frustum
9144
- * @param view.right - Right bound of the frustum
9145
- * @param view.bottom - Bottom bound of the frustum
9146
- * @param view.top - Top bound of the frustum
9147
- * @param view.near - Near bound of the frustum
9148
- * @param view.far - Far bound of the frustum. Can be set to Infinity.
9149
- * @returns self
9150
- */
9151
9110
  frustum(view) {
9152
- const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
9111
+ const {
9112
+ left,
9113
+ right,
9114
+ bottom,
9115
+ top,
9116
+ near = DEFAULT_NEAR,
9117
+ far = DEFAULT_FAR
9118
+ } = view;
9153
9119
  if (far === Infinity) {
9154
9120
  computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
9155
9121
  } else {
@@ -9157,47 +9123,35 @@ vec3 geometry_getNormal() {
9157
9123
  }
9158
9124
  return this.check();
9159
9125
  }
9160
- /**
9161
- * Generates a look-at matrix with the given eye position, focal point,
9162
- * and up axis
9163
- * @param view.eye - (vector) Position of the viewer
9164
- * @param view.center - (vector) Point the viewer is looking at
9165
- * @param view.up - (vector) Up axis
9166
- * @returns self
9167
- */
9168
9126
  lookAt(view) {
9169
- const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
9127
+ const {
9128
+ eye,
9129
+ center = [0, 0, 0],
9130
+ up = [0, 1, 0]
9131
+ } = view;
9170
9132
  lookAt(this, eye, center, up);
9171
9133
  return this.check();
9172
9134
  }
9173
- /**
9174
- * Generates a orthogonal projection matrix with the given bounds
9175
- * from "traditional" view space parameters
9176
- * @param view.left - Left bound of the frustum
9177
- * @param view.right number Right bound of the frustum
9178
- * @param view.bottom - Bottom bound of the frustum
9179
- * @param view.top number Top bound of the frustum
9180
- * @param view.near - Near bound of the frustum
9181
- * @param view.far number Far bound of the frustum
9182
- * @returns self
9183
- */
9184
9135
  ortho(view) {
9185
- const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
9136
+ const {
9137
+ left,
9138
+ right,
9139
+ bottom,
9140
+ top,
9141
+ near = DEFAULT_NEAR,
9142
+ far = DEFAULT_FAR
9143
+ } = view;
9186
9144
  ortho(this, left, right, bottom, top, near, far);
9187
9145
  return this.check();
9188
9146
  }
9189
- /**
9190
- * Generates an orthogonal projection matrix with the same parameters
9191
- * as a perspective matrix (plus focalDistance)
9192
- * @param view.fovy Vertical field of view in radians
9193
- * @param view.aspect Aspect ratio. Typically viewport width / viewport height
9194
- * @param view.focalDistance Distance in the view frustum used for extent calculations
9195
- * @param view.near Near bound of the frustum
9196
- * @param view.far Far bound of the frustum
9197
- * @returns self
9198
- */
9199
9147
  orthographic(view) {
9200
- const { fovy = DEFAULT_FOVY, aspect = DEFAULT_ASPECT, focalDistance = 1, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
9148
+ const {
9149
+ fovy = DEFAULT_FOVY,
9150
+ aspect = DEFAULT_ASPECT,
9151
+ focalDistance = 1,
9152
+ near = DEFAULT_NEAR,
9153
+ far = DEFAULT_FAR
9154
+ } = view;
9201
9155
  checkRadians(fovy);
9202
9156
  const halfY = fovy / 2;
9203
9157
  const top = focalDistance * Math.tan(halfY);
@@ -9211,53 +9165,32 @@ vec3 geometry_getNormal() {
9211
9165
  far
9212
9166
  });
9213
9167
  }
9214
- /**
9215
- * Generates a perspective projection matrix with the given bounds
9216
- * @param view.fovy Vertical field of view in radians
9217
- * @param view.aspect Aspect ratio. typically viewport width/height
9218
- * @param view.near Near bound of the frustum
9219
- * @param view.far Far bound of the frustum
9220
- * @returns self
9221
- */
9222
9168
  perspective(view) {
9223
- const { fovy = 45 * Math.PI / 180, aspect = 1, near = 0.1, far = 500 } = view;
9169
+ const {
9170
+ fovy = 45 * Math.PI / 180,
9171
+ aspect = 1,
9172
+ near = 0.1,
9173
+ far = 500
9174
+ } = view;
9224
9175
  checkRadians(fovy);
9225
9176
  perspective(this, fovy, aspect, near, far);
9226
9177
  return this.check();
9227
9178
  }
9228
- // Accessors
9229
9179
  determinant() {
9230
9180
  return determinant(this);
9231
9181
  }
9232
- /**
9233
- * Extracts the non-uniform scale assuming the matrix is an affine transformation.
9234
- * The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
9235
- * @param result
9236
- * @returns self
9237
- */
9238
9182
  getScale(result = [-0, -0, -0]) {
9239
9183
  result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
9240
9184
  result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
9241
9185
  result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
9242
9186
  return result;
9243
9187
  }
9244
- /**
9245
- * Gets the translation portion, assuming the matrix is a affine transformation matrix.
9246
- * @param result
9247
- * @returns self
9248
- */
9249
9188
  getTranslation(result = [-0, -0, -0]) {
9250
9189
  result[0] = this[12];
9251
9190
  result[1] = this[13];
9252
9191
  result[2] = this[14];
9253
9192
  return result;
9254
9193
  }
9255
- /**
9256
- * Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
9257
- * @param result
9258
- * @param scaleResult
9259
- * @returns self
9260
- */
9261
9194
  getRotation(result, scaleResult) {
9262
9195
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
9263
9196
  scaleResult = scaleResult || [-0, -0, -0];
@@ -9283,12 +9216,6 @@ vec3 geometry_getNormal() {
9283
9216
  result[15] = 1;
9284
9217
  return result;
9285
9218
  }
9286
- /**
9287
- *
9288
- * @param result
9289
- * @param scaleResult
9290
- * @returns self
9291
- */
9292
9219
  getRotationMatrix3(result, scaleResult) {
9293
9220
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
9294
9221
  scaleResult = scaleResult || [-0, -0, -0];
@@ -9307,7 +9234,6 @@ vec3 geometry_getNormal() {
9307
9234
  result[8] = this[10] * inverseScale2;
9308
9235
  return result;
9309
9236
  }
9310
- // Modifiers
9311
9237
  transpose() {
9312
9238
  transpose(this, this);
9313
9239
  return this.check();
@@ -9316,7 +9242,6 @@ vec3 geometry_getNormal() {
9316
9242
  invert(this, this);
9317
9243
  return this.check();
9318
9244
  }
9319
- // Operations
9320
9245
  multiplyLeft(a) {
9321
9246
  multiply(this, a, this);
9322
9247
  return this.check();
@@ -9325,68 +9250,33 @@ vec3 geometry_getNormal() {
9325
9250
  multiply(this, this, a);
9326
9251
  return this.check();
9327
9252
  }
9328
- // Rotates a matrix by the given angle around the X axis
9329
9253
  rotateX(radians) {
9330
9254
  rotateX(this, this, radians);
9331
9255
  return this.check();
9332
9256
  }
9333
- // Rotates a matrix by the given angle around the Y axis.
9334
9257
  rotateY(radians) {
9335
9258
  rotateY(this, this, radians);
9336
9259
  return this.check();
9337
9260
  }
9338
- /**
9339
- * Rotates a matrix by the given angle around the Z axis.
9340
- * @param radians
9341
- * @returns self
9342
- */
9343
9261
  rotateZ(radians) {
9344
9262
  rotateZ(this, this, radians);
9345
9263
  return this.check();
9346
9264
  }
9347
- /**
9348
- *
9349
- * @param param0
9350
- * @returns self
9351
- */
9352
9265
  rotateXYZ(angleXYZ) {
9353
9266
  return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
9354
9267
  }
9355
- /**
9356
- *
9357
- * @param radians
9358
- * @param axis
9359
- * @returns self
9360
- */
9361
9268
  rotateAxis(radians, axis) {
9362
9269
  rotate(this, this, radians, axis);
9363
9270
  return this.check();
9364
9271
  }
9365
- /**
9366
- *
9367
- * @param factor
9368
- * @returns self
9369
- */
9370
9272
  scale(factor) {
9371
9273
  scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
9372
9274
  return this.check();
9373
9275
  }
9374
- /**
9375
- *
9376
- * @param vec
9377
- * @returns self
9378
- */
9379
9276
  translate(vector) {
9380
9277
  translate(this, this, vector);
9381
9278
  return this.check();
9382
9279
  }
9383
- // Transforms
9384
- /**
9385
- * Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
9386
- * @param vector
9387
- * @param result
9388
- * @returns self
9389
- */
9390
9280
  transform(vector, result) {
9391
9281
  if (vector.length === 4) {
9392
9282
  result = transformMat43(result || [-0, -0, -0, -0], vector, this);
@@ -9395,14 +9285,10 @@ vec3 geometry_getNormal() {
9395
9285
  }
9396
9286
  return this.transformAsPoint(vector, result);
9397
9287
  }
9398
- /**
9399
- * Transforms any 2 or 3 element array as point (w implicitly 1)
9400
- * @param vector
9401
- * @param result
9402
- * @returns self
9403
- */
9404
9288
  transformAsPoint(vector, result) {
9405
- const { length } = vector;
9289
+ const {
9290
+ length
9291
+ } = vector;
9406
9292
  let out;
9407
9293
  switch (length) {
9408
9294
  case 2:
@@ -9417,12 +9303,6 @@ vec3 geometry_getNormal() {
9417
9303
  checkVector(out, vector.length);
9418
9304
  return out;
9419
9305
  }
9420
- /**
9421
- * Transforms any 2 or 3 element array as vector (w implicitly 0)
9422
- * @param vector
9423
- * @param result
9424
- * @returns self
9425
- */
9426
9306
  transformAsVector(vector, result) {
9427
9307
  let out;
9428
9308
  switch (vector.length) {
@@ -9438,19 +9318,15 @@ vec3 geometry_getNormal() {
9438
9318
  checkVector(out, vector.length);
9439
9319
  return out;
9440
9320
  }
9441
- /** @deprecated */
9442
9321
  transformPoint(vector, result) {
9443
9322
  return this.transformAsPoint(vector, result);
9444
9323
  }
9445
- /** @deprecated */
9446
9324
  transformVector(vector, result) {
9447
9325
  return this.transformAsPoint(vector, result);
9448
9326
  }
9449
- /** @deprecated */
9450
9327
  transformDirection(vector, result) {
9451
9328
  return this.transformAsVector(vector, result);
9452
9329
  }
9453
- // three.js math API compatibility
9454
9330
  makeRotationX(radians) {
9455
9331
  return this.identity().rotateX(radians);
9456
9332
  }
package/dist/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var jn=Object.create;var ue=Object.defineProperty;var $n=Object.getOwnPropertyDescriptor;var Kn=Object.getOwnPropertyNames;var Zn=Object.getPrototypeOf,Jn=Object.prototype.hasOwnProperty;var eo=(t,e,r)=>e in t?ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var to=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ro=(t,e)=>{for(var r in e)ue(t,r,{get:e[r],enumerable:!0})},ve=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Kn(e))!Jn.call(t,o)&&o!==r&&ue(t,o,{get:()=>e[o],enumerable:!(n=$n(e,o))||n.enumerable});return t},Ae=(t,e,r)=>(ve(t,e,"default"),r&&ve(r,e,"default")),or=(t,e,r)=>(r=t!=null?jn(Zn(t)):{},ve(e||!t||!t.__esModule?ue(r,"default",{value:t,enumerable:!0}):r,t)),no=t=>ve(ue({},"__esModule",{value:!0}),t);var ir=(t,e,r)=>(eo(t,typeof e!="symbol"?e+"":e,r),r);var $e=to((Ri,sr)=>{sr.exports=globalThis.luma});var xe={};ro(xe,{ShaderAssembler:()=>pe,ShaderModuleInstance:()=>C,_ShaderModuleInstance:()=>C,_getDependencyGraph:()=>be,_resolveModules:()=>re,_warp:()=>ce,assembleShaderPairGLSL:()=>Pe,brightnessContrast:()=>Gr,bulgePinch:()=>ln,capitalize:()=>K,colorHalftone:()=>rn,combineInjects:()=>mr,convertToVec4:()=>it,denoise:()=>Hr,dirlight:()=>Qt,dirlight1:()=>Qn,dotScreen:()=>nn,edgeWork:()=>on,fp32:()=>Ur,fp64:()=>pn,fp64arithmetic:()=>Ht,fxaa:()=>un,generateShaderForModule:()=>Ir,geometry1:()=>dn,getPassthroughFS:()=>Nr,getQualifierDetails:()=>kr,getShaderInfo:()=>ye,getShaderLayoutFromWGSL:()=>Or,glsl:()=>ar,gouraudLighting:()=>Vn,gouraudMaterial:()=>Bt,hexagonalPixelate:()=>sn,hueSaturation:()=>Wr,ink:()=>an,lighting:()=>Q,lights1:()=>te,magnify:()=>cn,noise:()=>jr,normalizeShaderModule:()=>Sr,pbr:()=>Wn,pbrMaterial:()=>qr,phongLighting:()=>qn,phongMaterial:()=>Vt,picking:()=>zr,project1:()=>je,random:()=>B,sepia:()=>$r,swirl:()=>fn,tiltShift:()=>Jr,triangleBlur:()=>en,typeToChannelCount:()=>Tr,typeToChannelSuffix:()=>Er,vibrance:()=>Kr,vignette:()=>Zr,zoomBlur:()=>tn});Ae(xe,or($e(),1));var ar=t=>`${t}`;function z(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var Ke={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function lr(t){let e={};for(let[r,n]of Object.entries(t))e[r]=oo(n);return e}function fr(t,e,r){let n={};for(let[o,i]of Object.entries(e))t&&o in t&&!i.private?(i.validate&&z(i.validate(t[o],i),`${r}: invalid ${o}`),n[o]=t[o]):n[o]=i.value;return n}function oo(t){let e=cr(t);if(e!=="object")return{value:t,...Ke[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...Ke[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=cr(t.value),{...t,...Ke[e],type:e}):{type:"object",value:null};throw new Error("props")}function cr(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var ur=`#ifdef MODULE_LOGDEPTH
7
+ "use strict";var __exports__=(()=>{var jn=Object.create;var ue=Object.defineProperty;var $n=Object.getOwnPropertyDescriptor;var Kn=Object.getOwnPropertyNames;var Zn=Object.getPrototypeOf,Jn=Object.prototype.hasOwnProperty;var eo=(t,e,r)=>e in t?ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var to=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ro=(t,e)=>{for(var r in e)ue(t,r,{get:e[r],enumerable:!0})},ve=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Kn(e))!Jn.call(t,o)&&o!==r&&ue(t,o,{get:()=>e[o],enumerable:!(n=$n(e,o))||n.enumerable});return t},Ae=(t,e,r)=>(ve(t,e,"default"),r&&ve(r,e,"default")),or=(t,e,r)=>(r=t!=null?jn(Zn(t)):{},ve(e||!t||!t.__esModule?ue(r,"default",{value:t,enumerable:!0}):r,t)),no=t=>ve(ue({},"__esModule",{value:!0}),t);var ir=(t,e,r)=>(eo(t,typeof e!="symbol"?e+"":e,r),r);var $e=to((Oi,sr)=>{sr.exports=globalThis.luma});var xe={};ro(xe,{ShaderAssembler:()=>pe,ShaderModuleInstance:()=>C,_ShaderModuleInstance:()=>C,_getDependencyGraph:()=>be,_resolveModules:()=>re,_warp:()=>ce,assembleShaderPairGLSL:()=>Pe,brightnessContrast:()=>Gr,bulgePinch:()=>ln,capitalize:()=>K,colorHalftone:()=>rn,combineInjects:()=>mr,convertToVec4:()=>it,denoise:()=>Hr,dirlight:()=>Qt,dirlight1:()=>Qn,dotScreen:()=>nn,edgeWork:()=>on,fp32:()=>Ur,fp64:()=>pn,fp64arithmetic:()=>Ht,fxaa:()=>un,generateShaderForModule:()=>Ir,geometry1:()=>dn,getPassthroughFS:()=>Nr,getQualifierDetails:()=>kr,getShaderInfo:()=>ye,getShaderLayoutFromWGSL:()=>Or,glsl:()=>ar,gouraudLighting:()=>Vn,gouraudMaterial:()=>Bt,hexagonalPixelate:()=>sn,hueSaturation:()=>Wr,ink:()=>an,lighting:()=>Q,lights1:()=>te,magnify:()=>cn,noise:()=>jr,normalizeShaderModule:()=>Sr,pbr:()=>Wn,pbrMaterial:()=>qr,phongLighting:()=>qn,phongMaterial:()=>Vt,picking:()=>zr,project1:()=>je,random:()=>B,sepia:()=>$r,swirl:()=>fn,tiltShift:()=>Jr,triangleBlur:()=>en,typeToChannelCount:()=>Tr,typeToChannelSuffix:()=>Er,vibrance:()=>Kr,vignette:()=>Zr,zoomBlur:()=>tn});Ae(xe,or($e(),1));var ar=t=>`${t}`;function z(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var Ke={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function lr(t){let e={};for(let[r,n]of Object.entries(t))e[r]=oo(n);return e}function fr(t,e,r){let n={};for(let[o,i]of Object.entries(e))t&&o in t&&!i.private?(i.validate&&z(i.validate(t[o],i),`${r}: invalid ${o}`),n[o]=t[o]):n[o]=i.value;return n}function oo(t){let e=cr(t);if(e!=="object")return{value:t,...Ke[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...Ke[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=cr(t.value),{...t,...Ke[e],type:e}):{type:"object",value:null};throw new Error("props")}function cr(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var ur=`#ifdef MODULE_LOGDEPTH
8
8
  logdepth_adjustPosition(gl_Position);
9
9
  #endif
10
10
  `,_r=`#ifdef MODULE_MATERIAL
@@ -2461,7 +2461,7 @@ return geometry_vPosition;
2461
2461
  vec3 geometry_getNormal() {
2462
2462
  return geometry_vNormal;
2463
2463
  }
2464
- `,dn={name:"geometry",vs:si,fs:ai};var Ea=1/Math.PI*180,Ta=1/180*Math.PI,ci={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...ci}};var O=globalThis.mathgl.config;function mn(t,{precision:e=O.precision}={}){return t=li(t),`${parseFloat(t.toPrecision(e))}`}function Be(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Wt(t,e,r){let n=O.EPSILON;r&&(O.EPSILON=r);try{if(t===e)return!0;if(Be(t)&&Be(e)){if(t.length!==e.length)return!1;for(let o=0;o<t.length;++o)if(!Wt(t[o],e[o]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=O.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{O.EPSILON=n}}function li(t){return Math.round(t/O.EPSILON)*O.EPSILON}var Ve=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Be(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(O)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+mn(this[n],e);return`${e.printTypes?this.constructor.name:""}[${r}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Wt(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let o=0;o<this.ELEMENTS;++o){let i=e[o],a=typeof r=="number"?r:r[o];this[o]=i+n*(a-i)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(O.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function fi(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function gn(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${JSON.stringify(t)}`);return t}function qe(t,e,r=""){if(O.debug&&!fi(t,e))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return t}var H=typeof Float32Array<"u"?Float32Array:Array;var Oa=Math.PI/180;function ui(){let t=new H(2);return H!=Float32Array&&(t[0]=0,t[1]=0),t}function An(t,e,r){let n=e[0],o=e[1];return t[0]=r[0]*n+r[4]*o+r[12],t[1]=r[1]*n+r[5]*o+r[13],t}var Ua=function(){let t=ui();return function(e,r,n,o,i,a){let f,u;for(r||(r=2),n||(n=0),o?u=Math.min(o*r+n,e.length):u=e.length,f=n;f<u;f+=r)t[0]=e[f],t[1]=e[f+1],i(t,t,a),e[f]=t[0],e[f+1]=t[1];return e}}();function bn(t,e,r){let n=e[0],o=e[1],i=r[3]*n+r[7]*o||1;return t[0]=(r[0]*n+r[4]*o)/i,t[1]=(r[1]*n+r[5]*o)/i,t}function yn(t,e,r){let n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i||1;return t[0]=(r[0]*n+r[4]*o+r[8]*i)/a,t[1]=(r[1]*n+r[5]*o+r[9]*i)/a,t[2]=(r[2]*n+r[6]*o+r[10]*i)/a,t}function _i(){let t=new H(3);return H!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Pn(t,e,r){let n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/a,t[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,t[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,t}var Ya=function(){let t=_i();return function(e,r,n,o,i,a){let f,u;for(r||(r=3),n||(n=0),o?u=Math.min(o*r+n,e.length):u=e.length,f=n;f<u;f+=r)t[0]=e[f],t[1]=e[f+1],t[2]=e[f+2],i(t,t,a),e[f]=t[0],e[f+1]=t[1],e[f+2]=t[2];return e}}();var Ge=class extends Ve{toString(){let e="[";if(O.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+r]}`}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=` ${this[r]}`}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=gn(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let o=0;o<this.RANK;++o)r[o]=this[n+o];return r}setColumn(e,r){let n=e*this.RANK;for(let o=0;o<this.RANK;++o)this[n+o]=r[o];return this}};function hi(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function wn(t,e){if(t===e){let r=e[1],n=e[2],o=e[3],i=e[6],a=e[7],f=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=o,t[13]=a,t[14]=f}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Ln(t,e){let r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],f=e[5],u=e[6],h=e[7],p=e[8],d=e[9],m=e[10],x=e[11],w=e[12],g=e[13],A=e[14],L=e[15],v=r*f-n*a,y=r*u-o*a,P=r*h-i*a,b=n*u-o*f,S=n*h-i*f,k=o*h-i*u,F=p*g-d*w,M=p*A-m*w,N=p*L-x*w,I=d*A-m*g,U=d*L-x*g,R=m*L-x*A,E=v*R-y*U+P*I+b*N-S*M+k*F;return E?(E=1/E,t[0]=(f*R-u*U+h*I)*E,t[1]=(o*U-n*R-i*I)*E,t[2]=(g*k-A*S+L*b)*E,t[3]=(m*S-d*k-x*b)*E,t[4]=(u*N-a*R-h*M)*E,t[5]=(r*R-o*N+i*M)*E,t[6]=(A*P-w*k-L*y)*E,t[7]=(p*k-m*P+x*y)*E,t[8]=(a*U-f*N+h*F)*E,t[9]=(n*N-r*U-i*F)*E,t[10]=(w*S-g*P+L*v)*E,t[11]=(d*P-p*S-x*v)*E,t[12]=(f*M-a*I-u*F)*E,t[13]=(r*I-n*M+o*F)*E,t[14]=(g*y-w*b-A*v)*E,t[15]=(p*b-d*y+m*v)*E,t):null}function Sn(t){let e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],f=t[6],u=t[7],h=t[8],p=t[9],d=t[10],m=t[11],x=t[12],w=t[13],g=t[14],A=t[15],L=e*a-r*i,v=e*f-n*i,y=r*f-n*a,P=h*w-p*x,b=h*g-d*x,S=p*g-d*w,k=e*S-r*b+n*P,F=i*S-a*b+f*P,M=h*y-p*v+d*L,N=x*y-w*v+g*L;return u*k-o*F+A*M-m*N}function $t(t,e,r){let n=e[0],o=e[1],i=e[2],a=e[3],f=e[4],u=e[5],h=e[6],p=e[7],d=e[8],m=e[9],x=e[10],w=e[11],g=e[12],A=e[13],L=e[14],v=e[15],y=r[0],P=r[1],b=r[2],S=r[3];return t[0]=y*n+P*f+b*d+S*g,t[1]=y*o+P*u+b*m+S*A,t[2]=y*i+P*h+b*x+S*L,t[3]=y*a+P*p+b*w+S*v,y=r[4],P=r[5],b=r[6],S=r[7],t[4]=y*n+P*f+b*d+S*g,t[5]=y*o+P*u+b*m+S*A,t[6]=y*i+P*h+b*x+S*L,t[7]=y*a+P*p+b*w+S*v,y=r[8],P=r[9],b=r[10],S=r[11],t[8]=y*n+P*f+b*d+S*g,t[9]=y*o+P*u+b*m+S*A,t[10]=y*i+P*h+b*x+S*L,t[11]=y*a+P*p+b*w+S*v,y=r[12],P=r[13],b=r[14],S=r[15],t[12]=y*n+P*f+b*d+S*g,t[13]=y*o+P*u+b*m+S*A,t[14]=y*i+P*h+b*x+S*L,t[15]=y*a+P*p+b*w+S*v,t}function kn(t,e,r){let n=r[0],o=r[1],i=r[2],a,f,u,h,p,d,m,x,w,g,A,L;return e===t?(t[12]=e[0]*n+e[4]*o+e[8]*i+e[12],t[13]=e[1]*n+e[5]*o+e[9]*i+e[13],t[14]=e[2]*n+e[6]*o+e[10]*i+e[14],t[15]=e[3]*n+e[7]*o+e[11]*i+e[15]):(a=e[0],f=e[1],u=e[2],h=e[3],p=e[4],d=e[5],m=e[6],x=e[7],w=e[8],g=e[9],A=e[10],L=e[11],t[0]=a,t[1]=f,t[2]=u,t[3]=h,t[4]=p,t[5]=d,t[6]=m,t[7]=x,t[8]=w,t[9]=g,t[10]=A,t[11]=L,t[12]=a*n+p*o+w*i+e[12],t[13]=f*n+d*o+g*i+e[13],t[14]=u*n+m*o+A*i+e[14],t[15]=h*n+x*o+L*i+e[15]),t}function Nn(t,e,r){let n=r[0],o=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function En(t,e,r,n){let o=n[0],i=n[1],a=n[2],f=Math.sqrt(o*o+i*i+a*a),u,h,p,d,m,x,w,g,A,L,v,y,P,b,S,k,F,M,N,I,U,R,E,fe;return f<1e-6?null:(f=1/f,o*=f,i*=f,a*=f,h=Math.sin(r),u=Math.cos(r),p=1-u,d=e[0],m=e[1],x=e[2],w=e[3],g=e[4],A=e[5],L=e[6],v=e[7],y=e[8],P=e[9],b=e[10],S=e[11],k=o*o*p+u,F=i*o*p+a*h,M=a*o*p-i*h,N=o*i*p-a*h,I=i*i*p+u,U=a*i*p+o*h,R=o*a*p+i*h,E=i*a*p-o*h,fe=a*a*p+u,t[0]=d*k+g*F+y*M,t[1]=m*k+A*F+P*M,t[2]=x*k+L*F+b*M,t[3]=w*k+v*F+S*M,t[4]=d*N+g*I+y*U,t[5]=m*N+A*I+P*U,t[6]=x*N+L*I+b*U,t[7]=w*N+v*I+S*U,t[8]=d*R+g*E+y*fe,t[9]=m*R+A*E+P*fe,t[10]=x*R+L*E+b*fe,t[11]=w*R+v*E+S*fe,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Tn(t,e,r){let n=Math.sin(r),o=Math.cos(r),i=e[4],a=e[5],f=e[6],u=e[7],h=e[8],p=e[9],d=e[10],m=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*o+h*n,t[5]=a*o+p*n,t[6]=f*o+d*n,t[7]=u*o+m*n,t[8]=h*o-i*n,t[9]=p*o-a*n,t[10]=d*o-f*n,t[11]=m*o-u*n,t}function Mn(t,e,r){let n=Math.sin(r),o=Math.cos(r),i=e[0],a=e[1],f=e[2],u=e[3],h=e[8],p=e[9],d=e[10],m=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*o-h*n,t[1]=a*o-p*n,t[2]=f*o-d*n,t[3]=u*o-m*n,t[8]=i*n+h*o,t[9]=a*n+p*o,t[10]=f*n+d*o,t[11]=u*n+m*o,t}function Fn(t,e,r){let n=Math.sin(r),o=Math.cos(r),i=e[0],a=e[1],f=e[2],u=e[3],h=e[4],p=e[5],d=e[6],m=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*o+h*n,t[1]=a*o+p*n,t[2]=f*o+d*n,t[3]=u*o+m*n,t[4]=h*o-i*n,t[5]=p*o-a*n,t[6]=d*o-f*n,t[7]=m*o-u*n,t}function In(t,e){let r=e[0],n=e[1],o=e[2],i=e[3],a=r+r,f=n+n,u=o+o,h=r*a,p=n*a,d=n*f,m=o*a,x=o*f,w=o*u,g=i*a,A=i*f,L=i*u;return t[0]=1-d-w,t[1]=p+L,t[2]=m-A,t[3]=0,t[4]=p-L,t[5]=1-h-w,t[6]=x+g,t[7]=0,t[8]=m+A,t[9]=x-g,t[10]=1-h-d,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Cn(t,e,r,n,o,i,a){let f=1/(r-e),u=1/(o-n),h=1/(i-a);return t[0]=i*2*f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i*2*u,t[6]=0,t[7]=0,t[8]=(r+e)*f,t[9]=(o+n)*u,t[10]=(a+i)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*h,t[15]=0,t}function pi(t,e,r,n,o){let i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0){let a=1/(n-o);t[10]=(o+n)*a,t[14]=2*o*n*a}else t[10]=-1,t[14]=-2*n;return t}var Rn=pi;function di(t,e,r,n,o,i,a){let f=1/(e-r),u=1/(n-o),h=1/(i-a);return t[0]=-2*f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+r)*f,t[13]=(o+n)*u,t[14]=(a+i)*h,t[15]=1,t}var On=di;function Un(t,e,r,n){let o,i,a,f,u,h,p,d,m,x,w=e[0],g=e[1],A=e[2],L=n[0],v=n[1],y=n[2],P=r[0],b=r[1],S=r[2];return Math.abs(w-P)<1e-6&&Math.abs(g-b)<1e-6&&Math.abs(A-S)<1e-6?hi(t):(d=w-P,m=g-b,x=A-S,o=1/Math.sqrt(d*d+m*m+x*x),d*=o,m*=o,x*=o,i=v*x-y*m,a=y*d-L*x,f=L*m-v*d,o=Math.sqrt(i*i+a*a+f*f),o?(o=1/o,i*=o,a*=o,f*=o):(i=0,a=0,f=0),u=m*f-x*a,h=x*i-d*f,p=d*a-m*i,o=Math.sqrt(u*u+h*h+p*p),o?(o=1/o,u*=o,h*=o,p*=o):(u=0,h=0,p=0),t[0]=i,t[1]=u,t[2]=d,t[3]=0,t[4]=a,t[5]=h,t[6]=m,t[7]=0,t[8]=f,t[9]=p,t[10]=x,t[11]=0,t[12]=-(i*w+a*g+f*A),t[13]=-(u*w+h*g+p*A),t[14]=-(d*w+m*g+x*A),t[15]=1,t)}function mi(){let t=new H(4);return H!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function zn(t,e,r){let n=e[0],o=e[1],i=e[2],a=e[3];return t[0]=r[0]*n+r[4]*o+r[8]*i+r[12]*a,t[1]=r[1]*n+r[5]*o+r[9]*i+r[13]*a,t[2]=r[2]*n+r[6]*o+r[10]*i+r[14]*a,t[3]=r[3]*n+r[7]*o+r[11]*i+r[15]*a,t}var Ha=function(){let t=mi();return function(e,r,n,o,i,a){let f,u;for(r||(r=4),n||(n=0),o?u=Math.min(o*r+n,e.length):u=e.length,f=n;f<u;f+=r)t[0]=e[f],t[1]=e[f+1],t[2]=e[f+2],t[3]=e[f+3],i(t,t,a),e[f]=t[0],e[f+1]=t[1],e[f+2]=t[2],e[f+3]=t[3];return e}}();var Jt;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(Jt||(Jt={}));var gi=45*Math.PI/180,xi=1,Kt=.1,Zt=500,vi=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),ee=class extends Ge{static get IDENTITY(){return bi()}static get ZERO(){return Ai()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Jt}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,o,i,a,f,u,h,p,d,m,x,w,g,A){return this[0]=e,this[1]=r,this[2]=n,this[3]=o,this[4]=i,this[5]=a,this[6]=f,this[7]=u,this[8]=h,this[9]=p,this[10]=d,this[11]=m,this[12]=x,this[13]=w,this[14]=g,this[15]=A,this.check()}setRowMajor(e,r,n,o,i,a,f,u,h,p,d,m,x,w,g,A){return this[0]=e,this[1]=i,this[2]=h,this[3]=x,this[4]=r,this[5]=a,this[6]=p,this[7]=w,this[8]=n,this[9]=f,this[10]=d,this[11]=g,this[12]=o,this[13]=u,this[14]=m,this[15]=A,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(vi)}fromObject(e){return this.check()}fromQuaternion(e){return In(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:o,top:i,near:a=Kt,far:f=Zt}=e;return f===1/0?yi(this,r,n,o,i,a):Cn(this,r,n,o,i,a,f),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:o=[0,1,0]}=e;return Un(this,r,n,o),this.check()}ortho(e){let{left:r,right:n,bottom:o,top:i,near:a=Kt,far:f=Zt}=e;return On(this,r,n,o,i,a,f),this.check()}orthographic(e){let{fovy:r=gi,aspect:n=xi,focalDistance:o=1,near:i=Kt,far:a=Zt}=e;Dn(r);let f=r/2,u=o*Math.tan(f),h=u*n;return this.ortho({left:-h,right:h,bottom:-u,top:u,near:i,far:a})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:o=.1,far:i=500}=e;return Dn(r),Rn(this,r,n,o,i),this.check()}determinant(){return Sn(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),o=1/n[0],i=1/n[1],a=1/n[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*o,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*o,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),o=1/n[0],i=1/n[1],a=1/n[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*o,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*o,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return wn(this,this),this.check()}invert(){return Ln(this,this),this.check()}multiplyLeft(e){return $t(this,e,this),this.check()}multiplyRight(e){return $t(this,this,e),this.check()}rotateX(e){return Tn(this,this,e),this.check()}rotateY(e){return Mn(this,this,e),this.check()}rotateZ(e){return Fn(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return En(this,this,e,r),this.check()}scale(e){return Nn(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return kn(this,this,e),this.check()}transform(e,r){return e.length===4?(r=zn(r||[-0,-0,-0,-0],e,this),qe(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,o;switch(n){case 2:o=An(r||[-0,-0],e,this);break;case 3:o=Pn(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return qe(o,e.length),o}transformAsVector(e,r){let n;switch(e.length){case 2:n=bn(r||[-0,-0],e,this);break;case 3:n=yn(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return qe(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},He,We;function Ai(){return He||(He=new ee([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(He)),He}function bi(){return We||(We=new ee,Object.freeze(We)),We}function Dn(t){if(t>Math.PI*2)throw Error("expected radians")}function yi(t,e,r,n,o,i){let a=2*i/(r-e),f=2*i/(o-n),u=(r+e)/(r-e),h=(o+n)/(o-n),p=-1,d=-1,m=-2*i;return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=f,t[6]=0,t[7]=0,t[8]=u,t[9]=h,t[10]=p,t[11]=d,t[12]=0,t[13]=0,t[14]=m,t[15]=0,t}var er=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Pi={modelMatrix:er,viewMatrix:er,projectionMatrix:er,cameraPositionWorld:[0,0,0]};function wi(t=Pi,e={}){let r={};return t.modelMatrix!==void 0&&(r.modelMatrix=t.modelMatrix),t.viewMatrix!==void 0&&(r.viewMatrix=t.viewMatrix),t.projectionMatrix!==void 0&&(r.projectionMatrix=t.projectionMatrix),t.cameraPositionWorld!==void 0&&(r.cameraPositionWorld=t.cameraPositionWorld),(t.projectionMatrix!==void 0||t.viewMatrix!==void 0)&&(r.viewProjectionMatrix=new ee(t.projectionMatrix).multiplyRight(t.viewMatrix)),r}var Yn=`varying vec4 project_vPositionWorld;
2464
+ `,dn={name:"geometry",vs:si,fs:ai};var Ta=1/Math.PI*180,Ma=1/180*Math.PI,ci={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...ci}};var O=globalThis.mathgl.config;function mn(t,{precision:e=O.precision}={}){return t=li(t),"".concat(parseFloat(t.toPrecision(e)))}function Be(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Wt(t,e,r){let n=O.EPSILON;r&&(O.EPSILON=r);try{if(t===e)return!0;if(Be(t)&&Be(e)){if(t.length!==e.length)return!1;for(let o=0;o<t.length;++o)if(!Wt(t[o],e[o]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=O.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{O.EPSILON=n}}function li(t){return Math.round(t/O.EPSILON)*O.EPSILON}function fi(t){function e(){var r=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var Ve=class extends fi(Array){clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Be(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(O)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+mn(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Wt(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let o=0;o<this.ELEMENTS;++o){let i=e[o],a=typeof r=="number"?r:r[o];this[o]=i+n*(a-i)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(O.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function ui(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function gn(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(JSON.stringify(t)));return t}function qe(t,e,r=""){if(O.debug&&!ui(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}var H=typeof Float32Array<"u"?Float32Array:Array;var Ua=Math.PI/180;function _i(){let t=new H(2);return H!=Float32Array&&(t[0]=0,t[1]=0),t}function An(t,e,r){let n=e[0],o=e[1];return t[0]=r[0]*n+r[4]*o+r[12],t[1]=r[1]*n+r[5]*o+r[13],t}var za=function(){let t=_i();return function(e,r,n,o,i,a){let f,u;for(r||(r=2),n||(n=0),o?u=Math.min(o*r+n,e.length):u=e.length,f=n;f<u;f+=r)t[0]=e[f],t[1]=e[f+1],i(t,t,a),e[f]=t[0],e[f+1]=t[1];return e}}();function bn(t,e,r){let n=e[0],o=e[1],i=r[3]*n+r[7]*o||1;return t[0]=(r[0]*n+r[4]*o)/i,t[1]=(r[1]*n+r[5]*o)/i,t}function yn(t,e,r){let n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i||1;return t[0]=(r[0]*n+r[4]*o+r[8]*i)/a,t[1]=(r[1]*n+r[5]*o+r[9]*i)/a,t[2]=(r[2]*n+r[6]*o+r[10]*i)/a,t}function hi(){let t=new H(3);return H!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Pn(t,e,r){let n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/a,t[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,t[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,t}var Xa=function(){let t=hi();return function(e,r,n,o,i,a){let f,u;for(r||(r=3),n||(n=0),o?u=Math.min(o*r+n,e.length):u=e.length,f=n;f<u;f+=r)t[0]=e[f],t[1]=e[f+1],t[2]=e[f+2],i(t,t,a),e[f]=t[0],e[f+1]=t[1],e[f+2]=t[2];return e}}();var Ge=class extends Ve{toString(){let e="[";if(O.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=" ".concat(this[n*this.RANK+r])}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=" ".concat(this[r])}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=gn(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let o=0;o<this.RANK;++o)r[o]=this[n+o];return r}setColumn(e,r){let n=e*this.RANK;for(let o=0;o<this.RANK;++o)this[n+o]=r[o];return this}};function pi(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function wn(t,e){if(t===e){let r=e[1],n=e[2],o=e[3],i=e[6],a=e[7],f=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=o,t[13]=a,t[14]=f}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Ln(t,e){let r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],f=e[5],u=e[6],h=e[7],p=e[8],d=e[9],m=e[10],x=e[11],w=e[12],g=e[13],A=e[14],L=e[15],v=r*f-n*a,y=r*u-o*a,P=r*h-i*a,b=n*u-o*f,S=n*h-i*f,k=o*h-i*u,F=p*g-d*w,M=p*A-m*w,N=p*L-x*w,I=d*A-m*g,U=d*L-x*g,R=m*L-x*A,E=v*R-y*U+P*I+b*N-S*M+k*F;return E?(E=1/E,t[0]=(f*R-u*U+h*I)*E,t[1]=(o*U-n*R-i*I)*E,t[2]=(g*k-A*S+L*b)*E,t[3]=(m*S-d*k-x*b)*E,t[4]=(u*N-a*R-h*M)*E,t[5]=(r*R-o*N+i*M)*E,t[6]=(A*P-w*k-L*y)*E,t[7]=(p*k-m*P+x*y)*E,t[8]=(a*U-f*N+h*F)*E,t[9]=(n*N-r*U-i*F)*E,t[10]=(w*S-g*P+L*v)*E,t[11]=(d*P-p*S-x*v)*E,t[12]=(f*M-a*I-u*F)*E,t[13]=(r*I-n*M+o*F)*E,t[14]=(g*y-w*b-A*v)*E,t[15]=(p*b-d*y+m*v)*E,t):null}function Sn(t){let e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],f=t[6],u=t[7],h=t[8],p=t[9],d=t[10],m=t[11],x=t[12],w=t[13],g=t[14],A=t[15],L=e*a-r*i,v=e*f-n*i,y=r*f-n*a,P=h*w-p*x,b=h*g-d*x,S=p*g-d*w,k=e*S-r*b+n*P,F=i*S-a*b+f*P,M=h*y-p*v+d*L,N=x*y-w*v+g*L;return u*k-o*F+A*M-m*N}function $t(t,e,r){let n=e[0],o=e[1],i=e[2],a=e[3],f=e[4],u=e[5],h=e[6],p=e[7],d=e[8],m=e[9],x=e[10],w=e[11],g=e[12],A=e[13],L=e[14],v=e[15],y=r[0],P=r[1],b=r[2],S=r[3];return t[0]=y*n+P*f+b*d+S*g,t[1]=y*o+P*u+b*m+S*A,t[2]=y*i+P*h+b*x+S*L,t[3]=y*a+P*p+b*w+S*v,y=r[4],P=r[5],b=r[6],S=r[7],t[4]=y*n+P*f+b*d+S*g,t[5]=y*o+P*u+b*m+S*A,t[6]=y*i+P*h+b*x+S*L,t[7]=y*a+P*p+b*w+S*v,y=r[8],P=r[9],b=r[10],S=r[11],t[8]=y*n+P*f+b*d+S*g,t[9]=y*o+P*u+b*m+S*A,t[10]=y*i+P*h+b*x+S*L,t[11]=y*a+P*p+b*w+S*v,y=r[12],P=r[13],b=r[14],S=r[15],t[12]=y*n+P*f+b*d+S*g,t[13]=y*o+P*u+b*m+S*A,t[14]=y*i+P*h+b*x+S*L,t[15]=y*a+P*p+b*w+S*v,t}function kn(t,e,r){let n=r[0],o=r[1],i=r[2],a,f,u,h,p,d,m,x,w,g,A,L;return e===t?(t[12]=e[0]*n+e[4]*o+e[8]*i+e[12],t[13]=e[1]*n+e[5]*o+e[9]*i+e[13],t[14]=e[2]*n+e[6]*o+e[10]*i+e[14],t[15]=e[3]*n+e[7]*o+e[11]*i+e[15]):(a=e[0],f=e[1],u=e[2],h=e[3],p=e[4],d=e[5],m=e[6],x=e[7],w=e[8],g=e[9],A=e[10],L=e[11],t[0]=a,t[1]=f,t[2]=u,t[3]=h,t[4]=p,t[5]=d,t[6]=m,t[7]=x,t[8]=w,t[9]=g,t[10]=A,t[11]=L,t[12]=a*n+p*o+w*i+e[12],t[13]=f*n+d*o+g*i+e[13],t[14]=u*n+m*o+A*i+e[14],t[15]=h*n+x*o+L*i+e[15]),t}function Nn(t,e,r){let n=r[0],o=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function En(t,e,r,n){let o=n[0],i=n[1],a=n[2],f=Math.sqrt(o*o+i*i+a*a),u,h,p,d,m,x,w,g,A,L,v,y,P,b,S,k,F,M,N,I,U,R,E,fe;return f<1e-6?null:(f=1/f,o*=f,i*=f,a*=f,h=Math.sin(r),u=Math.cos(r),p=1-u,d=e[0],m=e[1],x=e[2],w=e[3],g=e[4],A=e[5],L=e[6],v=e[7],y=e[8],P=e[9],b=e[10],S=e[11],k=o*o*p+u,F=i*o*p+a*h,M=a*o*p-i*h,N=o*i*p-a*h,I=i*i*p+u,U=a*i*p+o*h,R=o*a*p+i*h,E=i*a*p-o*h,fe=a*a*p+u,t[0]=d*k+g*F+y*M,t[1]=m*k+A*F+P*M,t[2]=x*k+L*F+b*M,t[3]=w*k+v*F+S*M,t[4]=d*N+g*I+y*U,t[5]=m*N+A*I+P*U,t[6]=x*N+L*I+b*U,t[7]=w*N+v*I+S*U,t[8]=d*R+g*E+y*fe,t[9]=m*R+A*E+P*fe,t[10]=x*R+L*E+b*fe,t[11]=w*R+v*E+S*fe,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Tn(t,e,r){let n=Math.sin(r),o=Math.cos(r),i=e[4],a=e[5],f=e[6],u=e[7],h=e[8],p=e[9],d=e[10],m=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*o+h*n,t[5]=a*o+p*n,t[6]=f*o+d*n,t[7]=u*o+m*n,t[8]=h*o-i*n,t[9]=p*o-a*n,t[10]=d*o-f*n,t[11]=m*o-u*n,t}function Mn(t,e,r){let n=Math.sin(r),o=Math.cos(r),i=e[0],a=e[1],f=e[2],u=e[3],h=e[8],p=e[9],d=e[10],m=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*o-h*n,t[1]=a*o-p*n,t[2]=f*o-d*n,t[3]=u*o-m*n,t[8]=i*n+h*o,t[9]=a*n+p*o,t[10]=f*n+d*o,t[11]=u*n+m*o,t}function Fn(t,e,r){let n=Math.sin(r),o=Math.cos(r),i=e[0],a=e[1],f=e[2],u=e[3],h=e[4],p=e[5],d=e[6],m=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*o+h*n,t[1]=a*o+p*n,t[2]=f*o+d*n,t[3]=u*o+m*n,t[4]=h*o-i*n,t[5]=p*o-a*n,t[6]=d*o-f*n,t[7]=m*o-u*n,t}function In(t,e){let r=e[0],n=e[1],o=e[2],i=e[3],a=r+r,f=n+n,u=o+o,h=r*a,p=n*a,d=n*f,m=o*a,x=o*f,w=o*u,g=i*a,A=i*f,L=i*u;return t[0]=1-d-w,t[1]=p+L,t[2]=m-A,t[3]=0,t[4]=p-L,t[5]=1-h-w,t[6]=x+g,t[7]=0,t[8]=m+A,t[9]=x-g,t[10]=1-h-d,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Cn(t,e,r,n,o,i,a){let f=1/(r-e),u=1/(o-n),h=1/(i-a);return t[0]=i*2*f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i*2*u,t[6]=0,t[7]=0,t[8]=(r+e)*f,t[9]=(o+n)*u,t[10]=(a+i)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*h,t[15]=0,t}function di(t,e,r,n,o){let i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0){let a=1/(n-o);t[10]=(o+n)*a,t[14]=2*o*n*a}else t[10]=-1,t[14]=-2*n;return t}var Rn=di;function mi(t,e,r,n,o,i,a){let f=1/(e-r),u=1/(n-o),h=1/(i-a);return t[0]=-2*f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+r)*f,t[13]=(o+n)*u,t[14]=(a+i)*h,t[15]=1,t}var On=mi;function Un(t,e,r,n){let o,i,a,f,u,h,p,d,m,x,w=e[0],g=e[1],A=e[2],L=n[0],v=n[1],y=n[2],P=r[0],b=r[1],S=r[2];return Math.abs(w-P)<1e-6&&Math.abs(g-b)<1e-6&&Math.abs(A-S)<1e-6?pi(t):(d=w-P,m=g-b,x=A-S,o=1/Math.sqrt(d*d+m*m+x*x),d*=o,m*=o,x*=o,i=v*x-y*m,a=y*d-L*x,f=L*m-v*d,o=Math.sqrt(i*i+a*a+f*f),o?(o=1/o,i*=o,a*=o,f*=o):(i=0,a=0,f=0),u=m*f-x*a,h=x*i-d*f,p=d*a-m*i,o=Math.sqrt(u*u+h*h+p*p),o?(o=1/o,u*=o,h*=o,p*=o):(u=0,h=0,p=0),t[0]=i,t[1]=u,t[2]=d,t[3]=0,t[4]=a,t[5]=h,t[6]=m,t[7]=0,t[8]=f,t[9]=p,t[10]=x,t[11]=0,t[12]=-(i*w+a*g+f*A),t[13]=-(u*w+h*g+p*A),t[14]=-(d*w+m*g+x*A),t[15]=1,t)}function gi(){let t=new H(4);return H!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function zn(t,e,r){let n=e[0],o=e[1],i=e[2],a=e[3];return t[0]=r[0]*n+r[4]*o+r[8]*i+r[12]*a,t[1]=r[1]*n+r[5]*o+r[9]*i+r[13]*a,t[2]=r[2]*n+r[6]*o+r[10]*i+r[14]*a,t[3]=r[3]*n+r[7]*o+r[11]*i+r[15]*a,t}var Wa=function(){let t=gi();return function(e,r,n,o,i,a){let f,u;for(r||(r=4),n||(n=0),o?u=Math.min(o*r+n,e.length):u=e.length,f=n;f<u;f+=r)t[0]=e[f],t[1]=e[f+1],t[2]=e[f+2],t[3]=e[f+3],i(t,t,a),e[f]=t[0],e[f+1]=t[1],e[f+2]=t[2],e[f+3]=t[3];return e}}();var Jt;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(Jt||(Jt={}));var xi=45*Math.PI/180,vi=1,Kt=.1,Zt=500,Ai=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),ee=class extends Ge{static get IDENTITY(){return yi()}static get ZERO(){return bi()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Jt}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,o,i,a,f,u,h,p,d,m,x,w,g,A){return this[0]=e,this[1]=r,this[2]=n,this[3]=o,this[4]=i,this[5]=a,this[6]=f,this[7]=u,this[8]=h,this[9]=p,this[10]=d,this[11]=m,this[12]=x,this[13]=w,this[14]=g,this[15]=A,this.check()}setRowMajor(e,r,n,o,i,a,f,u,h,p,d,m,x,w,g,A){return this[0]=e,this[1]=i,this[2]=h,this[3]=x,this[4]=r,this[5]=a,this[6]=p,this[7]=w,this[8]=n,this[9]=f,this[10]=d,this[11]=g,this[12]=o,this[13]=u,this[14]=m,this[15]=A,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Ai)}fromObject(e){return this.check()}fromQuaternion(e){return In(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:o,top:i,near:a=Kt,far:f=Zt}=e;return f===1/0?Pi(this,r,n,o,i,a):Cn(this,r,n,o,i,a,f),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:o=[0,1,0]}=e;return Un(this,r,n,o),this.check()}ortho(e){let{left:r,right:n,bottom:o,top:i,near:a=Kt,far:f=Zt}=e;return On(this,r,n,o,i,a,f),this.check()}orthographic(e){let{fovy:r=xi,aspect:n=vi,focalDistance:o=1,near:i=Kt,far:a=Zt}=e;Dn(r);let f=r/2,u=o*Math.tan(f),h=u*n;return this.ortho({left:-h,right:h,bottom:-u,top:u,near:i,far:a})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:o=.1,far:i=500}=e;return Dn(r),Rn(this,r,n,o,i),this.check()}determinant(){return Sn(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),o=1/n[0],i=1/n[1],a=1/n[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*o,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*o,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),o=1/n[0],i=1/n[1],a=1/n[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*o,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*o,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return wn(this,this),this.check()}invert(){return Ln(this,this),this.check()}multiplyLeft(e){return $t(this,e,this),this.check()}multiplyRight(e){return $t(this,this,e),this.check()}rotateX(e){return Tn(this,this,e),this.check()}rotateY(e){return Mn(this,this,e),this.check()}rotateZ(e){return Fn(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return En(this,this,e,r),this.check()}scale(e){return Nn(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return kn(this,this,e),this.check()}transform(e,r){return e.length===4?(r=zn(r||[-0,-0,-0,-0],e,this),qe(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,o;switch(n){case 2:o=An(r||[-0,-0],e,this);break;case 3:o=Pn(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return qe(o,e.length),o}transformAsVector(e,r){let n;switch(e.length){case 2:n=bn(r||[-0,-0],e,this);break;case 3:n=yn(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return qe(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},He,We;function bi(){return He||(He=new ee([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(He)),He}function yi(){return We||(We=new ee,Object.freeze(We)),We}function Dn(t){if(t>Math.PI*2)throw Error("expected radians")}function Pi(t,e,r,n,o,i){let a=2*i/(r-e),f=2*i/(o-n),u=(r+e)/(r-e),h=(o+n)/(o-n),p=-1,d=-1,m=-2*i;return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=f,t[6]=0,t[7]=0,t[8]=u,t[9]=h,t[10]=p,t[11]=d,t[12]=0,t[13]=0,t[14]=m,t[15]=0,t}var er=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],wi={modelMatrix:er,viewMatrix:er,projectionMatrix:er,cameraPositionWorld:[0,0,0]};function Li(t=wi,e={}){let r={};return t.modelMatrix!==void 0&&(r.modelMatrix=t.modelMatrix),t.viewMatrix!==void 0&&(r.viewMatrix=t.viewMatrix),t.projectionMatrix!==void 0&&(r.projectionMatrix=t.projectionMatrix),t.cameraPositionWorld!==void 0&&(r.cameraPositionWorld=t.cameraPositionWorld),(t.projectionMatrix!==void 0||t.viewMatrix!==void 0)&&(r.viewProjectionMatrix=new ee(t.projectionMatrix).multiplyRight(t.viewMatrix)),r}var Yn=`varying vec4 project_vPositionWorld;
2465
2465
  varying vec3 project_vNormalWorld;
2466
2466
  vec4 project_getPosition_World() {
2467
2467
  return project_vPositionWorld;
@@ -2469,7 +2469,7 @@ return project_vPositionWorld;
2469
2469
  vec3 project_getNormal_World() {
2470
2470
  return project_vNormalWorld;
2471
2471
  }
2472
- `,Li=`${Yn}
2472
+ `,Si=`${Yn}
2473
2473
 
2474
2474
  // Unprefixed uniforms
2475
2475
  uniform mat4 modelMatrix;
@@ -2522,8 +2522,8 @@ vec4 project_view_to_clipspace(vec3 position) {
2522
2522
  vec4 project_to_clipspace(vec3 position) {
2523
2523
  return viewProjectionMatrix * vec4(position, 1.);
2524
2524
  }
2525
- `,Si=`
2526
- ${Yn}`,je={name:"project",getUniforms:wi,vs:Li,fs:Si};var tr=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
2525
+ `,ki=`
2526
+ ${Yn}`,je={name:"project",getUniforms:Li,vs:Si,fs:ki};var tr=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
2527
2527
  struct AmbientLight {
2528
2528
  vec3 color;
2529
2529
  };
@@ -2548,13 +2548,13 @@ return pointLight.attenuation.x
2548
2548
  + pointLight.attenuation.z * distance * distance;
2549
2549
  }
2550
2550
  #endif
2551
- `;var ki={lightSources:{}};function rr(t={}){let{color:e=[0,0,0],intensity:r=1}=t;return e.map(n=>n*r/255)}function Ni({ambientLight:t,pointLights:e=[],directionalLights:r=[]}){let n={};return t?n["lighting_uAmbientLight.color"]=rr(t):n["lighting_uAmbientLight.color"]=[0,0,0],e.forEach((o,i)=>{n[`lighting_uPointLight[${i}].color`]=rr(o),n[`lighting_uPointLight[${i}].position`]=o.position,n[`lighting_uPointLight[${i}].attenuation`]=o.attenuation||[1,0,0]}),n.lighting_uPointLightCount=e.length,r.forEach((o,i)=>{n[`lighting_uDirectionalLight[${i}].color`]=rr(o),n[`lighting_uDirectionalLight[${i}].direction`]=o.direction}),n.lighting_uDirectionalLightCount=r.length,n}function Xn(t=ki){if("lightSources"in t){let{ambientLight:e,pointLights:r,directionalLights:n}=t.lightSources||{};return e||r&&r.length>0||n&&n.length>0?Object.assign({},Ni({ambientLight:e,pointLights:r,directionalLights:n}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){let e={pointLights:[],directionalLights:[]};for(let r of t.lights||[])switch(r.type){case"ambient":e.ambientLight=r;break;case"directional":e.directionalLights?.push(r);break;case"point":e.pointLights?.push(r);break;default:}return Xn({lightSources:e})}return{}}var te={name:"lights",vs:tr,fs:tr,getUniforms:Xn,defines:{MAX_LIGHTS:3}};var Ei={lightDirection:new Float32Array([1,1,2])};function Ti(t=Ei){let e={};return t.lightDirection&&(e.dirlight_uLightDirection=t.lightDirection),e}var Mi=`uniform vec3 dirlight_uLightDirection;
2551
+ `;var Ni={lightSources:{}};function rr(t={}){let{color:e=[0,0,0],intensity:r=1}=t;return e.map(n=>n*r/255)}function Ei({ambientLight:t,pointLights:e=[],directionalLights:r=[]}){let n={};return t?n["lighting_uAmbientLight.color"]=rr(t):n["lighting_uAmbientLight.color"]=[0,0,0],e.forEach((o,i)=>{n[`lighting_uPointLight[${i}].color`]=rr(o),n[`lighting_uPointLight[${i}].position`]=o.position,n[`lighting_uPointLight[${i}].attenuation`]=o.attenuation||[1,0,0]}),n.lighting_uPointLightCount=e.length,r.forEach((o,i)=>{n[`lighting_uDirectionalLight[${i}].color`]=rr(o),n[`lighting_uDirectionalLight[${i}].direction`]=o.direction}),n.lighting_uDirectionalLightCount=r.length,n}function Xn(t=Ni){if("lightSources"in t){let{ambientLight:e,pointLights:r,directionalLights:n}=t.lightSources||{};return e||r&&r.length>0||n&&n.length>0?Object.assign({},Ei({ambientLight:e,pointLights:r,directionalLights:n}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){let e={pointLights:[],directionalLights:[]};for(let r of t.lights||[])switch(r.type){case"ambient":e.ambientLight=r;break;case"directional":e.directionalLights?.push(r);break;case"point":e.pointLights?.push(r);break;default:}return Xn({lightSources:e})}return{}}var te={name:"lights",vs:tr,fs:tr,getUniforms:Xn,defines:{MAX_LIGHTS:3}};var Ti={lightDirection:new Float32Array([1,1,2])};function Mi(t=Ti){let e={};return t.lightDirection&&(e.dirlight_uLightDirection=t.lightDirection),e}var Fi=`uniform vec3 dirlight_uLightDirection;
2552
2552
  vec4 dirlight_filterColor(vec4 color) {
2553
2553
  vec3 normal = project_getNormal_World();
2554
2554
  float d = abs(dot(normalize(normal), normalize(dirlight_uLightDirection)));
2555
2555
  return vec4(color.rgb * d, color.a);
2556
2556
  }
2557
- `,Qn={name:"dirlight",fs:Mi,getUniforms:Ti,dependencies:[je]};var nr=`uniform float lighting_uAmbient;
2557
+ `,Qn={name:"dirlight",fs:Fi,getUniforms:Mi,dependencies:[je]};var nr=`uniform float lighting_uAmbient;
2558
2558
  uniform float lighting_uDiffuse;
2559
2559
  uniform float lighting_uShininess;
2560
2560
  uniform vec3 lighting_uSpecularColor;
@@ -2617,7 +2617,7 @@ lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction,
2617
2617
  }
2618
2618
  return lightColor;
2619
2619
  }
2620
- `;var Fi={};function Ii(t){let{ambient:e=.35,diffuse:r=.6,shininess:n=32,specularColor:o=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:r,lighting_uShininess:n,lighting_uSpecularColor:o.map(i=>i/255)}}function Bn(t=Fi){if(!("material"in t))return{};let{material:e}=t;return e?Ii(e):{lighting_uEnabled:!1}}var Vn={name:"gouraud-lighting",dependencies:[te],vs:nr,defines:{LIGHTING_VERTEX:1},getUniforms:Bn},qn={name:"phong-lighting",dependencies:[te],fs:nr,defines:{LIGHTING_FRAGMENT:1},getUniforms:Bn};var Gn=`uniform mat4 u_MVPMatrix;
2620
+ `;var Ii={};function Ci(t){let{ambient:e=.35,diffuse:r=.6,shininess:n=32,specularColor:o=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:r,lighting_uShininess:n,lighting_uSpecularColor:o.map(i=>i/255)}}function Bn(t=Ii){if(!("material"in t))return{};let{material:e}=t;return e?Ci(e):{lighting_uEnabled:!1}}var Vn={name:"gouraud-lighting",dependencies:[te],vs:nr,defines:{LIGHTING_VERTEX:1},getUniforms:Bn},qn={name:"phong-lighting",dependencies:[te],fs:nr,defines:{LIGHTING_FRAGMENT:1},getUniforms:Bn};var Gn=`uniform mat4 u_MVPMatrix;
2621
2621
  uniform mat4 u_ModelMatrix;
2622
2622
  uniform mat4 u_NormalMatrix;
2623
2623
  out vec3 pbr_vPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/shadertools",
3
- "version": "9.0.9",
3
+ "version": "9.0.10",
4
4
  "description": "Shader module system for luma.gl",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -52,5 +52,5 @@
52
52
  "@math.gl/core": "^4.0.0",
53
53
  "@math.gl/types": "^4.0.0"
54
54
  },
55
- "gitHead": "1715a33d52c6d23227cd3f62e163a40ea9acec9e"
55
+ "gitHead": "aa5e354fd9502a84e43c9e312ad33d9c155fed01"
56
56
  }