@pascal-app/viewer 1.0.3 → 1.0.5
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/capture/capture-runtime.js +1 -1
- package/dist/components/error-boundary.d.ts.map +1 -1
- package/dist/components/renderers/node-renderer.d.ts +1 -1
- package/dist/components/renderers/node-renderer.d.ts.map +1 -1
- package/dist/components/renderers/node-renderer.js +12 -4
- package/dist/components/renderers/parametric-node-renderer.d.ts.map +1 -1
- package/dist/components/viewer/bvh-ecctrl.d.ts.map +1 -1
- package/dist/components/viewer/frame-limiter.d.ts +1 -0
- package/dist/components/viewer/frame-limiter.d.ts.map +1 -1
- package/dist/components/viewer/frame-limiter.js +22 -3
- package/dist/components/viewer/glb-interactive.d.ts +25 -1
- package/dist/components/viewer/glb-interactive.d.ts.map +1 -1
- package/dist/components/viewer/glb-interactive.js +253 -86
- package/dist/components/viewer/glb-mechanisms.d.ts +10 -0
- package/dist/components/viewer/glb-mechanisms.d.ts.map +1 -0
- package/dist/components/viewer/glb-mechanisms.js +19 -0
- package/dist/components/viewer/glb-reference-nodes.js +1 -1
- package/dist/components/viewer/glb-replace-instances.js +1 -1
- package/dist/components/viewer/glb-scene.d.ts +45 -27
- package/dist/components/viewer/glb-scene.d.ts.map +1 -1
- package/dist/components/viewer/glb-scene.js +421 -508
- package/dist/components/viewer/glb-walkthrough-controller.d.ts +1 -1
- package/dist/components/viewer/glb-walkthrough-controller.d.ts.map +1 -1
- package/dist/components/viewer/glb-walkthrough-controller.js +13 -2
- package/dist/components/viewer/index.d.ts +24 -1
- package/dist/components/viewer/index.d.ts.map +1 -1
- package/dist/components/viewer/index.js +111 -37
- package/dist/components/viewer/lights.d.ts.map +1 -1
- package/dist/components/viewer/lights.js +113 -22
- package/dist/components/viewer/perf-monitor.d.ts.map +1 -1
- package/dist/components/viewer/perf-monitor.js +6 -0
- package/dist/components/viewer/perf-panel.d.ts.map +1 -1
- package/dist/components/viewer/perf-panel.js +1 -1
- package/dist/components/viewer/post-processing.d.ts.map +1 -1
- package/dist/components/viewer/post-processing.js +104 -36
- package/dist/components/viewer/registered-systems.d.ts.map +1 -1
- package/dist/components/viewer/registered-systems.js +17 -3
- package/dist/components/viewer/render-error.d.ts +18 -0
- package/dist/components/viewer/render-error.d.ts.map +1 -0
- package/dist/components/viewer/render-error.js +29 -0
- package/dist/components/viewer/scene-bvh.d.ts.map +1 -1
- package/dist/components/viewer/scene-bvh.js +1 -1
- package/dist/components/viewer/scene-environment.d.ts.map +1 -1
- package/dist/components/viewer/scene-environment.js +31 -11
- package/dist/components/viewer/scene-ground-replacement.d.ts +6 -0
- package/dist/components/viewer/scene-ground-replacement.d.ts.map +1 -1
- package/dist/components/viewer/scene-ground-replacement.js +15 -0
- package/dist/components/viewer/selection-manager.d.ts.map +1 -1
- package/dist/components/viewer/selection-manager.js +25 -7
- package/dist/components/viewer/underground-ambiance.d.ts +9 -0
- package/dist/components/viewer/underground-ambiance.d.ts.map +1 -0
- package/dist/components/viewer/underground-ambiance.js +105 -0
- package/dist/components/viewer/viewer-camera.d.ts +4 -0
- package/dist/components/viewer/viewer-camera.d.ts.map +1 -1
- package/dist/components/viewer/viewer-camera.js +12 -2
- package/dist/components/viewer/viewer-presentations.d.ts.map +1 -1
- package/dist/hooks/use-gltf-ktx2.d.ts.map +1 -1
- package/dist/hooks/use-gltf-ktx2.js +2 -0
- package/dist/hooks/use-node-events.d.ts.map +1 -1
- package/dist/index.d.ts +36 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -19
- package/dist/lib/asset-url.d.ts.map +1 -1
- package/dist/lib/asset-url.js +7 -1
- package/dist/lib/backdrop.d.ts +17 -0
- package/dist/lib/backdrop.d.ts.map +1 -1
- package/dist/lib/backdrop.js +18 -1
- package/dist/lib/construction-dust.d.ts +57 -0
- package/dist/lib/construction-dust.d.ts.map +1 -0
- package/dist/lib/construction-dust.js +187 -0
- package/dist/lib/csg-utils.js +1 -1
- package/dist/lib/display-state.d.ts +25 -0
- package/dist/lib/display-state.d.ts.map +1 -0
- package/dist/lib/display-state.js +1 -0
- package/dist/lib/foundation-materials.d.ts +26 -0
- package/dist/lib/foundation-materials.d.ts.map +1 -0
- package/dist/lib/foundation-materials.js +65 -0
- package/dist/lib/gltf-unlit.d.ts +10 -0
- package/dist/lib/gltf-unlit.d.ts.map +1 -0
- package/dist/lib/gltf-unlit.js +23 -0
- package/dist/lib/ground-window.d.ts +33 -0
- package/dist/lib/ground-window.d.ts.map +1 -0
- package/dist/lib/ground-window.js +114 -0
- package/dist/lib/hero-pose.d.ts +13 -3
- package/dist/lib/hero-pose.d.ts.map +1 -1
- package/dist/lib/hero-pose.js +72 -5
- package/dist/lib/ink-edges.d.ts +6 -3
- package/dist/lib/ink-edges.d.ts.map +1 -1
- package/dist/lib/ink-edges.js +17 -7
- package/dist/lib/key-light-override.d.ts +11 -0
- package/dist/lib/key-light-override.d.ts.map +1 -0
- package/dist/lib/key-light-override.js +14 -0
- package/dist/lib/ktx2-loader.d.ts +7 -0
- package/dist/lib/ktx2-loader.d.ts.map +1 -1
- package/dist/lib/ktx2-loader.js +35 -0
- package/dist/lib/layer-pass.d.ts.map +1 -1
- package/dist/lib/layers.d.ts +11 -7
- package/dist/lib/layers.d.ts.map +1 -1
- package/dist/lib/layers.js +16 -6
- package/dist/lib/live-frame-hold.d.ts +14 -0
- package/dist/lib/live-frame-hold.d.ts.map +1 -0
- package/dist/lib/live-frame-hold.js +28 -0
- package/dist/lib/materials.d.ts +19 -7
- package/dist/lib/materials.d.ts.map +1 -1
- package/dist/lib/materials.js +65 -9
- package/dist/lib/merged-outline-node.d.ts +5 -0
- package/dist/lib/merged-outline-node.d.ts.map +1 -1
- package/dist/lib/merged-outline-node.js +80 -2
- package/dist/lib/node-top-surface-height.d.ts +6 -0
- package/dist/lib/node-top-surface-height.d.ts.map +1 -0
- package/dist/lib/node-top-surface-height.js +74 -0
- package/dist/lib/perf-probe-state.d.ts +39 -0
- package/dist/lib/perf-probe-state.d.ts.map +1 -0
- package/dist/lib/perf-probe-state.js +17 -0
- package/dist/lib/pointer-events.d.ts +26 -2
- package/dist/lib/pointer-events.d.ts.map +1 -1
- package/dist/lib/pointer-events.js +99 -12
- package/dist/lib/post-processing-resources.d.ts.map +1 -1
- package/dist/lib/procedural-emission.d.ts +7 -0
- package/dist/lib/procedural-emission.d.ts.map +1 -0
- package/dist/lib/procedural-emission.js +54 -0
- package/dist/lib/reveal-candidates.d.ts +80 -0
- package/dist/lib/reveal-candidates.d.ts.map +1 -0
- package/dist/lib/reveal-candidates.js +524 -0
- package/dist/lib/reveal-ghost.d.ts +9 -0
- package/dist/lib/reveal-ghost.d.ts.map +1 -0
- package/dist/lib/reveal-ghost.js +62 -0
- package/dist/lib/reveal-pending.d.ts +12 -0
- package/dist/lib/reveal-pending.d.ts.map +1 -0
- package/dist/lib/reveal-pending.js +12 -0
- package/dist/lib/reveal-pose.d.ts +70 -0
- package/dist/lib/reveal-pose.d.ts.map +1 -0
- package/dist/lib/reveal-pose.js +248 -0
- package/dist/lib/reveal-schedule.d.ts +208 -0
- package/dist/lib/reveal-schedule.d.ts.map +1 -0
- package/dist/lib/reveal-schedule.js +410 -0
- package/dist/lib/reveal-texture-scale.d.ts +5 -0
- package/dist/lib/reveal-texture-scale.d.ts.map +1 -0
- package/dist/lib/reveal-texture-scale.js +113 -0
- package/dist/lib/reveal-windows.d.ts +23 -0
- package/dist/lib/reveal-windows.d.ts.map +1 -0
- package/dist/lib/reveal-windows.js +31 -0
- package/dist/lib/reveal-wipe.d.ts +71 -0
- package/dist/lib/reveal-wipe.d.ts.map +1 -0
- package/dist/lib/reveal-wipe.js +105 -0
- package/dist/lib/scene-pass-mrt.d.ts +12 -0
- package/dist/lib/scene-pass-mrt.d.ts.map +1 -0
- package/dist/lib/scene-pass-mrt.js +23 -0
- package/dist/lib/scene-support-height.d.ts +4 -0
- package/dist/lib/scene-support-height.d.ts.map +1 -0
- package/dist/lib/scene-support-height.js +34 -0
- package/dist/lib/scene-themes.d.ts +30 -8
- package/dist/lib/scene-themes.d.ts.map +1 -1
- package/dist/lib/scene-themes.js +36 -0
- package/dist/lib/scene-visibility.d.ts +17 -1
- package/dist/lib/scene-visibility.d.ts.map +1 -1
- package/dist/lib/scene-visibility.js +53 -3
- package/dist/lib/scripted-opening.d.ts +11 -0
- package/dist/lib/scripted-opening.d.ts.map +1 -0
- package/dist/lib/scripted-opening.js +20 -0
- package/dist/lib/site-surfaces.d.ts +32 -0
- package/dist/lib/site-surfaces.d.ts.map +1 -0
- package/dist/lib/site-surfaces.js +70 -0
- package/dist/lib/snapshot-pipeline.d.ts +34 -3
- package/dist/lib/snapshot-pipeline.d.ts.map +1 -1
- package/dist/lib/snapshot-pipeline.js +247 -117
- package/dist/lib/terrain-perimeter-fill.d.ts.map +1 -1
- package/dist/lib/terrain-perimeter-fill.js +22 -14
- package/dist/lib/tsl-compat.d.ts +2 -2
- package/dist/lib/tsl-compat.d.ts.map +1 -1
- package/dist/lib/underground-ambiance.d.ts +168 -0
- package/dist/lib/underground-ambiance.d.ts.map +1 -0
- package/dist/lib/underground-ambiance.js +334 -0
- package/dist/lib/zone-geometry.d.ts +11 -0
- package/dist/lib/zone-geometry.d.ts.map +1 -0
- package/dist/lib/zone-geometry.js +46 -0
- package/dist/store/use-item-light-pool.d.ts +14 -10
- package/dist/store/use-item-light-pool.d.ts.map +1 -1
- package/dist/store/use-item-light-pool.js +52 -26
- package/dist/store/use-viewer.d.ts +194 -26
- package/dist/store/use-viewer.d.ts.map +1 -1
- package/dist/store/use-viewer.js +164 -21
- package/dist/systems/ceiling/ceiling-system.d.ts +15 -1
- package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
- package/dist/systems/ceiling/ceiling-system.js +88 -6
- package/dist/systems/construction-reveal/construction-dust.d.ts +16 -0
- package/dist/systems/construction-reveal/construction-dust.d.ts.map +1 -0
- package/dist/systems/construction-reveal/construction-dust.js +92 -0
- package/dist/systems/construction-reveal/construction-reveal.d.ts +276 -0
- package/dist/systems/construction-reveal/construction-reveal.d.ts.map +1 -0
- package/dist/systems/construction-reveal/construction-reveal.js +2383 -0
- package/dist/systems/construction-reveal/dust-material.d.ts +10 -0
- package/dist/systems/construction-reveal/dust-material.d.ts.map +1 -0
- package/dist/systems/construction-reveal/dust-material.js +17 -0
- package/dist/systems/construction-reveal/ghost-dress.d.ts +10 -0
- package/dist/systems/construction-reveal/ghost-dress.d.ts.map +1 -0
- package/dist/systems/construction-reveal/ghost-dress.js +24 -0
- package/dist/systems/door/door-system.d.ts.map +1 -1
- package/dist/systems/door/door-system.js +55 -17
- package/dist/systems/elevator/elevator-interaction-system.d.ts +7 -0
- package/dist/systems/elevator/elevator-interaction-system.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-interaction-system.js +18 -1
- package/dist/systems/floor-elevation/floor-elevation-system.d.ts +3 -1
- package/dist/systems/floor-elevation/floor-elevation-system.d.ts.map +1 -1
- package/dist/systems/floor-elevation/floor-elevation-system.js +33 -5
- package/dist/systems/geometry/geometry-system.d.ts.map +1 -1
- package/dist/systems/geometry/geometry-system.js +71 -11
- package/dist/systems/interactive/control-widget.d.ts.map +1 -1
- package/dist/systems/interactive/interactive-system.d.ts.map +1 -1
- package/dist/systems/interactive/interactive-system.js +52 -17
- package/dist/systems/interactive/procedural-controls.d.ts +13 -0
- package/dist/systems/interactive/procedural-controls.d.ts.map +1 -0
- package/dist/systems/interactive/procedural-controls.js +17 -0
- package/dist/systems/interactive/scripted-clips.d.ts +19 -0
- package/dist/systems/interactive/scripted-clips.d.ts.map +1 -0
- package/dist/systems/interactive/scripted-clips.js +134 -0
- package/dist/systems/item/item-system.d.ts.map +1 -1
- package/dist/systems/item/item-system.js +9 -3
- package/dist/systems/item/object-cut-invalidation.d.ts +3 -0
- package/dist/systems/item/object-cut-invalidation.d.ts.map +1 -0
- package/dist/systems/item/object-cut-invalidation.js +68 -0
- package/dist/systems/item-light/item-light-system.d.ts +1 -1
- package/dist/systems/item-light/item-light-system.d.ts.map +1 -1
- package/dist/systems/item-light/item-light-system.js +48 -53
- package/dist/systems/level/level-hold.d.ts +4 -0
- package/dist/systems/level/level-hold.d.ts.map +1 -0
- package/dist/systems/level/level-hold.js +14 -0
- package/dist/systems/level/level-system.d.ts.map +1 -1
- package/dist/systems/level/level-system.js +19 -6
- package/dist/systems/level/level-utils.d.ts +19 -6
- package/dist/systems/level/level-utils.d.ts.map +1 -1
- package/dist/systems/level/level-utils.js +68 -9
- package/dist/systems/level/shadow-only-levels.d.ts +9 -0
- package/dist/systems/level/shadow-only-levels.d.ts.map +1 -0
- package/dist/systems/level/shadow-only-levels.js +7 -0
- package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts +103 -0
- package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts.map +1 -0
- package/dist/systems/roof/__fixtures__/roof-plane-cases.js +317 -0
- package/dist/systems/roof/roof-materials.d.ts +16 -2
- package/dist/systems/roof/roof-materials.d.ts.map +1 -1
- package/dist/systems/roof/roof-materials.js +64 -31
- package/dist/systems/roof/roof-system.d.ts +21 -4
- package/dist/systems/roof/roof-system.d.ts.map +1 -1
- package/dist/systems/roof/roof-system.js +374 -49
- package/dist/systems/slab/slab-system.d.ts +1 -1
- package/dist/systems/slab/slab-system.d.ts.map +1 -1
- package/dist/systems/slab/slab-system.js +49 -19
- package/dist/systems/stair/stair-system.d.ts.map +1 -1
- package/dist/systems/stair/stair-system.js +133 -354
- package/dist/systems/wall/wall-cutout-cache.d.ts +39 -3
- package/dist/systems/wall/wall-cutout-cache.d.ts.map +1 -1
- package/dist/systems/wall/wall-cutout-cache.js +141 -19
- package/dist/systems/wall/wall-cutout.d.ts +6 -0
- package/dist/systems/wall/wall-cutout.d.ts.map +1 -1
- package/dist/systems/wall/wall-cutout.js +42 -28
- package/dist/systems/wall/wall-finish-data.d.ts +22 -0
- package/dist/systems/wall/wall-finish-data.d.ts.map +1 -0
- package/dist/systems/wall/wall-finish-data.js +17 -0
- package/dist/systems/wall/wall-material-variant.d.ts.map +1 -1
- package/dist/systems/wall/wall-materials.d.ts +9 -4
- package/dist/systems/wall/wall-materials.d.ts.map +1 -1
- package/dist/systems/wall/wall-materials.js +135 -153
- package/dist/systems/wall/wall-placeholder-sweep.d.ts.map +1 -1
- package/dist/systems/wall/wall-system.d.ts +33 -2
- package/dist/systems/wall/wall-system.d.ts.map +1 -1
- package/dist/systems/wall/wall-system.js +621 -159
- package/dist/systems/window/corner-frame.d.ts +10 -0
- package/dist/systems/window/corner-frame.d.ts.map +1 -0
- package/dist/systems/window/corner-frame.js +17 -0
- package/dist/systems/window/window-system.d.ts +1 -1
- package/dist/systems/window/window-system.d.ts.map +1 -1
- package/dist/systems/window/window-system.js +71 -27
- package/package.json +10 -10
- package/dist/systems/fence/fence-system.d.ts +0 -22
- package/dist/systems/fence/fence-system.d.ts.map +0 -1
- package/dist/systems/fence/fence-system.js +0 -357
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*
|
|
24
|
-
* Vendored from R3F 9.
|
|
25
|
-
* https://raw.githubusercontent.com/pmndrs/react-three-fiber/v9.
|
|
24
|
+
* Vendored from R3F 9.8.2:
|
|
25
|
+
* https://raw.githubusercontent.com/pmndrs/react-three-fiber/v9.8.2/packages/fiber/src/core/events.ts
|
|
26
26
|
* Ray collection is cached; camera-drag moves are throttled before stock dispatch.
|
|
27
27
|
* The throttle is a vendored-manager policy; dev ?stockEvents uses untouched R3F.
|
|
28
28
|
*/
|
|
29
|
+
import { sceneRegistry, useScene } from '@pascal-app/core';
|
|
29
30
|
import { events as createWebEvents, getRootState, } from '@react-three/fiber';
|
|
30
31
|
import * as THREE from 'three';
|
|
31
32
|
import { acceleratedRaycast } from 'three-mesh-bvh';
|
|
@@ -61,10 +62,10 @@ function isSupportedRaycast(raycast) {
|
|
|
61
62
|
supportedRaycasts.has(raycast) ||
|
|
62
63
|
raycast[pureRaycast] === true);
|
|
63
64
|
}
|
|
64
|
-
export function choosePointerEvents(search = typeof window !== 'undefined' ? window.location.search : '') {
|
|
65
|
+
export function choosePointerEvents(search = typeof window !== 'undefined' ? window.location.search : '', onBreadcrumb) {
|
|
65
66
|
return process.env.NODE_ENV !== 'production' && new URLSearchParams(search).has('stockEvents')
|
|
66
67
|
? createWebEvents
|
|
67
|
-
: createPascalPointerEvents;
|
|
68
|
+
: (store) => createPascalPointerEvents(store, onBreadcrumb);
|
|
68
69
|
}
|
|
69
70
|
function querySnapshot(raycaster) {
|
|
70
71
|
if (Object.getPrototypeOf(raycaster) !== THREE.Raycaster.prototype ||
|
|
@@ -112,10 +113,92 @@ function querySnapshot(raycaster) {
|
|
|
112
113
|
}
|
|
113
114
|
return snapshot;
|
|
114
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Whether a mesh has a material for everything a raycast reads: three indexes
|
|
118
|
+
* a material array by each geometry group, and one with no entry throws on
|
|
119
|
+
* `material.side`. A mesh caught mid-swap (a preview restored an older array
|
|
120
|
+
* over a rebuilt geometry) is skipped for this move instead of taking the whole
|
|
121
|
+
* pointer event down; its children are still tested. `material` asks the same of
|
|
122
|
+
* an array the mesh would wear.
|
|
123
|
+
*/
|
|
124
|
+
export function hasMaterialsForGroups(object, material = object.material) {
|
|
125
|
+
const mesh = object;
|
|
126
|
+
if (!mesh.isMesh)
|
|
127
|
+
return true;
|
|
128
|
+
if (!material)
|
|
129
|
+
return false;
|
|
130
|
+
if (!Array.isArray(material))
|
|
131
|
+
return true;
|
|
132
|
+
for (const group of mesh.geometry?.groups ?? []) {
|
|
133
|
+
if (!material[group.materialIndex ?? 0])
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
115
138
|
function distanceOrder(a, b) {
|
|
116
139
|
return a.distance - b.distance;
|
|
117
140
|
}
|
|
118
|
-
|
|
141
|
+
/** The scene node `object` draws for: itself or its nearest registered ancestor. */
|
|
142
|
+
function owningNode(object) {
|
|
143
|
+
const owners = new Map();
|
|
144
|
+
for (const [id, registered] of sceneRegistry.nodes)
|
|
145
|
+
owners.set(registered, id);
|
|
146
|
+
for (let at = object; at; at = at.parent) {
|
|
147
|
+
const id = owners.get(at);
|
|
148
|
+
if (id === undefined)
|
|
149
|
+
continue;
|
|
150
|
+
const node = useScene.getState().nodes[id];
|
|
151
|
+
return { id, type: node?.type ?? null };
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Reports each mesh a pointer raycast skips for groups with no material, once
|
|
157
|
+
* per material it wears: pointer moves would otherwise repeat it every frame.
|
|
158
|
+
*/
|
|
159
|
+
function createInvalidMaterialReporter(onBreadcrumb) {
|
|
160
|
+
const reported = new WeakMap();
|
|
161
|
+
return (object) => {
|
|
162
|
+
const material = object.material;
|
|
163
|
+
if (!onBreadcrumb || (reported.has(object) && reported.get(object) === material))
|
|
164
|
+
return;
|
|
165
|
+
reported.set(object, material);
|
|
166
|
+
const node = owningNode(object);
|
|
167
|
+
onBreadcrumb({
|
|
168
|
+
category: 'raycast_invalid_material',
|
|
169
|
+
message: 'Pointer raycast skipped a mesh whose geometry groups have no material',
|
|
170
|
+
level: 'warning',
|
|
171
|
+
data: { nodeType: node?.type ?? null, nodeId: node?.id ?? null, objectName: object.name },
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Three's recursive `intersectObject`, skipping meshes `hasMaterialsForGroups`
|
|
177
|
+
* rejects. A raycaster with its own `intersectObject` is asked directly.
|
|
178
|
+
*/
|
|
179
|
+
export function intersectDrawable(raycaster, object, skip) {
|
|
180
|
+
if (raycaster.intersectObject !== stockIntersectObject) {
|
|
181
|
+
return raycaster.intersectObject(object, true);
|
|
182
|
+
}
|
|
183
|
+
const hits = [];
|
|
184
|
+
const visit = (current) => {
|
|
185
|
+
let result;
|
|
186
|
+
if (current.layers.test(raycaster.layers)) {
|
|
187
|
+
if (hasMaterialsForGroups(current))
|
|
188
|
+
result = current.raycast(raycaster, hits);
|
|
189
|
+
else
|
|
190
|
+
skip(current);
|
|
191
|
+
}
|
|
192
|
+
if (result === false)
|
|
193
|
+
return;
|
|
194
|
+
const children = current.children;
|
|
195
|
+
for (let i = 0, length = children.length; i < length; i++)
|
|
196
|
+
visit(children[i]);
|
|
197
|
+
};
|
|
198
|
+
visit(object);
|
|
199
|
+
return hits.sort(distanceOrder);
|
|
200
|
+
}
|
|
201
|
+
function createCachedRaycast(skip) {
|
|
119
202
|
const queries = new WeakMap();
|
|
120
203
|
const activeQueries = [];
|
|
121
204
|
const rootHits = [];
|
|
@@ -140,7 +223,10 @@ function createCachedRaycast() {
|
|
|
140
223
|
unsupportedObject = object;
|
|
141
224
|
return false;
|
|
142
225
|
}
|
|
143
|
-
|
|
226
|
+
if (hasMaterialsForGroups(object))
|
|
227
|
+
result = object.raycast(raycaster, hits);
|
|
228
|
+
else
|
|
229
|
+
skip(object);
|
|
144
230
|
}
|
|
145
231
|
if (result !== false) {
|
|
146
232
|
const children = object.children;
|
|
@@ -223,9 +309,9 @@ function createCachedRaycast() {
|
|
|
223
309
|
},
|
|
224
310
|
};
|
|
225
311
|
}
|
|
226
|
-
export function createPascalPointerEvents(store) {
|
|
312
|
+
export function createPascalPointerEvents(store, onBreadcrumb) {
|
|
227
313
|
const manager = createWebEvents(store);
|
|
228
|
-
const { handlePointer } = createEvents(store);
|
|
314
|
+
const { handlePointer } = createEvents(store, onBreadcrumb);
|
|
229
315
|
for (const name of Object.keys(manager.handlers)) {
|
|
230
316
|
manager.handlers[name] = handlePointer(name);
|
|
231
317
|
}
|
|
@@ -246,7 +332,7 @@ export function createPascalPointerEvents(store) {
|
|
|
246
332
|
return manager;
|
|
247
333
|
}
|
|
248
334
|
function makeId(event) {
|
|
249
|
-
// biome-ignore lint/style/useTemplate: Keep the vendored dispatch identical to R3F 9.
|
|
335
|
+
// biome-ignore lint/style/useTemplate: Keep the vendored dispatch identical to R3F 9.8.2.
|
|
250
336
|
return (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;
|
|
251
337
|
}
|
|
252
338
|
/**
|
|
@@ -264,7 +350,8 @@ function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
|
264
350
|
}
|
|
265
351
|
}
|
|
266
352
|
}
|
|
267
|
-
function createEvents(store) {
|
|
353
|
+
function createEvents(store, onBreadcrumb) {
|
|
354
|
+
const skipInvalidMaterial = createInvalidMaterialReporter(onBreadcrumb);
|
|
268
355
|
const stats = {
|
|
269
356
|
events: 0,
|
|
270
357
|
cachedEvents: 0,
|
|
@@ -320,7 +407,7 @@ function createEvents(store) {
|
|
|
320
407
|
// Make sure root-level pointer and ray are set up
|
|
321
408
|
state.events.compute?.(event, state);
|
|
322
409
|
}
|
|
323
|
-
collectors[collectionDepth] ??= createCachedRaycast();
|
|
410
|
+
collectors[collectionDepth] ??= createCachedRaycast(skipInvalidMaterial);
|
|
324
411
|
const collector = collectors[collectionDepth++];
|
|
325
412
|
let hits = [];
|
|
326
413
|
let stock = false;
|
|
@@ -342,7 +429,7 @@ function createEvents(store) {
|
|
|
342
429
|
}
|
|
343
430
|
if (layer.raycaster.camera) {
|
|
344
431
|
const rootHits = stock
|
|
345
|
-
? layer.raycaster
|
|
432
|
+
? intersectDrawable(layer.raycaster, obj, skipInvalidMaterial)
|
|
346
433
|
: collector.intersectObject(obj, layer);
|
|
347
434
|
if (!rootHits) {
|
|
348
435
|
const unsupported = collector.unsupportedObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-processing-resources.d.ts","sourceRoot":"","sources":["../../src/lib/post-processing-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,qBAAa,uBAAuB;IAClC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAO;IACxC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAK;IAChC,OAAO,EAAE;QAAE,OAAO,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAO;IAC1C,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAO;IAEtC,OAAO;
|
|
1
|
+
{"version":3,"file":"post-processing-resources.d.ts","sourceRoot":"","sources":["../../src/lib/post-processing-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,qBAAa,uBAAuB;IAClC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAO;IACxC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAK;IAChC,OAAO,EAAE;QAAE,OAAO,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAO;IAC1C,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAO;IAEtC,OAAO,SASN;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EvaluatedLight } from '@pascal-app/core/procedural-items';
|
|
2
|
+
import type { Material, Mesh, Object3D } from 'three';
|
|
3
|
+
export declare function cloneWithProceduralEmission(material: Material, color: string, on: boolean): Material;
|
|
4
|
+
export declare function setProceduralEmission(material: Material, on: boolean): void;
|
|
5
|
+
export declare function proceduralSlotMeshes(root: Object3D, slots: Set<string>): Mesh[];
|
|
6
|
+
export declare function decorateProceduralEmission(root: Object3D, lights: EvaluatedLight[], on: boolean): () => void;
|
|
7
|
+
//# sourceMappingURL=procedural-emission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procedural-emission.d.ts","sourceRoot":"","sources":["../../src/lib/procedural-emission.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACvE,OAAO,KAAK,EAAS,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAQ5D,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,OAAO,GACV,QAAQ,CAQV;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,CAG3E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAW/E;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,cAAc,EAAE,EACxB,EAAE,EAAE,OAAO,GACV,MAAM,IAAI,CAwBZ"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export function cloneWithProceduralEmission(material, color, on) {
|
|
2
|
+
const clone = material.clone();
|
|
3
|
+
clone.userData = { ...clone.userData, __pascalCachedMaterial: false };
|
|
4
|
+
if (clone.emissive)
|
|
5
|
+
clone.emissive.set(color);
|
|
6
|
+
if ('emissiveIntensity' in clone)
|
|
7
|
+
clone.emissiveIntensity = on ? 1 : 0;
|
|
8
|
+
if ('emissiveMap' in clone)
|
|
9
|
+
clone.emissiveMap = null;
|
|
10
|
+
clone.needsUpdate = true;
|
|
11
|
+
return clone;
|
|
12
|
+
}
|
|
13
|
+
export function setProceduralEmission(material, on) {
|
|
14
|
+
const controlled = material;
|
|
15
|
+
if ('emissiveIntensity' in controlled)
|
|
16
|
+
controlled.emissiveIntensity = on ? 1 : 0;
|
|
17
|
+
}
|
|
18
|
+
export function proceduralSlotMeshes(root, slots) {
|
|
19
|
+
const meshes = [];
|
|
20
|
+
const owner = root.userData.pascalId;
|
|
21
|
+
const visit = (object) => {
|
|
22
|
+
if (object !== root && object.userData.pascalId && object.userData.pascalId !== owner)
|
|
23
|
+
return;
|
|
24
|
+
const mesh = object;
|
|
25
|
+
if (mesh.isMesh && slots.has(mesh.userData.slotId))
|
|
26
|
+
meshes.push(mesh);
|
|
27
|
+
for (const child of object.children)
|
|
28
|
+
visit(child);
|
|
29
|
+
};
|
|
30
|
+
visit(root);
|
|
31
|
+
return meshes;
|
|
32
|
+
}
|
|
33
|
+
export function decorateProceduralEmission(root, lights, on) {
|
|
34
|
+
const colors = new Map(lights.flatMap((light) => light.emissiveSlot ? [[light.emissiveSlot, light.color]] : []));
|
|
35
|
+
const restores = [];
|
|
36
|
+
for (const mesh of proceduralSlotMeshes(root, new Set(colors.keys()))) {
|
|
37
|
+
const slot = mesh.userData.slotId;
|
|
38
|
+
const color = colors.get(slot);
|
|
39
|
+
if (!color)
|
|
40
|
+
continue;
|
|
41
|
+
const previous = mesh.material;
|
|
42
|
+
const clones = (Array.isArray(previous) ? previous : [previous]).map((material) => cloneWithProceduralEmission(material, color, on));
|
|
43
|
+
mesh.material = Array.isArray(previous) ? clones : clones[0];
|
|
44
|
+
restores.push(() => {
|
|
45
|
+
mesh.material = previous;
|
|
46
|
+
for (const clone of clones)
|
|
47
|
+
clone.dispose();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return () => {
|
|
51
|
+
for (const restore of restores)
|
|
52
|
+
restore();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type AnyNode, type AnyNodeId, type RevealStyle, type SceneCommit } from '@pascal-app/core';
|
|
2
|
+
import type { RevealCandidate } from './reveal-schedule';
|
|
3
|
+
import type { PlayedStyle } from './reveal-wipe';
|
|
4
|
+
/**
|
|
5
|
+
* How much of the construction plays. `off` shows a build at once; `simple`
|
|
6
|
+
* keeps the scattered order with only `rise` and `scale`; `full` adds the
|
|
7
|
+
* falls, settles, cuts, assembled roofs and the dust. `framing` plays the
|
|
8
|
+
* same motions on the lazy, nested schedule (floor by floor, room by room,
|
|
9
|
+
* piece by piece; `planLazyReveal`), overdone a little, and plugins that stage
|
|
10
|
+
* their own members (the framing) read it and play them in the prerolls.
|
|
11
|
+
*/
|
|
12
|
+
export type ConstructionRevealLevel = 'off' | 'simple' | 'full' | 'framing';
|
|
13
|
+
/** A candidate; for an assembled node's part, also the node it assembles. */
|
|
14
|
+
export type StagedCandidate = RevealCandidate & {
|
|
15
|
+
host?: string;
|
|
16
|
+
};
|
|
17
|
+
/** A roof piece lifts this share of its drop before it falls: a hair, 20 cm of 4 m. */
|
|
18
|
+
export declare const PART_LEAD = 0.05;
|
|
19
|
+
/** `simple` keeps the stagger with only the two slice-one motions. */
|
|
20
|
+
export declare function styleAt(style: RevealStyle, at: ConstructionRevealLevel): PlayedStyle;
|
|
21
|
+
/** Kinds that hold the others: staging one would unmount everything under it. */
|
|
22
|
+
export declare const CONTAINERS: ReadonlySet<string>;
|
|
23
|
+
/**
|
|
24
|
+
* What `commit` stages at `at`: each node it creates whose kind declares a
|
|
25
|
+
* reveal, and the new parts (children declaring none) of each one that
|
|
26
|
+
* assembles. A new node of a kind that declares none comes in with a default
|
|
27
|
+
* reveal when what holds it was already there (under a new host, it comes in
|
|
28
|
+
* with the host). `seq` counts on from `firstSeq` in arrival order. Each
|
|
29
|
+
* candidate carries its room and its place in it (`layoutRevealCandidates`).
|
|
30
|
+
*/
|
|
31
|
+
export declare function commitRevealCandidates({ before, current, author }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): StagedCandidate[];
|
|
32
|
+
/**
|
|
33
|
+
* Gives each candidate its room for the lazy schedule: the room it stands in (a node on a line, the
|
|
34
|
+
* room on either side of its middle), else, for a node on a line, a run of the lines it meets end to
|
|
35
|
+
* end (`capabilities.revealLayout`); its room's
|
|
36
|
+
* sweep across the floor; and its place in the room (around the room's centre, or along the run).
|
|
37
|
+
* What stands in no room keeps none: it belongs to the floor.
|
|
38
|
+
*/
|
|
39
|
+
export declare function layoutRevealCandidates(candidates: StagedCandidate[], nodes: Record<AnyNodeId, AnyNode>): void;
|
|
40
|
+
/** Where a piece stood in its level: its position, and its turn about the vertical. */
|
|
41
|
+
export type Placement = {
|
|
42
|
+
position: [number, number, number];
|
|
43
|
+
yaw: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A piece changed by a commit. `from` is where a moved piece stood when it can glide from there, else
|
|
47
|
+
* null; `edited` marks a piece whose picture was edited (a wall bent, a slab resized), which plays its
|
|
48
|
+
* reveal again, quickly (`commitEditCandidates`).
|
|
49
|
+
*/
|
|
50
|
+
export type ChangeCandidate = StagedCandidate & {
|
|
51
|
+
from: Placement | null;
|
|
52
|
+
edited?: true;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* What `commit` moves: each piece of furniture it finds already there that is placed differently
|
|
56
|
+
* (another position, turn or parent). Furniture only, for now: walls and openings move with the
|
|
57
|
+
* rooms and walls that hold them.
|
|
58
|
+
*/
|
|
59
|
+
export declare function commitChangeCandidates({ before, current, author }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): ChangeCandidate[];
|
|
60
|
+
/**
|
|
61
|
+
* What taking `ids` back reveals: each of them, and everything under them (a wall's openings, a
|
|
62
|
+
* room's furniture), as the build would have staged it: by what its kind declares, or the default
|
|
63
|
+
* reveal a kind that declares none came in with. What stands in a host that goes (a segment of a
|
|
64
|
+
* stair, a part of a pool) goes with it; an assembled node (a roof) goes whole, not part by part.
|
|
65
|
+
*/
|
|
66
|
+
export declare function nodeRevealCandidates(ids: Iterable<string>, nodes: Record<AnyNodeId, AnyNode>, at: ConstructionRevealLevel): RevealCandidate[];
|
|
67
|
+
/**
|
|
68
|
+
* What `commit` edits: each node already there whose kind lists `capabilities.revealOnEdit` and one of
|
|
69
|
+
* those fields (the ones that make its picture) changed. A change to any other field stays instant, and
|
|
70
|
+
* so does what the structure reconciler derived from an edit (`derivedWrites`: the plates and ceilings it
|
|
71
|
+
* owns, the fields it wrote on a node): a wall moved does not make its room's floor rise again.
|
|
72
|
+
*/
|
|
73
|
+
export declare function commitEditCandidates({ before, current, author, derivedWrites }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): ChangeCandidate[];
|
|
74
|
+
/**
|
|
75
|
+
* What `commit` deletes that the picture can play out: each node that was there and is gone whose kind
|
|
76
|
+
* stages a reveal, as it was staged when built (a node standing in a host that goes with it goes with
|
|
77
|
+
* its host). Derived construction the reconciler retires is not a deletion the person or the agent made.
|
|
78
|
+
*/
|
|
79
|
+
export declare function commitDeleteCandidates({ before, current, author, derivedWrites }: SceneCommit, at: ConstructionRevealLevel, firstSeq?: number): StagedCandidate[];
|
|
80
|
+
//# sourceMappingURL=reveal-candidates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal-candidates.d.ts","sourceRoot":"","sources":["../../src/lib/reveal-candidates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,SAAS,EAMd,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAE3E,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjE,uFAAuF;AACvF,eAAO,MAAM,SAAS,OAAO,CAAA;AAE7B,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,uBAAuB,GAAG,WAAW,CAKpF;AAED,iFAAiF;AACjF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CAA0C,CAAA;AAiFrF;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EACxC,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CA0CnB;AA2FD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,EAAE,EAC7B,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAChC,IAAI,CAqEN;AAoED,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAmCzF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EACxC,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CAoBnB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,EACrB,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EACjC,EAAE,EAAE,uBAAuB,GAC1B,eAAe,EAAE,CAsBnB;AAgBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,WAAW,EACvD,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CA4BnB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,WAAW,EACvD,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,SAAI,GACX,eAAe,EAAE,CA4BnB"}
|