@selvajs/compute 3.1.0-beta.11 → 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-6R4EL3ZJ.cjs +2 -0
- package/dist/chunk-6R4EL3ZJ.cjs.map +1 -0
- package/dist/chunk-6TMSTNHN.js +2 -0
- package/dist/chunk-6TMSTNHN.js.map +1 -0
- package/dist/chunk-GLOTP5TC.cjs +120 -0
- package/dist/chunk-GLOTP5TC.cjs.map +1 -0
- package/dist/chunk-H3FZW6OX.cjs +4 -0
- package/dist/chunk-H3FZW6OX.cjs.map +1 -0
- package/dist/chunk-NVMSD4CC.js +120 -0
- package/dist/chunk-NVMSD4CC.js.map +1 -0
- package/dist/chunk-Y3M7P3BW.js +4 -0
- package/dist/chunk-Y3M7P3BW.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +22 -1
- package/dist/core.d.ts +22 -1
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.d.cts +20 -0
- package/dist/grasshopper.d.ts +20 -0
- package/dist/grasshopper.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +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 +193 -21
- package/dist/visualization.d.ts +193 -21
- package/dist/visualization.js +1 -1
- package/package.json +55 -34
- package/dist/chunk-7XMD5YXP.cjs +0 -62
- package/dist/chunk-7XMD5YXP.cjs.map +0 -1
- package/dist/chunk-C7P43VZF.js +0 -2
- package/dist/chunk-C7P43VZF.js.map +0 -1
- package/dist/chunk-CUQQ3ZBV.cjs +0 -4
- package/dist/chunk-CUQQ3ZBV.cjs.map +0 -1
- package/dist/chunk-PX2YTSHJ.js +0 -62
- package/dist/chunk-PX2YTSHJ.js.map +0 -1
- package/dist/chunk-QZECCPT3.cjs +0 -2
- package/dist/chunk-QZECCPT3.cjs.map +0 -1
- package/dist/chunk-WPB2LKCD.js +0 -4
- package/dist/chunk-WPB2LKCD.js.map +0 -1
- package/dist/visualization-4RSUYQG2.cjs +0 -2
- package/dist/visualization-4RSUYQG2.cjs.map +0 -1
- package/dist/visualization-MOYO6MDN.js +0 -2
- /package/dist/{visualization-MOYO6MDN.js.map → visualization-BIHTM2KJ.js.map} +0 -0
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.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/index.cjs"],"names":[],"mappings":"AAAA,iIAA4H,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/selva/selva/packages/compute/dist/index.cjs"],"names":[],"mappings":"AAAA,iIAA4H,wDAAmH,yuCAA8kB","file":"/home/runner/work/selva/selva/packages/compute/dist/index.cjs"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.cjs';
|
|
1
|
+
export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, getResponseWireSize, setLogger, setResponseWireSize, toCamelCase } from './core.cjs';
|
|
2
2
|
export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-BISo_wob.cjs';
|
|
3
3
|
export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-BGhtYxZ-.cjs';
|
|
4
4
|
export { CacheOptions, DataTreeValue, DefinitionRef, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveDefinition, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, processInputs, solveGrasshopperDefinition, stableStringify } from './grasshopper.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.js';
|
|
1
|
+
export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, getResponseWireSize, setLogger, setResponseWireSize, toCamelCase } from './core.js';
|
|
2
2
|
export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-BISo_wob.js';
|
|
3
3
|
export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-BGhtYxZ-.js';
|
|
4
4
|
export { CacheOptions, DataTreeValue, DefinitionRef, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveDefinition, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, processInputs, solveGrasshopperDefinition, stableStringify } from './grasshopper.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
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
|
|
@@ -114,14 +122,31 @@ type Look = (typeof LOOKS)[number];
|
|
|
114
122
|
type EdgesConfig = {
|
|
115
123
|
/** Auto-attach edge overlays to meshes as they load. Default false (opt-in). */
|
|
116
124
|
enabled?: boolean;
|
|
117
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Force a single edge color for all meshes. Omit (the default) to derive each mesh's edge color
|
|
127
|
+
* from its own surface material, darkened by `darken` — so edges read as the object's own outline.
|
|
128
|
+
*/
|
|
118
129
|
color?: THREE.ColorRepresentation;
|
|
130
|
+
/**
|
|
131
|
+
* How far derived edge colors are darkened toward black, 0–1 (default 0.75). Ignored when `color`
|
|
132
|
+
* is set.
|
|
133
|
+
*/
|
|
134
|
+
darken?: number;
|
|
119
135
|
/** Edge thickness in CSS px. Default 1.5. */
|
|
120
136
|
width?: number;
|
|
121
|
-
/** Crease angle (degrees): keep edges where faces differ by more than this. Default
|
|
137
|
+
/** Crease angle (degrees): keep edges where faces differ by more than this. Default 44. */
|
|
122
138
|
thresholdAngle?: number;
|
|
123
139
|
/** Fade an overlay out as its mesh shrinks on screen, so far zoom-outs stay clean. Default true. */
|
|
124
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;
|
|
125
150
|
};
|
|
126
151
|
type ControlsConfig = {
|
|
127
152
|
enableDamping?: boolean;
|
|
@@ -320,6 +345,13 @@ interface Grid {
|
|
|
320
345
|
readonly object: THREE.Mesh;
|
|
321
346
|
/** Keep the fade centered on the camera so the grid feels infinite as you move. Call per frame. */
|
|
322
347
|
update(cameraPosition: THREE.Vector3): void;
|
|
348
|
+
/**
|
|
349
|
+
* Rescale the grid's cell spacing and fade radius to the loaded content's extent. Call after a
|
|
350
|
+
* geometry change (e.g. right after `updateScene`) so a part that is 3 units or 3000 units wide
|
|
351
|
+
* both get sensibly-sized cells and a fade that reaches past the model. No-op for empty/degenerate
|
|
352
|
+
* bounds — the grid keeps its last (or default) scale. See {@link Grid.fitToContent}'s impl notes.
|
|
353
|
+
*/
|
|
354
|
+
fitToContent(bounds: THREE.Box3): void;
|
|
323
355
|
setVisible(visible: boolean): void;
|
|
324
356
|
dispose(): void;
|
|
325
357
|
}
|
|
@@ -500,9 +532,24 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
|
|
|
500
532
|
measureTool: MeasureTool | null;
|
|
501
533
|
/**
|
|
502
534
|
* Attach edge overlays to the meshes under `root` (no-op unless `edges.enabled`). Call after
|
|
503
|
-
* 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.
|
|
504
538
|
*/
|
|
505
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;
|
|
506
553
|
/** Toggle ambient occlusion at runtime — builds or tears down the postprocessing pipeline. */
|
|
507
554
|
setAmbientOcclusion: (enabled: boolean) => void;
|
|
508
555
|
/**
|
|
@@ -550,6 +597,12 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
|
|
|
550
597
|
* loading or replacing geometry (e.g. after `updateScene`). No-op when sunlight/shadows are off.
|
|
551
598
|
*/
|
|
552
599
|
updateShadowBounds: () => void;
|
|
600
|
+
/**
|
|
601
|
+
* Rescale the grid's cell spacing and fade radius to the current scene content, so parts of any
|
|
602
|
+
* size get readable cells and a fade that reaches past the model. Call after loading or replacing
|
|
603
|
+
* geometry (e.g. after `updateScene`). No-op when the grid is off or there's no content.
|
|
604
|
+
*/
|
|
605
|
+
updateGridScale: () => void;
|
|
553
606
|
dispose: () => void;
|
|
554
607
|
fitToView: () => void;
|
|
555
608
|
clearSelection: () => void;
|
|
@@ -606,11 +659,23 @@ declare namespace threeMaterials {
|
|
|
606
659
|
* Crisp boundary/crease edges overlaid on meshes — the defining "technical drawing" look that makes
|
|
607
660
|
* shaded geometry read as discrete objects rather than blobs.
|
|
608
661
|
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
* `LineMaterial` family as curves
|
|
612
|
-
* of `THREE.LineSegments`. The overlay is added as a
|
|
613
|
-
* 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.
|
|
614
679
|
*
|
|
615
680
|
* Depth strategy: edges render at TRUE depth; the mesh's own surface is pushed back a hair with
|
|
616
681
|
* polygonOffset instead (see {@link setSurfaceDepthOffset}). Biasing the lines toward the camera —
|
|
@@ -622,13 +687,23 @@ declare namespace threeMaterials {
|
|
|
622
687
|
* occlusion of hidden edges exact.
|
|
623
688
|
*/
|
|
624
689
|
interface EdgeOptions {
|
|
625
|
-
/**
|
|
690
|
+
/**
|
|
691
|
+
* Force a single edge color for every overlay. When omitted (the default), each overlay derives
|
|
692
|
+
* its color from its own mesh's material — a darkened tint of the surface — so edges read as the
|
|
693
|
+
* object's own outline rather than a uniform black frame. Meshes with no readable material color
|
|
694
|
+
* fall back to {@link DEFAULT_EDGE_COLOR}.
|
|
695
|
+
*/
|
|
626
696
|
color?: THREE.ColorRepresentation;
|
|
697
|
+
/**
|
|
698
|
+
* How far to darken the derived edge color toward black, 0–1 (default 0.75). Only applies when
|
|
699
|
+
* `color` is omitted. Higher = darker edges; 0 leaves edges the surface color, 1 makes them black.
|
|
700
|
+
*/
|
|
701
|
+
darken?: number;
|
|
627
702
|
/** Edge thickness in CSS px. Default 1.5. */
|
|
628
703
|
width?: number;
|
|
629
704
|
/**
|
|
630
705
|
* Crease angle in degrees: an edge is kept only where its two faces differ by more than this.
|
|
631
|
-
* Default
|
|
706
|
+
* Default 44. Higher = fewer edges (only sharp creases); lower = more (catches gentle bends).
|
|
632
707
|
*/
|
|
633
708
|
thresholdAngle?: number;
|
|
634
709
|
/**
|
|
@@ -636,34 +711,120 @@ interface EdgeOptions {
|
|
|
636
711
|
* covering only tens of pixels alias into dark noise; fading them keeps far zoom-outs clean.
|
|
637
712
|
*/
|
|
638
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;
|
|
639
727
|
}
|
|
640
728
|
/** Tag on edge overlays so pick/fit/clear logic can recognize and skip or dispose them. */
|
|
641
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;
|
|
642
734
|
/**
|
|
643
735
|
* Walk an object subtree and attach an edge overlay to every `Mesh` found, returning the created
|
|
644
736
|
* overlays (so callers can dispose them explicitly if they don't clear the whole subtree). Meshes
|
|
645
737
|
* that already carry an overlay are skipped, so this is safe to call more than once.
|
|
646
738
|
*
|
|
647
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.
|
|
648
744
|
*/
|
|
649
745
|
declare function addEdges(root: THREE.Object3D, options?: EdgeOptions): LineSegments2[];
|
|
650
|
-
/**
|
|
651
|
-
|
|
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[]>;
|
|
652
756
|
/**
|
|
653
757
|
* Remove every edge overlay under `root`, disposing its geometry and material. The inverse of
|
|
654
|
-
* {@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.
|
|
655
760
|
*/
|
|
656
761
|
declare function removeEdges(root: THREE.Object3D): number;
|
|
657
762
|
|
|
658
763
|
/**
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
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.
|
|
662
772
|
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
* 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.
|
|
667
828
|
*
|
|
668
829
|
* SMAA restores antialiasing on this path. The EffectComposer renders into an offscreen target, so
|
|
669
830
|
* the WebGLRenderer's own MSAA (`antialias: true`) does nothing here — without a dedicated AA pass,
|
|
@@ -681,12 +842,18 @@ interface RenderPipeline {
|
|
|
681
842
|
setSize(width: number, height: number, pixelRatio: number): void;
|
|
682
843
|
/** Point the passes at the currently active camera (call when projection changes). */
|
|
683
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;
|
|
684
849
|
dispose(): void;
|
|
685
850
|
}
|
|
686
851
|
interface RenderPipelineOptions {
|
|
687
852
|
/** Tone mapping to apply in OutputPass (mirror the renderer's). */
|
|
688
853
|
toneMapping: THREE.ToneMapping;
|
|
689
854
|
toneMappingExposure: number;
|
|
855
|
+
/** Build the pipeline with the GTAO ambient-occlusion pass. Default true. */
|
|
856
|
+
ambientOcclusion?: boolean;
|
|
690
857
|
/** AO strength 0–1. Default 1. */
|
|
691
858
|
aoIntensity?: number;
|
|
692
859
|
/**
|
|
@@ -695,6 +862,11 @@ interface RenderPipelineOptions {
|
|
|
695
862
|
* pixelRatio is clamped to this. Default 1.
|
|
696
863
|
*/
|
|
697
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;
|
|
698
870
|
}
|
|
699
871
|
declare function createRenderPipeline(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options: RenderPipelineOptions): RenderPipeline;
|
|
700
872
|
|
|
@@ -811,4 +983,4 @@ interface DisplayItemParseOptions {
|
|
|
811
983
|
*/
|
|
812
984
|
declare function parseDisplayItems(items: DisplayItem[] | undefined, options?: DisplayItemParseOptions): THREE.Object3D[];
|
|
813
985
|
|
|
814
|
-
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 };
|