@luma.gl/engine 9.1.0-alpha.15 → 9.1.0-alpha.16
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/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +2 -1
- package/dist/async-texture/async-texture.d.ts +1 -1
- package/dist/async-texture/async-texture.d.ts.map +1 -1
- package/dist/async-texture/async-texture.js +7 -1
- package/dist/compute/computation.d.ts +2 -2
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +3 -3
- package/dist/compute/swap.d.ts +27 -1
- package/dist/compute/swap.d.ts.map +1 -1
- package/dist/compute/swap.js +44 -0
- package/dist/dist.dev.js +418 -27
- package/dist/dist.min.js +117 -2
- package/dist/factories/pipeline-factory.d.ts.map +1 -0
- package/dist/factories/shader-factory.d.ts.map +1 -0
- package/dist/index.cjs +415 -27
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/model/model.d.ts +2 -2
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +17 -14
- package/dist/models/background-texture-model.d.ts +21 -0
- package/dist/models/background-texture-model.d.ts.map +1 -0
- package/dist/models/background-texture-model.js +47 -0
- package/dist/models/clip-space.d.ts +11 -0
- package/dist/models/clip-space.d.ts.map +1 -0
- package/dist/{lib → models}/clip-space.js +29 -1
- package/dist/modules/picking/picking-manager.js +1 -1
- package/dist/passes/get-fragment-shader.d.ts +12 -0
- package/dist/passes/get-fragment-shader.d.ts.map +1 -0
- package/dist/passes/get-fragment-shader.js +116 -0
- package/dist/passes/shader-pass-renderer.d.ts +61 -0
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -0
- package/dist/passes/shader-pass-renderer.js +171 -0
- package/dist/shader-inputs.d.ts +3 -3
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +2 -5
- package/package.json +2 -2
- package/src/animation-loop/make-animation-loop.ts +2 -1
- package/src/async-texture/async-texture.ts +10 -2
- package/src/compute/computation.ts +3 -3
- package/src/compute/swap.ts +57 -1
- package/src/index.ts +15 -6
- package/src/model/model.ts +19 -14
- package/src/models/background-texture-model.ts +64 -0
- package/src/{lib → models}/clip-space.ts +35 -2
- package/src/modules/picking/picking-manager.ts +1 -1
- package/src/passes/get-fragment-shader.ts +129 -0
- package/src/passes/shader-pass-renderer.ts +223 -0
- package/src/shader-inputs.ts +3 -7
- package/dist/lib/clip-space.d.ts +0 -9
- package/dist/lib/clip-space.d.ts.map +0 -1
- package/dist/lib/pipeline-factory.d.ts.map +0 -1
- package/dist/lib/shader-factory.d.ts.map +0 -1
- /package/dist/{lib → factories}/pipeline-factory.d.ts +0 -0
- /package/dist/{lib → factories}/pipeline-factory.js +0 -0
- /package/dist/{lib → factories}/shader-factory.d.ts +0 -0
- /package/dist/{lib → factories}/shader-factory.js +0 -0
- /package/src/{lib → factories}/pipeline-factory.ts +0 -0
- /package/src/{lib → factories}/shader-factory.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/make-animation-loop.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,OAAO,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAChE,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,4BAAyB;AAGnE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,kBAAkB,EAClB,gBAAgB,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,CAC9D,GAAG;IACF,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAC/B,yBAAyB,EAAE,OAAO,qBAAqB,EACvD,KAAK,CAAC,EAAE,sBAAsB,GAC7B,aAAa,
|
|
1
|
+
{"version":3,"file":"make-animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/make-animation-loop.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,OAAO,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAChE,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,4BAAyB;AAGnE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,kBAAkB,EAClB,gBAAgB,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,CAC9D,GAAG;IACF,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAC/B,yBAAyB,EAAE,OAAO,qBAAqB,EACvD,KAAK,CAAC,EAAE,sBAAsB,GAC7B,aAAa,CAoCf"}
|
|
@@ -6,7 +6,8 @@ import { AnimationLoop } from "./animation-loop.js";
|
|
|
6
6
|
/** Instantiates and runs the render loop */
|
|
7
7
|
export function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
|
|
8
8
|
let renderLoop = null;
|
|
9
|
-
const device = props?.device ||
|
|
9
|
+
const device = props?.device ||
|
|
10
|
+
luma.createDevice({ id: 'animation-loop', adapters: props?.adapters, createCanvasContext: true });
|
|
10
11
|
// Create an animation loop;
|
|
11
12
|
const animationLoop = new AnimationLoop({
|
|
12
13
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-texture.d.ts","sourceRoot":"","sources":["../../src/async-texture/async-texture.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,OAAO,EACP,WAAW,EACX,MAAM,EACN,aAAa,EACb,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAA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C,GAAG,OAAO;CAgBvD"}
|
|
@@ -71,9 +71,15 @@ export class AsyncTexture {
|
|
|
71
71
|
if (!this.isReady) {
|
|
72
72
|
throw new Error('Cannot resize texture before it is ready');
|
|
73
73
|
}
|
|
74
|
+
if (size.width === this.texture.width && size.height === this.texture.height) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
74
77
|
if (this.texture) {
|
|
75
|
-
|
|
78
|
+
const texture = this.texture;
|
|
79
|
+
this.texture = texture.clone(size);
|
|
80
|
+
texture.destroy();
|
|
76
81
|
}
|
|
82
|
+
return true;
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
// HELPERS
|
|
@@ -4,8 +4,8 @@ import type { ShaderModule, PlatformInfo } from '@luma.gl/shadertools';
|
|
|
4
4
|
import { ShaderAssembler } from '@luma.gl/shadertools';
|
|
5
5
|
import { TypedArray } from '@math.gl/types';
|
|
6
6
|
import { ShaderInputs } from "../shader-inputs.js";
|
|
7
|
-
import { PipelineFactory } from "../
|
|
8
|
-
import { ShaderFactory } from "../
|
|
7
|
+
import { PipelineFactory } from "../factories/pipeline-factory.js";
|
|
8
|
+
import { ShaderFactory } from "../factories/shader-factory.js";
|
|
9
9
|
export type ComputationProps = Omit<ComputePipelineProps, 'shader'> & {
|
|
10
10
|
source?: string;
|
|
11
11
|
/** shadertool shader modules (added to shader code) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computation.d.ts","sourceRoot":"","sources":["../../src/compute/computation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAgB,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACxF,OAAO,EACL,MAAM,EACN,MAAM,EACN,eAAe,EACf,WAAW,EACX,YAAY,EAGb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAC,eAAe,EAA0B,MAAM,sBAAsB,CAAC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AE,MAAM,GAAG,IAAI;IAI7C,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAUjD;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAkBtD,kBAAkB,IAAI,IAAI;IAI1B;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIpD,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI7C,eAAe,IAAI,eAAe;IAgClC,iCAAiC;IACjC,YAAY,SAAK;IACjB,QAAQ,UAAS;IAEjB,iBAAiB,IAAI,IAAI;IAazB,eAAe,IAAI,IAAI;IAgBvB,SAAS,CAAC,UAAU,SAAK;IAGzB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,EAAE,GAAG,GAAG,MAAM;CAMlF;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAS5D"}
|
|
@@ -5,8 +5,8 @@ import { Buffer, ComputePipeline, UniformStore, log, getTypedArrayFromDataType }
|
|
|
5
5
|
import { ShaderAssembler, getShaderLayoutFromWGSL } from '@luma.gl/shadertools';
|
|
6
6
|
import { isNumericArray } from '@math.gl/types';
|
|
7
7
|
import { ShaderInputs } from "../shader-inputs.js";
|
|
8
|
-
import { PipelineFactory } from "../
|
|
9
|
-
import { ShaderFactory } from "../
|
|
8
|
+
import { PipelineFactory } from "../factories/pipeline-factory.js";
|
|
9
|
+
import { ShaderFactory } from "../factories/shader-factory.js";
|
|
10
10
|
import { uid } from "../utils/uid.js";
|
|
11
11
|
// import {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';
|
|
12
12
|
const LOG_DRAW_PRIORITY = 2;
|
|
@@ -196,7 +196,7 @@ export class Computation {
|
|
|
196
196
|
id: `${this.id}-fragment`,
|
|
197
197
|
stage: 'compute',
|
|
198
198
|
source: this.source,
|
|
199
|
-
|
|
199
|
+
debugShaders: this.props.debugShaders
|
|
200
200
|
});
|
|
201
201
|
this.pipeline = this.pipelineFactory.createComputePipeline({
|
|
202
202
|
...this.props,
|
package/dist/compute/swap.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BufferProps, FramebufferProps } from '@luma.gl/core';
|
|
2
|
+
import { Device, Resource, Buffer, Framebuffer } from '@luma.gl/core';
|
|
2
3
|
/**
|
|
3
4
|
* Helper class for working with repeated transformations / computations
|
|
4
5
|
* Primarily intended for GPU buffers `Swap<Buffer>` or textures `Swap<Texture>`)
|
|
@@ -19,4 +20,29 @@ export declare class Swap<T extends Resource<any>> {
|
|
|
19
20
|
/** Make the next resource into the current resource, and reuse the current resource as the next resource */
|
|
20
21
|
swap(): void;
|
|
21
22
|
}
|
|
23
|
+
/** Helper for managing double-buffered framebuffers */
|
|
24
|
+
export declare class SwapFramebuffers extends Swap<Framebuffer> {
|
|
25
|
+
constructor(device: Device, props: FramebufferProps);
|
|
26
|
+
/**
|
|
27
|
+
* Resizes the Framebuffers.
|
|
28
|
+
* @returns true if the size changed, otherwise exiting framebuffers were preserved
|
|
29
|
+
* @note any contents are not preserved!
|
|
30
|
+
*/
|
|
31
|
+
resize(size: {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}): boolean;
|
|
35
|
+
}
|
|
36
|
+
/** Helper for managing double-buffered GPU buffers */
|
|
37
|
+
export declare class SwapBuffers extends Swap<Buffer> {
|
|
38
|
+
constructor(device: Device, props: BufferProps);
|
|
39
|
+
/**
|
|
40
|
+
* Resizes the Buffers.
|
|
41
|
+
* @returns true if the size changed, otherwise exiting buffers were preserved.
|
|
42
|
+
* @note any contents are not preserved!
|
|
43
|
+
*/
|
|
44
|
+
resize(props: {
|
|
45
|
+
byteLength: number;
|
|
46
|
+
}): boolean;
|
|
47
|
+
}
|
|
22
48
|
//# sourceMappingURL=swap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/compute/swap.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/compute/swap.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACjE,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAEpE;;;;;GAKG;AACH,qBAAa,IAAI,CAAC,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC;IACvC,4EAA4E;IAC5E,OAAO,EAAE,CAAC,CAAC;IACX,uFAAuF;IACvF,IAAI,EAAE,CAAC,CAAC;gBAEI,KAAK,EAAE;QAAC,OAAO,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAC;IAKxC,yCAAyC;IACzC,OAAO;IAKP,4GAA4G;IAC5G,IAAI;CAKL;AAED,uDAAuD;AACvD,qBAAa,gBAAiB,SAAQ,IAAI,CAAC,WAAW,CAAC;gBACzC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;IAInD;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO;CAcvD;AAED,sDAAsD;AACtD,qBAAa,WAAY,SAAQ,IAAI,CAAC,MAAM,CAAC;gBAC/B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAI9C;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC;CAenC"}
|
package/dist/compute/swap.js
CHANGED
|
@@ -28,3 +28,47 @@ export class Swap {
|
|
|
28
28
|
this.next = current;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/** Helper for managing double-buffered framebuffers */
|
|
32
|
+
export class SwapFramebuffers extends Swap {
|
|
33
|
+
constructor(device, props) {
|
|
34
|
+
super({ current: device.createFramebuffer(props), next: device.createFramebuffer(props) });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resizes the Framebuffers.
|
|
38
|
+
* @returns true if the size changed, otherwise exiting framebuffers were preserved
|
|
39
|
+
* @note any contents are not preserved!
|
|
40
|
+
*/
|
|
41
|
+
resize(size) {
|
|
42
|
+
if (size.width === this.current.width && size.height === this.current.height) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const { current, next } = this;
|
|
46
|
+
this.current = current.clone(size);
|
|
47
|
+
current.destroy();
|
|
48
|
+
this.next = next.clone(size);
|
|
49
|
+
next.destroy();
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Helper for managing double-buffered GPU buffers */
|
|
54
|
+
export class SwapBuffers extends Swap {
|
|
55
|
+
constructor(device, props) {
|
|
56
|
+
super({ current: device.createBuffer(props), next: device.createBuffer(props) });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resizes the Buffers.
|
|
60
|
+
* @returns true if the size changed, otherwise exiting buffers were preserved.
|
|
61
|
+
* @note any contents are not preserved!
|
|
62
|
+
*/
|
|
63
|
+
resize(props) {
|
|
64
|
+
if (props.byteLength === this.current.byteLength) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
const { current, next } = this;
|
|
68
|
+
this.current = current.clone(props);
|
|
69
|
+
current.destroy();
|
|
70
|
+
this.next = next.clone(props);
|
|
71
|
+
next.destroy();
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|