@selvajs/compute 3.1.0-beta.12 → 3.1.0-beta.13
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-44HGB4C4.cjs → chunk-6R4EL3ZJ.cjs} +2 -2
- package/dist/{chunk-44HGB4C4.cjs.map → chunk-6R4EL3ZJ.cjs.map} +1 -1
- package/dist/{chunk-3SEQKFGD.js → chunk-6TMSTNHN.js} +2 -2
- package/dist/chunk-GLOTP5TC.cjs +120 -0
- package/dist/chunk-GLOTP5TC.cjs.map +1 -0
- package/dist/chunk-NVMSD4CC.js +120 -0
- package/dist/chunk-NVMSD4CC.js.map +1 -0
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/visualization-BIHTM2KJ.js +2 -0
- package/dist/visualization-FLDYIZ3F.cjs +2 -0
- package/dist/visualization-FLDYIZ3F.cjs.map +1 -0
- package/dist/visualization.cjs +1 -1
- package/dist/visualization.cjs.map +1 -1
- package/dist/visualization.d.cts +158 -17
- package/dist/visualization.d.ts +158 -17
- package/dist/visualization.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-INP5HVA2.js +0 -62
- package/dist/chunk-INP5HVA2.js.map +0 -1
- package/dist/chunk-KTKY5M5S.cjs +0 -62
- package/dist/chunk-KTKY5M5S.cjs.map +0 -1
- package/dist/visualization-5RH6RSLV.js +0 -2
- package/dist/visualization-KRP5OPYW.cjs +0 -2
- package/dist/visualization-KRP5OPYW.cjs.map +0 -1
- /package/dist/{chunk-3SEQKFGD.js.map → chunk-6TMSTNHN.js.map} +0 -0
- /package/dist/{visualization-5RH6RSLV.js.map → visualization-BIHTM2KJ.js.map} +0 -0
package/dist/grasshopper.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 _chunk6R4EL3ZJcjs = require('./chunk-6R4EL3ZJ.cjs');var _chunkH3FZW6OXcjs = require('./chunk-H3FZW6OX.cjs');exports.GrasshopperClient = _chunk6R4EL3ZJcjs.g; exports.GrasshopperResponseProcessor = _chunk6R4EL3ZJcjs.h; exports.RhinoComputeError = _chunkH3FZW6OXcjs.d; exports.SolveScheduler = _chunk6R4EL3ZJcjs.f; exports.TreeBuilder = _chunk6R4EL3ZJcjs.m; exports.downloadFileData = _chunkH3FZW6OXcjs.v; exports.extractFilesFromComputeResponse = _chunkH3FZW6OXcjs.u; exports.fetchDefinitionIO = _chunk6R4EL3ZJcjs.k; exports.fetchParsedDefinitionIO = _chunk6R4EL3ZJcjs.l; exports.hashDefinition = _chunk6R4EL3ZJcjs.e; exports.hashSolveInput = _chunk6R4EL3ZJcjs.d; exports.isDefinitionRef = _chunk6R4EL3ZJcjs.a; exports.processInput = _chunk6R4EL3ZJcjs.i; exports.processInputs = _chunk6R4EL3ZJcjs.j; exports.solveGrasshopperDefinition = _chunk6R4EL3ZJcjs.b; exports.stableStringify = _chunk6R4EL3ZJcjs.c;
|
|
2
2
|
//# sourceMappingURL=grasshopper.cjs.map
|
package/dist/grasshopper.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p}from"./chunk-
|
|
1
|
+
import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p}from"./chunk-6TMSTNHN.js";import{d as a,u as b,v as c}from"./chunk-Y3M7P3BW.js";export{j as GrasshopperClient,k as GrasshopperResponseProcessor,a as RhinoComputeError,i as SolveScheduler,p as TreeBuilder,c as downloadFileData,b as extractFilesFromComputeResponse,n as fetchDefinitionIO,o as fetchParsedDefinitionIO,h as hashDefinition,g as hashSolveInput,d as isDefinitionRef,l as processInput,m as processInputs,e as solveGrasshopperDefinition,f as stableStringify};
|
|
2
2
|
//# sourceMappingURL=grasshopper.js.map
|
package/dist/index.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 _chunk6R4EL3ZJcjs = require('./chunk-6R4EL3ZJ.cjs');var _chunkH3FZW6OXcjs = require('./chunk-H3FZW6OX.cjs');exports.ComputeServerStats = _chunkH3FZW6OXcjs.p; exports.ErrorCodes = _chunkH3FZW6OXcjs.c; exports.GrasshopperClient = _chunk6R4EL3ZJcjs.g; exports.GrasshopperResponseProcessor = _chunk6R4EL3ZJcjs.h; exports.RhinoComputeError = _chunkH3FZW6OXcjs.d; exports.SolveScheduler = _chunk6R4EL3ZJcjs.f; exports.TreeBuilder = _chunk6R4EL3ZJcjs.m; exports.camelcaseKeys = _chunkH3FZW6OXcjs.r; exports.downloadFileData = _chunkH3FZW6OXcjs.v; exports.enableDebugLogging = _chunkH3FZW6OXcjs.g; exports.extractFilesFromComputeResponse = _chunkH3FZW6OXcjs.u; exports.fetchDefinitionIO = _chunk6R4EL3ZJcjs.k; exports.fetchParsedDefinitionIO = _chunk6R4EL3ZJcjs.l; exports.fetchRhinoCompute = _chunkH3FZW6OXcjs.n; exports.getLogger = _chunkH3FZW6OXcjs.e; exports.getResponseWireSize = _chunkH3FZW6OXcjs.m; exports.hashDefinition = _chunk6R4EL3ZJcjs.e; exports.hashSolveInput = _chunk6R4EL3ZJcjs.d; exports.isDefinitionRef = _chunk6R4EL3ZJcjs.a; exports.processInput = _chunk6R4EL3ZJcjs.i; exports.processInputs = _chunk6R4EL3ZJcjs.j; exports.setLogger = _chunkH3FZW6OXcjs.f; exports.setResponseWireSize = _chunkH3FZW6OXcjs.l; exports.solveGrasshopperDefinition = _chunk6R4EL3ZJcjs.b; exports.stableStringify = _chunk6R4EL3ZJcjs.c; exports.toCamelCase = _chunkH3FZW6OXcjs.q;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h,b as i,c as j,d as k,e as l,f as n,g as q,h as s,i as u,j as v,k as w,l as y,m as z}from"./chunk-
|
|
1
|
+
import{a as h,b as i,c as j,d as k,e as l,f as n,g as q,h as s,i as u,j as v,k as w,l as y,m as z}from"./chunk-6TMSTNHN.js";import{c as o,d as r,e,f,g as m,l as p,m as t,n as x,p as a,q as b,r as c,u as d,v as g}from"./chunk-Y3M7P3BW.js";export{a as ComputeServerStats,o as ErrorCodes,q as GrasshopperClient,s as GrasshopperResponseProcessor,r as RhinoComputeError,n as SolveScheduler,z as TreeBuilder,c as camelcaseKeys,g as downloadFileData,m as enableDebugLogging,d as extractFilesFromComputeResponse,w as fetchDefinitionIO,y as fetchParsedDefinitionIO,x as fetchRhinoCompute,e as getLogger,t as getResponseWireSize,l as hashDefinition,k as hashSolveInput,h as isDefinitionRef,u as processInput,v as processInputs,f as setLogger,p as setResponseWireSize,i as solveGrasshopperDefinition,j as stableStringify,b as toCamelCase};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{A as S,B as j,C as I,D as L,E as D,F as R,G,H as B,I as P,J as u,K as F,L as N,M as b,N as V,O as U,P as H,Q 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 E,p as d,q as C,r as x,s as h,t as M,u as _,v as A,w as c,x as O,y as g,z as T}from"./chunk-NVMSD4CC.js";import"./chunk-Y3M7P3BW.js";export{S as BINARY_MESH_MAGIC,I as BINARY_MESH_VERSION,j as COMPRESSED_MESH_MAGIC,m as EDGES_SKIPPED_TRIANGLE_CAP,n as EDGE_USERDATA_KIND,G as FLAG_DELTA_ENCODED,D as FLAG_FLOAT32,B as FLAG_HAS_UVS,P as FLAG_HAS_VERTEX_COLORS,R as FLAG_UINT16_INDICES,g as LOOKS,L as MIN_SUPPORTED_VERSION,e as Materials,H as SCALE_FACTORS,M as TEXTURE_CACHE_MAX_ENTRIES,F as UV_FORMAT_FLOAT32,u as UV_FORMAT_UINT16,f as addEdges,y as addEdgesAsync,t as applyOffset,A as clearTextureCache,a as computeCombinedBoundingBox,s as createCameraController,p as createGrid,C as createLabelLayer,h as createMeasureTool,d as createRenderPipeline,i as createViewGizmo,v as getThreeMeshesFromComputeResponse,O as initThree,l as isEdgeOverlay,c as materialAppearanceForLook,N as parseBinaryMeshBatch,o as parseColor,T as parseDisplayItems,b as parseMeshBatch,U as parseMeshBatchBlob,V as parseMeshBatchObject,E as removeEdges,_ as setTextureAnisotropy,x as snapToVertex,r as updateScene};
|
|
2
|
+
//# sourceMappingURL=visualization-BIHTM2KJ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGLOTP5TCcjs = require('./chunk-GLOTP5TC.cjs');require('./chunk-H3FZW6OX.cjs');exports.BINARY_MESH_MAGIC = _chunkGLOTP5TCcjs.A; exports.BINARY_MESH_VERSION = _chunkGLOTP5TCcjs.C; exports.COMPRESSED_MESH_MAGIC = _chunkGLOTP5TCcjs.B; exports.EDGES_SKIPPED_TRIANGLE_CAP = _chunkGLOTP5TCcjs.j; exports.EDGE_USERDATA_KIND = _chunkGLOTP5TCcjs.i; exports.FLAG_DELTA_ENCODED = _chunkGLOTP5TCcjs.G; exports.FLAG_FLOAT32 = _chunkGLOTP5TCcjs.E; exports.FLAG_HAS_UVS = _chunkGLOTP5TCcjs.H; exports.FLAG_HAS_VERTEX_COLORS = _chunkGLOTP5TCcjs.I; exports.FLAG_UINT16_INDICES = _chunkGLOTP5TCcjs.F; exports.LOOKS = _chunkGLOTP5TCcjs.y; exports.MIN_SUPPORTED_VERSION = _chunkGLOTP5TCcjs.D; exports.Materials = _chunkGLOTP5TCcjs.a; exports.SCALE_FACTORS = _chunkGLOTP5TCcjs.P; exports.TEXTURE_CACHE_MAX_ENTRIES = _chunkGLOTP5TCcjs.t; exports.UV_FORMAT_FLOAT32 = _chunkGLOTP5TCcjs.K; exports.UV_FORMAT_UINT16 = _chunkGLOTP5TCcjs.J; exports.addEdges = _chunkGLOTP5TCcjs.l; exports.addEdgesAsync = _chunkGLOTP5TCcjs.m; exports.applyOffset = _chunkGLOTP5TCcjs.d; exports.clearTextureCache = _chunkGLOTP5TCcjs.v; exports.computeCombinedBoundingBox = _chunkGLOTP5TCcjs.e; exports.createCameraController = _chunkGLOTP5TCcjs.f; exports.createGrid = _chunkGLOTP5TCcjs.g; exports.createLabelLayer = _chunkGLOTP5TCcjs.q; exports.createMeasureTool = _chunkGLOTP5TCcjs.s; exports.createRenderPipeline = _chunkGLOTP5TCcjs.p; exports.createViewGizmo = _chunkGLOTP5TCcjs.h; exports.getThreeMeshesFromComputeResponse = _chunkGLOTP5TCcjs.Q; exports.initThree = _chunkGLOTP5TCcjs.x; exports.isEdgeOverlay = _chunkGLOTP5TCcjs.k; exports.materialAppearanceForLook = _chunkGLOTP5TCcjs.w; exports.parseBinaryMeshBatch = _chunkGLOTP5TCcjs.L; exports.parseColor = _chunkGLOTP5TCcjs.c; exports.parseDisplayItems = _chunkGLOTP5TCcjs.z; exports.parseMeshBatch = _chunkGLOTP5TCcjs.M; exports.parseMeshBatchBlob = _chunkGLOTP5TCcjs.O; exports.parseMeshBatchObject = _chunkGLOTP5TCcjs.N; exports.removeEdges = _chunkGLOTP5TCcjs.n; exports.setTextureAnisotropy = _chunkGLOTP5TCcjs.u; exports.snapToVertex = _chunkGLOTP5TCcjs.r; exports.updateScene = _chunkGLOTP5TCcjs.b;
|
|
2
|
+
//# sourceMappingURL=visualization-FLDYIZ3F.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/visualization-FLDYIZ3F.cjs"],"names":[],"mappings":"AAAA,iIAAkU,gCAA6B,y/DAA87B","file":"/home/runner/work/selva/selva/packages/compute/dist/visualization-FLDYIZ3F.cjs"}
|
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 _chunkGLOTP5TCcjs = require('./chunk-GLOTP5TC.cjs');require('./chunk-H3FZW6OX.cjs');exports.EDGES_SKIPPED_TRIANGLE_CAP = _chunkGLOTP5TCcjs.j; exports.EDGE_USERDATA_KIND = _chunkGLOTP5TCcjs.i; exports.EdgeDetectionPass = _chunkGLOTP5TCcjs.o; exports.LOOKS = _chunkGLOTP5TCcjs.y; exports.Materials = _chunkGLOTP5TCcjs.a; exports.SCALE_FACTORS = _chunkGLOTP5TCcjs.P; exports.addEdges = _chunkGLOTP5TCcjs.l; exports.addEdgesAsync = _chunkGLOTP5TCcjs.m; exports.applyOffset = _chunkGLOTP5TCcjs.d; exports.computeCombinedBoundingBox = _chunkGLOTP5TCcjs.e; exports.createCameraController = _chunkGLOTP5TCcjs.f; exports.createGrid = _chunkGLOTP5TCcjs.g; exports.createLabelLayer = _chunkGLOTP5TCcjs.q; exports.createMeasureTool = _chunkGLOTP5TCcjs.s; exports.createRenderPipeline = _chunkGLOTP5TCcjs.p; exports.createViewGizmo = _chunkGLOTP5TCcjs.h; exports.getThreeMeshesFromComputeResponse = _chunkGLOTP5TCcjs.Q; exports.initThree = _chunkGLOTP5TCcjs.x; exports.isEdgeOverlay = _chunkGLOTP5TCcjs.k; exports.parseColor = _chunkGLOTP5TCcjs.c; exports.parseDisplayItems = _chunkGLOTP5TCcjs.z; exports.parseMeshBatchBlob = _chunkGLOTP5TCcjs.O; exports.parseMeshBatchObject = _chunkGLOTP5TCcjs.N; exports.removeEdges = _chunkGLOTP5TCcjs.n; exports.snapToVertex = _chunkGLOTP5TCcjs.r; exports.updateScene = _chunkGLOTP5TCcjs.b;
|
|
2
2
|
//# sourceMappingURL=visualization.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/visualization.cjs"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/visualization.cjs"],"names":[],"mappings":"AAAA,iIAAuN,gCAA6B,+sCAAojB","file":"/home/runner/work/selva/selva/packages/compute/dist/visualization.cjs"}
|
package/dist/visualization.d.cts
CHANGED
|
@@ -4,6 +4,7 @@ import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as M
|
|
|
4
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
|
+
import { Pass } from 'three/addons/postprocessing/Pass.js';
|
|
7
8
|
import { RhinoModule } from 'rhino3dm';
|
|
8
9
|
import './types-BGhtYxZ-.cjs';
|
|
9
10
|
|
|
@@ -88,6 +89,13 @@ type RenderConfig = {
|
|
|
88
89
|
* toward the display DPR for sharper AO at higher cost; only relevant when AO is enabled.
|
|
89
90
|
*/
|
|
90
91
|
aoPixelRatio?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Render only when something changed (camera motion, invalidate(), pointer input, resize), with
|
|
94
|
+
* a ~500 ms safety repaint, instead of every animation frame. Default true — cuts idle GPU/battery
|
|
95
|
+
* to ~2 fps worth of work, which matters especially with ambient occlusion on. Set false to
|
|
96
|
+
* restore the legacy continuous loop.
|
|
97
|
+
*/
|
|
98
|
+
onDemand?: boolean;
|
|
91
99
|
};
|
|
92
100
|
/**
|
|
93
101
|
* A ready-to-go visual look. A `look` is a named bundle of LIGHTING/MATERIAL defaults only — it is
|
|
@@ -130,6 +138,15 @@ type EdgesConfig = {
|
|
|
130
138
|
thresholdAngle?: number;
|
|
131
139
|
/** Fade an overlay out as its mesh shrinks on screen, so far zoom-outs stay clean. Default true. */
|
|
132
140
|
distanceFade?: boolean;
|
|
141
|
+
/** Skip overlay extraction for meshes above this triangle count. Default 4M. See `EdgeOptions`. */
|
|
142
|
+
maxTriangles?: number;
|
|
143
|
+
/** Overlays above this segment count render opaque (no distance fade). Default 2M. */
|
|
144
|
+
maxSegments?: number;
|
|
145
|
+
/**
|
|
146
|
+
* When a mesh is skipped for exceeding `maxTriangles`, approximate its edges with the
|
|
147
|
+
* screen-space edge-detection pass (constant cost in triangle count). Default true.
|
|
148
|
+
*/
|
|
149
|
+
screenSpaceFallback?: boolean;
|
|
133
150
|
};
|
|
134
151
|
type ControlsConfig = {
|
|
135
152
|
enableDamping?: boolean;
|
|
@@ -515,9 +532,24 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
|
|
|
515
532
|
measureTool: MeasureTool | null;
|
|
516
533
|
/**
|
|
517
534
|
* Attach edge overlays to the meshes under `root` (no-op unless `edges.enabled`). Call after
|
|
518
|
-
* loading meshes via `updateScene`, since meshes arrive after init.
|
|
535
|
+
* loading meshes via `updateScene`, since meshes arrive after init. Extraction for large meshes
|
|
536
|
+
* runs off-thread — their overlays attach a beat later; meshes over `edges.maxTriangles` are
|
|
537
|
+
* skipped and (by default) covered by the screen-space edge fallback instead.
|
|
519
538
|
*/
|
|
520
539
|
applyEdges: (root: THREE.Object3D) => void;
|
|
540
|
+
/**
|
|
541
|
+
* Remove edge overlays under `root` — the toggle-off counterpart of `applyEdges`. Prefer this
|
|
542
|
+
* over calling `removeEdges` directly: it also cancels in-flight async attaches' fallout and
|
|
543
|
+
* stands down the screen-space edge fallback if it was active.
|
|
544
|
+
*/
|
|
545
|
+
clearEdges: (root: THREE.Object3D) => void;
|
|
546
|
+
/**
|
|
547
|
+
* Request a repaint from the on-demand render loop. Camera motion, resizes, pointer input, and
|
|
548
|
+
* the built-in setters invalidate automatically; call this after mutating the scene externally
|
|
549
|
+
* (e.g. `updateScene`, adding user geometry) so the change shows immediately rather than on the
|
|
550
|
+
* next safety repaint. No-op (harmless) when `render.onDemand` is false.
|
|
551
|
+
*/
|
|
552
|
+
invalidate: () => void;
|
|
521
553
|
/** Toggle ambient occlusion at runtime — builds or tears down the postprocessing pipeline. */
|
|
522
554
|
setAmbientOcclusion: (enabled: boolean) => void;
|
|
523
555
|
/**
|
|
@@ -627,11 +659,23 @@ declare namespace threeMaterials {
|
|
|
627
659
|
* Crisp boundary/crease edges overlaid on meshes — the defining "technical drawing" look that makes
|
|
628
660
|
* shaded geometry read as discrete objects rather than blobs.
|
|
629
661
|
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
* `LineMaterial` family as curves
|
|
633
|
-
* of `THREE.LineSegments`. The overlay is added as a
|
|
634
|
-
* transform and is disposed when the mesh subtree
|
|
662
|
+
* Edge segments are extracted by `extractEdgeSegments` (see edge-extract.ts — an
|
|
663
|
+
* `EdgesGeometry`-equivalent that is ~an order of magnitude faster and worker-portable) and
|
|
664
|
+
* rendered as fat `LineSegments2` using the same `LineMaterial` family as curves — so edges get
|
|
665
|
+
* controllable thickness, not the 1px cap of `THREE.LineSegments`. The overlay is added as a
|
|
666
|
+
* *child* of each mesh, so it inherits the mesh's transform and is disposed when the mesh subtree
|
|
667
|
+
* is cleared.
|
|
668
|
+
*
|
|
669
|
+
* Performance model (docs/plans/4.edge-overlay-performance.md):
|
|
670
|
+
* - Extraction results are cached at two levels: per source `BufferGeometry` (object identity,
|
|
671
|
+
* helps instanced parts within one solve) and by *content fingerprint* in an LRU — the viewer
|
|
672
|
+
* rebuilds all geometry objects every solve, so only a content key survives re-solves.
|
|
673
|
+
* - {@link addEdgesAsync} runs extraction for large meshes in a Worker built from a blob URL
|
|
674
|
+
* (bundler-agnostic; falls back to inline extraction when Workers are unavailable), keeping the
|
|
675
|
+
* main thread free of the multi-second stalls extraction causes at millions of triangles.
|
|
676
|
+
* - Caps bound the pathological cases: meshes above `maxTriangles` are skipped outright (tagged
|
|
677
|
+
* `userData.edgesSkipped = 'triangle-cap'`), overlays above `maxSegments` lose the distance
|
|
678
|
+
* fade so they render in the cheaper opaque pass.
|
|
635
679
|
*
|
|
636
680
|
* Depth strategy: edges render at TRUE depth; the mesh's own surface is pushed back a hair with
|
|
637
681
|
* polygonOffset instead (see {@link setSurfaceDepthOffset}). Biasing the lines toward the camera —
|
|
@@ -667,34 +711,120 @@ interface EdgeOptions {
|
|
|
667
711
|
* covering only tens of pixels alias into dark noise; fading them keeps far zoom-outs clean.
|
|
668
712
|
*/
|
|
669
713
|
distanceFade?: boolean;
|
|
714
|
+
/**
|
|
715
|
+
* Skip meshes above this triangle count entirely (default 4M) — extraction time is linear in
|
|
716
|
+
* triangles, and past this bound even the worker path burns seconds for a look the screen-space
|
|
717
|
+
* fallback approximates at constant cost. Skipped meshes are tagged
|
|
718
|
+
* `userData.edgesSkipped = 'triangle-cap'` so hosts can react (e.g. enable the render-pipeline
|
|
719
|
+
* edge pass).
|
|
720
|
+
*/
|
|
721
|
+
maxTriangles?: number;
|
|
722
|
+
/**
|
|
723
|
+
* Above this many extracted segments (default 2M), an overlay drops the distance fade so it
|
|
724
|
+
* renders opaque — millions of blended fat-line quads are a fill-rate cliff; opaque ones aren't.
|
|
725
|
+
*/
|
|
726
|
+
maxSegments?: number;
|
|
670
727
|
}
|
|
671
728
|
/** Tag on edge overlays so pick/fit/clear logic can recognize and skip or dispose them. */
|
|
672
729
|
declare const EDGE_USERDATA_KIND = "edge-overlay";
|
|
730
|
+
/** `userData.edgesSkipped` value on meshes whose triangle count exceeded {@link EdgeOptions.maxTriangles}. */
|
|
731
|
+
declare const EDGES_SKIPPED_TRIANGLE_CAP = "triangle-cap";
|
|
732
|
+
/** Whether an object is an edge overlay (for pick/fit filters elsewhere). */
|
|
733
|
+
declare function isEdgeOverlay(object: THREE.Object3D): boolean;
|
|
673
734
|
/**
|
|
674
735
|
* Walk an object subtree and attach an edge overlay to every `Mesh` found, returning the created
|
|
675
736
|
* overlays (so callers can dispose them explicitly if they don't clear the whole subtree). Meshes
|
|
676
737
|
* that already carry an overlay are skipped, so this is safe to call more than once.
|
|
677
738
|
*
|
|
678
739
|
* Skips the floor and the grid (they're aids, not content) and anything already tagged as an edge.
|
|
740
|
+
*
|
|
741
|
+
* Fully synchronous — extraction for every mesh runs on the calling thread. Interactive hosts with
|
|
742
|
+
* potentially-large meshes should prefer {@link addEdgesAsync}, which offloads big extractions to
|
|
743
|
+
* a worker.
|
|
679
744
|
*/
|
|
680
745
|
declare function addEdges(root: THREE.Object3D, options?: EdgeOptions): LineSegments2[];
|
|
681
|
-
/**
|
|
682
|
-
|
|
746
|
+
/**
|
|
747
|
+
* Like {@link addEdges}, but extraction for large meshes runs in a Worker so the main thread never
|
|
748
|
+
* stalls. Small meshes (< ~25k triangles) still attach synchronously before this returns — only
|
|
749
|
+
* heavy extractions arrive a beat later. Resolves with every overlay actually attached.
|
|
750
|
+
*
|
|
751
|
+
* Late results are dropped (never attached) when the mesh has left the root's subtree (scene was
|
|
752
|
+
* cleared by a newer solve), the root's edges were removed via {@link removeEdges}, or another
|
|
753
|
+
* apply already attached an overlay to that mesh.
|
|
754
|
+
*/
|
|
755
|
+
declare function addEdgesAsync(root: THREE.Object3D, options?: EdgeOptions): Promise<LineSegments2[]>;
|
|
683
756
|
/**
|
|
684
757
|
* Remove every edge overlay under `root`, disposing its geometry and material. The inverse of
|
|
685
|
-
* {@link addEdges}; together they make edges a live on/off toggle
|
|
758
|
+
* {@link addEdges}/{@link addEdgesAsync}; together they make edges a live on/off toggle — this
|
|
759
|
+
* also cancels any in-flight async attaches for `root`. Returns how many were removed.
|
|
686
760
|
*/
|
|
687
761
|
declare function removeEdges(root: THREE.Object3D): number;
|
|
688
762
|
|
|
689
763
|
/**
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
764
|
+
* Screen-space edge detection: draws crease/silhouette lines by finding depth and normal
|
|
765
|
+
* discontinuities, as a fullscreen pass — cost is O(pixels), independent of triangle count.
|
|
766
|
+
*
|
|
767
|
+
* This is the fallback look for scenes too heavy for geometry edge overlays (see
|
|
768
|
+
* docs/plans/4.edge-overlay-performance.md Phase 3): meshes over `EdgeOptions.maxTriangles` skip
|
|
769
|
+
* extraction, and this pass approximates the technical-drawing read at constant cost. Trade-offs
|
|
770
|
+
* vs geometry edges: uniform pixel width, one global color (no per-object tinting), view-dependent
|
|
771
|
+
* response, and gentle creases below the normal threshold don't register.
|
|
693
772
|
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* the
|
|
773
|
+
* Works like GTAOPass internally: the scene is re-rendered with a `MeshNormalMaterial` override
|
|
774
|
+
* into a normal target carrying a depth texture (a pattern this scene already tolerates for AO),
|
|
775
|
+
* then a fullscreen shader Roberts-crosses depth (relative view-Z difference, so far scenes don't
|
|
776
|
+
* dissolve into noise) and normals, and blends the edge color over the composed image.
|
|
777
|
+
*
|
|
778
|
+
* The render target is allocated lazily on first enabled render, so constructing the pass
|
|
779
|
+
* disabled costs nothing but the material.
|
|
780
|
+
*/
|
|
781
|
+
interface EdgeDetectionOptions {
|
|
782
|
+
/** Edge line color. Default 0x222222 — matches the geometry overlays' default. */
|
|
783
|
+
color?: THREE.ColorRepresentation;
|
|
784
|
+
/** Edge blend strength 0–1. Default 1. */
|
|
785
|
+
opacity?: number;
|
|
786
|
+
/**
|
|
787
|
+
* Normal discontinuity threshold, in summed `1 - dot(n₁, n₂)` across the two diagonal pairs.
|
|
788
|
+
* Lower catches gentler creases. Default 0.4 (≈ the 44° crease default of geometry edges).
|
|
789
|
+
*/
|
|
790
|
+
normalThreshold?: number;
|
|
791
|
+
/** Relative view-depth discontinuity threshold. Default 0.02 (2% of the center depth). */
|
|
792
|
+
depthThreshold?: number;
|
|
793
|
+
/** Sample offset in device px — line thickness. Default 1. */
|
|
794
|
+
thickness?: number;
|
|
795
|
+
}
|
|
796
|
+
declare class EdgeDetectionPass extends Pass {
|
|
797
|
+
camera: THREE.Camera;
|
|
798
|
+
private readonly scene;
|
|
799
|
+
private readonly normalMaterial;
|
|
800
|
+
private readonly edgeMaterial;
|
|
801
|
+
private readonly fsQuad;
|
|
802
|
+
private normalTarget;
|
|
803
|
+
private width;
|
|
804
|
+
private height;
|
|
805
|
+
constructor(scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options?: EdgeDetectionOptions);
|
|
806
|
+
private acquireNormalTarget;
|
|
807
|
+
setSize(width: number, height: number): void;
|
|
808
|
+
render(renderer: THREE.WebGLRenderer, writeBuffer: THREE.WebGLRenderTarget, readBuffer: THREE.WebGLRenderTarget): void;
|
|
809
|
+
dispose(): void;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Optional postprocessing pipeline. Default-OFF: the viewer only constructs this when a
|
|
814
|
+
* postprocessed feature (ambient occlusion, screen-space edges) is enabled, and otherwise renders
|
|
815
|
+
* with a plain `renderer.render` so the cheap path stays cheap (the chosen tradeoff — see
|
|
816
|
+
* cad-viewer-plan.md).
|
|
817
|
+
*
|
|
818
|
+
* Pipeline: RenderPass → GTAOPass? → EdgeDetectionPass? → SMAAPass → OutputPass. GTAO
|
|
819
|
+
* (ground-truth AO) is the modern replacement for SSAO/SAO — better contact shadows in crevices,
|
|
820
|
+
* the "engineered" depth cue. `screenSpaceRadius` is on so the AO radius is in screen space, which
|
|
821
|
+
* keeps it scale-robust across the viewer's mm→m scenes without per-scene tuning.
|
|
822
|
+
*
|
|
823
|
+
* EdgeDetectionPass draws crease/silhouette lines in screen space at O(pixels) — the fallback for
|
|
824
|
+
* scenes too triangle-heavy for geometry edge overlays (docs/plans/4.edge-overlay-performance.md).
|
|
825
|
+
* It sits before SMAA so its 1px lines get antialiased. Always constructed (its render target is
|
|
826
|
+
* lazy), so it can be toggled at runtime via {@link RenderPipeline.setEdgeDetection} without a
|
|
827
|
+
* pipeline rebuild.
|
|
698
828
|
*
|
|
699
829
|
* SMAA restores antialiasing on this path. The EffectComposer renders into an offscreen target, so
|
|
700
830
|
* the WebGLRenderer's own MSAA (`antialias: true`) does nothing here — without a dedicated AA pass,
|
|
@@ -712,12 +842,18 @@ interface RenderPipeline {
|
|
|
712
842
|
setSize(width: number, height: number, pixelRatio: number): void;
|
|
713
843
|
/** Point the passes at the currently active camera (call when projection changes). */
|
|
714
844
|
setCamera(camera: THREE.Camera): void;
|
|
845
|
+
/** Toggle the screen-space edge pass at runtime (no pipeline rebuild). */
|
|
846
|
+
setEdgeDetection(enabled: boolean): void;
|
|
847
|
+
/** Whether the screen-space edge pass currently runs. */
|
|
848
|
+
edgeDetectionEnabled(): boolean;
|
|
715
849
|
dispose(): void;
|
|
716
850
|
}
|
|
717
851
|
interface RenderPipelineOptions {
|
|
718
852
|
/** Tone mapping to apply in OutputPass (mirror the renderer's). */
|
|
719
853
|
toneMapping: THREE.ToneMapping;
|
|
720
854
|
toneMappingExposure: number;
|
|
855
|
+
/** Build the pipeline with the GTAO ambient-occlusion pass. Default true. */
|
|
856
|
+
ambientOcclusion?: boolean;
|
|
721
857
|
/** AO strength 0–1. Default 1. */
|
|
722
858
|
aoIntensity?: number;
|
|
723
859
|
/**
|
|
@@ -726,6 +862,11 @@ interface RenderPipelineOptions {
|
|
|
726
862
|
* pixelRatio is clamped to this. Default 1.
|
|
727
863
|
*/
|
|
728
864
|
aoPixelRatio?: number;
|
|
865
|
+
/**
|
|
866
|
+
* Start with the screen-space edge pass enabled; pass an object to tune it. The pass itself is
|
|
867
|
+
* always constructed (cheap while disabled) so it can be toggled later via `setEdgeDetection`.
|
|
868
|
+
*/
|
|
869
|
+
edgeDetection?: boolean | EdgeDetectionOptions;
|
|
729
870
|
}
|
|
730
871
|
declare function createRenderPipeline(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options: RenderPipelineOptions): RenderPipeline;
|
|
731
872
|
|
|
@@ -842,4 +983,4 @@ interface DisplayItemParseOptions {
|
|
|
842
983
|
*/
|
|
843
984
|
declare function parseDisplayItems(items: DisplayItem[] | undefined, options?: DisplayItemParseOptions): THREE.Object3D[];
|
|
844
985
|
|
|
845
|
-
export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGE_USERDATA_KIND, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type ViewGizmo, type ViewPreset, addEdges, applyOffset, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, updateScene };
|
|
986
|
+
export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGES_SKIPPED_TRIANGLE_CAP, EDGE_USERDATA_KIND, type EdgeDetectionOptions, EdgeDetectionPass, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type ViewGizmo, type ViewPreset, addEdges, addEdgesAsync, applyOffset, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, updateScene };
|
package/dist/visualization.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as M
|
|
|
4
4
|
export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-Dtok-mVq.js';
|
|
5
5
|
import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';
|
|
6
6
|
import { LineSegments2 } from 'three/addons/lines/LineSegments2.js';
|
|
7
|
+
import { Pass } from 'three/addons/postprocessing/Pass.js';
|
|
7
8
|
import { RhinoModule } from 'rhino3dm';
|
|
8
9
|
import './types-BGhtYxZ-.js';
|
|
9
10
|
|
|
@@ -88,6 +89,13 @@ type RenderConfig = {
|
|
|
88
89
|
* toward the display DPR for sharper AO at higher cost; only relevant when AO is enabled.
|
|
89
90
|
*/
|
|
90
91
|
aoPixelRatio?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Render only when something changed (camera motion, invalidate(), pointer input, resize), with
|
|
94
|
+
* a ~500 ms safety repaint, instead of every animation frame. Default true — cuts idle GPU/battery
|
|
95
|
+
* to ~2 fps worth of work, which matters especially with ambient occlusion on. Set false to
|
|
96
|
+
* restore the legacy continuous loop.
|
|
97
|
+
*/
|
|
98
|
+
onDemand?: boolean;
|
|
91
99
|
};
|
|
92
100
|
/**
|
|
93
101
|
* A ready-to-go visual look. A `look` is a named bundle of LIGHTING/MATERIAL defaults only — it is
|
|
@@ -130,6 +138,15 @@ type EdgesConfig = {
|
|
|
130
138
|
thresholdAngle?: number;
|
|
131
139
|
/** Fade an overlay out as its mesh shrinks on screen, so far zoom-outs stay clean. Default true. */
|
|
132
140
|
distanceFade?: boolean;
|
|
141
|
+
/** Skip overlay extraction for meshes above this triangle count. Default 4M. See `EdgeOptions`. */
|
|
142
|
+
maxTriangles?: number;
|
|
143
|
+
/** Overlays above this segment count render opaque (no distance fade). Default 2M. */
|
|
144
|
+
maxSegments?: number;
|
|
145
|
+
/**
|
|
146
|
+
* When a mesh is skipped for exceeding `maxTriangles`, approximate its edges with the
|
|
147
|
+
* screen-space edge-detection pass (constant cost in triangle count). Default true.
|
|
148
|
+
*/
|
|
149
|
+
screenSpaceFallback?: boolean;
|
|
133
150
|
};
|
|
134
151
|
type ControlsConfig = {
|
|
135
152
|
enableDamping?: boolean;
|
|
@@ -515,9 +532,24 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
|
|
|
515
532
|
measureTool: MeasureTool | null;
|
|
516
533
|
/**
|
|
517
534
|
* Attach edge overlays to the meshes under `root` (no-op unless `edges.enabled`). Call after
|
|
518
|
-
* loading meshes via `updateScene`, since meshes arrive after init.
|
|
535
|
+
* loading meshes via `updateScene`, since meshes arrive after init. Extraction for large meshes
|
|
536
|
+
* runs off-thread — their overlays attach a beat later; meshes over `edges.maxTriangles` are
|
|
537
|
+
* skipped and (by default) covered by the screen-space edge fallback instead.
|
|
519
538
|
*/
|
|
520
539
|
applyEdges: (root: THREE.Object3D) => void;
|
|
540
|
+
/**
|
|
541
|
+
* Remove edge overlays under `root` — the toggle-off counterpart of `applyEdges`. Prefer this
|
|
542
|
+
* over calling `removeEdges` directly: it also cancels in-flight async attaches' fallout and
|
|
543
|
+
* stands down the screen-space edge fallback if it was active.
|
|
544
|
+
*/
|
|
545
|
+
clearEdges: (root: THREE.Object3D) => void;
|
|
546
|
+
/**
|
|
547
|
+
* Request a repaint from the on-demand render loop. Camera motion, resizes, pointer input, and
|
|
548
|
+
* the built-in setters invalidate automatically; call this after mutating the scene externally
|
|
549
|
+
* (e.g. `updateScene`, adding user geometry) so the change shows immediately rather than on the
|
|
550
|
+
* next safety repaint. No-op (harmless) when `render.onDemand` is false.
|
|
551
|
+
*/
|
|
552
|
+
invalidate: () => void;
|
|
521
553
|
/** Toggle ambient occlusion at runtime — builds or tears down the postprocessing pipeline. */
|
|
522
554
|
setAmbientOcclusion: (enabled: boolean) => void;
|
|
523
555
|
/**
|
|
@@ -627,11 +659,23 @@ declare namespace threeMaterials {
|
|
|
627
659
|
* Crisp boundary/crease edges overlaid on meshes — the defining "technical drawing" look that makes
|
|
628
660
|
* shaded geometry read as discrete objects rather than blobs.
|
|
629
661
|
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
* `LineMaterial` family as curves
|
|
633
|
-
* of `THREE.LineSegments`. The overlay is added as a
|
|
634
|
-
* transform and is disposed when the mesh subtree
|
|
662
|
+
* Edge segments are extracted by `extractEdgeSegments` (see edge-extract.ts — an
|
|
663
|
+
* `EdgesGeometry`-equivalent that is ~an order of magnitude faster and worker-portable) and
|
|
664
|
+
* rendered as fat `LineSegments2` using the same `LineMaterial` family as curves — so edges get
|
|
665
|
+
* controllable thickness, not the 1px cap of `THREE.LineSegments`. The overlay is added as a
|
|
666
|
+
* *child* of each mesh, so it inherits the mesh's transform and is disposed when the mesh subtree
|
|
667
|
+
* is cleared.
|
|
668
|
+
*
|
|
669
|
+
* Performance model (docs/plans/4.edge-overlay-performance.md):
|
|
670
|
+
* - Extraction results are cached at two levels: per source `BufferGeometry` (object identity,
|
|
671
|
+
* helps instanced parts within one solve) and by *content fingerprint* in an LRU — the viewer
|
|
672
|
+
* rebuilds all geometry objects every solve, so only a content key survives re-solves.
|
|
673
|
+
* - {@link addEdgesAsync} runs extraction for large meshes in a Worker built from a blob URL
|
|
674
|
+
* (bundler-agnostic; falls back to inline extraction when Workers are unavailable), keeping the
|
|
675
|
+
* main thread free of the multi-second stalls extraction causes at millions of triangles.
|
|
676
|
+
* - Caps bound the pathological cases: meshes above `maxTriangles` are skipped outright (tagged
|
|
677
|
+
* `userData.edgesSkipped = 'triangle-cap'`), overlays above `maxSegments` lose the distance
|
|
678
|
+
* fade so they render in the cheaper opaque pass.
|
|
635
679
|
*
|
|
636
680
|
* Depth strategy: edges render at TRUE depth; the mesh's own surface is pushed back a hair with
|
|
637
681
|
* polygonOffset instead (see {@link setSurfaceDepthOffset}). Biasing the lines toward the camera —
|
|
@@ -667,34 +711,120 @@ interface EdgeOptions {
|
|
|
667
711
|
* covering only tens of pixels alias into dark noise; fading them keeps far zoom-outs clean.
|
|
668
712
|
*/
|
|
669
713
|
distanceFade?: boolean;
|
|
714
|
+
/**
|
|
715
|
+
* Skip meshes above this triangle count entirely (default 4M) — extraction time is linear in
|
|
716
|
+
* triangles, and past this bound even the worker path burns seconds for a look the screen-space
|
|
717
|
+
* fallback approximates at constant cost. Skipped meshes are tagged
|
|
718
|
+
* `userData.edgesSkipped = 'triangle-cap'` so hosts can react (e.g. enable the render-pipeline
|
|
719
|
+
* edge pass).
|
|
720
|
+
*/
|
|
721
|
+
maxTriangles?: number;
|
|
722
|
+
/**
|
|
723
|
+
* Above this many extracted segments (default 2M), an overlay drops the distance fade so it
|
|
724
|
+
* renders opaque — millions of blended fat-line quads are a fill-rate cliff; opaque ones aren't.
|
|
725
|
+
*/
|
|
726
|
+
maxSegments?: number;
|
|
670
727
|
}
|
|
671
728
|
/** Tag on edge overlays so pick/fit/clear logic can recognize and skip or dispose them. */
|
|
672
729
|
declare const EDGE_USERDATA_KIND = "edge-overlay";
|
|
730
|
+
/** `userData.edgesSkipped` value on meshes whose triangle count exceeded {@link EdgeOptions.maxTriangles}. */
|
|
731
|
+
declare const EDGES_SKIPPED_TRIANGLE_CAP = "triangle-cap";
|
|
732
|
+
/** Whether an object is an edge overlay (for pick/fit filters elsewhere). */
|
|
733
|
+
declare function isEdgeOverlay(object: THREE.Object3D): boolean;
|
|
673
734
|
/**
|
|
674
735
|
* Walk an object subtree and attach an edge overlay to every `Mesh` found, returning the created
|
|
675
736
|
* overlays (so callers can dispose them explicitly if they don't clear the whole subtree). Meshes
|
|
676
737
|
* that already carry an overlay are skipped, so this is safe to call more than once.
|
|
677
738
|
*
|
|
678
739
|
* Skips the floor and the grid (they're aids, not content) and anything already tagged as an edge.
|
|
740
|
+
*
|
|
741
|
+
* Fully synchronous — extraction for every mesh runs on the calling thread. Interactive hosts with
|
|
742
|
+
* potentially-large meshes should prefer {@link addEdgesAsync}, which offloads big extractions to
|
|
743
|
+
* a worker.
|
|
679
744
|
*/
|
|
680
745
|
declare function addEdges(root: THREE.Object3D, options?: EdgeOptions): LineSegments2[];
|
|
681
|
-
/**
|
|
682
|
-
|
|
746
|
+
/**
|
|
747
|
+
* Like {@link addEdges}, but extraction for large meshes runs in a Worker so the main thread never
|
|
748
|
+
* stalls. Small meshes (< ~25k triangles) still attach synchronously before this returns — only
|
|
749
|
+
* heavy extractions arrive a beat later. Resolves with every overlay actually attached.
|
|
750
|
+
*
|
|
751
|
+
* Late results are dropped (never attached) when the mesh has left the root's subtree (scene was
|
|
752
|
+
* cleared by a newer solve), the root's edges were removed via {@link removeEdges}, or another
|
|
753
|
+
* apply already attached an overlay to that mesh.
|
|
754
|
+
*/
|
|
755
|
+
declare function addEdgesAsync(root: THREE.Object3D, options?: EdgeOptions): Promise<LineSegments2[]>;
|
|
683
756
|
/**
|
|
684
757
|
* Remove every edge overlay under `root`, disposing its geometry and material. The inverse of
|
|
685
|
-
* {@link addEdges}; together they make edges a live on/off toggle
|
|
758
|
+
* {@link addEdges}/{@link addEdgesAsync}; together they make edges a live on/off toggle — this
|
|
759
|
+
* also cancels any in-flight async attaches for `root`. Returns how many were removed.
|
|
686
760
|
*/
|
|
687
761
|
declare function removeEdges(root: THREE.Object3D): number;
|
|
688
762
|
|
|
689
763
|
/**
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
764
|
+
* Screen-space edge detection: draws crease/silhouette lines by finding depth and normal
|
|
765
|
+
* discontinuities, as a fullscreen pass — cost is O(pixels), independent of triangle count.
|
|
766
|
+
*
|
|
767
|
+
* This is the fallback look for scenes too heavy for geometry edge overlays (see
|
|
768
|
+
* docs/plans/4.edge-overlay-performance.md Phase 3): meshes over `EdgeOptions.maxTriangles` skip
|
|
769
|
+
* extraction, and this pass approximates the technical-drawing read at constant cost. Trade-offs
|
|
770
|
+
* vs geometry edges: uniform pixel width, one global color (no per-object tinting), view-dependent
|
|
771
|
+
* response, and gentle creases below the normal threshold don't register.
|
|
693
772
|
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* the
|
|
773
|
+
* Works like GTAOPass internally: the scene is re-rendered with a `MeshNormalMaterial` override
|
|
774
|
+
* into a normal target carrying a depth texture (a pattern this scene already tolerates for AO),
|
|
775
|
+
* then a fullscreen shader Roberts-crosses depth (relative view-Z difference, so far scenes don't
|
|
776
|
+
* dissolve into noise) and normals, and blends the edge color over the composed image.
|
|
777
|
+
*
|
|
778
|
+
* The render target is allocated lazily on first enabled render, so constructing the pass
|
|
779
|
+
* disabled costs nothing but the material.
|
|
780
|
+
*/
|
|
781
|
+
interface EdgeDetectionOptions {
|
|
782
|
+
/** Edge line color. Default 0x222222 — matches the geometry overlays' default. */
|
|
783
|
+
color?: THREE.ColorRepresentation;
|
|
784
|
+
/** Edge blend strength 0–1. Default 1. */
|
|
785
|
+
opacity?: number;
|
|
786
|
+
/**
|
|
787
|
+
* Normal discontinuity threshold, in summed `1 - dot(n₁, n₂)` across the two diagonal pairs.
|
|
788
|
+
* Lower catches gentler creases. Default 0.4 (≈ the 44° crease default of geometry edges).
|
|
789
|
+
*/
|
|
790
|
+
normalThreshold?: number;
|
|
791
|
+
/** Relative view-depth discontinuity threshold. Default 0.02 (2% of the center depth). */
|
|
792
|
+
depthThreshold?: number;
|
|
793
|
+
/** Sample offset in device px — line thickness. Default 1. */
|
|
794
|
+
thickness?: number;
|
|
795
|
+
}
|
|
796
|
+
declare class EdgeDetectionPass extends Pass {
|
|
797
|
+
camera: THREE.Camera;
|
|
798
|
+
private readonly scene;
|
|
799
|
+
private readonly normalMaterial;
|
|
800
|
+
private readonly edgeMaterial;
|
|
801
|
+
private readonly fsQuad;
|
|
802
|
+
private normalTarget;
|
|
803
|
+
private width;
|
|
804
|
+
private height;
|
|
805
|
+
constructor(scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options?: EdgeDetectionOptions);
|
|
806
|
+
private acquireNormalTarget;
|
|
807
|
+
setSize(width: number, height: number): void;
|
|
808
|
+
render(renderer: THREE.WebGLRenderer, writeBuffer: THREE.WebGLRenderTarget, readBuffer: THREE.WebGLRenderTarget): void;
|
|
809
|
+
dispose(): void;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Optional postprocessing pipeline. Default-OFF: the viewer only constructs this when a
|
|
814
|
+
* postprocessed feature (ambient occlusion, screen-space edges) is enabled, and otherwise renders
|
|
815
|
+
* with a plain `renderer.render` so the cheap path stays cheap (the chosen tradeoff — see
|
|
816
|
+
* cad-viewer-plan.md).
|
|
817
|
+
*
|
|
818
|
+
* Pipeline: RenderPass → GTAOPass? → EdgeDetectionPass? → SMAAPass → OutputPass. GTAO
|
|
819
|
+
* (ground-truth AO) is the modern replacement for SSAO/SAO — better contact shadows in crevices,
|
|
820
|
+
* the "engineered" depth cue. `screenSpaceRadius` is on so the AO radius is in screen space, which
|
|
821
|
+
* keeps it scale-robust across the viewer's mm→m scenes without per-scene tuning.
|
|
822
|
+
*
|
|
823
|
+
* EdgeDetectionPass draws crease/silhouette lines in screen space at O(pixels) — the fallback for
|
|
824
|
+
* scenes too triangle-heavy for geometry edge overlays (docs/plans/4.edge-overlay-performance.md).
|
|
825
|
+
* It sits before SMAA so its 1px lines get antialiased. Always constructed (its render target is
|
|
826
|
+
* lazy), so it can be toggled at runtime via {@link RenderPipeline.setEdgeDetection} without a
|
|
827
|
+
* pipeline rebuild.
|
|
698
828
|
*
|
|
699
829
|
* SMAA restores antialiasing on this path. The EffectComposer renders into an offscreen target, so
|
|
700
830
|
* the WebGLRenderer's own MSAA (`antialias: true`) does nothing here — without a dedicated AA pass,
|
|
@@ -712,12 +842,18 @@ interface RenderPipeline {
|
|
|
712
842
|
setSize(width: number, height: number, pixelRatio: number): void;
|
|
713
843
|
/** Point the passes at the currently active camera (call when projection changes). */
|
|
714
844
|
setCamera(camera: THREE.Camera): void;
|
|
845
|
+
/** Toggle the screen-space edge pass at runtime (no pipeline rebuild). */
|
|
846
|
+
setEdgeDetection(enabled: boolean): void;
|
|
847
|
+
/** Whether the screen-space edge pass currently runs. */
|
|
848
|
+
edgeDetectionEnabled(): boolean;
|
|
715
849
|
dispose(): void;
|
|
716
850
|
}
|
|
717
851
|
interface RenderPipelineOptions {
|
|
718
852
|
/** Tone mapping to apply in OutputPass (mirror the renderer's). */
|
|
719
853
|
toneMapping: THREE.ToneMapping;
|
|
720
854
|
toneMappingExposure: number;
|
|
855
|
+
/** Build the pipeline with the GTAO ambient-occlusion pass. Default true. */
|
|
856
|
+
ambientOcclusion?: boolean;
|
|
721
857
|
/** AO strength 0–1. Default 1. */
|
|
722
858
|
aoIntensity?: number;
|
|
723
859
|
/**
|
|
@@ -726,6 +862,11 @@ interface RenderPipelineOptions {
|
|
|
726
862
|
* pixelRatio is clamped to this. Default 1.
|
|
727
863
|
*/
|
|
728
864
|
aoPixelRatio?: number;
|
|
865
|
+
/**
|
|
866
|
+
* Start with the screen-space edge pass enabled; pass an object to tune it. The pass itself is
|
|
867
|
+
* always constructed (cheap while disabled) so it can be toggled later via `setEdgeDetection`.
|
|
868
|
+
*/
|
|
869
|
+
edgeDetection?: boolean | EdgeDetectionOptions;
|
|
729
870
|
}
|
|
730
871
|
declare function createRenderPipeline(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options: RenderPipelineOptions): RenderPipeline;
|
|
731
872
|
|
|
@@ -842,4 +983,4 @@ interface DisplayItemParseOptions {
|
|
|
842
983
|
*/
|
|
843
984
|
declare function parseDisplayItems(items: DisplayItem[] | undefined, options?: DisplayItemParseOptions): THREE.Object3D[];
|
|
844
985
|
|
|
845
|
-
export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGE_USERDATA_KIND, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type ViewGizmo, type ViewPreset, addEdges, applyOffset, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, updateScene };
|
|
986
|
+
export { type CameraConfig, type CameraController, type CameraProjection, type ControlsConfig, DisplayBatch, DisplayItem, type DisplayItemParseOptions, EDGES_SKIPPED_TRIANGLE_CAP, EDGE_USERDATA_KIND, type EdgeDetectionOptions, EdgeDetectionPass, type EdgeOptions, type EdgesConfig, type EnvironmentConfig, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, type GridOptions, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Look, threeMaterials as Materials, type MeasureConfig, type MeasureOptions, type MeasureTool, MeshExtractionOptions, type RenderConfig, type RenderPipeline, type RenderPipelineOptions, SCALE_FACTORS, type ThreeInitializerOptions, type ViewGizmo, type ViewPreset, addEdges, addEdgesAsync, applyOffset, computeCombinedBoundingBox, createCameraController, createGrid, createLabelLayer, createMeasureTool, createRenderPipeline, createViewGizmo, getThreeMeshesFromComputeResponse, initThree, isEdgeOverlay, parseColor, parseDisplayItems, parseMeshBatchBlob, parseMeshBatchObject, removeEdges, snapToVertex, updateScene };
|
package/dist/visualization.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{N as E,O as z,P as D,Q as O,a as e,b as r,c as t,d as o,e as i,f as s,g as a,h as p,i as n,j as f,k as l,l as m,m as y,n as u,o as d,p as x,q as g,r as C,s as c,x as h,y as j,z as v}from"./chunk-NVMSD4CC.js";import"./chunk-Y3M7P3BW.js";export{f as EDGES_SKIPPED_TRIANGLE_CAP,n as EDGE_USERDATA_KIND,d as EdgeDetectionPass,j as LOOKS,e as Materials,D as SCALE_FACTORS,m as addEdges,y as addEdgesAsync,o as applyOffset,i as computeCombinedBoundingBox,s as createCameraController,a as createGrid,g as createLabelLayer,c as createMeasureTool,x as createRenderPipeline,p as createViewGizmo,O as getThreeMeshesFromComputeResponse,h as initThree,l as isEdgeOverlay,t as parseColor,v as parseDisplayItems,z as parseMeshBatchBlob,E as parseMeshBatchObject,u as removeEdges,C as snapToVertex,r as updateScene};
|
|
2
2
|
//# sourceMappingURL=visualization.js.map
|