@selvajs/compute 3.1.0-beta.5 → 3.1.0-beta.7

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.
Files changed (51) hide show
  1. package/dist/chunk-AGU3SX3J.cjs +62 -0
  2. package/dist/chunk-AGU3SX3J.cjs.map +1 -0
  3. package/dist/{chunk-GF6ZIJWX.cjs → chunk-CUQQ3ZBV.cjs} +1 -1
  4. package/dist/chunk-CUQQ3ZBV.cjs.map +1 -0
  5. package/dist/chunk-EQ7EMYF6.js +62 -0
  6. package/dist/chunk-EQ7EMYF6.js.map +1 -0
  7. package/dist/{chunk-PJATLYMU.js → chunk-VZK5OUII.js} +2 -2
  8. package/dist/chunk-VZK5OUII.js.map +1 -0
  9. package/dist/{chunk-54O6BO24.js → chunk-WPB2LKCD.js} +1 -1
  10. package/dist/chunk-WPB2LKCD.js.map +1 -0
  11. package/dist/{chunk-7KFBCOZM.cjs → chunk-WSOTCJIQ.cjs} +2 -2
  12. package/dist/{chunk-7KFBCOZM.cjs.map → chunk-WSOTCJIQ.cjs.map} +1 -1
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.d.cts +3 -3
  15. package/dist/core.d.ts +3 -3
  16. package/dist/core.js +1 -1
  17. package/dist/grasshopper.cjs +1 -1
  18. package/dist/grasshopper.d.cts +8 -18
  19. package/dist/grasshopper.d.ts +8 -18
  20. package/dist/grasshopper.js +1 -1
  21. package/dist/{handle-files-DMnx92gr.d.ts → handle-files-BISo_wob.d.cts} +17 -69
  22. package/dist/{handle-files-DMnx92gr.d.cts → handle-files-BISo_wob.d.ts} +17 -69
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +3 -3
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +1 -1
  27. package/dist/types-BGhtYxZ-.d.cts +45 -0
  28. package/dist/types-BGhtYxZ-.d.ts +45 -0
  29. package/dist/{types-DuOh5XqS.d.ts → types-C8XWc4Ab.d.cts} +9 -56
  30. package/dist/{types-Ci8Z0-hF.d.cts → types-Dtok-mVq.d.ts} +9 -56
  31. package/dist/visualization-ET5JQHLQ.cjs +2 -0
  32. package/dist/visualization-ET5JQHLQ.cjs.map +1 -0
  33. package/dist/visualization-I6ZHBKFN.js +2 -0
  34. package/dist/visualization.cjs +1 -1
  35. package/dist/visualization.d.cts +91 -49
  36. package/dist/visualization.d.ts +91 -49
  37. package/dist/visualization.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-54O6BO24.js.map +0 -1
  40. package/dist/chunk-EZRBMUXT.cjs +0 -62
  41. package/dist/chunk-EZRBMUXT.cjs.map +0 -1
  42. package/dist/chunk-GF6ZIJWX.cjs.map +0 -1
  43. package/dist/chunk-ORGJSKR4.js +0 -62
  44. package/dist/chunk-ORGJSKR4.js.map +0 -1
  45. package/dist/chunk-PJATLYMU.js.map +0 -1
  46. package/dist/types-C9YpTbr3.d.cts +0 -121
  47. package/dist/types-C9YpTbr3.d.ts +0 -121
  48. package/dist/visualization-C3YOGQTW.js +0 -2
  49. package/dist/visualization-CERJ6XDX.cjs +0 -2
  50. package/dist/visualization-CERJ6XDX.cjs.map +0 -1
  51. /package/dist/{visualization-C3YOGQTW.js.map → visualization-I6ZHBKFN.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization-ET5JQHLQ.cjs"],"names":[],"mappings":"AAAA,iIAA6S,gCAA6B,62DAAg4B","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization-ET5JQHLQ.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-EQ7EMYF6.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-I6ZHBKFN.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEZRBMUXTcjs = require('./chunk-EZRBMUXT.cjs');require('./chunk-GF6ZIJWX.cjs');exports.EDGE_USERDATA_KIND = _chunkEZRBMUXTcjs.i; exports.Materials = _chunkEZRBMUXTcjs.a; exports.SCALE_FACTORS = _chunkEZRBMUXTcjs.L; exports.addEdges = _chunkEZRBMUXTcjs.j; exports.applyOffset = _chunkEZRBMUXTcjs.d; exports.computeCombinedBoundingBox = _chunkEZRBMUXTcjs.e; exports.createCameraController = _chunkEZRBMUXTcjs.f; exports.createGrid = _chunkEZRBMUXTcjs.g; exports.createLabelLayer = _chunkEZRBMUXTcjs.n; exports.createMeasureTool = _chunkEZRBMUXTcjs.p; exports.createRenderPipeline = _chunkEZRBMUXTcjs.m; exports.createViewGizmo = _chunkEZRBMUXTcjs.h; exports.getThreeMeshesFromComputeResponse = _chunkEZRBMUXTcjs.M; exports.initThree = _chunkEZRBMUXTcjs.u; exports.isEdgeOverlay = _chunkEZRBMUXTcjs.k; exports.parseColor = _chunkEZRBMUXTcjs.c; exports.parseDisplayItems = _chunkEZRBMUXTcjs.v; exports.parseMeshBatchBlob = _chunkEZRBMUXTcjs.K; exports.parseMeshBatchObject = _chunkEZRBMUXTcjs.J; exports.removeEdges = _chunkEZRBMUXTcjs.l; exports.snapToVertex = _chunkEZRBMUXTcjs.o; exports.updateScene = _chunkEZRBMUXTcjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkAGU3SX3Jcjs = require('./chunk-AGU3SX3J.cjs');require('./chunk-CUQQ3ZBV.cjs');exports.EDGE_USERDATA_KIND = _chunkAGU3SX3Jcjs.i; exports.Materials = _chunkAGU3SX3Jcjs.a; exports.SCALE_FACTORS = _chunkAGU3SX3Jcjs.L; exports.addEdges = _chunkAGU3SX3Jcjs.j; exports.applyOffset = _chunkAGU3SX3Jcjs.d; exports.computeCombinedBoundingBox = _chunkAGU3SX3Jcjs.e; exports.createCameraController = _chunkAGU3SX3Jcjs.f; exports.createGrid = _chunkAGU3SX3Jcjs.g; exports.createLabelLayer = _chunkAGU3SX3Jcjs.n; exports.createMeasureTool = _chunkAGU3SX3Jcjs.p; exports.createRenderPipeline = _chunkAGU3SX3Jcjs.m; exports.createViewGizmo = _chunkAGU3SX3Jcjs.h; exports.getThreeMeshesFromComputeResponse = _chunkAGU3SX3Jcjs.M; exports.initThree = _chunkAGU3SX3Jcjs.u; exports.isEdgeOverlay = _chunkAGU3SX3Jcjs.k; exports.parseColor = _chunkAGU3SX3Jcjs.c; exports.parseDisplayItems = _chunkAGU3SX3Jcjs.v; exports.parseMeshBatchBlob = _chunkAGU3SX3Jcjs.K; exports.parseMeshBatchObject = _chunkAGU3SX3Jcjs.J; exports.removeEdges = _chunkAGU3SX3Jcjs.l; exports.snapToVertex = _chunkAGU3SX3Jcjs.o; exports.updateScene = _chunkAGU3SX3Jcjs.b;
2
2
  //# sourceMappingURL=visualization.cjs.map
@@ -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-Ci8Z0-hF.cjs';
4
- export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-Ci8Z0-hF.cjs';
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-C9YpTbr3.cjs';
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 coherent visual look. Seeds the initial render defaults (tone mapping, AO, edges, grid, IBL
58
- * strength) at construction and can be re-applied live via `setRenderStyle`.
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, edges + grid on, AO on.
61
- * Reads like a CAD shaded view (Rhino/Onshape).
62
- * - 'rendered': presentation — ACES-filmic tone mapping, stronger IBL, edges off, AO on. Reads
63
- * like a Keyshot/Fusion render.
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 RenderStyle = 'technical' | 'rendered';
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 coherent look up front — seeds sensible defaults for tone mapping, AO, edges, grid, and
137
- * IBL strength (see {@link RenderStyle}). Individual `render`/`edges`/`grid` options still win
138
- * when set explicitly, so this only fills in what you leave unspecified. Omit for the plain
139
- * per-field defaults (no style applied). Re-apply later via the init result's `setRenderStyle`.
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
- renderStyle?: RenderStyle;
175
+ look?: Look;
142
176
  camera?: CameraConfig;
143
177
  lighting?: LightingConfig;
144
178
  environment?: EnvironmentConfig;
@@ -461,13 +495,40 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
461
495
  * edges). Retunes viewer-owned dials only; per-material parse choices are set via the batch
462
496
  * parser's `material` option. Handy for comparing the two looks in a live viewer.
463
497
  */
464
- setRenderStyle: (style: "technical" | "rendered") => void;
465
498
  /**
466
- * The parse-time material options (backface culling, IBL strength) matching the active render
467
- * style — feed into the batch parser's `material` option so freshly-loaded meshes are built to
468
- * match the look. Returns undefined when no style is active. See `setRenderStyle`.
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.
469
502
  */
470
- getMaterialAppearance: () => MaterialAppearanceOptions | undefined;
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.
509
+ */
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;
471
532
  /**
472
533
  * Refit the sun's shadow frustum to the current scene content for crisp shadows. Call after
473
534
  * loading or replacing geometry (e.g. after `updateScene`). No-op when sunlight/shadows are off.
@@ -488,25 +549,9 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
488
549
  clearUserGeometry: () => void;
489
550
  };
490
551
 
491
- /**
492
- * Updates the scene with the given meshes and camera settings.
493
- * If initialPositionSet is false, it positions the camera and sets the controls target based on the bounding boxes of the meshes.
494
- * @param scene - The THREE.Scene object to update.
495
- * @param meshes - An array of THREE.Mesh objects to add to the scene.
496
- * @param camera - The THREE.PerspectiveCamera object to position.
497
- * @param controls - The OrbitControls object to update.
498
- * @param initialPositionSet - A boolean indicating whether the initial position of the camera and controls have been set.
499
- */
552
+ /** Updates scene with meshes and positions camera on first call. */
500
553
  declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
501
- /**
502
- * Parses a color string in multiple formats to a THREE.Color object.
503
- * Supported formats:
504
- * - Hex: "#C7A5A5", "C7A5A5"
505
- * - RGB: "199, 165, 165"
506
- * - CSS named colors: "red", "blue", etc.
507
- * @param colorString - The color string to parse.
508
- * @returns A THREE.Color object.
509
- */
554
+ /** Parses color strings (hex, RGB, CSS names). */
510
555
  declare function parseColor(colorString: string): THREE.Color;
511
556
  /**
512
557
  * Shift objects along one world axis. Defaults to `z` — the up axis of the unified Z-up scene
@@ -526,12 +571,7 @@ declare const PLASTIC_MATERIAL: THREE.MeshPhysicalMaterial;
526
571
  declare const GLASS_MATERIAL: THREE.MeshPhysicalMaterial;
527
572
  declare const RUBBER_MATERIAL: THREE.MeshPhysicalMaterial;
528
573
  declare const WOOD_MATERIAL: THREE.MeshPhysicalMaterial;
529
- /**
530
- * The module-scope singleton materials above, as a set. Scene-clearing code must NOT dispose a
531
- * material in this set: they are shared across meshes and across solves, and `dispose()` on a
532
- * still-referenced material forces a shader program rebuild on its next use (and would free any
533
- * textures they gain later while other objects still use them).
534
- */
574
+ /** Shared singleton materials; must not be disposed (rebuilds shaders, frees textures). */
535
575
  declare const SHARED_MATERIALS: ReadonlySet<THREE.Material>;
536
576
 
537
577
  declare const threeMaterials_CONCRETE_MATERIAL: typeof CONCRETE_MATERIAL;
@@ -619,6 +659,12 @@ interface RenderPipelineOptions {
619
659
  toneMappingExposure: number;
620
660
  /** AO strength 0–1. Default 1. */
621
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;
622
668
  }
623
669
  declare function createRenderPipeline(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options: RenderPipelineOptions): RenderPipeline;
624
670
 
@@ -677,11 +723,7 @@ declare const SCALE_FACTORS: Record<string, number>;
677
723
  */
678
724
  declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Object3D[]>;
679
725
 
680
- /**
681
- * Internal-only telemetry threaded from an outer entry point (e.g. the JSON
682
- * `parseMeshBatch` measuring its own `JSON.parse` cost) into the shared build
683
- * step. Never part of any public options surface — callers don't supply timings.
684
- */
726
+ /** Internal telemetry only (not exposed in public options). */
685
727
  interface ParseTelemetry {
686
728
  parseTime?: number;
687
729
  perfStart?: number;
@@ -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-DuOh5XqS.js';
4
- export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-DuOh5XqS.js';
3
+ import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-Dtok-mVq.js';
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
7
  import { RhinoModule } from 'rhino3dm';
8
- import './types-C9YpTbr3.js';
8
+ import './types-BGhtYxZ-.js';
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 coherent visual look. Seeds the initial render defaults (tone mapping, AO, edges, grid, IBL
58
- * strength) at construction and can be re-applied live via `setRenderStyle`.
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, edges + grid on, AO on.
61
- * Reads like a CAD shaded view (Rhino/Onshape).
62
- * - 'rendered': presentation — ACES-filmic tone mapping, stronger IBL, edges off, AO on. Reads
63
- * like a Keyshot/Fusion render.
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 RenderStyle = 'technical' | 'rendered';
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 coherent look up front — seeds sensible defaults for tone mapping, AO, edges, grid, and
137
- * IBL strength (see {@link RenderStyle}). Individual `render`/`edges`/`grid` options still win
138
- * when set explicitly, so this only fills in what you leave unspecified. Omit for the plain
139
- * per-field defaults (no style applied). Re-apply later via the init result's `setRenderStyle`.
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
- renderStyle?: RenderStyle;
175
+ look?: Look;
142
176
  camera?: CameraConfig;
143
177
  lighting?: LightingConfig;
144
178
  environment?: EnvironmentConfig;
@@ -461,13 +495,40 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
461
495
  * edges). Retunes viewer-owned dials only; per-material parse choices are set via the batch
462
496
  * parser's `material` option. Handy for comparing the two looks in a live viewer.
463
497
  */
464
- setRenderStyle: (style: "technical" | "rendered") => void;
465
498
  /**
466
- * The parse-time material options (backface culling, IBL strength) matching the active render
467
- * style — feed into the batch parser's `material` option so freshly-loaded meshes are built to
468
- * match the look. Returns undefined when no style is active. See `setRenderStyle`.
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.
469
502
  */
470
- getMaterialAppearance: () => MaterialAppearanceOptions | undefined;
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.
509
+ */
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;
471
532
  /**
472
533
  * Refit the sun's shadow frustum to the current scene content for crisp shadows. Call after
473
534
  * loading or replacing geometry (e.g. after `updateScene`). No-op when sunlight/shadows are off.
@@ -488,25 +549,9 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
488
549
  clearUserGeometry: () => void;
489
550
  };
490
551
 
491
- /**
492
- * Updates the scene with the given meshes and camera settings.
493
- * If initialPositionSet is false, it positions the camera and sets the controls target based on the bounding boxes of the meshes.
494
- * @param scene - The THREE.Scene object to update.
495
- * @param meshes - An array of THREE.Mesh objects to add to the scene.
496
- * @param camera - The THREE.PerspectiveCamera object to position.
497
- * @param controls - The OrbitControls object to update.
498
- * @param initialPositionSet - A boolean indicating whether the initial position of the camera and controls have been set.
499
- */
552
+ /** Updates scene with meshes and positions camera on first call. */
500
553
  declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
501
- /**
502
- * Parses a color string in multiple formats to a THREE.Color object.
503
- * Supported formats:
504
- * - Hex: "#C7A5A5", "C7A5A5"
505
- * - RGB: "199, 165, 165"
506
- * - CSS named colors: "red", "blue", etc.
507
- * @param colorString - The color string to parse.
508
- * @returns A THREE.Color object.
509
- */
554
+ /** Parses color strings (hex, RGB, CSS names). */
510
555
  declare function parseColor(colorString: string): THREE.Color;
511
556
  /**
512
557
  * Shift objects along one world axis. Defaults to `z` — the up axis of the unified Z-up scene
@@ -526,12 +571,7 @@ declare const PLASTIC_MATERIAL: THREE.MeshPhysicalMaterial;
526
571
  declare const GLASS_MATERIAL: THREE.MeshPhysicalMaterial;
527
572
  declare const RUBBER_MATERIAL: THREE.MeshPhysicalMaterial;
528
573
  declare const WOOD_MATERIAL: THREE.MeshPhysicalMaterial;
529
- /**
530
- * The module-scope singleton materials above, as a set. Scene-clearing code must NOT dispose a
531
- * material in this set: they are shared across meshes and across solves, and `dispose()` on a
532
- * still-referenced material forces a shader program rebuild on its next use (and would free any
533
- * textures they gain later while other objects still use them).
534
- */
574
+ /** Shared singleton materials; must not be disposed (rebuilds shaders, frees textures). */
535
575
  declare const SHARED_MATERIALS: ReadonlySet<THREE.Material>;
536
576
 
537
577
  declare const threeMaterials_CONCRETE_MATERIAL: typeof CONCRETE_MATERIAL;
@@ -619,6 +659,12 @@ interface RenderPipelineOptions {
619
659
  toneMappingExposure: number;
620
660
  /** AO strength 0–1. Default 1. */
621
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;
622
668
  }
623
669
  declare function createRenderPipeline(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options: RenderPipelineOptions): RenderPipeline;
624
670
 
@@ -677,11 +723,7 @@ declare const SCALE_FACTORS: Record<string, number>;
677
723
  */
678
724
  declare function getThreeMeshesFromComputeResponse(data: GrasshopperComputeResponse, options?: MeshExtractionOptions): Promise<THREE.Object3D[]>;
679
725
 
680
- /**
681
- * Internal-only telemetry threaded from an outer entry point (e.g. the JSON
682
- * `parseMeshBatch` measuring its own `JSON.parse` cost) into the shared build
683
- * step. Never part of any public options surface — callers don't supply timings.
684
- */
726
+ /** Internal telemetry only (not exposed in public options). */
685
727
  interface ParseTelemetry {
686
728
  parseTime?: number;
687
729
  perfStart?: number;
@@ -1,2 +1,2 @@
1
- import{J as h,K as c,L as v,M as j,a as e,b as r,c as t,d as o,e as i,f as a,g as s,h as p,i as n,j as l,k as f,l as m,m as y,n as u,o as d,p as x,u as C,v as g}from"./chunk-ORGJSKR4.js";import"./chunk-54O6BO24.js";export{n as EDGE_USERDATA_KIND,e as Materials,v as SCALE_FACTORS,l as addEdges,o as applyOffset,i as computeCombinedBoundingBox,a as createCameraController,s as createGrid,u as createLabelLayer,x as createMeasureTool,y as createRenderPipeline,p as createViewGizmo,j as getThreeMeshesFromComputeResponse,C as initThree,f as isEdgeOverlay,t as parseColor,g as parseDisplayItems,c as parseMeshBatchBlob,h as parseMeshBatchObject,m as removeEdges,d as snapToVertex,r as updateScene};
1
+ import{J as h,K as c,L as v,M as j,a as e,b as r,c as t,d as o,e as i,f as a,g as s,h as p,i as n,j as l,k as f,l as m,m as y,n as u,o as d,p as x,u as C,v as g}from"./chunk-EQ7EMYF6.js";import"./chunk-WPB2LKCD.js";export{n as EDGE_USERDATA_KIND,e as Materials,v as SCALE_FACTORS,l as addEdges,o as applyOffset,i as computeCombinedBoundingBox,a as createCameraController,s as createGrid,u as createLabelLayer,x as createMeasureTool,y as createRenderPipeline,p as createViewGizmo,j as getThreeMeshesFromComputeResponse,C as initThree,f as isEdgeOverlay,t as parseColor,g as parseDisplayItems,c as parseMeshBatchBlob,h as parseMeshBatchObject,m as removeEdges,d as snapToVertex,r as updateScene};
2
2
  //# sourceMappingURL=visualization.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selvajs/compute",
3
- "version": "3.1.0-beta.5",
3
+ "version": "3.1.0-beta.7",
4
4
  "description": "TypeScript library for Rhino Compute Server - Grasshopper and RhinoCommon",
5
5
  "author": "VektorNode",
6
6
  "license": "MIT",