@selvajs/visualization 1.8.0-beta.7 → 1.8.0
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 +99 -53
- 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 +97 -52
- 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.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_gpu_dispose = require("./gpu-dispose-0c_-KS12.cjs");
|
|
4
|
-
const require_merged_draw = require("./merged-draw-ma_2r4N8.cjs");
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-CmQyd0Gu.cjs");
|
|
5
3
|
let three = require("three");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let three_addons_lines_LineGeometry_js = require("three/addons/lines/LineGeometry.js");
|
|
9
|
-
let three_addons_lines_LineMaterial_js = require("three/addons/lines/LineMaterial.js");
|
|
4
|
+
const require_gpu_dispose = require("./gpu-dispose--5MA0CcI.cjs");
|
|
5
|
+
const require_gpu_ownership = require("./gpu-ownership-BtECafMd.cjs");
|
|
10
6
|
let three_addons_lines_LineSegments2_js = require("three/addons/lines/LineSegments2.js");
|
|
11
7
|
let three_addons_lines_LineSegmentsGeometry_js = require("three/addons/lines/LineSegmentsGeometry.js");
|
|
8
|
+
const require_merged_draw = require("./merged-draw-C9jFRnos.cjs");
|
|
9
|
+
let three_addons_lines_LineMaterial_js = require("three/addons/lines/LineMaterial.js");
|
|
12
10
|
let three_addons_renderers_CSS2DRenderer_js = require("three/addons/renderers/CSS2DRenderer.js");
|
|
11
|
+
let three_addons_lines_Line2_js = require("three/addons/lines/Line2.js");
|
|
12
|
+
let three_addons_lines_LineGeometry_js = require("three/addons/lines/LineGeometry.js");
|
|
13
13
|
let three_mesh_bvh = require("three-mesh-bvh");
|
|
14
14
|
let three_addons_helpers_ViewHelper_js = require("three/addons/helpers/ViewHelper.js");
|
|
15
15
|
let three_addons_postprocessing_EffectComposer_js = require("three/addons/postprocessing/EffectComposer.js");
|
|
@@ -22,6 +22,7 @@ let three_addons_postprocessing_Pass_js = require("three/addons/postprocessing/P
|
|
|
22
22
|
let three_addons_postprocessing_UnrealBloomPass_js = require("three/addons/postprocessing/UnrealBloomPass.js");
|
|
23
23
|
let three_addons_controls_OrbitControls_js = require("three/addons/controls/OrbitControls.js");
|
|
24
24
|
let three_addons_loaders_HDRLoader_js = require("three/addons/loaders/HDRLoader.js");
|
|
25
|
+
three = require_rolldown_runtime.__toESM(three, 1);
|
|
25
26
|
// src/shared/types.ts
|
|
26
27
|
/** Source of truth for {@link Look} — lets consumers (e.g. a style picker) iterate instead of hardcoding names. */
|
|
27
28
|
const LOOKS = [
|
|
@@ -34,6 +35,36 @@ const LOOKS = [
|
|
|
34
35
|
"wireframe",
|
|
35
36
|
"night"
|
|
36
37
|
];
|
|
38
|
+
// src/render/fit.ts
|
|
39
|
+
/** Room left around a fitted box, as a factor on the tight distance. */
|
|
40
|
+
const FIT_MARGIN = 1.1;
|
|
41
|
+
/**
|
|
42
|
+
* How far from the box's center, along `direction` (target → camera), a perspective camera with
|
|
43
|
+
* vertical field of view `fovDegrees` and `aspect` must sit to see the whole box, with `margin`.
|
|
44
|
+
*
|
|
45
|
+
* Every corner is fitted across both the width and the height of the view. Fitting the box's
|
|
46
|
+
* largest side to the vertical field of view alone left a long part in a wide viewport filling a
|
|
47
|
+
* third of it.
|
|
48
|
+
*/
|
|
49
|
+
function fitDistance(box, direction, up, fovDegrees, aspect, margin = FIT_MARGIN) {
|
|
50
|
+
if (box.isEmpty()) return margin;
|
|
51
|
+
const dir = direction.clone().normalize();
|
|
52
|
+
const center = box.getCenter(new three.Vector3());
|
|
53
|
+
const tanV = Math.tan(fovDegrees * Math.PI / 360);
|
|
54
|
+
const tanH = tanV * (aspect > 0 && Number.isFinite(aspect) ? aspect : 1);
|
|
55
|
+
const right = new three.Vector3().crossVectors(up, dir);
|
|
56
|
+
if (right.lengthSq() < 1e-12) right.crossVectors(Math.abs(dir.x) < .9 ? new three.Vector3(1, 0, 0) : new three.Vector3(0, 1, 0), dir);
|
|
57
|
+
right.normalize();
|
|
58
|
+
const viewUp = new three.Vector3().crossVectors(dir, right).normalize();
|
|
59
|
+
const corner = new three.Vector3();
|
|
60
|
+
let distance = 0;
|
|
61
|
+
for (const x of [box.min.x, box.max.x]) for (const y of [box.min.y, box.max.y]) for (const z of [box.min.z, box.max.z]) {
|
|
62
|
+
corner.set(x, y, z).sub(center);
|
|
63
|
+
const depth = corner.dot(dir);
|
|
64
|
+
distance = Math.max(distance, Math.abs(corner.dot(right)) / tanH + depth, Math.abs(corner.dot(viewUp)) / tanV + depth);
|
|
65
|
+
}
|
|
66
|
+
return (distance || 1) * margin;
|
|
67
|
+
}
|
|
37
68
|
// src/render/scene-ownership.ts
|
|
38
69
|
/** Geometry produced by a solve. Replaced wholesale on the next one. */
|
|
39
70
|
const SOURCE_COMPUTE = "compute";
|
|
@@ -340,15 +371,15 @@ function applyDefaults(options) {
|
|
|
340
371
|
sunlightPosition: options.lighting?.sunlightPosition || sunOffset(options.environment?.sceneUp ?? defaultUp, defaults.lightDistance, defaults.lightHeight),
|
|
341
372
|
ambientLightColor: options.lighting?.ambientLightColor || new three.Color(4210752),
|
|
342
373
|
ambientLightIntensity: options.lighting?.ambientLightIntensity ?? preset.ambientIntensity,
|
|
343
|
-
sunlightColor: options.lighting?.sunlightColor ||
|
|
374
|
+
sunlightColor: options.lighting?.sunlightColor || 0xffffff,
|
|
344
375
|
enableHemisphereLight: options.lighting?.enableHemisphereLight ?? preset.hemisphereIntensity > 0,
|
|
345
|
-
hemisphereSkyColor: options.lighting?.hemisphereSkyColor ??
|
|
376
|
+
hemisphereSkyColor: options.lighting?.hemisphereSkyColor ?? 0xdfe6ff,
|
|
346
377
|
hemisphereGroundColor: options.lighting?.hemisphereGroundColor ?? 7036754,
|
|
347
378
|
hemisphereIntensity: options.lighting?.hemisphereIntensity ?? preset.hemisphereIntensity
|
|
348
379
|
},
|
|
349
380
|
environment: {
|
|
350
381
|
hdrPath: options.environment?.hdrPath === false ? false : options.environment?.hdrPath || "/baseHDR.hdr",
|
|
351
|
-
backgroundColor: options.environment?.backgroundColor || new three.Color(
|
|
382
|
+
backgroundColor: options.environment?.backgroundColor || new three.Color(0xf0f0f0),
|
|
352
383
|
enableEnvironmentLighting: options.environment?.enableEnvironmentLighting ?? true,
|
|
353
384
|
sceneUp: options.environment?.sceneUp || defaultUp,
|
|
354
385
|
showEnvironment: options.environment?.showEnvironment ?? false,
|
|
@@ -387,7 +418,7 @@ function applyDefaults(options) {
|
|
|
387
418
|
enableZoom: options.controls?.enableZoom ?? true,
|
|
388
419
|
enablePan: options.controls?.enablePan ?? true,
|
|
389
420
|
minDistance: options.controls?.minDistance || defaults.minDistance,
|
|
390
|
-
maxDistance: options.controls?.maxDistance ||
|
|
421
|
+
maxDistance: options.controls?.maxDistance || 1e400
|
|
391
422
|
},
|
|
392
423
|
grid: {
|
|
393
424
|
enabled: options.grid?.enabled ?? false,
|
|
@@ -568,7 +599,7 @@ function setupLighting(scene, config) {
|
|
|
568
599
|
hemisphere,
|
|
569
600
|
sun: null
|
|
570
601
|
};
|
|
571
|
-
const sunlight = new three.DirectionalLight(config.lighting.sunlightColor ??
|
|
602
|
+
const sunlight = new three.DirectionalLight(config.lighting.sunlightColor ?? 0xffffff, config.lighting.sunlightIntensity);
|
|
572
603
|
const pos = config.lighting.sunlightPosition;
|
|
573
604
|
if (pos) sunlight.position.set(pos.x, pos.y, pos.z);
|
|
574
605
|
if (!config.render.enableShadows) {
|
|
@@ -649,8 +680,7 @@ const CAMERA_CONFIG = {
|
|
|
649
680
|
HUGE: 100,
|
|
650
681
|
LARGE: 50,
|
|
651
682
|
NORMAL: 20
|
|
652
|
-
}
|
|
653
|
-
INITIAL_DISTANCE_MULTIPLIER: 4
|
|
683
|
+
}
|
|
654
684
|
};
|
|
655
685
|
/** Replaces scene content with `meshes`, rescales the camera frustum to fit, and (first call only) positions the camera/controls. */
|
|
656
686
|
function updateScene(scene, meshes, camera, controls, initialPositionSet) {
|
|
@@ -676,8 +706,9 @@ function updateScene(scene, meshes, camera, controls, initialPositionSet) {
|
|
|
676
706
|
}
|
|
677
707
|
camera.updateProjectionMatrix();
|
|
678
708
|
if (!initialPositionSet) {
|
|
679
|
-
const
|
|
680
|
-
|
|
709
|
+
const direction = isoOffset(camera.up, 1).normalize();
|
|
710
|
+
const distance = fitDistance(unionBoundingBox, direction, camera.up, camera.fov, camera.aspect);
|
|
711
|
+
camera.position.copy(center).addScaledVector(direction, distance);
|
|
681
712
|
controls.target.copy(center);
|
|
682
713
|
controls.update();
|
|
683
714
|
}
|
|
@@ -817,10 +848,19 @@ function createCameraController(deps) {
|
|
|
817
848
|
controls.update();
|
|
818
849
|
onActiveCameraChange(active());
|
|
819
850
|
};
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
851
|
+
let lastFit = null;
|
|
852
|
+
const forgetFit = () => {
|
|
853
|
+
lastFit = null;
|
|
854
|
+
};
|
|
855
|
+
controls.addEventListener?.("start", forgetFit);
|
|
856
|
+
const frame = (box, direction, animate) => {
|
|
857
|
+
const center = box.getCenter(new three.Vector3());
|
|
858
|
+
const dir = nudgeOffPole(direction, up).clone().normalize();
|
|
859
|
+
const distance = fitDistance(box, dir, up, perspective.fov, aspect);
|
|
860
|
+
lastFit = {
|
|
861
|
+
box: box.clone(),
|
|
862
|
+
direction: dir.clone()
|
|
863
|
+
};
|
|
824
864
|
const toPosition = center.clone().add(dir.clone().multiplyScalar(distance));
|
|
825
865
|
const cam = active();
|
|
826
866
|
if (projection === "orthographic") ortho.zoom = 1;
|
|
@@ -836,20 +876,15 @@ function createCameraController(deps) {
|
|
|
836
876
|
}
|
|
837
877
|
};
|
|
838
878
|
const setViewDirection = (direction, animate = true) => {
|
|
839
|
-
const
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
const maxDim = Math.max(size.x, size.y, size.z) || 1;
|
|
843
|
-
frame(center, maxDim, direction, animate);
|
|
879
|
+
const content = computeContentBounds(scene);
|
|
880
|
+
const box = content.isEmpty() ? new three.Box3().setFromCenterAndSize(controls.target.clone(), new three.Vector3(1, 1, 1)) : content;
|
|
881
|
+
frame(box, direction, animate);
|
|
844
882
|
};
|
|
845
883
|
const frameBounds = (box, animate = true) => {
|
|
846
884
|
if (box.isEmpty()) return;
|
|
847
|
-
const center = box.getCenter(new three.Vector3());
|
|
848
|
-
const size = box.getSize(new three.Vector3());
|
|
849
|
-
const maxDim = Math.max(size.x, size.y, size.z) || 1;
|
|
850
885
|
const direction = active().position.clone().sub(controls.target);
|
|
851
886
|
if (direction.lengthSq() < 1e-12) direction.copy(VIEW_DIRECTIONS.iso);
|
|
852
|
-
frame(
|
|
887
|
+
frame(box, direction.normalize(), animate);
|
|
853
888
|
};
|
|
854
889
|
const setView = (preset, animate = true) => {
|
|
855
890
|
setViewDirection(VIEW_DIRECTIONS[preset], animate);
|
|
@@ -870,6 +905,7 @@ function createCameraController(deps) {
|
|
|
870
905
|
const target = toVector(view.target);
|
|
871
906
|
if (position && target && position.distanceToSquared(target) > 1e-12) {
|
|
872
907
|
cancelTween();
|
|
908
|
+
forgetFit();
|
|
873
909
|
const cam = active();
|
|
874
910
|
if (projection === "orthographic") ortho.zoom = 1;
|
|
875
911
|
if (animate) {
|
|
@@ -892,7 +928,14 @@ function createCameraController(deps) {
|
|
|
892
928
|
controls.enableRotate = enabled;
|
|
893
929
|
};
|
|
894
930
|
const updateAspect = (width, height) => {
|
|
895
|
-
|
|
931
|
+
const next = height === 0 ? aspect : width / height;
|
|
932
|
+
const changed = Math.abs(next - aspect) > 1e-6;
|
|
933
|
+
aspect = next;
|
|
934
|
+
if (changed && lastFit) {
|
|
935
|
+
const { box, direction } = lastFit;
|
|
936
|
+
frame(box, direction, false);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
896
939
|
if (projection === "orthographic") syncOrthoFrustum();
|
|
897
940
|
};
|
|
898
941
|
return {
|
|
@@ -911,7 +954,10 @@ function createCameraController(deps) {
|
|
|
911
954
|
setRotateEnabled,
|
|
912
955
|
isRotateEnabled: () => controls.enableRotate,
|
|
913
956
|
updateAspect,
|
|
914
|
-
dispose:
|
|
957
|
+
dispose: () => {
|
|
958
|
+
cancelTween();
|
|
959
|
+
controls.removeEventListener?.("start", forgetFit);
|
|
960
|
+
}
|
|
915
961
|
};
|
|
916
962
|
}
|
|
917
963
|
const rounded = (v) => [
|
|
@@ -967,7 +1013,7 @@ const SPACING_PERCENTILE = .15;
|
|
|
967
1013
|
const SPACING_SAMPLE_LIMIT = 4096;
|
|
968
1014
|
function edgeSpacingOf(segments) {
|
|
969
1015
|
const segmentCount = Math.floor(segments.length / 6);
|
|
970
|
-
if (segmentCount === 0) return
|
|
1016
|
+
if (segmentCount === 0) return 1e400;
|
|
971
1017
|
const stride = Math.max(1, Math.ceil(segmentCount / SPACING_SAMPLE_LIMIT));
|
|
972
1018
|
const lengths = [];
|
|
973
1019
|
for (let s = 0; s < segmentCount; s += stride) {
|
|
@@ -975,7 +1021,7 @@ function edgeSpacingOf(segments) {
|
|
|
975
1021
|
const length = Math.hypot(segments[i + 3] - segments[i], segments[i + 4] - segments[i + 1], segments[i + 5] - segments[i + 2]);
|
|
976
1022
|
if (length > 0) lengths.push(length);
|
|
977
1023
|
}
|
|
978
|
-
if (lengths.length === 0) return
|
|
1024
|
+
if (lengths.length === 0) return 1e400;
|
|
979
1025
|
lengths.sort((a, b) => a - b);
|
|
980
1026
|
return lengths[Math.min(lengths.length - 1, Math.floor(lengths.length * SPACING_PERCENTILE))];
|
|
981
1027
|
}
|
|
@@ -1243,7 +1289,7 @@ function fastPathData(geometry) {
|
|
|
1243
1289
|
}
|
|
1244
1290
|
function contentKey(data, thresholdAngle) {
|
|
1245
1291
|
const SAMPLE_WORDS = 4096;
|
|
1246
|
-
let hash =
|
|
1292
|
+
let hash = 0x811c9dc5;
|
|
1247
1293
|
const mix = (word) => {
|
|
1248
1294
|
hash ^= word;
|
|
1249
1295
|
hash = Math.imul(hash, 16777619);
|
|
@@ -1564,22 +1610,22 @@ const _fadeCameraPos = new three.Vector3();
|
|
|
1564
1610
|
function pixelsPerWorldUnit(overlay, camera, viewportHeightPx) {
|
|
1565
1611
|
if (!overlay.geometry.boundingSphere) overlay.geometry.computeBoundingSphere();
|
|
1566
1612
|
const sphere = overlay.geometry.boundingSphere;
|
|
1567
|
-
if (!sphere) return
|
|
1613
|
+
if (!sphere) return 1e400;
|
|
1568
1614
|
if (camera.isPerspectiveCamera) {
|
|
1569
1615
|
const perspective = camera;
|
|
1570
1616
|
_fadeCenter.copy(sphere.center).applyMatrix4(overlay.matrixWorld);
|
|
1571
1617
|
const distance = _fadeCameraPos.setFromMatrixPosition(camera.matrixWorld).distanceTo(_fadeCenter);
|
|
1572
|
-
if (distance <= sphere.radius * overlay.matrixWorld.getMaxScaleOnAxis()) return
|
|
1618
|
+
if (distance <= sphere.radius * overlay.matrixWorld.getMaxScaleOnAxis()) return 1e400;
|
|
1573
1619
|
const tanHalfFov = Math.tan(three.MathUtils.degToRad(perspective.fov) * .5);
|
|
1574
1620
|
const worldHeightAtCentre = 2 * distance * tanHalfFov;
|
|
1575
|
-
return worldHeightAtCentre > 0 ? viewportHeightPx / worldHeightAtCentre :
|
|
1621
|
+
return worldHeightAtCentre > 0 ? viewportHeightPx / worldHeightAtCentre : 1e400;
|
|
1576
1622
|
}
|
|
1577
1623
|
if (camera.isOrthographicCamera) {
|
|
1578
1624
|
const ortho = camera;
|
|
1579
1625
|
const worldHeight = (ortho.top - ortho.bottom) / ortho.zoom;
|
|
1580
|
-
return worldHeight > 0 ? viewportHeightPx / worldHeight :
|
|
1626
|
+
return worldHeight > 0 ? viewportHeightPx / worldHeight : 1e400;
|
|
1581
1627
|
}
|
|
1582
|
-
return
|
|
1628
|
+
return 1e400;
|
|
1583
1629
|
}
|
|
1584
1630
|
function enableDistanceFade(overlay, edgeSpacing) {
|
|
1585
1631
|
overlay.onBeforeRender = (renderer, _scene, camera) => {
|
|
@@ -2021,7 +2067,7 @@ function warmPickIndex(root) {
|
|
|
2021
2067
|
}
|
|
2022
2068
|
// src/render/measure.ts
|
|
2023
2069
|
const DEFAULT_SNAP_PIXELS = 12;
|
|
2024
|
-
const DEFAULT_COLOR =
|
|
2070
|
+
const DEFAULT_COLOR = 0xffcc00;
|
|
2025
2071
|
const LINE_PICK_FRACTION = .015;
|
|
2026
2072
|
const RENDER_ORDER_LINE = 998;
|
|
2027
2073
|
const RENDER_ORDER_MARKER = 999;
|
|
@@ -2513,7 +2559,7 @@ function createNearestDepthQuery() {
|
|
|
2513
2559
|
const singleBox = /* @__PURE__ */ new Float32Array(6);
|
|
2514
2560
|
let polygon = /* @__PURE__ */ new Float64Array(21);
|
|
2515
2561
|
let clipped = /* @__PURE__ */ new Float64Array(21);
|
|
2516
|
-
let nearest =
|
|
2562
|
+
let nearest = 1e400;
|
|
2517
2563
|
let sawContent = false;
|
|
2518
2564
|
const chunksOf = (object, geometry) => {
|
|
2519
2565
|
const position = geometry.getAttribute("position");
|
|
@@ -2534,7 +2580,7 @@ function createNearestDepthQuery() {
|
|
|
2534
2580
|
const chunkDepth = (chunks, chunk, planes) => {
|
|
2535
2581
|
const { position, index } = chunks;
|
|
2536
2582
|
const indices = index?.array;
|
|
2537
|
-
let best =
|
|
2583
|
+
let best = 1e400;
|
|
2538
2584
|
for (let t = chunks.ranges[chunk * 2]; t < chunks.ranges[chunk * 2 + 1]; t++) {
|
|
2539
2585
|
for (let corner = 0; corner < 3; corner++) {
|
|
2540
2586
|
const v = indices ? indices[t * 3 + corner] : t * 3 + corner;
|
|
@@ -2667,7 +2713,7 @@ function createNearestDepthQuery() {
|
|
|
2667
2713
|
worldPlanes[17] = forward.y;
|
|
2668
2714
|
worldPlanes[18] = forward.z;
|
|
2669
2715
|
worldPlanes[19] = -forward.dot(camera.position);
|
|
2670
|
-
nearest =
|
|
2716
|
+
nearest = 1e400;
|
|
2671
2717
|
sawContent = false;
|
|
2672
2718
|
for (const child of scene.children) visit(child);
|
|
2673
2719
|
return sawContent ? nearest : null;
|
|
@@ -2715,12 +2761,12 @@ function buildChunkBoxes(position, index, breaks) {
|
|
|
2715
2761
|
const fast = plain && position.itemSize === 3 && !position.normalized;
|
|
2716
2762
|
const indices = index?.array;
|
|
2717
2763
|
for (let chunk = 0; chunk < chunkCount; chunk++) {
|
|
2718
|
-
let minX =
|
|
2719
|
-
let minY =
|
|
2720
|
-
let minZ =
|
|
2721
|
-
let maxX = -
|
|
2722
|
-
let maxY = -
|
|
2723
|
-
let maxZ = -
|
|
2764
|
+
let minX = 1e400;
|
|
2765
|
+
let minY = 1e400;
|
|
2766
|
+
let minZ = 1e400;
|
|
2767
|
+
let maxX = -1e400;
|
|
2768
|
+
let maxY = -1e400;
|
|
2769
|
+
let maxZ = -1e400;
|
|
2724
2770
|
const end = ranges[chunk * 2 + 1] * 3;
|
|
2725
2771
|
for (let corner = ranges[chunk * 2] * 3; corner < end; corner++) {
|
|
2726
2772
|
const v = indices ? indices[corner] : corner;
|
|
@@ -3067,8 +3113,8 @@ function createEmissiveLights(scene) {
|
|
|
3067
3113
|
const silenced = /* @__PURE__ */ new Set();
|
|
3068
3114
|
const offset = new three.Vector3();
|
|
3069
3115
|
const addLight = (shadowed) => {
|
|
3070
|
-
const key = new three.PointLight(
|
|
3071
|
-
const bounce = new three.PointLight(
|
|
3116
|
+
const key = new three.PointLight(0xffffff, 1, 0, 2);
|
|
3117
|
+
const bounce = new three.PointLight(0xffffff, 1, 0, 1);
|
|
3072
3118
|
if (shadowed) {
|
|
3073
3119
|
key.castShadow = true;
|
|
3074
3120
|
key.shadow.mapSize.setScalar(SHADOW_MAP_SIZE);
|
|
@@ -3202,7 +3248,7 @@ function applyMaterialOverride(material, override) {
|
|
|
3202
3248
|
return;
|
|
3203
3249
|
}
|
|
3204
3250
|
if (!target[BASELINE_KEY]) target[BASELINE_KEY] = {
|
|
3205
|
-
color: target.color?.getHex() ??
|
|
3251
|
+
color: target.color?.getHex() ?? 0xffffff,
|
|
3206
3252
|
metalness: target.metalness ?? 0,
|
|
3207
3253
|
roughness: target.roughness ?? 1,
|
|
3208
3254
|
emissiveIntensity: target.emissiveIntensity ?? 0,
|
|
@@ -3816,7 +3862,7 @@ function setupControls(camera, canvas, config) {
|
|
|
3816
3862
|
controls.enableZoom = config.controls.enableZoom ?? true;
|
|
3817
3863
|
controls.enablePan = config.controls.enablePan ?? true;
|
|
3818
3864
|
controls.minDistance = config.controls.minDistance || .001;
|
|
3819
|
-
controls.maxDistance = config.controls.maxDistance ||
|
|
3865
|
+
controls.maxDistance = config.controls.maxDistance || 1e400;
|
|
3820
3866
|
controls.screenSpacePanning = false;
|
|
3821
3867
|
controls.maxPolarAngle = Math.PI;
|
|
3822
3868
|
controls.update();
|