@selvajs/compute 3.1.0-beta.4 → 3.1.0-beta.6
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/chunk-727SRM4E.cjs +62 -0
- package/dist/chunk-727SRM4E.cjs.map +1 -0
- package/dist/chunk-CUQQ3ZBV.cjs +4 -0
- package/dist/chunk-CUQQ3ZBV.cjs.map +1 -0
- package/dist/chunk-CWODTGNH.js +62 -0
- package/dist/chunk-CWODTGNH.js.map +1 -0
- package/dist/chunk-JNFNLKFO.js +2 -0
- package/dist/chunk-JNFNLKFO.js.map +1 -0
- package/dist/chunk-WPB2LKCD.js +4 -0
- package/dist/chunk-WPB2LKCD.js.map +1 -0
- package/dist/chunk-Y5E6RIEH.cjs +2 -0
- package/dist/chunk-Y5E6RIEH.cjs.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +40 -3
- package/dist/core.d.ts +40 -3
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +222 -32
- package/dist/grasshopper.d.ts +222 -32
- package/dist/grasshopper.js +1 -1
- package/dist/{handle-files-9pkEgDIp.d.ts → handle-files-BISo_wob.d.cts} +51 -67
- package/dist/{handle-files-9pkEgDIp.d.cts → handle-files-BISo_wob.d.ts} +51 -67
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/types-BGhtYxZ-.d.cts +45 -0
- package/dist/types-BGhtYxZ-.d.ts +45 -0
- package/dist/{types-BBSF_ISX.d.ts → types-C8XWc4Ab.d.cts} +62 -66
- package/dist/{types-DxPi5SEx.d.cts → types-Dtok-mVq.d.ts} +62 -66
- package/dist/visualization-36IV2CVU.cjs +2 -0
- package/dist/visualization-36IV2CVU.cjs.map +1 -0
- package/dist/visualization-QCI36RHC.js +2 -0
- package/dist/visualization.cjs +1 -1
- package/dist/visualization.d.cts +144 -48
- package/dist/visualization.d.ts +144 -48
- package/dist/visualization.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-33753HSV.cjs +0 -2
- package/dist/chunk-33753HSV.cjs.map +0 -1
- package/dist/chunk-4JNRO7TX.cjs +0 -62
- package/dist/chunk-4JNRO7TX.cjs.map +0 -1
- package/dist/chunk-6V6SUB4V.js +0 -62
- package/dist/chunk-6V6SUB4V.js.map +0 -1
- package/dist/chunk-D7A3YIYD.cjs +0 -4
- package/dist/chunk-D7A3YIYD.cjs.map +0 -1
- package/dist/chunk-EMXDP7KY.js +0 -4
- package/dist/chunk-EMXDP7KY.js.map +0 -1
- package/dist/chunk-MDFVHHH6.js +0 -2
- package/dist/chunk-MDFVHHH6.js.map +0 -1
- package/dist/types-V7G83j5m.d.cts +0 -100
- package/dist/types-V7G83j5m.d.ts +0 -100
- package/dist/visualization-3XYZHAIV.js +0 -2
- package/dist/visualization-DEAMRV7R.cjs +0 -2
- package/dist/visualization-DEAMRV7R.cjs.map +0 -1
- /package/dist/{visualization-3XYZHAIV.js.map → visualization-QCI36RHC.js.map} +0 -0
|
@@ -1,57 +1,44 @@
|
|
|
1
|
-
import { C as ComputeConfig, a as RhinoModelUnit } from './types-
|
|
1
|
+
import { C as ComputeConfig, a as RhinoModelUnit } from './types-BGhtYxZ-.js';
|
|
2
2
|
import { RhinoModule } from 'rhino3dm';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Grasshopper types
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Grasshopper-style data tree branch path
|
|
10
|
-
* @example "{0}", "{0;0}", "{0;1;2}"
|
|
11
|
-
*/
|
|
12
4
|
type DataTreePath = `{${string}}`;
|
|
13
|
-
/**
|
|
14
|
-
* Represents a data item in a data tree
|
|
15
|
-
*/
|
|
16
5
|
interface DataItem {
|
|
17
|
-
/** The type of the data, inferred from the Grasshopper GOO class */
|
|
18
6
|
type: string;
|
|
19
|
-
/** The actual returned data as a string that may need to be parsed */
|
|
20
7
|
data: string;
|
|
21
|
-
/** The grasshopper refrence id of the output */
|
|
22
8
|
id: string;
|
|
23
9
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Grasshopper-style data tree for input defaults
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const numericTree: DataTreeDefault<number> = {
|
|
29
|
-
* "{0}": [1, 2, 3],
|
|
30
|
-
* "{0;0}": [4, 5],
|
|
31
|
-
* "{1}": [6]
|
|
32
|
-
* };
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
10
|
type DataTreeDefault<T = any> = {
|
|
36
11
|
[K in DataTreePath]?: T[];
|
|
37
12
|
};
|
|
38
|
-
/**
|
|
39
|
-
* Data structure for InnerTreeData matching Rhino Compute responses
|
|
40
|
-
*/
|
|
41
13
|
type InnerTreeData = {
|
|
42
14
|
[path in DataTreePath]: DataItem[];
|
|
43
15
|
};
|
|
44
16
|
/**
|
|
45
|
-
* Tree with parameter metadata (used in compute responses)
|
|
17
|
+
* Tree with parameter metadata (used in compute requests and responses).
|
|
18
|
+
*
|
|
19
|
+
* Field casing varies by server branch: stock mcneel compute (8.x/9.x)
|
|
20
|
+
* serializes `Resthopper.IO.DataTree` in PascalCase (`ParamName`/`InnerTree`
|
|
21
|
+
* — the C# class carries no `[JsonProperty]` attributes), while
|
|
22
|
+
* camelCase-serializing forks return `paramName`/`innerTree` instead. This
|
|
23
|
+
* client always *sends* PascalCase (see `DataTree.toCompute()` in
|
|
24
|
+
* `data-tree.ts`), so the PascalCase fields remain the canonical/required
|
|
25
|
+
* shape; the optional camelCase fields exist so responses from camelCase
|
|
26
|
+
* forks are representable without casts. Code that must read trees across
|
|
27
|
+
* both server families should use `readField`/`hasField`
|
|
28
|
+
* (`@/core/utils/read-field`, case-insensitive) rather than direct property
|
|
29
|
+
* access — `warnOnEmptyInnerTrees` in `solve.ts` is the reference example.
|
|
46
30
|
*/
|
|
47
31
|
interface DataTree {
|
|
32
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
48
33
|
InnerTree: InnerTreeData;
|
|
34
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
49
35
|
ParamName: string;
|
|
36
|
+
/** camelCase — sent instead of `InnerTree` by camelCase server forks. */
|
|
37
|
+
innerTree?: InnerTreeData;
|
|
38
|
+
/** camelCase — sent instead of `ParamName` by camelCase server forks. */
|
|
39
|
+
paramName?: string;
|
|
50
40
|
}
|
|
51
|
-
|
|
52
|
-
* Output types supported from Grasshopper/Rhino Compute
|
|
53
|
-
*/
|
|
54
|
-
type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | string;
|
|
41
|
+
type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | (string & {});
|
|
55
42
|
/**
|
|
56
43
|
* Union type for all possible default value types
|
|
57
44
|
*/
|
|
@@ -207,11 +194,24 @@ interface GrasshopperRequestSchema extends GrasshopperBaseSchema, GrasshopperDef
|
|
|
207
194
|
/**
|
|
208
195
|
* Response from Grasshopper compute server
|
|
209
196
|
* Includes all schema fields + computed results
|
|
197
|
+
*
|
|
198
|
+
* `pointer` is deliberately excluded (`Omit`): the solve layer (`runSolve` in
|
|
199
|
+
* `solve.ts`) splits the server's echoed `pointer` off as the solve's
|
|
200
|
+
* `cacheKey` and strips it from the returned response, so client-returned
|
|
201
|
+
* responses never carry it.
|
|
202
|
+
*
|
|
203
|
+
* The schema-echo fields (`cachesolve`/`modelunits`/`dataversion`) stay
|
|
204
|
+
* optional as inherited from {@link GrasshopperBaseSchema}: the server echoes
|
|
205
|
+
* them back when set, but nothing client-side enforces their presence — don't
|
|
206
|
+
* rely on them without a fallback.
|
|
210
207
|
*/
|
|
211
|
-
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, GrasshopperDefinitionSource {
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
208
|
+
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, Omit<GrasshopperDefinitionSource, 'pointer'> {
|
|
209
|
+
/**
|
|
210
|
+
* Model units the definition was solved in. Every conforming server response
|
|
211
|
+
* carries this (it drives downstream scaling, e.g. the webdisplay parser),
|
|
212
|
+
* but note it is not validated client-side — a non-conforming server or
|
|
213
|
+
* hand-built mock may omit it at runtime.
|
|
214
|
+
*/
|
|
215
215
|
modelunits: RhinoModelUnit;
|
|
216
216
|
/**
|
|
217
217
|
* The server echoes the request's full base64 definition back as `algo`, but the client strips
|
|
@@ -222,8 +222,6 @@ interface GrasshopperComputeResponse extends GrasshopperBaseSchema, GrasshopperD
|
|
|
222
222
|
algo?: string | null;
|
|
223
223
|
/** Filename of the definition (always present in response) */
|
|
224
224
|
filename: string | null;
|
|
225
|
-
/** Data version */
|
|
226
|
-
dataversion: 7 | 8;
|
|
227
225
|
/** Recursion level used */
|
|
228
226
|
recursionlevel?: number;
|
|
229
227
|
/** Output values organized by parameter */
|
|
@@ -332,14 +330,9 @@ interface GrasshopperParsedIO {
|
|
|
332
330
|
}
|
|
333
331
|
|
|
334
332
|
/**
|
|
335
|
-
* Non-mesh display items: curves
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* separate pipeline from the SLVA mesh path in `../webdisplay`. Curves arrive as Rhino-native JSON
|
|
339
|
-
* (decoded via rhino3dm and tessellated on the web); points arrive as raw `{X,Y,Z}` positions.
|
|
340
|
-
*
|
|
341
|
-
* The union is STRICT and discriminated on `kind`. The parser narrows on it and uses a
|
|
342
|
-
* `never`-exhaustiveness check, so adding a new kind is a compile error until it is handled.
|
|
333
|
+
* Non-mesh display items: curves and points. Ride as JSON inside {@link DisplayBatch} alongside
|
|
334
|
+
* the binary mesh blob. The union is STRICT and discriminated on `kind`; the parser uses a
|
|
335
|
+
* `never`-exhaustiveness check, so adding a new kind is a compile error until handled.
|
|
343
336
|
*/
|
|
344
337
|
/**
|
|
345
338
|
* Identity + tagging shared by every display thing — meshes (via an adapter over `MeshMetadata`)
|
|
@@ -367,7 +360,10 @@ interface DisplayItemBase extends DisplayIdentity {
|
|
|
367
360
|
/** Opacity 0–1. Omitted means fully opaque. */
|
|
368
361
|
opacity?: number;
|
|
369
362
|
}
|
|
370
|
-
/**
|
|
363
|
+
/**
|
|
364
|
+
* A world position in Rhino's Z-up frame, in Rhino's `{X,Y,Z}` casing. Used unchanged on parse —
|
|
365
|
+
* the Three scene IS Rhino's Z-up frame, so no rotation is applied (see `../coordinate-transform.ts`).
|
|
366
|
+
*/
|
|
371
367
|
interface DisplayPosition {
|
|
372
368
|
X: number;
|
|
373
369
|
Y: number;
|
|
@@ -390,7 +386,7 @@ interface DisplayCurve extends DisplayItemBase {
|
|
|
390
386
|
/** A single point, shipped raw (no rhino3dm decode), rendered as one vertex of a `THREE.Points`. */
|
|
391
387
|
interface DisplayPoint extends DisplayItemBase {
|
|
392
388
|
kind: 'point';
|
|
393
|
-
/** World position in Rhino Z-up
|
|
389
|
+
/** World position in Rhino Z-up, used directly — the Three scene shares Rhino's Z-up frame. */
|
|
394
390
|
position: DisplayPosition;
|
|
395
391
|
}
|
|
396
392
|
/**
|
|
@@ -421,11 +417,17 @@ interface SerializableMaterial {
|
|
|
421
417
|
* Metadata for a single mesh within a batch.
|
|
422
418
|
*
|
|
423
419
|
* Offsets and counts are expressed in **vertex-count units** (not float components) and
|
|
424
|
-
* **index-count units
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* -
|
|
428
|
-
* -
|
|
420
|
+
* **index-count units** — i.e. element offsets into the decoded typed arrays, which is how
|
|
421
|
+
* consumers address them (`indices.subarray(indexStart, indexStart + indexCount)`). To address
|
|
422
|
+
* the typed-array storage:
|
|
423
|
+
* - vertex component offset = `vertexStart * 3`
|
|
424
|
+
* - vertex component count = `vertexCount * 3`
|
|
425
|
+
* - index element offset = `indexStart`
|
|
426
|
+
* - index count = `indexCount`
|
|
427
|
+
*
|
|
428
|
+
* If you need *byte* offsets, multiply by the element size, which depends on the blob's flags:
|
|
429
|
+
* indices are 2 bytes each for `FLAG_UINT16_INDICES` (wire v2+) blobs and 4 bytes for uint32
|
|
430
|
+
* blobs; vertex components are 2 bytes (int16 quantized) or 4 bytes (`FLAG_FLOAT32`).
|
|
429
431
|
*/
|
|
430
432
|
interface MeshMetadata {
|
|
431
433
|
name: string;
|
|
@@ -468,11 +470,8 @@ interface MaterialGroup {
|
|
|
468
470
|
* later labels/icons) also travel — those ride as JSON alongside the mesh blob, not inside it.
|
|
469
471
|
*/
|
|
470
472
|
interface DisplayBatch {
|
|
471
|
-
/** Array of unique materials */
|
|
472
473
|
materials: SerializableMaterial[];
|
|
473
|
-
/** Groups of meshes organized by material */
|
|
474
474
|
groups: MaterialGroup[];
|
|
475
|
-
/** Base64-encoded binary blob (SLVA wire format). */
|
|
476
475
|
compressedData: string;
|
|
477
476
|
/** InstanceGuid of the WebDisplay GH component that produced this batch.
|
|
478
477
|
* Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
|
|
@@ -490,20 +489,17 @@ interface DisplayBatch {
|
|
|
490
489
|
* This alias keeps existing imports compiling; remove it once consumers migrate.
|
|
491
490
|
*/
|
|
492
491
|
type MeshBatch = DisplayBatch;
|
|
493
|
-
/**
|
|
494
|
-
* Options for parsing mesh batch data.
|
|
495
|
-
*/
|
|
496
492
|
interface MeshBatchParsingOptions {
|
|
497
|
-
/** Merge meshes with same material into single geometry
|
|
493
|
+
/** Merge meshes with same material into single geometry. Defaults to true. */
|
|
498
494
|
mergeByMaterial?: boolean;
|
|
499
|
-
/** Apply coordinate system transformations
|
|
495
|
+
/** Apply coordinate system transformations. Defaults to true. */
|
|
500
496
|
applyTransforms?: boolean;
|
|
501
|
-
/** Enable performance monitoring
|
|
497
|
+
/** Enable performance monitoring. Defaults to false. */
|
|
502
498
|
debug?: boolean;
|
|
503
499
|
/**
|
|
504
|
-
* Appearance dials applied to every material built from this batch. These drive how "
|
|
500
|
+
* Appearance dials applied to every material built from this batch. These drive how "studio"
|
|
505
501
|
* vs "matte technical" the meshes look; they are set once at parse time (materials are rebuilt
|
|
506
|
-
* per solve). Runtime restyling of an already-built scene lives in the viewer's `
|
|
502
|
+
* per solve). Runtime restyling of an already-built scene lives in the viewer's `setLook`.
|
|
507
503
|
*/
|
|
508
504
|
material?: MaterialAppearanceOptions;
|
|
509
505
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk727SRM4Ecjs = require('./chunk-727SRM4E.cjs');require('./chunk-CUQQ3ZBV.cjs');exports.BINARY_MESH_MAGIC = _chunk727SRM4Ecjs.w; exports.BINARY_MESH_VERSION = _chunk727SRM4Ecjs.y; exports.COMPRESSED_MESH_MAGIC = _chunk727SRM4Ecjs.x; exports.EDGE_USERDATA_KIND = _chunk727SRM4Ecjs.i; exports.FLAG_DELTA_ENCODED = _chunk727SRM4Ecjs.C; exports.FLAG_FLOAT32 = _chunk727SRM4Ecjs.A; exports.FLAG_HAS_UVS = _chunk727SRM4Ecjs.D; exports.FLAG_HAS_VERTEX_COLORS = _chunk727SRM4Ecjs.E; exports.FLAG_UINT16_INDICES = _chunk727SRM4Ecjs.B; exports.MIN_SUPPORTED_VERSION = _chunk727SRM4Ecjs.z; exports.Materials = _chunk727SRM4Ecjs.a; exports.SCALE_FACTORS = _chunk727SRM4Ecjs.L; exports.TEXTURE_CACHE_MAX_ENTRIES = _chunk727SRM4Ecjs.q; exports.UV_FORMAT_FLOAT32 = _chunk727SRM4Ecjs.G; exports.UV_FORMAT_UINT16 = _chunk727SRM4Ecjs.F; exports.addEdges = _chunk727SRM4Ecjs.j; exports.applyOffset = _chunk727SRM4Ecjs.d; exports.clearTextureCache = _chunk727SRM4Ecjs.s; exports.computeCombinedBoundingBox = _chunk727SRM4Ecjs.e; exports.createCameraController = _chunk727SRM4Ecjs.f; exports.createGrid = _chunk727SRM4Ecjs.g; exports.createLabelLayer = _chunk727SRM4Ecjs.n; exports.createMeasureTool = _chunk727SRM4Ecjs.p; exports.createRenderPipeline = _chunk727SRM4Ecjs.m; exports.createViewGizmo = _chunk727SRM4Ecjs.h; exports.getThreeMeshesFromComputeResponse = _chunk727SRM4Ecjs.M; exports.initThree = _chunk727SRM4Ecjs.u; exports.isEdgeOverlay = _chunk727SRM4Ecjs.k; exports.materialAppearanceForLook = _chunk727SRM4Ecjs.t; exports.parseBinaryMeshBatch = _chunk727SRM4Ecjs.H; exports.parseColor = _chunk727SRM4Ecjs.c; exports.parseDisplayItems = _chunk727SRM4Ecjs.v; exports.parseMeshBatch = _chunk727SRM4Ecjs.I; exports.parseMeshBatchBlob = _chunk727SRM4Ecjs.K; exports.parseMeshBatchObject = _chunk727SRM4Ecjs.J; exports.removeEdges = _chunk727SRM4Ecjs.l; exports.setTextureAnisotropy = _chunk727SRM4Ecjs.r; exports.snapToVertex = _chunk727SRM4Ecjs.o; exports.updateScene = _chunk727SRM4Ecjs.b;
|
|
2
|
+
//# sourceMappingURL=visualization-36IV2CVU.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization-36IV2CVU.cjs"],"names":[],"mappings":"AAAA,iIAA6S,gCAA6B,62DAAg4B","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization-36IV2CVU.cjs"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{A as I,B as L,C as R,D as S,E as D,F as B,G,H as P,I as u,J as F,K as b,L as N,M as V,a as e,b as r,c as o,d as t,e as a,f as s,g as p,h as i,i as n,j as m,k as l,l as f,m as y,n as C,o as x,p as d,q as h,r as E,s as M,t as _,u as c,v as A,w as g,x as O,y as T,z as j}from"./chunk-CWODTGNH.js";import"./chunk-WPB2LKCD.js";export{g as BINARY_MESH_MAGIC,T as BINARY_MESH_VERSION,O as COMPRESSED_MESH_MAGIC,n as EDGE_USERDATA_KIND,R as FLAG_DELTA_ENCODED,I as FLAG_FLOAT32,S as FLAG_HAS_UVS,D as FLAG_HAS_VERTEX_COLORS,L as FLAG_UINT16_INDICES,j as MIN_SUPPORTED_VERSION,e as Materials,N as SCALE_FACTORS,h as TEXTURE_CACHE_MAX_ENTRIES,G as UV_FORMAT_FLOAT32,B as UV_FORMAT_UINT16,m as addEdges,t as applyOffset,M as clearTextureCache,a as computeCombinedBoundingBox,s as createCameraController,p as createGrid,C as createLabelLayer,d as createMeasureTool,y as createRenderPipeline,i as createViewGizmo,V as getThreeMeshesFromComputeResponse,c as initThree,l as isEdgeOverlay,_ as materialAppearanceForLook,P as parseBinaryMeshBatch,o as parseColor,A as parseDisplayItems,u as parseMeshBatch,b as parseMeshBatchBlob,F as parseMeshBatchObject,f as removeEdges,E as setTextureAnisotropy,x as snapToVertex,r as updateScene};
|
|
2
|
+
//# sourceMappingURL=visualization-QCI36RHC.js.map
|
package/dist/visualization.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk727SRM4Ecjs = require('./chunk-727SRM4E.cjs');require('./chunk-CUQQ3ZBV.cjs');exports.EDGE_USERDATA_KIND = _chunk727SRM4Ecjs.i; exports.Materials = _chunk727SRM4Ecjs.a; exports.SCALE_FACTORS = _chunk727SRM4Ecjs.L; exports.addEdges = _chunk727SRM4Ecjs.j; exports.applyOffset = _chunk727SRM4Ecjs.d; exports.computeCombinedBoundingBox = _chunk727SRM4Ecjs.e; exports.createCameraController = _chunk727SRM4Ecjs.f; exports.createGrid = _chunk727SRM4Ecjs.g; exports.createLabelLayer = _chunk727SRM4Ecjs.n; exports.createMeasureTool = _chunk727SRM4Ecjs.p; exports.createRenderPipeline = _chunk727SRM4Ecjs.m; exports.createViewGizmo = _chunk727SRM4Ecjs.h; exports.getThreeMeshesFromComputeResponse = _chunk727SRM4Ecjs.M; exports.initThree = _chunk727SRM4Ecjs.u; exports.isEdgeOverlay = _chunk727SRM4Ecjs.k; exports.parseColor = _chunk727SRM4Ecjs.c; exports.parseDisplayItems = _chunk727SRM4Ecjs.v; exports.parseMeshBatchBlob = _chunk727SRM4Ecjs.K; exports.parseMeshBatchObject = _chunk727SRM4Ecjs.J; exports.removeEdges = _chunk727SRM4Ecjs.l; exports.snapToVertex = _chunk727SRM4Ecjs.o; exports.updateScene = _chunk727SRM4Ecjs.b;
|
|
2
2
|
//# sourceMappingURL=visualization.cjs.map
|
package/dist/visualization.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
3
|
-
import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-
|
|
4
|
-
export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-
|
|
3
|
+
import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-C8XWc4Ab.cjs';
|
|
4
|
+
export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-C8XWc4Ab.cjs';
|
|
5
5
|
import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';
|
|
6
6
|
import { LineSegments2 } from 'three/addons/lines/LineSegments2.js';
|
|
7
7
|
import { RhinoModule } from 'rhino3dm';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-BGhtYxZ-.cjs';
|
|
9
9
|
|
|
10
10
|
type CameraConfig = {
|
|
11
11
|
position?: THREE.Vector3;
|
|
@@ -21,6 +21,20 @@ type LightingConfig = {
|
|
|
21
21
|
ambientLightColor?: THREE.Color;
|
|
22
22
|
ambientLightIntensity?: number;
|
|
23
23
|
sunlightColor?: THREE.Color | number;
|
|
24
|
+
/**
|
|
25
|
+
* Add a hemisphere fill light (sky color from above, ground color from below). Unlike the flat
|
|
26
|
+
* ambient, this gives soft *direction-aware* fill, so downward- and side-facing surfaces never
|
|
27
|
+
* collapse to black when the HDR's lower hemisphere is dark. The single biggest lever for keeping
|
|
28
|
+
* results well-lit regardless of which HDR is loaded. Default false (opt-in) — enabling it shifts
|
|
29
|
+
* the look. See {@link LightingConfig.hemisphereIntensity}.
|
|
30
|
+
*/
|
|
31
|
+
enableHemisphereLight?: boolean;
|
|
32
|
+
/** Hemisphere fill sky color (lights upward-facing surfaces). Default white. */
|
|
33
|
+
hemisphereSkyColor?: THREE.Color | number;
|
|
34
|
+
/** Hemisphere fill ground color (lights downward-facing surfaces). Default a mid grey. */
|
|
35
|
+
hemisphereGroundColor?: THREE.Color | number;
|
|
36
|
+
/** Hemisphere fill strength. Default 0.6. Only applies when {@link LightingConfig.enableHemisphereLight}. */
|
|
37
|
+
hemisphereIntensity?: number;
|
|
24
38
|
};
|
|
25
39
|
type EnvironmentConfig = {
|
|
26
40
|
hdrPath?: string;
|
|
@@ -28,6 +42,13 @@ type EnvironmentConfig = {
|
|
|
28
42
|
enableEnvironmentLighting?: boolean;
|
|
29
43
|
sceneUp?: THREE.Vector3;
|
|
30
44
|
showEnvironment?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Uniform multiplier on the HDR's image-based lighting contribution (`scene.environmentIntensity`).
|
|
47
|
+
* Normalizes brightness across HDRs of differing exposure — raise it to lift a dim HDR, lower it to
|
|
48
|
+
* tame a blown-out one — so the scene doesn't render dim-or-blown purely because of the HDR chosen.
|
|
49
|
+
* Default 1 (three.js default, unchanged look).
|
|
50
|
+
*/
|
|
51
|
+
environmentIntensity?: number;
|
|
31
52
|
};
|
|
32
53
|
type FloorConfig = {
|
|
33
54
|
enabled?: boolean;
|
|
@@ -52,17 +73,29 @@ type RenderConfig = {
|
|
|
52
73
|
ambientOcclusion?: boolean;
|
|
53
74
|
/** AO strength 0–1 when {@link RenderConfig.ambientOcclusion} is on. Default 1. */
|
|
54
75
|
aoIntensity?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Device-pixel-ratio cap for the ambient-occlusion postprocessing buffers. AO is low-frequency, so
|
|
78
|
+
* rendering its buffers below the display DPR is nearly invisible but hugely cheaper — on a Retina
|
|
79
|
+
* display (DPR 2) full-resolution AO means 4× the pixels through GTAO's per-pixel sample loops,
|
|
80
|
+
* which can dominate frame time. Default 1 (AO buffers at 1× regardless of display DPR). Raise
|
|
81
|
+
* toward the display DPR for sharper AO at higher cost; only relevant when AO is enabled.
|
|
82
|
+
*/
|
|
83
|
+
aoPixelRatio?: number;
|
|
55
84
|
};
|
|
56
85
|
/**
|
|
57
|
-
* A
|
|
58
|
-
*
|
|
86
|
+
* A ready-to-go visual look. A `look` is a named bundle of LIGHTING/MATERIAL defaults only — it is
|
|
87
|
+
* deliberately decoupled from the CAD overlays (edges, grid), which are driven independently by
|
|
88
|
+
* {@link EdgesConfig}/{@link GridConfig}. Pick one and the viewer looks professional with zero other
|
|
89
|
+
* config; every individual `lighting`/`environment`/`render` option still overrides the preset. Seeds
|
|
90
|
+
* construction defaults and can be re-applied live via `setLook`.
|
|
59
91
|
*
|
|
60
|
-
* - 'technical': matte, drawing-like — neutral tone mapping, low IBL,
|
|
61
|
-
*
|
|
62
|
-
* - '
|
|
63
|
-
*
|
|
92
|
+
* - 'technical' (default): matte, drawing-like — neutral tone mapping, low IBL, no fill. Reads like a
|
|
93
|
+
* CAD shaded view (Rhino/Onshape).
|
|
94
|
+
* - 'studio': balanced presentation — ACES tone mapping, hemisphere fill + lifted HDR so results are
|
|
95
|
+
* well-lit regardless of the HDR, without washing colour out. The polished "product shot" look.
|
|
96
|
+
* - 'showcase': punchier presentation — ACES, stronger IBL/fill and a touch more exposure.
|
|
64
97
|
*/
|
|
65
|
-
type
|
|
98
|
+
type Look = 'studio' | 'technical' | 'showcase';
|
|
66
99
|
/** Crisp boundary/crease edge overlays on meshes. See `addEdges`. */
|
|
67
100
|
type EdgesConfig = {
|
|
68
101
|
/** Auto-attach edge overlays to meshes as they load. Default false (opt-in). */
|
|
@@ -133,12 +166,13 @@ type MeasureConfig = {
|
|
|
133
166
|
type ThreeInitializerOptions = {
|
|
134
167
|
sceneScale?: 'mm' | 'cm' | 'm' | 'inches' | 'feet';
|
|
135
168
|
/**
|
|
136
|
-
* Pick a
|
|
137
|
-
* IBL strength
|
|
138
|
-
* when set explicitly, so this only fills in what you
|
|
139
|
-
*
|
|
169
|
+
* Pick a ready-to-go visual look up front — seeds professional lighting/material defaults (tone
|
|
170
|
+
* mapping, AO, IBL strength, hemisphere fill; see {@link Look}). Individual `lighting`/
|
|
171
|
+
* `environment`/`render` options still win when set explicitly, so this only fills in what you
|
|
172
|
+
* leave unspecified. A look does NOT touch edges/grid (those are independent overlays). Defaults
|
|
173
|
+
* to 'technical'. Re-apply later via the init result's `setLook`.
|
|
140
174
|
*/
|
|
141
|
-
|
|
175
|
+
look?: Look;
|
|
142
176
|
camera?: CameraConfig;
|
|
143
177
|
lighting?: LightingConfig;
|
|
144
178
|
environment?: EnvironmentConfig;
|
|
@@ -210,12 +244,20 @@ interface CameraController {
|
|
|
210
244
|
* singularity.
|
|
211
245
|
*/
|
|
212
246
|
setViewDirection(direction: THREE.Vector3, animate?: boolean): void;
|
|
247
|
+
/**
|
|
248
|
+
* Frame an arbitrary world-space box (e.g. a double-clicked object) from the current view
|
|
249
|
+
* direction, moving the *active* camera — in 2D mode that means resizing the ortho frustum, not
|
|
250
|
+
* just translating. No-op on an empty box.
|
|
251
|
+
*/
|
|
252
|
+
frameBounds(box: THREE.Box3, animate?: boolean): void;
|
|
213
253
|
/** Enable/disable orbit rotation at runtime (pan/zoom unaffected). */
|
|
214
254
|
setRotateEnabled(enabled: boolean): void;
|
|
215
255
|
/** Whether rotation is currently enabled. */
|
|
216
256
|
isRotateEnabled(): boolean;
|
|
217
257
|
/** Keep the orthographic frustum aspect in sync on canvas resize. Called by the resize loop. */
|
|
218
258
|
updateAspect(width: number, height: number): void;
|
|
259
|
+
/** Cancel any in-flight camera tween. Call on viewer teardown so ticks can't touch disposed controls. */
|
|
260
|
+
dispose(): void;
|
|
219
261
|
}
|
|
220
262
|
interface CameraControllerDeps {
|
|
221
263
|
scene: THREE.Scene;
|
|
@@ -282,14 +324,24 @@ declare function createGrid(options?: GridOptions): Grid;
|
|
|
282
324
|
*
|
|
283
325
|
* Caller responsibilities (mirror ViewHelper's own contract):
|
|
284
326
|
* - call {@link ViewGizmo.render} *after* the main scene render each frame (overlay viewport),
|
|
285
|
-
* - call {@link ViewGizmo.update} each frame (no-op now; kept for API symmetry),
|
|
286
327
|
* - forward pointer clicks to {@link ViewGizmo.handleClick}.
|
|
287
328
|
*/
|
|
288
329
|
interface ViewGizmo {
|
|
289
330
|
render(renderer: THREE.WebGLRenderer): void;
|
|
331
|
+
/**
|
|
332
|
+
* @deprecated No-op, kept only for API stability. This wrapper never uses ViewHelper's
|
|
333
|
+
* click→animate path (see module comment) — view changes snap instantly through the camera
|
|
334
|
+
* controller — so there is never a gizmo animation to advance. Safe to stop calling.
|
|
335
|
+
*/
|
|
290
336
|
update(delta: number): void;
|
|
291
337
|
/** Hit-test a click. Returns true if it hit the gizmo (and a view change started). */
|
|
292
338
|
handleClick(event: MouseEvent): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* @deprecated Always `false`, kept only for API stability. Gizmo clicks snap the view
|
|
341
|
+
* instantly rather than animating (deliberately — ViewHelper's built-in animation assumes a
|
|
342
|
+
* Y-up world and rolls the view in this Z-up scene), so there is no animation window to gate
|
|
343
|
+
* input on.
|
|
344
|
+
*/
|
|
293
345
|
readonly isAnimating: boolean;
|
|
294
346
|
/** Show/hide the gizmo at runtime. Hidden = not rendered and not click-hittable. */
|
|
295
347
|
setVisible(visible: boolean): void;
|
|
@@ -392,6 +444,14 @@ interface MeasureDeps {
|
|
|
392
444
|
canvas: HTMLCanvasElement;
|
|
393
445
|
scene: THREE.Scene;
|
|
394
446
|
getActiveCamera: () => THREE.Camera;
|
|
447
|
+
/**
|
|
448
|
+
* The current orbit target (e.g. `controls.target`). Used to scale the line/point pick
|
|
449
|
+
* threshold with the view: the tolerance is a fraction of the camera→target distance, so it
|
|
450
|
+
* stays roughly constant on screen wherever the user has framed the model. Optional for
|
|
451
|
+
* backward compatibility — without it the perspective fallback is the camera's distance to the
|
|
452
|
+
* world origin, which misjudges the threshold for off-origin content. Thread it in when you can.
|
|
453
|
+
*/
|
|
454
|
+
getViewTarget?: () => THREE.Vector3;
|
|
395
455
|
labelLayer: LabelLayer;
|
|
396
456
|
options?: MeasureOptions;
|
|
397
457
|
}
|
|
@@ -435,13 +495,40 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
|
|
|
435
495
|
* edges). Retunes viewer-owned dials only; per-material parse choices are set via the batch
|
|
436
496
|
* parser's `material` option. Handy for comparing the two looks in a live viewer.
|
|
437
497
|
*/
|
|
438
|
-
setRenderStyle: (style: "technical" | "rendered") => void;
|
|
439
498
|
/**
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
499
|
+
* Switch the viewer to a ready-to-go look at runtime ('studio' | 'technical' | 'showcase'). Retunes
|
|
500
|
+
* lighting/material only (tone mapping, fill, IBL, AO) — never edges/grid. A straight preset apply:
|
|
501
|
+
* overwrites any granular lighting dials you set earlier.
|
|
502
|
+
*/
|
|
503
|
+
setLook: (look: "studio" | "technical" | "showcase") => void;
|
|
504
|
+
/**
|
|
505
|
+
* Retune the fill lights at runtime: the direction-aware hemisphere fill (sky/ground) and the flat
|
|
506
|
+
* ambient. Raising `hemisphereIntensity` is the most effective way to lift shadowed / under-facing
|
|
507
|
+
* surfaces a dark HDR leaves black. A positive `hemisphereIntensity` lazily creates the hemisphere
|
|
508
|
+
* light if the viewer was built without one; `0` switches it off.
|
|
443
509
|
*/
|
|
444
|
-
|
|
510
|
+
setFillLights: (opts: {
|
|
511
|
+
hemisphereIntensity?: number;
|
|
512
|
+
hemisphereSkyColor?: THREE.Color | number;
|
|
513
|
+
hemisphereGroundColor?: THREE.Color | number;
|
|
514
|
+
ambientIntensity?: number;
|
|
515
|
+
}) => void;
|
|
516
|
+
/**
|
|
517
|
+
* Set the uniform multiplier on the HDR's image-based lighting (`scene.environmentIntensity`) at
|
|
518
|
+
* runtime — normalizes brightness across HDRs of differing exposure so the scene isn't at the
|
|
519
|
+
* mercy of whichever HDR is loaded. Applies immediately, even before the HDR finishes decoding.
|
|
520
|
+
*/
|
|
521
|
+
setEnvironmentIntensity: (intensity: number) => void;
|
|
522
|
+
/** Set renderer tone-mapping exposure at runtime. Higher lifts shadows and overall brightness. */
|
|
523
|
+
setToneMappingExposure: (exposure: number) => void;
|
|
524
|
+
/** Set GTAO strength at runtime (0–1). No-op when ambient occlusion isn't active. */
|
|
525
|
+
setAoIntensity: (intensity: number) => void;
|
|
526
|
+
/**
|
|
527
|
+
* The parse-time material options (backface culling, IBL strength) matching the active look — feed
|
|
528
|
+
* into the batch parser's `material` option so freshly-loaded meshes are built to match it. See
|
|
529
|
+
* `setLook`.
|
|
530
|
+
*/
|
|
531
|
+
getMaterialAppearance: () => MaterialAppearanceOptions;
|
|
445
532
|
/**
|
|
446
533
|
* Refit the sun's shadow frustum to the current scene content for crisp shadows. Call after
|
|
447
534
|
* loading or replacing geometry (e.g. after `updateScene`). No-op when sunlight/shadows are off.
|
|
@@ -462,25 +549,9 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
|
|
|
462
549
|
clearUserGeometry: () => void;
|
|
463
550
|
};
|
|
464
551
|
|
|
465
|
-
/**
|
|
466
|
-
* Updates the scene with the given meshes and camera settings.
|
|
467
|
-
* If initialPositionSet is false, it positions the camera and sets the controls target based on the bounding boxes of the meshes.
|
|
468
|
-
* @param scene - The THREE.Scene object to update.
|
|
469
|
-
* @param meshes - An array of THREE.Mesh objects to add to the scene.
|
|
470
|
-
* @param camera - The THREE.PerspectiveCamera object to position.
|
|
471
|
-
* @param controls - The OrbitControls object to update.
|
|
472
|
-
* @param initialPositionSet - A boolean indicating whether the initial position of the camera and controls have been set.
|
|
473
|
-
*/
|
|
552
|
+
/** Updates scene with meshes and positions camera on first call. */
|
|
474
553
|
declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
|
|
475
|
-
/**
|
|
476
|
-
* Parses a color string in multiple formats to a THREE.Color object.
|
|
477
|
-
* Supported formats:
|
|
478
|
-
* - Hex: "#C7A5A5", "C7A5A5"
|
|
479
|
-
* - RGB: "199, 165, 165"
|
|
480
|
-
* - CSS named colors: "red", "blue", etc.
|
|
481
|
-
* @param colorString - The color string to parse.
|
|
482
|
-
* @returns A THREE.Color object.
|
|
483
|
-
*/
|
|
554
|
+
/** Parses color strings (hex, RGB, CSS names). */
|
|
484
555
|
declare function parseColor(colorString: string): THREE.Color;
|
|
485
556
|
/**
|
|
486
557
|
* Shift objects along one world axis. Defaults to `z` — the up axis of the unified Z-up scene
|
|
@@ -500,6 +571,8 @@ declare const PLASTIC_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
|
500
571
|
declare const GLASS_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
501
572
|
declare const RUBBER_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
502
573
|
declare const WOOD_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
574
|
+
/** Shared singleton materials; must not be disposed (rebuilds shaders, frees textures). */
|
|
575
|
+
declare const SHARED_MATERIALS: ReadonlySet<THREE.Material>;
|
|
503
576
|
|
|
504
577
|
declare const threeMaterials_CONCRETE_MATERIAL: typeof CONCRETE_MATERIAL;
|
|
505
578
|
declare const threeMaterials_EMISSIVE_MATERIAL: typeof EMISSIVE_MATERIAL;
|
|
@@ -507,9 +580,10 @@ declare const threeMaterials_GLASS_MATERIAL: typeof GLASS_MATERIAL;
|
|
|
507
580
|
declare const threeMaterials_METAL_MATERIAL: typeof METAL_MATERIAL;
|
|
508
581
|
declare const threeMaterials_PLASTIC_MATERIAL: typeof PLASTIC_MATERIAL;
|
|
509
582
|
declare const threeMaterials_RUBBER_MATERIAL: typeof RUBBER_MATERIAL;
|
|
583
|
+
declare const threeMaterials_SHARED_MATERIALS: typeof SHARED_MATERIALS;
|
|
510
584
|
declare const threeMaterials_WOOD_MATERIAL: typeof WOOD_MATERIAL;
|
|
511
585
|
declare namespace threeMaterials {
|
|
512
|
-
export { threeMaterials_CONCRETE_MATERIAL as CONCRETE_MATERIAL, threeMaterials_EMISSIVE_MATERIAL as EMISSIVE_MATERIAL, threeMaterials_GLASS_MATERIAL as GLASS_MATERIAL, threeMaterials_METAL_MATERIAL as METAL_MATERIAL, threeMaterials_PLASTIC_MATERIAL as PLASTIC_MATERIAL, threeMaterials_RUBBER_MATERIAL as RUBBER_MATERIAL, threeMaterials_WOOD_MATERIAL as WOOD_MATERIAL };
|
|
586
|
+
export { threeMaterials_CONCRETE_MATERIAL as CONCRETE_MATERIAL, threeMaterials_EMISSIVE_MATERIAL as EMISSIVE_MATERIAL, threeMaterials_GLASS_MATERIAL as GLASS_MATERIAL, threeMaterials_METAL_MATERIAL as METAL_MATERIAL, threeMaterials_PLASTIC_MATERIAL as PLASTIC_MATERIAL, threeMaterials_RUBBER_MATERIAL as RUBBER_MATERIAL, threeMaterials_SHARED_MATERIALS as SHARED_MATERIALS, threeMaterials_WOOD_MATERIAL as WOOD_MATERIAL };
|
|
513
587
|
}
|
|
514
588
|
|
|
515
589
|
/**
|
|
@@ -585,9 +659,21 @@ interface RenderPipelineOptions {
|
|
|
585
659
|
toneMappingExposure: number;
|
|
586
660
|
/** AO strength 0–1. Default 1. */
|
|
587
661
|
aoIntensity?: number;
|
|
662
|
+
/**
|
|
663
|
+
* Cap on the device-pixel-ratio used for the composer's (AO) buffers. AO is low-frequency, so
|
|
664
|
+
* rendering below the display DPR is nearly invisible but far cheaper. `setSize`'s incoming
|
|
665
|
+
* pixelRatio is clamped to this. Default 1.
|
|
666
|
+
*/
|
|
667
|
+
aoPixelRatio?: number;
|
|
588
668
|
}
|
|
589
669
|
declare function createRenderPipeline(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options: RenderPipelineOptions): RenderPipeline;
|
|
590
670
|
|
|
671
|
+
/**
|
|
672
|
+
* Metres per model unit, keyed by Rhino `UnitSystem` name (the `modelunits` string on the compute
|
|
673
|
+
* response). Imperial factors are the exact international definitions (1 in = 0.0254 m,
|
|
674
|
+
* 1 ft = 0.3048 m, 1 mi = 1609.344 m). Units not in this table scale 1 and log a one-time warning
|
|
675
|
+
* — see {@link getScaleFactor}.
|
|
676
|
+
*/
|
|
591
677
|
declare const SCALE_FACTORS: Record<string, number>;
|
|
592
678
|
/**
|
|
593
679
|
* Extracts and processes display meshes from a ComputePointerResponse using the Grasshopper WebDisplay component.
|
|
@@ -595,7 +681,9 @@ declare const SCALE_FACTORS: Record<string, number>;
|
|
|
595
681
|
* This is the primary entry point for extracting mesh geometry from Grasshopper compute responses.
|
|
596
682
|
* It handles all aspects of mesh processing: decompression, coordinate transformation, scaling, and positioning.
|
|
597
683
|
*
|
|
598
|
-
* **Note:**
|
|
684
|
+
* **Note:** The entire pipeline (base64 decode, inflate, dequantization, mesh construction) runs
|
|
685
|
+
* synchronously on the calling thread — large batches will block the UI for their duration. The
|
|
686
|
+
* function is `async` only so its shape can stay stable if parsing moves off-thread later.
|
|
599
687
|
*
|
|
600
688
|
* @param data - The ComputePointerResponse containing Grasshopper output trees.
|
|
601
689
|
* @param options - Configuration for mesh extraction and parsing behavior. All options are optional with sensible defaults.
|
|
@@ -606,7 +694,7 @@ declare const SCALE_FACTORS: Record<string, number>;
|
|
|
606
694
|
* - Only works with the WebDisplay component of GHHeadless.
|
|
607
695
|
* - Requires changes to Rhino.Compute (see https://github.com/TheVessen/compute.rhino3d).
|
|
608
696
|
* - Provides a performant way to display mesh data in Three.js.
|
|
609
|
-
* -
|
|
697
|
+
* - All decoding is synchronous on the main thread; there is no Web Worker offload today.
|
|
610
698
|
* - Supports mesh metadata (names, user data) if provided in the compute response.
|
|
611
699
|
*
|
|
612
700
|
* @internal Internal helper: high-level extraction remains public via visualization module, but this
|
|
@@ -635,11 +723,7 @@ declare const SCALE_FACTORS: Record<string, number>;
|
|
|
635
723
|
*/
|
|
636
724
|
declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Object3D[]>;
|
|
637
725
|
|
|
638
|
-
/**
|
|
639
|
-
* Internal-only telemetry threaded from an outer entry point (e.g. the JSON
|
|
640
|
-
* `parseMeshBatch` measuring its own `JSON.parse` cost) into the shared build
|
|
641
|
-
* step. Never part of any public options surface — callers don't supply timings.
|
|
642
|
-
*/
|
|
726
|
+
/** Internal telemetry only (not exposed in public options). */
|
|
643
727
|
interface ParseTelemetry {
|
|
644
728
|
parseTime?: number;
|
|
645
729
|
perfStart?: number;
|
|
@@ -651,9 +735,14 @@ interface ParseTelemetry {
|
|
|
651
735
|
* over the blob. The function stays `async` so callers don't have to change shape if we move
|
|
652
736
|
* parsing into a worker later.
|
|
653
737
|
*
|
|
738
|
+
* A batch with no `compressedData` (genuinely empty/absent geometry) resolves to `[]`. A corrupt,
|
|
739
|
+
* truncated, or unsupported blob throws so callers get a signal instead of a silent empty scene —
|
|
740
|
+
* `getThreeMeshesFromComputeResponse` documents (and now delivers) exactly that rethrow.
|
|
741
|
+
*
|
|
654
742
|
* @param batch - DisplayBatch object
|
|
655
743
|
* @param options - Rendering options
|
|
656
744
|
* @returns Promise resolving to array of Three.js mesh objects
|
|
745
|
+
* @throws {RhinoComputeError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
657
746
|
*/
|
|
658
747
|
declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions,
|
|
659
748
|
/** @internal Timings threaded from an outer entry point; not a caller option. */
|
|
@@ -669,13 +758,20 @@ telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
|
|
|
669
758
|
* @param blob - Raw blob bytes from a binary WebSocket frame.
|
|
670
759
|
* @param options - Rendering options.
|
|
671
760
|
* @returns Promise resolving to array of Three.js mesh objects.
|
|
761
|
+
* @throws {RhinoComputeError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
672
762
|
*/
|
|
673
763
|
declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: MeshBatchParsingOptions): Promise<THREE.Mesh[]>;
|
|
674
764
|
|
|
675
765
|
interface DisplayItemParseOptions {
|
|
676
766
|
/** rhino3dm instance for decoding curve JSON. Omit to skip curves (points still render). */
|
|
677
767
|
rhino?: RhinoModule;
|
|
678
|
-
/**
|
|
768
|
+
/**
|
|
769
|
+
* No-op. Historically toggled the Rhino Z-up → Three Y-up rotation, but the pipeline now keeps
|
|
770
|
+
* one coordinate frame end to end ({@link rhinoToThree} is the identity), so this flag no longer
|
|
771
|
+
* changes the result. Do NOT pre-rotate your own geometry to compensate — none is applied.
|
|
772
|
+
*
|
|
773
|
+
* @deprecated Retained only so existing call sites compile unchanged; has no effect.
|
|
774
|
+
*/
|
|
679
775
|
applyTransforms?: boolean;
|
|
680
776
|
}
|
|
681
777
|
/**
|