@ifc-lite/renderer 3.2.0 → 5.0.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/aabb-edges.d.ts +10 -0
- package/dist/aabb-edges.d.ts.map +1 -1
- package/dist/aabb-edges.js +13 -0
- package/dist/aabb-edges.js.map +1 -1
- package/dist/ao-params.d.ts +85 -0
- package/dist/ao-params.d.ts.map +1 -0
- package/dist/ao-params.js +109 -0
- package/dist/ao-params.js.map +1 -0
- package/dist/ao-pass.d.ts +47 -0
- package/dist/ao-pass.d.ts.map +1 -0
- package/dist/ao-pass.js +157 -0
- package/dist/ao-pass.js.map +1 -0
- package/dist/camera-matrices.d.ts +3 -0
- package/dist/camera-matrices.d.ts.map +1 -1
- package/dist/camera-matrices.js +12 -1
- package/dist/camera-matrices.js.map +1 -1
- package/dist/camera-orientation.d.ts +62 -0
- package/dist/camera-orientation.d.ts.map +1 -0
- package/dist/camera-orientation.js +155 -0
- package/dist/camera-orientation.js.map +1 -0
- package/dist/camera-projection.d.ts +3 -1
- package/dist/camera-projection.d.ts.map +1 -1
- package/dist/camera-projection.js +26 -20
- package/dist/camera-projection.js.map +1 -1
- package/dist/camera-surface-zoom.d.ts +32 -0
- package/dist/camera-surface-zoom.d.ts.map +1 -0
- package/dist/camera-surface-zoom.js +37 -0
- package/dist/camera-surface-zoom.js.map +1 -0
- package/dist/camera.d.ts +32 -61
- package/dist/camera.d.ts.map +1 -1
- package/dist/camera.js +71 -167
- package/dist/camera.js.map +1 -1
- package/dist/clash-solid-pipeline.d.ts +9 -3
- package/dist/clash-solid-pipeline.d.ts.map +1 -1
- package/dist/clash-solid-pipeline.js +31 -8
- package/dist/clash-solid-pipeline.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -3
- package/dist/constants.js.map +1 -1
- package/dist/depth-reconstruct.d.ts +43 -0
- package/dist/depth-reconstruct.d.ts.map +1 -0
- package/dist/depth-reconstruct.js +35 -0
- package/dist/depth-reconstruct.js.map +1 -0
- package/dist/device.js +1 -1
- package/dist/device.js.map +1 -1
- package/dist/edge-params.d.ts +43 -0
- package/dist/edge-params.d.ts.map +1 -0
- package/dist/edge-params.js +63 -0
- package/dist/edge-params.js.map +1 -0
- package/dist/edge-pass.d.ts +38 -0
- package/dist/edge-pass.d.ts.map +1 -0
- package/dist/edge-pass.js +111 -0
- package/dist/edge-pass.js.map +1 -0
- package/dist/environment.d.ts +26 -15
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +24 -13
- package/dist/environment.js.map +1 -1
- package/dist/federation-registry.d.ts +16 -0
- package/dist/federation-registry.d.ts.map +1 -1
- package/dist/federation-registry.js +80 -9
- package/dist/federation-registry.js.map +1 -1
- package/dist/gpu-static-upload.d.ts +39 -0
- package/dist/gpu-static-upload.d.ts.map +1 -0
- package/dist/gpu-static-upload.js +70 -0
- package/dist/gpu-static-upload.js.map +1 -0
- package/dist/gpu-upload-guard.d.ts +12 -23
- package/dist/gpu-upload-guard.d.ts.map +1 -1
- package/dist/gpu-upload-guard.js +12 -26
- package/dist/gpu-upload-guard.js.map +1 -1
- package/dist/index.d.ts +58 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -284
- package/dist/index.js.map +1 -1
- package/dist/instanced-render.d.ts +25 -5
- package/dist/instanced-render.d.ts.map +1 -1
- package/dist/instanced-render.js +50 -13
- package/dist/instanced-render.js.map +1 -1
- package/dist/instanced-rte.d.ts +17 -0
- package/dist/instanced-rte.d.ts.map +1 -0
- package/dist/instanced-rte.js +32 -0
- package/dist/instanced-rte.js.map +1 -0
- package/dist/mesh-material.d.ts +26 -0
- package/dist/mesh-material.d.ts.map +1 -0
- package/dist/mesh-material.js +52 -0
- package/dist/mesh-material.js.map +1 -0
- package/dist/mesh-rte-uniforms.d.ts +47 -0
- package/dist/mesh-rte-uniforms.d.ts.map +1 -0
- package/dist/mesh-rte-uniforms.js +60 -0
- package/dist/mesh-rte-uniforms.js.map +1 -0
- package/dist/model-bounds-tracker.d.ts +7 -0
- package/dist/model-bounds-tracker.d.ts.map +1 -1
- package/dist/model-bounds-tracker.js +16 -5
- package/dist/model-bounds-tracker.js.map +1 -1
- package/dist/model-translation.d.ts +1 -1
- package/dist/model-translation.d.ts.map +1 -1
- package/dist/model-translation.js +50 -2
- package/dist/model-translation.js.map +1 -1
- package/dist/overlay-theme-uniforms.d.ts +54 -0
- package/dist/overlay-theme-uniforms.d.ts.map +1 -0
- package/dist/overlay-theme-uniforms.js +89 -0
- package/dist/overlay-theme-uniforms.js.map +1 -0
- package/dist/overlay-theme.d.ts +73 -0
- package/dist/overlay-theme.d.ts.map +1 -0
- package/dist/overlay-theme.js +24 -0
- package/dist/overlay-theme.js.map +1 -0
- package/dist/pick-rte-snapshot.d.ts +7 -0
- package/dist/pick-rte-snapshot.d.ts.map +1 -0
- package/dist/pick-rte-snapshot.js +15 -0
- package/dist/pick-rte-snapshot.js.map +1 -0
- package/dist/pick-types.d.ts +17 -0
- package/dist/pick-types.d.ts.map +1 -0
- package/dist/pick-types.js +5 -0
- package/dist/pick-types.js.map +1 -0
- package/dist/pick-uniforms.d.ts +6 -0
- package/dist/pick-uniforms.d.ts.map +1 -1
- package/dist/pick-uniforms.js +22 -18
- package/dist/pick-uniforms.js.map +1 -1
- package/dist/pick-world-position.d.ts +18 -0
- package/dist/pick-world-position.d.ts.map +1 -0
- package/dist/pick-world-position.js +21 -0
- package/dist/pick-world-position.js.map +1 -0
- package/dist/picker-readbacks.d.ts +6 -0
- package/dist/picker-readbacks.d.ts.map +1 -0
- package/dist/picker-readbacks.js +20 -0
- package/dist/picker-readbacks.js.map +1 -0
- package/dist/picker-rte-uniforms.d.ts +6 -0
- package/dist/picker-rte-uniforms.d.ts.map +1 -0
- package/dist/picker-rte-uniforms.js +41 -0
- package/dist/picker-rte-uniforms.js.map +1 -0
- package/dist/picker.d.ts +6 -7
- package/dist/picker.d.ts.map +1 -1
- package/dist/picker.js +88 -115
- package/dist/picker.js.map +1 -1
- package/dist/picking-manager.d.ts +8 -0
- package/dist/picking-manager.d.ts.map +1 -1
- package/dist/picking-manager.js +46 -19
- package/dist/picking-manager.js.map +1 -1
- package/dist/pipeline.d.ts +3 -7
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +27 -31
- package/dist/pipeline.js.map +1 -1
- package/dist/point-picker.d.ts +5 -1
- package/dist/point-picker.d.ts.map +1 -1
- package/dist/point-picker.js +49 -9
- package/dist/point-picker.js.map +1 -1
- package/dist/pointcloud/point-cloud-handle-ids.d.ts +22 -0
- package/dist/pointcloud/point-cloud-handle-ids.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-handle-ids.js +31 -0
- package/dist/pointcloud/point-cloud-handle-ids.js.map +1 -0
- package/dist/pointcloud/point-cloud-node.d.ts +14 -6
- package/dist/pointcloud/point-cloud-node.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-node.js.map +1 -1
- package/dist/pointcloud/point-cloud-pick-sources.d.ts +47 -0
- package/dist/pointcloud/point-cloud-pick-sources.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-pick-sources.js +32 -0
- package/dist/pointcloud/point-cloud-pick-sources.js.map +1 -0
- package/dist/pointcloud/point-cloud-placement.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-placement.js +20 -5
- package/dist/pointcloud/point-cloud-placement.js.map +1 -1
- package/dist/pointcloud/point-cloud-ray-transform.d.ts +78 -4
- package/dist/pointcloud/point-cloud-ray-transform.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-ray-transform.js +31 -84
- package/dist/pointcloud/point-cloud-ray-transform.js.map +1 -1
- package/dist/pointcloud/point-cloud-renderer.d.ts +21 -19
- package/dist/pointcloud/point-cloud-renderer.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-renderer.js +46 -52
- package/dist/pointcloud/point-cloud-renderer.js.map +1 -1
- package/dist/pointcloud/point-cloud-stream-lifecycle.d.ts +44 -0
- package/dist/pointcloud/point-cloud-stream-lifecycle.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-stream-lifecycle.js +44 -0
- package/dist/pointcloud/point-cloud-stream-lifecycle.js.map +1 -0
- package/dist/pointcloud/point-cloud-uniforms.d.ts +5 -0
- package/dist/pointcloud/point-cloud-uniforms.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-uniforms.js +55 -44
- package/dist/pointcloud/point-cloud-uniforms.js.map +1 -1
- package/dist/pointcloud/point-cloud-visibility.d.ts +10 -0
- package/dist/pointcloud/point-cloud-visibility.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-visibility.js +18 -0
- package/dist/pointcloud/point-cloud-visibility.js.map +1 -0
- package/dist/pointcloud/point-pipeline.d.ts +4 -9
- package/dist/pointcloud/point-pipeline.d.ts.map +1 -1
- package/dist/pointcloud/point-pipeline.js +4 -9
- package/dist/pointcloud/point-pipeline.js.map +1 -1
- package/dist/pointcloud/point-shader.wgsl.d.ts +1 -21
- package/dist/pointcloud/point-shader.wgsl.d.ts.map +1 -1
- package/dist/pointcloud/point-shader.wgsl.js +25 -5
- package/dist/pointcloud/point-shader.wgsl.js.map +1 -1
- package/dist/post-pass-chain.d.ts +38 -0
- package/dist/post-pass-chain.d.ts.map +1 -0
- package/dist/post-pass-chain.js +105 -0
- package/dist/post-pass-chain.js.map +1 -0
- package/dist/raycast-engine.d.ts +7 -5
- package/dist/raycast-engine.d.ts.map +1 -1
- package/dist/raycast-engine.js +17 -20
- package/dist/raycast-engine.js.map +1 -1
- package/dist/raycast-point-cloud-query.d.ts +1 -1
- package/dist/raycast-point-cloud-query.d.ts.map +1 -1
- package/dist/reference-image-pipeline.d.ts +1 -1
- package/dist/reference-image-pipeline.d.ts.map +1 -1
- package/dist/reference-image-pipeline.js +25 -7
- package/dist/reference-image-pipeline.js.map +1 -1
- package/dist/reference-images.d.ts +1 -1
- package/dist/reference-images.d.ts.map +1 -1
- package/dist/reference-images.js +13 -5
- package/dist/reference-images.js.map +1 -1
- package/dist/relative-to-eye.d.ts +146 -0
- package/dist/relative-to-eye.d.ts.map +1 -0
- package/dist/relative-to-eye.js +326 -0
- package/dist/relative-to-eye.js.map +1 -0
- package/dist/render-section-draw.d.ts +11 -0
- package/dist/render-section-draw.d.ts.map +1 -1
- package/dist/render-section-draw.js +6 -3
- package/dist/render-section-draw.js.map +1 -1
- package/dist/renderer-color-readback.d.ts +50 -0
- package/dist/renderer-color-readback.d.ts.map +1 -0
- package/dist/renderer-color-readback.js +145 -0
- package/dist/renderer-color-readback.js.map +1 -0
- package/dist/renderer-overlays.d.ts +20 -10
- package/dist/renderer-overlays.d.ts.map +1 -1
- package/dist/renderer-overlays.js +44 -34
- package/dist/renderer-overlays.js.map +1 -1
- package/dist/renderer-screenshot.d.ts +4 -0
- package/dist/renderer-screenshot.d.ts.map +1 -0
- package/dist/renderer-screenshot.js +17 -0
- package/dist/renderer-screenshot.js.map +1 -0
- package/dist/renderer-symbolic-overlays.d.ts +4 -2
- package/dist/renderer-symbolic-overlays.d.ts.map +1 -1
- package/dist/renderer-symbolic-overlays.js +33 -13
- package/dist/renderer-symbolic-overlays.js.map +1 -1
- package/dist/renderer-viewport.d.ts +45 -0
- package/dist/renderer-viewport.d.ts.map +1 -1
- package/dist/renderer-viewport.js +44 -0
- package/dist/renderer-viewport.js.map +1 -1
- package/dist/rte-clip-space.d.ts +12 -0
- package/dist/rte-clip-space.d.ts.map +1 -0
- package/dist/rte-clip-space.js +22 -0
- package/dist/rte-clip-space.js.map +1 -0
- package/dist/rte-frustum.d.ts +24 -0
- package/dist/rte-frustum.d.ts.map +1 -0
- package/dist/rte-frustum.js +45 -0
- package/dist/rte-frustum.js.map +1 -0
- package/dist/scene-batch-upload.d.ts.map +1 -1
- package/dist/scene-batch-upload.js +14 -38
- package/dist/scene-batch-upload.js.map +1 -1
- package/dist/scene-device-recovery.d.ts.map +1 -1
- package/dist/scene-device-recovery.js +5 -9
- package/dist/scene-device-recovery.js.map +1 -1
- package/dist/scene-finalize-regroup.d.ts +54 -0
- package/dist/scene-finalize-regroup.d.ts.map +1 -0
- package/dist/scene-finalize-regroup.js +136 -0
- package/dist/scene-finalize-regroup.js.map +1 -0
- package/dist/scene-instance-bounds.d.ts +12 -0
- package/dist/scene-instance-bounds.d.ts.map +1 -0
- package/dist/scene-instance-bounds.js +48 -0
- package/dist/scene-instance-bounds.js.map +1 -0
- package/dist/scene-instance-materialization.d.ts +4 -1
- package/dist/scene-instance-materialization.d.ts.map +1 -1
- package/dist/scene-instance-materialization.js +21 -6
- package/dist/scene-instance-materialization.js.map +1 -1
- package/dist/scene-instance-translation.d.ts +17 -0
- package/dist/scene-instance-translation.d.ts.map +1 -0
- package/dist/scene-instance-translation.js +50 -0
- package/dist/scene-instance-translation.js.map +1 -0
- package/dist/scene-instance-types.d.ts +6 -0
- package/dist/scene-instance-types.d.ts.map +1 -1
- package/dist/scene-model-translation.d.ts +2 -0
- package/dist/scene-model-translation.d.ts.map +1 -1
- package/dist/scene-model-translation.js +1 -1
- package/dist/scene-model-translation.js.map +1 -1
- package/dist/scene-rect-select.d.ts +11 -1
- package/dist/scene-rect-select.d.ts.map +1 -1
- package/dist/scene-rect-select.js +7 -4
- package/dist/scene-rect-select.js.map +1 -1
- package/dist/scene.d.ts +27 -20
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +109 -238
- package/dist/scene.js.map +1 -1
- package/dist/section-2d-lift.d.ts +10 -2
- package/dist/section-2d-lift.d.ts.map +1 -1
- package/dist/section-2d-lift.js +14 -6
- package/dist/section-2d-lift.js.map +1 -1
- package/dist/section-2d-line-buffer.d.ts +12 -4
- package/dist/section-2d-line-buffer.d.ts.map +1 -1
- package/dist/section-2d-line-buffer.js +59 -33
- package/dist/section-2d-line-buffer.js.map +1 -1
- package/dist/section-2d-overlay.d.ts +18 -72
- package/dist/section-2d-overlay.d.ts.map +1 -1
- package/dist/section-2d-overlay.js +72 -103
- package/dist/section-2d-overlay.js.map +1 -1
- package/dist/section-2d-types.d.ts +38 -0
- package/dist/section-2d-types.d.ts.map +1 -0
- package/dist/section-2d-types.js +6 -0
- package/dist/section-2d-types.js.map +1 -0
- package/dist/section-cap-pipelines.d.ts +6 -0
- package/dist/section-cap-pipelines.d.ts.map +1 -0
- package/dist/section-cap-pipelines.js +87 -0
- package/dist/section-cap-pipelines.js.map +1 -0
- package/dist/section-plane-geometry.d.ts +24 -0
- package/dist/section-plane-geometry.d.ts.map +1 -0
- package/dist/section-plane-geometry.js +93 -0
- package/dist/section-plane-geometry.js.map +1 -0
- package/dist/section-plane.d.ts +26 -24
- package/dist/section-plane.d.ts.map +1 -1
- package/dist/section-plane.js +57 -182
- package/dist/section-plane.js.map +1 -1
- package/dist/shaders/ao.wgsl.d.ts +2 -0
- package/dist/shaders/ao.wgsl.d.ts.map +1 -0
- package/dist/shaders/ao.wgsl.js +234 -0
- package/dist/shaders/ao.wgsl.js.map +1 -0
- package/dist/shaders/color-transfer.wgsl.d.ts +28 -0
- package/dist/shaders/color-transfer.wgsl.d.ts.map +1 -0
- package/dist/shaders/color-transfer.wgsl.js +55 -0
- package/dist/shaders/color-transfer.wgsl.js.map +1 -0
- package/dist/shaders/depth-reconstruct.wgsl.d.ts +16 -0
- package/dist/shaders/depth-reconstruct.wgsl.d.ts.map +1 -0
- package/dist/shaders/depth-reconstruct.wgsl.js +69 -0
- package/dist/shaders/depth-reconstruct.wgsl.js.map +1 -0
- package/dist/shaders/edges.wgsl.d.ts +2 -0
- package/dist/shaders/edges.wgsl.d.ts.map +1 -0
- package/dist/shaders/edges.wgsl.js +158 -0
- package/dist/shaders/edges.wgsl.js.map +1 -0
- package/dist/shaders/main-rte-shadow.wgsl.d.ts +4 -0
- package/dist/shaders/main-rte-shadow.wgsl.d.ts.map +1 -0
- package/dist/shaders/main-rte-shadow.wgsl.js +54 -0
- package/dist/shaders/main-rte-shadow.wgsl.js.map +1 -0
- package/dist/shaders/main.wgsl.d.ts +1 -6
- package/dist/shaders/main.wgsl.d.ts.map +1 -1
- package/dist/shaders/main.wgsl.js +183 -228
- package/dist/shaders/main.wgsl.js.map +1 -1
- package/dist/shaders/relative-to-eye.wgsl.d.ts +12 -0
- package/dist/shaders/relative-to-eye.wgsl.d.ts.map +1 -0
- package/dist/shaders/relative-to-eye.wgsl.js +40 -0
- package/dist/shaders/relative-to-eye.wgsl.js.map +1 -0
- package/dist/shaders/section-2d-overlay.wgsl.d.ts +28 -12
- package/dist/shaders/section-2d-overlay.wgsl.d.ts.map +1 -1
- package/dist/shaders/section-2d-overlay.wgsl.js +40 -13
- package/dist/shaders/section-2d-overlay.wgsl.js.map +1 -1
- package/dist/shaders/shadow.wgsl.d.ts +1 -1
- package/dist/shaders/shadow.wgsl.d.ts.map +1 -1
- package/dist/shaders/shadow.wgsl.js +25 -7
- package/dist/shaders/shadow.wgsl.js.map +1 -1
- package/dist/shaders/sky.wgsl.d.ts +1 -11
- package/dist/shaders/sky.wgsl.d.ts.map +1 -1
- package/dist/shaders/sky.wgsl.js +17 -19
- package/dist/shaders/sky.wgsl.js.map +1 -1
- package/dist/shaders/specular.wgsl.d.ts +34 -0
- package/dist/shaders/specular.wgsl.d.ts.map +1 -0
- package/dist/shaders/specular.wgsl.js +134 -0
- package/dist/shaders/specular.wgsl.js.map +1 -0
- package/dist/shaders/symbolic-overlay.wgsl.d.ts +2 -9
- package/dist/shaders/symbolic-overlay.wgsl.d.ts.map +1 -1
- package/dist/shaders/symbolic-overlay.wgsl.js +88 -17
- package/dist/shaders/symbolic-overlay.wgsl.js.map +1 -1
- package/dist/shaders/textured.wgsl.d.ts.map +1 -1
- package/dist/shaders/textured.wgsl.js +11 -9
- package/dist/shaders/textured.wgsl.js.map +1 -1
- package/dist/shadow-light-matrix.d.ts +7 -0
- package/dist/shadow-light-matrix.d.ts.map +1 -1
- package/dist/shadow-light-matrix.js +11 -0
- package/dist/shadow-light-matrix.js.map +1 -1
- package/dist/shadow-occluder-batches.d.ts +10 -0
- package/dist/shadow-occluder-batches.d.ts.map +1 -0
- package/dist/shadow-occluder-batches.js +39 -0
- package/dist/shadow-occluder-batches.js.map +1 -0
- package/dist/shadow-occluders.d.ts.map +1 -1
- package/dist/shadow-occluders.js +4 -0
- package/dist/shadow-occluders.js.map +1 -1
- package/dist/shadow-pass.d.ts +5 -51
- package/dist/shadow-pass.d.ts.map +1 -1
- package/dist/shadow-pass.js +49 -45
- package/dist/shadow-pass.js.map +1 -1
- package/dist/shadow-types.d.ts +39 -0
- package/dist/shadow-types.d.ts.map +1 -0
- package/dist/shadow-types.js +15 -0
- package/dist/shadow-types.js.map +1 -0
- package/dist/symbolic-overlay-geometry.d.ts +7 -0
- package/dist/symbolic-overlay-geometry.d.ts.map +1 -0
- package/dist/symbolic-overlay-geometry.js +43 -0
- package/dist/symbolic-overlay-geometry.js.map +1 -0
- package/dist/symbolic-overlay-pipelines.d.ts +24 -36
- package/dist/symbolic-overlay-pipelines.d.ts.map +1 -1
- package/dist/symbolic-overlay-pipelines.js +175 -182
- package/dist/symbolic-overlay-pipelines.js.map +1 -1
- package/dist/symbolic-text-atlas.d.ts +21 -0
- package/dist/symbolic-text-atlas.d.ts.map +1 -1
- package/dist/symbolic-text-atlas.js +29 -1
- package/dist/symbolic-text-atlas.js.map +1 -1
- package/dist/types.d.ts +20 -26
- package/dist/types.d.ts.map +1 -1
- package/dist/visual-enhancement.d.ts +30 -1
- package/dist/visual-enhancement.d.ts.map +1 -1
- package/dist/visual-enhancement.js +44 -12
- package/dist/visual-enhancement.js.map +1 -1
- package/package.json +3 -3
- package/dist/post-processor.d.ts +0 -60
- package/dist/post-processor.d.ts.map +0 -1
- package/dist/post-processor.js +0 -353
- package/dist/post-processor.js.map +0 -1
package/dist/scene.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { materializeInstances } from './scene-instance-materialization.js';
|
|
5
5
|
import { InstanceSuppression } from './scene-instance-suppression.js';
|
|
6
6
|
import { createSceneBatch } from './scene-batch-upload.js';
|
|
7
|
+
import { createStaticGpuBuffer } from './gpu-static-upload.js';
|
|
7
8
|
import { createSceneAppearancePreview, rebindSceneAppearanceAccess } from './scene-appearance-preview.js';
|
|
8
9
|
import { AppearanceBuckets } from './scene-appearance-buckets.js';
|
|
9
10
|
import { AuthoredPreparationRegistry, prepareSceneAuthoredOwner } from './scene-authored-owner.js';
|
|
@@ -27,10 +28,13 @@ import { selectEvictions } from './residency.js';
|
|
|
27
28
|
import { OPAQUE_ALPHA_CUTOFF } from './overlay-routing.js';
|
|
28
29
|
import { translateSceneModel, rotateSceneModelInstances, releaseInstanceVertices, refreshTexturedBounds } from './scene-model-translation.js';
|
|
29
30
|
import { ModelTranslations } from './model-translation.js';
|
|
31
|
+
import { unionInstancedWorldAabb as unionInstanceBounds } from './scene-instance-bounds.js';
|
|
30
32
|
import { DerivedMeshProvenance } from './scene-derived-mesh-provenance.js';
|
|
31
33
|
import { rebuildSceneBatches } from './scene-batch-rebuild.js';
|
|
34
|
+
import { regroupStreamedBuckets } from './scene-finalize-regroup.js';
|
|
32
35
|
import { dropAllPartialCaches as dropAllPartialCachesIn, dropPartialCacheForBatch as dropPartialCacheForBatchIn, retireUnusedAlphaSlots as retireUnusedAlphaSlotsIn, } from './partial-batch-cache.js';
|
|
33
36
|
import { prepareInstancedRender, foldOccurrenceWorldBox, INSTANCE_STRIDE_BYTES, INSTANCE_COLOR_OFFSET, INSTANCE_FLAGS_OFFSET, INSTANCE_FLAG_SELECTED, INSTANCE_FLAG_HIDDEN, } from './instanced-render.js';
|
|
37
|
+
import { translateInstanceRecord } from './scene-instance-translation.js';
|
|
34
38
|
import { discardSceneGpuResourcesForRecovery, prepareSceneDeviceRecovery, repartitionHydratedRecoveryBucket, restoreSceneGpuResourcesAfterRecovery } from './scene-device-recovery.js';
|
|
35
39
|
const EMPTY_INSTANCED_TEMPLATES = [];
|
|
36
40
|
/**
|
|
@@ -300,6 +304,9 @@ export class Scene {
|
|
|
300
304
|
// Temporary fragment batches created during streaming for immediate rendering.
|
|
301
305
|
// Destroyed and replaced by proper merged batches in finalizeStreaming().
|
|
302
306
|
streamingFragments = [];
|
|
307
|
+
// Buckets that received streamed meshes since the last finalize — the only
|
|
308
|
+
// ones a finalize re-groups and rebuilds (#5358).
|
|
309
|
+
streamedBucketKeys = new Set();
|
|
303
310
|
// ─── Mesh command queue ────────────────────────────────────────────
|
|
304
311
|
// Decouples React state updates from GPU work. Callers push meshes
|
|
305
312
|
// via queueMeshes() (instant, no GPU), and the animation loop drains
|
|
@@ -1084,7 +1091,7 @@ export class Scene {
|
|
|
1084
1091
|
* STREAMING OPTIMIZATION: During streaming, creates lightweight "fragment"
|
|
1085
1092
|
* batches from ONLY the new meshes instead of re-merging all accumulated
|
|
1086
1093
|
* data. This reduces streaming from O(N²) to O(N). Call finalizeStreaming()
|
|
1087
|
-
* when streaming completes to
|
|
1094
|
+
* when streaming completes to merge the streamed buckets (only those, #5358).
|
|
1088
1095
|
*/
|
|
1089
1096
|
appendToBatches(meshDataArray, device, pipeline, isStreaming = false) {
|
|
1090
1097
|
meshDataArray = meshDataArray.map((mesh) => this.modelTranslations.placeMesh(mesh));
|
|
@@ -1146,16 +1153,17 @@ export class Scene {
|
|
|
1146
1153
|
this.meshDataBucket.set(meshData, bucket);
|
|
1147
1154
|
// Also store individual mesh data for visibility filtering
|
|
1148
1155
|
this.addMeshData(meshData);
|
|
1149
|
-
//
|
|
1150
|
-
if (
|
|
1156
|
+
// Non-streaming rebuilds now; streamed buckets wait for finalize.
|
|
1157
|
+
if (isStreaming)
|
|
1158
|
+
this.streamedBucketKeys.add(bucketKey);
|
|
1159
|
+
else
|
|
1151
1160
|
this.pendingBatchKeys.add(bucketKey);
|
|
1152
|
-
}
|
|
1153
1161
|
}
|
|
1154
1162
|
}
|
|
1155
1163
|
if (isStreaming) {
|
|
1156
1164
|
// STREAMING: Create small fragment batches from ONLY the new meshes.
|
|
1157
1165
|
// Avoids the O(N²) cost of re-merging all accumulated data every batch.
|
|
1158
|
-
// finalizeStreaming() destroys fragments and
|
|
1166
|
+
// finalizeStreaming() destroys fragments and merges the streamed buckets.
|
|
1159
1167
|
// `renderable` excludes textured meshes (drawn via the textured pipeline).
|
|
1160
1168
|
this.createStreamingFragments(renderable, device, pipeline);
|
|
1161
1169
|
return;
|
|
@@ -1504,22 +1512,17 @@ export class Scene {
|
|
|
1504
1512
|
const cpu = this.instancedTemplateCpu[occ.templateIndex];
|
|
1505
1513
|
if (!cpu)
|
|
1506
1514
|
continue;
|
|
1507
|
-
// Column-major mat4: the translation column is floats 12,13,14, i.e. bytes
|
|
1508
|
-
// +48/+52/+56 of the occurrence's record (matches unionInstancedWorldAabb).
|
|
1509
|
-
const dv = new DataView(cpu.instanceData);
|
|
1510
1515
|
const b = occ.byteOffset;
|
|
1511
|
-
const
|
|
1512
|
-
const ty = dv.getFloat32(b + 52, true) + dy;
|
|
1513
|
-
const tz = dv.getFloat32(b + 56, true) + dz;
|
|
1514
|
-
dv.setFloat32(b + 48, tx, true);
|
|
1515
|
-
dv.setFloat32(b + 52, ty, true);
|
|
1516
|
-
dv.setFloat32(b + 56, tz, true);
|
|
1516
|
+
const translated = translateInstanceRecord(cpu, b, [dx, dy, dz]);
|
|
1517
1517
|
// Push only the 12 translation bytes to the GPU buffer (in place). Guarded
|
|
1518
1518
|
// on the cached device so CPU-only tests still exercise the matrix math.
|
|
1519
1519
|
if (device) {
|
|
1520
1520
|
const gpu = this.instancedTemplates[occ.templateIndex]?.instanceBuffer;
|
|
1521
|
-
if (gpu)
|
|
1522
|
-
device.queue.writeBuffer(gpu, b + 48,
|
|
1521
|
+
if (gpu) {
|
|
1522
|
+
device.queue.writeBuffer(gpu, b + 48, translated.translation);
|
|
1523
|
+
if (translated.legacyAnchors)
|
|
1524
|
+
device.queue.writeBuffer(gpu, b + 88, translated.legacyAnchors);
|
|
1525
|
+
}
|
|
1523
1526
|
}
|
|
1524
1527
|
moved = true;
|
|
1525
1528
|
}
|
|
@@ -1773,7 +1776,7 @@ export class Scene {
|
|
|
1773
1776
|
// yielding the frame back at the TOP of the loop. The mesh-count-only chunker
|
|
1774
1777
|
// could merge a 512-mesh chunk of high-poly meshes (e.g. 899 Velux roof
|
|
1775
1778
|
// windows at 7624 tris each → ~3.9M tris) in ONE indivisible mergeGeometry +
|
|
1776
|
-
//
|
|
1779
|
+
// GPU buffer upload copy — hundreds of ms that parked the main thread
|
|
1777
1780
|
// past the 16s stream watchdog. Capping each appendToBatches by index volume
|
|
1778
1781
|
// keeps every synchronous slice ≈ one bounded fragment merge (~12-15ms).
|
|
1779
1782
|
const MAX_MESHES_PER_FLUSH = 4096;
|
|
@@ -1863,15 +1866,14 @@ export class Scene {
|
|
|
1863
1866
|
return splitMeshForStreaming(meshData, Scene.STREAMING_FRAGMENT_MAX_INDICES, Scene.STREAMING_FRAGMENT_MAX_VERTEX_BYTES);
|
|
1864
1867
|
}
|
|
1865
1868
|
/**
|
|
1866
|
-
* Finalize streaming: destroy temporary fragment batches and
|
|
1867
|
-
*
|
|
1869
|
+
* Finalize streaming: destroy the temporary fragment batches and merge the
|
|
1870
|
+
* meshes streamed since the last finalize into proper batches.
|
|
1868
1871
|
* Call this when streaming completes instead of rebuildPendingBatches().
|
|
1869
1872
|
*
|
|
1870
|
-
*
|
|
1871
|
-
*
|
|
1872
|
-
*
|
|
1873
|
-
*
|
|
1874
|
-
* meshData by their CURRENT color to produce correct batches.
|
|
1873
|
+
* Only the buckets that received streamed meshes are re-grouped and rebuilt
|
|
1874
|
+
* (plus any key already pending); every other model's batches stay as they
|
|
1875
|
+
* are (#5358). See `regroupStreamedBuckets` for why the streamed meshes are
|
|
1876
|
+
* re-grouped by their CURRENT colour.
|
|
1875
1877
|
*/
|
|
1876
1878
|
finalizeStreaming(device, pipeline) {
|
|
1877
1879
|
if (this.streamingFragments.length === 0)
|
|
@@ -1884,6 +1886,27 @@ export class Scene {
|
|
|
1884
1886
|
this.finalizeInProgress = false;
|
|
1885
1887
|
}
|
|
1886
1888
|
}
|
|
1889
|
+
regroupStreamed() {
|
|
1890
|
+
return regroupStreamedBuckets({
|
|
1891
|
+
buckets: this.buckets,
|
|
1892
|
+
meshDataBucket: this.meshDataBucket,
|
|
1893
|
+
activeBucketKey: this.activeBucketKey,
|
|
1894
|
+
coldBuckets: this.coldBuckets,
|
|
1895
|
+
pendingBatchKeys: this.pendingBatchKeys,
|
|
1896
|
+
streamedBucketKeys: this.streamedBucketKeys,
|
|
1897
|
+
bucketBaseKey: (md) => this.bucketBaseKey(md),
|
|
1898
|
+
resolveActiveBucket: (base, md) => this.resolveActiveBucket(base, md),
|
|
1899
|
+
createBucket: (key) => ({ key, meshData: [], batchedMesh: null, vertexBytes: 0 }),
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
/** Free batches the finalize swap replaced, with their per-batch caches. */
|
|
1903
|
+
retireFinalizedBatches(batches) {
|
|
1904
|
+
for (const batch of batches) {
|
|
1905
|
+
this.dropPartialCacheForBatch(batch);
|
|
1906
|
+
this.lastDrawnFrame.delete(batch.id);
|
|
1907
|
+
destroyGpuResources(batch);
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1887
1910
|
finalizeStreamingInner(device, pipeline) {
|
|
1888
1911
|
// Save references to old fragments/batches — keep them rendering
|
|
1889
1912
|
// until the new proper batches are fully built (no visual gap).
|
|
@@ -1891,103 +1914,47 @@ export class Scene {
|
|
|
1891
1914
|
const oldBatches = this.batchedMeshes;
|
|
1892
1915
|
const fragmentSet = new Set(oldFragments);
|
|
1893
1916
|
const oldBatchSet = new Set(oldBatches);
|
|
1894
|
-
//
|
|
1895
|
-
//
|
|
1896
|
-
//
|
|
1897
|
-
//
|
|
1898
|
-
|
|
1917
|
+
// The re-group detaches the streamed buckets BEFORE the replacement GPU
|
|
1918
|
+
// buffers exist. If a createBuffer fails part-way through, callers that
|
|
1919
|
+
// CONTAIN the throw to keep the canvas alive would otherwise be left
|
|
1920
|
+
// rendering a half-built scene, turning a crash into a silently blank model.
|
|
1921
|
+
let regroup = null;
|
|
1899
1922
|
let rebuilt = false;
|
|
1900
1923
|
try {
|
|
1901
1924
|
this.streamingFragments = [];
|
|
1902
|
-
|
|
1903
|
-
//
|
|
1904
|
-
//
|
|
1905
|
-
// sealed shells instead of being re-grouped (re-grouping would
|
|
1906
|
-
// silently drop them).
|
|
1907
|
-
const allMeshData = [];
|
|
1908
|
-
const carriedCold = [];
|
|
1909
|
-
for (const [key, bucket] of this.buckets) {
|
|
1910
|
-
if (this.coldBuckets.has(key) && bucket.meshData.length === 0 && bucket.batchedMesh) {
|
|
1911
|
-
carriedCold.push([key, bucket]);
|
|
1912
|
-
continue;
|
|
1913
|
-
}
|
|
1914
|
-
for (const md of bucket.meshData)
|
|
1915
|
-
allMeshData.push(md);
|
|
1916
|
-
}
|
|
1917
|
-
// 2. Clear all bucket/batch state for a clean rebuild
|
|
1918
|
-
// NOTE: batchedMeshes keeps the OLD array reference — the renderer
|
|
1919
|
-
// continues to draw from it until we swap in the new array below.
|
|
1920
|
-
this.buckets.clear();
|
|
1921
|
-
this.meshDataBucket = new Map();
|
|
1922
|
-
this.activeBucketKey.clear();
|
|
1923
|
-
this.lastDrawnFrame.clear();
|
|
1924
|
-
this.residencyRestoreQueue.clear();
|
|
1925
|
-
this.pendingBatchKeys.clear();
|
|
1926
|
-
// Re-seat the carried cold shells in the fresh bucket map (their GPU
|
|
1927
|
-
// shells re-enter the flat array via rebuildPendingBatches below).
|
|
1928
|
-
for (const [key, bucket] of carriedCold)
|
|
1929
|
-
this.buckets.set(key, bucket);
|
|
1930
|
-
// 3. Re-group ALL meshData by their CURRENT color (and grid cell).
|
|
1931
|
-
// meshData.color may have been mutated in-place since the mesh was
|
|
1932
|
-
// first bucketed, so the original bucket key is stale. Re-grouping
|
|
1933
|
-
// by current color ensures batches render with correct colors.
|
|
1934
|
-
for (const meshData of allMeshData) {
|
|
1935
|
-
const baseKey = this.bucketBaseKey(meshData);
|
|
1936
|
-
const bucketKey = this.resolveActiveBucket(baseKey, meshData);
|
|
1937
|
-
let bucket = this.buckets.get(bucketKey);
|
|
1938
|
-
if (!bucket) {
|
|
1939
|
-
bucket = { key: bucketKey, meshData: [], batchedMesh: null, vertexBytes: 0 };
|
|
1940
|
-
this.buckets.set(bucketKey, bucket);
|
|
1941
|
-
}
|
|
1942
|
-
bucket.meshData.push(meshData);
|
|
1943
|
-
this.meshDataBucket.set(meshData, bucket);
|
|
1944
|
-
this.pendingBatchKeys.add(bucketKey);
|
|
1945
|
-
}
|
|
1946
|
-
// 4. Build new proper batches into a fresh array
|
|
1925
|
+
regroup = this.regroupStreamed();
|
|
1926
|
+
// Build into a fresh array; rebuildPendingBatches republishes every
|
|
1927
|
+
// bucket's batch, untouched ones included.
|
|
1947
1928
|
this.batchedMeshes = [];
|
|
1948
1929
|
this.rebuildPendingBatches(device, pipeline);
|
|
1949
1930
|
rebuilt = true;
|
|
1950
|
-
// Cached partial (filtered-visibility) batches are keyed by their SOURCE
|
|
1951
|
-
// batch, so they only go stale once the replacement batches are live.
|
|
1952
|
-
// Dropping them up in step 2 destroyed their GPU resources BEFORE the
|
|
1953
|
-
// rebuild could fail, and the rollback cannot bring them back — an active
|
|
1954
|
-
// hide/isolate view lost its visible subset and had to recreate it
|
|
1955
|
-
// against the very device that just failed. On the failure path they now
|
|
1956
|
-
// survive, still matching the restored batches.
|
|
1957
|
-
this.dropAllPartialCaches();
|
|
1958
1931
|
}
|
|
1959
1932
|
finally {
|
|
1960
1933
|
if (!rebuilt) {
|
|
1961
|
-
// Free ONLY what this attempt created
|
|
1962
|
-
//
|
|
1963
|
-
// live before the rebuild must be left alone — destroying it would
|
|
1964
|
-
// leave the restored arrays pointing at dead buffers.
|
|
1934
|
+
// Free ONLY what this attempt created: anything live before the
|
|
1935
|
+
// rebuild is what the restored arrays point back at.
|
|
1965
1936
|
for (const created of this.batchedMeshes) {
|
|
1966
1937
|
if (!oldBatchSet.has(created) && !fragmentSet.has(created)) {
|
|
1967
1938
|
destroyGpuResources(created);
|
|
1968
1939
|
}
|
|
1969
1940
|
}
|
|
1970
|
-
|
|
1971
|
-
// resource: putting the arrays back restores exactly what was on
|
|
1972
|
-
// screen.
|
|
1941
|
+
regroup?.rollback();
|
|
1973
1942
|
this.streamingFragments = oldFragments;
|
|
1974
1943
|
this.batchedMeshes = oldBatches;
|
|
1975
1944
|
}
|
|
1976
1945
|
}
|
|
1977
|
-
//
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
destroyGpuResources(batch);
|
|
1983
|
-
}
|
|
1946
|
+
// NOW free the fragments and the dissolved buckets' batches (the
|
|
1947
|
+
// replacements are live). Batches of rebuilt surviving buckets were
|
|
1948
|
+
// already retired by rebuildPendingBatches.
|
|
1949
|
+
this.retireFinalizedBatches(oldFragments);
|
|
1950
|
+
this.retireFinalizedBatches(regroup?.retired ?? []);
|
|
1984
1951
|
this.reapplyColorOverrides(device, pipeline);
|
|
1985
1952
|
}
|
|
1986
1953
|
/**
|
|
1987
1954
|
* Time-sliced version of finalizeStreaming.
|
|
1988
|
-
*
|
|
1989
|
-
*
|
|
1990
|
-
*
|
|
1955
|
+
* Rebuilds the streamed buckets' batches in small chunks, yielding to the
|
|
1956
|
+
* event loop between chunks so orbit/pan stays responsive. The fragments
|
|
1957
|
+
* keep rendering until the rebuilt batches are swapped in.
|
|
1991
1958
|
*
|
|
1992
1959
|
* @param device GPU device
|
|
1993
1960
|
* @param pipeline Render pipeline
|
|
@@ -2019,21 +1986,18 @@ export class Scene {
|
|
|
2019
1986
|
// spec). Every entry point that can fail — the synchronous preamble AND
|
|
2020
1987
|
// each chunked continuation — must therefore run under its own try/catch
|
|
2021
1988
|
// that explicitly calls `reject`, mirroring finalizeStreamingInner's
|
|
2022
|
-
// try/finally contract: restore oldFragments/oldBatches
|
|
2023
|
-
// this attempt created,
|
|
2024
|
-
//
|
|
1989
|
+
// try/finally contract: restore oldFragments/oldBatches and the bucket
|
|
1990
|
+
// map, free only what this attempt created, and always clear
|
|
1991
|
+
// finalizeInProgress.
|
|
2025
1992
|
return new Promise((resolve, reject) => {
|
|
2026
|
-
const newBatches = [];
|
|
2027
1993
|
const createdOwned = [];
|
|
2028
|
-
|
|
1994
|
+
// Pending keys whose bucket ended up empty: deleted (and their batch
|
|
1995
|
+
// retired) at the swap, exactly as rebuildPendingBatches would.
|
|
1996
|
+
const emptied = [];
|
|
1997
|
+
let regroup = null;
|
|
2029
1998
|
let pendingKeys = [];
|
|
2030
1999
|
let keyIdx = 0;
|
|
2031
2000
|
function rollback() {
|
|
2032
|
-
// Free ONLY what this attempt created — carried cold shells and
|
|
2033
|
-
// anything already live before the rebuild must be left alone (they
|
|
2034
|
-
// are what the restored arrays point back at). Iterating the owned
|
|
2035
|
-
// pairs rather than `newBatches` also skips the carried cold shells
|
|
2036
|
-
// appended just before the swap, which this attempt did not create.
|
|
2037
2001
|
for (const { bucket, previous, previousFrameOrigin, batch } of createdOwned) {
|
|
2038
2002
|
// Repair the owner BEFORE the free, so no bucket is ever observable
|
|
2039
2003
|
// holding a destroyed batch; its frame origin (what a later
|
|
@@ -2046,7 +2010,8 @@ export class Scene {
|
|
|
2046
2010
|
destroyGpuResources(batch);
|
|
2047
2011
|
}
|
|
2048
2012
|
}
|
|
2049
|
-
|
|
2013
|
+
regroup?.rollback();
|
|
2014
|
+
scene.streamingFragments = [...oldFragments, ...scene.streamingFragments]; // + any streamed in meanwhile
|
|
2050
2015
|
scene.batchedMeshes = oldBatches;
|
|
2051
2016
|
scene.finalizeInProgress = false;
|
|
2052
2017
|
}
|
|
@@ -2057,7 +2022,7 @@ export class Scene {
|
|
|
2057
2022
|
const key = pendingKeys[keyIdx++];
|
|
2058
2023
|
const bucket = scene.buckets.get(key);
|
|
2059
2024
|
if (!bucket || bucket.meshData.length === 0) {
|
|
2060
|
-
|
|
2025
|
+
emptied.push(key);
|
|
2061
2026
|
continue;
|
|
2062
2027
|
}
|
|
2063
2028
|
const color = bucket.meshData[0].color;
|
|
@@ -2067,35 +2032,31 @@ export class Scene {
|
|
|
2067
2032
|
bucket.batchedMesh = batchedMesh;
|
|
2068
2033
|
bucket.frameOrigin = batchedMesh.origin;
|
|
2069
2034
|
createdOwned.push({ bucket, previous, previousFrameOrigin, batch: batchedMesh });
|
|
2070
|
-
newBatches.push(batchedMesh);
|
|
2071
2035
|
// Check time budget — yield if exceeded
|
|
2072
2036
|
if (performance.now() - chunkStart >= budgetMs) {
|
|
2073
2037
|
setTimeout(processChunk, 0);
|
|
2074
2038
|
return;
|
|
2075
2039
|
}
|
|
2076
2040
|
}
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
// Cached partial (filtered-visibility) batches are keyed by their
|
|
2087
|
-
// SOURCE batch, so they only go stale once the replacement batches
|
|
2088
|
-
// are live — dropping them any earlier destroys GPU resources a
|
|
2089
|
-
// mid-rebuild failure could never get back (same rationale as
|
|
2090
|
-
// finalizeStreamingInner).
|
|
2091
|
-
scene.dropAllPartialCaches();
|
|
2092
|
-
// Destroy old fragment/batch GPU resources
|
|
2093
|
-
for (const fragment of oldFragments)
|
|
2094
|
-
destroyGpuResources(fragment);
|
|
2095
|
-
for (const batch of oldBatches) {
|
|
2096
|
-
if (!fragmentSet.has(batch))
|
|
2097
|
-
destroyGpuResources(batch);
|
|
2041
|
+
const retired = [...oldFragments, ...(regroup?.retired ?? [])];
|
|
2042
|
+
for (const { previous } of createdOwned)
|
|
2043
|
+
if (previous)
|
|
2044
|
+
retired.push(previous);
|
|
2045
|
+
for (const key of emptied) {
|
|
2046
|
+
const batch = scene.buckets.get(key)?.batchedMesh;
|
|
2047
|
+
if (batch)
|
|
2048
|
+
retired.push(batch);
|
|
2049
|
+
scene.buckets.delete(key);
|
|
2098
2050
|
}
|
|
2051
|
+
// Atomic swap so the renderer never sees an empty array: every
|
|
2052
|
+
// bucket's live batch (untouched models included, evicted shells
|
|
2053
|
+
// too — the draw loop skips gpuResident === false and the restore
|
|
2054
|
+
// path revives them) plus any fragment streamed in meanwhile.
|
|
2055
|
+
scene.batchedMeshes = [
|
|
2056
|
+
...[...scene.buckets.values()].flatMap((b) => (b.batchedMesh ? [b.batchedMesh] : [])),
|
|
2057
|
+
...scene.streamingFragments,
|
|
2058
|
+
];
|
|
2059
|
+
scene.retireFinalizedBatches(retired);
|
|
2099
2060
|
scene.finalizeInProgress = false;
|
|
2100
2061
|
scene.reapplyColorOverrides(device, pipeline); // never throws: the swap above is committed
|
|
2101
2062
|
resolve();
|
|
@@ -2106,45 +2067,9 @@ export class Scene {
|
|
|
2106
2067
|
}
|
|
2107
2068
|
}
|
|
2108
2069
|
try {
|
|
2109
|
-
// --- Synchronous preamble
|
|
2070
|
+
// --- Synchronous preamble: re-group the streamed meshes only ---
|
|
2110
2071
|
scene.streamingFragments = [];
|
|
2111
|
-
|
|
2112
|
-
// shells — see the sync finalize for the rationale)
|
|
2113
|
-
const allMeshData = [];
|
|
2114
|
-
for (const [key, bucket] of scene.buckets) {
|
|
2115
|
-
if (scene.coldBuckets.has(key) && bucket.meshData.length === 0 && bucket.batchedMesh) {
|
|
2116
|
-
carriedCold.push([key, bucket]);
|
|
2117
|
-
continue;
|
|
2118
|
-
}
|
|
2119
|
-
for (const md of bucket.meshData)
|
|
2120
|
-
allMeshData.push(md);
|
|
2121
|
-
}
|
|
2122
|
-
// 2. Clear bucket/batch state. dropAllPartialCaches() is deliberately
|
|
2123
|
-
// NOT called here — see the success path above.
|
|
2124
|
-
scene.buckets.clear();
|
|
2125
|
-
scene.meshDataBucket = new Map();
|
|
2126
|
-
scene.activeBucketKey.clear();
|
|
2127
|
-
scene.lastDrawnFrame.clear();
|
|
2128
|
-
scene.residencyRestoreQueue.clear();
|
|
2129
|
-
scene.pendingBatchKeys.clear();
|
|
2130
|
-
// Re-seat the carried cold shells in the fresh bucket map.
|
|
2131
|
-
for (const [key, bucket] of carriedCold)
|
|
2132
|
-
scene.buckets.set(key, bucket);
|
|
2133
|
-
// 3. Re-group meshData by current color (and grid cell) — fast
|
|
2134
|
-
for (const meshData of allMeshData) {
|
|
2135
|
-
const baseKey = scene.bucketBaseKey(meshData);
|
|
2136
|
-
const bucketKey = scene.resolveActiveBucket(baseKey, meshData);
|
|
2137
|
-
let bucket = scene.buckets.get(bucketKey);
|
|
2138
|
-
if (!bucket) {
|
|
2139
|
-
bucket = { key: bucketKey, meshData: [], batchedMesh: null, vertexBytes: 0 };
|
|
2140
|
-
scene.buckets.set(bucketKey, bucket);
|
|
2141
|
-
}
|
|
2142
|
-
bucket.meshData.push(meshData);
|
|
2143
|
-
scene.meshDataBucket.set(meshData, bucket);
|
|
2144
|
-
scene.pendingBatchKeys.add(bucketKey);
|
|
2145
|
-
}
|
|
2146
|
-
// Build new batches into a temporary array so the old batchedMeshes
|
|
2147
|
-
// (streaming fragments) keep rendering until the swap is complete.
|
|
2072
|
+
regroup = scene.regroupStreamed();
|
|
2148
2073
|
pendingKeys = Array.from(scene.pendingBatchKeys);
|
|
2149
2074
|
scene.pendingBatchKeys.clear();
|
|
2150
2075
|
}
|
|
@@ -2185,6 +2110,7 @@ export class Scene {
|
|
|
2185
2110
|
this.coldBuckets.clear();
|
|
2186
2111
|
this.dirtyBuckets.clear();
|
|
2187
2112
|
this.pendingBatchKeys.clear();
|
|
2113
|
+
this.streamedBucketKeys.clear();
|
|
2188
2114
|
this.dropAllPartialCaches();
|
|
2189
2115
|
this.geometryReleased = true;
|
|
2190
2116
|
this.ephemeralStreamingMode = false;
|
|
@@ -2887,31 +2813,13 @@ export class Scene {
|
|
|
2887
2813
|
vf[o + 5] = i * 3 + 2 < t.normals.length ? t.normals[i * 3 + 2] : 0;
|
|
2888
2814
|
// vf[o + 6] (entityId lane) stays 0.
|
|
2889
2815
|
}
|
|
2890
|
-
const vertexBuffer = device.
|
|
2891
|
-
|
|
2892
|
-
usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
|
|
2893
|
-
mappedAtCreation: true,
|
|
2894
|
-
});
|
|
2895
|
-
new Uint8Array(vertexBuffer.getMappedRange()).set(new Uint8Array(vtx));
|
|
2896
|
-
vertexBuffer.unmap();
|
|
2897
|
-
const indexBuffer = device.createBuffer({
|
|
2898
|
-
size: t.indices.byteLength,
|
|
2899
|
-
usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST,
|
|
2900
|
-
mappedAtCreation: true,
|
|
2901
|
-
});
|
|
2902
|
-
new Uint32Array(indexBuffer.getMappedRange()).set(t.indices);
|
|
2903
|
-
indexBuffer.unmap();
|
|
2816
|
+
const vertexBuffer = createStaticGpuBuffer(device, vtx, GPUBufferUsage.VERTEX);
|
|
2817
|
+
const indexBuffer = createStaticGpuBuffer(device, t.indices, GPUBufferUsage.INDEX);
|
|
2904
2818
|
// instanceBuffer is already the interleaved mat4 + entityId + rgba block
|
|
2905
2819
|
// (INSTANCE_STRIDE_BYTES per occurrence) from prepareInstancedRender.
|
|
2906
|
-
this.modelTranslations.placeInstances(t.instanceBuffer, modelIndex, INSTANCE_STRIDE_BYTES);
|
|
2820
|
+
this.modelTranslations.placeInstances(t.instanceBuffer, modelIndex, INSTANCE_STRIDE_BYTES, t.canonicalAnchors, t.canonicalMatrixTranslations);
|
|
2907
2821
|
const instSize = t.instanceCount * INSTANCE_STRIDE_BYTES;
|
|
2908
|
-
const instanceBuffer = device.
|
|
2909
|
-
size: instSize,
|
|
2910
|
-
usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
|
|
2911
|
-
mappedAtCreation: true,
|
|
2912
|
-
});
|
|
2913
|
-
new Uint8Array(instanceBuffer.getMappedRange()).set(new Uint8Array(t.instanceBuffer, 0, instSize));
|
|
2914
|
-
instanceBuffer.unmap();
|
|
2822
|
+
const instanceBuffer = createStaticGpuBuffer(device, new Uint8Array(t.instanceBuffer, 0, instSize), GPUBufferUsage.VERTEX);
|
|
2915
2823
|
// Always append: slots are stable identities, never recycled.
|
|
2916
2824
|
const templateIndex = this.instancedTemplates.length;
|
|
2917
2825
|
const template = {
|
|
@@ -2921,6 +2829,7 @@ export class Scene {
|
|
|
2921
2829
|
indexCount: t.indices.length,
|
|
2922
2830
|
instanceBuffer,
|
|
2923
2831
|
instanceCount: t.instanceCount,
|
|
2832
|
+
canonicalAnchors: t.canonicalAnchors,
|
|
2924
2833
|
bounds: null,
|
|
2925
2834
|
maxOccRadius: 0,
|
|
2926
2835
|
selectedCount: 0,
|
|
@@ -2954,6 +2863,8 @@ export class Scene {
|
|
|
2954
2863
|
normals: t.normals,
|
|
2955
2864
|
indices: t.indices,
|
|
2956
2865
|
instanceData: t.instanceBuffer,
|
|
2866
|
+
canonicalAnchors: t.canonicalAnchors,
|
|
2867
|
+
canonicalMatrixTranslations: t.canonicalMatrixTranslations,
|
|
2957
2868
|
localMin: [lmnx, lmny, lmnz],
|
|
2958
2869
|
localMax: [lmxx, lmxy, lmxz],
|
|
2959
2870
|
};
|
|
@@ -3024,51 +2935,10 @@ export class Scene {
|
|
|
3024
2935
|
this.instancedVisibilityDirty = true;
|
|
3025
2936
|
this.instancedGhostDirty = true;
|
|
3026
2937
|
}
|
|
3027
|
-
/** Transform a template's local AABB by an occurrence's column-major mat4 (read
|
|
3028
|
-
* from the packed instance record at `matOffset`) and union the world box into
|
|
3029
|
-
* boundingBoxes[eid]. Returns the occurrence's world box so the caller can also
|
|
3030
|
-
* fold it into the template's cull metadata. */
|
|
3031
2938
|
unionInstancedWorldAabb(eid, dv, matOffset, lmnx, lmny, lmnz, lmxx, lmxy, lmxz) {
|
|
3032
|
-
|
|
3033
|
-
const m4 = dv.getFloat32(matOffset + 16, true), m5 = dv.getFloat32(matOffset + 20, true), m6 = dv.getFloat32(matOffset + 24, true);
|
|
3034
|
-
const m8 = dv.getFloat32(matOffset + 32, true), m9 = dv.getFloat32(matOffset + 36, true), m10 = dv.getFloat32(matOffset + 40, true);
|
|
3035
|
-
const m12 = dv.getFloat32(matOffset + 48, true), m13 = dv.getFloat32(matOffset + 52, true), m14 = dv.getFloat32(matOffset + 56, true);
|
|
3036
|
-
let minX = Infinity, minY = Infinity, minZ = Infinity, maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
|
|
3037
|
-
for (let c = 0; c < 8; c++) {
|
|
3038
|
-
const x = (c & 1) ? lmxx : lmnx, y = (c & 2) ? lmxy : lmny, z = (c & 4) ? lmxz : lmnz;
|
|
3039
|
-
const wx = m0 * x + m4 * y + m8 * z + m12;
|
|
3040
|
-
const wy = m1 * x + m5 * y + m9 * z + m13;
|
|
3041
|
-
const wz = m2 * x + m6 * y + m10 * z + m14;
|
|
3042
|
-
if (wx < minX)
|
|
3043
|
-
minX = wx;
|
|
3044
|
-
if (wy < minY)
|
|
3045
|
-
minY = wy;
|
|
3046
|
-
if (wz < minZ)
|
|
3047
|
-
minZ = wz;
|
|
3048
|
-
if (wx > maxX)
|
|
3049
|
-
maxX = wx;
|
|
3050
|
-
if (wy > maxY)
|
|
3051
|
-
maxY = wy;
|
|
3052
|
-
if (wz > maxZ)
|
|
3053
|
-
maxZ = wz;
|
|
3054
|
-
}
|
|
3055
|
-
const existing = this.boundingBoxes.get(eid);
|
|
3056
|
-
if (existing) {
|
|
3057
|
-
existing.min.x = Math.min(existing.min.x, minX);
|
|
3058
|
-
existing.min.y = Math.min(existing.min.y, minY);
|
|
3059
|
-
existing.min.z = Math.min(existing.min.z, minZ);
|
|
3060
|
-
existing.max.x = Math.max(existing.max.x, maxX);
|
|
3061
|
-
existing.max.y = Math.max(existing.max.y, maxY);
|
|
3062
|
-
existing.max.z = Math.max(existing.max.z, maxZ);
|
|
3063
|
-
}
|
|
3064
|
-
else {
|
|
3065
|
-
this.boundingBoxes.set(eid, { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } });
|
|
3066
|
-
}
|
|
3067
|
-
return { minX, minY, minZ, maxX, maxY, maxZ };
|
|
2939
|
+
return unionInstanceBounds(this.boundingBoxes, eid, dv, matOffset, lmnx, lmny, lmnz, lmxx, lmxy, lmxz);
|
|
3068
2940
|
}
|
|
3069
|
-
/** True
|
|
3070
|
-
* shard, not the flat meshDataMap). CPU consumers use this to decide whether to
|
|
3071
|
-
* fall back to the instanced accessors below. */
|
|
2941
|
+
/** True when `expressId` has a GPU-instanced occurrence. */
|
|
3072
2942
|
isInstancedEntity(expressId) {
|
|
3073
2943
|
return this.instancedEntityMap.has(expressId);
|
|
3074
2944
|
}
|
|
@@ -3635,6 +3505,7 @@ export class Scene {
|
|
|
3635
3505
|
this.dirtyBuckets.clear();
|
|
3636
3506
|
this.cachedMaxBufferSize = 0;
|
|
3637
3507
|
this.pendingBatchKeys.clear();
|
|
3508
|
+
this.streamedBucketKeys.clear();
|
|
3638
3509
|
this.meshQueue = [];
|
|
3639
3510
|
this.meshQueueReadIndex = 0;
|
|
3640
3511
|
this.geometryReleased = false;
|
|
@@ -3933,7 +3804,7 @@ export class Scene {
|
|
|
3933
3804
|
* covered: their world AABBs are registered in `boundingBoxes` when the
|
|
3934
3805
|
* instanced shard is built.
|
|
3935
3806
|
*/
|
|
3936
|
-
selectRect(x0, y0, x1, y1, viewportWidth, viewportHeight, viewProj, hiddenIds, isolatedIds, clip) {
|
|
3807
|
+
selectRect(x0, y0, x1, y1, viewportWidth, viewportHeight, viewProj, hiddenIds, isolatedIds, clip, rte) {
|
|
3937
3808
|
// After release the cache is already the complete set; before it, boxes are
|
|
3938
3809
|
// computed lazily, so make sure every entity that still has mesh data has
|
|
3939
3810
|
// one. Same authoritative id set pick() uses, so colour-fused fillers whose
|
|
@@ -3951,7 +3822,7 @@ export class Scene {
|
|
|
3951
3822
|
this.getEntityBoundingBox(expressId);
|
|
3952
3823
|
}
|
|
3953
3824
|
}
|
|
3954
|
-
return selectBoundingBoxesInRect(this.boundingBoxes, viewProj, { x0, y0, x1, y1 }, viewportWidth, viewportHeight, hiddenIds, isolatedIds, clip);
|
|
3825
|
+
return selectBoundingBoxesInRect(this.boundingBoxes, viewProj, { x0, y0, x1, y1 }, viewportWidth, viewportHeight, hiddenIds, isolatedIds, clip, rte);
|
|
3955
3826
|
}
|
|
3956
3827
|
}
|
|
3957
3828
|
//# sourceMappingURL=scene.js.map
|