@luma.gl/core 9.0.11 → 9.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +34 -0
- package/dist/adapter/canvas-context.d.ts +5 -0
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/device.d.ts +10 -8
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +20 -18
- package/dist/{lib → adapter}/luma.d.ts +2 -2
- package/dist/adapter/luma.d.ts.map +1 -0
- package/dist/{lib → adapter}/luma.js +7 -7
- package/dist/adapter/resources/buffer.js +5 -5
- package/dist/adapter/resources/compute-pipeline.d.ts +2 -0
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +3 -0
- package/dist/adapter/resources/external-texture.d.ts +1 -1
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +1 -1
- package/dist/adapter/resources/framebuffer.d.ts +3 -3
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +2 -83
- package/dist/adapter/resources/render-pass.d.ts +2 -2
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +2 -5
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/resource.d.ts +3 -3
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +1 -1
- package/dist/adapter/resources/shader.d.ts +5 -2
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +15 -9
- package/dist/adapter/resources/texture-view.d.ts +1 -1
- package/dist/adapter/resources/texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/texture.d.ts +111 -49
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +96 -12
- package/dist/adapter/resources/transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.d.ts +1 -1
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +6 -2
- package/dist/adapter/types/{types.d.ts → attachments.d.ts} +5 -16
- package/dist/adapter/types/attachments.d.ts.map +1 -0
- package/dist/adapter/types/buffer-layout.d.ts +1 -1
- package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
- package/dist/adapter/types/compiler-message.d.ts.map +1 -0
- package/dist/adapter/types/parameters.d.ts +2 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/shader-layout.d.ts +23 -3
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/uniforms.d.ts +4 -0
- package/dist/adapter/types/uniforms.d.ts.map +1 -0
- package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.d.ts +1 -1
- package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.d.ts +4 -11
- package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.js +10 -30
- package/dist/adapter-utils/is-uniform-value.d.ts +3 -0
- package/dist/adapter-utils/is-uniform-value.d.ts.map +1 -0
- package/dist/adapter-utils/is-uniform-value.js +7 -0
- package/dist/dist.dev.js +266 -588
- package/dist/dist.min.js +4 -4
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.d.ts +3 -3
- package/dist/gpu-type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.d.ts +1 -1
- package/dist/gpu-type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.d.ts +1 -1
- package/dist/gpu-type-utils/decode-shader-types.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.js +0 -2
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.d.ts +2 -2
- package/dist/gpu-type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.d.ts +1 -1
- package/dist/gpu-type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/gpu-type-utils/shader-types.d.ts.map +1 -0
- package/dist/{adapter/types → gpu-type-utils}/texture-formats.d.ts +1 -1
- package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.d.ts +2 -2
- package/dist/gpu-type-utils/vertex-format-from-attribute.d.ts.map +1 -0
- package/dist/gpu-type-utils/vertex-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.d.ts +1 -1
- package/dist/gpu-type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/index.cjs +190 -411
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +28 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -36
- package/dist/init.js +1 -1
- package/dist/{lib/uniforms → portable}/uniform-block.d.ts +3 -3
- package/dist/portable/uniform-block.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-block.js +2 -2
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.d.ts +2 -2
- package/dist/portable/uniform-buffer-layout.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.js +6 -7
- package/dist/{lib/uniforms → portable}/uniform-store.d.ts +4 -4
- package/dist/portable/uniform-store.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-store.js +11 -9
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +6 -7
- package/dist/utils/array-utils-flat.d.ts +1 -7
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +0 -23
- package/dist/utils/is-array.d.ts +3 -3
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +2 -2
- package/dist/utils/uid.d.ts +7 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/{utils.js → uid.js} +0 -11
- package/package.json +5 -5
- package/src/adapter/canvas-context.ts +6 -0
- package/src/adapter/device.ts +34 -31
- package/src/{lib → adapter}/luma.ts +9 -9
- package/src/adapter/resources/buffer.ts +5 -5
- package/src/adapter/resources/command-encoder.ts +1 -1
- package/src/adapter/resources/compute-pass.ts +3 -3
- package/src/adapter/resources/compute-pipeline.ts +6 -3
- package/src/adapter/resources/external-texture.ts +2 -2
- package/src/adapter/resources/framebuffer.ts +5 -92
- package/src/adapter/resources/query-set.ts +2 -2
- package/src/adapter/resources/render-pass.ts +11 -7
- package/src/adapter/resources/render-pipeline.ts +3 -6
- package/src/adapter/resources/resource.ts +7 -7
- package/src/adapter/resources/shader.ts +18 -11
- package/src/adapter/resources/texture-view.ts +5 -5
- package/src/adapter/resources/texture.ts +226 -77
- package/src/adapter/resources/transform-feedback.ts +1 -1
- package/src/adapter/resources/vertex-array.ts +7 -3
- package/src/adapter/types/{types.ts → attachments.ts} +8 -17
- package/src/adapter/types/buffer-layout.ts +1 -1
- package/src/adapter/types/parameters.ts +10 -14
- package/src/adapter/types/shader-layout.ts +31 -29
- package/src/adapter/types/uniforms.ts +10 -0
- package/src/{lib/compiler-log → adapter-utils}/format-compiler-log.ts +1 -1
- package/src/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.ts +18 -42
- package/src/adapter-utils/is-uniform-value.ts +10 -0
- package/src/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.ts +3 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-data-type.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/decode-shader-types.ts +1 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-texture-format.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.ts +1 -1
- package/src/{adapter/types → gpu-type-utils}/texture-formats.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/wgsl-utils.ts +1 -1
- package/src/index.ts +69 -84
- package/src/{lib/uniforms → portable}/uniform-block.ts +5 -5
- package/src/{lib/uniforms → portable}/uniform-buffer-layout.ts +9 -9
- package/src/{lib/uniforms → portable}/uniform-store.ts +14 -12
- package/src/types.ts +0 -12
- package/src/utils/array-equal.ts +6 -7
- package/src/utils/array-utils-flat.ts +1 -31
- package/src/utils/is-array.ts +5 -5
- package/src/utils/{utils.ts → uid.ts} +0 -12
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +0 -1
- package/dist/adapter/types/accessor.d.ts +0 -23
- package/dist/adapter/types/accessor.d.ts.map +0 -1
- package/dist/adapter/types/shader-types.d.ts.map +0 -1
- package/dist/adapter/types/texture-formats.d.ts.map +0 -1
- package/dist/adapter/types/types.d.ts.map +0 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +0 -1
- package/dist/lib/compiler-log/compiler-message.d.ts.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.d.ts +0 -9
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js +0 -29
- package/dist/lib/luma.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-block.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-store.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.d.ts +0 -10
- package/dist/lib/uniforms/uniform.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.js +0 -20
- package/dist/utils/assert.d.ts +0 -2
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/assert.js +0 -10
- package/dist/utils/cast.d.ts +0 -3
- package/dist/utils/cast.d.ts.map +0 -1
- package/dist/utils/cast.js +0 -7
- package/dist/utils/check-props.d.ts +0 -7
- package/dist/utils/check-props.d.ts.map +0 -1
- package/dist/utils/check-props.js +0 -36
- package/dist/utils/deep-equal.d.ts +0 -9
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/deep-equal.js +0 -50
- package/dist/utils/format-value.d.ts +0 -7
- package/dist/utils/format-value.d.ts.map +0 -1
- package/dist/utils/format-value.js +0 -39
- package/dist/utils/load-file.d.ts +0 -35
- package/dist/utils/load-file.d.ts.map +0 -1
- package/dist/utils/load-file.js +0 -74
- package/dist/utils/random.d.ts +0 -5
- package/dist/utils/random.d.ts.map +0 -1
- package/dist/utils/random.js +0 -18
- package/dist/utils/request-animation-frame.d.ts +0 -3
- package/dist/utils/request-animation-frame.d.ts.map +0 -1
- package/dist/utils/request-animation-frame.js +0 -16
- package/dist/utils/stub-methods.d.ts +0 -2
- package/dist/utils/stub-methods.d.ts.map +0 -1
- package/dist/utils/stub-methods.js +0 -19
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.d.ts.map +0 -1
- package/src/adapter/types/accessor.ts +0 -37
- package/src/lib/compiler-log/get-shader-info.ts +0 -42
- package/src/lib/uniforms/uniform.ts +0 -31
- package/src/utils/assert.ts +0 -11
- package/src/utils/cast.ts +0 -8
- package/src/utils/check-props.ts +0 -82
- package/src/utils/deep-equal.ts +0 -51
- package/src/utils/format-value.ts +0 -47
- package/src/utils/load-file.ts +0 -91
- package/src/utils/random.ts +0 -21
- package/src/utils/request-animation-frame.ts +0 -19
- package/src/utils/stub-methods.ts +0 -29
- /package/dist/adapter/types/{accessor.js → attachments.js} +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.d.ts +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.js +0 -0
- /package/dist/adapter/types/{shader-types.js → uniforms.js} +0 -0
- /package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/shader-types.d.ts +0 -0
- /package/dist/{adapter/types/texture-formats.js → gpu-type-utils/shader-types.js} +0 -0
- /package/dist/{adapter/types/types.js → gpu-type-utils/texture-formats.js} +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.d.ts +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.js +0 -0
- /package/src/{lib/compiler-log → adapter/types}/compiler-message.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/shader-types.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/vertex-formats.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,6 @@ __export(dist_exports, {
|
|
|
42
42
|
Resource: () => Resource,
|
|
43
43
|
Sampler: () => Sampler,
|
|
44
44
|
Shader: () => Shader,
|
|
45
|
-
StatsManager: () => StatsManager,
|
|
46
45
|
Texture: () => Texture,
|
|
47
46
|
TextureView: () => TextureView,
|
|
48
47
|
TransformFeedback: () => TransformFeedback,
|
|
@@ -51,18 +50,10 @@ __export(dist_exports, {
|
|
|
51
50
|
UniformStore: () => UniformStore,
|
|
52
51
|
VERSION: () => VERSION,
|
|
53
52
|
VertexArray: () => VertexArray,
|
|
54
|
-
assert: () => assert,
|
|
55
|
-
cancelAnimationFrame: () => cancelAnimationFrame,
|
|
56
|
-
cast: () => cast,
|
|
57
|
-
checkProps: () => checkProps,
|
|
58
53
|
decodeShaderAttributeType: () => decodeShaderAttributeType,
|
|
59
54
|
decodeShaderUniformType: () => decodeShaderUniformType,
|
|
60
55
|
decodeTextureFormat: () => decodeTextureFormat,
|
|
61
56
|
decodeVertexFormat: () => decodeVertexFormat,
|
|
62
|
-
deepEqual: () => deepEqual,
|
|
63
|
-
fillArray: () => fillArray,
|
|
64
|
-
formatCompilerLog: () => formatCompilerLog,
|
|
65
|
-
formatValue: () => formatValue,
|
|
66
57
|
getAttributeInfosFromLayouts: () => getAttributeInfosFromLayouts,
|
|
67
58
|
getDataTypeFromTypedArray: () => getDataTypeFromTypedArray,
|
|
68
59
|
getScratchArray: () => getScratchArray,
|
|
@@ -70,24 +61,8 @@ __export(dist_exports, {
|
|
|
70
61
|
getTypedArrayFromDataType: () => getTypedArrayFromDataType,
|
|
71
62
|
getVertexFormatFromAttribute: () => getVertexFormatFromAttribute,
|
|
72
63
|
glsl: () => glsl,
|
|
73
|
-
isNumberArray: () => isNumberArray,
|
|
74
|
-
isObjectEmpty: () => isObjectEmpty,
|
|
75
|
-
isTypedArray: () => isTypedArray,
|
|
76
|
-
isUniformValue: () => isUniformValue,
|
|
77
|
-
loadFile: () => loadFile,
|
|
78
|
-
loadImage: () => loadImage,
|
|
79
|
-
loadImageBitmap: () => loadImageBitmap,
|
|
80
|
-
loadScript: () => loadScript,
|
|
81
64
|
log: () => log,
|
|
82
|
-
luma: () => luma
|
|
83
|
-
makeRandomNumberGenerator: () => makeRandomNumberGenerator,
|
|
84
|
-
mergeShaderLayout: () => mergeShaderLayout,
|
|
85
|
-
random: () => random,
|
|
86
|
-
requestAnimationFrame: () => requestAnimationFrame,
|
|
87
|
-
setPathPrefix: () => setPathPrefix,
|
|
88
|
-
splitUniformsAndBindings: () => splitUniformsAndBindings,
|
|
89
|
-
stubRemovedMethods: () => stubRemovedMethods,
|
|
90
|
-
uid: () => uid
|
|
65
|
+
luma: () => luma
|
|
91
66
|
});
|
|
92
67
|
module.exports = __toCommonJS(dist_exports);
|
|
93
68
|
|
|
@@ -116,7 +91,7 @@ var lumaStats = new StatsManager();
|
|
|
116
91
|
|
|
117
92
|
// dist/init.js
|
|
118
93
|
function initializeLuma() {
|
|
119
|
-
const VERSION2 = true ? "9.0.
|
|
94
|
+
const VERSION2 = true ? "9.1.0-alpha.2" : "running from source";
|
|
120
95
|
const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
|
|
121
96
|
if (globalThis.luma && globalThis.luma.VERSION !== VERSION2) {
|
|
122
97
|
throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION2}`);
|
|
@@ -138,32 +113,13 @@ function initializeLuma() {
|
|
|
138
113
|
}
|
|
139
114
|
var VERSION = initializeLuma();
|
|
140
115
|
|
|
141
|
-
// dist/utils/
|
|
142
|
-
function isTypedArray(value) {
|
|
143
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;
|
|
144
|
-
}
|
|
145
|
-
function isNumberArray(value) {
|
|
146
|
-
if (Array.isArray(value)) {
|
|
147
|
-
return value.length === 0 || typeof value[0] === "number" ? value : null;
|
|
148
|
-
}
|
|
149
|
-
return isTypedArray(value);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// dist/utils/utils.js
|
|
116
|
+
// dist/utils/uid.js
|
|
153
117
|
var uidCounters = {};
|
|
154
118
|
function uid(id = "id") {
|
|
155
119
|
uidCounters[id] = uidCounters[id] || 1;
|
|
156
120
|
const count = uidCounters[id]++;
|
|
157
121
|
return `${id}-${count}`;
|
|
158
122
|
}
|
|
159
|
-
function isObjectEmpty(obj) {
|
|
160
|
-
let isEmpty = true;
|
|
161
|
-
for (const key in obj) {
|
|
162
|
-
isEmpty = false;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
return isEmpty;
|
|
166
|
-
}
|
|
167
123
|
|
|
168
124
|
// dist/adapter/resources/resource.js
|
|
169
125
|
var Resource = class {
|
|
@@ -328,14 +284,14 @@ var _Buffer = class extends Resource {
|
|
|
328
284
|
debugData = new ArrayBuffer(0);
|
|
329
285
|
/** This doesn't handle partial non-zero offset updates correctly */
|
|
330
286
|
_setDebugData(data, byteOffset, byteLength) {
|
|
331
|
-
const
|
|
287
|
+
const arrayBuffer2 = ArrayBuffer.isView(data) ? data.buffer : data;
|
|
332
288
|
const debugDataLength = Math.min(data ? data.byteLength : byteLength, _Buffer.DEBUG_DATA_MAX_LENGTH);
|
|
333
|
-
if (
|
|
289
|
+
if (arrayBuffer2 === null) {
|
|
334
290
|
this.debugData = new ArrayBuffer(debugDataLength);
|
|
335
|
-
} else if (byteOffset === 0 && byteLength ===
|
|
336
|
-
this.debugData =
|
|
291
|
+
} else if (byteOffset === 0 && byteLength === arrayBuffer2.byteLength) {
|
|
292
|
+
this.debugData = arrayBuffer2.slice(0, debugDataLength);
|
|
337
293
|
} else {
|
|
338
|
-
this.debugData =
|
|
294
|
+
this.debugData = arrayBuffer2.slice(byteOffset, byteOffset + debugDataLength);
|
|
339
295
|
}
|
|
340
296
|
}
|
|
341
297
|
};
|
|
@@ -369,7 +325,7 @@ __publicField(Buffer2, "QUERY_RESOLVE", 512);
|
|
|
369
325
|
/** Max amount of debug data saved. Two vec4's */
|
|
370
326
|
__publicField(Buffer2, "DEBUG_DATA_MAX_LENGTH", 32);
|
|
371
327
|
|
|
372
|
-
// dist/
|
|
328
|
+
// dist/gpu-type-utils/decode-data-type.js
|
|
373
329
|
function decodeVertexType(type) {
|
|
374
330
|
const dataType = TYPE_MAP[type];
|
|
375
331
|
const bytes = getDataTypeBytes(dataType);
|
|
@@ -413,7 +369,7 @@ var TYPE_SIZES = {
|
|
|
413
369
|
sint32: 4
|
|
414
370
|
};
|
|
415
371
|
|
|
416
|
-
// dist/
|
|
372
|
+
// dist/gpu-type-utils/decode-texture-format.js
|
|
417
373
|
var COMPRESSED_TEXTURE_FORMAT_PREFIXES = [
|
|
418
374
|
"bc1",
|
|
419
375
|
"bc2",
|
|
@@ -503,7 +459,8 @@ var DeviceFeatures = class {
|
|
|
503
459
|
yield* this.features;
|
|
504
460
|
}
|
|
505
461
|
has(feature) {
|
|
506
|
-
|
|
462
|
+
var _a;
|
|
463
|
+
return !((_a = this.disabledFeatures) == null ? void 0 : _a[feature]) && this.features.has(feature);
|
|
507
464
|
}
|
|
508
465
|
};
|
|
509
466
|
var _Device = class {
|
|
@@ -536,6 +493,10 @@ var _Device = class {
|
|
|
536
493
|
loseDevice() {
|
|
537
494
|
return false;
|
|
538
495
|
}
|
|
496
|
+
/** Report error (normally for unhandled device errors) */
|
|
497
|
+
error(error) {
|
|
498
|
+
this.props.onError(error);
|
|
499
|
+
}
|
|
539
500
|
/** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */
|
|
540
501
|
getCanvasContext() {
|
|
541
502
|
if (!this.canvasContext) {
|
|
@@ -543,10 +504,8 @@ var _Device = class {
|
|
|
543
504
|
}
|
|
544
505
|
return this.canvasContext;
|
|
545
506
|
}
|
|
507
|
+
// createTexture(data: Promise<TextureData>): Texture;
|
|
546
508
|
createTexture(props) {
|
|
547
|
-
if (props instanceof Promise || typeof props === "string") {
|
|
548
|
-
props = { data: props };
|
|
549
|
-
}
|
|
550
509
|
return this._createTexture(props);
|
|
551
510
|
}
|
|
552
511
|
createCommandEncoder(props = {}) {
|
|
@@ -620,42 +579,35 @@ __publicField(Device, "defaultProps", {
|
|
|
620
579
|
// width are height are only used by headless gl
|
|
621
580
|
height: 600,
|
|
622
581
|
requestMaxLimits: true,
|
|
582
|
+
// Callbacks
|
|
583
|
+
onError: (error) => log.error(error.message),
|
|
584
|
+
gl: null,
|
|
585
|
+
// alpha: undefined,
|
|
586
|
+
// depth: undefined,
|
|
587
|
+
// stencil: undefined,
|
|
588
|
+
// antialias: undefined,
|
|
589
|
+
// premultipliedAlpha: undefined,
|
|
590
|
+
// preserveDrawingBuffer: undefined,
|
|
591
|
+
// failIfMajorPerformanceCaveat: undefined
|
|
623
592
|
debug: Boolean(log.get("debug")),
|
|
624
593
|
// Instrument context (at the expense of performance)
|
|
625
594
|
spector: Boolean(log.get("spector")),
|
|
626
595
|
// Initialize the SpectorJS WebGL debugger
|
|
627
|
-
break: [],
|
|
596
|
+
break: log.get("break") || [],
|
|
628
597
|
// TODO - Change these after confirming things work as expected
|
|
629
598
|
initalizeFeatures: true,
|
|
630
599
|
disabledFeatures: {
|
|
631
600
|
"compilation-status-async-webgl": true
|
|
632
601
|
},
|
|
633
|
-
|
|
634
|
-
// depth: undefined,
|
|
635
|
-
// stencil: undefined,
|
|
636
|
-
// antialias: undefined,
|
|
637
|
-
// premultipliedAlpha: undefined,
|
|
638
|
-
// preserveDrawingBuffer: undefined,
|
|
639
|
-
// failIfMajorPerformanceCaveat: undefined
|
|
640
|
-
gl: null,
|
|
641
|
-
// Callbacks
|
|
642
|
-
onError: (error) => log.error(error.message)
|
|
602
|
+
_factoryDestroyPolicy: "unused"
|
|
643
603
|
});
|
|
644
604
|
__publicField(Device, "VERSION", VERSION);
|
|
645
605
|
|
|
646
|
-
// dist/
|
|
647
|
-
function assert(condition, message) {
|
|
648
|
-
if (!condition) {
|
|
649
|
-
throw new Error(message || "luma.gl: assertion failed.");
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// dist/lib/luma.js
|
|
606
|
+
// dist/adapter/luma.js
|
|
654
607
|
var deviceMap = /* @__PURE__ */ new Map();
|
|
655
|
-
var
|
|
608
|
+
var _luma = class {
|
|
656
609
|
static registerDevices(deviceClasses) {
|
|
657
610
|
for (const deviceClass of deviceClasses) {
|
|
658
|
-
assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);
|
|
659
611
|
deviceMap.set(deviceClass.type, deviceClass);
|
|
660
612
|
}
|
|
661
613
|
}
|
|
@@ -666,7 +618,7 @@ var luma = class {
|
|
|
666
618
|
return Array.from(deviceMap).filter((Device2) => Device2.isSupported()).map((Device2) => Device2.type);
|
|
667
619
|
}
|
|
668
620
|
static setDefaultDeviceProps(props) {
|
|
669
|
-
Object.assign(
|
|
621
|
+
Object.assign(_luma.defaultProps, props);
|
|
670
622
|
}
|
|
671
623
|
/** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */
|
|
672
624
|
static async attachDevice(props) {
|
|
@@ -688,20 +640,22 @@ var luma = class {
|
|
|
688
640
|
/** Creates a device. Asynchronously. */
|
|
689
641
|
static async createDevice(props = {}) {
|
|
690
642
|
var _a, _b;
|
|
691
|
-
props = { ...
|
|
643
|
+
props = { ..._luma.defaultProps, ...props };
|
|
692
644
|
if (props.gl) {
|
|
693
645
|
props.type = "webgl";
|
|
694
646
|
}
|
|
695
647
|
const devices = getDeviceMap(props.devices) || deviceMap;
|
|
648
|
+
let WebGPUDevice;
|
|
649
|
+
let WebGLDevice;
|
|
696
650
|
switch (props.type) {
|
|
697
651
|
case "webgpu":
|
|
698
|
-
|
|
652
|
+
WebGPUDevice = devices.get("webgpu");
|
|
699
653
|
if (WebGPUDevice) {
|
|
700
654
|
return await WebGPUDevice.create(props);
|
|
701
655
|
}
|
|
702
656
|
break;
|
|
703
657
|
case "webgl":
|
|
704
|
-
|
|
658
|
+
WebGLDevice = devices.get("webgl");
|
|
705
659
|
if (WebGLDevice) {
|
|
706
660
|
return await WebGLDevice.create(props);
|
|
707
661
|
}
|
|
@@ -741,6 +695,7 @@ var luma = class {
|
|
|
741
695
|
};
|
|
742
696
|
}
|
|
743
697
|
};
|
|
698
|
+
var luma = _luma;
|
|
744
699
|
__publicField(luma, "defaultProps", {
|
|
745
700
|
...Device.defaultProps,
|
|
746
701
|
type: "best-available",
|
|
@@ -1050,20 +1005,102 @@ var _Texture = class extends Resource {
|
|
|
1050
1005
|
height;
|
|
1051
1006
|
/** depth of this texture */
|
|
1052
1007
|
depth;
|
|
1008
|
+
/** mip levels in this texture */
|
|
1009
|
+
mipLevels;
|
|
1053
1010
|
/** "Time" of last update. Monotonically increasing timestamp */
|
|
1054
1011
|
updateTimestamp;
|
|
1012
|
+
/** Check if data is an external image */
|
|
1013
|
+
static isExternalImage(data) {
|
|
1014
|
+
return typeof ImageData !== "undefined" && data instanceof ImageData || typeof ImageBitmap !== "undefined" && data instanceof ImageBitmap || typeof HTMLImageElement !== "undefined" && data instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && data instanceof HTMLCanvasElement || typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement;
|
|
1015
|
+
}
|
|
1016
|
+
/** Determine size (width and height) of provided image data */
|
|
1017
|
+
static getExternalImageSize(data) {
|
|
1018
|
+
if (typeof ImageData !== "undefined" && data instanceof ImageData || typeof ImageBitmap !== "undefined" && data instanceof ImageBitmap || typeof HTMLCanvasElement !== "undefined" && data instanceof HTMLCanvasElement) {
|
|
1019
|
+
return { width: data.width, height: data.height };
|
|
1020
|
+
}
|
|
1021
|
+
if (typeof HTMLImageElement !== "undefined" && data instanceof HTMLImageElement) {
|
|
1022
|
+
return { width: data.naturalWidth, height: data.naturalHeight };
|
|
1023
|
+
}
|
|
1024
|
+
if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
|
|
1025
|
+
return { width: data.videoWidth, height: data.videoHeight };
|
|
1026
|
+
}
|
|
1027
|
+
return null;
|
|
1028
|
+
}
|
|
1029
|
+
/** Check if texture data is a typed array */
|
|
1030
|
+
isTextureLevelData(data) {
|
|
1031
|
+
const typedArray = data == null ? void 0 : data.data;
|
|
1032
|
+
return ArrayBuffer.isView(typedArray);
|
|
1033
|
+
}
|
|
1034
|
+
/** Get the size of the texture described by the provided TextureData */
|
|
1035
|
+
getTextureDataSize(data) {
|
|
1036
|
+
if (!data) {
|
|
1037
|
+
return null;
|
|
1038
|
+
}
|
|
1039
|
+
if (ArrayBuffer.isView(data)) {
|
|
1040
|
+
return null;
|
|
1041
|
+
}
|
|
1042
|
+
if (Array.isArray(data)) {
|
|
1043
|
+
return this.getTextureDataSize(data[0]);
|
|
1044
|
+
}
|
|
1045
|
+
if (_Texture.isExternalImage(data)) {
|
|
1046
|
+
return _Texture.getExternalImageSize(data);
|
|
1047
|
+
}
|
|
1048
|
+
if (data && typeof data === "object" && data.constructor === Object) {
|
|
1049
|
+
const untypedData = data;
|
|
1050
|
+
return { width: untypedData.width, height: untypedData.height };
|
|
1051
|
+
}
|
|
1052
|
+
throw new Error("texture size deduction failed");
|
|
1053
|
+
}
|
|
1054
|
+
/** Calculate the number of mip levels for a texture of width and height */
|
|
1055
|
+
getMipLevelCount(width, height) {
|
|
1056
|
+
return Math.floor(Math.log2(Math.max(width, height))) + 1;
|
|
1057
|
+
}
|
|
1058
|
+
/** Convert luma.gl cubemap face constants to depth index */
|
|
1059
|
+
getCubeFaceDepth(face) {
|
|
1060
|
+
switch (face) {
|
|
1061
|
+
case "+X":
|
|
1062
|
+
return 0;
|
|
1063
|
+
case "-X":
|
|
1064
|
+
return 1;
|
|
1065
|
+
case "+Y":
|
|
1066
|
+
return 2;
|
|
1067
|
+
case "-Y":
|
|
1068
|
+
return 3;
|
|
1069
|
+
case "+Z":
|
|
1070
|
+
return 4;
|
|
1071
|
+
case "-Z":
|
|
1072
|
+
return 5;
|
|
1073
|
+
default:
|
|
1074
|
+
throw new Error(face);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1055
1077
|
/** Do not use directly. Create with device.createTexture() */
|
|
1056
|
-
constructor(device, props
|
|
1057
|
-
super(device, props, defaultProps);
|
|
1078
|
+
constructor(device, props) {
|
|
1079
|
+
super(device, props, _Texture.defaultProps);
|
|
1058
1080
|
this.dimension = this.props.dimension;
|
|
1059
1081
|
this.format = this.props.format;
|
|
1060
1082
|
this.width = this.props.width;
|
|
1061
1083
|
this.height = this.props.height;
|
|
1062
1084
|
this.depth = this.props.depth;
|
|
1085
|
+
if (this.props.width === void 0 || this.props.height === void 0) {
|
|
1086
|
+
const size = this.getTextureDataSize(this.props.data);
|
|
1087
|
+
this.width = (size == null ? void 0 : size.width) || 1;
|
|
1088
|
+
this.height = (size == null ? void 0 : size.height) || 1;
|
|
1089
|
+
}
|
|
1090
|
+
if (this.props.mipmaps && this.props.mipLevels === void 0) {
|
|
1091
|
+
this.props.mipLevels = "pyramid";
|
|
1092
|
+
}
|
|
1093
|
+
this.mipLevels = this.props.mipLevels === "pyramid" ? this.getMipLevelCount(this.width, this.height) : this.props.mipLevels || 1;
|
|
1063
1094
|
this.updateTimestamp = device.incrementTimestamp();
|
|
1064
1095
|
}
|
|
1065
1096
|
};
|
|
1066
1097
|
var Texture = _Texture;
|
|
1098
|
+
__publicField(Texture, "COPY_SRC", 1);
|
|
1099
|
+
__publicField(Texture, "COPY_DST", 2);
|
|
1100
|
+
__publicField(Texture, "TEXTURE", 4);
|
|
1101
|
+
__publicField(Texture, "STORAGE", 8);
|
|
1102
|
+
__publicField(Texture, "RENDER_ATTACHMENT", 16);
|
|
1103
|
+
__publicField(Texture, "CubeFaces", ["+X", "-X", "+Y", "-Y", "+Z", "-Z"]);
|
|
1067
1104
|
__publicField(Texture, "defaultProps", {
|
|
1068
1105
|
...Resource.defaultProps,
|
|
1069
1106
|
data: null,
|
|
@@ -1072,23 +1109,14 @@ __publicField(Texture, "defaultProps", {
|
|
|
1072
1109
|
width: void 0,
|
|
1073
1110
|
height: void 0,
|
|
1074
1111
|
depth: 1,
|
|
1075
|
-
mipmaps:
|
|
1076
|
-
// type: undefined,
|
|
1112
|
+
mipmaps: false,
|
|
1077
1113
|
compressed: false,
|
|
1078
|
-
// mipLevels: 1,
|
|
1079
1114
|
usage: 0,
|
|
1080
|
-
// usage: GPUTextureUsage.COPY_DST
|
|
1081
1115
|
mipLevels: void 0,
|
|
1082
1116
|
samples: void 0,
|
|
1083
|
-
type: void 0,
|
|
1084
1117
|
sampler: {},
|
|
1085
1118
|
view: void 0
|
|
1086
1119
|
});
|
|
1087
|
-
__publicField(Texture, "COPY_SRC", 1);
|
|
1088
|
-
__publicField(Texture, "COPY_DST", 2);
|
|
1089
|
-
__publicField(Texture, "TEXTURE_BINDING", 4);
|
|
1090
|
-
__publicField(Texture, "STORAGE_BINDING", 8);
|
|
1091
|
-
__publicField(Texture, "RENDER_ATTACHMENT", 16);
|
|
1092
1120
|
|
|
1093
1121
|
// dist/adapter/resources/texture-view.js
|
|
1094
1122
|
var _TextureView = class extends Resource {
|
|
@@ -1124,11 +1152,11 @@ var _ExternalTexture = class extends Resource {
|
|
|
1124
1152
|
var ExternalTexture = _ExternalTexture;
|
|
1125
1153
|
__publicField(ExternalTexture, "defaultProps", {
|
|
1126
1154
|
...Resource.defaultProps,
|
|
1127
|
-
source:
|
|
1155
|
+
source: void 0,
|
|
1128
1156
|
colorSpace: "srgb"
|
|
1129
1157
|
});
|
|
1130
1158
|
|
|
1131
|
-
// dist/
|
|
1159
|
+
// dist/adapter-utils/format-compiler-log.js
|
|
1132
1160
|
function formatCompilerLog(shaderLog, source, options) {
|
|
1133
1161
|
let formattedLog = "";
|
|
1134
1162
|
const lines = source.split(/\r?\n/);
|
|
@@ -1194,31 +1222,6 @@ function escapeHTML(unsafe) {
|
|
|
1194
1222
|
return unsafe.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1195
1223
|
}
|
|
1196
1224
|
|
|
1197
|
-
// dist/lib/compiler-log/get-shader-info.js
|
|
1198
|
-
function getShaderInfo(source, defaultName) {
|
|
1199
|
-
return {
|
|
1200
|
-
name: getShaderName(source, defaultName),
|
|
1201
|
-
language: "glsl",
|
|
1202
|
-
version: getShaderVersion(source)
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
function getShaderName(shader, defaultName = "unnamed") {
|
|
1206
|
-
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
1207
|
-
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
1208
|
-
return match ? match[1] : defaultName;
|
|
1209
|
-
}
|
|
1210
|
-
function getShaderVersion(source) {
|
|
1211
|
-
let version = 100;
|
|
1212
|
-
const words = source.match(/[^\s]+/g);
|
|
1213
|
-
if (words && words.length >= 2 && words[0] === "#version") {
|
|
1214
|
-
const v = parseInt(words[1], 10);
|
|
1215
|
-
if (Number.isFinite(v)) {
|
|
1216
|
-
version = v;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
return version;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
1225
|
// dist/adapter/resources/shader.js
|
|
1223
1226
|
var _Shader = class extends Resource {
|
|
1224
1227
|
get [Symbol.toStringTag]() {
|
|
@@ -1266,13 +1269,16 @@ var _Shader = class extends Resource {
|
|
|
1266
1269
|
this._displayShaderLog(messages);
|
|
1267
1270
|
}
|
|
1268
1271
|
// PRIVATE
|
|
1269
|
-
/**
|
|
1272
|
+
/**
|
|
1273
|
+
* In-browser UI logging of errors
|
|
1274
|
+
* TODO - this HTML formatting code should not be in Device, should be pluggable
|
|
1275
|
+
*/
|
|
1270
1276
|
_displayShaderLog(messages) {
|
|
1271
1277
|
var _a;
|
|
1272
1278
|
if (typeof document === "undefined" || !(document == null ? void 0 : document.createElement)) {
|
|
1273
1279
|
return;
|
|
1274
1280
|
}
|
|
1275
|
-
const shaderName =
|
|
1281
|
+
const shaderName = getShaderName(this.source);
|
|
1276
1282
|
const shaderTitle = `${this.stage} ${shaderName}`;
|
|
1277
1283
|
let htmlLog = formatCompilerLog(messages, this.source, { showSourceCode: "all", html: true });
|
|
1278
1284
|
const translatedSource = this.getTranslatedSource();
|
|
@@ -1293,9 +1299,7 @@ ${htmlLog}
|
|
|
1293
1299
|
button.style.textAlign = "left";
|
|
1294
1300
|
document.body.appendChild(button);
|
|
1295
1301
|
const errors = document.getElementsByClassName("luma-compiler-log-error");
|
|
1296
|
-
|
|
1297
|
-
errors[0].scrollIntoView();
|
|
1298
|
-
}
|
|
1302
|
+
(_a = errors[0]) == null ? void 0 : _a.scrollIntoView();
|
|
1299
1303
|
button.onclick = () => {
|
|
1300
1304
|
const dataURI = `data:text/plain,${encodeURIComponent(this.source)}`;
|
|
1301
1305
|
navigator.clipboard.writeText(dataURI);
|
|
@@ -1313,7 +1317,12 @@ __publicField(Shader, "defaultProps", {
|
|
|
1313
1317
|
debug: "errors"
|
|
1314
1318
|
});
|
|
1315
1319
|
function getShaderIdFromProps(props) {
|
|
1316
|
-
return
|
|
1320
|
+
return getShaderName(props.source) || props.id || uid(`unnamed ${props.stage}-shader`);
|
|
1321
|
+
}
|
|
1322
|
+
function getShaderName(shader, defaultName = "unnamed") {
|
|
1323
|
+
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
1324
|
+
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
1325
|
+
return match ? match[1] : defaultName;
|
|
1317
1326
|
}
|
|
1318
1327
|
|
|
1319
1328
|
// dist/adapter/resources/sampler.js
|
|
@@ -1351,10 +1360,6 @@ var _Framebuffer = class extends Resource {
|
|
|
1351
1360
|
width;
|
|
1352
1361
|
/** Height of all attachments in this framebuffer */
|
|
1353
1362
|
height;
|
|
1354
|
-
/** Color attachments */
|
|
1355
|
-
colorAttachments = [];
|
|
1356
|
-
/** Depth-stencil attachment, if provided */
|
|
1357
|
-
depthStencilAttachment = null;
|
|
1358
1363
|
constructor(device, props = {}) {
|
|
1359
1364
|
super(device, props, _Framebuffer.defaultProps);
|
|
1360
1365
|
this.width = this.props.width;
|
|
@@ -1431,7 +1436,7 @@ var _Framebuffer = class extends Resource {
|
|
|
1431
1436
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
1432
1437
|
if (this.colorAttachments[i]) {
|
|
1433
1438
|
const resizedTexture = this.device._createTexture({
|
|
1434
|
-
...this.colorAttachments[i].props,
|
|
1439
|
+
...this.colorAttachments[i].texture.props,
|
|
1435
1440
|
width,
|
|
1436
1441
|
height
|
|
1437
1442
|
});
|
|
@@ -1442,7 +1447,7 @@ var _Framebuffer = class extends Resource {
|
|
|
1442
1447
|
}
|
|
1443
1448
|
if (this.depthStencilAttachment) {
|
|
1444
1449
|
const resizedTexture = this.device._createTexture({
|
|
1445
|
-
...this.depthStencilAttachment.props,
|
|
1450
|
+
...this.depthStencilAttachment.texture.props,
|
|
1446
1451
|
width,
|
|
1447
1452
|
height
|
|
1448
1453
|
});
|
|
@@ -1545,8 +1550,11 @@ var _ComputePipeline = class extends Resource {
|
|
|
1545
1550
|
return "ComputePipeline";
|
|
1546
1551
|
}
|
|
1547
1552
|
hash = "";
|
|
1553
|
+
/** The merged shader layout */
|
|
1554
|
+
shaderLayout;
|
|
1548
1555
|
constructor(device, props) {
|
|
1549
1556
|
super(device, props, _ComputePipeline.defaultProps);
|
|
1557
|
+
this.shaderLayout = props.shaderLayout;
|
|
1550
1558
|
}
|
|
1551
1559
|
};
|
|
1552
1560
|
var ComputePipeline = _ComputePipeline;
|
|
@@ -1604,7 +1612,7 @@ __publicField(CommandBuffer, "defaultProps", {
|
|
|
1604
1612
|
...Resource.defaultProps
|
|
1605
1613
|
});
|
|
1606
1614
|
|
|
1607
|
-
// dist/
|
|
1615
|
+
// dist/gpu-type-utils/decode-attribute-type.js
|
|
1608
1616
|
function decodeShaderAttributeType(attributeType) {
|
|
1609
1617
|
const [dataType, components] = TYPE_INFO[attributeType];
|
|
1610
1618
|
const integer = dataType === "i32" || dataType === "u32";
|
|
@@ -1666,7 +1674,7 @@ var TYPE_SIZES2 = {
|
|
|
1666
1674
|
// 'bool-webgl': 4,
|
|
1667
1675
|
};
|
|
1668
1676
|
|
|
1669
|
-
// dist/
|
|
1677
|
+
// dist/gpu-type-utils/decode-vertex-format.js
|
|
1670
1678
|
function decodeVertexFormat(format) {
|
|
1671
1679
|
let webglOnly;
|
|
1672
1680
|
if (format.endsWith("-webgl")) {
|
|
@@ -1691,11 +1699,14 @@ function decodeVertexFormat(format) {
|
|
|
1691
1699
|
return result;
|
|
1692
1700
|
}
|
|
1693
1701
|
|
|
1694
|
-
// dist/adapter
|
|
1702
|
+
// dist/adapter-utils/get-attribute-from-layouts.js
|
|
1695
1703
|
function getAttributeInfosFromLayouts(shaderLayout, bufferLayout) {
|
|
1696
1704
|
const attributeInfos = {};
|
|
1697
1705
|
for (const attribute of shaderLayout.attributes) {
|
|
1698
|
-
|
|
1706
|
+
const attributeInfo = getAttributeInfoFromLayouts(shaderLayout, bufferLayout, attribute.name);
|
|
1707
|
+
if (attributeInfo) {
|
|
1708
|
+
attributeInfos[attribute.name] = attributeInfo;
|
|
1709
|
+
}
|
|
1699
1710
|
}
|
|
1700
1711
|
return attributeInfos;
|
|
1701
1712
|
}
|
|
@@ -1730,7 +1741,7 @@ function getAttributeInfoFromLayouts(shaderLayout, bufferLayout, name2) {
|
|
|
1730
1741
|
normalized: vertexFormatInfo.normalized,
|
|
1731
1742
|
// integer is a property of the shader declaration
|
|
1732
1743
|
integer: attributeTypeInfo.integer,
|
|
1733
|
-
stepMode: (bufferMapping == null ? void 0 : bufferMapping.stepMode) || shaderDeclaration.stepMode,
|
|
1744
|
+
stepMode: (bufferMapping == null ? void 0 : bufferMapping.stepMode) || shaderDeclaration.stepMode || "vertex",
|
|
1734
1745
|
byteOffset: (bufferMapping == null ? void 0 : bufferMapping.byteOffset) || 0,
|
|
1735
1746
|
byteStride: (bufferMapping == null ? void 0 : bufferMapping.byteStride) || 0
|
|
1736
1747
|
};
|
|
@@ -1796,28 +1807,13 @@ function getAttributeFromAttributesList(bufferLayouts, name2) {
|
|
|
1796
1807
|
stepMode: bufferLayout.stepMode,
|
|
1797
1808
|
vertexFormat: attributeMapping.format,
|
|
1798
1809
|
byteOffset: attributeMapping.byteOffset,
|
|
1810
|
+
// @ts-ignore
|
|
1799
1811
|
byteStride
|
|
1800
1812
|
};
|
|
1801
1813
|
}
|
|
1802
1814
|
}
|
|
1803
1815
|
return null;
|
|
1804
1816
|
}
|
|
1805
|
-
function mergeShaderLayout(baseLayout, overrideLayout) {
|
|
1806
|
-
const mergedLayout = {
|
|
1807
|
-
...baseLayout,
|
|
1808
|
-
attributes: baseLayout.attributes.map((attribute) => ({ ...attribute }))
|
|
1809
|
-
};
|
|
1810
|
-
for (const attribute of (overrideLayout == null ? void 0 : overrideLayout.attributes) || []) {
|
|
1811
|
-
const baseAttribute = mergedLayout.attributes.find((attr) => attr.name === attribute.name);
|
|
1812
|
-
if (!baseAttribute) {
|
|
1813
|
-
log.warn(`shader layout attribute ${attribute.name} not present in shader`);
|
|
1814
|
-
} else {
|
|
1815
|
-
baseAttribute.type = attribute.type || baseAttribute.type;
|
|
1816
|
-
baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
return mergedLayout;
|
|
1820
|
-
}
|
|
1821
1817
|
|
|
1822
1818
|
// dist/adapter/resources/vertex-array.js
|
|
1823
1819
|
var _VertexArray = class extends Resource {
|
|
@@ -1836,7 +1832,11 @@ var _VertexArray = class extends Resource {
|
|
|
1836
1832
|
super(device, props, _VertexArray.defaultProps);
|
|
1837
1833
|
this.maxVertexAttributes = device.limits.maxVertexAttributes;
|
|
1838
1834
|
this.attributes = new Array(this.maxVertexAttributes).fill(null);
|
|
1839
|
-
|
|
1835
|
+
const { shaderLayout, bufferLayout } = props.renderPipeline || {};
|
|
1836
|
+
if (!shaderLayout || !bufferLayout) {
|
|
1837
|
+
throw new Error("VertexArray");
|
|
1838
|
+
}
|
|
1839
|
+
this.attributeInfos = getAttributeInfosByLocation(shaderLayout, bufferLayout, this.maxVertexAttributes);
|
|
1840
1840
|
}
|
|
1841
1841
|
// DEPRECATED METHODS
|
|
1842
1842
|
/** @deprecated Set constant attributes (WebGL only) */
|
|
@@ -1882,7 +1882,7 @@ __publicField(QuerySet, "defaultProps", {
|
|
|
1882
1882
|
count: void 0
|
|
1883
1883
|
});
|
|
1884
1884
|
|
|
1885
|
-
// dist/
|
|
1885
|
+
// dist/gpu-type-utils/decode-shader-types.js
|
|
1886
1886
|
var UNIFORM_FORMATS = {
|
|
1887
1887
|
f32: { type: "f32", components: 1 },
|
|
1888
1888
|
i32: { type: "i32", components: 1 },
|
|
@@ -1909,7 +1909,6 @@ var UNIFORM_FORMATS = {
|
|
|
1909
1909
|
};
|
|
1910
1910
|
function decodeShaderUniformType(format) {
|
|
1911
1911
|
const decoded = UNIFORM_FORMATS[format];
|
|
1912
|
-
assert(format);
|
|
1913
1912
|
return decoded;
|
|
1914
1913
|
}
|
|
1915
1914
|
function alignTo(size, count) {
|
|
@@ -1935,27 +1934,19 @@ function getScratchArray(Type, length) {
|
|
|
1935
1934
|
const scratchArrayBuffer = getScratchArrayBuffer(Type.BYTES_PER_ELEMENT * length);
|
|
1936
1935
|
return new Type(scratchArrayBuffer, 0, length);
|
|
1937
1936
|
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
while (copied < total) {
|
|
1947
|
-
if (copied < total - copied) {
|
|
1948
|
-
target.copyWithin(start + copied, start, start + copied);
|
|
1949
|
-
copied *= 2;
|
|
1950
|
-
} else {
|
|
1951
|
-
target.copyWithin(start + copied, start, start + total - copied);
|
|
1952
|
-
copied = total;
|
|
1953
|
-
}
|
|
1937
|
+
|
|
1938
|
+
// dist/utils/is-array.js
|
|
1939
|
+
function isTypedArray(value) {
|
|
1940
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
1941
|
+
}
|
|
1942
|
+
function isNumberArray(value) {
|
|
1943
|
+
if (Array.isArray(value)) {
|
|
1944
|
+
return value.length === 0 || typeof value[0] === "number";
|
|
1954
1945
|
}
|
|
1955
|
-
return
|
|
1946
|
+
return isTypedArray(value);
|
|
1956
1947
|
}
|
|
1957
1948
|
|
|
1958
|
-
// dist/
|
|
1949
|
+
// dist/portable/uniform-buffer-layout.js
|
|
1959
1950
|
var minBufferSize = 1024;
|
|
1960
1951
|
var UniformBufferLayout = class {
|
|
1961
1952
|
layout = {};
|
|
@@ -2002,12 +1993,11 @@ var UniformBufferLayout = class {
|
|
|
2002
1993
|
}
|
|
2003
1994
|
typedArray[offset] = Number(value);
|
|
2004
1995
|
} else {
|
|
2005
|
-
|
|
2006
|
-
if (!numericArray) {
|
|
1996
|
+
if (!isNumberArray(value)) {
|
|
2007
1997
|
log.warn(`Supplied value for multi component / array uniform ${name2} is not a numeric array: ${value}`)();
|
|
2008
1998
|
continue;
|
|
2009
1999
|
}
|
|
2010
|
-
typedArray.set(
|
|
2000
|
+
typedArray.set(value, offset);
|
|
2011
2001
|
}
|
|
2012
2002
|
}
|
|
2013
2003
|
return new Uint8Array(arrayBuffer2);
|
|
@@ -2028,12 +2018,12 @@ function arrayEqual(a, b, limit = 16) {
|
|
|
2028
2018
|
if (a !== b) {
|
|
2029
2019
|
return false;
|
|
2030
2020
|
}
|
|
2031
|
-
const arrayA =
|
|
2032
|
-
|
|
2021
|
+
const arrayA = a;
|
|
2022
|
+
const arrayB = b;
|
|
2023
|
+
if (!isNumberArray(arrayA)) {
|
|
2033
2024
|
return false;
|
|
2034
2025
|
}
|
|
2035
|
-
|
|
2036
|
-
if (arrayB && arrayA.length === arrayB.length) {
|
|
2026
|
+
if (isNumberArray(arrayB) && arrayA.length === arrayB.length) {
|
|
2037
2027
|
for (let i = 0; i < arrayA.length; ++i) {
|
|
2038
2028
|
if (arrayB[i] !== arrayA[i]) {
|
|
2039
2029
|
return false;
|
|
@@ -2043,14 +2033,13 @@ function arrayEqual(a, b, limit = 16) {
|
|
|
2043
2033
|
return true;
|
|
2044
2034
|
}
|
|
2045
2035
|
function arrayCopy(a) {
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
return numberArray.slice();
|
|
2036
|
+
if (isNumberArray(a)) {
|
|
2037
|
+
return a.slice();
|
|
2049
2038
|
}
|
|
2050
2039
|
return a;
|
|
2051
2040
|
}
|
|
2052
2041
|
|
|
2053
|
-
// dist/
|
|
2042
|
+
// dist/portable/uniform-block.js
|
|
2054
2043
|
var UniformBlock = class {
|
|
2055
2044
|
name;
|
|
2056
2045
|
uniforms = {};
|
|
@@ -2060,7 +2049,7 @@ var UniformBlock = class {
|
|
|
2060
2049
|
needsRedraw = "initialized";
|
|
2061
2050
|
constructor(props) {
|
|
2062
2051
|
var _a;
|
|
2063
|
-
this.name = props == null ? void 0 : props.name;
|
|
2052
|
+
this.name = (props == null ? void 0 : props.name) || "unnamed";
|
|
2064
2053
|
if ((props == null ? void 0 : props.name) && (props == null ? void 0 : props.shaderLayout)) {
|
|
2065
2054
|
const binding = (_a = props == null ? void 0 : props.shaderLayout.bindings) == null ? void 0 : _a.find((binding2) => binding2.type === "uniform" && binding2.name === (props == null ? void 0 : props.name));
|
|
2066
2055
|
if (!binding) {
|
|
@@ -2101,7 +2090,7 @@ var UniformBlock = class {
|
|
|
2101
2090
|
}
|
|
2102
2091
|
};
|
|
2103
2092
|
|
|
2104
|
-
// dist/
|
|
2093
|
+
// dist/portable/uniform-store.js
|
|
2105
2094
|
var UniformStore = class {
|
|
2106
2095
|
/** Stores the uniform values for each uniform block */
|
|
2107
2096
|
uniformBlocks = /* @__PURE__ */ new Map();
|
|
@@ -2134,19 +2123,22 @@ var UniformStore = class {
|
|
|
2134
2123
|
* Makes all properties partial
|
|
2135
2124
|
*/
|
|
2136
2125
|
setUniforms(uniforms) {
|
|
2126
|
+
var _a;
|
|
2137
2127
|
for (const [blockName, uniformValues] of Object.entries(uniforms)) {
|
|
2138
|
-
this.uniformBlocks.get(blockName).setUniforms(uniformValues);
|
|
2128
|
+
(_a = this.uniformBlocks.get(blockName)) == null ? void 0 : _a.setUniforms(uniformValues);
|
|
2139
2129
|
}
|
|
2140
2130
|
this.updateUniformBuffers();
|
|
2141
2131
|
}
|
|
2142
2132
|
/** Get the required minimum length of the uniform buffer */
|
|
2143
2133
|
getUniformBufferByteLength(uniformBufferName) {
|
|
2144
|
-
|
|
2134
|
+
var _a;
|
|
2135
|
+
return ((_a = this.uniformBufferLayouts.get(uniformBufferName)) == null ? void 0 : _a.byteLength) || 0;
|
|
2145
2136
|
}
|
|
2146
2137
|
/** Get formatted binary memory that can be uploaded to a buffer */
|
|
2147
2138
|
getUniformBufferData(uniformBufferName) {
|
|
2148
|
-
|
|
2149
|
-
|
|
2139
|
+
var _a, _b;
|
|
2140
|
+
const uniformValues = ((_a = this.uniformBlocks.get(uniformBufferName)) == null ? void 0 : _a.getAllUniforms()) || {};
|
|
2141
|
+
return (_b = this.uniformBufferLayouts.get(uniformBufferName)) == null ? void 0 : _b.getData(uniformValues);
|
|
2150
2142
|
}
|
|
2151
2143
|
/**
|
|
2152
2144
|
* Creates an unmanaged uniform buffer (umnanaged means that application is responsible for destroying it)
|
|
@@ -2191,22 +2183,23 @@ var UniformStore = class {
|
|
|
2191
2183
|
}
|
|
2192
2184
|
/** Update one uniform buffer. Only updates if values have changed */
|
|
2193
2185
|
updateUniformBuffer(uniformBufferName) {
|
|
2186
|
+
var _a;
|
|
2194
2187
|
const uniformBlock = this.uniformBlocks.get(uniformBufferName);
|
|
2195
2188
|
const uniformBuffer = this.uniformBuffers.get(uniformBufferName);
|
|
2196
2189
|
let reason = false;
|
|
2197
|
-
if (uniformBuffer && uniformBlock.needsRedraw) {
|
|
2190
|
+
if (uniformBuffer && (uniformBlock == null ? void 0 : uniformBlock.needsRedraw)) {
|
|
2198
2191
|
reason ||= uniformBlock.needsRedraw;
|
|
2199
2192
|
const uniformBufferData = this.getUniformBufferData(uniformBufferName);
|
|
2200
2193
|
const uniformBuffer2 = this.uniformBuffers.get(uniformBufferName);
|
|
2201
|
-
uniformBuffer2.write(uniformBufferData);
|
|
2202
|
-
const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();
|
|
2194
|
+
uniformBuffer2 == null ? void 0 : uniformBuffer2.write(uniformBufferData);
|
|
2195
|
+
const uniformValues = (_a = this.uniformBlocks.get(uniformBufferName)) == null ? void 0 : _a.getAllUniforms();
|
|
2203
2196
|
log.log(4, `Writing to uniform buffer ${String(uniformBufferName)}`, uniformBufferData, uniformValues)();
|
|
2204
2197
|
}
|
|
2205
2198
|
return reason;
|
|
2206
2199
|
}
|
|
2207
2200
|
};
|
|
2208
2201
|
|
|
2209
|
-
// dist/
|
|
2202
|
+
// dist/gpu-type-utils/vertex-format-from-attribute.js
|
|
2210
2203
|
function getDataTypeFromTypedArray(arrayOrType) {
|
|
2211
2204
|
const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
|
|
2212
2205
|
switch (type) {
|
|
@@ -2283,220 +2276,6 @@ function getVertexFormatFromAttribute(typedArray, size, normalized) {
|
|
|
2283
2276
|
return `${dataType}x${components}`;
|
|
2284
2277
|
}
|
|
2285
2278
|
|
|
2286
|
-
// dist/utils/cast.js
|
|
2287
|
-
function cast(value) {
|
|
2288
|
-
return value;
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
// dist/lib/uniforms/uniform.js
|
|
2292
|
-
function isUniformValue(value) {
|
|
2293
|
-
return isNumberArray(value) !== null || typeof value === "number" || typeof value === "boolean";
|
|
2294
|
-
}
|
|
2295
|
-
function splitUniformsAndBindings(uniforms) {
|
|
2296
|
-
const result = { bindings: {}, uniforms: {} };
|
|
2297
|
-
Object.keys(uniforms).forEach((name2) => {
|
|
2298
|
-
const uniform = uniforms[name2];
|
|
2299
|
-
if (isUniformValue(uniform)) {
|
|
2300
|
-
result.uniforms[name2] = uniform;
|
|
2301
|
-
} else {
|
|
2302
|
-
result.bindings[name2] = uniform;
|
|
2303
|
-
}
|
|
2304
|
-
});
|
|
2305
|
-
return result;
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
// dist/utils/format-value.js
|
|
2309
|
-
function formatArrayValue(v, opts = {}) {
|
|
2310
|
-
const { maxElts = 16, size = 1 } = opts;
|
|
2311
|
-
let string = "[";
|
|
2312
|
-
for (let i = 0; i < v.length && i < maxElts; ++i) {
|
|
2313
|
-
if (i > 0) {
|
|
2314
|
-
string += `,${i % size === 0 ? " " : ""}`;
|
|
2315
|
-
}
|
|
2316
|
-
string += formatValue(v[i], opts);
|
|
2317
|
-
}
|
|
2318
|
-
const terminator = v.length > maxElts ? "..." : "]";
|
|
2319
|
-
return `${string}${terminator}`;
|
|
2320
|
-
}
|
|
2321
|
-
function formatValue(v, opts = {}) {
|
|
2322
|
-
const EPSILON = 1e-16;
|
|
2323
|
-
const { isInteger = false } = opts;
|
|
2324
|
-
if (Array.isArray(v) || ArrayBuffer.isView(v)) {
|
|
2325
|
-
return formatArrayValue(v, opts);
|
|
2326
|
-
}
|
|
2327
|
-
if (typeof v !== "number") {
|
|
2328
|
-
return String(v);
|
|
2329
|
-
}
|
|
2330
|
-
if (Math.abs(v) < EPSILON) {
|
|
2331
|
-
return isInteger ? "0" : "0.";
|
|
2332
|
-
}
|
|
2333
|
-
if (isInteger) {
|
|
2334
|
-
return v.toFixed(0);
|
|
2335
|
-
}
|
|
2336
|
-
if (Math.abs(v) > 100 && Math.abs(v) < 1e4) {
|
|
2337
|
-
return v.toFixed(0);
|
|
2338
|
-
}
|
|
2339
|
-
const string = v.toPrecision(2);
|
|
2340
|
-
const decimal = string.indexOf(".0");
|
|
2341
|
-
return decimal === string.length - 2 ? string.slice(0, -1) : string;
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
// dist/utils/stub-methods.js
|
|
2345
|
-
function stubRemovedMethods(instance, className, version, methodNames) {
|
|
2346
|
-
const upgradeMessage = `See luma.gl ${version} Upgrade Guide at https://luma.gl/docs/upgrade-guide`;
|
|
2347
|
-
const prototype = Object.getPrototypeOf(instance);
|
|
2348
|
-
methodNames.forEach((methodName) => {
|
|
2349
|
-
if (prototype.methodName) {
|
|
2350
|
-
return;
|
|
2351
|
-
}
|
|
2352
|
-
prototype[methodName] = () => {
|
|
2353
|
-
log.removed(`Calling removed method ${className}.${methodName}: `, upgradeMessage)();
|
|
2354
|
-
throw new Error(methodName);
|
|
2355
|
-
};
|
|
2356
|
-
});
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
|
-
// dist/utils/check-props.js
|
|
2360
|
-
function checkProps(className, props, propChecks) {
|
|
2361
|
-
const { removedProps = {}, deprecatedProps = {}, replacedProps = {} } = propChecks;
|
|
2362
|
-
for (const propName in removedProps) {
|
|
2363
|
-
if (propName in props) {
|
|
2364
|
-
const replacementProp = removedProps[propName];
|
|
2365
|
-
const replacement = replacementProp ? `${className}.${removedProps[propName]}` : "N/A";
|
|
2366
|
-
log.removed(`${className}.${propName}`, replacement)();
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
for (const propName in deprecatedProps) {
|
|
2370
|
-
if (propName in props) {
|
|
2371
|
-
const replacementProp = deprecatedProps[propName];
|
|
2372
|
-
log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
let newProps = null;
|
|
2376
|
-
for (const [propName, replacementProp] of Object.entries(replacedProps)) {
|
|
2377
|
-
if (propName in props) {
|
|
2378
|
-
log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();
|
|
2379
|
-
newProps = newProps || Object.assign({}, props);
|
|
2380
|
-
newProps[replacementProp] = props[propName];
|
|
2381
|
-
delete newProps[propName];
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
return newProps || props;
|
|
2385
|
-
}
|
|
2386
|
-
|
|
2387
|
-
// dist/utils/load-file.js
|
|
2388
|
-
var pathPrefix = "";
|
|
2389
|
-
function setPathPrefix(prefix) {
|
|
2390
|
-
pathPrefix = prefix;
|
|
2391
|
-
}
|
|
2392
|
-
async function loadFile(url, options) {
|
|
2393
|
-
url = url.startsWith("http") ? url : pathPrefix + url;
|
|
2394
|
-
const dataType = (options == null ? void 0 : options.dataType) || "text";
|
|
2395
|
-
const response = await fetch(url, options);
|
|
2396
|
-
return await response[dataType]();
|
|
2397
|
-
}
|
|
2398
|
-
async function loadImageBitmap(url, opts) {
|
|
2399
|
-
const image = new Image();
|
|
2400
|
-
image.crossOrigin = (opts == null ? void 0 : opts.crossOrigin) || "anonymous";
|
|
2401
|
-
image.src = url.startsWith("http") ? url : pathPrefix + url;
|
|
2402
|
-
await image.decode();
|
|
2403
|
-
return await createImageBitmap(image);
|
|
2404
|
-
}
|
|
2405
|
-
async function loadImage(url, opts) {
|
|
2406
|
-
return await new Promise((resolve, reject) => {
|
|
2407
|
-
try {
|
|
2408
|
-
const image = new Image();
|
|
2409
|
-
image.onload = () => resolve(image);
|
|
2410
|
-
image.onerror = () => reject(new Error(`Could not load image ${url}.`));
|
|
2411
|
-
image.crossOrigin = (opts == null ? void 0 : opts.crossOrigin) || "anonymous";
|
|
2412
|
-
image.src = url.startsWith("http") ? url : pathPrefix + url;
|
|
2413
|
-
} catch (error) {
|
|
2414
|
-
reject(error);
|
|
2415
|
-
}
|
|
2416
|
-
});
|
|
2417
|
-
}
|
|
2418
|
-
async function loadScript(scriptUrl, scriptId) {
|
|
2419
|
-
const head = document.getElementsByTagName("head")[0];
|
|
2420
|
-
if (!head) {
|
|
2421
|
-
throw new Error("loadScript");
|
|
2422
|
-
}
|
|
2423
|
-
const script = document.createElement("script");
|
|
2424
|
-
script.setAttribute("type", "text/javascript");
|
|
2425
|
-
script.setAttribute("src", scriptUrl);
|
|
2426
|
-
if (scriptId) {
|
|
2427
|
-
script.id = scriptId;
|
|
2428
|
-
}
|
|
2429
|
-
return new Promise((resolve, reject) => {
|
|
2430
|
-
script.onload = resolve;
|
|
2431
|
-
script.onerror = (error) => reject(new Error(`Unable to load script '${scriptUrl}': ${error}`));
|
|
2432
|
-
head.appendChild(script);
|
|
2433
|
-
});
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
// dist/utils/random.js
|
|
2437
|
-
function makeRandomNumberGenerator() {
|
|
2438
|
-
let s = 1;
|
|
2439
|
-
let c = 1;
|
|
2440
|
-
return () => {
|
|
2441
|
-
s = Math.sin(c * 17.23);
|
|
2442
|
-
c = Math.cos(s * 27.92);
|
|
2443
|
-
return fract(Math.abs(s * c) * 1432.71);
|
|
2444
|
-
};
|
|
2445
|
-
}
|
|
2446
|
-
function fract(n) {
|
|
2447
|
-
return n - Math.floor(n);
|
|
2448
|
-
}
|
|
2449
|
-
var random = makeRandomNumberGenerator();
|
|
2450
|
-
|
|
2451
|
-
// dist/utils/deep-equal.js
|
|
2452
|
-
function deepEqual(a, b, depth) {
|
|
2453
|
-
if (a === b) {
|
|
2454
|
-
return true;
|
|
2455
|
-
}
|
|
2456
|
-
if (!depth || !a || !b) {
|
|
2457
|
-
return false;
|
|
2458
|
-
}
|
|
2459
|
-
if (Array.isArray(a)) {
|
|
2460
|
-
if (!Array.isArray(b) || a.length !== b.length) {
|
|
2461
|
-
return false;
|
|
2462
|
-
}
|
|
2463
|
-
for (let i = 0; i < a.length; i++) {
|
|
2464
|
-
if (!deepEqual(a[i], b[i], depth - 1)) {
|
|
2465
|
-
return false;
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
return true;
|
|
2469
|
-
}
|
|
2470
|
-
if (Array.isArray(b)) {
|
|
2471
|
-
return false;
|
|
2472
|
-
}
|
|
2473
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
2474
|
-
const aKeys = Object.keys(a);
|
|
2475
|
-
const bKeys = Object.keys(b);
|
|
2476
|
-
if (aKeys.length !== bKeys.length) {
|
|
2477
|
-
return false;
|
|
2478
|
-
}
|
|
2479
|
-
for (const key of aKeys) {
|
|
2480
|
-
if (!b.hasOwnProperty(key)) {
|
|
2481
|
-
return false;
|
|
2482
|
-
}
|
|
2483
|
-
if (!deepEqual(a[key], b[key], depth - 1)) {
|
|
2484
|
-
return false;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
return true;
|
|
2488
|
-
}
|
|
2489
|
-
return false;
|
|
2490
|
-
}
|
|
2491
|
-
|
|
2492
|
-
// dist/utils/request-animation-frame.js
|
|
2493
|
-
function requestAnimationFrame(callback) {
|
|
2494
|
-
return typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame(callback) : setTimeout(callback, 1e3 / 60);
|
|
2495
|
-
}
|
|
2496
|
-
function cancelAnimationFrame(timerId) {
|
|
2497
|
-
return typeof window !== "undefined" && window.cancelAnimationFrame ? window.cancelAnimationFrame(timerId) : clearTimeout(timerId);
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
2279
|
// dist/index.js
|
|
2501
2280
|
var glsl = (x) => `${x}`;
|
|
2502
2281
|
//# sourceMappingURL=index.cjs.map
|