@selvajs/visualization 1.0.0-beta.1 → 1.0.0-beta.3
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/README.md +7 -7
- package/dist/gpu-dispose-Dkj-BKt4.js +2 -0
- package/dist/gpu-dispose-Dkj-BKt4.js.map +1 -0
- package/dist/gpu-dispose-DrN-ryj5.cjs +2 -0
- package/dist/gpu-dispose-DrN-ryj5.cjs.map +1 -0
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/parse.cjs +3 -3
- package/dist/parse.cjs.map +1 -1
- package/dist/parse.d.cts +117 -110
- package/dist/parse.d.ts +117 -110
- package/dist/parse.js +3 -3
- package/dist/parse.js.map +1 -1
- package/dist/render.cjs +5 -6
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +441 -312
- package/dist/render.d.ts +441 -312
- package/dist/render.js +5 -6
- package/dist/render.js.map +1 -1
- package/dist/rolldown-runtime-BocRIvOZ.cjs +1 -0
- package/dist/scene.cjs +1 -1
- package/dist/scene.cjs.map +1 -1
- package/dist/scene.d.cts +94 -89
- package/dist/scene.d.ts +94 -89
- package/dist/scene.js +1 -1
- package/dist/scene.js.map +1 -1
- package/dist/types-Di80Y609.d.cts +34 -0
- package/dist/types-Di80Y609.d.ts +34 -0
- package/package.json +13 -8
- package/dist/chunk-5XGN7UAV.js +0 -2
- package/dist/chunk-5XGN7UAV.js.map +0 -1
- package/dist/chunk-AZ4GBXXL.cjs +0 -2
- package/dist/chunk-AZ4GBXXL.cjs.map +0 -1
- package/dist/chunk-BYLIBOAU.cjs +0 -2
- package/dist/chunk-BYLIBOAU.cjs.map +0 -1
- package/dist/chunk-KRA5RVHM.js +0 -2
- package/dist/chunk-KRA5RVHM.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types-DCuos3gI.d.cts +0 -33
- package/dist/types-DCuos3gI.d.ts +0 -33
package/dist/parse.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { i as MaterialAppearanceOptions } from "./types-Di80Y609.cjs";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
//#region src/parse/mesh-policy.d.ts
|
|
4
4
|
/** Structurally, not nominally, typed as `@selvajs/solve/client`'s `MeshPolicy<THREE.Object3D>` — avoids a dependency on solve. */
|
|
5
5
|
declare const meshPolicy: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
clone(meshes: THREE.Object3D[]): THREE.Object3D[];
|
|
7
|
+
release(meshes: THREE.Object3D[]): void;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/parse/webdisplay/response-envelope.d.ts
|
|
10
11
|
/**
|
|
11
12
|
* Declared structurally rather than imported from `@selvajs/compute` — this package converts
|
|
12
13
|
* meshes, it doesn't need a Rhino.Compute client dependency to describe the shape a caller hands
|
|
@@ -14,73 +15,75 @@ declare const meshPolicy: {
|
|
|
14
15
|
* this, so {@link getThreeMeshesFromComputeResponse} keeps accepting one unchanged.
|
|
15
16
|
*/
|
|
16
17
|
interface DisplayDataItem {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/** Namespaced wire type token, e.g. `Selva.GH.Features.Display.Services.DisplayBatch`. */
|
|
19
|
+
type: string;
|
|
20
|
+
data: string;
|
|
20
21
|
}
|
|
21
22
|
interface DisplayResponseValue {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
InnerTree: {
|
|
24
|
+
[branchPath: string]: DisplayDataItem[];
|
|
25
|
+
};
|
|
25
26
|
}
|
|
26
27
|
interface DisplayComputeResponse {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
values: DisplayResponseValue[];
|
|
29
|
+
/** Rhino `UnitSystem` name driving unit scaling (see `SCALE_FACTORS`); unrecognized/absent scales 1. */
|
|
30
|
+
modelunits: string;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/parse/display-items/types.d.ts
|
|
32
34
|
interface DisplayIdentity {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/** Stable pick key: `${sourceComponentId}:${originalIndex}`. Distinct from `name` so renaming doesn't change identity. */
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
layer: string;
|
|
39
|
+
/** Arbitrary key-value pairs from the GH Metadata input. */
|
|
40
|
+
metadata?: Record<string, string>;
|
|
39
41
|
}
|
|
40
42
|
interface DisplayItemBase extends DisplayIdentity {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
/** Hex/rgb/named color string, parsed by `parseColor`. Falls back to a viewer default. */
|
|
44
|
+
color?: string;
|
|
45
|
+
/** 0-1; omitted means fully opaque. */
|
|
46
|
+
opacity?: number;
|
|
45
47
|
}
|
|
46
48
|
/** Rhino's Z-up frame and `{X,Y,Z}` casing. */
|
|
47
49
|
interface DisplayPosition {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
X: number;
|
|
51
|
+
Y: number;
|
|
52
|
+
Z: number;
|
|
51
53
|
}
|
|
52
54
|
/** Rendered as a fat `Line2` straight from `points` — nothing decodes geometry in the browser. */
|
|
53
55
|
interface DisplayCurve extends DisplayItemBase {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
kind: 'curve';
|
|
57
|
+
/**
|
|
58
|
+
* Backend-tessellated polyline, flat `[x,y,z, …]` in Rhino's Z-up frame.
|
|
59
|
+
*
|
|
60
|
+
* Typed as required even though the plugin still sends a legacy `json` field alongside it: a
|
|
61
|
+
* payload without `points` came from a Display component too old to render, and parsing throws
|
|
62
|
+
* rather than treating it as a shape this package supports.
|
|
63
|
+
*/
|
|
64
|
+
points: number[];
|
|
65
|
+
/** Screen-space CSS px, constant regardless of zoom. Omitted uses the viewer default. */
|
|
66
|
+
width?: number;
|
|
65
67
|
}
|
|
66
68
|
interface DisplayPoint extends DisplayItemBase {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
kind: 'point';
|
|
70
|
+
position: DisplayPosition;
|
|
69
71
|
}
|
|
70
72
|
type DisplayItem = DisplayCurve | DisplayPoint;
|
|
71
|
-
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/parse/webdisplay/types.d.ts
|
|
72
75
|
interface SerializableMaterial {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
color: string;
|
|
77
|
+
metalness: number;
|
|
78
|
+
roughness: number;
|
|
79
|
+
opacity: number;
|
|
80
|
+
transparent: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Optional color-map texture reference: http(s) URL, data URI, or plugin asset URL
|
|
83
|
+
* (`http://localhost:{port}/assets/{hash}`). Omitted entirely (not just empty) when untextured.
|
|
84
|
+
* When set, the mesh blob also carries per-vertex UVs (FLAG_HAS_UVS) for meshes using it.
|
|
85
|
+
*/
|
|
86
|
+
map?: string;
|
|
84
87
|
}
|
|
85
88
|
/**
|
|
86
89
|
* `vertexStart`/`vertexCount` and `indexStart`/`indexCount` are in **element units** of the
|
|
@@ -90,23 +93,23 @@ interface SerializableMaterial {
|
|
|
90
93
|
* vertex components are 2 bytes (int16 quantized) or 4 bytes (`FLAG_FLOAT32`).
|
|
91
94
|
*/
|
|
92
95
|
interface MeshMetadata {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
name: string;
|
|
97
|
+
/** Layer path for grouping in the scene manager, e.g. 'Structure/Walls'. */
|
|
98
|
+
layer: string;
|
|
99
|
+
/** Index in the GH input tree before material grouping; combined with sourceComponentId
|
|
100
|
+
* uniquely identifies the GH source geometry. */
|
|
101
|
+
originalIndex: number;
|
|
102
|
+
vertexCount: number;
|
|
103
|
+
/** 3 per triangle. */
|
|
104
|
+
indexCount: number;
|
|
105
|
+
vertexStart: number;
|
|
106
|
+
indexStart: number;
|
|
107
|
+
/** Arbitrary key-value pairs from the GH Metadata input. */
|
|
108
|
+
metadata?: Record<string, string>;
|
|
106
109
|
}
|
|
107
110
|
interface MaterialGroup {
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
materialId: number;
|
|
112
|
+
meshes: MeshMetadata[];
|
|
110
113
|
}
|
|
111
114
|
/**
|
|
112
115
|
* One Display component's payload, ready for Three.js rendering.
|
|
@@ -120,45 +123,45 @@ interface MaterialGroup {
|
|
|
120
123
|
* blob (`items`), not inside it.
|
|
121
124
|
*/
|
|
122
125
|
interface DisplayBatch {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
materials: SerializableMaterial[];
|
|
127
|
+
groups: MaterialGroup[];
|
|
128
|
+
compressedData: string;
|
|
129
|
+
/** InstanceGuid of the WebDisplay GH component that produced this batch; combined with
|
|
130
|
+
* MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
|
|
131
|
+
sourceComponentId?: string;
|
|
132
|
+
/** Non-mesh display items — see {@link DisplayItem}. Parsed by the separate `display-items`
|
|
133
|
+
* path, not the SLVA mesh parser. Omitted when there are none. */
|
|
134
|
+
items?: DisplayItem[];
|
|
132
135
|
}
|
|
133
136
|
interface MeshBatchParsingOptions {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
/** Merge meshes sharing a material into a single geometry. Defaults to true. */
|
|
138
|
+
mergeByMaterial?: boolean;
|
|
139
|
+
debug?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Appearance dials applied to every material built from this batch — set once at parse time
|
|
142
|
+
* (materials are rebuilt per solve). Runtime restyling of an already-built scene lives in the
|
|
143
|
+
* viewer's `setLook`.
|
|
144
|
+
*/
|
|
145
|
+
material?: MaterialAppearanceOptions;
|
|
143
146
|
}
|
|
144
|
-
|
|
145
147
|
interface MeshExtractionOptions {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
148
|
+
parsing?: MeshBatchParsingOptions;
|
|
149
|
+
/** Scale geometry to model units. Defaults to true. */
|
|
150
|
+
allowScaling?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Drop geometry so its lowest point sits on the ground plane. **Defaults to `false`** — content
|
|
153
|
+
* renders at its true Rhino coordinates, matching the Grasshopper definition. Setting `true`
|
|
154
|
+
* shifts objects, so anything read back out of the scene (bounds, measured/picked positions) no
|
|
155
|
+
* longer corresponds to Rhino coordinates.
|
|
156
|
+
*/
|
|
157
|
+
allowAutoPosition?: boolean;
|
|
158
|
+
/** Up axis for `allowAutoPosition` grounding. Defaults to `'z'` (Rhino's frame) — only set this
|
|
159
|
+
* if the viewer is configured with a non-default `sceneUp`. */
|
|
160
|
+
groundAxis?: 'x' | 'y' | 'z';
|
|
161
|
+
debug?: boolean;
|
|
160
162
|
}
|
|
161
|
-
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/parse/webdisplay/webdisplay-parser.d.ts
|
|
162
165
|
/**
|
|
163
166
|
* Metres per model unit, keyed by Rhino `UnitSystem` name (the `modelunits` string on the compute
|
|
164
167
|
* response). Imperial factors are the exact international definitions. Units missing from this
|
|
@@ -175,10 +178,11 @@ declare const SCALE_FACTORS: Record<string, number>;
|
|
|
175
178
|
* @throws Rethrows unexpected errors after attempting to dispose any created meshes.
|
|
176
179
|
*/
|
|
177
180
|
declare function getThreeMeshesFromComputeResponse(data: DisplayComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Object3D[]>;
|
|
178
|
-
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/parse/webdisplay/batch-parser.d.ts
|
|
179
183
|
interface ParseTelemetry {
|
|
180
|
-
|
|
181
|
-
|
|
184
|
+
parseTime?: number;
|
|
185
|
+
perfStart?: number;
|
|
182
186
|
}
|
|
183
187
|
/**
|
|
184
188
|
* Parses a DisplayBatch object and creates Three.js meshes from its mesh blob.
|
|
@@ -188,7 +192,7 @@ interface ParseTelemetry {
|
|
|
188
192
|
*
|
|
189
193
|
* @throws {VisualizationError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
190
194
|
*/
|
|
191
|
-
declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions,
|
|
195
|
+
declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions,
|
|
192
196
|
/** @internal Timings threaded from an outer entry point — not a caller option. */
|
|
193
197
|
telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
|
|
194
198
|
/**
|
|
@@ -201,14 +205,16 @@ telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
|
|
|
201
205
|
* @throws {VisualizationError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
202
206
|
*/
|
|
203
207
|
declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: MeshBatchParsingOptions): Promise<THREE.Mesh[]>;
|
|
204
|
-
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/parse/webdisplay/apply-texture.d.ts
|
|
205
210
|
/**
|
|
206
211
|
* Subscribed to the renderer's own report below, so no host wiring is needed; still exported for a
|
|
207
212
|
* host embedding a foreign renderer that wants to set it directly. Applies to textures loaded from
|
|
208
213
|
* here on — textures already decoded keep the value they were given.
|
|
209
214
|
*/
|
|
210
215
|
declare function setTextureAnisotropy(value: number): void;
|
|
211
|
-
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/parse/display-items/display-items-parser.d.ts
|
|
212
218
|
/**
|
|
213
219
|
* Builds THREE objects for the batch's non-mesh items.
|
|
214
220
|
*
|
|
@@ -217,5 +223,6 @@ declare function setTextureAnisotropy(value: number): void;
|
|
|
217
223
|
* unrenderable item is logged and skipped.
|
|
218
224
|
*/
|
|
219
225
|
declare function parseDisplayItems(items: DisplayItem[] | undefined): THREE.Object3D[];
|
|
220
|
-
|
|
226
|
+
//#endregion
|
|
221
227
|
export { type DisplayBatch, type DisplayComputeResponse, type DisplayCurve, type DisplayDataItem, type DisplayIdentity, type DisplayItem, type DisplayItemBase, type DisplayPoint, type DisplayPosition, type DisplayResponseValue, type MaterialGroup, type MeshBatchParsingOptions, type MeshExtractionOptions, type MeshMetadata, SCALE_FACTORS, type SerializableMaterial, getThreeMeshesFromComputeResponse, meshPolicy, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, setTextureAnisotropy };
|
|
228
|
+
//# sourceMappingURL=parse.d.cts.map
|
package/dist/parse.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { i as MaterialAppearanceOptions } from "./types-Di80Y609.js";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
//#region src/parse/mesh-policy.d.ts
|
|
4
4
|
/** Structurally, not nominally, typed as `@selvajs/solve/client`'s `MeshPolicy<THREE.Object3D>` — avoids a dependency on solve. */
|
|
5
5
|
declare const meshPolicy: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
clone(meshes: THREE.Object3D[]): THREE.Object3D[];
|
|
7
|
+
release(meshes: THREE.Object3D[]): void;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/parse/webdisplay/response-envelope.d.ts
|
|
10
11
|
/**
|
|
11
12
|
* Declared structurally rather than imported from `@selvajs/compute` — this package converts
|
|
12
13
|
* meshes, it doesn't need a Rhino.Compute client dependency to describe the shape a caller hands
|
|
@@ -14,73 +15,75 @@ declare const meshPolicy: {
|
|
|
14
15
|
* this, so {@link getThreeMeshesFromComputeResponse} keeps accepting one unchanged.
|
|
15
16
|
*/
|
|
16
17
|
interface DisplayDataItem {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/** Namespaced wire type token, e.g. `Selva.GH.Features.Display.Services.DisplayBatch`. */
|
|
19
|
+
type: string;
|
|
20
|
+
data: string;
|
|
20
21
|
}
|
|
21
22
|
interface DisplayResponseValue {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
InnerTree: {
|
|
24
|
+
[branchPath: string]: DisplayDataItem[];
|
|
25
|
+
};
|
|
25
26
|
}
|
|
26
27
|
interface DisplayComputeResponse {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
values: DisplayResponseValue[];
|
|
29
|
+
/** Rhino `UnitSystem` name driving unit scaling (see `SCALE_FACTORS`); unrecognized/absent scales 1. */
|
|
30
|
+
modelunits: string;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/parse/display-items/types.d.ts
|
|
32
34
|
interface DisplayIdentity {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/** Stable pick key: `${sourceComponentId}:${originalIndex}`. Distinct from `name` so renaming doesn't change identity. */
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
layer: string;
|
|
39
|
+
/** Arbitrary key-value pairs from the GH Metadata input. */
|
|
40
|
+
metadata?: Record<string, string>;
|
|
39
41
|
}
|
|
40
42
|
interface DisplayItemBase extends DisplayIdentity {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
/** Hex/rgb/named color string, parsed by `parseColor`. Falls back to a viewer default. */
|
|
44
|
+
color?: string;
|
|
45
|
+
/** 0-1; omitted means fully opaque. */
|
|
46
|
+
opacity?: number;
|
|
45
47
|
}
|
|
46
48
|
/** Rhino's Z-up frame and `{X,Y,Z}` casing. */
|
|
47
49
|
interface DisplayPosition {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
X: number;
|
|
51
|
+
Y: number;
|
|
52
|
+
Z: number;
|
|
51
53
|
}
|
|
52
54
|
/** Rendered as a fat `Line2` straight from `points` — nothing decodes geometry in the browser. */
|
|
53
55
|
interface DisplayCurve extends DisplayItemBase {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
kind: 'curve';
|
|
57
|
+
/**
|
|
58
|
+
* Backend-tessellated polyline, flat `[x,y,z, …]` in Rhino's Z-up frame.
|
|
59
|
+
*
|
|
60
|
+
* Typed as required even though the plugin still sends a legacy `json` field alongside it: a
|
|
61
|
+
* payload without `points` came from a Display component too old to render, and parsing throws
|
|
62
|
+
* rather than treating it as a shape this package supports.
|
|
63
|
+
*/
|
|
64
|
+
points: number[];
|
|
65
|
+
/** Screen-space CSS px, constant regardless of zoom. Omitted uses the viewer default. */
|
|
66
|
+
width?: number;
|
|
65
67
|
}
|
|
66
68
|
interface DisplayPoint extends DisplayItemBase {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
kind: 'point';
|
|
70
|
+
position: DisplayPosition;
|
|
69
71
|
}
|
|
70
72
|
type DisplayItem = DisplayCurve | DisplayPoint;
|
|
71
|
-
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/parse/webdisplay/types.d.ts
|
|
72
75
|
interface SerializableMaterial {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
color: string;
|
|
77
|
+
metalness: number;
|
|
78
|
+
roughness: number;
|
|
79
|
+
opacity: number;
|
|
80
|
+
transparent: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Optional color-map texture reference: http(s) URL, data URI, or plugin asset URL
|
|
83
|
+
* (`http://localhost:{port}/assets/{hash}`). Omitted entirely (not just empty) when untextured.
|
|
84
|
+
* When set, the mesh blob also carries per-vertex UVs (FLAG_HAS_UVS) for meshes using it.
|
|
85
|
+
*/
|
|
86
|
+
map?: string;
|
|
84
87
|
}
|
|
85
88
|
/**
|
|
86
89
|
* `vertexStart`/`vertexCount` and `indexStart`/`indexCount` are in **element units** of the
|
|
@@ -90,23 +93,23 @@ interface SerializableMaterial {
|
|
|
90
93
|
* vertex components are 2 bytes (int16 quantized) or 4 bytes (`FLAG_FLOAT32`).
|
|
91
94
|
*/
|
|
92
95
|
interface MeshMetadata {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
name: string;
|
|
97
|
+
/** Layer path for grouping in the scene manager, e.g. 'Structure/Walls'. */
|
|
98
|
+
layer: string;
|
|
99
|
+
/** Index in the GH input tree before material grouping; combined with sourceComponentId
|
|
100
|
+
* uniquely identifies the GH source geometry. */
|
|
101
|
+
originalIndex: number;
|
|
102
|
+
vertexCount: number;
|
|
103
|
+
/** 3 per triangle. */
|
|
104
|
+
indexCount: number;
|
|
105
|
+
vertexStart: number;
|
|
106
|
+
indexStart: number;
|
|
107
|
+
/** Arbitrary key-value pairs from the GH Metadata input. */
|
|
108
|
+
metadata?: Record<string, string>;
|
|
106
109
|
}
|
|
107
110
|
interface MaterialGroup {
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
materialId: number;
|
|
112
|
+
meshes: MeshMetadata[];
|
|
110
113
|
}
|
|
111
114
|
/**
|
|
112
115
|
* One Display component's payload, ready for Three.js rendering.
|
|
@@ -120,45 +123,45 @@ interface MaterialGroup {
|
|
|
120
123
|
* blob (`items`), not inside it.
|
|
121
124
|
*/
|
|
122
125
|
interface DisplayBatch {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
materials: SerializableMaterial[];
|
|
127
|
+
groups: MaterialGroup[];
|
|
128
|
+
compressedData: string;
|
|
129
|
+
/** InstanceGuid of the WebDisplay GH component that produced this batch; combined with
|
|
130
|
+
* MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
|
|
131
|
+
sourceComponentId?: string;
|
|
132
|
+
/** Non-mesh display items — see {@link DisplayItem}. Parsed by the separate `display-items`
|
|
133
|
+
* path, not the SLVA mesh parser. Omitted when there are none. */
|
|
134
|
+
items?: DisplayItem[];
|
|
132
135
|
}
|
|
133
136
|
interface MeshBatchParsingOptions {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
/** Merge meshes sharing a material into a single geometry. Defaults to true. */
|
|
138
|
+
mergeByMaterial?: boolean;
|
|
139
|
+
debug?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Appearance dials applied to every material built from this batch — set once at parse time
|
|
142
|
+
* (materials are rebuilt per solve). Runtime restyling of an already-built scene lives in the
|
|
143
|
+
* viewer's `setLook`.
|
|
144
|
+
*/
|
|
145
|
+
material?: MaterialAppearanceOptions;
|
|
143
146
|
}
|
|
144
|
-
|
|
145
147
|
interface MeshExtractionOptions {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
148
|
+
parsing?: MeshBatchParsingOptions;
|
|
149
|
+
/** Scale geometry to model units. Defaults to true. */
|
|
150
|
+
allowScaling?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Drop geometry so its lowest point sits on the ground plane. **Defaults to `false`** — content
|
|
153
|
+
* renders at its true Rhino coordinates, matching the Grasshopper definition. Setting `true`
|
|
154
|
+
* shifts objects, so anything read back out of the scene (bounds, measured/picked positions) no
|
|
155
|
+
* longer corresponds to Rhino coordinates.
|
|
156
|
+
*/
|
|
157
|
+
allowAutoPosition?: boolean;
|
|
158
|
+
/** Up axis for `allowAutoPosition` grounding. Defaults to `'z'` (Rhino's frame) — only set this
|
|
159
|
+
* if the viewer is configured with a non-default `sceneUp`. */
|
|
160
|
+
groundAxis?: 'x' | 'y' | 'z';
|
|
161
|
+
debug?: boolean;
|
|
160
162
|
}
|
|
161
|
-
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/parse/webdisplay/webdisplay-parser.d.ts
|
|
162
165
|
/**
|
|
163
166
|
* Metres per model unit, keyed by Rhino `UnitSystem` name (the `modelunits` string on the compute
|
|
164
167
|
* response). Imperial factors are the exact international definitions. Units missing from this
|
|
@@ -175,10 +178,11 @@ declare const SCALE_FACTORS: Record<string, number>;
|
|
|
175
178
|
* @throws Rethrows unexpected errors after attempting to dispose any created meshes.
|
|
176
179
|
*/
|
|
177
180
|
declare function getThreeMeshesFromComputeResponse(data: DisplayComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Object3D[]>;
|
|
178
|
-
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/parse/webdisplay/batch-parser.d.ts
|
|
179
183
|
interface ParseTelemetry {
|
|
180
|
-
|
|
181
|
-
|
|
184
|
+
parseTime?: number;
|
|
185
|
+
perfStart?: number;
|
|
182
186
|
}
|
|
183
187
|
/**
|
|
184
188
|
* Parses a DisplayBatch object and creates Three.js meshes from its mesh blob.
|
|
@@ -188,7 +192,7 @@ interface ParseTelemetry {
|
|
|
188
192
|
*
|
|
189
193
|
* @throws {VisualizationError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
190
194
|
*/
|
|
191
|
-
declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions,
|
|
195
|
+
declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions,
|
|
192
196
|
/** @internal Timings threaded from an outer entry point — not a caller option. */
|
|
193
197
|
telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
|
|
194
198
|
/**
|
|
@@ -201,14 +205,16 @@ telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
|
|
|
201
205
|
* @throws {VisualizationError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
202
206
|
*/
|
|
203
207
|
declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: MeshBatchParsingOptions): Promise<THREE.Mesh[]>;
|
|
204
|
-
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/parse/webdisplay/apply-texture.d.ts
|
|
205
210
|
/**
|
|
206
211
|
* Subscribed to the renderer's own report below, so no host wiring is needed; still exported for a
|
|
207
212
|
* host embedding a foreign renderer that wants to set it directly. Applies to textures loaded from
|
|
208
213
|
* here on — textures already decoded keep the value they were given.
|
|
209
214
|
*/
|
|
210
215
|
declare function setTextureAnisotropy(value: number): void;
|
|
211
|
-
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/parse/display-items/display-items-parser.d.ts
|
|
212
218
|
/**
|
|
213
219
|
* Builds THREE objects for the batch's non-mesh items.
|
|
214
220
|
*
|
|
@@ -217,5 +223,6 @@ declare function setTextureAnisotropy(value: number): void;
|
|
|
217
223
|
* unrenderable item is logged and skipped.
|
|
218
224
|
*/
|
|
219
225
|
declare function parseDisplayItems(items: DisplayItem[] | undefined): THREE.Object3D[];
|
|
220
|
-
|
|
226
|
+
//#endregion
|
|
221
227
|
export { type DisplayBatch, type DisplayComputeResponse, type DisplayCurve, type DisplayDataItem, type DisplayIdentity, type DisplayItem, type DisplayItemBase, type DisplayPoint, type DisplayPosition, type DisplayResponseValue, type MaterialGroup, type MeshBatchParsingOptions, type MeshExtractionOptions, type MeshMetadata, SCALE_FACTORS, type SerializableMaterial, getThreeMeshesFromComputeResponse, meshPolicy, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, setTextureAnisotropy };
|
|
228
|
+
//# sourceMappingURL=parse.d.ts.map
|