@math.gl/geometry 5.0.0-beta.10 → 5.0.0-beta.11
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/index.cjs +110 -161
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/polygon/cut-by-grid.d.ts.map +1 -1
- package/dist/polygon/cut-by-grid.js +18 -0
- package/dist/polygon/cut-by-grid.js.map +1 -1
- package/dist/polygon/subdivide-triangle-mesh.d.ts.map +1 -1
- package/dist/polygon/subdivide-triangle-mesh.js +55 -17
- package/dist/polygon/subdivide-triangle-mesh.js.map +1 -1
- package/dist/utils/compute-vertex-normals.d.ts +2 -2
- package/dist/utils/compute-vertex-normals.d.ts.map +1 -1
- package/dist/utils/compute-vertex-normals.js +3 -4
- package/dist/utils/compute-vertex-normals.js.map +1 -1
- package/dist/utils/geometry.d.ts +11 -4
- package/dist/utils/geometry.d.ts.map +1 -1
- package/dist/utils/geometry.js +19 -2
- package/dist/utils/geometry.js.map +1 -1
- package/dist/utils/index.d.ts +1 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mesh-processing.d.ts +16 -6
- package/dist/utils/mesh-processing.d.ts.map +1 -1
- package/dist/utils/mesh-processing.js +9 -6
- package/dist/utils/mesh-processing.js.map +1 -1
- package/dist/utils/primitive-iterator.d.ts +16 -8
- package/dist/utils/primitive-iterator.d.ts.map +1 -1
- package/dist/utils/primitive-iterator.js +32 -35
- package/dist/utils/primitive-iterator.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +22 -11
- package/src/polygon/cut-by-grid.ts +18 -0
- package/src/polygon/subdivide-triangle-mesh.ts +56 -16
- package/src/utils/compute-vertex-normals.ts +5 -6
- package/src/utils/geometry.ts +32 -6
- package/src/utils/index.ts +5 -5
- package/src/utils/mesh-processing.ts +30 -14
- package/src/utils/primitive-iterator.ts +45 -43
- package/dist/utils/constants.d.ts +0 -52
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js +0 -39
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/gl-type.d.ts +0 -17
- package/dist/utils/gl-type.d.ts.map +0 -1
- package/dist/utils/gl-type.js +0 -69
- package/dist/utils/gl-type.js.map +0 -1
- package/src/utils/constants.ts +0 -42
- package/src/utils/gl-type.ts +0 -87
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Vector3} from '@math.gl/core';
|
|
6
|
-
import {
|
|
7
|
-
import type {Geometry} from './geometry';
|
|
6
|
+
import type {GeometryInput} from './geometry';
|
|
8
7
|
import {getAttributeValues, getPositionAttribute} from './geometry';
|
|
9
8
|
import {makePrimitiveIterator} from './primitive-iterator';
|
|
10
9
|
|
|
11
10
|
/** Computes smooth, area-weighted vertex normals for a triangle geometry. */
|
|
12
|
-
export function computeVertexNormals(geometry:
|
|
11
|
+
export function computeVertexNormals(geometry: GeometryInput): Float32Array {
|
|
13
12
|
if (
|
|
14
|
-
geometry.
|
|
15
|
-
geometry.
|
|
16
|
-
geometry.
|
|
13
|
+
geometry.topology !== 'triangle-list' &&
|
|
14
|
+
geometry.topology !== 'triangle-strip' &&
|
|
15
|
+
geometry.topology !== 'triangle-fan'
|
|
17
16
|
) {
|
|
18
17
|
throw new Error('Triangle geometry is required');
|
|
19
18
|
}
|
package/src/utils/geometry.ts
CHANGED
|
@@ -3,28 +3,54 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import type {TypedArray} from '@math.gl/core';
|
|
6
|
+
import type {PrimitiveTopology} from '../lib/geometry';
|
|
6
7
|
|
|
7
8
|
/** A typed geometry attribute with either loaders.gl-style `value` or legacy `values` storage. */
|
|
8
9
|
export type GeometryAttribute = {
|
|
10
|
+
/** Attribute data in canonical storage. */
|
|
9
11
|
value?: TypedArray;
|
|
12
|
+
/** Alternate field for attribute data. */
|
|
10
13
|
values?: TypedArray;
|
|
14
|
+
/** Number of components per element. */
|
|
11
15
|
size?: number;
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
/** Minimal geometry shape understood by the geometry utilities. */
|
|
15
|
-
export type
|
|
16
|
-
|
|
19
|
+
export type GeometryInput = {
|
|
20
|
+
/** Connectivity of the indexed or sequential vertices. */
|
|
21
|
+
topology: PrimitiveTopology | 'line-loop' | 'triangle-fan';
|
|
22
|
+
/** Optional vertex indices in a packed array. */
|
|
17
23
|
indices?: GeometryAttribute | TypedArray;
|
|
24
|
+
/** Vertex attributes keyed by semantic name. */
|
|
18
25
|
attributes: Record<string, GeometryAttribute>;
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
/** Returns whether a value has the minimal geometry shape. */
|
|
22
|
-
export function isGeometry(value: unknown): value is
|
|
29
|
+
export function isGeometry(value: unknown): value is GeometryInput {
|
|
23
30
|
if (!value || typeof value !== 'object') {
|
|
24
31
|
return false;
|
|
25
32
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
33
|
+
const {topology, attributes} = value as Partial<GeometryInput>;
|
|
34
|
+
if (
|
|
35
|
+
!attributes ||
|
|
36
|
+
typeof attributes !== 'object' ||
|
|
37
|
+
Array.isArray(attributes) ||
|
|
38
|
+
ArrayBuffer.isView(attributes)
|
|
39
|
+
) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
switch (topology) {
|
|
43
|
+
case 'point-list':
|
|
44
|
+
case 'line-list':
|
|
45
|
+
case 'line-strip':
|
|
46
|
+
case 'line-loop':
|
|
47
|
+
case 'triangle-list':
|
|
48
|
+
case 'triangle-strip':
|
|
49
|
+
case 'triangle-fan':
|
|
50
|
+
return true;
|
|
51
|
+
default:
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
28
54
|
}
|
|
29
55
|
|
|
30
56
|
/** Returns the typed array stored in a geometry attribute. */
|
|
@@ -40,7 +66,7 @@ export function getAttributeValues(attribute: GeometryAttribute | TypedArray): T
|
|
|
40
66
|
}
|
|
41
67
|
|
|
42
68
|
/** Returns a geometry's position attribute. */
|
|
43
|
-
export function getPositionAttribute(geometry:
|
|
69
|
+
export function getPositionAttribute(geometry: GeometryInput): GeometryAttribute {
|
|
44
70
|
const position = geometry.attributes['POSITION'] || geometry.attributes['positions'];
|
|
45
71
|
if (!position) {
|
|
46
72
|
throw new Error('Geometry does not contain a position attribute');
|
package/src/utils/index.ts
CHANGED
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
export type {TypedArray, TypedArrayConstructor} from '@math.gl/core';
|
|
6
6
|
|
|
7
|
-
export {
|
|
8
|
-
export {default as GLType} from './gl-type';
|
|
9
|
-
|
|
10
|
-
export type {Geometry, GeometryAttribute} from './geometry';
|
|
7
|
+
export type {GeometryInput, GeometryAttribute} from './geometry';
|
|
11
8
|
export {isGeometry} from './geometry';
|
|
12
9
|
|
|
13
10
|
export type {Primitive} from './primitive-iterator';
|
|
@@ -43,7 +40,10 @@ export {
|
|
|
43
40
|
weldGeometry,
|
|
44
41
|
getDegenerateTriangles
|
|
45
42
|
} from './mesh-processing';
|
|
46
|
-
export type {
|
|
43
|
+
export type {
|
|
44
|
+
WeldGeometryOptions,
|
|
45
|
+
WeldGeometryResult
|
|
46
|
+
} from './mesh-processing';
|
|
47
47
|
|
|
48
48
|
export {interpolatePackedAttributes} from './interpolate-packed-attributes';
|
|
49
49
|
export type {
|
|
@@ -4,21 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
import {Matrix4} from '@math.gl/core';
|
|
6
6
|
import type {TypedArray, TypedArrayConstructor} from '@math.gl/core';
|
|
7
|
-
import {
|
|
8
|
-
import {getAttributeValues, type Geometry, type GeometryAttribute} from './geometry';
|
|
7
|
+
import {getAttributeValues, type GeometryInput, type GeometryAttribute} from './geometry';
|
|
9
8
|
|
|
9
|
+
/** Geometry emitted by triangle mesh operations. */
|
|
10
|
+
type TriangleGeometry = GeometryInput & {topology: 'triangle-list'};
|
|
11
|
+
|
|
12
|
+
/** Validated, packed mesh buffers used internally by mesh operations. */
|
|
10
13
|
type MeshData = {
|
|
14
|
+
/** Attributes with resolved buffers and element sizes. */
|
|
11
15
|
attributes: Record<string, {value: TypedArray; size: number}>;
|
|
16
|
+
/** Semantic name of the position attribute. */
|
|
12
17
|
position: string;
|
|
18
|
+
/** Number of vertices in each attribute buffer. */
|
|
13
19
|
count: number;
|
|
20
|
+
/** Explicit triangle indices, including those generated for non-indexed input. */
|
|
14
21
|
indices: Uint32Array;
|
|
15
22
|
};
|
|
16
23
|
|
|
17
24
|
/** Fresh, indexed triangle-list geometry. No input buffers are changed. */
|
|
18
25
|
export function transformGeometry(
|
|
19
|
-
geometry:
|
|
26
|
+
geometry: GeometryInput,
|
|
20
27
|
matrix: Readonly<ArrayLike<number>>
|
|
21
|
-
):
|
|
28
|
+
): TriangleGeometry {
|
|
22
29
|
const mesh = readMesh(geometry);
|
|
23
30
|
if (
|
|
24
31
|
matrix.length !== 16 ||
|
|
@@ -99,11 +106,11 @@ export function transformGeometry(
|
|
|
99
106
|
if (determinant < 0)
|
|
100
107
|
for (let i = 0; i < indices.length; i += 3)
|
|
101
108
|
[indices[i + 1], indices[i + 2]] = [indices[i + 2], indices[i + 1]];
|
|
102
|
-
return {
|
|
109
|
+
return {topology: 'triangle-list', attributes, indices};
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
/** Concatenates compatible triangle meshes and offsets vertex indices. */
|
|
106
|
-
export function mergeGeometries(geometries: readonly
|
|
113
|
+
export function mergeGeometries(geometries: readonly GeometryInput[]): TriangleGeometry {
|
|
107
114
|
if (!geometries.length) throw new RangeError('At least one geometry is required');
|
|
108
115
|
const meshes = geometries.map(readMesh),
|
|
109
116
|
first = meshes[0],
|
|
@@ -148,21 +155,26 @@ export function mergeGeometries(geometries: readonly Geometry[]): Geometry {
|
|
|
148
155
|
for (const index of mesh.indices) indices[indexOffset++] = index + vertexOffset;
|
|
149
156
|
vertexOffset += mesh.count;
|
|
150
157
|
}
|
|
151
|
-
return {
|
|
158
|
+
return {topology: 'triangle-list', attributes, indices};
|
|
152
159
|
}
|
|
153
160
|
|
|
161
|
+
/** Controls vertex matching during a weld. */
|
|
154
162
|
export type WeldGeometryOptions = {
|
|
155
163
|
/** Position quantization step; zero means exact matching. */ positionGridSize?: number;
|
|
156
164
|
};
|
|
165
|
+
/** Welded mesh and the mapping from its original vertices. */
|
|
157
166
|
export type WeldGeometryResult = {
|
|
158
|
-
|
|
167
|
+
/** Welded triangle mesh. */
|
|
168
|
+
geometry: TriangleGeometry;
|
|
169
|
+
/** Welded vertex index for each original vertex. */
|
|
159
170
|
vertexMap: Uint32Array;
|
|
171
|
+
/** Number of duplicate vertices removed. */
|
|
160
172
|
removedVertices: number;
|
|
161
173
|
};
|
|
162
174
|
|
|
163
175
|
/** Welds full attribute tuples, preserving UV seams and hard normal edges. */
|
|
164
176
|
export function weldGeometry(
|
|
165
|
-
geometry:
|
|
177
|
+
geometry: GeometryInput,
|
|
166
178
|
options: WeldGeometryOptions = {}
|
|
167
179
|
): WeldGeometryResult {
|
|
168
180
|
const mesh = readMesh(geometry),
|
|
@@ -208,7 +220,7 @@ export function weldGeometry(
|
|
|
208
220
|
}
|
|
209
221
|
return {
|
|
210
222
|
geometry: {
|
|
211
|
-
|
|
223
|
+
topology: 'triangle-list',
|
|
212
224
|
attributes,
|
|
213
225
|
indices: Uint32Array.from(mesh.indices, index => vertexMap[index])
|
|
214
226
|
},
|
|
@@ -218,7 +230,7 @@ export function weldGeometry(
|
|
|
218
230
|
}
|
|
219
231
|
|
|
220
232
|
/** Returns triangle numbers with area <= areaEpsilon, in original draw order. */
|
|
221
|
-
export function getDegenerateTriangles(geometry:
|
|
233
|
+
export function getDegenerateTriangles(geometry: GeometryInput, areaEpsilon = 0): Uint32Array {
|
|
222
234
|
if (!Number.isFinite(areaEpsilon) || areaEpsilon < 0)
|
|
223
235
|
throw new RangeError('Area epsilon must be finite and nonnegative');
|
|
224
236
|
const mesh = readMesh(geometry),
|
|
@@ -256,8 +268,9 @@ export function getDegenerateTriangles(geometry: Geometry, areaEpsilon = 0): Uin
|
|
|
256
268
|
return Uint32Array.from(result);
|
|
257
269
|
}
|
|
258
270
|
|
|
259
|
-
|
|
260
|
-
|
|
271
|
+
/** Validates triangle connectivity and resolves the packed input buffers. */
|
|
272
|
+
function readMesh(geometry: GeometryInput): MeshData {
|
|
273
|
+
if (geometry.topology !== 'triangle-list')
|
|
261
274
|
throw new RangeError('Packed triangle-list geometry is required');
|
|
262
275
|
const position = geometry.attributes['POSITION']
|
|
263
276
|
? 'POSITION'
|
|
@@ -363,7 +376,10 @@ function toDyadic(value: number): Dyadic {
|
|
|
363
376
|
const exponentBits = (high >>> 20) & 0x7ff;
|
|
364
377
|
const fraction = (BigInt(high & 0xfffff) << 32n) | BigInt(low);
|
|
365
378
|
const n = exponentBits ? (1n << 52n) | fraction : fraction;
|
|
366
|
-
return {
|
|
379
|
+
return {
|
|
380
|
+
n: high >>> 31 ? -n : n,
|
|
381
|
+
exponent: exponentBits ? exponentBits - 1075 : -1074
|
|
382
|
+
};
|
|
367
383
|
}
|
|
368
384
|
function subtractDyadic(a: Dyadic, b: Dyadic): Dyadic {
|
|
369
385
|
const exponent = Math.min(a.exponent, b.exponent);
|
|
@@ -2,72 +2,77 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
import {GL} from './constants';
|
|
7
|
-
import type {Geometry} from './geometry';
|
|
5
|
+
import type {GeometryInput} from './geometry';
|
|
8
6
|
import {getAttributeValues, getPositionAttribute, isGeometry} from './geometry';
|
|
9
7
|
|
|
10
8
|
/** One dereferenced point, line, or triangle primitive. */
|
|
11
9
|
export type Primitive = {
|
|
10
|
+
/** The input geometry’s attribute map. */
|
|
12
11
|
attributes: object;
|
|
13
|
-
|
|
12
|
+
/** List topology of the emitted primitive. */
|
|
13
|
+
type: 'point-list' | 'line-list' | 'triangle-list';
|
|
14
|
+
/** Index of the first vertex. */
|
|
14
15
|
i1: number;
|
|
16
|
+
/** Index of the second vertex on a line or triangle. */
|
|
15
17
|
i2?: number;
|
|
18
|
+
/** Index of the third vertex on a triangle. */
|
|
16
19
|
i3?: number;
|
|
20
|
+
/** Zero-based index in this iteration. */
|
|
17
21
|
primitiveIndex: number;
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* Iterates through a geometry's primitives and dereferences optional indices.
|
|
22
26
|
*
|
|
23
|
-
*
|
|
27
|
+
* @param geometry - Geometry whose optional indices are dereferenced.
|
|
28
|
+
* @param options - Zero-based, end-exclusive range in the index or vertex sequence.
|
|
24
29
|
*/
|
|
25
30
|
export function* makePrimitiveIterator(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
geometry: GeometryInput,
|
|
32
|
+
options: {
|
|
33
|
+
/** Offset of the first index or vertex to consider. */
|
|
34
|
+
start?: number;
|
|
35
|
+
/** Exclusive end of the range. Defaults to the index or vertex count. */
|
|
36
|
+
end?: number;
|
|
37
|
+
} = {}
|
|
31
38
|
): Iterable<Primitive> {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
if (!isGeometry(geometry)) {
|
|
40
|
+
throw new TypeError('Geometry with a supported topology and attributes is required');
|
|
41
|
+
}
|
|
42
|
+
const {start = 0} = options;
|
|
43
|
+
let end = options.end;
|
|
44
|
+
const {attributes, topology} = geometry;
|
|
45
|
+
const indices = geometry.indices ? getAttributeValues(geometry.indices) : undefined;
|
|
46
|
+
if (end === undefined) {
|
|
47
|
+
if (indices) {
|
|
48
|
+
end = indices.length;
|
|
49
|
+
} else {
|
|
39
50
|
const position = getPositionAttribute(geometry);
|
|
40
|
-
end =
|
|
51
|
+
end = getAttributeValues(position).length / (position.size || 3);
|
|
41
52
|
}
|
|
42
|
-
} else if (geometryOrIndices) {
|
|
43
|
-
indices = getAttributeValues(geometryOrIndices);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (mode === undefined) {
|
|
47
|
-
throw new Error('Primitive mode is required');
|
|
48
53
|
}
|
|
49
|
-
end ??= indices?.length ?? start;
|
|
50
54
|
|
|
55
|
+
/** Resolves an index-buffer offset or sequential vertex index. */
|
|
51
56
|
const dereference = (index: number): number => Number(indices ? indices[index] : index);
|
|
52
57
|
let primitiveIndex = 0;
|
|
53
58
|
|
|
54
|
-
switch (
|
|
55
|
-
case
|
|
59
|
+
switch (topology) {
|
|
60
|
+
case 'point-list':
|
|
56
61
|
for (let index = start; index < end; index++) {
|
|
57
62
|
yield {
|
|
58
63
|
attributes,
|
|
59
|
-
type:
|
|
64
|
+
type: 'point-list',
|
|
60
65
|
i1: dereference(index),
|
|
61
66
|
primitiveIndex: primitiveIndex++
|
|
62
67
|
};
|
|
63
68
|
}
|
|
64
69
|
return;
|
|
65
70
|
|
|
66
|
-
case
|
|
71
|
+
case 'line-list':
|
|
67
72
|
for (let index = start; index + 1 < end; index += 2) {
|
|
68
73
|
yield {
|
|
69
74
|
attributes,
|
|
70
|
-
type:
|
|
75
|
+
type: 'line-list',
|
|
71
76
|
i1: dereference(index),
|
|
72
77
|
i2: dereference(index + 1),
|
|
73
78
|
primitiveIndex: primitiveIndex++
|
|
@@ -75,11 +80,11 @@ export function* makePrimitiveIterator(
|
|
|
75
80
|
}
|
|
76
81
|
return;
|
|
77
82
|
|
|
78
|
-
case
|
|
83
|
+
case 'line-strip':
|
|
79
84
|
for (let index = start; index + 1 < end; index++) {
|
|
80
85
|
yield {
|
|
81
86
|
attributes,
|
|
82
|
-
type:
|
|
87
|
+
type: 'line-list',
|
|
83
88
|
i1: dereference(index),
|
|
84
89
|
i2: dereference(index + 1),
|
|
85
90
|
primitiveIndex: primitiveIndex++
|
|
@@ -87,11 +92,11 @@ export function* makePrimitiveIterator(
|
|
|
87
92
|
}
|
|
88
93
|
return;
|
|
89
94
|
|
|
90
|
-
case
|
|
95
|
+
case 'line-loop':
|
|
91
96
|
for (let index = start; index < end; index++) {
|
|
92
97
|
yield {
|
|
93
98
|
attributes,
|
|
94
|
-
type:
|
|
99
|
+
type: 'line-list',
|
|
95
100
|
i1: dereference(index),
|
|
96
101
|
i2: dereference(index + 1 < end ? index + 1 : start),
|
|
97
102
|
primitiveIndex: primitiveIndex++
|
|
@@ -99,11 +104,11 @@ export function* makePrimitiveIterator(
|
|
|
99
104
|
}
|
|
100
105
|
return;
|
|
101
106
|
|
|
102
|
-
case
|
|
107
|
+
case 'triangle-list':
|
|
103
108
|
for (let index = start; index + 2 < end; index += 3) {
|
|
104
109
|
yield {
|
|
105
110
|
attributes,
|
|
106
|
-
type:
|
|
111
|
+
type: 'triangle-list',
|
|
107
112
|
i1: dereference(index),
|
|
108
113
|
i2: dereference(index + 1),
|
|
109
114
|
i3: dereference(index + 2),
|
|
@@ -112,12 +117,12 @@ export function* makePrimitiveIterator(
|
|
|
112
117
|
}
|
|
113
118
|
return;
|
|
114
119
|
|
|
115
|
-
case
|
|
120
|
+
case 'triangle-strip':
|
|
116
121
|
for (let index = start; index + 2 < end; index++) {
|
|
117
122
|
const odd = (index - start) % 2 === 1;
|
|
118
123
|
yield {
|
|
119
124
|
attributes,
|
|
120
|
-
type:
|
|
125
|
+
type: 'triangle-list',
|
|
121
126
|
i1: dereference(odd ? index + 1 : index),
|
|
122
127
|
i2: dereference(odd ? index : index + 1),
|
|
123
128
|
i3: dereference(index + 2),
|
|
@@ -126,11 +131,11 @@ export function* makePrimitiveIterator(
|
|
|
126
131
|
}
|
|
127
132
|
return;
|
|
128
133
|
|
|
129
|
-
case
|
|
134
|
+
case 'triangle-fan':
|
|
130
135
|
for (let index = start + 1; index + 1 < end; index++) {
|
|
131
136
|
yield {
|
|
132
137
|
attributes,
|
|
133
|
-
type:
|
|
138
|
+
type: 'triangle-list',
|
|
134
139
|
i1: dereference(start),
|
|
135
140
|
i2: dereference(index),
|
|
136
141
|
i3: dereference(index + 1),
|
|
@@ -138,8 +143,5 @@ export function* makePrimitiveIterator(
|
|
|
138
143
|
};
|
|
139
144
|
}
|
|
140
145
|
return;
|
|
141
|
-
|
|
142
|
-
default:
|
|
143
|
-
throw new Error(`Unknown primitive mode ${mode}`);
|
|
144
146
|
}
|
|
145
147
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/** Portable point, line, and triangle primitive types. */
|
|
2
|
-
export declare const GL_PRIMITIVE: {
|
|
3
|
-
readonly POINTS: 0;
|
|
4
|
-
readonly LINES: 1;
|
|
5
|
-
readonly TRIANGLES: 4;
|
|
6
|
-
};
|
|
7
|
-
/** WebGL-compatible primitive topology constants. */
|
|
8
|
-
export declare const GL_PRIMITIVE_MODE: {
|
|
9
|
-
readonly POINTS: 0;
|
|
10
|
-
readonly LINES: 1;
|
|
11
|
-
readonly LINE_LOOP: 2;
|
|
12
|
-
readonly LINE_STRIP: 3;
|
|
13
|
-
readonly TRIANGLES: 4;
|
|
14
|
-
readonly TRIANGLE_STRIP: 5;
|
|
15
|
-
readonly TRIANGLE_FAN: 6;
|
|
16
|
-
};
|
|
17
|
-
/** WebGL-compatible vertex component type constants. */
|
|
18
|
-
export declare const GL_TYPE: {
|
|
19
|
-
readonly BYTE: 5120;
|
|
20
|
-
readonly UNSIGNED_BYTE: 5121;
|
|
21
|
-
readonly SHORT: 5122;
|
|
22
|
-
readonly UNSIGNED_SHORT: 5123;
|
|
23
|
-
readonly INT: 5124;
|
|
24
|
-
readonly UNSIGNED_INT: 5125;
|
|
25
|
-
readonly FLOAT: 5126;
|
|
26
|
-
readonly DOUBLE: 5130;
|
|
27
|
-
readonly UNSIGNED_SHORT_4_4_4_4: 32819;
|
|
28
|
-
readonly UNSIGNED_SHORT_5_5_5_1: 32820;
|
|
29
|
-
readonly UNSIGNED_SHORT_5_6_5: 33635;
|
|
30
|
-
};
|
|
31
|
-
/** WebGL-compatible constants used by geometry utilities. */
|
|
32
|
-
export declare const GL: {
|
|
33
|
-
readonly BYTE: 5120;
|
|
34
|
-
readonly UNSIGNED_BYTE: 5121;
|
|
35
|
-
readonly SHORT: 5122;
|
|
36
|
-
readonly UNSIGNED_SHORT: 5123;
|
|
37
|
-
readonly INT: 5124;
|
|
38
|
-
readonly UNSIGNED_INT: 5125;
|
|
39
|
-
readonly FLOAT: 5126;
|
|
40
|
-
readonly DOUBLE: 5130;
|
|
41
|
-
readonly UNSIGNED_SHORT_4_4_4_4: 32819;
|
|
42
|
-
readonly UNSIGNED_SHORT_5_5_5_1: 32820;
|
|
43
|
-
readonly UNSIGNED_SHORT_5_6_5: 33635;
|
|
44
|
-
readonly POINTS: 0;
|
|
45
|
-
readonly LINES: 1;
|
|
46
|
-
readonly LINE_LOOP: 2;
|
|
47
|
-
readonly LINE_STRIP: 3;
|
|
48
|
-
readonly TRIANGLES: 4;
|
|
49
|
-
readonly TRIANGLE_STRIP: 5;
|
|
50
|
-
readonly TRIANGLE_FAN: 6;
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAIA,0DAA0D;AAC1D,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,qDAAqD;AACrD,eAAO,MAAM,iBAAiB;;;;;;;;CAQpB,CAAC;AAEX,wDAAwD;AACxD,eAAO,MAAM,OAAO;;;;;;;;;;;;CAYV,CAAC;AAEX,6DAA6D;AAC7D,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;CAGL,CAAC"}
|
package/dist/utils/constants.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// math.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
/** Portable point, line, and triangle primitive types. */
|
|
5
|
-
export const GL_PRIMITIVE = {
|
|
6
|
-
POINTS: 0x0000,
|
|
7
|
-
LINES: 0x0001,
|
|
8
|
-
TRIANGLES: 0x0004
|
|
9
|
-
};
|
|
10
|
-
/** WebGL-compatible primitive topology constants. */
|
|
11
|
-
export const GL_PRIMITIVE_MODE = {
|
|
12
|
-
POINTS: 0x0000,
|
|
13
|
-
LINES: 0x0001,
|
|
14
|
-
LINE_LOOP: 0x0002,
|
|
15
|
-
LINE_STRIP: 0x0003,
|
|
16
|
-
TRIANGLES: 0x0004,
|
|
17
|
-
TRIANGLE_STRIP: 0x0005,
|
|
18
|
-
TRIANGLE_FAN: 0x0006
|
|
19
|
-
};
|
|
20
|
-
/** WebGL-compatible vertex component type constants. */
|
|
21
|
-
export const GL_TYPE = {
|
|
22
|
-
BYTE: 5120,
|
|
23
|
-
UNSIGNED_BYTE: 5121,
|
|
24
|
-
SHORT: 5122,
|
|
25
|
-
UNSIGNED_SHORT: 5123,
|
|
26
|
-
INT: 5124,
|
|
27
|
-
UNSIGNED_INT: 5125,
|
|
28
|
-
FLOAT: 5126,
|
|
29
|
-
DOUBLE: 5130,
|
|
30
|
-
UNSIGNED_SHORT_4_4_4_4: 32819,
|
|
31
|
-
UNSIGNED_SHORT_5_5_5_1: 32820,
|
|
32
|
-
UNSIGNED_SHORT_5_6_5: 33635
|
|
33
|
-
};
|
|
34
|
-
/** WebGL-compatible constants used by geometry utilities. */
|
|
35
|
-
export const GL = {
|
|
36
|
-
...GL_PRIMITIVE_MODE,
|
|
37
|
-
...GL_TYPE
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,0DAA0D;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;CACT,CAAC;AAEX,qDAAqD;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,MAAM;IACjB,cAAc,EAAE,MAAM;IACtB,YAAY,EAAE,MAAM;CACZ,CAAC;AAEX,wDAAwD;AACxD,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,IAAI;IACV,aAAa,EAAE,IAAI;IACnB,KAAK,EAAE,IAAI;IACX,cAAc,EAAE,IAAI;IACpB,GAAG,EAAE,IAAI;IACT,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,sBAAsB,EAAE,KAAK;IAC7B,sBAAsB,EAAE,KAAK;IAC7B,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,6DAA6D;AAC7D,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,GAAG,iBAAiB;IACpB,GAAG,OAAO;CACF,CAAC"}
|
package/dist/utils/gl-type.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { TypedArray, TypedArrayConstructor } from '@math.gl/core';
|
|
2
|
-
/** Converts between WebGL component constants and JavaScript typed arrays. */
|
|
3
|
-
export default class GLType {
|
|
4
|
-
/** Returns the WebGL component constant for a typed array or typed-array constructor. */
|
|
5
|
-
static fromTypedArray(arrayOrType: TypedArray | TypedArrayConstructor): number;
|
|
6
|
-
/** Returns a WebGL component constant from its uppercase name. */
|
|
7
|
-
static fromName(name: string): number;
|
|
8
|
-
/** Returns the typed-array constructor for a WebGL component constant. */
|
|
9
|
-
static getArrayType(glType: number): TypedArrayConstructor;
|
|
10
|
-
/** Returns the size in bytes of one element of a WebGL component type. */
|
|
11
|
-
static getByteSize(glType: number): number;
|
|
12
|
-
/** Returns whether a value is a supported WebGL component type. */
|
|
13
|
-
static validate(glType: number): boolean;
|
|
14
|
-
/** Creates a typed view over an ArrayBuffer or an existing ArrayBuffer view. */
|
|
15
|
-
static createTypedArray(glType: number, buffer: ArrayBufferLike | ArrayBufferView, byteOffset?: number, length?: number): TypedArray;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=gl-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gl-type.d.ts","sourceRoot":"","sources":["../../src/utils/gl-type.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAE,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAuBrE,8EAA8E;AAC9E,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,yFAAyF;IACzF,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,UAAU,GAAG,qBAAqB,GAAG,MAAM;IAa9E,kEAAkE;IAClE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAQrC,0EAA0E;IAC1E,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB;IAQ1D,0EAA0E;IAC1E,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI1C,mEAAmE;IACnE,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIxC,gFAAgF;IAChF,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,GAAG,eAAe,EACzC,UAAU,SAAI,EACd,MAAM,CAAC,EAAE,MAAM,GACd,UAAU;CASd"}
|
package/dist/utils/gl-type.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// math.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
import { GL_TYPE } from "./constants.js";
|
|
5
|
-
const GL_TYPE_TO_ARRAY_TYPE = {
|
|
6
|
-
[GL_TYPE.DOUBLE]: Float64Array,
|
|
7
|
-
[GL_TYPE.FLOAT]: Float32Array,
|
|
8
|
-
[GL_TYPE.UNSIGNED_SHORT]: Uint16Array,
|
|
9
|
-
[GL_TYPE.UNSIGNED_INT]: Uint32Array,
|
|
10
|
-
[GL_TYPE.UNSIGNED_BYTE]: Uint8Array,
|
|
11
|
-
[GL_TYPE.BYTE]: Int8Array,
|
|
12
|
-
[GL_TYPE.SHORT]: Int16Array,
|
|
13
|
-
[GL_TYPE.INT]: Int32Array,
|
|
14
|
-
[GL_TYPE.UNSIGNED_SHORT_4_4_4_4]: Uint16Array,
|
|
15
|
-
[GL_TYPE.UNSIGNED_SHORT_5_5_5_1]: Uint16Array,
|
|
16
|
-
[GL_TYPE.UNSIGNED_SHORT_5_6_5]: Uint16Array
|
|
17
|
-
};
|
|
18
|
-
const NAME_TO_GL_TYPE = Object.fromEntries(Object.entries(GL_TYPE).map(([name, glType]) => [name, glType]));
|
|
19
|
-
const TYPE_CONVERSION_ERROR = 'Failed to convert GL type';
|
|
20
|
-
/** Converts between WebGL component constants and JavaScript typed arrays. */
|
|
21
|
-
export default class GLType {
|
|
22
|
-
/** Returns the WebGL component constant for a typed array or typed-array constructor. */
|
|
23
|
-
static fromTypedArray(arrayOrType) {
|
|
24
|
-
const arrayType = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
|
|
25
|
-
if (arrayType === Uint8ClampedArray) {
|
|
26
|
-
return GL_TYPE.UNSIGNED_BYTE;
|
|
27
|
-
}
|
|
28
|
-
for (const [glType, candidateArrayType] of Object.entries(GL_TYPE_TO_ARRAY_TYPE)) {
|
|
29
|
-
if (candidateArrayType === arrayType) {
|
|
30
|
-
return Number(glType);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
throw new Error(TYPE_CONVERSION_ERROR);
|
|
34
|
-
}
|
|
35
|
-
/** Returns a WebGL component constant from its uppercase name. */
|
|
36
|
-
static fromName(name) {
|
|
37
|
-
const glType = NAME_TO_GL_TYPE[name];
|
|
38
|
-
if (glType === undefined) {
|
|
39
|
-
throw new Error(TYPE_CONVERSION_ERROR);
|
|
40
|
-
}
|
|
41
|
-
return glType;
|
|
42
|
-
}
|
|
43
|
-
/** Returns the typed-array constructor for a WebGL component constant. */
|
|
44
|
-
static getArrayType(glType) {
|
|
45
|
-
const ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];
|
|
46
|
-
if (!ArrayType) {
|
|
47
|
-
throw new Error(TYPE_CONVERSION_ERROR);
|
|
48
|
-
}
|
|
49
|
-
return ArrayType;
|
|
50
|
-
}
|
|
51
|
-
/** Returns the size in bytes of one element of a WebGL component type. */
|
|
52
|
-
static getByteSize(glType) {
|
|
53
|
-
return GLType.getArrayType(glType).BYTES_PER_ELEMENT;
|
|
54
|
-
}
|
|
55
|
-
/** Returns whether a value is a supported WebGL component type. */
|
|
56
|
-
static validate(glType) {
|
|
57
|
-
return Boolean(GL_TYPE_TO_ARRAY_TYPE[glType]);
|
|
58
|
-
}
|
|
59
|
-
/** Creates a typed view over an ArrayBuffer or an existing ArrayBuffer view. */
|
|
60
|
-
static createTypedArray(glType, buffer, byteOffset = 0, length) {
|
|
61
|
-
const ArrayType = GLType.getArrayType(glType);
|
|
62
|
-
const arrayBuffer = ArrayBuffer.isView(buffer) ? buffer.buffer : buffer;
|
|
63
|
-
const viewByteOffset = ArrayBuffer.isView(buffer) ? buffer.byteOffset : 0;
|
|
64
|
-
const resolvedByteOffset = viewByteOffset + byteOffset;
|
|
65
|
-
const resolvedLength = length ?? Math.floor((buffer.byteLength - byteOffset) / ArrayType.BYTES_PER_ELEMENT);
|
|
66
|
-
return new ArrayType(arrayBuffer, resolvedByteOffset, resolvedLength);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=gl-type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gl-type.js","sourceRoot":"","sources":["../../src/utils/gl-type.ts"],"names":[],"mappings":"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"}
|
package/src/utils/constants.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// math.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
/** Portable point, line, and triangle primitive types. */
|
|
6
|
-
export const GL_PRIMITIVE = {
|
|
7
|
-
POINTS: 0x0000,
|
|
8
|
-
LINES: 0x0001,
|
|
9
|
-
TRIANGLES: 0x0004
|
|
10
|
-
} as const;
|
|
11
|
-
|
|
12
|
-
/** WebGL-compatible primitive topology constants. */
|
|
13
|
-
export const GL_PRIMITIVE_MODE = {
|
|
14
|
-
POINTS: 0x0000,
|
|
15
|
-
LINES: 0x0001,
|
|
16
|
-
LINE_LOOP: 0x0002,
|
|
17
|
-
LINE_STRIP: 0x0003,
|
|
18
|
-
TRIANGLES: 0x0004,
|
|
19
|
-
TRIANGLE_STRIP: 0x0005,
|
|
20
|
-
TRIANGLE_FAN: 0x0006
|
|
21
|
-
} as const;
|
|
22
|
-
|
|
23
|
-
/** WebGL-compatible vertex component type constants. */
|
|
24
|
-
export const GL_TYPE = {
|
|
25
|
-
BYTE: 5120,
|
|
26
|
-
UNSIGNED_BYTE: 5121,
|
|
27
|
-
SHORT: 5122,
|
|
28
|
-
UNSIGNED_SHORT: 5123,
|
|
29
|
-
INT: 5124,
|
|
30
|
-
UNSIGNED_INT: 5125,
|
|
31
|
-
FLOAT: 5126,
|
|
32
|
-
DOUBLE: 5130,
|
|
33
|
-
UNSIGNED_SHORT_4_4_4_4: 32819,
|
|
34
|
-
UNSIGNED_SHORT_5_5_5_1: 32820,
|
|
35
|
-
UNSIGNED_SHORT_5_6_5: 33635
|
|
36
|
-
} as const;
|
|
37
|
-
|
|
38
|
-
/** WebGL-compatible constants used by geometry utilities. */
|
|
39
|
-
export const GL = {
|
|
40
|
-
...GL_PRIMITIVE_MODE,
|
|
41
|
-
...GL_TYPE
|
|
42
|
-
} as const;
|