@luma.gl/engine 9.0.0-alpha.5 → 9.0.0-alpha.50
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 +3 -1
- package/dist/animation/key-frames.d.ts +1 -1
- package/dist/animation/key-frames.d.ts.map +1 -1
- package/dist/animation/key-frames.js +6 -27
- package/dist/animation/key-frames.js.map +1 -1
- package/dist/animation/timeline.d.ts +9 -9
- package/dist/animation/timeline.d.ts.map +1 -1
- package/dist/animation/timeline.js +18 -49
- package/dist/animation/timeline.js.map +1 -1
- package/dist/{lib → animation-loop}/animation-loop.d.ts +30 -31
- package/dist/animation-loop/animation-loop.d.ts.map +1 -0
- package/dist/{lib → animation-loop}/animation-loop.js +115 -199
- package/dist/animation-loop/animation-loop.js.map +1 -0
- package/dist/{lib → animation-loop}/animation-props.d.ts +6 -7
- package/dist/animation-loop/animation-props.d.ts.map +1 -0
- package/dist/animation-loop/animation-props.js.map +1 -0
- package/dist/animation-loop/make-animation-loop.d.ts +6 -0
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -0
- package/dist/animation-loop/make-animation-loop.js +28 -0
- package/dist/animation-loop/make-animation-loop.js.map +1 -0
- package/dist/animation-loop/render-loop.d.ts +23 -0
- package/dist/animation-loop/render-loop.d.ts.map +1 -0
- package/dist/animation-loop/render-loop.js +7 -0
- package/dist/animation-loop/render-loop.js.map +1 -0
- package/dist/dist.dev.js +7064 -0
- package/dist/geometries/cone-geometry.d.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts.map +1 -1
- package/dist/geometries/cone-geometry.js +6 -5
- package/dist/geometries/cone-geometry.js.map +1 -1
- package/dist/geometries/cube-geometry.d.ts +2 -2
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +15 -8
- package/dist/geometries/cube-geometry.js.map +1 -1
- package/dist/geometries/cylinder-geometry.d.ts +1 -1
- package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
- package/dist/geometries/cylinder-geometry.js +6 -5
- package/dist/geometries/cylinder-geometry.js.map +1 -1
- package/dist/geometries/ico-sphere-geometry.d.ts +2 -2
- package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +10 -19
- package/dist/geometries/ico-sphere-geometry.js.map +1 -1
- package/dist/geometries/plane-geometry.d.ts +2 -2
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js +14 -23
- package/dist/geometries/plane-geometry.js.map +1 -1
- package/dist/geometries/sphere-geometry.d.ts +2 -2
- package/dist/geometries/sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/sphere-geometry.js +9 -13
- package/dist/geometries/sphere-geometry.js.map +1 -1
- package/dist/geometries/truncated-cone-geometry.d.ts +2 -4
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +9 -25
- package/dist/geometries/truncated-cone-geometry.js.map +1 -1
- package/dist/geometry/geometry-table.d.ts +2 -2
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-table.js.map +1 -1
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +0 -9
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/geometry/geometry.d.ts +50 -59
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +32 -97
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts +37 -0
- package/dist/geometry/gpu-geometry.d.ts.map +1 -0
- package/dist/geometry/gpu-geometry.js +107 -0
- package/dist/geometry/gpu-geometry.js.map +1 -0
- package/dist/geometry/gpu-table.d.ts +1 -0
- package/dist/geometry/gpu-table.d.ts.map +1 -0
- package/dist/geometry/gpu-table.js +2 -0
- package/dist/geometry/gpu-table.js.map +1 -0
- package/dist/index.cjs +2959 -0
- package/dist/index.d.ts +26 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -13
- package/dist/index.js.map +1 -1
- package/dist/lib/clip-space.d.ts +8 -0
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +47 -0
- package/dist/lib/clip-space.js.map +1 -1
- package/dist/lib/pipeline-factory.d.ts +12 -40
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +50 -148
- package/dist/lib/pipeline-factory.js.map +1 -1
- package/dist/model/model.d.ts +192 -0
- package/dist/model/model.d.ts.map +1 -0
- package/dist/model/model.js +312 -0
- package/dist/model/model.js.map +1 -0
- package/dist/scenegraph/group-node.d.ts +21 -0
- package/dist/scenegraph/group-node.d.ts.map +1 -0
- package/dist/scenegraph/group-node.js +94 -0
- package/dist/scenegraph/group-node.js.map +1 -0
- package/dist/scenegraph/model-node.d.ts +18 -0
- package/dist/scenegraph/model-node.d.ts.map +1 -0
- package/dist/scenegraph/model-node.js +28 -0
- package/dist/scenegraph/model-node.js.map +1 -0
- package/dist/scenegraph/scenegraph-node.d.ts +56 -0
- package/dist/scenegraph/scenegraph-node.d.ts.map +1 -0
- package/dist/scenegraph/scenegraph-node.js +141 -0
- package/dist/scenegraph/scenegraph-node.js.map +1 -0
- package/dist/shader-inputs.d.ts +62 -0
- package/dist/shader-inputs.d.ts.map +1 -0
- package/dist/shader-inputs.js +49 -0
- package/dist/shader-inputs.js.map +1 -0
- package/dist/transform/buffer-transform.d.ts +35 -0
- package/dist/transform/buffer-transform.d.ts.map +1 -0
- package/dist/transform/buffer-transform.js +62 -0
- package/dist/transform/buffer-transform.js.map +1 -0
- package/dist/transform/texture-transform.d.ts +57 -0
- package/dist/transform/texture-transform.d.ts.map +1 -0
- package/dist/transform/texture-transform.js +122 -0
- package/dist/transform/texture-transform.js.map +1 -0
- package/dist.min.js +286 -0
- package/package.json +21 -12
- package/src/animation/timeline.ts +16 -15
- package/src/{lib → animation-loop}/animation-loop.ts +120 -107
- package/src/{lib → animation-loop}/animation-props.ts +5 -5
- package/src/animation-loop/make-animation-loop.ts +44 -0
- package/src/animation-loop/render-loop.ts +23 -0
- package/src/geometries/cone-geometry.ts +1 -1
- package/src/geometries/cube-geometry.ts +6 -3
- package/src/geometries/cylinder-geometry.ts +2 -2
- package/src/geometries/ico-sphere-geometry.ts +7 -6
- package/src/geometries/plane-geometry.ts +5 -4
- package/src/geometries/sphere-geometry.ts +4 -3
- package/src/geometries/truncated-cone-geometry.ts +4 -13
- package/src/geometry/geometry-table.ts +1 -1
- package/src/geometry/geometry-utils.ts +3 -3
- package/src/geometry/geometry.ts +79 -119
- package/src/geometry/gpu-geometry.ts +124 -0
- package/src/geometry/gpu-table.ts +41 -0
- package/src/index.ts +38 -12
- package/src/lib/clip-space.ts +22 -21
- package/src/lib/pipeline-factory.ts +60 -168
- package/src/model/model.ts +549 -0
- package/src/scenegraph/group-node.ts +103 -0
- package/src/scenegraph/model-node.ts +50 -0
- package/src/scenegraph/scenegraph-node.ts +204 -0
- package/src/shader-inputs.ts +132 -0
- package/src/transform/buffer-transform.ts +94 -0
- package/src/transform/texture-transform.ts +169 -0
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/geometry/primitive-utils.d.ts +0 -1
- package/dist/geometry/primitive-utils.d.ts.map +0 -1
- package/dist/geometry/primitive-utils.js +0 -2
- package/dist/geometry/primitive-utils.js.map +0 -1
- package/dist/lib/animation-loop.d.ts.map +0 -1
- package/dist/lib/animation-loop.js.map +0 -1
- package/dist/lib/animation-props.d.ts.map +0 -1
- package/dist/lib/animation-props.js.map +0 -1
- package/dist/lib/model-utils.d.ts +0 -5
- package/dist/lib/model-utils.d.ts.map +0 -1
- package/dist/lib/model-utils.js +0 -45
- package/dist/lib/model-utils.js.map +0 -1
- package/dist/lib/model.d.ts +0 -41
- package/dist/lib/model.d.ts.map +0 -1
- package/dist/lib/model.js +0 -176
- package/dist/lib/model.js.map +0 -1
- package/dist/lib/render-loop.d.ts +0 -14
- package/dist/lib/render-loop.d.ts.map +0 -1
- package/dist/lib/render-loop.js +0 -49
- package/dist/lib/render-loop.js.map +0 -1
- package/src/bundle.ts +0 -4
- package/src/geometry/primitive-utils.ts +0 -30
- package/src/lib/model-utils.ts +0 -124
- package/src/lib/model.ts +0 -179
- package/src/lib/render-loop.ts +0 -58
- /package/dist/{lib → animation-loop}/animation-props.js +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
2
|
+
import { log } from '@luma.gl/core';
|
|
3
|
+
import { ScenegraphNode } from "./scenegraph-node.js";
|
|
4
|
+
export class GroupNode extends ScenegraphNode {
|
|
5
|
+
constructor() {
|
|
6
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
props = Array.isArray(props) ? {
|
|
8
|
+
children: props
|
|
9
|
+
} : props;
|
|
10
|
+
const {
|
|
11
|
+
children = []
|
|
12
|
+
} = props;
|
|
13
|
+
log.assert(children.every(child => child instanceof ScenegraphNode), 'every child must an instance of ScenegraphNode');
|
|
14
|
+
super(props);
|
|
15
|
+
this.children = void 0;
|
|
16
|
+
this.children = children;
|
|
17
|
+
}
|
|
18
|
+
getBounds() {
|
|
19
|
+
const result = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
|
|
20
|
+
this.traverse((node, _ref) => {
|
|
21
|
+
let {
|
|
22
|
+
worldMatrix
|
|
23
|
+
} = _ref;
|
|
24
|
+
const bounds = node.getBounds();
|
|
25
|
+
if (!bounds) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const [min, max] = bounds;
|
|
29
|
+
const center = new Vector3(min).add(max).divide([2, 2, 2]);
|
|
30
|
+
worldMatrix.transformAsPoint(center, center);
|
|
31
|
+
const halfSize = new Vector3(max).subtract(min).divide([2, 2, 2]);
|
|
32
|
+
worldMatrix.transformAsVector(halfSize, halfSize);
|
|
33
|
+
for (let v = 0; v < 8; v++) {
|
|
34
|
+
const position = new Vector3(v & 0b001 ? -1 : 1, v & 0b010 ? -1 : 1, v & 0b100 ? -1 : 1).multiply(halfSize).add(center);
|
|
35
|
+
for (let i = 0; i < 3; i++) {
|
|
36
|
+
result[0][i] = Math.min(result[0][i], position[i]);
|
|
37
|
+
result[1][i] = Math.max(result[1][i], position[i]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (!Number.isFinite(result[0][0])) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
destroy() {
|
|
47
|
+
this.children.forEach(child => child.destroy());
|
|
48
|
+
this.removeAll();
|
|
49
|
+
super.destroy();
|
|
50
|
+
}
|
|
51
|
+
add() {
|
|
52
|
+
for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
53
|
+
children[_key] = arguments[_key];
|
|
54
|
+
}
|
|
55
|
+
for (const child of children) {
|
|
56
|
+
if (Array.isArray(child)) {
|
|
57
|
+
this.add(...child);
|
|
58
|
+
} else {
|
|
59
|
+
this.children.push(child);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
remove(child) {
|
|
65
|
+
const children = this.children;
|
|
66
|
+
const indexOf = children.indexOf(child);
|
|
67
|
+
if (indexOf > -1) {
|
|
68
|
+
children.splice(indexOf, 1);
|
|
69
|
+
}
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
removeAll() {
|
|
73
|
+
this.children = [];
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
traverse(visitor) {
|
|
77
|
+
let {
|
|
78
|
+
worldMatrix = new Matrix4()
|
|
79
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
80
|
+
const modelMatrix = new Matrix4(worldMatrix).multiplyRight(this.matrix);
|
|
81
|
+
for (const child of this.children) {
|
|
82
|
+
if (child instanceof GroupNode) {
|
|
83
|
+
child.traverse(visitor, {
|
|
84
|
+
worldMatrix: modelMatrix
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
visitor(child, {
|
|
88
|
+
worldMatrix: modelMatrix
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=group-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-node.js","names":["Matrix4","Vector3","log","ScenegraphNode","GroupNode","constructor","props","arguments","length","undefined","Array","isArray","children","assert","every","child","getBounds","result","Infinity","traverse","node","_ref","worldMatrix","bounds","min","max","center","add","divide","transformAsPoint","halfSize","subtract","transformAsVector","v","position","multiply","i","Math","Number","isFinite","destroy","forEach","removeAll","_len","_key","push","remove","indexOf","splice","visitor","modelMatrix","multiplyRight","matrix"],"sources":["../../src/scenegraph/group-node.ts"],"sourcesContent":["import {Matrix4, Vector3} from '@math.gl/core';\nimport {log} from '@luma.gl/core';\nimport {ScenegraphNode, ScenegraphNodeProps} from './scenegraph-node';\n\nexport type GroupNodeProps = ScenegraphNodeProps & {\n children?: ScenegraphNode[];\n}\n\nexport class GroupNode extends ScenegraphNode {\n children: ScenegraphNode[];\n\n constructor(children: ScenegraphNode[]);\n constructor(props?: GroupNodeProps);\n\n constructor(props: ScenegraphNode[] | GroupNodeProps = {}) {\n props = Array.isArray(props) ? {children: props} : props;\n const {children = []} = props;\n log.assert(\n children.every((child) => child instanceof ScenegraphNode),\n 'every child must an instance of ScenegraphNode'\n );\n super(props);\n this.children = children;\n }\n\n override getBounds(): [number[], number[]] | null {\n const result: [number[], number[]] = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];\n\n this.traverse((node, {worldMatrix}) => {\n const bounds = node.getBounds();\n if (!bounds) {\n return;\n }\n const [min, max] = bounds;\n const center = new Vector3(min).add(max).divide([2, 2, 2]);\n worldMatrix.transformAsPoint(center, center);\n const halfSize = new Vector3(max).subtract(min).divide([2, 2, 2]);\n worldMatrix.transformAsVector(halfSize, halfSize);\n\n for (let v = 0; v < 8; v++) {\n // Test all 8 corners of the box\n const position = new Vector3(\n v & 0b001 ? -1 : 1,\n v & 0b010 ? -1 : 1,\n v & 0b100 ? -1 : 1\n ).multiply(halfSize).add(center);\n\n for (let i = 0; i < 3; i++) {\n result[0][i] = Math.min(result[0][i], position[i]);\n result[1][i] = Math.max(result[1][i], position[i]);\n }\n }\n });\n if (!Number.isFinite(result[0][0])) {\n return null;\n }\n return result;\n }\n\n override destroy(): void {\n this.children.forEach((child) => child.destroy());\n this.removeAll();\n super.destroy();\n }\n\n // Unpacks arrays and nested arrays of children\n add(...children: (ScenegraphNode | ScenegraphNode[])[]): this {\n for (const child of children) {\n if (Array.isArray(child)) {\n this.add(...child);\n } else {\n this.children.push(child);\n }\n }\n return this;\n }\n\n remove(child: ScenegraphNode): this {\n const children = this.children;\n const indexOf = children.indexOf(child);\n if (indexOf > -1) {\n children.splice(indexOf, 1);\n }\n return this;\n }\n\n removeAll(): this {\n this.children = [];\n return this;\n }\n\n traverse(visitor: (node: ScenegraphNode, context: {worldMatrix: Matrix4}) => void, {worldMatrix = new Matrix4()} = {}) {\n const modelMatrix = new Matrix4(worldMatrix).multiplyRight(this.matrix);\n\n for (const child of this.children) {\n if (child instanceof GroupNode) {\n child.traverse(visitor, {worldMatrix: modelMatrix});\n } else {\n visitor(child, {worldMatrix: modelMatrix});\n }\n }\n }\n}\n"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,eAAe;AAC9C,SAAQC,GAAG,QAAO,eAAe;AAAC,SAC1BC,cAAc;AAMtB,OAAO,MAAMC,SAAS,SAASD,cAAc,CAAC;EAM5CE,WAAWA,CAAA,EAAgD;IAAA,IAA/CC,KAAwC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF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AAS,EAAE;QAC9BW,KAAK,CAACI,QAAQ,CAAC8B,OAAO,EAAE;UAAC3B,WAAW,EAAE4B;QAAW,CAAC,CAAC;MACrD,CAAC,MAAM;QACLD,OAAO,CAAClC,KAAK,EAAE;UAACO,WAAW,EAAE4B;QAAW,CAAC,CAAC;MAC5C;IACF;EACF;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RenderPass } from '@luma.gl/core';
|
|
2
|
+
import { ScenegraphNode, ScenegraphNodeProps } from './scenegraph-node';
|
|
3
|
+
import { Model } from '../model/model';
|
|
4
|
+
export type ModelNodeProps = ScenegraphNodeProps & {
|
|
5
|
+
model: Model;
|
|
6
|
+
managedResources?: any[];
|
|
7
|
+
bounds?: [number[], number[]];
|
|
8
|
+
};
|
|
9
|
+
export declare class ModelNode extends ScenegraphNode {
|
|
10
|
+
readonly model: Model;
|
|
11
|
+
bounds: [number[], number[]] | null;
|
|
12
|
+
managedResources: any[];
|
|
13
|
+
constructor(props: ModelNodeProps);
|
|
14
|
+
getBounds(): [number[], number[]] | null;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
draw(renderPass?: RenderPass): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=model-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-node.d.ts","sourceRoot":"","sources":["../../src/scenegraph/model-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG;IACjD,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;CAC/B,CAAA;AAED,qBAAa,SAAU,SAAQ,cAAc;IAC3C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAQ;IAC3C,gBAAgB,EAAE,GAAG,EAAE,CAAC;gBAOZ,KAAK,EAAE,cAAc;IAUxB,SAAS,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAIxC,OAAO,IAAI,IAAI;IAWxB,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU;CAI7B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ScenegraphNode } from "./scenegraph-node.js";
|
|
2
|
+
export class ModelNode extends ScenegraphNode {
|
|
3
|
+
constructor(props) {
|
|
4
|
+
super(props);
|
|
5
|
+
this.model = void 0;
|
|
6
|
+
this.bounds = null;
|
|
7
|
+
this.managedResources = void 0;
|
|
8
|
+
this.model = props.model;
|
|
9
|
+
this.managedResources = props.managedResources || [];
|
|
10
|
+
this.bounds = props.bounds || null;
|
|
11
|
+
this.setProps(props);
|
|
12
|
+
}
|
|
13
|
+
getBounds() {
|
|
14
|
+
return this.bounds;
|
|
15
|
+
}
|
|
16
|
+
destroy() {
|
|
17
|
+
if (this.model) {
|
|
18
|
+
this.model.destroy();
|
|
19
|
+
this.model = null;
|
|
20
|
+
}
|
|
21
|
+
this.managedResources.forEach(resource => resource.destroy());
|
|
22
|
+
this.managedResources = [];
|
|
23
|
+
}
|
|
24
|
+
draw(renderPass) {
|
|
25
|
+
return this.model.draw(renderPass);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=model-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-node.js","names":["ScenegraphNode","ModelNode","constructor","props","model","bounds","managedResources","setProps","getBounds","destroy","forEach","resource","draw","renderPass"],"sources":["../../src/scenegraph/model-node.ts"],"sourcesContent":["import {RenderPass} from '@luma.gl/core';\nimport {ScenegraphNode, ScenegraphNodeProps} from './scenegraph-node';\nimport {Model} from '../model/model';\n\nexport type ModelNodeProps = ScenegraphNodeProps & {\n model: Model;\n managedResources?: any[];\n bounds?: [number[], number[]];\n}\n\nexport class ModelNode extends ScenegraphNode {\n readonly model: Model;\n bounds: [number[], number[]] | null = null;\n managedResources: any[];\n\n // TODO - is this used? override callbacks to make sure we call them with this\n // onBeforeRender = null;\n // onAfterRender = null;\n // AfterRender = null;\n\n constructor(props: ModelNodeProps) {\n super(props);\n\n // Create new Model or used supplied Model\n this.model = props.model;\n this.managedResources = props.managedResources || [];\n this.bounds = props.bounds || null;\n this.setProps(props);\n }\n\n override getBounds(): [number[], number[]] | null {\n return this.bounds;\n }\n\n override destroy(): void {\n if (this.model) {\n this.model.destroy();\n // @ts-expect-error\n this.model = null;\n }\n this.managedResources.forEach((resource) => resource.destroy());\n this.managedResources = [];\n }\n\n // Expose model methods\n draw(renderPass?: RenderPass) {\n // Return value indicates if something was actually drawn\n return this.model.draw(renderPass);\n }\n}\n"],"mappings":"SACQA,cAAc;AAStB,OAAO,MAAMC,SAAS,SAASD,cAAc,CAAC;EAU5CE,WAAWA,CAACC,KAAqB,EAAE;IACjC,KAAK,CAACA,KAAK,CAAC;IAAC,KAVNC,KAAK;IAAA,KACdC,MAAM,GAAgC,IAAI;IAAA,KAC1CC,gBAAgB;IAWd,IAAI,CAACF,KAAK,GAAGD,KAAK,CAACC,KAAK;IACxB,IAAI,CAACE,gBAAgB,GAAGH,KAAK,CAACG,gBAAgB,IAAI,EAAE;IACpD,IAAI,CAACD,MAAM,GAAGF,KAAK,CAACE,MAAM,IAAI,IAAI;IAClC,IAAI,CAACE,QAAQ,CAACJ,KAAK,CAAC;EACtB;EAESK,SAASA,CAAA,EAAgC;IAChD,OAAO,IAAI,CAACH,MAAM;EACpB;EAESI,OAAOA,CAAA,EAAS;IACvB,IAAI,IAAI,CAACL,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACK,OAAO,CAAC,CAAC;MAEpB,IAAI,CAACL,KAAK,GAAG,IAAI;IACnB;IACA,IAAI,CAACE,gBAAgB,CAACI,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAACF,OAAO,CAAC,CAAC,CAAC;IAC/D,IAAI,CAACH,gBAAgB,GAAG,EAAE;EAC5B;EAGAM,IAAIA,CAACC,UAAuB,EAAE;IAE5B,OAAO,IAAI,CAACT,KAAK,CAACQ,IAAI,CAACC,UAAU,CAAC;EACpC;AACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { NumberArray } from '@luma.gl/core';
|
|
2
|
+
import { Vector3, Matrix4 } from '@math.gl/core';
|
|
3
|
+
/** Properties for creating a new Scenegraph */
|
|
4
|
+
export type ScenegraphNodeProps = {
|
|
5
|
+
id?: string;
|
|
6
|
+
/** whether to display the object at all */
|
|
7
|
+
display?: boolean;
|
|
8
|
+
matrix?: NumberArray;
|
|
9
|
+
position?: NumberArray;
|
|
10
|
+
rotation?: NumberArray;
|
|
11
|
+
scale?: NumberArray;
|
|
12
|
+
update?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare class ScenegraphNode {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
matrix: Matrix4;
|
|
17
|
+
display: boolean;
|
|
18
|
+
position: Vector3;
|
|
19
|
+
rotation: Vector3;
|
|
20
|
+
scale: Vector3;
|
|
21
|
+
userData: Record<string, unknown>;
|
|
22
|
+
props: ScenegraphNodeProps;
|
|
23
|
+
constructor(props?: ScenegraphNodeProps);
|
|
24
|
+
getBounds(): [number[], number[]] | null;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
/** @deprecated use .destroy() */
|
|
27
|
+
delete(): void;
|
|
28
|
+
setProps(props: ScenegraphNodeProps): this;
|
|
29
|
+
toString(): string;
|
|
30
|
+
setPosition(position: any): this;
|
|
31
|
+
setRotation(rotation: any): this;
|
|
32
|
+
setScale(scale: any): this;
|
|
33
|
+
setMatrix(matrix: any, copyMatrix?: boolean): void;
|
|
34
|
+
setMatrixComponents(components: {
|
|
35
|
+
position?: any;
|
|
36
|
+
rotation?: any;
|
|
37
|
+
scale?: any;
|
|
38
|
+
update?: boolean;
|
|
39
|
+
}): this;
|
|
40
|
+
updateMatrix(): this;
|
|
41
|
+
update(options?: {
|
|
42
|
+
position?: any;
|
|
43
|
+
rotation?: any;
|
|
44
|
+
scale?: any;
|
|
45
|
+
}): this;
|
|
46
|
+
getCoordinateUniforms(viewMatrix: any, modelMatrix?: any): {
|
|
47
|
+
viewMatrix: any;
|
|
48
|
+
modelMatrix: any;
|
|
49
|
+
objectMatrix: any;
|
|
50
|
+
worldMatrix: any;
|
|
51
|
+
worldInverseMatrix: any;
|
|
52
|
+
worldInverseTransposeMatrix: any;
|
|
53
|
+
};
|
|
54
|
+
_setScenegraphNodeProps(props: ScenegraphNodeProps): void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=scenegraph-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenegraph-node.d.ts","sourceRoot":"","sources":["../../src/scenegraph/scenegraph-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE/C,+CAA+C;AAC/C,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AAEF,qBAAa,cAAc;IACzB,QAAQ,CAAC,EAAE,EAAE,MA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QAClB,WAAW,EAAE,GAAG,CAAC;QACjB,kBAAkB,EAAE,GAAG,CAAC;QACxB,2BAA2B,EAAE,GAAG,CAAC;KAClC;IA0CD,uBAAuB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CAsB1D"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { assert, uid } from '@luma.gl/core';
|
|
2
|
+
import { Vector3, Matrix4 } from '@math.gl/core';
|
|
3
|
+
export class ScenegraphNode {
|
|
4
|
+
constructor() {
|
|
5
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
this.id = void 0;
|
|
7
|
+
this.matrix = new Matrix4();
|
|
8
|
+
this.display = true;
|
|
9
|
+
this.position = new Vector3();
|
|
10
|
+
this.rotation = new Vector3();
|
|
11
|
+
this.scale = new Vector3(1, 1, 1);
|
|
12
|
+
this.userData = {};
|
|
13
|
+
this.props = {};
|
|
14
|
+
const {
|
|
15
|
+
id
|
|
16
|
+
} = props;
|
|
17
|
+
this.id = id || uid(this.constructor.name);
|
|
18
|
+
this._setScenegraphNodeProps(props);
|
|
19
|
+
}
|
|
20
|
+
getBounds() {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
destroy() {}
|
|
24
|
+
delete() {
|
|
25
|
+
this.destroy();
|
|
26
|
+
}
|
|
27
|
+
setProps(props) {
|
|
28
|
+
this._setScenegraphNodeProps(props);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
toString() {
|
|
32
|
+
return `{type: ScenegraphNode, id: ${this.id})}`;
|
|
33
|
+
}
|
|
34
|
+
setPosition(position) {
|
|
35
|
+
assert(position.length === 3, 'setPosition requires vector argument');
|
|
36
|
+
this.position = position;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
setRotation(rotation) {
|
|
40
|
+
assert(rotation.length === 3, 'setRotation requires vector argument');
|
|
41
|
+
this.rotation = rotation;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
setScale(scale) {
|
|
45
|
+
assert(scale.length === 3, 'setScale requires vector argument');
|
|
46
|
+
this.scale = scale;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
setMatrix(matrix) {
|
|
50
|
+
let copyMatrix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
51
|
+
if (copyMatrix) {
|
|
52
|
+
this.matrix.copy(matrix);
|
|
53
|
+
} else {
|
|
54
|
+
this.matrix = matrix;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
setMatrixComponents(components) {
|
|
58
|
+
const {
|
|
59
|
+
position,
|
|
60
|
+
rotation,
|
|
61
|
+
scale,
|
|
62
|
+
update = true
|
|
63
|
+
} = components;
|
|
64
|
+
if (position) {
|
|
65
|
+
this.setPosition(position);
|
|
66
|
+
}
|
|
67
|
+
if (rotation) {
|
|
68
|
+
this.setRotation(rotation);
|
|
69
|
+
}
|
|
70
|
+
if (scale) {
|
|
71
|
+
this.setScale(scale);
|
|
72
|
+
}
|
|
73
|
+
if (update) {
|
|
74
|
+
this.updateMatrix();
|
|
75
|
+
}
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
updateMatrix() {
|
|
79
|
+
const pos = this.position;
|
|
80
|
+
const rot = this.rotation;
|
|
81
|
+
const scale = this.scale;
|
|
82
|
+
this.matrix.identity();
|
|
83
|
+
this.matrix.translate(pos);
|
|
84
|
+
this.matrix.rotateXYZ(rot);
|
|
85
|
+
this.matrix.scale(scale);
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
update() {
|
|
89
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90
|
+
const {
|
|
91
|
+
position,
|
|
92
|
+
rotation,
|
|
93
|
+
scale
|
|
94
|
+
} = options;
|
|
95
|
+
if (position) {
|
|
96
|
+
this.setPosition(position);
|
|
97
|
+
}
|
|
98
|
+
if (rotation) {
|
|
99
|
+
this.setRotation(rotation);
|
|
100
|
+
}
|
|
101
|
+
if (scale) {
|
|
102
|
+
this.setScale(scale);
|
|
103
|
+
}
|
|
104
|
+
this.updateMatrix();
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
getCoordinateUniforms(viewMatrix, modelMatrix) {
|
|
108
|
+
assert(viewMatrix);
|
|
109
|
+
modelMatrix = modelMatrix || this.matrix;
|
|
110
|
+
const worldMatrix = new Matrix4(viewMatrix).multiplyRight(modelMatrix);
|
|
111
|
+
const worldInverse = worldMatrix.invert();
|
|
112
|
+
const worldInverseTranspose = worldInverse.transpose();
|
|
113
|
+
return {
|
|
114
|
+
viewMatrix,
|
|
115
|
+
modelMatrix,
|
|
116
|
+
objectMatrix: modelMatrix,
|
|
117
|
+
worldMatrix,
|
|
118
|
+
worldInverseMatrix: worldInverse,
|
|
119
|
+
worldInverseTransposeMatrix: worldInverseTranspose
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
_setScenegraphNodeProps(props) {
|
|
123
|
+
if ('display' in props) {
|
|
124
|
+
this.display = props.display;
|
|
125
|
+
}
|
|
126
|
+
if ('position' in props) {
|
|
127
|
+
this.setPosition(props.position);
|
|
128
|
+
}
|
|
129
|
+
if ('rotation' in props) {
|
|
130
|
+
this.setRotation(props.rotation);
|
|
131
|
+
}
|
|
132
|
+
if ('scale' in props) {
|
|
133
|
+
this.setScale(props.scale);
|
|
134
|
+
}
|
|
135
|
+
if ('matrix' in props) {
|
|
136
|
+
this.setMatrix(props.matrix);
|
|
137
|
+
}
|
|
138
|
+
Object.assign(this.props, props);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=scenegraph-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenegraph-node.js","names":["assert","uid","Vector3","Matrix4","ScenegraphNode","constructor","props","arguments","length","undefined","id","matrix","display","position","rotation","scale","userData","name","_setScenegraphNodeProps","getBounds","destroy","delete","setProps","toString","setPosition","setRotation","setScale","setMatrix","copyMatrix","copy","setMatrixComponents","components","update","updateMatrix","pos","rot","identity","translate","rotateXYZ","options","getCoordinateUniforms","viewMatrix","modelMatrix","worldMatrix","multiplyRight","worldInverse","invert","worldInverseTranspose","transpose","objectMatrix","worldInverseMatrix","worldInverseTransposeMatrix","Object","assign"],"sources":["../../src/scenegraph/scenegraph-node.ts"],"sourcesContent":["import {assert, uid, NumberArray} from '@luma.gl/core';\nimport {Vector3, Matrix4} from '@math.gl/core';\n\n/** Properties for creating a new Scenegraph */\nexport type ScenegraphNodeProps = {\n id?: string;\n /** whether to display the object at all */\n display?: boolean;\n matrix?: NumberArray;\n position?: NumberArray;\n rotation?: NumberArray;\n scale?: NumberArray;\n update?: boolean\n};\n\nexport class ScenegraphNode {\n readonly id: string;\n matrix: Matrix4 = new Matrix4();\n\n display = true; \n position = new Vector3();\n rotation = new Vector3();\n scale = new Vector3(1, 1, 1);\n userData: Record<string, unknown> = {};\n\n props: ScenegraphNodeProps = {};\n\n constructor(props: ScenegraphNodeProps = {}) {\n const {id} = props;\n\n this.id = id || uid(this.constructor.name);\n\n this._setScenegraphNodeProps(props);\n }\n\n getBounds(): [number[], number[]] | null {\n return null;\n }\n\n destroy(): void {}\n\n /** @deprecated use .destroy() */\n delete(): void {\n this.destroy();\n }\n setProps(props: ScenegraphNodeProps): this {\n this._setScenegraphNodeProps(props);\n return this;\n }\n\n toString(): string {\n return `{type: ScenegraphNode, id: ${this.id})}`;\n }\n\n setPosition(position: any): this {\n assert(position.length === 3, 'setPosition requires vector argument');\n this.position = position;\n return this;\n }\n\n setRotation(rotation: any): this {\n assert(rotation.length === 3, 'setRotation requires vector argument');\n this.rotation = rotation;\n return this;\n }\n\n setScale(scale: any): this {\n assert(scale.length === 3, 'setScale requires vector argument');\n this.scale = scale;\n return this;\n }\n\n setMatrix(matrix: any, copyMatrix: boolean = true): void {\n if (copyMatrix) {\n this.matrix.copy(matrix);\n } else {\n this.matrix = matrix;\n }\n }\n\n setMatrixComponents(components: {\n position?: any;\n rotation?: any;\n scale?: any;\n update?: boolean;\n }): this {\n const {position, rotation, scale, update = true} = components;\n if (position) {\n this.setPosition(position);\n }\n if (rotation) {\n this.setRotation(rotation);\n }\n if (scale) {\n this.setScale(scale);\n }\n if (update) {\n this.updateMatrix();\n }\n return this;\n }\n\n updateMatrix(): this {\n const pos = this.position;\n const rot = this.rotation;\n const scale = this.scale;\n\n this.matrix.identity();\n this.matrix.translate(pos);\n this.matrix.rotateXYZ(rot);\n this.matrix.scale(scale);\n return this;\n }\n\n update(options: {position?: any; rotation?: any; scale?: any} = {}): this {\n const {position, rotation, scale} = options;\n if (position) {\n this.setPosition(position);\n }\n if (rotation) {\n this.setRotation(rotation);\n }\n if (scale) {\n this.setScale(scale);\n }\n this.updateMatrix();\n return this;\n }\n\n getCoordinateUniforms(\n viewMatrix: any,\n modelMatrix?: any\n ): {\n viewMatrix: any;\n modelMatrix: any;\n objectMatrix: any;\n worldMatrix: any;\n worldInverseMatrix: any;\n worldInverseTransposeMatrix: any;\n } {\n // TODO - solve multiple class problem\n // assert(viewMatrix instanceof Matrix4);\n assert(viewMatrix);\n modelMatrix = modelMatrix || this.matrix;\n const worldMatrix = new Matrix4(viewMatrix).multiplyRight(modelMatrix);\n const worldInverse = worldMatrix.invert();\n const worldInverseTranspose = worldInverse.transpose();\n\n return {\n viewMatrix,\n modelMatrix,\n objectMatrix: modelMatrix,\n worldMatrix,\n worldInverseMatrix: worldInverse,\n worldInverseTransposeMatrix: worldInverseTranspose\n };\n }\n\n // TODO - copied code, not yet vetted\n /*\n transform() {\n if (!this.parent) {\n this.endPosition.set(this.position);\n this.endRotation.set(this.rotation);\n this.endScale.set(this.scale);\n } else {\n const parent = this.parent;\n this.endPosition.set(this.position.add(parent.endPosition));\n this.endRotation.set(this.rotation.add(parent.endRotation));\n this.endScale.set(this.scale.add(parent.endScale));\n }\n\n const ch = this.children;\n for (let i = 0; i < ch.length; ++i) {\n ch[i].transform();\n }\n\n return this;\n }\n */\n\n _setScenegraphNodeProps(props: ScenegraphNodeProps): void {\n if ('display' in props) {\n this.display = props.display;\n }\n\n if ('position' in props) {\n this.setPosition(props.position);\n }\n if ('rotation' in props) {\n this.setRotation(props.rotation);\n }\n if ('scale' in props) {\n this.setScale(props.scale);\n }\n\n // Matrix overwrites other props\n if ('matrix' in props) {\n this.setMatrix(props.matrix);\n }\n\n Object.assign(this.props, props);\n }\n}\n"],"mappings":"AAAA,SAAQA,MAAM,EAAEC,GAAG,QAAoB,eAAe;AACtD,SAAQC,OAAO,EAAEC,OAAO,QAAO,eAAe;AAc9C,OAAO,MAAMC,cAAc,CAAC;EAY1BC,WAAWA,CAAA,EAAkC;IAAA,IAAjCC,KAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,KAXlCG,EAAE;IAAA,KACXC,MAAM,GAAY,IAAIR,OAAO,CAAC,CAAC;IAAA,KAE/BS,OAAO,GAAG,IAAI;IAAA,KACdC,QAAQ,GAAG,IAAIX,OAAO,CAAC,CAAC;IAAA,KACxBY,QAAQ,GAAG,IAAIZ,OAAO,CAAC,CAAC;IAAA,KACxBa,KAAK,GAAG,IAAIb,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAAA,KAC5Bc,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAEtCV,KAAK,GAAwB,CAAC,CAAC;IAG7B,MAAM;MAACI;IAAE,CAAC,GAAGJ,KAAK;IAElB,IAAI,CAACI,EAAE,GAAGA,EAAE,IAAIT,GAAG,CAAC,IAAI,CAACI,WAAW,CAACY,IAAI,CAAC;IAE1C,IAAI,CAACC,uBAAuB,CAACZ,KAAK,CAAC;EACrC;EAEAa,SAASA,CAAA,EAAgC;IACvC,OAAO,IAAI;EACb;EAEAC,OAAOA,CAAA,EAAS,CAAC;EAGjBC,MAAMA,CAAA,EAAS;IACb,IAAI,CAACD,OAAO,CAAC,CAAC;EAChB;E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M;IACxC,MAAMgC,WAAW,GAAG,IAAIxC,OAAO,CAACsC,UAAU,CAAC,CAACG,aAAa,CAACF,WAAW,CAAC;IACtE,MAAMG,YAAY,GAAGF,WAAW,CAACG,MAAM,CAAC,CAAC;IACzC,MAAMC,qBAAqB,GAAGF,YAAY,CAACG,SAAS,CAAC,CAAC;IAEtD,OAAO;MACLP,UAAU;MACVC,WAAW;MACXO,YAAY,EAAEP,WAAW;MACzBC,WAAW;MACXO,kBAAkB,EAAEL,YAAY;MAChCM,2BAA2B,EAAEJ;IAC/B,CAAC;EACH;EAyBA7B,uBAAuBA,CAACZ,KAA0B,EAAQ;IACxD,IAAI,SAAS,IAAIA,KAAK,EAAE;MACtB,IAAI,CAACM,OAAO,GAAGN,KAAK,CAACM,OAAO;IAC9B;IAEA,IAAI,UAAU,IAAIN,KAAK,EAAE;MACvB,IAAI,CAACkB,WAAW,CAAClB,KAAK,CAACO,QAAQ,CAAC;IAClC;IACA,IAAI,UAAU,IAAIP,KAAK,EAAE;MACvB,IAAI,CAACmB,WAAW,CAACnB,KAAK,CAACQ,QAAQ,CAAC;IAClC;IACA,IAAI,OAAO,IAAIR,KAAK,EAAE;MACpB,IAAI,CAACoB,QAAQ,CAACpB,KAAK,CAACS,KAAK,CAAC;IAC5B;IAGA,IAAI,QAAQ,IAAIT,KAAK,EAAE;MACrB,IAAI,CAACqB,SAAS,CAACrB,KAAK,CAACK,MAAM,CAAC;IAC9B;IAEAyC,MAAM,CAACC,MAAM,CAAC,IAAI,CAAC/C,KAAK,EAAEA,KAAK,CAAC;EAClC;AACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { UniformValue, Texture, Sampler } from '@luma.gl/core';
|
|
2
|
+
import { ShaderModuleInstance } from '@luma.gl/shadertools';
|
|
3
|
+
/** Minimal ShaderModule subset, we don't need shader code etc */
|
|
4
|
+
export type ShaderModuleInputs<PropsT extends Record<string, unknown> = Record<string, unknown>, UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, BindingsT extends Record<string, Texture | Sampler> = Record<string, Texture | Sampler>> = {
|
|
5
|
+
defaultUniforms?: UniformsT;
|
|
6
|
+
getUniforms?: (settings: Partial<PropsT>, prevUniforms?: UniformsT) => UniformsT;
|
|
7
|
+
/** Not used. Used to access props type */
|
|
8
|
+
props?: PropsT;
|
|
9
|
+
bindings?: Record<keyof BindingsT, {
|
|
10
|
+
location: number;
|
|
11
|
+
type: 'texture' | 'sampler' | 'uniforms';
|
|
12
|
+
}>;
|
|
13
|
+
uniformTypes?: any;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* ShaderInputs holds uniform and binding values for one or more shader modules,
|
|
17
|
+
* - It can generate binary data for any uniform buffer
|
|
18
|
+
* - It can manage a uniform buffer for each block
|
|
19
|
+
* - It can update managed uniform buffers with a single call
|
|
20
|
+
* - It performs some book keeping on what has changed to minimize unnecessary writes to uniform buffers.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ShaderInputs<ShaderPropsT extends Partial<Record<string, Record<string, unknown>>> = Partial<Record<string, Record<string, unknown>>>> {
|
|
23
|
+
/**
|
|
24
|
+
* The map of modules
|
|
25
|
+
* @todo should should this include the resolved dependencies?
|
|
26
|
+
*/
|
|
27
|
+
modules: Readonly<{
|
|
28
|
+
[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>;
|
|
29
|
+
}>;
|
|
30
|
+
/** Stores the uniform values for each module */
|
|
31
|
+
moduleUniforms: Record<keyof ShaderPropsT, Record<string, UniformValue>>;
|
|
32
|
+
/** Stores the uniform bindings for each module */
|
|
33
|
+
moduleBindings: Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;
|
|
34
|
+
/** Tracks if uniforms have changed */
|
|
35
|
+
moduleUniformsChanged: Record<keyof ShaderPropsT, false | string>;
|
|
36
|
+
/**
|
|
37
|
+
* Create a new UniformStore instance
|
|
38
|
+
* @param modules
|
|
39
|
+
*/
|
|
40
|
+
constructor(modules: {
|
|
41
|
+
[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>;
|
|
42
|
+
});
|
|
43
|
+
/** Destroy */
|
|
44
|
+
destroy(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Set module props
|
|
47
|
+
*/
|
|
48
|
+
setProps(props: Partial<{
|
|
49
|
+
[P in keyof ShaderPropsT]?: Partial<ShaderPropsT[P]>;
|
|
50
|
+
}>): void;
|
|
51
|
+
/** Merges all bindings for the shader (from the various modules) */
|
|
52
|
+
/**
|
|
53
|
+
* Return the map of modules
|
|
54
|
+
* @todo should should this include the resolved dependencies?
|
|
55
|
+
*/
|
|
56
|
+
getModules(): ShaderModuleInstance[];
|
|
57
|
+
/** Get all uniform values for all modules */
|
|
58
|
+
getUniformValues(): Record<keyof ShaderPropsT, Record<string, UniformValue>>;
|
|
59
|
+
/** Merges all bindings for the shader (from the various modules) */
|
|
60
|
+
getBindings(): Record<string, Texture | Sampler>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=shader-inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-inputs.d.ts","sourceRoot":"","sources":["../src/shader-inputs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAkB,oBAAoB,EAAC,MAAM,sBAAsB,CAAA;AAG1E,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,CAC5B,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC7E,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,C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C;KAAC;IAoBrF,cAAc;IACd,OAAO,IAAI,IAAI;IAEf;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;SAAE,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;KAAC,CAAC,GAAG,IAAI;IAoBtF,oEAAoE;IAKpE;;;OAGG;IACH,UAAU,IAAI,oBAAoB,EAAE;IAIpC,6CAA6C;IAC7C,gBAAgB,IAAI,MAAM,CAAC,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAI5E,oEAAoE;IACpE,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;CAOjD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { log } from '@luma.gl/core';
|
|
2
|
+
import { _resolveModules } from '@luma.gl/shadertools';
|
|
3
|
+
export class ShaderInputs {
|
|
4
|
+
constructor(modules) {
|
|
5
|
+
this.modules = void 0;
|
|
6
|
+
this.moduleUniforms = void 0;
|
|
7
|
+
this.moduleBindings = void 0;
|
|
8
|
+
this.moduleUniformsChanged = void 0;
|
|
9
|
+
const allModules = _resolveModules(Object.values(modules));
|
|
10
|
+
log.log(1, 'Creating ShaderInputs with modules', allModules.map(m => m.name))();
|
|
11
|
+
this.modules = modules;
|
|
12
|
+
this.moduleUniforms = {};
|
|
13
|
+
this.moduleBindings = {};
|
|
14
|
+
for (const [name, module] of Object.entries(modules)) {
|
|
15
|
+
const moduleName = name;
|
|
16
|
+
this.moduleUniforms[moduleName] = module.defaultUniforms || {};
|
|
17
|
+
this.moduleBindings[moduleName] = {};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
destroy() {}
|
|
21
|
+
setProps(props) {
|
|
22
|
+
for (const name of Object.keys(props)) {
|
|
23
|
+
var _module$getUniforms;
|
|
24
|
+
const moduleName = name;
|
|
25
|
+
const moduleProps = props[moduleName];
|
|
26
|
+
const module = this.modules[moduleName];
|
|
27
|
+
const oldUniforms = this.moduleUniforms[moduleName];
|
|
28
|
+
const uniforms = ((_module$getUniforms = module.getUniforms) === null || _module$getUniforms === void 0 ? void 0 : _module$getUniforms.call(module, moduleProps, this.moduleUniforms[moduleName])) || moduleProps;
|
|
29
|
+
this.moduleUniforms[moduleName] = {
|
|
30
|
+
...oldUniforms,
|
|
31
|
+
...uniforms
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
getModules() {
|
|
36
|
+
return Object.values(this.modules);
|
|
37
|
+
}
|
|
38
|
+
getUniformValues() {
|
|
39
|
+
return this.moduleUniforms;
|
|
40
|
+
}
|
|
41
|
+
getBindings() {
|
|
42
|
+
const bindings = {};
|
|
43
|
+
for (const moduleBindings of Object.values(this.moduleBindings)) {
|
|
44
|
+
Object.assign(bindings, moduleBindings);
|
|
45
|
+
}
|
|
46
|
+
return bindings;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=shader-inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-inputs.js","names":["log","_resolveModules","ShaderInputs","constructor","modules","moduleUniforms","moduleBindings","moduleUniformsChanged","allModules","Object","values","map","m","name","module","entries","moduleName","defaultUniforms","destroy","setProps","props","keys","_module$getUniforms","moduleProps","oldUniforms","uniforms","getUniforms","call","getModules","getUniformValues","getBindings","bindings","assign"],"sources":["../src/shader-inputs.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {UniformValue, Texture, Sampler} from '@luma.gl/core';\nimport {log} from '@luma.gl/core';\n// import type {ShaderUniformType, UniformValue, UniformFormat, UniformInfoDevice, Texture, Sampler} from '@luma.gl/core';\nimport {_resolveModules, ShaderModuleInstance} from '@luma.gl/shadertools'\n\n\n/** Minimal ShaderModule subset, we don't need shader code etc */\nexport type ShaderModuleInputs<\n PropsT extends Record<string, unknown> = Record<string, unknown>,\n UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>,\n BindingsT extends Record<string, Texture | Sampler> = Record<string, Texture | Sampler>\n> = {\n defaultUniforms?: UniformsT;\n getUniforms?: (settings: Partial<PropsT>, prevUniforms?: UniformsT) => UniformsT;\n\n /** Not used. Used to access props type */\n props?: PropsT;\n\n bindings?: Record<\n keyof BindingsT,\n {\n location: number;\n type: 'texture' | 'sampler' | 'uniforms';\n }\n >;\n\n uniformTypes?: any;\n};\n\n/**\n * ShaderInputs holds uniform and binding values for one or more shader modules,\n * - It can generate binary data for any uniform buffer\n * - It can manage a uniform buffer for each block\n * - It can update managed uniform buffers with a single call\n * - It performs some book keeping on what has changed to minimize unnecessary writes to uniform buffers.\n */\nexport class ShaderInputs<\n ShaderPropsT extends Partial<Record<string, Record<string, unknown>>> = Partial<\n Record<string, Record<string, unknown>>\n >\n> {\n /** \n * The map of modules \n * @todo should should this include the resolved dependencies?\n */\n modules: Readonly<{[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>}>;\n\n /** Stores the uniform values for each module */\n moduleUniforms: Record<keyof ShaderPropsT, Record<string, UniformValue>>;\n /** Stores the uniform bindings for each module */\n moduleBindings: Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;\n /** Tracks if uniforms have changed */\n moduleUniformsChanged: Record<keyof ShaderPropsT, false | string>;\n\n /**\n * Create a new UniformStore instance\n * @param modules\n */\n constructor(modules: {[P in keyof ShaderPropsT]: ShaderModuleInputs<ShaderPropsT[P]>}) {\n // TODO - get all dependencies from modules\n const allModules =_resolveModules(Object.values(modules));\n log.log(1, 'Creating ShaderInputs with modules', allModules.map(m => m.name))();\n\n // Store the module definitions and create storage for uniform values and binding values, per module\n this.modules = modules;\n this.moduleUniforms = {} as Record<keyof ShaderPropsT, Record<string, UniformValue>>;\n this.moduleBindings = {} as Record<keyof ShaderPropsT, Record<string, Texture | Sampler>>;\n\n // Initialize the modules\n for (const [name, module] of Object.entries(modules)) {\n const moduleName = name as keyof ShaderPropsT;\n\n // Get default uniforms from module\n this.moduleUniforms[moduleName] = module.defaultUniforms || {};\n this.moduleBindings[moduleName] = {};\n }\n }\n\n /** Destroy */\n destroy(): void {}\n\n /**\n * Set module props\n */\n setProps(props: Partial<{[P in keyof ShaderPropsT]?: Partial<ShaderPropsT[P]>}>): void {\n for (const name of Object.keys(props)) {\n const moduleName = name as keyof ShaderPropsT;\n const moduleProps = props[moduleName];\n const module = this.modules[moduleName];\n\n const oldUniforms = this.moduleUniforms[moduleName]; \n const uniforms = module.getUniforms?.(moduleProps, this.moduleUniforms[moduleName]) || moduleProps as any;\n // console.error(uniforms)\n this.moduleUniforms[moduleName] = {...oldUniforms, ...uniforms};\n // this.moduleUniformsChanged ||= moduleName;\n\n // console.log(`setProps(${String(moduleName)}`, moduleName, this.moduleUniforms[moduleName])\n\n // TODO - Get Module bindings\n // const bindings = module.getBindings?.(moduleProps);\n // this.moduleUniforms[moduleName] = bindings;\n }\n }\n\n /** Merges all bindings for the shader (from the various modules) */\n // getUniformBlocks(): Record<string, Texture | Sampler> {\n // return this.moduleUniforms;\n // }\n\n /** \n * Return the map of modules \n * @todo should should this include the resolved dependencies?\n */\n getModules(): ShaderModuleInstance[] {\n return Object.values(this.modules);\n }\n\n /** Get all uniform values for all modules */\n getUniformValues(): Record<keyof ShaderPropsT, Record<string, UniformValue>> {\n return this.moduleUniforms;\n }\n\n /** Merges all bindings for the shader (from the various modules) */\n getBindings(): Record<string, Texture | Sampler> {\n const bindings = {} as Record<string, Texture | Sampler>;\n for (const moduleBindings of Object.values(this.moduleBindings)) {\n Object.assign(bindings, moduleBindings);\n }\n return bindings;\n }\n}\n"],"mappings":"AAEA,SAAQA,GAAG,QAAO,eAAe;AAEjC,SAAQC,eAAe,QAA6B,sBAAsB;AAiC1E,OAAO,MAAMC,YAAY,CAIvB;EAkBAC,WAAWA,CAACC,OAAyE,EAAE;IAAA,KAbvFA,OAAO;IAAA,KAGPC,cAAc;IAAA,KAEdC,cAAc;IAAA,KAEdC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AEzG,IAAI,CAAClB,cAAc,CAACW,UAAU,CAAC,GAAG;QAAC,GAAGQ,WAAW;QAAE,GAAGC;MAAQ,CAAC;IAQjE;EACF;EAWAG,UAAUA,CAAA,EAA2B;IACnC,OAAOnB,MAAM,CAACC,MAAM,CAAC,IAAI,CAACN,OAAO,CAAC;EACpC;EAGAyB,gBAAgBA,CAAA,EAA6D;IAC3E,OAAO,IAAI,CAACxB,cAAc;EAC5B;EAGAyB,WAAWA,CAAA,EAAsC;IAC/C,MAAMC,QAAQ,GAAG,CAAC,CAAsC;IACxD,KAAK,MAAMzB,cAAc,IAAIG,MAAM,CAACC,MAAM,CAAC,IAAI,CAACJ,cAAc,CAAC,EAAE;MAC/DG,MAAM,CAACuB,MAAM,CAACD,QAAQ,EAAEzB,cAAc,CAAC;IACzC;IACA,OAAOyB,QAAQ;EACjB;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Device, Buffer, BufferRange, TransformFeedback, RenderPassProps } from '@luma.gl/core';
|
|
2
|
+
import { Model } from '../model/model';
|
|
3
|
+
import type { ModelProps } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* Properties for creating a {@link BufferTransform}
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
8
|
+
export type BufferTransformProps = Omit<ModelProps, 'fs'> & {
|
|
9
|
+
fs?: ModelProps['fs'];
|
|
10
|
+
feedbackBuffers?: Record<string, Buffer | BufferRange>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Creates a pipeline for buffer→buffer transforms.
|
|
14
|
+
* @deprecated
|
|
15
|
+
*/
|
|
16
|
+
export declare class BufferTransform {
|
|
17
|
+
readonly device: Device;
|
|
18
|
+
readonly model: Model;
|
|
19
|
+
readonly transformFeedback: TransformFeedback;
|
|
20
|
+
/** @deprecated Use device feature test. */
|
|
21
|
+
static isSupported(device: Device): boolean;
|
|
22
|
+
constructor(device: Device, props?: BufferTransformProps);
|
|
23
|
+
/** Destroy owned resources. */
|
|
24
|
+
destroy(): void;
|
|
25
|
+
/** @deprecated Use {@link destroy}. */
|
|
26
|
+
delete(): void;
|
|
27
|
+
/** Run one transform loop. */
|
|
28
|
+
run(options?: RenderPassProps): void;
|
|
29
|
+
/** @deprecated */
|
|
30
|
+
update(...args: any[]): void;
|
|
31
|
+
/** Returns the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
32
|
+
getBuffer(varyingName: string): Buffer | BufferRange | null;
|
|
33
|
+
readAsync(varyingName: string): Promise<Uint8Array>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=buffer-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-transform.d.ts","sourceRoot":"","sources":["../../src/transform/buffer-transform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAU,eAAe,EAAC,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG;IAC1D,EAAE,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;CACxD,CAAC;AAEF;;;GAGG;AACH,qBAAa,eAAe;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAE9C,2CAA2C;IAC3C,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;gBAI/B,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,oBAAyC;IAsB5E,+BAA+B;IAC/B,OAAO,IAAI,IAAI;IAMf,uCAAuC;IACvC,MAAM,IAAI,IAAI;IAId,8BAA8B;IAC9B,GAAG,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI;IAMpC,kBAAkB;IAClB,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO5B,gFAAgF;IAChF,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI;IAI3D,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAQpD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Buffer, assert } from '@luma.gl/core';
|
|
2
|
+
import { getPassthroughFS } from '@luma.gl/shadertools';
|
|
3
|
+
import { Model } from "../model/model.js";
|
|
4
|
+
export class BufferTransform {
|
|
5
|
+
static isSupported(device) {
|
|
6
|
+
return device.features.has('transform-feedback-webgl2');
|
|
7
|
+
}
|
|
8
|
+
constructor(device) {
|
|
9
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Model.defaultProps;
|
|
10
|
+
this.device = void 0;
|
|
11
|
+
this.model = void 0;
|
|
12
|
+
this.transformFeedback = void 0;
|
|
13
|
+
assert(device.features.has('transform-feedback-webgl2'), 'Device must support transform feedback');
|
|
14
|
+
this.device = device;
|
|
15
|
+
this.model = new Model(this.device, {
|
|
16
|
+
id: props.id || 'buffer-transform-model',
|
|
17
|
+
fs: props.fs || getPassthroughFS({
|
|
18
|
+
version: 300
|
|
19
|
+
}),
|
|
20
|
+
topology: props.topology || 'point-list',
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
this.transformFeedback = this.device.createTransformFeedback({
|
|
24
|
+
layout: this.model.pipeline.shaderLayout,
|
|
25
|
+
buffers: props.feedbackBuffers
|
|
26
|
+
});
|
|
27
|
+
this.model.setTransformFeedback(this.transformFeedback);
|
|
28
|
+
Object.seal(this);
|
|
29
|
+
}
|
|
30
|
+
destroy() {
|
|
31
|
+
if (this.model) {
|
|
32
|
+
this.model.destroy();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
delete() {
|
|
36
|
+
this.destroy();
|
|
37
|
+
}
|
|
38
|
+
run(options) {
|
|
39
|
+
const renderPass = this.device.beginRenderPass(options);
|
|
40
|
+
this.model.draw(renderPass);
|
|
41
|
+
renderPass.end();
|
|
42
|
+
}
|
|
43
|
+
update() {
|
|
44
|
+
console.warn('TextureTransform#update() not implemented');
|
|
45
|
+
}
|
|
46
|
+
getBuffer(varyingName) {
|
|
47
|
+
return this.transformFeedback.getBuffer(varyingName);
|
|
48
|
+
}
|
|
49
|
+
readAsync(varyingName) {
|
|
50
|
+
const result = this.getBuffer(varyingName);
|
|
51
|
+
if (result instanceof Buffer) {
|
|
52
|
+
return result.readAsync();
|
|
53
|
+
}
|
|
54
|
+
const {
|
|
55
|
+
buffer,
|
|
56
|
+
byteOffset = 0,
|
|
57
|
+
byteLength = buffer.byteLength
|
|
58
|
+
} = result;
|
|
59
|
+
return buffer.readAsync(byteOffset, byteLength);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=buffer-transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-transform.js","names":["Buffer","assert","getPassthroughFS","Model","BufferTransform","isSupported","device","features","has","constructor","props","arguments","length","undefined","defaultProps","model","transformFeedback","id","fs","version","topology","createTransformFeedback","layout","pipeline","shaderLayout","buffers","feedbackBuffers","setTransformFeedback","Object","seal","destroy","delete","run","options","renderPass","beginRenderPass","draw","end","update","console","warn","getBuffer","varyingName","readAsync","result","buffer","byteOffset","byteLength"],"sources":["../../src/transform/buffer-transform.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {Device, Buffer, BufferRange, TransformFeedback, assert, RenderPassProps} from '@luma.gl/core';\nimport {getPassthroughFS} from '@luma.gl/shadertools';\nimport {Model} from '../model/model';\nimport type { ModelProps } from '..';\n\n/**\n * Properties for creating a {@link BufferTransform}\n * @deprecated\n */\nexport type BufferTransformProps = Omit<ModelProps, 'fs'> & {\n fs?: ModelProps['fs']; // override as optional\n feedbackBuffers?: Record<string, Buffer | BufferRange>;\n};\n\n/**\n * Creates a pipeline for buffer→buffer transforms.\n * @deprecated\n */\nexport class BufferTransform {\n readonly device: Device;\n readonly model: Model;\n readonly transformFeedback: TransformFeedback;\n\n /** @deprecated Use device feature test. */\n static isSupported(device: Device): boolean {\n return device.features.has('transform-feedback-webgl2');\n }\n\n constructor(device: Device, props: BufferTransformProps = Model.defaultProps) {\n assert(device.features.has('transform-feedback-webgl2'), 'Device must support transform feedback');\n\n this.device = device;\n\n this.model = new Model(this.device, {\n id: props.id || 'buffer-transform-model',\n fs: props.fs || getPassthroughFS({version: 300}),\n topology: props.topology || 'point-list',\n ...props,\n });\n\n this.transformFeedback = this.device.createTransformFeedback({\n layout: this.model.pipeline.shaderLayout,\n buffers: props.feedbackBuffers,\n });\n\n this.model.setTransformFeedback(this.transformFeedback);\n\n Object.seal(this);\n }\n\n /** Destroy owned resources. */\n destroy(): void {\n if (this.model) {\n this.model.destroy();\n }\n }\n\n /** @deprecated Use {@link destroy}. */\n delete(): void {\n this.destroy();\n }\n\n /** Run one transform loop. */\n run(options?: RenderPassProps): void {\n const renderPass = this.device.beginRenderPass(options);\n this.model.draw(renderPass);\n renderPass.end();\n }\n\n /** @deprecated */\n update(...args: any[]): void {\n // TODO(v9): Method should likely be removed for v9. Keeping a method stub\n // to assist with migrating DeckGL usage.\n // eslint-disable-next-line no-console\n console.warn('TextureTransform#update() not implemented');\n }\n\n /** Returns the {@link Buffer} or {@link BufferRange} for given varying name. */\n getBuffer(varyingName: string): Buffer | BufferRange | null {\n return this.transformFeedback.getBuffer(varyingName);\n }\n\n readAsync(varyingName: string): Promise<Uint8Array> {\n const result = this.getBuffer(varyingName);\n if (result instanceof Buffer) {\n return result.readAsync();\n }\n const {buffer, byteOffset = 0, byteLength = buffer.byteLength} = result;\n return buffer.readAsync(byteOffset, byteLength);\n }\n}\n"],"mappings":"AAGA,SAAgBA,MAAM,EAAkCC,MAAM,QAAwB,eAAe;AACrG,SAAQC,gBAAgB,QAAO,sBAAsB;AAAC,SAC9CC,KAAK;AAgBb,OAAO,MAAMC,eAAe,CAAC;EAM3B,OAAOC,WAAWA,CAACC,MAAc,EAAW;IAC1C,OAAOA,MAAM,CAACC,QAAQ,CAACC,GAAG,CAAC,2BAA2B,CAAC;EACzD;EAEAC,WAAWA,CAACH,MAAc,EAAoD;IAAA,IAAlDI,KAA2B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGR,KAAK,CAACW,YAAY;IAAA,KATnER,MAAM;IAAA,KACNS,KAAK;IAAA,KACLC,iBAAiB;IAQxBf,MAAM,CAACK,MAAM,CAACC,QAAQ,CAACC,GAAG,CAAC,2BAA2B,CAAC,EAAE,wCAAwC,CAAC;IAElG,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACS,KAAK,GAAG,IAAIZ,KAAK,CAAC,IAAI,CAACG,MAAM,EAAE;MAClCW,EAAE,EAAEP,KAAK,CAACO,EAAE,IAAI,wBAAwB;MACxCC,EAAE,EAAER,KAAK,CAACQ,EAAE,IAAIhB,gBAAgB,CAAC;QAACiB,OAAO,EAAE;MAAG,CAAC,CAAC;MAChDC,QAAQ,EAAEV,KAAK,CAACU,QAAQ,IAAI,YAAY;MACxC,GAAGV;IACL,CAAC,CAAC;IAEF,IAAI,CAACM,iBAAiB,GAAG,IAAI,CAACV,MAAM,CAACe,uBAAuB,CAAC;MAC3DC,MAAM,EAAE,IAAI,CAACP,KAAK,CAACQ,QAAQ,CAACC,YAAY;MACxCC,OAAO,EAAEf,KAAK,CAACgB;IACjB,CAAC,CAAC;IAEF,IAAI,CAACX,KAAK,CAACY,oBAAoB,CAAC,IAAI,CAACX,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