@viamrobotics/motion-tools 1.15.8 → 1.18.0
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/attribute.d.ts +3 -2
- package/dist/attribute.js +24 -16
- package/dist/buf/draw/v1/drawing_pb.d.ts +33 -16
- package/dist/buf/draw/v1/drawing_pb.js +35 -17
- package/dist/buf/draw/v1/metadata_pb.d.ts +44 -3
- package/dist/buf/draw/v1/metadata_pb.js +54 -3
- package/dist/buf/draw/v1/scene_pb.d.ts +6 -6
- package/dist/buf/draw/v1/scene_pb.js +7 -7
- package/dist/buffer.d.ts +54 -45
- package/dist/buffer.js +91 -57
- package/dist/color.d.ts +1 -2
- package/dist/color.js +5 -12
- package/dist/components/App.svelte +18 -3
- package/dist/components/App.svelte.d.ts +15 -2
- package/dist/components/Entities/Arrows/ArrowGroups.svelte +5 -6
- package/dist/components/Entities/Arrows/Arrows.svelte +9 -0
- package/dist/components/Entities/Entities.svelte +18 -1
- package/dist/components/Entities/Frame.svelte +7 -1
- package/dist/components/Entities/GLTF.svelte +13 -2
- package/dist/components/Entities/Line.svelte +46 -18
- package/dist/components/Entities/LineDots.svelte +38 -8
- package/dist/components/Entities/LineDots.svelte.d.ts +2 -2
- package/dist/components/Entities/LineGeometry.svelte +2 -1
- package/dist/components/Entities/LineGeometry.svelte.d.ts +2 -0
- package/dist/components/Entities/Mesh.svelte +8 -1
- package/dist/components/Entities/Points.svelte +22 -11
- package/dist/components/Entities/hooks/useEntityEvents.svelte.js +6 -2
- package/dist/components/FileDrop/FileDrop.svelte +5 -1
- package/dist/components/KeyboardControls.svelte +2 -10
- package/dist/components/PCD.svelte +11 -4
- package/dist/components/PCD.svelte.d.ts +3 -1
- package/dist/components/SceneProviders.svelte +2 -0
- package/dist/components/Selected.svelte +2 -12
- package/dist/components/{Lasso → Selection}/Debug.svelte +8 -8
- package/dist/components/{Lasso → Selection}/Debug.svelte.d.ts +2 -2
- package/dist/components/Selection/Ellipse.svelte +294 -0
- package/dist/components/Selection/Ellipse.svelte.d.ts +7 -0
- package/dist/components/{Lasso → Selection}/Lasso.svelte +33 -61
- package/dist/components/{Lasso → Selection}/Lasso.svelte.d.ts +1 -0
- package/dist/components/Selection/Tool.svelte +94 -0
- package/dist/components/{Lasso → Selection}/Tool.svelte.d.ts +2 -2
- package/dist/components/{Lasso → Selection}/traits.d.ts +11 -2
- package/dist/components/{Lasso → Selection}/traits.js +7 -2
- package/dist/components/Selection/useSelectionPlugin.svelte.d.ts +8 -0
- package/dist/components/Selection/useSelectionPlugin.svelte.js +24 -0
- package/dist/components/Selection/utils.d.ts +5 -0
- package/dist/components/Selection/utils.js +38 -0
- package/dist/components/Snapshot.svelte +4 -2
- package/dist/components/overlay/AddRelationship.svelte +1 -2
- package/dist/components/overlay/AddRelationship.svelte.d.ts +1 -1
- package/dist/components/overlay/Details.svelte +12 -12
- package/dist/components/overlay/Details.svelte.d.ts +8 -1
- package/dist/components/overlay/settings/Settings.svelte +8 -1
- package/dist/components/xr/OriginMarker.svelte +94 -17
- package/dist/components/xr/XR.svelte +1 -1
- package/dist/draw.d.ts +13 -0
- package/dist/draw.js +428 -0
- package/dist/ecs/traits.d.ts +31 -13
- package/dist/ecs/traits.js +25 -8
- package/dist/geometry.js +3 -0
- package/dist/hooks/useDrawAPI.svelte.js +61 -24
- package/dist/hooks/useDrawService.svelte.d.ts +12 -0
- package/dist/hooks/useDrawService.svelte.js +240 -0
- package/dist/hooks/usePointcloudObjects.svelte.js +7 -2
- package/dist/hooks/usePointclouds.svelte.js +7 -2
- package/dist/hooks/useSettings.svelte.d.ts +3 -2
- package/dist/hooks/useSettings.svelte.js +2 -2
- package/dist/hooks/useWorldState.svelte.js +5 -52
- package/dist/index.d.ts +9 -1
- package/dist/index.js +10 -1
- package/dist/lib.d.ts +2 -0
- package/dist/lib.js +2 -0
- package/dist/loaders/pcd/index.d.ts +1 -1
- package/dist/loaders/pcd/messages.d.ts +2 -2
- package/dist/loaders/pcd/worker.inline.d.ts +1 -1
- package/dist/loaders/pcd/worker.inline.js +229 -187
- package/dist/loaders/pcd/worker.js +2 -2
- package/dist/metadata.d.ts +9 -15
- package/dist/metadata.js +45 -9
- package/dist/plugins/bvh.svelte.js +6 -2
- package/dist/snapshot.d.ts +3 -9
- package/dist/snapshot.js +11 -204
- package/dist/three/InstancedArrows/InstancedArrows.js +3 -2
- package/package.json +14 -11
- package/dist/components/Lasso/Tool.svelte +0 -108
- package/dist/components/xr/Hands.svelte +0 -23
- package/dist/components/xr/Hands.svelte.d.ts +0 -18
package/dist/attribute.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { BufferGeometry } from 'three';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
2
|
+
import type { Metadata } from './metadata';
|
|
3
|
+
export declare const createBufferGeometry: (positions: Float32Array, metadata?: Metadata) => BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>;
|
|
4
|
+
export declare const updateBufferGeometry: (geometry: BufferGeometry, positions: Float32Array, metadata: Metadata) => void;
|
package/dist/attribute.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { BufferAttribute, BufferGeometry } from 'three';
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
const numVertices = positions.length / STRIDE.POSITIONS;
|
|
5
|
-
const stride = colors.length / numVertices;
|
|
6
|
-
return stride === STRIDE.COLORS_RGBA ? STRIDE.COLORS_RGBA : STRIDE.COLORS_RGB;
|
|
7
|
-
};
|
|
8
|
-
export const createBufferGeometry = (positions, colors) => {
|
|
2
|
+
import { colorStride } from './buffer';
|
|
3
|
+
export const createBufferGeometry = (positions, metadata) => {
|
|
9
4
|
const geometry = new BufferGeometry();
|
|
10
5
|
geometry.setAttribute('position', new BufferAttribute(positions, 3));
|
|
11
|
-
if (colors) {
|
|
12
|
-
const stride = colorStride(
|
|
13
|
-
geometry.setAttribute('color', new BufferAttribute(colors, stride, true));
|
|
6
|
+
if (metadata?.colors) {
|
|
7
|
+
const stride = colorStride(metadata.colorFormat);
|
|
8
|
+
geometry.setAttribute('color', new BufferAttribute(metadata.colors, stride, true));
|
|
9
|
+
}
|
|
10
|
+
if (metadata?.opacities) {
|
|
11
|
+
geometry.setAttribute('opacity', new BufferAttribute(metadata.opacities, 1, true));
|
|
14
12
|
}
|
|
15
13
|
return geometry;
|
|
16
14
|
};
|
|
17
|
-
export const updateBufferGeometry = (geometry, positions,
|
|
15
|
+
export const updateBufferGeometry = (geometry, positions, metadata) => {
|
|
18
16
|
const positionAttr = geometry.getAttribute('position');
|
|
19
17
|
if (positionAttr && positionAttr.array.length >= positions.length) {
|
|
20
18
|
positionAttr.array.set(positions, 0);
|
|
@@ -24,15 +22,25 @@ export const updateBufferGeometry = (geometry, positions, colors) => {
|
|
|
24
22
|
else {
|
|
25
23
|
geometry.setAttribute('position', new BufferAttribute(positions, 3));
|
|
26
24
|
}
|
|
27
|
-
if (colors) {
|
|
25
|
+
if (metadata.colors) {
|
|
26
|
+
const stride = colorStride(metadata.colorFormat);
|
|
28
27
|
const colorAttr = geometry.getAttribute('color');
|
|
29
|
-
if (colorAttr && colorAttr.array.length >= colors.length) {
|
|
30
|
-
colorAttr.array.set(colors, 0);
|
|
28
|
+
if (colorAttr && colorAttr.array.length >= metadata.colors.length) {
|
|
29
|
+
colorAttr.array.set(metadata.colors, 0);
|
|
31
30
|
colorAttr.needsUpdate = true;
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
geometry.setAttribute('color', new BufferAttribute(metadata.colors, stride, true));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (metadata.opacities) {
|
|
37
|
+
const opacityAttr = geometry.getAttribute('opacity');
|
|
38
|
+
if (opacityAttr && opacityAttr.array.length >= metadata.opacities.length) {
|
|
39
|
+
opacityAttr.array.set(metadata.opacities, 0);
|
|
40
|
+
opacityAttr.needsUpdate = true;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
geometry.setAttribute('opacity', new BufferAttribute(metadata.opacities, 1, true));
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
};
|
|
@@ -5,9 +5,11 @@ import { Metadata } from "./metadata_pb";
|
|
|
5
5
|
/**
|
|
6
6
|
* Arrows represents a set of arrows in 3D space
|
|
7
7
|
* Metadata:
|
|
8
|
-
* - colors: []uint8 of a single color
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* - colors: []uint8 of a single color or a color per arrow
|
|
9
|
+
* defaults to [0, 128, 0] (green)
|
|
10
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
11
|
+
* - opacities: []uint8 of a single opacity or a opacity per arrow
|
|
12
|
+
* defaults to [255] (fully opaque)
|
|
11
13
|
*
|
|
12
14
|
* @generated from message draw.v1.Arrows
|
|
13
15
|
*/
|
|
@@ -31,15 +33,17 @@ export declare class Arrows extends Message<Arrows> {
|
|
|
31
33
|
/**
|
|
32
34
|
* Line represents a line in 3D space
|
|
33
35
|
* Metadata:
|
|
34
|
-
* - colors: []uint8 of a single color
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* - colors: []uint8 of a single color or a color per line point
|
|
37
|
+
* defaults to [0, 0, 255] (blue)
|
|
38
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
39
|
+
* - opacities: []uint8 of a single opacity or a opacity per line point
|
|
40
|
+
* defaults to [255] (fully opaque)
|
|
37
41
|
*
|
|
38
42
|
* @generated from message draw.v1.Line
|
|
39
43
|
*/
|
|
40
44
|
export declare class Line extends Message<Line> {
|
|
41
45
|
/**
|
|
42
|
-
* The positions of the line
|
|
46
|
+
* The positions of the line dots
|
|
43
47
|
* float32 array of positions: [x, y, z, ...]
|
|
44
48
|
*
|
|
45
49
|
* @generated from field: bytes positions = 1;
|
|
@@ -52,11 +56,19 @@ export declare class Line extends Message<Line> {
|
|
|
52
56
|
*/
|
|
53
57
|
lineWidth?: number;
|
|
54
58
|
/**
|
|
55
|
-
* optional size of the
|
|
59
|
+
* optional size of the dots in millimeters, defaults to 10
|
|
56
60
|
*
|
|
57
|
-
* @generated from field: optional float
|
|
61
|
+
* @generated from field: optional float dot_size = 3;
|
|
58
62
|
*/
|
|
59
|
-
|
|
63
|
+
dotSize?: number;
|
|
64
|
+
/**
|
|
65
|
+
* optional colors for the line dots
|
|
66
|
+
* []uint8 of a single color: [r, g, b, a]
|
|
67
|
+
* or one color per dot: [r, g, b, a, ...]
|
|
68
|
+
*
|
|
69
|
+
* @generated from field: optional bytes dot_colors = 4;
|
|
70
|
+
*/
|
|
71
|
+
dotColors?: Uint8Array;
|
|
60
72
|
constructor(data?: PartialMessage<Line>);
|
|
61
73
|
static readonly runtime: typeof proto3;
|
|
62
74
|
static readonly typeName = "draw.v1.Line";
|
|
@@ -69,9 +81,11 @@ export declare class Line extends Message<Line> {
|
|
|
69
81
|
/**
|
|
70
82
|
* Points represents a set of points in 3D space
|
|
71
83
|
* Metadata:
|
|
72
|
-
* - colors: []uint8 of a single color
|
|
73
|
-
*
|
|
74
|
-
*
|
|
84
|
+
* - colors: []uint8 of a single color or a color per point
|
|
85
|
+
* defaults to [128, 128, 128] (gray)
|
|
86
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
87
|
+
* - opacities: []uint8 of a single opacity or a opacity per point
|
|
88
|
+
* defaults to [255] (fully opaque)
|
|
75
89
|
*
|
|
76
90
|
* @generated from message draw.v1.Points
|
|
77
91
|
*/
|
|
@@ -171,7 +185,7 @@ export declare class Model extends Message<Model> {
|
|
|
171
185
|
*/
|
|
172
186
|
scale?: Vector3;
|
|
173
187
|
/**
|
|
174
|
-
* Name
|
|
188
|
+
* Name ofI the animation to play, defaults to empty string (no animation)
|
|
175
189
|
*
|
|
176
190
|
* @generated from field: optional string animation_name = 3;
|
|
177
191
|
*/
|
|
@@ -188,8 +202,11 @@ export declare class Model extends Message<Model> {
|
|
|
188
202
|
/**
|
|
189
203
|
* Nurbs represents a NURBS curve in 3D space
|
|
190
204
|
* Metadata:
|
|
191
|
-
* - colors: []uint8 of a single color
|
|
192
|
-
* defaults to [0, 255, 255
|
|
205
|
+
* - colors: []uint8 of a single color or a color per NURBS control point
|
|
206
|
+
* defaults to [0, 255, 255] (cyan)
|
|
207
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
208
|
+
* - opacities: []uint8 of a single opacity or a opacity per NURBS control point
|
|
209
|
+
* defaults to [255] (fully opaque)
|
|
193
210
|
*
|
|
194
211
|
* @generated from message draw.v1.Nurbs
|
|
195
212
|
*/
|
|
@@ -8,9 +8,11 @@ import { Metadata } from "./metadata_pb";
|
|
|
8
8
|
/**
|
|
9
9
|
* Arrows represents a set of arrows in 3D space
|
|
10
10
|
* Metadata:
|
|
11
|
-
* - colors: []uint8 of a single color
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* - colors: []uint8 of a single color or a color per arrow
|
|
12
|
+
* defaults to [0, 128, 0] (green)
|
|
13
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
14
|
+
* - opacities: []uint8 of a single opacity or a opacity per arrow
|
|
15
|
+
* defaults to [255] (fully opaque)
|
|
14
16
|
*
|
|
15
17
|
* @generated from message draw.v1.Arrows
|
|
16
18
|
*/
|
|
@@ -47,15 +49,17 @@ export class Arrows extends Message {
|
|
|
47
49
|
/**
|
|
48
50
|
* Line represents a line in 3D space
|
|
49
51
|
* Metadata:
|
|
50
|
-
* - colors: []uint8 of a single color
|
|
51
|
-
*
|
|
52
|
-
*
|
|
52
|
+
* - colors: []uint8 of a single color or a color per line point
|
|
53
|
+
* defaults to [0, 0, 255] (blue)
|
|
54
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
55
|
+
* - opacities: []uint8 of a single opacity or a opacity per line point
|
|
56
|
+
* defaults to [255] (fully opaque)
|
|
53
57
|
*
|
|
54
58
|
* @generated from message draw.v1.Line
|
|
55
59
|
*/
|
|
56
60
|
export class Line extends Message {
|
|
57
61
|
/**
|
|
58
|
-
* The positions of the line
|
|
62
|
+
* The positions of the line dots
|
|
59
63
|
* float32 array of positions: [x, y, z, ...]
|
|
60
64
|
*
|
|
61
65
|
* @generated from field: bytes positions = 1;
|
|
@@ -68,11 +72,19 @@ export class Line extends Message {
|
|
|
68
72
|
*/
|
|
69
73
|
lineWidth;
|
|
70
74
|
/**
|
|
71
|
-
* optional size of the
|
|
75
|
+
* optional size of the dots in millimeters, defaults to 10
|
|
72
76
|
*
|
|
73
|
-
* @generated from field: optional float
|
|
77
|
+
* @generated from field: optional float dot_size = 3;
|
|
74
78
|
*/
|
|
75
|
-
|
|
79
|
+
dotSize;
|
|
80
|
+
/**
|
|
81
|
+
* optional colors for the line dots
|
|
82
|
+
* []uint8 of a single color: [r, g, b, a]
|
|
83
|
+
* or one color per dot: [r, g, b, a, ...]
|
|
84
|
+
*
|
|
85
|
+
* @generated from field: optional bytes dot_colors = 4;
|
|
86
|
+
*/
|
|
87
|
+
dotColors;
|
|
76
88
|
constructor(data) {
|
|
77
89
|
super();
|
|
78
90
|
proto3.util.initPartial(data, this);
|
|
@@ -82,7 +94,8 @@ export class Line extends Message {
|
|
|
82
94
|
static fields = proto3.util.newFieldList(() => [
|
|
83
95
|
{ no: 1, name: "positions", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
|
84
96
|
{ no: 2, name: "line_width", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
|
|
85
|
-
{ no: 3, name: "
|
|
97
|
+
{ no: 3, name: "dot_size", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
|
|
98
|
+
{ no: 4, name: "dot_colors", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true },
|
|
86
99
|
]);
|
|
87
100
|
static fromBinary(bytes, options) {
|
|
88
101
|
return new Line().fromBinary(bytes, options);
|
|
@@ -100,9 +113,11 @@ export class Line extends Message {
|
|
|
100
113
|
/**
|
|
101
114
|
* Points represents a set of points in 3D space
|
|
102
115
|
* Metadata:
|
|
103
|
-
* - colors: []uint8 of a single color
|
|
104
|
-
*
|
|
105
|
-
*
|
|
116
|
+
* - colors: []uint8 of a single color or a color per point
|
|
117
|
+
* defaults to [128, 128, 128] (gray)
|
|
118
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
119
|
+
* - opacities: []uint8 of a single opacity or a opacity per point
|
|
120
|
+
* defaults to [255] (fully opaque)
|
|
106
121
|
*
|
|
107
122
|
* @generated from message draw.v1.Points
|
|
108
123
|
*/
|
|
@@ -213,7 +228,7 @@ export class Model extends Message {
|
|
|
213
228
|
*/
|
|
214
229
|
scale;
|
|
215
230
|
/**
|
|
216
|
-
* Name
|
|
231
|
+
* Name ofI the animation to play, defaults to empty string (no animation)
|
|
217
232
|
*
|
|
218
233
|
* @generated from field: optional string animation_name = 3;
|
|
219
234
|
*/
|
|
@@ -245,8 +260,11 @@ export class Model extends Message {
|
|
|
245
260
|
/**
|
|
246
261
|
* Nurbs represents a NURBS curve in 3D space
|
|
247
262
|
* Metadata:
|
|
248
|
-
* - colors: []uint8 of a single color
|
|
249
|
-
* defaults to [0, 255, 255
|
|
263
|
+
* - colors: []uint8 of a single color or a color per NURBS control point
|
|
264
|
+
* defaults to [0, 255, 255] (cyan)
|
|
265
|
+
* - color format: the format of the colors field, defaults to COLOR_FORMAT_RGB
|
|
266
|
+
* - opacities: []uint8 of a single opacity or a opacity per NURBS control point
|
|
267
|
+
* defaults to [255] (fully opaque)
|
|
250
268
|
*
|
|
251
269
|
* @generated from message draw.v1.Nurbs
|
|
252
270
|
*/
|
|
@@ -1,17 +1,58 @@
|
|
|
1
1
|
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
|
2
2
|
import { Message, proto3 } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* ColorFormat describes the encoding of the colors bytes field.
|
|
5
|
+
*
|
|
6
|
+
* @generated from enum draw.v1.ColorFormat
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ColorFormat {
|
|
9
|
+
/**
|
|
10
|
+
* @generated from enum value: COLOR_FORMAT_UNSPECIFIED = 0;
|
|
11
|
+
*/
|
|
12
|
+
UNSPECIFIED = 0,
|
|
13
|
+
/**
|
|
14
|
+
* @generated from enum value: COLOR_FORMAT_RGB = 1;
|
|
15
|
+
*/
|
|
16
|
+
RGB = 1
|
|
17
|
+
}
|
|
3
18
|
/**
|
|
4
19
|
* @generated from message draw.v1.Metadata
|
|
5
20
|
*/
|
|
6
21
|
export declare class Metadata extends Message<Metadata> {
|
|
7
22
|
/**
|
|
8
|
-
* Uint8Array of
|
|
9
|
-
*
|
|
10
|
-
* For complex objects, this is an array of colors of [r, g, b, a, ...]
|
|
23
|
+
* Uint8Array of color values (0-255) based on the color format.
|
|
24
|
+
* Can be a single set of values for a uniform color, or an array of values for per-vertex colors.
|
|
11
25
|
*
|
|
12
26
|
* @generated from field: optional bytes colors = 1;
|
|
13
27
|
*/
|
|
14
28
|
colors?: Uint8Array;
|
|
29
|
+
/**
|
|
30
|
+
* Describes the encoding of the colors field. Defaults to COLOR_FORMAT_RGB when set by this API.
|
|
31
|
+
*
|
|
32
|
+
* @generated from field: draw.v1.ColorFormat color_format = 2;
|
|
33
|
+
*/
|
|
34
|
+
colorFormat: ColorFormat;
|
|
35
|
+
/**
|
|
36
|
+
* Uint8Array of opacity values (0-255) corresponding to colors.
|
|
37
|
+
* Can be a single set of values for a uniform opacity, or an array of values for per-vertex opacity.
|
|
38
|
+
*
|
|
39
|
+
* @generated from field: optional bytes opacities = 3;
|
|
40
|
+
*/
|
|
41
|
+
opacities?: Uint8Array;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to show the axes helper (RGB XYZ indicator) on the entity.
|
|
44
|
+
* Defaults to false.
|
|
45
|
+
*
|
|
46
|
+
* @generated from field: optional bool show_axes_helper = 4;
|
|
47
|
+
*/
|
|
48
|
+
showAxesHelper?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the entity is invisible (not rendered) by default.
|
|
51
|
+
* Defaults to false.
|
|
52
|
+
*
|
|
53
|
+
* @generated from field: optional bool invisible = 5;
|
|
54
|
+
*/
|
|
55
|
+
invisible?: boolean;
|
|
15
56
|
constructor(data?: PartialMessage<Metadata>);
|
|
16
57
|
static readonly runtime: typeof proto3;
|
|
17
58
|
static readonly typeName = "draw.v1.Metadata";
|
|
@@ -3,18 +3,65 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
5
5
|
import { Message, proto3 } from "@bufbuild/protobuf";
|
|
6
|
+
/**
|
|
7
|
+
* ColorFormat describes the encoding of the colors bytes field.
|
|
8
|
+
*
|
|
9
|
+
* @generated from enum draw.v1.ColorFormat
|
|
10
|
+
*/
|
|
11
|
+
export var ColorFormat;
|
|
12
|
+
(function (ColorFormat) {
|
|
13
|
+
/**
|
|
14
|
+
* @generated from enum value: COLOR_FORMAT_UNSPECIFIED = 0;
|
|
15
|
+
*/
|
|
16
|
+
ColorFormat[ColorFormat["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
17
|
+
/**
|
|
18
|
+
* @generated from enum value: COLOR_FORMAT_RGB = 1;
|
|
19
|
+
*/
|
|
20
|
+
ColorFormat[ColorFormat["RGB"] = 1] = "RGB";
|
|
21
|
+
})(ColorFormat || (ColorFormat = {}));
|
|
22
|
+
// Retrieve enum metadata with: proto3.getEnumType(ColorFormat)
|
|
23
|
+
proto3.util.setEnumType(ColorFormat, "draw.v1.ColorFormat", [
|
|
24
|
+
{ no: 0, name: "COLOR_FORMAT_UNSPECIFIED" },
|
|
25
|
+
{ no: 1, name: "COLOR_FORMAT_RGB" },
|
|
26
|
+
]);
|
|
6
27
|
/**
|
|
7
28
|
* @generated from message draw.v1.Metadata
|
|
8
29
|
*/
|
|
9
30
|
export class Metadata extends Message {
|
|
10
31
|
/**
|
|
11
|
-
* Uint8Array of
|
|
12
|
-
*
|
|
13
|
-
* For complex objects, this is an array of colors of [r, g, b, a, ...]
|
|
32
|
+
* Uint8Array of color values (0-255) based on the color format.
|
|
33
|
+
* Can be a single set of values for a uniform color, or an array of values for per-vertex colors.
|
|
14
34
|
*
|
|
15
35
|
* @generated from field: optional bytes colors = 1;
|
|
16
36
|
*/
|
|
17
37
|
colors;
|
|
38
|
+
/**
|
|
39
|
+
* Describes the encoding of the colors field. Defaults to COLOR_FORMAT_RGB when set by this API.
|
|
40
|
+
*
|
|
41
|
+
* @generated from field: draw.v1.ColorFormat color_format = 2;
|
|
42
|
+
*/
|
|
43
|
+
colorFormat = ColorFormat.UNSPECIFIED;
|
|
44
|
+
/**
|
|
45
|
+
* Uint8Array of opacity values (0-255) corresponding to colors.
|
|
46
|
+
* Can be a single set of values for a uniform opacity, or an array of values for per-vertex opacity.
|
|
47
|
+
*
|
|
48
|
+
* @generated from field: optional bytes opacities = 3;
|
|
49
|
+
*/
|
|
50
|
+
opacities;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to show the axes helper (RGB XYZ indicator) on the entity.
|
|
53
|
+
* Defaults to false.
|
|
54
|
+
*
|
|
55
|
+
* @generated from field: optional bool show_axes_helper = 4;
|
|
56
|
+
*/
|
|
57
|
+
showAxesHelper;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the entity is invisible (not rendered) by default.
|
|
60
|
+
* Defaults to false.
|
|
61
|
+
*
|
|
62
|
+
* @generated from field: optional bool invisible = 5;
|
|
63
|
+
*/
|
|
64
|
+
invisible;
|
|
18
65
|
constructor(data) {
|
|
19
66
|
super();
|
|
20
67
|
proto3.util.initPartial(data, this);
|
|
@@ -23,6 +70,10 @@ export class Metadata extends Message {
|
|
|
23
70
|
static typeName = "draw.v1.Metadata";
|
|
24
71
|
static fields = proto3.util.newFieldList(() => [
|
|
25
72
|
{ no: 1, name: "colors", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true },
|
|
73
|
+
{ no: 2, name: "color_format", kind: "enum", T: proto3.getEnumType(ColorFormat) },
|
|
74
|
+
{ no: 3, name: "opacities", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true },
|
|
75
|
+
{ no: 4, name: "show_axes_helper", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
|
|
76
|
+
{ no: 5, name: "invisible", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
|
|
26
77
|
]);
|
|
27
78
|
static fromBinary(bytes, options) {
|
|
28
79
|
return new Metadata().fromBinary(bytes, options);
|
|
@@ -190,25 +190,25 @@ export declare class SceneMetadata extends Message<SceneMetadata> {
|
|
|
190
190
|
pointSize?: number;
|
|
191
191
|
/**
|
|
192
192
|
* The color of the points if not defined by a transform's metadata
|
|
193
|
-
* defaults to [51, 51, 51
|
|
193
|
+
* defaults to [51, 51, 51] (gray)
|
|
194
194
|
*
|
|
195
195
|
* @generated from field: optional bytes point_color = 7;
|
|
196
196
|
*/
|
|
197
197
|
pointColor?: Uint8Array;
|
|
198
198
|
/**
|
|
199
199
|
* The width of the lines if not defined by a transform's metadata
|
|
200
|
-
* defaults to
|
|
200
|
+
* defaults to 5mm
|
|
201
201
|
*
|
|
202
202
|
* @generated from field: optional float line_width = 8;
|
|
203
203
|
*/
|
|
204
204
|
lineWidth?: number;
|
|
205
205
|
/**
|
|
206
|
-
* The size of the
|
|
207
|
-
* metadata defaults to
|
|
206
|
+
* The size of the dots of the lines if not defined by a transform's
|
|
207
|
+
* metadata defaults to 10mm
|
|
208
208
|
*
|
|
209
|
-
* @generated from field: optional float
|
|
209
|
+
* @generated from field: optional float line_dot_size = 9;
|
|
210
210
|
*/
|
|
211
|
-
|
|
211
|
+
lineDotSize?: number;
|
|
212
212
|
/**
|
|
213
213
|
* The models to render
|
|
214
214
|
* defaults to COLLIDERS_AND_MODEL
|
|
@@ -237,25 +237,25 @@ export class SceneMetadata extends Message {
|
|
|
237
237
|
pointSize;
|
|
238
238
|
/**
|
|
239
239
|
* The color of the points if not defined by a transform's metadata
|
|
240
|
-
* defaults to [51, 51, 51
|
|
240
|
+
* defaults to [51, 51, 51] (gray)
|
|
241
241
|
*
|
|
242
242
|
* @generated from field: optional bytes point_color = 7;
|
|
243
243
|
*/
|
|
244
244
|
pointColor;
|
|
245
245
|
/**
|
|
246
246
|
* The width of the lines if not defined by a transform's metadata
|
|
247
|
-
* defaults to
|
|
247
|
+
* defaults to 5mm
|
|
248
248
|
*
|
|
249
249
|
* @generated from field: optional float line_width = 8;
|
|
250
250
|
*/
|
|
251
251
|
lineWidth;
|
|
252
252
|
/**
|
|
253
|
-
* The size of the
|
|
254
|
-
* metadata defaults to
|
|
253
|
+
* The size of the dots of the lines if not defined by a transform's
|
|
254
|
+
* metadata defaults to 10mm
|
|
255
255
|
*
|
|
256
|
-
* @generated from field: optional float
|
|
256
|
+
* @generated from field: optional float line_dot_size = 9;
|
|
257
257
|
*/
|
|
258
|
-
|
|
258
|
+
lineDotSize;
|
|
259
259
|
/**
|
|
260
260
|
* The models to render
|
|
261
261
|
* defaults to COLLIDERS_AND_MODEL
|
|
@@ -285,7 +285,7 @@ export class SceneMetadata extends Message {
|
|
|
285
285
|
{ no: 6, name: "point_size", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
|
|
286
286
|
{ no: 7, name: "point_color", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true },
|
|
287
287
|
{ no: 8, name: "line_width", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
|
|
288
|
-
{ no: 9, name: "
|
|
288
|
+
{ no: 9, name: "line_dot_size", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
|
|
289
289
|
{ no: 10, name: "render_arm_models", kind: "enum", T: proto3.getEnumType(RenderArmModels), opt: true },
|
|
290
290
|
{ no: 11, name: "render_shapes", kind: "enum", T: proto3.getEnumType(RenderShapes), repeated: true },
|
|
291
291
|
]);
|
package/dist/buffer.d.ts
CHANGED
|
@@ -1,44 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zero-copy buffer utilities for converting protobuf bytes to Three.js typed arrays.
|
|
3
|
-
*
|
|
4
|
-
* Proto messages pack float32 data as `Uint8Array` (bytes fields). These utilities
|
|
5
|
-
* provide efficient conversion to `Float32Array` for Three.js BufferAttributes.
|
|
6
|
-
*/
|
|
7
1
|
import { Color } from 'three';
|
|
8
|
-
|
|
9
|
-
* Stride constants for proto binary data formats.
|
|
10
|
-
* Each value represents the number of float32 elements per item.
|
|
11
|
-
*/
|
|
2
|
+
import { ColorFormat } from './buf/draw/v1/metadata_pb';
|
|
12
3
|
export declare const STRIDE: {
|
|
13
|
-
/** Arrows: [x, y, z, ox, oy, oz]
|
|
4
|
+
/** Arrows: [x, y, z, ox, oy, oz, ...] */
|
|
14
5
|
readonly ARROWS: 6;
|
|
15
|
-
/** Line/Points: [x, y, z]
|
|
6
|
+
/** Line/Points: [x, y, z, ...] */
|
|
16
7
|
readonly POSITIONS: 3;
|
|
17
|
-
/** Nurbs control points: [x, y, z, ox, oy, oz, theta]
|
|
8
|
+
/** Nurbs control points: [x, y, z, ox, oy, oz, theta, ...] */
|
|
18
9
|
readonly NURBS_CONTROL_POINTS: 7;
|
|
19
|
-
/** Nurbs knots/weights:
|
|
10
|
+
/** Nurbs knots/weights: [w, ...] */
|
|
20
11
|
readonly NURBS_KNOTS: 1;
|
|
21
|
-
/** Colors: [r, g, b,
|
|
22
|
-
readonly COLORS_RGBA: 4;
|
|
23
|
-
/** Colors: [r, g, b] */
|
|
12
|
+
/** Colors: [r, g, b, ...] */
|
|
24
13
|
readonly COLORS_RGB: 3;
|
|
25
14
|
};
|
|
26
15
|
/**
|
|
27
16
|
* Creates a Float32Array view over a Uint8Array without copying data.
|
|
28
17
|
* Falls back to a copy if the buffer is not 4-byte aligned (rare with protobuf).
|
|
29
18
|
*
|
|
19
|
+
* An optional `transform` applies a per-element function during conversion.
|
|
20
|
+
*
|
|
30
21
|
* @param bytes - The raw bytes from a protobuf bytes field
|
|
22
|
+
* @param transform - Optional function applied to every float element
|
|
31
23
|
* @returns A Float32Array view or copy of the data
|
|
32
24
|
*
|
|
33
25
|
* @example
|
|
34
26
|
* ```ts
|
|
35
27
|
* const positions = asFloat32Array(line.positions)
|
|
36
|
-
*
|
|
28
|
+
* const meterPositions = asFloat32Array(line.positions, inMeters)
|
|
37
29
|
* ```
|
|
38
30
|
*/
|
|
39
|
-
export declare const asFloat32Array: (bytes: Uint8Array
|
|
31
|
+
export declare const asFloat32Array: (bytes: Uint8Array, transform?: (value: number) => number) => Float32Array;
|
|
40
32
|
/**
|
|
41
|
-
* Sets a Three.js Color from 3 bytes of a uint8 color array starting at `offset`.
|
|
33
|
+
* Sets a Three.js Color from 3 bytes of a uint8 RGB color array starting at `offset`.
|
|
42
34
|
* Mutates and returns `target` — pass a pre-allocated Color to avoid allocations
|
|
43
35
|
* in hot paths.
|
|
44
36
|
*
|
|
@@ -50,52 +42,69 @@ export declare const asFloat32Array: (bytes: Uint8Array<ArrayBuffer>) => Float32
|
|
|
50
42
|
* @example
|
|
51
43
|
* ```ts
|
|
52
44
|
* asColor(colors.current, material.color)
|
|
53
|
-
* asColor(colors.current, pointColorUtil,
|
|
45
|
+
* asColor(colors.current, pointColorUtil, STRIDE.COLORS_RGB) // read second color
|
|
54
46
|
* ```
|
|
55
47
|
*/
|
|
56
|
-
export declare const asColor: (bytes: Uint8Array
|
|
48
|
+
export declare const asColor: (bytes: Uint8Array, target: Color, offset?: number) => Color;
|
|
49
|
+
export declare const asRGB: (bytes: Uint8Array, target: {
|
|
50
|
+
r: number;
|
|
51
|
+
g: number;
|
|
52
|
+
b: number;
|
|
53
|
+
}, offset?: number) => {
|
|
54
|
+
r: number;
|
|
55
|
+
g: number;
|
|
56
|
+
b: number;
|
|
57
|
+
};
|
|
57
58
|
/**
|
|
58
|
-
*
|
|
59
|
+
* Reads a byte from a uint8 opacities array at `index` and normalizes it to 0-1.
|
|
60
|
+
* Returns `fallback` when the array is absent or shorter than `index + 1`.
|
|
59
61
|
*
|
|
60
|
-
* @param
|
|
61
|
-
* @
|
|
62
|
+
* @param opacities - Uint8Array of opacity values (0-255). Length 1 = uniform. Length N = per-vertex.
|
|
63
|
+
* @param fallback - Value to return when no opacity byte is available (default 1)
|
|
64
|
+
* @param index - Index into the opacities array (default 0)
|
|
65
|
+
* @returns Normalized opacity in 0-1 range, or the fallback value
|
|
62
66
|
*
|
|
63
67
|
* @example
|
|
64
68
|
* ```ts
|
|
65
|
-
*
|
|
69
|
+
* material.opacity = asOpacity(metadata.opacities)
|
|
66
70
|
* ```
|
|
67
71
|
*/
|
|
68
|
-
export declare const
|
|
72
|
+
export declare const asOpacity: (opacities: Uint8Array | undefined, fallback?: number, index?: number) => number;
|
|
69
73
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @param bytes - ArrayLike of uint8 color values
|
|
74
|
-
* @param fallback - Value to return when no alpha byte is present (default 1)
|
|
75
|
-
* @param offset - Byte index to read from (default 3, the alpha channel of the first color)
|
|
76
|
-
* @returns Normalized opacity in 0-1 range, or the fallback value
|
|
74
|
+
* Returns true when `colors` contains exactly one color (RGB or RGBA),
|
|
75
|
+
* as opposed to a per-vertex color array.
|
|
77
76
|
*
|
|
78
77
|
* @example
|
|
79
78
|
* ```ts
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
* if (isSingleColor(colors)) {
|
|
80
|
+
* material.color = asColor(colors, colorUtil)
|
|
81
|
+
* }
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
84
|
-
export declare const
|
|
84
|
+
export declare const isSingleColor: (colors: Uint8Array) => boolean;
|
|
85
85
|
/**
|
|
86
|
-
* Returns true when `colors` contains
|
|
87
|
-
*
|
|
86
|
+
* Returns true when `colors` contains per-vertex color data rather than a
|
|
87
|
+
* single uniform color.
|
|
88
88
|
*
|
|
89
|
-
* @param colors - Uint8Array of packed
|
|
90
|
-
* @param numVertex - Number of points/vertices the color buffer should cover
|
|
89
|
+
* @param colors - Uint8Array of packed RGB bytes (stride of 3)
|
|
91
90
|
*
|
|
92
91
|
* @example
|
|
93
92
|
* ```ts
|
|
94
|
-
* if (
|
|
93
|
+
* if (isVertexColors(colors, positions.length / 3)) {
|
|
95
94
|
* // treat as per-vertex
|
|
96
|
-
* } else {
|
|
97
|
-
* addColorTraits(entityTraits, colors)
|
|
98
95
|
* }
|
|
99
96
|
* ```
|
|
100
97
|
*/
|
|
101
|
-
export declare const
|
|
98
|
+
export declare const isVertexColors: (colors: Uint8Array | undefined) => colors is Uint8Array;
|
|
99
|
+
/**
|
|
100
|
+
* Per-element transform that converts a millimeter value to meters.
|
|
101
|
+
* Pass to {@link asFloat32Array} to fuse the conversion into a single pass.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const positions = asFloat32Array(line.positions, inMeters)
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare const inMeters: (v: number) => number;
|
|
109
|
+
/** Returns the byte stride for a given color format. */
|
|
110
|
+
export declare const colorStride: (format?: ColorFormat) => number;
|