@luma.gl/engine 9.0.0-alpha.31 → 9.0.0-alpha.33
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/dist.dev.js +583 -294
- package/dist/geometries/truncated-cone-geometry.d.ts +0 -2
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +0 -11
- package/dist/geometries/truncated-cone-geometry.js.map +1 -1
- package/dist/geometry/geometry.d.ts +25 -11
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +1 -2
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts +48 -0
- package/dist/geometry/gpu-geometry.d.ts.map +1 -0
- package/dist/geometry/gpu-geometry.js +137 -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 +313 -222
- package/dist/lib/pipeline-factory.d.ts +11 -44
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +28 -119
- package/dist/lib/pipeline-factory.js.map +1 -1
- package/dist/model/model.d.ts +108 -22
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +148 -92
- package/dist/model/model.js.map +1 -1
- package/dist.min.js +67 -67
- package/package.json +6 -6
- package/src/geometries/truncated-cone-geometry.ts +0 -10
- package/src/geometry/geometry.ts +26 -23
- package/src/geometry/gpu-geometry.ts +158 -0
- package/src/geometry/gpu-table.ts +41 -0
- package/src/lib/pipeline-factory.ts +43 -164
- package/src/model/model.ts +276 -126
- 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/model/model-utils.d.ts +0 -5
- package/dist/model/model-utils.d.ts.map +0 -1
- package/dist/model/model-utils.js +0 -40
- package/dist/model/model-utils.js.map +0 -1
- package/src/geometry/primitive-utils.ts +0 -30
- package/src/model/model-utils.ts +0 -125
package/src/model/model-utils.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import {Device, Buffer, assert} from '@luma.gl/core';
|
|
2
|
-
import type {Geometry} from '../geometry/geometry';
|
|
3
|
-
|
|
4
|
-
// Support for mapping new geometries with glTF attribute names to "classic" luma.gl shader names
|
|
5
|
-
const GLTF_TO_LUMA_ATTRIBUTE_MAP = {
|
|
6
|
-
POSITION: 'positions',
|
|
7
|
-
NORMAL: 'normals',
|
|
8
|
-
COLOR_0: 'colors',
|
|
9
|
-
TEXCOORD_0: 'texCoords',
|
|
10
|
-
TEXCOORD_1: 'texCoords1',
|
|
11
|
-
TEXCOORD_2: 'texCoords2'
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
export function getAttributeLayoutsFromGeometry(geometry: Geometry) {
|
|
16
|
-
const layouts: Record<string, {}> = {};
|
|
17
|
-
let indices = geometry.indices;
|
|
18
|
-
|
|
19
|
-
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
20
|
-
const remappedName = mapAttributeName(name);
|
|
21
|
-
|
|
22
|
-
if (attribute.constant) {
|
|
23
|
-
throw new Error('constant attributes not supported');
|
|
24
|
-
} else {
|
|
25
|
-
const typedArray = attribute.value;
|
|
26
|
-
// Create accessor by copying the attribute and removing `value``
|
|
27
|
-
const accessor = {...attribute};
|
|
28
|
-
delete accessor.value;
|
|
29
|
-
buffers[remappedName] = [device.createBuffer(typedArray), accessor];
|
|
30
|
-
|
|
31
|
-
inferAttributeAccessor(name, accessor);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export class Table {
|
|
37
|
-
length: number;
|
|
38
|
-
// columns: Record<string, TypedArray> = {};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class GPUTable {
|
|
42
|
-
length: number;
|
|
43
|
-
columns: Record<string, Buffer> = {};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function convertTableToGPUTable(table: Table) {
|
|
47
|
-
// for (const ) {}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function renameTableColumns(table: Table, map: (name: string) => string) {
|
|
51
|
-
const newColumns = table.columns.reduce()
|
|
52
|
-
table.clone();
|
|
53
|
-
}
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
export function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined {
|
|
57
|
-
if (!geometry.indices) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// @ts-expect-error
|
|
62
|
-
const data = geometry.indices.value || geometry.indices;
|
|
63
|
-
assert(
|
|
64
|
-
data instanceof Uint16Array || data instanceof Uint32Array,
|
|
65
|
-
'attribute array for "indices" must be of integer type'
|
|
66
|
-
);
|
|
67
|
-
return device.createBuffer({usage: Buffer.INDEX, data});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function getAttributeBuffersFromGeometry(device: Device, geometry: Geometry): Record<string, Buffer> {
|
|
71
|
-
const buffers: Record<string, Buffer> = {};
|
|
72
|
-
|
|
73
|
-
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
74
|
-
const remappedName = mapAttributeName(name);
|
|
75
|
-
if (attribute?.constant) {
|
|
76
|
-
throw new Error('constant attributes not supported');
|
|
77
|
-
} else {
|
|
78
|
-
const typedArray = attribute?.value;
|
|
79
|
-
buffers[remappedName] = device.createBuffer({data: typedArray, id: `${remappedName}-buffer`});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return buffers;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function mapAttributeName(name: string): string {
|
|
87
|
-
// @ts-ignore-error
|
|
88
|
-
return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/*
|
|
92
|
-
// Check for well known attribute names
|
|
93
|
-
// eslint-disable-next-line complexity
|
|
94
|
-
export function inferAttributeAccessor(attributeName, attribute) {
|
|
95
|
-
let category;
|
|
96
|
-
switch (attributeName) {
|
|
97
|
-
case 'texCoords':
|
|
98
|
-
case 'texCoord1':
|
|
99
|
-
case 'texCoord2':
|
|
100
|
-
case 'texCoord3':
|
|
101
|
-
category = 'uvs';
|
|
102
|
-
break;
|
|
103
|
-
case 'vertices':
|
|
104
|
-
case 'positions':
|
|
105
|
-
case 'normals':
|
|
106
|
-
case 'pickingColors':
|
|
107
|
-
category = 'vectors';
|
|
108
|
-
break;
|
|
109
|
-
default:
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Check for categorys
|
|
113
|
-
switch (category) {
|
|
114
|
-
case 'vectors':
|
|
115
|
-
attribute.size = attribute.size || 3;
|
|
116
|
-
break;
|
|
117
|
-
case 'uvs':
|
|
118
|
-
attribute.size = attribute.size || 2;
|
|
119
|
-
break;
|
|
120
|
-
default:
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
assert(Number.isFinite(attribute.size), `attribute ${attributeName} needs size`);
|
|
124
|
-
}
|
|
125
|
-
*/
|