@luma.gl/engine 9.0.10 → 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/dist/dist.dev.js +261 -110
- package/dist/dist.min.js +9 -9
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +2 -2
- package/dist/model/model.js +1 -1
- package/dist/shader-inputs.d.ts +1 -1
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +7 -3
- package/dist.min.js +25 -0
- package/package.json +3 -3
- package/src/model/model.ts +1 -1
- package/src/shader-inputs.ts +12 -9
- package/src/.DS_Store +0 -0
package/dist/dist.dev.js
CHANGED
|
@@ -273,8 +273,6 @@ var __exports__ = (() => {
|
|
|
273
273
|
// ../../node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
274
274
|
var Stat = class {
|
|
275
275
|
constructor(name, type) {
|
|
276
|
-
this.name = void 0;
|
|
277
|
-
this.type = void 0;
|
|
278
276
|
this.sampleSize = 1;
|
|
279
277
|
this.time = 0;
|
|
280
278
|
this.count = 0;
|
|
@@ -309,26 +307,31 @@ var __exports__ = (() => {
|
|
|
309
307
|
this.sampleSize = samples;
|
|
310
308
|
return this;
|
|
311
309
|
}
|
|
310
|
+
/** Call to increment count (+1) */
|
|
312
311
|
incrementCount() {
|
|
313
312
|
this.addCount(1);
|
|
314
313
|
return this;
|
|
315
314
|
}
|
|
315
|
+
/** Call to decrement count (-1) */
|
|
316
316
|
decrementCount() {
|
|
317
317
|
this.subtractCount(1);
|
|
318
318
|
return this;
|
|
319
319
|
}
|
|
320
|
+
/** Increase count */
|
|
320
321
|
addCount(value) {
|
|
321
322
|
this._count += value;
|
|
322
323
|
this._samples++;
|
|
323
324
|
this._checkSampling();
|
|
324
325
|
return this;
|
|
325
326
|
}
|
|
327
|
+
/** Decrease count */
|
|
326
328
|
subtractCount(value) {
|
|
327
329
|
this._count -= value;
|
|
328
330
|
this._samples++;
|
|
329
331
|
this._checkSampling();
|
|
330
332
|
return this;
|
|
331
333
|
}
|
|
334
|
+
/** Add an arbitrary timing and bump the count */
|
|
332
335
|
addTime(time) {
|
|
333
336
|
this._time += time;
|
|
334
337
|
this.lastTiming = time;
|
|
@@ -336,11 +339,13 @@ var __exports__ = (() => {
|
|
|
336
339
|
this._checkSampling();
|
|
337
340
|
return this;
|
|
338
341
|
}
|
|
342
|
+
/** Start a timer */
|
|
339
343
|
timeStart() {
|
|
340
344
|
this._startTime = getHiResTimestamp();
|
|
341
345
|
this._timerPending = true;
|
|
342
346
|
return this;
|
|
343
347
|
}
|
|
348
|
+
/** End a timer. Adds to time and bumps the timing count. */
|
|
344
349
|
timeEnd() {
|
|
345
350
|
if (!this._timerPending) {
|
|
346
351
|
return this;
|
|
@@ -353,18 +358,22 @@ var __exports__ = (() => {
|
|
|
353
358
|
getSampleAverageCount() {
|
|
354
359
|
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
355
360
|
}
|
|
361
|
+
/** Calculate average time / count for the previous window */
|
|
356
362
|
getSampleAverageTime() {
|
|
357
363
|
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
358
364
|
}
|
|
365
|
+
/** Calculate counts per second for the previous window */
|
|
359
366
|
getSampleHz() {
|
|
360
367
|
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
361
368
|
}
|
|
362
369
|
getAverageCount() {
|
|
363
370
|
return this.samples > 0 ? this.count / this.samples : 0;
|
|
364
371
|
}
|
|
372
|
+
/** Calculate average time / count */
|
|
365
373
|
getAverageTime() {
|
|
366
374
|
return this.samples > 0 ? this.time / this.samples : 0;
|
|
367
375
|
}
|
|
376
|
+
/** Calculate counts per second */
|
|
368
377
|
getHz() {
|
|
369
378
|
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
370
379
|
}
|
|
@@ -385,23 +394,20 @@ var __exports__ = (() => {
|
|
|
385
394
|
// ../../node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
386
395
|
var Stats = class {
|
|
387
396
|
constructor(options) {
|
|
388
|
-
this.id = void 0;
|
|
389
397
|
this.stats = {};
|
|
390
398
|
this.id = options.id;
|
|
391
399
|
this.stats = {};
|
|
392
400
|
this._initializeStats(options.stats);
|
|
393
401
|
Object.seal(this);
|
|
394
402
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
return this._getOrCreate({
|
|
398
|
-
name,
|
|
399
|
-
type
|
|
400
|
-
});
|
|
403
|
+
/** Acquire a stat. Create if it doesn't exist. */
|
|
404
|
+
get(name, type = "count") {
|
|
405
|
+
return this._getOrCreate({ name, type });
|
|
401
406
|
}
|
|
402
407
|
get size() {
|
|
403
408
|
return Object.keys(this.stats).length;
|
|
404
409
|
}
|
|
410
|
+
/** Reset all stats */
|
|
405
411
|
reset() {
|
|
406
412
|
for (const stat of Object.values(this.stats)) {
|
|
407
413
|
stat.reset();
|
|
@@ -425,15 +431,11 @@ var __exports__ = (() => {
|
|
|
425
431
|
});
|
|
426
432
|
return table;
|
|
427
433
|
}
|
|
428
|
-
_initializeStats() {
|
|
429
|
-
let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
434
|
+
_initializeStats(stats = []) {
|
|
430
435
|
stats.forEach((stat) => this._getOrCreate(stat));
|
|
431
436
|
}
|
|
432
437
|
_getOrCreate(stat) {
|
|
433
|
-
const {
|
|
434
|
-
name,
|
|
435
|
-
type
|
|
436
|
-
} = stat;
|
|
438
|
+
const { name, type } = stat;
|
|
437
439
|
let result = this.stats[name];
|
|
438
440
|
if (!result) {
|
|
439
441
|
if (stat instanceof Stat) {
|
|
@@ -1087,6 +1089,7 @@ var __exports__ = (() => {
|
|
|
1087
1089
|
vs,
|
|
1088
1090
|
fs,
|
|
1089
1091
|
dependencies = [],
|
|
1092
|
+
uniformTypes = {},
|
|
1090
1093
|
uniformPropTypes = {},
|
|
1091
1094
|
getUniforms,
|
|
1092
1095
|
deprecations = [],
|
|
@@ -1102,6 +1105,7 @@ var __exports__ = (() => {
|
|
|
1102
1105
|
this.deprecations = this._parseDeprecationDefinitions(deprecations);
|
|
1103
1106
|
this.defines = defines;
|
|
1104
1107
|
this.injections = normalizeInjections(inject);
|
|
1108
|
+
this.uniformTypes = uniformTypes;
|
|
1105
1109
|
if (uniformPropTypes) {
|
|
1106
1110
|
this.uniforms = makePropValidators(uniformPropTypes);
|
|
1107
1111
|
}
|
|
@@ -4721,17 +4725,11 @@ void main() {
|
|
|
4721
4725
|
printRowMajor: true,
|
|
4722
4726
|
_cartographicRadians: false
|
|
4723
4727
|
};
|
|
4724
|
-
globalThis.mathgl = globalThis.mathgl || {
|
|
4725
|
-
config: {
|
|
4726
|
-
...DEFAULT_CONFIG
|
|
4727
|
-
}
|
|
4728
|
-
};
|
|
4728
|
+
globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
|
|
4729
4729
|
var config = globalThis.mathgl.config;
|
|
4730
|
-
function formatValue(value, {
|
|
4731
|
-
precision = config.precision
|
|
4732
|
-
} = {}) {
|
|
4730
|
+
function formatValue(value, { precision = config.precision } = {}) {
|
|
4733
4731
|
value = round(value);
|
|
4734
|
-
return
|
|
4732
|
+
return `${parseFloat(value.toPrecision(precision))}`;
|
|
4735
4733
|
}
|
|
4736
4734
|
function isArray(value) {
|
|
4737
4735
|
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
@@ -4775,28 +4773,12 @@ void main() {
|
|
|
4775
4773
|
}
|
|
4776
4774
|
|
|
4777
4775
|
// ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
ExtendableBuiltin.prototype = Object.create(cls.prototype, {
|
|
4785
|
-
constructor: {
|
|
4786
|
-
value: cls,
|
|
4787
|
-
enumerable: false,
|
|
4788
|
-
writable: true,
|
|
4789
|
-
configurable: true
|
|
4790
|
-
}
|
|
4791
|
-
});
|
|
4792
|
-
if (Object.setPrototypeOf) {
|
|
4793
|
-
Object.setPrototypeOf(ExtendableBuiltin, cls);
|
|
4794
|
-
} else {
|
|
4795
|
-
ExtendableBuiltin.__proto__ = cls;
|
|
4796
|
-
}
|
|
4797
|
-
return ExtendableBuiltin;
|
|
4798
|
-
}
|
|
4799
|
-
var MathArray = class extends _extendableBuiltin(Array) {
|
|
4776
|
+
var MathArray = class extends Array {
|
|
4777
|
+
// Common methods
|
|
4778
|
+
/**
|
|
4779
|
+
* Clone the current object
|
|
4780
|
+
* @returns a new copy of this object
|
|
4781
|
+
*/
|
|
4800
4782
|
clone() {
|
|
4801
4783
|
return new this.constructor().copy(this);
|
|
4802
4784
|
}
|
|
@@ -4816,7 +4798,10 @@ void main() {
|
|
|
4816
4798
|
return targetObject;
|
|
4817
4799
|
}
|
|
4818
4800
|
from(arrayOrObject) {
|
|
4819
|
-
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) :
|
|
4801
|
+
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
|
|
4802
|
+
// @ts-ignore
|
|
4803
|
+
this.fromObject(arrayOrObject)
|
|
4804
|
+
);
|
|
4820
4805
|
}
|
|
4821
4806
|
to(arrayOrObject) {
|
|
4822
4807
|
if (arrayOrObject === this) {
|
|
@@ -4827,18 +4812,20 @@ void main() {
|
|
|
4827
4812
|
toTarget(target) {
|
|
4828
4813
|
return target ? this.to(target) : this;
|
|
4829
4814
|
}
|
|
4815
|
+
/** @deprecated */
|
|
4830
4816
|
toFloat32Array() {
|
|
4831
4817
|
return new Float32Array(this);
|
|
4832
4818
|
}
|
|
4833
4819
|
toString() {
|
|
4834
4820
|
return this.formatString(config);
|
|
4835
4821
|
}
|
|
4822
|
+
/** Formats string according to options */
|
|
4836
4823
|
formatString(opts) {
|
|
4837
4824
|
let string = "";
|
|
4838
4825
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4839
4826
|
string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
|
|
4840
4827
|
}
|
|
4841
|
-
return
|
|
4828
|
+
return `${opts.printTypes ? this.constructor.name : ""}[${string}]`;
|
|
4842
4829
|
}
|
|
4843
4830
|
equals(array) {
|
|
4844
4831
|
if (!array || this.length !== array.length) {
|
|
@@ -4862,6 +4849,8 @@ void main() {
|
|
|
4862
4849
|
}
|
|
4863
4850
|
return true;
|
|
4864
4851
|
}
|
|
4852
|
+
// Modifiers
|
|
4853
|
+
/** Negates all values in this object */
|
|
4865
4854
|
negate() {
|
|
4866
4855
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4867
4856
|
this[i] = -this[i];
|
|
@@ -4879,12 +4868,14 @@ void main() {
|
|
|
4879
4868
|
}
|
|
4880
4869
|
return this.check();
|
|
4881
4870
|
}
|
|
4871
|
+
/** Minimal */
|
|
4882
4872
|
min(vector) {
|
|
4883
4873
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4884
4874
|
this[i] = Math.min(vector[i], this[i]);
|
|
4885
4875
|
}
|
|
4886
4876
|
return this.check();
|
|
4887
4877
|
}
|
|
4878
|
+
/** Maximal */
|
|
4888
4879
|
max(vector) {
|
|
4889
4880
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4890
4881
|
this[i] = Math.max(vector[i], this[i]);
|
|
@@ -4925,18 +4916,25 @@ void main() {
|
|
|
4925
4916
|
}
|
|
4926
4917
|
return this.check();
|
|
4927
4918
|
}
|
|
4919
|
+
/**
|
|
4920
|
+
* Multiplies all elements by `scale`
|
|
4921
|
+
* Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
|
|
4922
|
+
*/
|
|
4928
4923
|
multiplyByScalar(scalar) {
|
|
4929
4924
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4930
4925
|
this[i] *= scalar;
|
|
4931
4926
|
}
|
|
4932
4927
|
return this.check();
|
|
4933
4928
|
}
|
|
4929
|
+
// Debug checks
|
|
4930
|
+
/** Throws an error if array length is incorrect or contains illegal values */
|
|
4934
4931
|
check() {
|
|
4935
4932
|
if (config.debug && !this.validate()) {
|
|
4936
|
-
throw new Error(
|
|
4933
|
+
throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
|
|
4937
4934
|
}
|
|
4938
4935
|
return this;
|
|
4939
4936
|
}
|
|
4937
|
+
/** Returns false if the array length is incorrect or contains illegal values */
|
|
4940
4938
|
validate() {
|
|
4941
4939
|
let valid = this.length === this.ELEMENTS;
|
|
4942
4940
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -4944,39 +4942,48 @@ void main() {
|
|
|
4944
4942
|
}
|
|
4945
4943
|
return valid;
|
|
4946
4944
|
}
|
|
4945
|
+
// three.js compatibility
|
|
4946
|
+
/** @deprecated */
|
|
4947
4947
|
sub(a) {
|
|
4948
4948
|
return this.subtract(a);
|
|
4949
4949
|
}
|
|
4950
|
+
/** @deprecated */
|
|
4950
4951
|
setScalar(a) {
|
|
4951
4952
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4952
4953
|
this[i] = a;
|
|
4953
4954
|
}
|
|
4954
4955
|
return this.check();
|
|
4955
4956
|
}
|
|
4957
|
+
/** @deprecated */
|
|
4956
4958
|
addScalar(a) {
|
|
4957
4959
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4958
4960
|
this[i] += a;
|
|
4959
4961
|
}
|
|
4960
4962
|
return this.check();
|
|
4961
4963
|
}
|
|
4964
|
+
/** @deprecated */
|
|
4962
4965
|
subScalar(a) {
|
|
4963
4966
|
return this.addScalar(-a);
|
|
4964
4967
|
}
|
|
4968
|
+
/** @deprecated */
|
|
4965
4969
|
multiplyScalar(scalar) {
|
|
4966
4970
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4967
4971
|
this[i] *= scalar;
|
|
4968
4972
|
}
|
|
4969
4973
|
return this.check();
|
|
4970
4974
|
}
|
|
4975
|
+
/** @deprecated */
|
|
4971
4976
|
divideScalar(a) {
|
|
4972
4977
|
return this.multiplyByScalar(1 / a);
|
|
4973
4978
|
}
|
|
4979
|
+
/** @deprecated */
|
|
4974
4980
|
clampScalar(min, max) {
|
|
4975
4981
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4976
4982
|
this[i] = Math.min(Math.max(this[i], min), max);
|
|
4977
4983
|
}
|
|
4978
4984
|
return this.check();
|
|
4979
4985
|
}
|
|
4986
|
+
/** @deprecated */
|
|
4980
4987
|
get elements() {
|
|
4981
4988
|
return this;
|
|
4982
4989
|
}
|
|
@@ -4996,13 +5003,13 @@ void main() {
|
|
|
4996
5003
|
}
|
|
4997
5004
|
function checkNumber(value) {
|
|
4998
5005
|
if (!Number.isFinite(value)) {
|
|
4999
|
-
throw new Error(
|
|
5006
|
+
throw new Error(`Invalid number ${JSON.stringify(value)}`);
|
|
5000
5007
|
}
|
|
5001
5008
|
return value;
|
|
5002
5009
|
}
|
|
5003
5010
|
function checkVector(v, length, callerName = "") {
|
|
5004
5011
|
if (config.debug && !validateVector(v, length)) {
|
|
5005
|
-
throw new Error(
|
|
5012
|
+
throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
|
|
5006
5013
|
}
|
|
5007
5014
|
return v;
|
|
5008
5015
|
}
|
|
@@ -5010,12 +5017,13 @@ void main() {
|
|
|
5010
5017
|
// ../../node_modules/@math.gl/core/dist/lib/assert.js
|
|
5011
5018
|
function assert2(condition, message) {
|
|
5012
5019
|
if (!condition) {
|
|
5013
|
-
throw new Error(
|
|
5020
|
+
throw new Error(`math.gl assertion ${message}`);
|
|
5014
5021
|
}
|
|
5015
5022
|
}
|
|
5016
5023
|
|
|
5017
5024
|
// ../../node_modules/@math.gl/core/dist/classes/base/vector.js
|
|
5018
5025
|
var Vector = class extends MathArray {
|
|
5026
|
+
// ACCESSORS
|
|
5019
5027
|
get x() {
|
|
5020
5028
|
return this[0];
|
|
5021
5029
|
}
|
|
@@ -5028,12 +5036,24 @@ void main() {
|
|
|
5028
5036
|
set y(value) {
|
|
5029
5037
|
this[1] = checkNumber(value);
|
|
5030
5038
|
}
|
|
5039
|
+
/**
|
|
5040
|
+
* Returns the length of the vector from the origin to the point described by this vector
|
|
5041
|
+
*
|
|
5042
|
+
* @note `length` is a reserved word for Arrays, so `v.length()` will return number of elements
|
|
5043
|
+
* Instead we provide `len` and `magnitude`
|
|
5044
|
+
*/
|
|
5031
5045
|
len() {
|
|
5032
5046
|
return Math.sqrt(this.lengthSquared());
|
|
5033
5047
|
}
|
|
5048
|
+
/**
|
|
5049
|
+
* Returns the length of the vector from the origin to the point described by this vector
|
|
5050
|
+
*/
|
|
5034
5051
|
magnitude() {
|
|
5035
5052
|
return this.len();
|
|
5036
5053
|
}
|
|
5054
|
+
/**
|
|
5055
|
+
* Returns the squared length of the vector from the origin to the point described by this vector
|
|
5056
|
+
*/
|
|
5037
5057
|
lengthSquared() {
|
|
5038
5058
|
let length = 0;
|
|
5039
5059
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -5041,6 +5061,9 @@ void main() {
|
|
|
5041
5061
|
}
|
|
5042
5062
|
return length;
|
|
5043
5063
|
}
|
|
5064
|
+
/**
|
|
5065
|
+
* Returns the squared length of the vector from the origin to the point described by this vector
|
|
5066
|
+
*/
|
|
5044
5067
|
magnitudeSquared() {
|
|
5045
5068
|
return this.lengthSquared();
|
|
5046
5069
|
}
|
|
@@ -5062,6 +5085,7 @@ void main() {
|
|
|
5062
5085
|
}
|
|
5063
5086
|
return checkNumber(product);
|
|
5064
5087
|
}
|
|
5088
|
+
// MODIFIERS
|
|
5065
5089
|
normalize() {
|
|
5066
5090
|
const length = this.magnitude();
|
|
5067
5091
|
if (length !== 0) {
|
|
@@ -5087,6 +5111,7 @@ void main() {
|
|
|
5087
5111
|
}
|
|
5088
5112
|
return this.check();
|
|
5089
5113
|
}
|
|
5114
|
+
// THREE.js compatibility
|
|
5090
5115
|
lengthSq() {
|
|
5091
5116
|
return this.lengthSquared();
|
|
5092
5117
|
}
|
|
@@ -5359,6 +5384,12 @@ void main() {
|
|
|
5359
5384
|
}
|
|
5360
5385
|
return ZERO;
|
|
5361
5386
|
}
|
|
5387
|
+
/**
|
|
5388
|
+
* @class
|
|
5389
|
+
* @param x
|
|
5390
|
+
* @param y
|
|
5391
|
+
* @param z
|
|
5392
|
+
*/
|
|
5362
5393
|
constructor(x = 0, y = 0, z = 0) {
|
|
5363
5394
|
super(-0, -0, -0);
|
|
5364
5395
|
if (arguments.length === 1 && isArray(x)) {
|
|
@@ -5403,6 +5434,7 @@ void main() {
|
|
|
5403
5434
|
object.z = this[2];
|
|
5404
5435
|
return object;
|
|
5405
5436
|
}
|
|
5437
|
+
// Getters/setters
|
|
5406
5438
|
get ELEMENTS() {
|
|
5407
5439
|
return 3;
|
|
5408
5440
|
}
|
|
@@ -5412,41 +5444,38 @@ void main() {
|
|
|
5412
5444
|
set z(value) {
|
|
5413
5445
|
this[2] = checkNumber(value);
|
|
5414
5446
|
}
|
|
5447
|
+
// ACCESSORS
|
|
5415
5448
|
angle(vector) {
|
|
5416
5449
|
return angle(this, vector);
|
|
5417
5450
|
}
|
|
5451
|
+
// MODIFIERS
|
|
5418
5452
|
cross(vector) {
|
|
5419
5453
|
cross(this, this, vector);
|
|
5420
5454
|
return this.check();
|
|
5421
5455
|
}
|
|
5422
|
-
rotateX({
|
|
5423
|
-
radians,
|
|
5424
|
-
origin = ORIGIN
|
|
5425
|
-
}) {
|
|
5456
|
+
rotateX({ radians, origin = ORIGIN }) {
|
|
5426
5457
|
rotateX(this, this, origin, radians);
|
|
5427
5458
|
return this.check();
|
|
5428
5459
|
}
|
|
5429
|
-
rotateY({
|
|
5430
|
-
radians,
|
|
5431
|
-
origin = ORIGIN
|
|
5432
|
-
}) {
|
|
5460
|
+
rotateY({ radians, origin = ORIGIN }) {
|
|
5433
5461
|
rotateY(this, this, origin, radians);
|
|
5434
5462
|
return this.check();
|
|
5435
5463
|
}
|
|
5436
|
-
rotateZ({
|
|
5437
|
-
radians,
|
|
5438
|
-
origin = ORIGIN
|
|
5439
|
-
}) {
|
|
5464
|
+
rotateZ({ radians, origin = ORIGIN }) {
|
|
5440
5465
|
rotateZ(this, this, origin, radians);
|
|
5441
5466
|
return this.check();
|
|
5442
5467
|
}
|
|
5468
|
+
// Transforms
|
|
5469
|
+
// transforms as point (4th component is implicitly 1)
|
|
5443
5470
|
transform(matrix4) {
|
|
5444
5471
|
return this.transformAsPoint(matrix4);
|
|
5445
5472
|
}
|
|
5473
|
+
// transforms as point (4th component is implicitly 1)
|
|
5446
5474
|
transformAsPoint(matrix4) {
|
|
5447
5475
|
transformMat42(this, this, matrix4);
|
|
5448
5476
|
return this.check();
|
|
5449
5477
|
}
|
|
5478
|
+
// transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
|
|
5450
5479
|
transformAsVector(matrix4) {
|
|
5451
5480
|
vec3_transformMat4AsVector(this, this, matrix4);
|
|
5452
5481
|
return this.check();
|
|
@@ -5467,19 +5496,29 @@ void main() {
|
|
|
5467
5496
|
|
|
5468
5497
|
// ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
|
|
5469
5498
|
var Matrix = class extends MathArray {
|
|
5499
|
+
// fromObject(object) {
|
|
5500
|
+
// const array = object.elements;
|
|
5501
|
+
// return this.fromRowMajor(array);
|
|
5502
|
+
// }
|
|
5503
|
+
// toObject(object) {
|
|
5504
|
+
// const array = object.elements;
|
|
5505
|
+
// this.toRowMajor(array);
|
|
5506
|
+
// return object;
|
|
5507
|
+
// }
|
|
5508
|
+
// TODO better override formatString?
|
|
5470
5509
|
toString() {
|
|
5471
5510
|
let string = "[";
|
|
5472
5511
|
if (config.printRowMajor) {
|
|
5473
5512
|
string += "row-major:";
|
|
5474
5513
|
for (let row = 0; row < this.RANK; ++row) {
|
|
5475
5514
|
for (let col = 0; col < this.RANK; ++col) {
|
|
5476
|
-
string +=
|
|
5515
|
+
string += ` ${this[col * this.RANK + row]}`;
|
|
5477
5516
|
}
|
|
5478
5517
|
}
|
|
5479
5518
|
} else {
|
|
5480
5519
|
string += "column-major:";
|
|
5481
5520
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
5482
|
-
string +=
|
|
5521
|
+
string += ` ${this[i]}`;
|
|
5483
5522
|
}
|
|
5484
5523
|
}
|
|
5485
5524
|
string += "]";
|
|
@@ -5488,9 +5527,11 @@ void main() {
|
|
|
5488
5527
|
getElementIndex(row, col) {
|
|
5489
5528
|
return col * this.RANK + row;
|
|
5490
5529
|
}
|
|
5530
|
+
// By default assumes row major indices
|
|
5491
5531
|
getElement(row, col) {
|
|
5492
5532
|
return this[col * this.RANK + row];
|
|
5493
5533
|
}
|
|
5534
|
+
// By default assumes row major indices
|
|
5494
5535
|
setElement(row, col, value) {
|
|
5495
5536
|
this[col * this.RANK + row] = checkNumber(value);
|
|
5496
5537
|
return this;
|
|
@@ -6256,6 +6297,7 @@ void main() {
|
|
|
6256
6297
|
this[15] = array[15];
|
|
6257
6298
|
return this.check();
|
|
6258
6299
|
}
|
|
6300
|
+
// eslint-disable-next-line max-params
|
|
6259
6301
|
set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
|
|
6260
6302
|
this[0] = m00;
|
|
6261
6303
|
this[1] = m10;
|
|
@@ -6275,6 +6317,8 @@ void main() {
|
|
|
6275
6317
|
this[15] = m33;
|
|
6276
6318
|
return this.check();
|
|
6277
6319
|
}
|
|
6320
|
+
// accepts row major order, stores as column major
|
|
6321
|
+
// eslint-disable-next-line max-params
|
|
6278
6322
|
setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
|
|
6279
6323
|
this[0] = m00;
|
|
6280
6324
|
this[1] = m10;
|
|
@@ -6313,25 +6357,41 @@ void main() {
|
|
|
6313
6357
|
result[15] = this[15];
|
|
6314
6358
|
return result;
|
|
6315
6359
|
}
|
|
6360
|
+
// Constructors
|
|
6361
|
+
/** Set to identity matrix */
|
|
6316
6362
|
identity() {
|
|
6317
6363
|
return this.copy(IDENTITY_MATRIX);
|
|
6318
6364
|
}
|
|
6365
|
+
/**
|
|
6366
|
+
*
|
|
6367
|
+
* @param object
|
|
6368
|
+
* @returns self
|
|
6369
|
+
*/
|
|
6370
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6319
6371
|
fromObject(object) {
|
|
6320
6372
|
return this.check();
|
|
6321
6373
|
}
|
|
6374
|
+
/**
|
|
6375
|
+
* Calculates a 4x4 matrix from the given quaternion
|
|
6376
|
+
* @param quaternion Quaternion to create matrix from
|
|
6377
|
+
* @returns self
|
|
6378
|
+
*/
|
|
6322
6379
|
fromQuaternion(quaternion) {
|
|
6323
6380
|
fromQuat(this, quaternion);
|
|
6324
6381
|
return this.check();
|
|
6325
6382
|
}
|
|
6383
|
+
/**
|
|
6384
|
+
* Generates a frustum matrix with the given bounds
|
|
6385
|
+
* @param view.left - Left bound of the frustum
|
|
6386
|
+
* @param view.right - Right bound of the frustum
|
|
6387
|
+
* @param view.bottom - Bottom bound of the frustum
|
|
6388
|
+
* @param view.top - Top bound of the frustum
|
|
6389
|
+
* @param view.near - Near bound of the frustum
|
|
6390
|
+
* @param view.far - Far bound of the frustum. Can be set to Infinity.
|
|
6391
|
+
* @returns self
|
|
6392
|
+
*/
|
|
6326
6393
|
frustum(view) {
|
|
6327
|
-
const {
|
|
6328
|
-
left,
|
|
6329
|
-
right,
|
|
6330
|
-
bottom,
|
|
6331
|
-
top,
|
|
6332
|
-
near = DEFAULT_NEAR,
|
|
6333
|
-
far = DEFAULT_FAR
|
|
6334
|
-
} = view;
|
|
6394
|
+
const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
6335
6395
|
if (far === Infinity) {
|
|
6336
6396
|
computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
|
|
6337
6397
|
} else {
|
|
@@ -6339,35 +6399,47 @@ void main() {
|
|
|
6339
6399
|
}
|
|
6340
6400
|
return this.check();
|
|
6341
6401
|
}
|
|
6402
|
+
/**
|
|
6403
|
+
* Generates a look-at matrix with the given eye position, focal point,
|
|
6404
|
+
* and up axis
|
|
6405
|
+
* @param view.eye - (vector) Position of the viewer
|
|
6406
|
+
* @param view.center - (vector) Point the viewer is looking at
|
|
6407
|
+
* @param view.up - (vector) Up axis
|
|
6408
|
+
* @returns self
|
|
6409
|
+
*/
|
|
6342
6410
|
lookAt(view) {
|
|
6343
|
-
const {
|
|
6344
|
-
eye,
|
|
6345
|
-
center = [0, 0, 0],
|
|
6346
|
-
up = [0, 1, 0]
|
|
6347
|
-
} = view;
|
|
6411
|
+
const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
6348
6412
|
lookAt(this, eye, center, up);
|
|
6349
6413
|
return this.check();
|
|
6350
6414
|
}
|
|
6415
|
+
/**
|
|
6416
|
+
* Generates a orthogonal projection matrix with the given bounds
|
|
6417
|
+
* from "traditional" view space parameters
|
|
6418
|
+
* @param view.left - Left bound of the frustum
|
|
6419
|
+
* @param view.right number Right bound of the frustum
|
|
6420
|
+
* @param view.bottom - Bottom bound of the frustum
|
|
6421
|
+
* @param view.top number Top bound of the frustum
|
|
6422
|
+
* @param view.near - Near bound of the frustum
|
|
6423
|
+
* @param view.far number Far bound of the frustum
|
|
6424
|
+
* @returns self
|
|
6425
|
+
*/
|
|
6351
6426
|
ortho(view) {
|
|
6352
|
-
const {
|
|
6353
|
-
left,
|
|
6354
|
-
right,
|
|
6355
|
-
bottom,
|
|
6356
|
-
top,
|
|
6357
|
-
near = DEFAULT_NEAR,
|
|
6358
|
-
far = DEFAULT_FAR
|
|
6359
|
-
} = view;
|
|
6427
|
+
const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
6360
6428
|
ortho(this, left, right, bottom, top, near, far);
|
|
6361
6429
|
return this.check();
|
|
6362
6430
|
}
|
|
6431
|
+
/**
|
|
6432
|
+
* Generates an orthogonal projection matrix with the same parameters
|
|
6433
|
+
* as a perspective matrix (plus focalDistance)
|
|
6434
|
+
* @param view.fovy Vertical field of view in radians
|
|
6435
|
+
* @param view.aspect Aspect ratio. Typically viewport width / viewport height
|
|
6436
|
+
* @param view.focalDistance Distance in the view frustum used for extent calculations
|
|
6437
|
+
* @param view.near Near bound of the frustum
|
|
6438
|
+
* @param view.far Far bound of the frustum
|
|
6439
|
+
* @returns self
|
|
6440
|
+
*/
|
|
6363
6441
|
orthographic(view) {
|
|
6364
|
-
const {
|
|
6365
|
-
fovy = DEFAULT_FOVY,
|
|
6366
|
-
aspect = DEFAULT_ASPECT,
|
|
6367
|
-
focalDistance = 1,
|
|
6368
|
-
near = DEFAULT_NEAR,
|
|
6369
|
-
far = DEFAULT_FAR
|
|
6370
|
-
} = view;
|
|
6442
|
+
const { fovy = DEFAULT_FOVY, aspect = DEFAULT_ASPECT, focalDistance = 1, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
6371
6443
|
checkRadians(fovy);
|
|
6372
6444
|
const halfY = fovy / 2;
|
|
6373
6445
|
const top = focalDistance * Math.tan(halfY);
|
|
@@ -6381,32 +6453,53 @@ void main() {
|
|
|
6381
6453
|
far
|
|
6382
6454
|
});
|
|
6383
6455
|
}
|
|
6456
|
+
/**
|
|
6457
|
+
* Generates a perspective projection matrix with the given bounds
|
|
6458
|
+
* @param view.fovy Vertical field of view in radians
|
|
6459
|
+
* @param view.aspect Aspect ratio. typically viewport width/height
|
|
6460
|
+
* @param view.near Near bound of the frustum
|
|
6461
|
+
* @param view.far Far bound of the frustum
|
|
6462
|
+
* @returns self
|
|
6463
|
+
*/
|
|
6384
6464
|
perspective(view) {
|
|
6385
|
-
const {
|
|
6386
|
-
fovy = 45 * Math.PI / 180,
|
|
6387
|
-
aspect = 1,
|
|
6388
|
-
near = 0.1,
|
|
6389
|
-
far = 500
|
|
6390
|
-
} = view;
|
|
6465
|
+
const { fovy = 45 * Math.PI / 180, aspect = 1, near = 0.1, far = 500 } = view;
|
|
6391
6466
|
checkRadians(fovy);
|
|
6392
6467
|
perspective(this, fovy, aspect, near, far);
|
|
6393
6468
|
return this.check();
|
|
6394
6469
|
}
|
|
6470
|
+
// Accessors
|
|
6395
6471
|
determinant() {
|
|
6396
6472
|
return determinant(this);
|
|
6397
6473
|
}
|
|
6474
|
+
/**
|
|
6475
|
+
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
|
6476
|
+
* The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
|
|
6477
|
+
* @param result
|
|
6478
|
+
* @returns self
|
|
6479
|
+
*/
|
|
6398
6480
|
getScale(result = [-0, -0, -0]) {
|
|
6399
6481
|
result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
|
|
6400
6482
|
result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
|
|
6401
6483
|
result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
|
|
6402
6484
|
return result;
|
|
6403
6485
|
}
|
|
6486
|
+
/**
|
|
6487
|
+
* Gets the translation portion, assuming the matrix is a affine transformation matrix.
|
|
6488
|
+
* @param result
|
|
6489
|
+
* @returns self
|
|
6490
|
+
*/
|
|
6404
6491
|
getTranslation(result = [-0, -0, -0]) {
|
|
6405
6492
|
result[0] = this[12];
|
|
6406
6493
|
result[1] = this[13];
|
|
6407
6494
|
result[2] = this[14];
|
|
6408
6495
|
return result;
|
|
6409
6496
|
}
|
|
6497
|
+
/**
|
|
6498
|
+
* Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
|
|
6499
|
+
* @param result
|
|
6500
|
+
* @param scaleResult
|
|
6501
|
+
* @returns self
|
|
6502
|
+
*/
|
|
6410
6503
|
getRotation(result, scaleResult) {
|
|
6411
6504
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
6412
6505
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -6432,6 +6525,12 @@ void main() {
|
|
|
6432
6525
|
result[15] = 1;
|
|
6433
6526
|
return result;
|
|
6434
6527
|
}
|
|
6528
|
+
/**
|
|
6529
|
+
*
|
|
6530
|
+
* @param result
|
|
6531
|
+
* @param scaleResult
|
|
6532
|
+
* @returns self
|
|
6533
|
+
*/
|
|
6435
6534
|
getRotationMatrix3(result, scaleResult) {
|
|
6436
6535
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
6437
6536
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -6450,6 +6549,7 @@ void main() {
|
|
|
6450
6549
|
result[8] = this[10] * inverseScale2;
|
|
6451
6550
|
return result;
|
|
6452
6551
|
}
|
|
6552
|
+
// Modifiers
|
|
6453
6553
|
transpose() {
|
|
6454
6554
|
transpose(this, this);
|
|
6455
6555
|
return this.check();
|
|
@@ -6458,6 +6558,7 @@ void main() {
|
|
|
6458
6558
|
invert(this, this);
|
|
6459
6559
|
return this.check();
|
|
6460
6560
|
}
|
|
6561
|
+
// Operations
|
|
6461
6562
|
multiplyLeft(a) {
|
|
6462
6563
|
multiply(this, a, this);
|
|
6463
6564
|
return this.check();
|
|
@@ -6466,33 +6567,68 @@ void main() {
|
|
|
6466
6567
|
multiply(this, this, a);
|
|
6467
6568
|
return this.check();
|
|
6468
6569
|
}
|
|
6570
|
+
// Rotates a matrix by the given angle around the X axis
|
|
6469
6571
|
rotateX(radians) {
|
|
6470
6572
|
rotateX2(this, this, radians);
|
|
6471
6573
|
return this.check();
|
|
6472
6574
|
}
|
|
6575
|
+
// Rotates a matrix by the given angle around the Y axis.
|
|
6473
6576
|
rotateY(radians) {
|
|
6474
6577
|
rotateY2(this, this, radians);
|
|
6475
6578
|
return this.check();
|
|
6476
6579
|
}
|
|
6580
|
+
/**
|
|
6581
|
+
* Rotates a matrix by the given angle around the Z axis.
|
|
6582
|
+
* @param radians
|
|
6583
|
+
* @returns self
|
|
6584
|
+
*/
|
|
6477
6585
|
rotateZ(radians) {
|
|
6478
6586
|
rotateZ2(this, this, radians);
|
|
6479
6587
|
return this.check();
|
|
6480
6588
|
}
|
|
6589
|
+
/**
|
|
6590
|
+
*
|
|
6591
|
+
* @param param0
|
|
6592
|
+
* @returns self
|
|
6593
|
+
*/
|
|
6481
6594
|
rotateXYZ(angleXYZ) {
|
|
6482
6595
|
return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
|
|
6483
6596
|
}
|
|
6597
|
+
/**
|
|
6598
|
+
*
|
|
6599
|
+
* @param radians
|
|
6600
|
+
* @param axis
|
|
6601
|
+
* @returns self
|
|
6602
|
+
*/
|
|
6484
6603
|
rotateAxis(radians, axis) {
|
|
6485
6604
|
rotate(this, this, radians, axis);
|
|
6486
6605
|
return this.check();
|
|
6487
6606
|
}
|
|
6607
|
+
/**
|
|
6608
|
+
*
|
|
6609
|
+
* @param factor
|
|
6610
|
+
* @returns self
|
|
6611
|
+
*/
|
|
6488
6612
|
scale(factor) {
|
|
6489
6613
|
scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
|
|
6490
6614
|
return this.check();
|
|
6491
6615
|
}
|
|
6616
|
+
/**
|
|
6617
|
+
*
|
|
6618
|
+
* @param vec
|
|
6619
|
+
* @returns self
|
|
6620
|
+
*/
|
|
6492
6621
|
translate(vector) {
|
|
6493
6622
|
translate(this, this, vector);
|
|
6494
6623
|
return this.check();
|
|
6495
6624
|
}
|
|
6625
|
+
// Transforms
|
|
6626
|
+
/**
|
|
6627
|
+
* Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
|
|
6628
|
+
* @param vector
|
|
6629
|
+
* @param result
|
|
6630
|
+
* @returns self
|
|
6631
|
+
*/
|
|
6496
6632
|
transform(vector, result) {
|
|
6497
6633
|
if (vector.length === 4) {
|
|
6498
6634
|
result = transformMat43(result || [-0, -0, -0, -0], vector, this);
|
|
@@ -6501,10 +6637,14 @@ void main() {
|
|
|
6501
6637
|
}
|
|
6502
6638
|
return this.transformAsPoint(vector, result);
|
|
6503
6639
|
}
|
|
6640
|
+
/**
|
|
6641
|
+
* Transforms any 2 or 3 element array as point (w implicitly 1)
|
|
6642
|
+
* @param vector
|
|
6643
|
+
* @param result
|
|
6644
|
+
* @returns self
|
|
6645
|
+
*/
|
|
6504
6646
|
transformAsPoint(vector, result) {
|
|
6505
|
-
const {
|
|
6506
|
-
length
|
|
6507
|
-
} = vector;
|
|
6647
|
+
const { length } = vector;
|
|
6508
6648
|
let out;
|
|
6509
6649
|
switch (length) {
|
|
6510
6650
|
case 2:
|
|
@@ -6519,6 +6659,12 @@ void main() {
|
|
|
6519
6659
|
checkVector(out, vector.length);
|
|
6520
6660
|
return out;
|
|
6521
6661
|
}
|
|
6662
|
+
/**
|
|
6663
|
+
* Transforms any 2 or 3 element array as vector (w implicitly 0)
|
|
6664
|
+
* @param vector
|
|
6665
|
+
* @param result
|
|
6666
|
+
* @returns self
|
|
6667
|
+
*/
|
|
6522
6668
|
transformAsVector(vector, result) {
|
|
6523
6669
|
let out;
|
|
6524
6670
|
switch (vector.length) {
|
|
@@ -6534,15 +6680,19 @@ void main() {
|
|
|
6534
6680
|
checkVector(out, vector.length);
|
|
6535
6681
|
return out;
|
|
6536
6682
|
}
|
|
6683
|
+
/** @deprecated */
|
|
6537
6684
|
transformPoint(vector, result) {
|
|
6538
6685
|
return this.transformAsPoint(vector, result);
|
|
6539
6686
|
}
|
|
6687
|
+
/** @deprecated */
|
|
6540
6688
|
transformVector(vector, result) {
|
|
6541
6689
|
return this.transformAsPoint(vector, result);
|
|
6542
6690
|
}
|
|
6691
|
+
/** @deprecated */
|
|
6543
6692
|
transformDirection(vector, result) {
|
|
6544
6693
|
return this.transformAsVector(vector, result);
|
|
6545
6694
|
}
|
|
6695
|
+
// three.js math API compatibility
|
|
6546
6696
|
makeRotationX(radians) {
|
|
6547
6697
|
return this.identity().rotateX(radians);
|
|
6548
6698
|
}
|
|
@@ -6707,12 +6857,13 @@ void main() {
|
|
|
6707
6857
|
* @param modules
|
|
6708
6858
|
*/
|
|
6709
6859
|
constructor(modules) {
|
|
6710
|
-
const
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6860
|
+
const resolvedModules = resolveModules(
|
|
6861
|
+
Object.values(modules).filter((module) => module.dependencies)
|
|
6862
|
+
);
|
|
6863
|
+
for (const resolvedModule of resolvedModules) {
|
|
6864
|
+
modules[resolvedModule.name] = resolvedModule;
|
|
6865
|
+
}
|
|
6866
|
+
import_core6.log.log(1, "Creating ShaderInputs with modules", Object.keys(modules))();
|
|
6716
6867
|
this.modules = modules;
|
|
6717
6868
|
this.moduleUniforms = {};
|
|
6718
6869
|
this.moduleBindings = {};
|
|
@@ -7079,7 +7230,7 @@ void main() {
|
|
|
7079
7230
|
if (this._gpuGeometry) {
|
|
7080
7231
|
this._setGeometryAttributes(this._gpuGeometry);
|
|
7081
7232
|
}
|
|
7082
|
-
if (props
|
|
7233
|
+
if ("isInstanced" in props) {
|
|
7083
7234
|
this.isInstanced = props.isInstanced;
|
|
7084
7235
|
}
|
|
7085
7236
|
if (props.instanceCount) {
|