@selvajs/visualization 1.8.0-beta.8 → 1.8.1
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/{gpu-dispose-0c_-KS12.cjs → gpu-dispose--5MA0CcI.cjs} +10 -9
- package/dist/{gpu-dispose-0c_-KS12.cjs.map → gpu-dispose--5MA0CcI.cjs.map} +1 -1
- package/dist/{gpu-dispose-k_Gq-ygL.js → gpu-dispose-m5ywfM1f.js} +8 -8
- package/dist/{gpu-dispose-k_Gq-ygL.js.map → gpu-dispose-m5ywfM1f.js.map} +1 -1
- package/dist/{gpu-ownership-Bs9l7hrU.js → gpu-ownership-5o7F_lc2.js} +1 -1
- package/dist/{gpu-ownership-Bs9l7hrU.js.map → gpu-ownership-5o7F_lc2.js.map} +1 -1
- package/dist/{gpu-ownership-ADRZBxxs.cjs → gpu-ownership-BtECafMd.cjs} +1 -28
- package/dist/{gpu-ownership-ADRZBxxs.cjs.map → gpu-ownership-BtECafMd.cjs.map} +1 -1
- package/dist/{merged-draw-CO4rr2Co.js → merged-draw-BE0616Nv.js} +2 -2
- package/dist/{merged-draw-CO4rr2Co.js.map → merged-draw-BE0616Nv.js.map} +1 -1
- package/dist/{merged-draw-ma_2r4N8.cjs → merged-draw-C9jFRnos.cjs} +4 -3
- package/dist/merged-draw-C9jFRnos.cjs.map +1 -0
- package/dist/parse.cjs +23 -25
- package/dist/parse.cjs.map +1 -1
- package/dist/parse.d.cts +9 -3
- package/dist/parse.d.ts +9 -3
- package/dist/parse.js +21 -24
- package/dist/parse.js.map +1 -1
- package/dist/render.cjs +38 -35
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +10 -6
- package/dist/render.d.ts +14 -7
- package/dist/render.js +36 -34
- package/dist/render.js.map +1 -1
- package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
- package/dist/scene.cjs +3 -3
- package/dist/scene.cjs.map +1 -1
- package/dist/scene.d.cts +10 -2
- package/dist/scene.d.ts +10 -2
- package/dist/scene.js +1 -1
- package/dist/{types-i9wRcHK7.d.ts → types-8Qx4xyyR.d.ts} +1 -2
- package/dist/{types-i9wRcHK7.d.cts → types-D1PpOP_H.d.cts} +1 -2
- package/package.json +8 -8
- package/dist/merged-draw-ma_2r4N8.cjs.map +0 -1
package/dist/render.d.cts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `render/` — the CAD viewer toolkit. See README for the layer map and the render↔parse seam.
|
|
3
|
+
*
|
|
4
|
+
* `initThree` owns the toolkit; factories aren't exported on purpose — reach live instances through
|
|
5
|
+
* the viewer (`viewer.grid`, `viewer.measureTool`, …), configured via {@link ThreeInitializerOptions}.
|
|
6
|
+
*
|
|
7
|
+
* @module render
|
|
8
|
+
*/
|
|
2
9
|
import * as THREE from "three";
|
|
10
|
+
import { a as LookPreset, i as LookMaterialOverride, n as LOOKS, o as MaterialAppearanceOptions, r as Look, t as BloomOptions } from "./types-D1PpOP_H.cjs";
|
|
3
11
|
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
4
|
-
import "three/addons/lines/LineSegments2.js";
|
|
5
12
|
import { CSS2DObject } from "three/addons/renderers/CSS2DRenderer.js";
|
|
6
|
-
import "three/addons/postprocessing/Pass.js";
|
|
7
|
-
import "three-mesh-bvh";
|
|
8
13
|
/**
|
|
9
14
|
* Errors for the visualization package. Replaces `@selvajs/compute`'s `RhinoComputeError`, which
|
|
10
15
|
* mis-named failures on paths (e.g. the plugin WebSocket) that never touch Rhino.Compute. `code`
|
|
@@ -651,5 +656,4 @@ export declare function isHostOwned(object: THREE.Object3D): boolean;
|
|
|
651
656
|
export declare function isOwnedBy(object: THREE.Object3D, id?: string): boolean;
|
|
652
657
|
/** Replaces scene content with `meshes`, rescales the camera frustum to fit, and (first call only) positions the camera/controls. */
|
|
653
658
|
export declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
|
|
654
|
-
export { type CameraConfig, type CameraController, type CameraProjection, type CameraView, type ControlsConfig, type EdgesConfig, type EnvironmentConfig, type ErrorCode, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Logger, type Look, type LookMaterialOverride, type LookPreset, type MaterialAppearanceOptions, type MeasureConfig, type MeasureTool, type PointerTool, type RenderConfig, type SetLookOptions, type ThreeInitializerOptions, type ThreeViewer, type ToolRegistration, type ToolRegistry, type ViewGizmo, type ViewPreset };
|
|
655
|
-
//# sourceMappingURL=render.d.cts.map
|
|
659
|
+
export { type CameraConfig, type CameraController, type CameraProjection, type CameraView, type ControlsConfig, type EdgesConfig, type EnvironmentConfig, type ErrorCode, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Logger, type Look, type LookMaterialOverride, type LookPreset, type MaterialAppearanceOptions, type MeasureConfig, type MeasureTool, type PointerTool, type RenderConfig, type SetLookOptions, type ThreeInitializerOptions, type ThreeViewer, type ToolRegistration, type ToolRegistry, type ViewGizmo, type ViewPreset };
|
package/dist/render.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `render/` — the CAD viewer toolkit. See README for the layer map and the render↔parse seam.
|
|
3
|
+
*
|
|
4
|
+
* `initThree` owns the toolkit; factories aren't exported on purpose — reach live instances through
|
|
5
|
+
* the viewer (`viewer.grid`, `viewer.measureTool`, …), configured via {@link ThreeInitializerOptions}.
|
|
6
|
+
*
|
|
7
|
+
* @module render
|
|
8
|
+
*/
|
|
2
9
|
import * as THREE from "three";
|
|
3
|
-
import {
|
|
4
|
-
import { CSS2DObject } from "three/addons/renderers/CSS2DRenderer.js";
|
|
5
|
-
import { MeshBVH } from "three-mesh-bvh";
|
|
6
|
-
import { Pass } from "three/addons/postprocessing/Pass.js";
|
|
10
|
+
import { a as LookPreset, i as LookMaterialOverride, n as LOOKS, o as MaterialAppearanceOptions, r as Look, t as BloomOptions } from "./types-8Qx4xyyR.js";
|
|
7
11
|
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
12
|
+
import "three/addons/lines/LineSegments2.js";
|
|
13
|
+
import { CSS2DObject } from "three/addons/renderers/CSS2DRenderer.js";
|
|
14
|
+
import "three/addons/postprocessing/Pass.js";
|
|
15
|
+
import "three-mesh-bvh";
|
|
8
16
|
/**
|
|
9
17
|
* Errors for the visualization package. Replaces `@selvajs/compute`'s `RhinoComputeError`, which
|
|
10
18
|
* mis-named failures on paths (e.g. the plugin WebSocket) that never touch Rhino.Compute. `code`
|
|
@@ -651,5 +659,4 @@ export declare function isHostOwned(object: THREE.Object3D): boolean;
|
|
|
651
659
|
export declare function isOwnedBy(object: THREE.Object3D, id?: string): boolean;
|
|
652
660
|
/** Replaces scene content with `meshes`, rescales the camera frustum to fit, and (first call only) positions the camera/controls. */
|
|
653
661
|
export declare function updateScene(scene: THREE.Scene, meshes: THREE.Object3D[], camera: THREE.PerspectiveCamera, controls: OrbitControls, initialPositionSet: boolean): void;
|
|
654
|
-
export { type CameraConfig, type CameraController, type CameraProjection, type CameraView, type ControlsConfig, type EdgesConfig, type EnvironmentConfig, type ErrorCode, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Logger, type Look, type LookMaterialOverride, type LookPreset, type MaterialAppearanceOptions, type MeasureConfig, type MeasureTool, type PointerTool, type RenderConfig, type SetLookOptions, type ThreeInitializerOptions, type ThreeViewer, type ToolRegistration, type ToolRegistry, type ViewGizmo, type ViewPreset };
|
|
655
|
-
//# sourceMappingURL=render.d.ts.map
|
|
662
|
+
export { type CameraConfig, type CameraController, type CameraProjection, type CameraView, type ControlsConfig, type EdgesConfig, type EnvironmentConfig, type ErrorCode, type EventConfig, type FloorConfig, type GizmoConfig, type Grid, type GridConfig, LOOKS, type LabelHandle, type LabelLayer, type LightingConfig, type Logger, type Look, type LookMaterialOverride, type LookPreset, type MaterialAppearanceOptions, type MeasureConfig, type MeasureTool, type PointerTool, type RenderConfig, type SetLookOptions, type ThreeInitializerOptions, type ThreeViewer, type ToolRegistration, type ToolRegistry, type ViewGizmo, type ViewPreset };
|
package/dist/render.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { S as VisualizationError, _ as materialAppearanceForLook, b as setLogger, c as computeCombinedBoundingBox, d as EMISSIVE_LIGHT, f as LOOK_PRESETS, g as lookPreset, h as lookEnvMapIntensity, m as OWN_ENV_MAP_INTENSITY, o as publishMaxAnisotropy, r as hideGlass, t as disposeObjectTree, u as DEFAULT_LOOK, v as enableDebugLogging, x as ErrorCodes, y as getLogger } from "./gpu-dispose-k_Gq-ygL.js";
|
|
2
|
-
import { n as cachedSourceOf } from "./gpu-ownership-Bs9l7hrU.js";
|
|
3
|
-
import { a as onMemberDrawChange, i as getHiddenMembers, n as cloneForTint, r as getBaseMaterial, s as setMemberHighlight, t as clearMemberHighlight } from "./merged-draw-CO4rr2Co.js";
|
|
4
1
|
import * as THREE from "three";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { LineMaterial } from "three/addons/lines/LineMaterial.js";
|
|
2
|
+
import { S as VisualizationError, _ as materialAppearanceForLook, b as setLogger, c as computeCombinedBoundingBox, d as EMISSIVE_LIGHT, f as LOOK_PRESETS, g as lookPreset, h as lookEnvMapIntensity, m as OWN_ENV_MAP_INTENSITY, o as publishMaxAnisotropy, r as hideGlass, t as disposeObjectTree, u as DEFAULT_LOOK, v as enableDebugLogging, x as ErrorCodes, y as getLogger } from "./gpu-dispose-m5ywfM1f.js";
|
|
3
|
+
import { n as cachedSourceOf } from "./gpu-ownership-5o7F_lc2.js";
|
|
8
4
|
import { LineSegments2 } from "three/addons/lines/LineSegments2.js";
|
|
9
5
|
import { LineSegmentsGeometry } from "three/addons/lines/LineSegmentsGeometry.js";
|
|
6
|
+
import { a as onMemberDrawChange, i as getHiddenMembers, n as cloneForTint, r as getBaseMaterial, s as setMemberHighlight, t as clearMemberHighlight } from "./merged-draw-BE0616Nv.js";
|
|
7
|
+
import { LineMaterial } from "three/addons/lines/LineMaterial.js";
|
|
10
8
|
import { CSS2DObject, CSS2DRenderer } from "three/addons/renderers/CSS2DRenderer.js";
|
|
9
|
+
import { Line2 } from "three/addons/lines/Line2.js";
|
|
10
|
+
import { LineGeometry } from "three/addons/lines/LineGeometry.js";
|
|
11
11
|
import { MeshBVH } from "three-mesh-bvh";
|
|
12
12
|
import { ViewHelper } from "three/addons/helpers/ViewHelper.js";
|
|
13
13
|
import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
|
|
@@ -175,6 +175,7 @@ const METAL = .5;
|
|
|
175
175
|
/** Above PMREM's blur for a mirror, so a softbox has an edge in chrome without showing as a shape. */
|
|
176
176
|
const STUDIO_BLUR = .03;
|
|
177
177
|
const KEY = "selvaReflectionEnvironment";
|
|
178
|
+
const probes = /* @__PURE__ */ new WeakSet();
|
|
178
179
|
/**
|
|
179
180
|
* Builds the studio probe once per scene. `rotation` turns its Y-up room to the scene's up, the same
|
|
180
181
|
* rotation the HDR gets.
|
|
@@ -193,6 +194,7 @@ function installReflectionEnvironment(scene, texture, rotation) {
|
|
|
193
194
|
texture,
|
|
194
195
|
rotation: rotation.clone()
|
|
195
196
|
};
|
|
197
|
+
probes.add(texture);
|
|
196
198
|
scene.userData[KEY] = environment;
|
|
197
199
|
applyReflectionEnvironment(scene, scene);
|
|
198
200
|
}
|
|
@@ -216,7 +218,7 @@ function applyReflectionEnvironment(root, scene) {
|
|
|
216
218
|
const materials = Array.isArray(mesh.material) ? mesh.material : mesh.material ? [mesh.material] : [];
|
|
217
219
|
for (const material of materials) {
|
|
218
220
|
if (!(material instanceof THREE.MeshStandardMaterial)) continue;
|
|
219
|
-
if (material.envMap && material.envMap
|
|
221
|
+
if (material.envMap && !probes.has(material.envMap)) continue;
|
|
220
222
|
const wanted = material.metalness > METAL ? environment.texture : null;
|
|
221
223
|
if (material.envMap === wanted) continue;
|
|
222
224
|
material.envMap = wanted;
|
|
@@ -368,15 +370,15 @@ function applyDefaults(options) {
|
|
|
368
370
|
sunlightPosition: options.lighting?.sunlightPosition || sunOffset(options.environment?.sceneUp ?? defaultUp, defaults.lightDistance, defaults.lightHeight),
|
|
369
371
|
ambientLightColor: options.lighting?.ambientLightColor || new THREE.Color(4210752),
|
|
370
372
|
ambientLightIntensity: options.lighting?.ambientLightIntensity ?? preset.ambientIntensity,
|
|
371
|
-
sunlightColor: options.lighting?.sunlightColor ||
|
|
373
|
+
sunlightColor: options.lighting?.sunlightColor || 0xffffff,
|
|
372
374
|
enableHemisphereLight: options.lighting?.enableHemisphereLight ?? preset.hemisphereIntensity > 0,
|
|
373
|
-
hemisphereSkyColor: options.lighting?.hemisphereSkyColor ??
|
|
375
|
+
hemisphereSkyColor: options.lighting?.hemisphereSkyColor ?? 0xdfe6ff,
|
|
374
376
|
hemisphereGroundColor: options.lighting?.hemisphereGroundColor ?? 7036754,
|
|
375
377
|
hemisphereIntensity: options.lighting?.hemisphereIntensity ?? preset.hemisphereIntensity
|
|
376
378
|
},
|
|
377
379
|
environment: {
|
|
378
380
|
hdrPath: options.environment?.hdrPath === false ? false : options.environment?.hdrPath || "/baseHDR.hdr",
|
|
379
|
-
backgroundColor: options.environment?.backgroundColor || new THREE.Color(
|
|
381
|
+
backgroundColor: options.environment?.backgroundColor || new THREE.Color(0xf0f0f0),
|
|
380
382
|
enableEnvironmentLighting: options.environment?.enableEnvironmentLighting ?? true,
|
|
381
383
|
sceneUp: options.environment?.sceneUp || defaultUp,
|
|
382
384
|
showEnvironment: options.environment?.showEnvironment ?? false,
|
|
@@ -415,7 +417,7 @@ function applyDefaults(options) {
|
|
|
415
417
|
enableZoom: options.controls?.enableZoom ?? true,
|
|
416
418
|
enablePan: options.controls?.enablePan ?? true,
|
|
417
419
|
minDistance: options.controls?.minDistance || defaults.minDistance,
|
|
418
|
-
maxDistance: options.controls?.maxDistance ||
|
|
420
|
+
maxDistance: options.controls?.maxDistance || 1e400
|
|
419
421
|
},
|
|
420
422
|
grid: {
|
|
421
423
|
enabled: options.grid?.enabled ?? false,
|
|
@@ -596,7 +598,7 @@ function setupLighting(scene, config) {
|
|
|
596
598
|
hemisphere,
|
|
597
599
|
sun: null
|
|
598
600
|
};
|
|
599
|
-
const sunlight = new THREE.DirectionalLight(config.lighting.sunlightColor ??
|
|
601
|
+
const sunlight = new THREE.DirectionalLight(config.lighting.sunlightColor ?? 0xffffff, config.lighting.sunlightIntensity);
|
|
600
602
|
const pos = config.lighting.sunlightPosition;
|
|
601
603
|
if (pos) sunlight.position.set(pos.x, pos.y, pos.z);
|
|
602
604
|
if (!config.render.enableShadows) {
|
|
@@ -1010,7 +1012,7 @@ const SPACING_PERCENTILE = .15;
|
|
|
1010
1012
|
const SPACING_SAMPLE_LIMIT = 4096;
|
|
1011
1013
|
function edgeSpacingOf(segments) {
|
|
1012
1014
|
const segmentCount = Math.floor(segments.length / 6);
|
|
1013
|
-
if (segmentCount === 0) return
|
|
1015
|
+
if (segmentCount === 0) return 1e400;
|
|
1014
1016
|
const stride = Math.max(1, Math.ceil(segmentCount / SPACING_SAMPLE_LIMIT));
|
|
1015
1017
|
const lengths = [];
|
|
1016
1018
|
for (let s = 0; s < segmentCount; s += stride) {
|
|
@@ -1018,7 +1020,7 @@ function edgeSpacingOf(segments) {
|
|
|
1018
1020
|
const length = Math.hypot(segments[i + 3] - segments[i], segments[i + 4] - segments[i + 1], segments[i + 5] - segments[i + 2]);
|
|
1019
1021
|
if (length > 0) lengths.push(length);
|
|
1020
1022
|
}
|
|
1021
|
-
if (lengths.length === 0) return
|
|
1023
|
+
if (lengths.length === 0) return 1e400;
|
|
1022
1024
|
lengths.sort((a, b) => a - b);
|
|
1023
1025
|
return lengths[Math.min(lengths.length - 1, Math.floor(lengths.length * SPACING_PERCENTILE))];
|
|
1024
1026
|
}
|
|
@@ -1286,7 +1288,7 @@ function fastPathData(geometry) {
|
|
|
1286
1288
|
}
|
|
1287
1289
|
function contentKey(data, thresholdAngle) {
|
|
1288
1290
|
const SAMPLE_WORDS = 4096;
|
|
1289
|
-
let hash =
|
|
1291
|
+
let hash = 0x811c9dc5;
|
|
1290
1292
|
const mix = (word) => {
|
|
1291
1293
|
hash ^= word;
|
|
1292
1294
|
hash = Math.imul(hash, 16777619);
|
|
@@ -1607,22 +1609,22 @@ const _fadeCameraPos = new THREE.Vector3();
|
|
|
1607
1609
|
function pixelsPerWorldUnit(overlay, camera, viewportHeightPx) {
|
|
1608
1610
|
if (!overlay.geometry.boundingSphere) overlay.geometry.computeBoundingSphere();
|
|
1609
1611
|
const sphere = overlay.geometry.boundingSphere;
|
|
1610
|
-
if (!sphere) return
|
|
1612
|
+
if (!sphere) return 1e400;
|
|
1611
1613
|
if (camera.isPerspectiveCamera) {
|
|
1612
1614
|
const perspective = camera;
|
|
1613
1615
|
_fadeCenter.copy(sphere.center).applyMatrix4(overlay.matrixWorld);
|
|
1614
1616
|
const distance = _fadeCameraPos.setFromMatrixPosition(camera.matrixWorld).distanceTo(_fadeCenter);
|
|
1615
|
-
if (distance <= sphere.radius * overlay.matrixWorld.getMaxScaleOnAxis()) return
|
|
1617
|
+
if (distance <= sphere.radius * overlay.matrixWorld.getMaxScaleOnAxis()) return 1e400;
|
|
1616
1618
|
const tanHalfFov = Math.tan(THREE.MathUtils.degToRad(perspective.fov) * .5);
|
|
1617
1619
|
const worldHeightAtCentre = 2 * distance * tanHalfFov;
|
|
1618
|
-
return worldHeightAtCentre > 0 ? viewportHeightPx / worldHeightAtCentre :
|
|
1620
|
+
return worldHeightAtCentre > 0 ? viewportHeightPx / worldHeightAtCentre : 1e400;
|
|
1619
1621
|
}
|
|
1620
1622
|
if (camera.isOrthographicCamera) {
|
|
1621
1623
|
const ortho = camera;
|
|
1622
1624
|
const worldHeight = (ortho.top - ortho.bottom) / ortho.zoom;
|
|
1623
|
-
return worldHeight > 0 ? viewportHeightPx / worldHeight :
|
|
1625
|
+
return worldHeight > 0 ? viewportHeightPx / worldHeight : 1e400;
|
|
1624
1626
|
}
|
|
1625
|
-
return
|
|
1627
|
+
return 1e400;
|
|
1626
1628
|
}
|
|
1627
1629
|
function enableDistanceFade(overlay, edgeSpacing) {
|
|
1628
1630
|
overlay.onBeforeRender = (renderer, _scene, camera) => {
|
|
@@ -2064,7 +2066,7 @@ function warmPickIndex(root) {
|
|
|
2064
2066
|
}
|
|
2065
2067
|
// src/render/measure.ts
|
|
2066
2068
|
const DEFAULT_SNAP_PIXELS = 12;
|
|
2067
|
-
const DEFAULT_COLOR =
|
|
2069
|
+
const DEFAULT_COLOR = 0xffcc00;
|
|
2068
2070
|
const LINE_PICK_FRACTION = .015;
|
|
2069
2071
|
const RENDER_ORDER_LINE = 998;
|
|
2070
2072
|
const RENDER_ORDER_MARKER = 999;
|
|
@@ -2556,7 +2558,7 @@ function createNearestDepthQuery() {
|
|
|
2556
2558
|
const singleBox = /* @__PURE__ */ new Float32Array(6);
|
|
2557
2559
|
let polygon = /* @__PURE__ */ new Float64Array(21);
|
|
2558
2560
|
let clipped = /* @__PURE__ */ new Float64Array(21);
|
|
2559
|
-
let nearest =
|
|
2561
|
+
let nearest = 1e400;
|
|
2560
2562
|
let sawContent = false;
|
|
2561
2563
|
const chunksOf = (object, geometry) => {
|
|
2562
2564
|
const position = geometry.getAttribute("position");
|
|
@@ -2577,7 +2579,7 @@ function createNearestDepthQuery() {
|
|
|
2577
2579
|
const chunkDepth = (chunks, chunk, planes) => {
|
|
2578
2580
|
const { position, index } = chunks;
|
|
2579
2581
|
const indices = index?.array;
|
|
2580
|
-
let best =
|
|
2582
|
+
let best = 1e400;
|
|
2581
2583
|
for (let t = chunks.ranges[chunk * 2]; t < chunks.ranges[chunk * 2 + 1]; t++) {
|
|
2582
2584
|
for (let corner = 0; corner < 3; corner++) {
|
|
2583
2585
|
const v = indices ? indices[t * 3 + corner] : t * 3 + corner;
|
|
@@ -2710,7 +2712,7 @@ function createNearestDepthQuery() {
|
|
|
2710
2712
|
worldPlanes[17] = forward.y;
|
|
2711
2713
|
worldPlanes[18] = forward.z;
|
|
2712
2714
|
worldPlanes[19] = -forward.dot(camera.position);
|
|
2713
|
-
nearest =
|
|
2715
|
+
nearest = 1e400;
|
|
2714
2716
|
sawContent = false;
|
|
2715
2717
|
for (const child of scene.children) visit(child);
|
|
2716
2718
|
return sawContent ? nearest : null;
|
|
@@ -2758,12 +2760,12 @@ function buildChunkBoxes(position, index, breaks) {
|
|
|
2758
2760
|
const fast = plain && position.itemSize === 3 && !position.normalized;
|
|
2759
2761
|
const indices = index?.array;
|
|
2760
2762
|
for (let chunk = 0; chunk < chunkCount; chunk++) {
|
|
2761
|
-
let minX =
|
|
2762
|
-
let minY =
|
|
2763
|
-
let minZ =
|
|
2764
|
-
let maxX = -
|
|
2765
|
-
let maxY = -
|
|
2766
|
-
let maxZ = -
|
|
2763
|
+
let minX = 1e400;
|
|
2764
|
+
let minY = 1e400;
|
|
2765
|
+
let minZ = 1e400;
|
|
2766
|
+
let maxX = -1e400;
|
|
2767
|
+
let maxY = -1e400;
|
|
2768
|
+
let maxZ = -1e400;
|
|
2767
2769
|
const end = ranges[chunk * 2 + 1] * 3;
|
|
2768
2770
|
for (let corner = ranges[chunk * 2] * 3; corner < end; corner++) {
|
|
2769
2771
|
const v = indices ? indices[corner] : corner;
|
|
@@ -3110,8 +3112,8 @@ function createEmissiveLights(scene) {
|
|
|
3110
3112
|
const silenced = /* @__PURE__ */ new Set();
|
|
3111
3113
|
const offset = new THREE.Vector3();
|
|
3112
3114
|
const addLight = (shadowed) => {
|
|
3113
|
-
const key = new THREE.PointLight(
|
|
3114
|
-
const bounce = new THREE.PointLight(
|
|
3115
|
+
const key = new THREE.PointLight(0xffffff, 1, 0, 2);
|
|
3116
|
+
const bounce = new THREE.PointLight(0xffffff, 1, 0, 1);
|
|
3115
3117
|
if (shadowed) {
|
|
3116
3118
|
key.castShadow = true;
|
|
3117
3119
|
key.shadow.mapSize.setScalar(SHADOW_MAP_SIZE);
|
|
@@ -3245,7 +3247,7 @@ function applyMaterialOverride(material, override) {
|
|
|
3245
3247
|
return;
|
|
3246
3248
|
}
|
|
3247
3249
|
if (!target[BASELINE_KEY]) target[BASELINE_KEY] = {
|
|
3248
|
-
color: target.color?.getHex() ??
|
|
3250
|
+
color: target.color?.getHex() ?? 0xffffff,
|
|
3249
3251
|
metalness: target.metalness ?? 0,
|
|
3250
3252
|
roughness: target.roughness ?? 1,
|
|
3251
3253
|
emissiveIntensity: target.emissiveIntensity ?? 0,
|
|
@@ -3859,7 +3861,7 @@ function setupControls(camera, canvas, config) {
|
|
|
3859
3861
|
controls.enableZoom = config.controls.enableZoom ?? true;
|
|
3860
3862
|
controls.enablePan = config.controls.enablePan ?? true;
|
|
3861
3863
|
controls.minDistance = config.controls.minDistance || .001;
|
|
3862
|
-
controls.maxDistance = config.controls.maxDistance ||
|
|
3864
|
+
controls.maxDistance = config.controls.maxDistance || 1e400;
|
|
3863
3865
|
controls.screenSpacePanning = false;
|
|
3864
3866
|
controls.maxPolarAngle = Math.PI;
|
|
3865
3867
|
controls.update();
|