@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,37 +1,40 @@
|
|
|
1
|
+
// import type {Geometry} from './geometry';
|
|
1
2
|
export function unpackIndexedGeometry(geometry) {
|
|
2
|
-
|
|
3
|
-
indices
|
|
4
|
-
|
|
5
|
-
} = geometry;
|
|
6
|
-
if (!indices) {
|
|
7
|
-
return geometry;
|
|
8
|
-
}
|
|
9
|
-
const vertexCount = indices.value.length;
|
|
10
|
-
const unpackedAttributes = {};
|
|
11
|
-
for (const attributeName in attributes) {
|
|
12
|
-
const attribute = attributes[attributeName];
|
|
13
|
-
const {
|
|
14
|
-
constant,
|
|
15
|
-
value,
|
|
16
|
-
size
|
|
17
|
-
} = attribute;
|
|
18
|
-
if (constant || !size) {
|
|
19
|
-
continue;
|
|
3
|
+
const { indices, attributes } = geometry;
|
|
4
|
+
if (!indices) {
|
|
5
|
+
return geometry;
|
|
20
6
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
const vertexCount = indices.value.length;
|
|
8
|
+
const unpackedAttributes = {};
|
|
9
|
+
for (const attributeName in attributes) {
|
|
10
|
+
const attribute = attributes[attributeName];
|
|
11
|
+
const { constant, value, size } = attribute;
|
|
12
|
+
if (constant || !size) {
|
|
13
|
+
continue; // eslint-disable-line
|
|
14
|
+
}
|
|
15
|
+
const unpackedValue = new value.constructor(vertexCount * size);
|
|
16
|
+
for (let x = 0; x < vertexCount; ++x) {
|
|
17
|
+
const index = indices.value[x];
|
|
18
|
+
for (let i = 0; i < size; i++) {
|
|
19
|
+
unpackedValue[x * size + i] = value[index * size + i];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
unpackedAttributes[attributeName] = { size, value: unpackedValue };
|
|
27
23
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
value: unpackedValue
|
|
24
|
+
return {
|
|
25
|
+
attributes: Object.assign({}, attributes, unpackedAttributes)
|
|
31
26
|
};
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
attributes: Object.assign({}, attributes, unpackedAttributes)
|
|
35
|
-
};
|
|
36
27
|
}
|
|
37
|
-
|
|
28
|
+
// export function calculateVertexNormals(positions: Float32Array): Uint8Array {
|
|
29
|
+
// let normals = new Uint8Array(positions.length / 3);
|
|
30
|
+
// for (let i = 0; i < positions.length; i++) {
|
|
31
|
+
// const vec1 = new Vector3(positions.subarray(i * 3, i + 0, i + 3));
|
|
32
|
+
// const vec2 = new Vector3(positions.subarray(i + 3, i + 6));
|
|
33
|
+
// const vec3 = new Vector3(positions.subarray(i + 6, i + 9));
|
|
34
|
+
// const normal = new Vector3(vec1).cross(vec2).normalize();
|
|
35
|
+
// normals.set(normal[0], i + 4);
|
|
36
|
+
// normals.set(normal[1], i + 4 + 1);
|
|
37
|
+
// normals.set(normal[2], i + 2);
|
|
38
|
+
// }
|
|
39
|
+
// const normal = new Vector3(vec1).cross(vec2).normalize();
|
|
40
|
+
// }
|
|
@@ -1,79 +1,85 @@
|
|
|
1
1
|
import { uid, assert } from '@luma.gl/core';
|
|
2
2
|
export class Geometry {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
id;
|
|
4
|
+
/** Determines how vertices are read from the 'vertex' attributes */
|
|
5
|
+
topology;
|
|
6
|
+
vertexCount;
|
|
7
|
+
indices;
|
|
8
|
+
attributes;
|
|
9
|
+
userData = {};
|
|
10
|
+
constructor(props) {
|
|
11
|
+
const { attributes = {}, indices = null, vertexCount = null } = props;
|
|
12
|
+
this.id = props.id || uid('geometry');
|
|
13
|
+
this.topology = props.topology;
|
|
14
|
+
if (indices) {
|
|
15
|
+
this.indices = ArrayBuffer.isView(indices) ? { value: indices, size: 1 } : indices;
|
|
16
|
+
}
|
|
17
|
+
// @ts-expect-error
|
|
18
|
+
this.attributes = {};
|
|
19
|
+
for (const [attributeName, attributeValue] of Object.entries(attributes)) {
|
|
20
|
+
// Wrap "unwrapped" arrays and try to autodetect their type
|
|
21
|
+
const attribute = ArrayBuffer.isView(attributeValue)
|
|
22
|
+
? { value: attributeValue }
|
|
23
|
+
: attributeValue;
|
|
24
|
+
assert(ArrayBuffer.isView(attribute.value), `${this._print(attributeName)}: must be typed array or object with value as typed array`);
|
|
25
|
+
if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {
|
|
26
|
+
attribute.size = 3;
|
|
27
|
+
}
|
|
28
|
+
// Move indices to separate field
|
|
29
|
+
if (attributeName === 'indices') {
|
|
30
|
+
assert(!this.indices);
|
|
31
|
+
this.indices = attribute;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.attributes[attributeName] = attribute;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (this.indices && this.indices.isIndexed !== undefined) {
|
|
38
|
+
this.indices = Object.assign({}, this.indices);
|
|
39
|
+
delete this.indices.isIndexed;
|
|
40
|
+
}
|
|
41
|
+
this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);
|
|
22
42
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const attribute = ArrayBuffer.isView(attributeValue) ? {
|
|
26
|
-
value: attributeValue
|
|
27
|
-
} : attributeValue;
|
|
28
|
-
assert(ArrayBuffer.isView(attribute.value), `${this._print(attributeName)}: must be typed array or object with value as typed array`);
|
|
29
|
-
if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {
|
|
30
|
-
attribute.size = 3;
|
|
31
|
-
}
|
|
32
|
-
if (attributeName === 'indices') {
|
|
33
|
-
assert(!this.indices);
|
|
34
|
-
this.indices = attribute;
|
|
35
|
-
} else {
|
|
36
|
-
this.attributes[attributeName] = attribute;
|
|
37
|
-
}
|
|
43
|
+
getVertexCount() {
|
|
44
|
+
return this.vertexCount;
|
|
38
45
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Return an object with all attributes plus indices added as a field.
|
|
48
|
+
* TODO Geometry types are a mess
|
|
49
|
+
*/
|
|
50
|
+
getAttributes() {
|
|
51
|
+
return this.indices ? { indices: this.indices, ...this.attributes } : this.attributes;
|
|
42
52
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return this.vertexCount;
|
|
47
|
-
}
|
|
48
|
-
getAttributes() {
|
|
49
|
-
return this.indices ? {
|
|
50
|
-
indices: this.indices,
|
|
51
|
-
...this.attributes
|
|
52
|
-
} : this.attributes;
|
|
53
|
-
}
|
|
54
|
-
_print(attributeName) {
|
|
55
|
-
return `Geometry ${this.id} attribute ${attributeName}`;
|
|
56
|
-
}
|
|
57
|
-
_setAttributes(attributes, indices) {
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
_calculateVertexCount(attributes, indices) {
|
|
61
|
-
if (indices) {
|
|
62
|
-
return indices.value.length;
|
|
53
|
+
// PRIVATE
|
|
54
|
+
_print(attributeName) {
|
|
55
|
+
return `Geometry ${this.id} attribute ${attributeName}`;
|
|
63
56
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
/**
|
|
58
|
+
* GeometryAttribute
|
|
59
|
+
* value: typed array
|
|
60
|
+
* type: indices, vertices, uvs
|
|
61
|
+
* size: elements per vertex
|
|
62
|
+
* target: WebGL buffer type (string or constant)
|
|
63
|
+
*
|
|
64
|
+
* @param attributes
|
|
65
|
+
* @param indices
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
_setAttributes(attributes, indices) {
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
_calculateVertexCount(attributes, indices) {
|
|
72
|
+
if (indices) {
|
|
73
|
+
return indices.value.length;
|
|
74
|
+
}
|
|
75
|
+
let vertexCount = Infinity;
|
|
76
|
+
for (const attribute of Object.values(attributes)) {
|
|
77
|
+
const { value, size, constant } = attribute;
|
|
78
|
+
if (!constant && value && size >= 1) {
|
|
79
|
+
vertexCount = Math.min(vertexCount, value.length / size);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
assert(Number.isFinite(vertexCount));
|
|
83
|
+
return vertexCount;
|
|
74
84
|
}
|
|
75
|
-
assert(Number.isFinite(vertexCount));
|
|
76
|
-
return vertexCount;
|
|
77
|
-
}
|
|
78
85
|
}
|
|
79
|
-
//# sourceMappingURL=geometry.js.map
|
|
@@ -1,110 +1,91 @@
|
|
|
1
1
|
import { Buffer, uid, assert, getVertexFormatFromAttribute } from '@luma.gl/core';
|
|
2
2
|
export class GPUGeometry {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
id;
|
|
4
|
+
userData = {};
|
|
5
|
+
/** Determines how vertices are read from the 'vertex' attributes */
|
|
6
|
+
topology;
|
|
7
|
+
bufferLayout = [];
|
|
8
|
+
vertexCount;
|
|
9
|
+
indices;
|
|
10
|
+
attributes;
|
|
11
|
+
constructor(props) {
|
|
12
|
+
this.id = props.id || uid('geometry');
|
|
13
|
+
this.topology = props.topology;
|
|
14
|
+
this.indices = props.indices || null;
|
|
15
|
+
this.attributes = props.attributes;
|
|
16
|
+
this.vertexCount = props.vertexCount;
|
|
17
|
+
this.bufferLayout = props.bufferLayout || [];
|
|
18
|
+
if (this.indices) {
|
|
19
|
+
assert(this.indices.usage === Buffer.INDEX);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
destroy() {
|
|
23
|
+
this.indices.destroy();
|
|
24
|
+
this.attributes.positions.destroy();
|
|
25
|
+
this.attributes.normals.destroy();
|
|
26
|
+
this.attributes.texCoords.destroy();
|
|
27
|
+
this.attributes.colors?.destroy();
|
|
28
|
+
}
|
|
29
|
+
getVertexCount() {
|
|
30
|
+
return this.vertexCount;
|
|
31
|
+
}
|
|
32
|
+
getAttributes() {
|
|
33
|
+
return this.attributes;
|
|
34
|
+
}
|
|
35
|
+
getIndexes() {
|
|
36
|
+
return this.indices;
|
|
37
|
+
}
|
|
38
|
+
_calculateVertexCount(positions) {
|
|
39
|
+
// Assume that positions is a fully packed float32x3 buffer
|
|
40
|
+
const vertexCount = positions.byteLength / 12;
|
|
41
|
+
return vertexCount;
|
|
19
42
|
}
|
|
20
|
-
}
|
|
21
|
-
destroy() {
|
|
22
|
-
var _this$attributes$colo;
|
|
23
|
-
this.indices.destroy();
|
|
24
|
-
this.attributes.positions.destroy();
|
|
25
|
-
this.attributes.normals.destroy();
|
|
26
|
-
this.attributes.texCoords.destroy();
|
|
27
|
-
(_this$attributes$colo = this.attributes.colors) === null || _this$attributes$colo === void 0 ? void 0 : _this$attributes$colo.destroy();
|
|
28
|
-
}
|
|
29
|
-
getVertexCount() {
|
|
30
|
-
return this.vertexCount;
|
|
31
|
-
}
|
|
32
|
-
getAttributes() {
|
|
33
|
-
return this.attributes;
|
|
34
|
-
}
|
|
35
|
-
getIndexes() {
|
|
36
|
-
return this.indices;
|
|
37
|
-
}
|
|
38
|
-
_calculateVertexCount(positions) {
|
|
39
|
-
const vertexCount = positions.byteLength / 12;
|
|
40
|
-
return vertexCount;
|
|
41
|
-
}
|
|
42
43
|
}
|
|
43
44
|
export function makeGPUGeometry(device, geometry) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
indices,
|
|
57
|
-
attributes
|
|
58
|
-
});
|
|
45
|
+
if (geometry instanceof GPUGeometry) {
|
|
46
|
+
return geometry;
|
|
47
|
+
}
|
|
48
|
+
const indices = getIndexBufferFromGeometry(device, geometry);
|
|
49
|
+
const { attributes, bufferLayout } = getAttributeBuffersFromGeometry(device, geometry);
|
|
50
|
+
return new GPUGeometry({
|
|
51
|
+
topology: geometry.topology || 'triangle-list',
|
|
52
|
+
bufferLayout,
|
|
53
|
+
vertexCount: geometry.vertexCount,
|
|
54
|
+
indices,
|
|
55
|
+
attributes
|
|
56
|
+
});
|
|
59
57
|
}
|
|
60
58
|
export function getIndexBufferFromGeometry(device, geometry) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
usage: Buffer.INDEX,
|
|
67
|
-
data
|
|
68
|
-
});
|
|
59
|
+
if (!geometry.indices) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const data = geometry.indices.value;
|
|
63
|
+
return device.createBuffer({ usage: Buffer.INDEX, data });
|
|
69
64
|
}
|
|
70
65
|
export function getAttributeBuffersFromGeometry(device, geometry) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
66
|
+
const bufferLayout = [];
|
|
67
|
+
const attributes = {};
|
|
68
|
+
for (const [attributeName, attribute] of Object.entries(geometry.attributes)) {
|
|
69
|
+
let name = attributeName;
|
|
70
|
+
// TODO Map some GLTF attribute names (is this still needed?)
|
|
71
|
+
switch (attributeName) {
|
|
72
|
+
case 'POSITION':
|
|
73
|
+
name = 'positions';
|
|
74
|
+
break;
|
|
75
|
+
case 'NORMAL':
|
|
76
|
+
name = 'normals';
|
|
77
|
+
break;
|
|
78
|
+
case 'TEXCOORD_0':
|
|
79
|
+
name = 'texCoords';
|
|
80
|
+
break;
|
|
81
|
+
case 'COLOR_0':
|
|
82
|
+
name = 'colors';
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
attributes[name] = device.createBuffer({ data: attribute.value, id: `${attributeName}-buffer` });
|
|
86
|
+
const { value, size, normalized } = attribute;
|
|
87
|
+
bufferLayout.push({ name, format: getVertexFormatFromAttribute(value, size, normalized) });
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
id: `${attributeName}-buffer`
|
|
92
|
-
});
|
|
93
|
-
const {
|
|
94
|
-
value,
|
|
95
|
-
size,
|
|
96
|
-
normalized
|
|
97
|
-
} = attribute;
|
|
98
|
-
bufferLayout.push({
|
|
99
|
-
name,
|
|
100
|
-
format: getVertexFormatFromAttribute(value, size, normalized)
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices);
|
|
104
|
-
return {
|
|
105
|
-
attributes,
|
|
106
|
-
bufferLayout,
|
|
107
|
-
vertexCount
|
|
108
|
-
};
|
|
89
|
+
const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices);
|
|
90
|
+
return { attributes, bufferLayout, vertexCount };
|
|
109
91
|
}
|
|
110
|
-
//# sourceMappingURL=gpu-geometry.js.map
|
|
@@ -1,2 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
export function getAttributeLayoutsFromGeometry(geometry: Geometry) {
|
|
4
|
+
const layouts: Record<string, {}> = {};
|
|
5
|
+
let indices = geometry.indices;
|
|
1
6
|
|
|
2
|
-
|
|
7
|
+
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
8
|
+
const remappedName = mapAttributeName(name);
|
|
9
|
+
|
|
10
|
+
if (attribute.constant) {
|
|
11
|
+
throw new Error('constant attributes not supported');
|
|
12
|
+
} else {
|
|
13
|
+
const typedArray = attribute.value;
|
|
14
|
+
// Create accessor by copying the attribute and removing `value``
|
|
15
|
+
const accessor = {...attribute};
|
|
16
|
+
delete accessor.value;
|
|
17
|
+
buffers[remappedName] = [device.createBuffer(typedArray), accessor];
|
|
18
|
+
|
|
19
|
+
inferAttributeAccessor(name, accessor);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class Table {
|
|
25
|
+
length: number;
|
|
26
|
+
// columns: Record<string, TypedArray> = {};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class GPUTable {
|
|
30
|
+
length: number;
|
|
31
|
+
columns: Record<string, Buffer> = {};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function convertTableToGPUTable(table: Table) {
|
|
35
|
+
// for (const ) {}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function renameTableColumns(table: Table, map: (name: string) => string) {
|
|
39
|
+
const newColumns = table.columns.reduce()
|
|
40
|
+
table.clone();
|
|
41
|
+
}
|
|
42
|
+
*/
|