@luma.gl/engine 9.0.0-beta.3 → 9.0.0-beta.5
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/key-frames.js +54 -54
- package/dist/animation/timeline.js +95 -100
- package/dist/animation-loop/animation-loop-template.js +17 -5
- package/dist/animation-loop/animation-loop.js +425 -356
- package/dist/animation-loop/animation-props.js +0 -1
- package/dist/animation-loop/make-animation-loop.js +27 -25
- package/dist/debug/copy-texture-to-image.js +39 -43
- package/dist/debug/debug-framebuffer.js +43 -39
- package/dist/debug/debug-shader-layout.js +24 -25
- package/dist/debug/pixel-data-utils.js +33 -36
- package/dist/dist.dev.js +3784 -8642
- package/dist/geometries/cone-geometry.js +12 -18
- package/dist/geometries/cube-geometry.js +189 -62
- package/dist/geometries/cylinder-geometry.js +10 -15
- package/dist/geometries/ico-sphere-geometry.js +142 -161
- package/dist/geometries/plane-geometry.js +94 -112
- package/dist/geometries/sphere-geometry.js +77 -96
- package/dist/geometries/truncated-cone-geometry.js +100 -118
- package/dist/geometry/geometry-table.js +0 -1
- package/dist/geometry/geometry-utils.js +35 -32
- package/dist/geometry/geometry.js +77 -71
- package/dist/geometry/gpu-geometry.js +80 -99
- package/dist/geometry/gpu-table.js +41 -1
- package/dist/index.cjs +81 -127
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +27 -24
- package/dist/lib/clip-space.d.ts +1 -1
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +26 -30
- package/dist/lib/pipeline-factory.d.ts +1 -5
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +61 -68
- package/dist/model/model.d.ts +2 -2
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +539 -413
- package/dist/scenegraph/group-node.js +69 -84
- package/dist/scenegraph/model-node.js +32 -25
- package/dist/scenegraph/scenegraph-node.js +136 -124
- package/dist/shader-inputs.js +96 -58
- package/dist/transform/buffer-transform.js +65 -58
- package/dist/transform/texture-transform.d.ts.map +1 -1
- package/dist/transform/texture-transform.js +108 -115
- package/dist.min.js +3 -271
- package/package.json +10 -9
- package/src/lib/clip-space.ts +2 -1
- package/src/lib/pipeline-factory.ts +8 -21
- package/src/model/model.ts +5 -5
- package/src/transform/buffer-transform.ts +3 -3
- package/src/transform/texture-transform.ts +0 -2
- package/dist/animation/key-frames.js.map +0 -1
- package/dist/animation/timeline.js.map +0 -1
- package/dist/animation-loop/animation-loop-template.js.map +0 -1
- package/dist/animation-loop/animation-loop.js.map +0 -1
- package/dist/animation-loop/animation-props.js.map +0 -1
- package/dist/animation-loop/make-animation-loop.js.map +0 -1
- package/dist/debug/copy-texture-to-image.js.map +0 -1
- package/dist/debug/debug-framebuffer.js.map +0 -1
- package/dist/debug/debug-shader-layout.js.map +0 -1
- package/dist/debug/pixel-data-utils.js.map +0 -1
- package/dist/geometries/cone-geometry.js.map +0 -1
- package/dist/geometries/cube-geometry.js.map +0 -1
- package/dist/geometries/cylinder-geometry.js.map +0 -1
- package/dist/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/geometries/plane-geometry.js.map +0 -1
- package/dist/geometries/sphere-geometry.js.map +0 -1
- package/dist/geometries/truncated-cone-geometry.js.map +0 -1
- package/dist/geometry/geometry-table.js.map +0 -1
- package/dist/geometry/geometry-utils.js.map +0 -1
- package/dist/geometry/geometry.js.map +0 -1
- package/dist/geometry/gpu-geometry.js.map +0 -1
- package/dist/geometry/gpu-table.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/clip-space.js.map +0 -1
- package/dist/lib/pipeline-factory.js.map +0 -1
- package/dist/model/model.js.map +0 -1
- package/dist/scenegraph/group-node.js.map +0 -1
- package/dist/scenegraph/model-node.js.map +0 -1
- package/dist/scenegraph/scenegraph-node.js.map +0 -1
- package/dist/shader-inputs.js.map +0 -1
- package/dist/transform/buffer-transform.js.map +0 -1
- package/dist/transform/texture-transform.js.map +0 -1
|
@@ -1,62 +1,69 @@
|
|
|
1
|
+
// luma.gl, MIT license
|
|
2
|
+
// Copyright (c) vis.gl contributors
|
|
1
3
|
import { Buffer, assert } from '@luma.gl/core';
|
|
2
4
|
import { getPassthroughFS } from '@luma.gl/shadertools';
|
|
3
|
-
import { Model } from
|
|
5
|
+
import { Model } from '../model/model';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a pipeline for buffer→buffer transforms.
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
4
10
|
export class BufferTransform {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
11
|
+
device;
|
|
12
|
+
model;
|
|
13
|
+
transformFeedback;
|
|
14
|
+
/** @deprecated Use device feature test. */
|
|
15
|
+
static isSupported(device) {
|
|
16
|
+
return device.features.has('transform-feedback-webgl');
|
|
17
|
+
}
|
|
18
|
+
constructor(device, props = Model.defaultProps) {
|
|
19
|
+
assert(device.features.has('transform-feedback-webgl'), 'Device must support transform feedback');
|
|
20
|
+
this.device = device;
|
|
21
|
+
this.model = new Model(this.device, {
|
|
22
|
+
id: props.id || 'buffer-transform-model',
|
|
23
|
+
fs: props.fs || getPassthroughFS(),
|
|
24
|
+
topology: props.topology || 'point-list',
|
|
25
|
+
...props,
|
|
26
|
+
});
|
|
27
|
+
this.transformFeedback = this.device.createTransformFeedback({
|
|
28
|
+
layout: this.model.pipeline.shaderLayout,
|
|
29
|
+
buffers: props.feedbackBuffers,
|
|
30
|
+
});
|
|
31
|
+
this.model.setTransformFeedback(this.transformFeedback);
|
|
32
|
+
Object.seal(this);
|
|
33
|
+
}
|
|
34
|
+
/** Destroy owned resources. */
|
|
35
|
+
destroy() {
|
|
36
|
+
if (this.model) {
|
|
37
|
+
this.model.destroy();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** @deprecated Use {@link destroy}. */
|
|
41
|
+
delete() {
|
|
42
|
+
this.destroy();
|
|
43
|
+
}
|
|
44
|
+
/** Run one transform loop. */
|
|
45
|
+
run(options) {
|
|
46
|
+
const renderPass = this.device.beginRenderPass(options);
|
|
47
|
+
this.model.draw(renderPass);
|
|
48
|
+
renderPass.end();
|
|
49
|
+
}
|
|
50
|
+
/** @deprecated */
|
|
51
|
+
update(...args) {
|
|
52
|
+
// TODO(v9): Method should likely be removed for v9. Keeping a method stub
|
|
53
|
+
// to assist with migrating DeckGL usage.
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.warn('TextureTransform#update() not implemented');
|
|
56
|
+
}
|
|
57
|
+
/** Returns the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
58
|
+
getBuffer(varyingName) {
|
|
59
|
+
return this.transformFeedback.getBuffer(varyingName);
|
|
60
|
+
}
|
|
61
|
+
readAsync(varyingName) {
|
|
62
|
+
const result = this.getBuffer(varyingName);
|
|
63
|
+
if (result instanceof Buffer) {
|
|
64
|
+
return result.readAsync();
|
|
65
|
+
}
|
|
66
|
+
const { buffer, byteOffset = 0, byteLength = buffer.byteLength } = result;
|
|
67
|
+
return buffer.readAsync(byteOffset, byteLength);
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
|
-
//# sourceMappingURL=buffer-transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture-transform.d.ts","sourceRoot":"","sources":["../../src/transform/texture-transform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG;IAC3D,EAAE,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,4CAA4C;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,aAAa,EAAE,OAAO,CAAC;IACvB,qBAAqB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF,KAAK,cAAc,GAAG;IACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAIF;;;GAGG;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l, MIT license
|
|
2
|
+
// Copyright (c) vis.gl contributors
|
|
3
|
+
import { Model } from '../model/model';
|
|
2
4
|
import { getPassthroughFS } from '@luma.gl/shadertools';
|
|
3
5
|
const FS_OUTPUT_VARIABLE = 'transform_output';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a pipeline for texture→texture transforms.
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
4
10
|
export class TextureTransform {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
destroy() {}
|
|
36
|
-
delete() {
|
|
37
|
-
this.destroy();
|
|
38
|
-
}
|
|
39
|
-
run(options) {
|
|
40
|
-
const {
|
|
41
|
-
framebuffer
|
|
42
|
-
} = this.bindings[this.currentIndex];
|
|
43
|
-
const renderPass = this.device.beginRenderPass({
|
|
44
|
-
framebuffer,
|
|
45
|
-
...options
|
|
46
|
-
});
|
|
47
|
-
this.model.draw(renderPass);
|
|
48
|
-
renderPass.end();
|
|
49
|
-
}
|
|
50
|
-
update() {
|
|
51
|
-
console.warn('TextureTransform#update() not implemented');
|
|
52
|
-
}
|
|
53
|
-
getData() {
|
|
54
|
-
let {
|
|
55
|
-
packed = false
|
|
56
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
-
throw new Error('getData() not implemented');
|
|
58
|
-
}
|
|
59
|
-
getTargetTexture() {
|
|
60
|
-
const {
|
|
61
|
-
targetTexture
|
|
62
|
-
} = this.bindings[this.currentIndex];
|
|
63
|
-
return targetTexture;
|
|
64
|
-
}
|
|
65
|
-
getFramebuffer() {
|
|
66
|
-
const currentResources = this.bindings[this.currentIndex];
|
|
67
|
-
return currentResources.framebuffer;
|
|
68
|
-
}
|
|
69
|
-
_initialize(props) {
|
|
70
|
-
this._updateBindings(props);
|
|
71
|
-
}
|
|
72
|
-
_updateBindings(props) {
|
|
73
|
-
this.bindings[this.currentIndex] = this._updateBinding(this.bindings[this.currentIndex], props);
|
|
74
|
-
}
|
|
75
|
-
_updateBinding(binding, _ref) {
|
|
76
|
-
let {
|
|
77
|
-
sourceBuffers,
|
|
78
|
-
sourceTextures,
|
|
79
|
-
targetTexture
|
|
80
|
-
} = _ref;
|
|
81
|
-
if (!binding) {
|
|
82
|
-
binding = {
|
|
83
|
-
sourceBuffers: {},
|
|
84
|
-
sourceTextures: {},
|
|
85
|
-
targetTexture: null
|
|
86
|
-
};
|
|
11
|
+
device;
|
|
12
|
+
model;
|
|
13
|
+
sampler;
|
|
14
|
+
currentIndex = 0;
|
|
15
|
+
samplerTextureMap = null;
|
|
16
|
+
bindings = []; // each element is an object : {sourceTextures, targetTexture, framebuffer}
|
|
17
|
+
resources = {}; // resources to be deleted
|
|
18
|
+
constructor(device, props) {
|
|
19
|
+
this.device = device;
|
|
20
|
+
// For precise picking of element IDs.
|
|
21
|
+
this.sampler = device.createSampler({
|
|
22
|
+
addressModeU: 'clamp-to-edge',
|
|
23
|
+
addressModeV: 'clamp-to-edge',
|
|
24
|
+
minFilter: 'nearest',
|
|
25
|
+
magFilter: 'nearest',
|
|
26
|
+
mipmapFilter: 'nearest',
|
|
27
|
+
});
|
|
28
|
+
this.model = new Model(this.device, {
|
|
29
|
+
id: props.id || 'texture-transform-model',
|
|
30
|
+
fs: props.fs || getPassthroughFS({
|
|
31
|
+
input: props.targetTextureVarying,
|
|
32
|
+
inputChannels: props.targetTextureChannels,
|
|
33
|
+
output: FS_OUTPUT_VARIABLE
|
|
34
|
+
}),
|
|
35
|
+
vertexCount: props.vertexCount, // TODO(donmccurdy): Naming?
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
this._initialize(props);
|
|
39
|
+
Object.seal(this);
|
|
87
40
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
width,
|
|
94
|
-
height
|
|
95
|
-
} = targetTexture;
|
|
96
|
-
if (binding.framebuffer) {
|
|
97
|
-
binding.framebuffer.destroy();
|
|
98
|
-
}
|
|
99
|
-
binding.framebuffer = this.device.createFramebuffer({
|
|
100
|
-
id: 'transform-framebuffer',
|
|
101
|
-
width,
|
|
102
|
-
height,
|
|
103
|
-
colorAttachments: [targetTexture]
|
|
104
|
-
});
|
|
105
|
-
binding.framebuffer.resize({
|
|
106
|
-
width,
|
|
107
|
-
height
|
|
108
|
-
});
|
|
41
|
+
// Delete owned resources.
|
|
42
|
+
destroy() { }
|
|
43
|
+
/** @deprecated Use {@link destroy}. */
|
|
44
|
+
delete() {
|
|
45
|
+
this.destroy();
|
|
109
46
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
47
|
+
run(options) {
|
|
48
|
+
const { framebuffer } = this.bindings[this.currentIndex];
|
|
49
|
+
const renderPass = this.device.beginRenderPass({ framebuffer, ...options });
|
|
50
|
+
this.model.draw(renderPass);
|
|
51
|
+
renderPass.end();
|
|
52
|
+
}
|
|
53
|
+
/** @deprecated */
|
|
54
|
+
update(...args) {
|
|
55
|
+
// TODO(v9): Method should likely be removed for v9. Keeping a method stub
|
|
56
|
+
// to assist with migrating DeckGL usage.
|
|
57
|
+
// eslint-disable-next-line no-console
|
|
58
|
+
console.warn('TextureTransform#update() not implemented');
|
|
59
|
+
}
|
|
60
|
+
getData({ packed = false } = {}) {
|
|
61
|
+
// TODO(v9): Method should likely be removed for v9. Keeping a method stub
|
|
62
|
+
// to assist with migrating DeckGL usage.
|
|
63
|
+
throw new Error('getData() not implemented');
|
|
64
|
+
}
|
|
65
|
+
getTargetTexture() {
|
|
66
|
+
const { targetTexture } = this.bindings[this.currentIndex];
|
|
67
|
+
return targetTexture;
|
|
68
|
+
}
|
|
69
|
+
getFramebuffer() {
|
|
70
|
+
const currentResources = this.bindings[this.currentIndex];
|
|
71
|
+
return currentResources.framebuffer;
|
|
72
|
+
}
|
|
73
|
+
// Private
|
|
74
|
+
_initialize(props) {
|
|
75
|
+
this._updateBindings(props);
|
|
76
|
+
}
|
|
77
|
+
_updateBindings(props) {
|
|
78
|
+
this.bindings[this.currentIndex] = this._updateBinding(this.bindings[this.currentIndex], props);
|
|
79
|
+
}
|
|
80
|
+
_updateBinding(binding, { sourceBuffers, sourceTextures, targetTexture }) {
|
|
81
|
+
if (!binding) {
|
|
82
|
+
binding = {
|
|
83
|
+
sourceBuffers: {},
|
|
84
|
+
sourceTextures: {},
|
|
85
|
+
targetTexture: null
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
Object.assign(binding.sourceTextures, sourceTextures);
|
|
89
|
+
Object.assign(binding.sourceBuffers, sourceBuffers);
|
|
90
|
+
if (targetTexture) {
|
|
91
|
+
binding.targetTexture = targetTexture;
|
|
92
|
+
const { width, height } = targetTexture;
|
|
93
|
+
// TODO(donmccurdy): When is this called, and is this expected?
|
|
94
|
+
if (binding.framebuffer) {
|
|
95
|
+
binding.framebuffer.destroy();
|
|
96
|
+
}
|
|
97
|
+
binding.framebuffer = this.device.createFramebuffer({
|
|
98
|
+
id: 'transform-framebuffer',
|
|
99
|
+
width,
|
|
100
|
+
height,
|
|
101
|
+
colorAttachments: [targetTexture]
|
|
102
|
+
});
|
|
103
|
+
binding.framebuffer.resize({ width, height });
|
|
104
|
+
}
|
|
105
|
+
return binding;
|
|
106
|
+
}
|
|
107
|
+
// set texture filtering parameters on source textures.
|
|
108
|
+
_setSourceTextureParameters() {
|
|
109
|
+
const index = this.currentIndex;
|
|
110
|
+
const { sourceTextures } = this.bindings[index];
|
|
111
|
+
for (const name in sourceTextures) {
|
|
112
|
+
sourceTextures[name].sampler = this.sampler;
|
|
113
|
+
}
|
|
119
114
|
}
|
|
120
|
-
}
|
|
121
115
|
}
|
|
122
|
-
//# sourceMappingURL=texture-transform.js.map
|