@ifc-lite/renderer 5.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/camera-projection.d.ts +2 -0
- package/dist/camera-projection.d.ts.map +1 -1
- package/dist/camera-projection.js +46 -0
- package/dist/camera-projection.js.map +1 -1
- package/dist/chunk-grid.d.ts +21 -0
- package/dist/chunk-grid.d.ts.map +1 -1
- package/dist/chunk-grid.js +25 -7
- package/dist/chunk-grid.js.map +1 -1
- package/dist/clash-solid-pipeline.d.ts.map +1 -1
- package/dist/clash-solid-pipeline.js +4 -2
- package/dist/clash-solid-pipeline.js.map +1 -1
- package/dist/deviation/deviation-computer.d.ts +4 -0
- package/dist/deviation/deviation-computer.d.ts.map +1 -1
- package/dist/deviation/deviation-computer.js +20 -0
- package/dist/deviation/deviation-computer.js.map +1 -1
- package/dist/deviation/deviation-readback.d.ts +18 -0
- package/dist/deviation/deviation-readback.d.ts.map +1 -0
- package/dist/deviation/deviation-readback.js +67 -0
- package/dist/deviation/deviation-readback.js.map +1 -0
- package/dist/edge-pass.d.ts +16 -0
- package/dist/edge-pass.d.ts.map +1 -1
- package/dist/edge-pass.js +75 -1
- package/dist/edge-pass.js.map +1 -1
- package/dist/entity-color-table.d.ts +140 -0
- package/dist/entity-color-table.d.ts.map +1 -0
- package/dist/entity-color-table.js +238 -0
- package/dist/entity-color-table.js.map +1 -0
- package/dist/gpu-upload-guard.d.ts +1 -1
- package/dist/gpu-upload-guard.js +1 -1
- package/dist/hover-mesh-cache.d.ts +29 -0
- package/dist/hover-mesh-cache.d.ts.map +1 -0
- package/dist/hover-mesh-cache.js +31 -0
- package/dist/hover-mesh-cache.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +146 -161
- package/dist/index.js.map +1 -1
- package/dist/individual-mesh-upload.d.ts +24 -0
- package/dist/individual-mesh-upload.d.ts.map +1 -0
- package/dist/individual-mesh-upload.js +85 -0
- package/dist/individual-mesh-upload.js.map +1 -0
- package/dist/instanced-render.d.ts +19 -9
- package/dist/instanced-render.d.ts.map +1 -1
- package/dist/instanced-render.js +36 -24
- package/dist/instanced-render.js.map +1 -1
- package/dist/instanced-rte.d.ts +68 -7
- package/dist/instanced-rte.d.ts.map +1 -1
- package/dist/instanced-rte.js +98 -17
- package/dist/instanced-rte.js.map +1 -1
- package/dist/instanced-vertex-layout.d.ts +26 -0
- package/dist/instanced-vertex-layout.d.ts.map +1 -0
- package/dist/instanced-vertex-layout.js +61 -0
- package/dist/instanced-vertex-layout.js.map +1 -0
- package/dist/mesh-rte-uniforms.d.ts +4 -2
- package/dist/mesh-rte-uniforms.d.ts.map +1 -1
- package/dist/mesh-rte-uniforms.js +4 -2
- package/dist/mesh-rte-uniforms.js.map +1 -1
- package/dist/model-translation.d.ts.map +1 -1
- package/dist/model-translation.js +0 -7
- package/dist/model-translation.js.map +1 -1
- package/dist/outline-params.d.ts +45 -0
- package/dist/outline-params.d.ts.map +1 -0
- package/dist/outline-params.js +54 -0
- package/dist/outline-params.js.map +1 -0
- package/dist/overlay-routing.d.ts +8 -8
- package/dist/overlay-routing.js +2 -2
- package/dist/overlay-routing.js.map +1 -1
- package/dist/overlay-theme.d.ts +9 -3
- package/dist/overlay-theme.d.ts.map +1 -1
- package/dist/overlay-theme.js.map +1 -1
- package/dist/partial-batch-requests.d.ts +2 -2
- package/dist/pick-mesh-budget.d.ts +28 -0
- package/dist/pick-mesh-budget.d.ts.map +1 -0
- package/dist/pick-mesh-budget.js +74 -0
- package/dist/pick-mesh-budget.js.map +1 -0
- package/dist/picker-rte-uniforms.d.ts +7 -1
- package/dist/picker-rte-uniforms.d.ts.map +1 -1
- package/dist/picker-rte-uniforms.js +9 -1
- package/dist/picker-rte-uniforms.js.map +1 -1
- package/dist/picker.d.ts.map +1 -1
- package/dist/picker.js +15 -28
- package/dist/picker.js.map +1 -1
- package/dist/picking-manager.d.ts.map +1 -1
- package/dist/picking-manager.js +4 -47
- package/dist/picking-manager.js.map +1 -1
- package/dist/pipeline.d.ts +7 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +37 -59
- package/dist/pipeline.js.map +1 -1
- package/dist/point-picker.d.ts.map +1 -1
- package/dist/point-picker.js +7 -2
- package/dist/point-picker.js.map +1 -1
- package/dist/pointcloud/point-cloud-node.js +1 -1
- package/dist/pointcloud/point-cloud-node.js.map +1 -1
- package/dist/pointcloud/point-cloud-renderer.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-renderer.js +3 -1
- package/dist/pointcloud/point-cloud-renderer.js.map +1 -1
- package/dist/pointcloud/point-cloud-uniforms.d.ts +5 -1
- package/dist/pointcloud/point-cloud-uniforms.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-uniforms.js +7 -1
- package/dist/pointcloud/point-cloud-uniforms.js.map +1 -1
- package/dist/post-pass-chain.d.ts +14 -1
- package/dist/post-pass-chain.d.ts.map +1 -1
- package/dist/post-pass-chain.js +31 -2
- package/dist/post-pass-chain.js.map +1 -1
- package/dist/raycast-engine.d.ts +5 -1
- package/dist/raycast-engine.d.ts.map +1 -1
- package/dist/raycast-engine.js +20 -8
- package/dist/raycast-engine.js.map +1 -1
- package/dist/raycast-point-cloud-query.d.ts +2 -0
- package/dist/raycast-point-cloud-query.d.ts.map +1 -1
- package/dist/raycast-point-cloud-query.js +7 -0
- package/dist/raycast-point-cloud-query.js.map +1 -1
- package/dist/raycast-source-curve-query.d.ts +13 -0
- package/dist/raycast-source-curve-query.d.ts.map +1 -0
- package/dist/raycast-source-curve-query.js +17 -0
- package/dist/raycast-source-curve-query.js.map +1 -0
- package/dist/reference-image-pipeline.d.ts.map +1 -1
- package/dist/reference-image-pipeline.js +4 -2
- package/dist/reference-image-pipeline.js.map +1 -1
- package/dist/relative-to-eye-abi.d.ts +36 -0
- package/dist/relative-to-eye-abi.d.ts.map +1 -0
- package/dist/relative-to-eye-abi.js +72 -0
- package/dist/relative-to-eye-abi.js.map +1 -0
- package/dist/relative-to-eye.d.ts +15 -35
- package/dist/relative-to-eye.d.ts.map +1 -1
- package/dist/relative-to-eye.js +46 -74
- package/dist/relative-to-eye.js.map +1 -1
- package/dist/render-stats.d.ts +5 -1
- package/dist/render-stats.d.ts.map +1 -1
- package/dist/render-stats.js +1 -1
- package/dist/render-stats.js.map +1 -1
- package/dist/renderer-overlays.d.ts.map +1 -1
- package/dist/renderer-overlays.js +3 -2
- package/dist/renderer-overlays.js.map +1 -1
- package/dist/scene-batch-rebuild.d.ts +1 -2
- package/dist/scene-batch-rebuild.d.ts.map +1 -1
- package/dist/scene-batch-rebuild.js +4 -8
- package/dist/scene-batch-rebuild.js.map +1 -1
- package/dist/scene-batch-upload.d.ts.map +1 -1
- package/dist/scene-batch-upload.js +7 -3
- package/dist/scene-batch-upload.js.map +1 -1
- package/dist/scene-contents.d.ts +1 -1
- package/dist/scene-contents.d.ts.map +1 -1
- package/dist/scene-derived-batches.d.ts +19 -64
- package/dist/scene-derived-batches.d.ts.map +1 -1
- package/dist/scene-derived-batches.js +16 -51
- package/dist/scene-derived-batches.js.map +1 -1
- package/dist/scene-device-recovery.d.ts +3 -3
- package/dist/scene-device-recovery.d.ts.map +1 -1
- package/dist/scene-device-recovery.js +12 -9
- package/dist/scene-device-recovery.js.map +1 -1
- package/dist/scene-geometry.d.ts +6 -6
- package/dist/scene-geometry.d.ts.map +1 -1
- package/dist/scene-geometry.js +8 -9
- package/dist/scene-geometry.js.map +1 -1
- package/dist/scene-instance-bounds.d.ts +1 -1
- package/dist/scene-instance-bounds.d.ts.map +1 -1
- package/dist/scene-instance-bounds.js +4 -16
- package/dist/scene-instance-bounds.js.map +1 -1
- package/dist/scene-instance-materialization.d.ts.map +1 -1
- package/dist/scene-instance-materialization.js +4 -4
- package/dist/scene-instance-materialization.js.map +1 -1
- package/dist/scene-instance-translation.d.ts +6 -10
- package/dist/scene-instance-translation.d.ts.map +1 -1
- package/dist/scene-instance-translation.js +9 -31
- package/dist/scene-instance-translation.js.map +1 -1
- package/dist/scene-instance-types.d.ts +11 -2
- package/dist/scene-instance-types.d.ts.map +1 -1
- package/dist/scene-instance-types.js +7 -1
- package/dist/scene-instance-types.js.map +1 -1
- package/dist/scene-model-translation.d.ts +1 -2
- package/dist/scene-model-translation.d.ts.map +1 -1
- package/dist/scene-model-translation.js +4 -3
- package/dist/scene-model-translation.js.map +1 -1
- package/dist/scene-precision.d.ts +1 -1
- package/dist/scene-precision.d.ts.map +1 -1
- package/dist/scene-precision.js +11 -2
- package/dist/scene-precision.js.map +1 -1
- package/dist/scene.d.ts +43 -38
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +121 -129
- package/dist/scene.js.map +1 -1
- package/dist/section-2d-line-buffer.d.ts +2 -2
- package/dist/section-2d-line-buffer.d.ts.map +1 -1
- package/dist/section-2d-line-buffer.js +10 -11
- package/dist/section-2d-line-buffer.js.map +1 -1
- package/dist/section-2d-overlay.d.ts +6 -4
- package/dist/section-2d-overlay.d.ts.map +1 -1
- package/dist/section-2d-overlay.js +45 -21
- package/dist/section-2d-overlay.js.map +1 -1
- package/dist/section-2d-types.d.ts +1 -1
- package/dist/section-2d-types.d.ts.map +1 -1
- package/dist/section-2d-types.js +1 -1
- package/dist/section-2d-types.js.map +1 -1
- package/dist/section-plane.d.ts.map +1 -1
- package/dist/section-plane.js +3 -1
- package/dist/section-plane.js.map +1 -1
- package/dist/selection-mask-pass.d.ts +85 -0
- package/dist/selection-mask-pass.d.ts.map +1 -0
- package/dist/selection-mask-pass.js +170 -0
- package/dist/selection-mask-pass.js.map +1 -0
- package/dist/selection-mask-pipelines.d.ts +57 -0
- package/dist/selection-mask-pipelines.d.ts.map +1 -0
- package/dist/selection-mask-pipelines.js +150 -0
- package/dist/selection-mask-pipelines.js.map +1 -0
- package/dist/selection-outline-frame.d.ts +47 -0
- package/dist/selection-outline-frame.d.ts.map +1 -0
- package/dist/selection-outline-frame.js +122 -0
- package/dist/selection-outline-frame.js.map +1 -0
- package/dist/shaders/depth-reconstruct.wgsl.d.ts +7 -2
- package/dist/shaders/depth-reconstruct.wgsl.d.ts.map +1 -1
- package/dist/shaders/depth-reconstruct.wgsl.js +8 -3
- package/dist/shaders/depth-reconstruct.wgsl.js.map +1 -1
- package/dist/shaders/edges.wgsl.d.ts +18 -0
- package/dist/shaders/edges.wgsl.d.ts.map +1 -1
- package/dist/shaders/edges.wgsl.js +99 -0
- package/dist/shaders/edges.wgsl.js.map +1 -1
- package/dist/shaders/entity-color-table.wgsl.d.ts +2 -0
- package/dist/shaders/entity-color-table.wgsl.d.ts.map +1 -0
- package/dist/shaders/entity-color-table.wgsl.js +85 -0
- package/dist/shaders/entity-color-table.wgsl.js.map +1 -0
- package/dist/shaders/main.wgsl.d.ts +1 -1
- package/dist/shaders/main.wgsl.d.ts.map +1 -1
- package/dist/shaders/main.wgsl.js +45 -113
- package/dist/shaders/main.wgsl.js.map +1 -1
- package/dist/shaders/mesh-uniforms.wgsl.d.ts +2 -0
- package/dist/shaders/mesh-uniforms.wgsl.d.ts.map +1 -0
- package/dist/shaders/mesh-uniforms.wgsl.js +53 -0
- package/dist/shaders/mesh-uniforms.wgsl.js.map +1 -0
- package/dist/shaders/section-2d-overlay.wgsl.d.ts +1 -0
- package/dist/shaders/section-2d-overlay.wgsl.d.ts.map +1 -1
- package/dist/shaders/section-2d-overlay.wgsl.js +3 -2
- package/dist/shaders/section-2d-overlay.wgsl.js.map +1 -1
- package/dist/shaders/selection-mask.wgsl.d.ts +16 -0
- package/dist/shaders/selection-mask.wgsl.d.ts.map +1 -0
- package/dist/shaders/selection-mask.wgsl.js +138 -0
- package/dist/shaders/selection-mask.wgsl.js.map +1 -0
- 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 +3 -3
- package/dist/shadow-occluders.d.ts.map +1 -1
- package/dist/shadow-occluders.js +1 -0
- package/dist/shadow-occluders.js.map +1 -1
- package/dist/shadow-pass.d.ts +0 -1
- package/dist/shadow-pass.d.ts.map +1 -1
- package/dist/shadow-pass.js +26 -32
- package/dist/shadow-pass.js.map +1 -1
- package/dist/shadow-types.d.ts +3 -0
- package/dist/shadow-types.d.ts.map +1 -1
- package/dist/shadow-types.js.map +1 -1
- package/dist/snap-detector.d.ts +5 -0
- package/dist/snap-detector.d.ts.map +1 -1
- package/dist/snap-detector.js.map +1 -1
- package/dist/source-curve-clipping.d.ts +7 -0
- package/dist/source-curve-clipping.d.ts.map +1 -0
- package/dist/source-curve-clipping.js +165 -0
- package/dist/source-curve-clipping.js.map +1 -0
- package/dist/source-curve-snap.d.ts +49 -0
- package/dist/source-curve-snap.d.ts.map +1 -0
- package/dist/source-curve-snap.js +197 -0
- package/dist/source-curve-snap.js.map +1 -0
- package/dist/symbolic-overlay-pipelines.d.ts +1 -1
- package/dist/symbolic-overlay-pipelines.d.ts.map +1 -1
- package/dist/symbolic-overlay-pipelines.js +13 -22
- package/dist/symbolic-overlay-pipelines.js.map +1 -1
- package/dist/symbolic-text-rte.d.ts +16 -0
- package/dist/symbolic-text-rte.d.ts.map +1 -0
- package/dist/symbolic-text-rte.js +37 -0
- package/dist/symbolic-text-rte.js.map +1 -0
- package/dist/textured-vertices.d.ts.map +1 -1
- package/dist/textured-vertices.js +2 -3
- package/dist/textured-vertices.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/visual-enhancement.d.ts +0 -4
- package/dist/visual-enhancement.d.ts.map +1 -1
- package/dist/visual-enhancement.js +0 -5
- package/dist/visual-enhancement.js.map +1 -1
- package/dist/xray-alpha.d.ts +7 -3
- package/dist/xray-alpha.d.ts.map +1 -1
- package/dist/xray-alpha.js +11 -7
- package/dist/xray-alpha.js.map +1 -1
- package/package.json +4 -4
package/dist/edge-pass.js
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* straight onto the resolved canvas.
|
|
15
15
|
*/
|
|
16
16
|
import { EDGE_UNIFORM_BYTES, packEdgeUniforms } from './edge-params.js';
|
|
17
|
-
import {
|
|
17
|
+
import { OUTLINE_UNIFORM_BYTES, packOutlineUniforms } from './outline-params.js';
|
|
18
|
+
import { edgeShaderSource, outlineFragmentSource } from './shaders/edges.wgsl.js';
|
|
18
19
|
export class EdgePass {
|
|
19
20
|
device;
|
|
20
21
|
uniformBuffer;
|
|
@@ -24,6 +25,12 @@ export class EdgePass {
|
|
|
24
25
|
cachedDepthView = null;
|
|
25
26
|
cachedObjectIdView = null;
|
|
26
27
|
cachedBindGroup = null;
|
|
28
|
+
outlineUniformBuffer;
|
|
29
|
+
outlineUniformScratch = new Float32Array(OUTLINE_UNIFORM_BYTES / 4);
|
|
30
|
+
outlineLayout;
|
|
31
|
+
outlinePipeline;
|
|
32
|
+
cachedMask = null;
|
|
33
|
+
cachedOutlineBindGroup = null;
|
|
27
34
|
destroyed = false;
|
|
28
35
|
constructor(device, colorFormat, sampleCount) {
|
|
29
36
|
this.device = device;
|
|
@@ -67,6 +74,43 @@ export class EdgePass {
|
|
|
67
74
|
},
|
|
68
75
|
primitive: { topology: 'triangle-list', cullMode: 'none' },
|
|
69
76
|
});
|
|
77
|
+
// Selection/hover outline composite (#5390): a separate pipeline, since
|
|
78
|
+
// it needs a normal alpha-over blend (it draws an actual colour) rather
|
|
79
|
+
// than the darken-only blend above, and reads the mask textures rather
|
|
80
|
+
// than depth/id — but shares this module's fullscreen-triangle vertex
|
|
81
|
+
// stage (DRY).
|
|
82
|
+
this.outlineUniformBuffer = device.createBuffer({
|
|
83
|
+
label: 'outline-uniforms',
|
|
84
|
+
size: OUTLINE_UNIFORM_BYTES,
|
|
85
|
+
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
|
|
86
|
+
});
|
|
87
|
+
this.outlineLayout = device.createBindGroupLayout({
|
|
88
|
+
label: 'outline-bgl',
|
|
89
|
+
entries: [
|
|
90
|
+
{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: 'unfilterable-float' } },
|
|
91
|
+
{ binding: 1, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: 'unfilterable-float' } },
|
|
92
|
+
{ binding: 2, visibility: GPUShaderStage.FRAGMENT, buffer: { type: 'uniform' } },
|
|
93
|
+
],
|
|
94
|
+
});
|
|
95
|
+
const outlineModule = device.createShaderModule({ label: 'outline-shader', code: outlineFragmentSource() });
|
|
96
|
+
this.outlinePipeline = device.createRenderPipeline({
|
|
97
|
+
label: 'outline-pipeline',
|
|
98
|
+
layout: device.createPipelineLayout({ bindGroupLayouts: [this.outlineLayout] }),
|
|
99
|
+
vertex: { module: outlineModule, entryPoint: 'vs_fullscreen' },
|
|
100
|
+
fragment: {
|
|
101
|
+
module: outlineModule,
|
|
102
|
+
entryPoint: 'fs_outline',
|
|
103
|
+
targets: [{
|
|
104
|
+
format: colorFormat,
|
|
105
|
+
// Premultiplied-over: the shader already returns rgb*alpha.
|
|
106
|
+
blend: {
|
|
107
|
+
color: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha' },
|
|
108
|
+
alpha: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha' },
|
|
109
|
+
},
|
|
110
|
+
}],
|
|
111
|
+
},
|
|
112
|
+
primitive: { topology: 'triangle-list', cullMode: 'none' },
|
|
113
|
+
});
|
|
70
114
|
}
|
|
71
115
|
encode(frame) {
|
|
72
116
|
if (this.destroyed)
|
|
@@ -97,6 +141,33 @@ export class EdgePass {
|
|
|
97
141
|
pass.draw(3, 1, 0, 0);
|
|
98
142
|
pass.end();
|
|
99
143
|
}
|
|
144
|
+
/** Outline the selection/hover mask (#5390) onto `frame.targetView`. */
|
|
145
|
+
encodeOutline(frame) {
|
|
146
|
+
if (this.destroyed)
|
|
147
|
+
return;
|
|
148
|
+
packOutlineUniforms(this.outlineUniformScratch, frame.params);
|
|
149
|
+
this.device.queue.writeBuffer(this.outlineUniformBuffer, 0, this.outlineUniformScratch);
|
|
150
|
+
if (this.cachedMask !== frame.mask || this.cachedOutlineBindGroup === null) {
|
|
151
|
+
this.cachedOutlineBindGroup = this.device.createBindGroup({
|
|
152
|
+
label: 'outline-bg',
|
|
153
|
+
layout: this.outlineLayout,
|
|
154
|
+
entries: [
|
|
155
|
+
{ binding: 0, resource: frame.mask.visibleView },
|
|
156
|
+
{ binding: 1, resource: frame.mask.allView },
|
|
157
|
+
{ binding: 2, resource: { buffer: this.outlineUniformBuffer } },
|
|
158
|
+
],
|
|
159
|
+
});
|
|
160
|
+
this.cachedMask = frame.mask;
|
|
161
|
+
}
|
|
162
|
+
const pass = frame.encoder.beginRenderPass({
|
|
163
|
+
label: 'selection-hover-outline',
|
|
164
|
+
colorAttachments: [{ view: frame.targetView, loadOp: 'load', storeOp: 'store' }],
|
|
165
|
+
});
|
|
166
|
+
pass.setPipeline(this.outlinePipeline);
|
|
167
|
+
pass.setBindGroup(0, this.cachedOutlineBindGroup);
|
|
168
|
+
pass.draw(3, 1, 0, 0);
|
|
169
|
+
pass.end();
|
|
170
|
+
}
|
|
100
171
|
/** Release all GPU resources. Idempotent; the pass is unusable afterwards. */
|
|
101
172
|
destroy() {
|
|
102
173
|
if (this.destroyed)
|
|
@@ -106,6 +177,9 @@ export class EdgePass {
|
|
|
106
177
|
this.cachedBindGroup = null;
|
|
107
178
|
this.cachedDepthView = null;
|
|
108
179
|
this.cachedObjectIdView = null;
|
|
180
|
+
this.outlineUniformBuffer.destroy();
|
|
181
|
+
this.cachedOutlineBindGroup = null;
|
|
182
|
+
this.cachedMask = null;
|
|
109
183
|
}
|
|
110
184
|
}
|
|
111
185
|
//# sourceMappingURL=edge-pass.js.map
|
package/dist/edge-pass.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-pass.js","sourceRoot":"","sources":["../src/edge-pass.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,kBAAkB,EAAwB,gBAAgB,EAAE,MAA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UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-entity colour table (#6076): colour overrides (lens, charts, IDS,
|
|
3
|
+
* compare, 4D) are applied in the BASE pass by looking the entity up in one
|
|
4
|
+
* GPU storage buffer, instead of copying the overridden geometry into overlay
|
|
5
|
+
* batches drawn in a second equal-depth pass.
|
|
6
|
+
*
|
|
7
|
+
* WHAT THE SHADER CAN KNOW. Every flat vertex carries a u32 entity lane whose
|
|
8
|
+
* low 24 bits are the scene id (`MeshData.expressId`, the federated global id)
|
|
9
|
+
* masked to 24 bits, and whose high 8 bits are a colour salt for the depth
|
|
10
|
+
* nudge (`packEntityLane` in scene-geometry.ts). It does NOT carry a model
|
|
11
|
+
* index: federated global ids exceed 2^24 as soon as a few models load (each
|
|
12
|
+
* model's range is its max express id plus a 1,000,000 headroom), so the lane
|
|
13
|
+
* alone is ambiguous across models. Each draw therefore also passes an
|
|
14
|
+
* ANCHOR, the smallest full id it draws (`uniforms.overrideParams.x`), and the
|
|
15
|
+
* shader rebuilds the full id as `anchor + ((lane - anchor) mod 2^24)`. That is
|
|
16
|
+
* exact whenever the draw's ids span less than 2^24. Scene bucket keys carry
|
|
17
|
+
* each id's 2^24 page ({@link entityIdPageKey}), so every bucket batch,
|
|
18
|
+
* streaming fragment and partial sub-batch lies inside one page and meets
|
|
19
|
+
* that by construction. {@link entityIdAnchor} still returns null for a draw
|
|
20
|
+
* that does not (a hand-built batch), and the renderer then leaves it
|
|
21
|
+
* unpainted rather than paint the wrong entity.
|
|
22
|
+
*
|
|
23
|
+
* TABLE LAYOUT: an open-addressing hash table keyed by the full id, one
|
|
24
|
+
* `array<u32>` storage buffer:
|
|
25
|
+
*
|
|
26
|
+
* [0] capacity (power of two, 0 when empty) [1] max probe distance
|
|
27
|
+
* [2] entry count [3] colourBase = 4 + capacity
|
|
28
|
+
* [4 .. 4 + capacity) keys, EMPTY = 0xFFFFFFFF
|
|
29
|
+
* [colourBase + 4 * slot .. + 4) rgba as f32 bit patterns
|
|
30
|
+
*
|
|
31
|
+
* Linear probing from `fmix32(id) & (capacity - 1)`, load factor at most 1/2,
|
|
32
|
+
* and the longest displacement recorded in the header so the shader's probe
|
|
33
|
+
* loop has a bound. A dense per-model table (slot = express id) was the other
|
|
34
|
+
* candidate; it is sized by the model's STEP line count rather than by what
|
|
35
|
+
* is overridden, which on a large federation is tens of millions of slots and
|
|
36
|
+
* exceeds the 128 MiB default `maxStorageBufferBindingSize`. This table is
|
|
37
|
+
* sized by the number of overridden entities only.
|
|
38
|
+
*
|
|
39
|
+
* MEMORY BOUND: 20 bytes per slot plus a 16-byte header, capacity =
|
|
40
|
+
* nextPow2(2n) with a 16-slot minimum (336 bytes), so past that minimum
|
|
41
|
+
* (n >= 8) under 80 bytes per overridden entity and at least 40. 100,000 overridden entities take 262,144 slots = 5.0 MiB. The
|
|
42
|
+
* capacity is capped by `maxStorageBufferBindingSize` and `maxBufferSize`
|
|
43
|
+
* (2,097,152 entries at the 128 MiB default); past that the extra entries are
|
|
44
|
+
* dropped with one console warning.
|
|
45
|
+
*
|
|
46
|
+
* `EntityColorTable.write` rebuilds the image on the CPU (O(n)) and uploads it
|
|
47
|
+
* with one `queue.writeBuffer`; the GPU buffer is reallocated only when the
|
|
48
|
+
* image outgrows it (or the device changed, after a device-loss recovery), and
|
|
49
|
+
* the renderer rebinds it at frame start (`RenderPipeline.setEntityColorTableBuffer`).
|
|
50
|
+
*/
|
|
51
|
+
type Rgba = readonly [number, number, number, number];
|
|
52
|
+
/** Key value of an unused slot. Federated ids stop far below it (`FederationRegistry`'s 2e9 limit). */
|
|
53
|
+
export declare const ENTITY_COLOR_EMPTY_KEY = 4294967295;
|
|
54
|
+
/** Header words before the key section. */
|
|
55
|
+
export declare const ENTITY_COLOR_HEADER_WORDS = 4;
|
|
56
|
+
/** Distinct full ids one draw can resolve from the 24-bit lane (see the module doc). */
|
|
57
|
+
export declare const ENTITY_LANE_ID_SPAN = 16777216;
|
|
58
|
+
/** `overrideParams.y` bit: this draw applies the table. */
|
|
59
|
+
export declare const OVERRIDE_PARAM_PAINT = 1;
|
|
60
|
+
/** `overrideParams.y` bit: paint the override unlit and opaque (`RenderOptions.emphasizeOverrides`). */
|
|
61
|
+
export declare const OVERRIDE_PARAM_EMPHASIZE = 2;
|
|
62
|
+
/** murmur3's 32-bit finalizer; `entityColorSlotHash` in the WGSL is the same function. */
|
|
63
|
+
export declare function entityColorSlotHash(key: number): number;
|
|
64
|
+
/** The table as uploaded: `words` is the whole buffer image. */
|
|
65
|
+
export interface EntityColorTableImage {
|
|
66
|
+
readonly words: Uint32Array;
|
|
67
|
+
readonly capacity: number;
|
|
68
|
+
readonly count: number;
|
|
69
|
+
readonly maxProbe: number;
|
|
70
|
+
/** Overrides that did not fit under the device's buffer limits. */
|
|
71
|
+
readonly dropped: number;
|
|
72
|
+
}
|
|
73
|
+
/** Build the buffer image for `overrides` (keys are scene ids, colours linear 0..1 RGBA). */
|
|
74
|
+
export declare function buildEntityColorTableImage(overrides: ReadonlyMap<number, Rgba>, maxBytes?: number): EntityColorTableImage;
|
|
75
|
+
/** CPU mirror of the shader lookup: the colour stored for `id`, or null (sentinel). */
|
|
76
|
+
export declare function lookupEntityColor(image: EntityColorTableImage, id: number): [number, number, number, number] | null;
|
|
77
|
+
/**
|
|
78
|
+
* The anchor a draw passes so the shader can rebuild full ids from 24-bit
|
|
79
|
+
* lanes: the smallest id, or null when the ids span 2^24 or more (or are not
|
|
80
|
+
* table keys) and the draw must stay unpainted.
|
|
81
|
+
*/
|
|
82
|
+
export declare function entityIdAnchor(ids: ArrayLike<number>): number | null;
|
|
83
|
+
/** CPU mirror of the shader's `resolveLaneEntityId`: the full id behind a lane under `anchor`. */
|
|
84
|
+
export declare function resolveLaneEntityId(anchor: number, lane: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* `key` qualified by the 2^24 page of `id` (unchanged for ids below 2^24).
|
|
87
|
+
* Scene bucket keys go through this, so no batch holds ids from two pages and
|
|
88
|
+
* {@link entityIdAnchor} never refuses a bucket batch or its fragments.
|
|
89
|
+
*/
|
|
90
|
+
export declare function entityIdPageKey(id: number, key: string): string;
|
|
91
|
+
/** {@link entityIdAnchor} of a batch, cached per batch object (a batch's `expressIds` never change). */
|
|
92
|
+
export declare function batchEntityIdAnchor(batch: {
|
|
93
|
+
readonly expressIds: readonly number[];
|
|
94
|
+
}): number | null;
|
|
95
|
+
/**
|
|
96
|
+
* Whether any entity of `batch` is overridden, cached per batch for one
|
|
97
|
+
* override `generation` (`Scene.getColorOverrideGeneration`). A batch with none
|
|
98
|
+
* is drawn with the table off, so its fragments skip the lookup entirely.
|
|
99
|
+
*/
|
|
100
|
+
export declare function batchHasColorOverride(batch: {
|
|
101
|
+
readonly expressIds: readonly number[];
|
|
102
|
+
}, overrides: ReadonlyMap<number, unknown> | null, generation: number): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Write a draw's `overrideParams` lanes (x = anchor, y = mode bits). A null
|
|
105
|
+
* anchor, or `paint = false`, writes zeros: the draw keeps its own colour.
|
|
106
|
+
*/
|
|
107
|
+
export declare function packOverrideParams(out: Uint32Array, anchor: number | null, paint: boolean, emphasize: boolean): void;
|
|
108
|
+
interface TableDevice {
|
|
109
|
+
readonly limits?: {
|
|
110
|
+
readonly maxStorageBufferBindingSize?: number;
|
|
111
|
+
readonly maxBufferSize?: number;
|
|
112
|
+
};
|
|
113
|
+
createBuffer(descriptor: GPUBufferDescriptor): GPUBuffer;
|
|
114
|
+
readonly queue: {
|
|
115
|
+
writeBuffer(buffer: GPUBuffer, offset: number, data: Uint32Array): void;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** Owns the table's CPU image and its GPU buffer. One per `Scene`. */
|
|
119
|
+
export declare class EntityColorTable {
|
|
120
|
+
private image;
|
|
121
|
+
private buffer;
|
|
122
|
+
private bufferDevice;
|
|
123
|
+
private bufferBytes;
|
|
124
|
+
private uploadedBytes;
|
|
125
|
+
private warnedDropped;
|
|
126
|
+
/** Replace the table with `overrides` and upload it. */
|
|
127
|
+
write(device: TableDevice, overrides: ReadonlyMap<number, Rgba>): void;
|
|
128
|
+
/** Empty the table: only the 16-byte header is rewritten (count 0 disables every lookup). */
|
|
129
|
+
clear(): void;
|
|
130
|
+
/** Drop the GPU buffer (device loss, scene teardown); the CPU image survives for re-upload. */
|
|
131
|
+
releaseGpu(): void;
|
|
132
|
+
/** The buffer the renderer binds, or null while nothing was ever written. */
|
|
133
|
+
getBuffer(): GPUBuffer | null;
|
|
134
|
+
/** The current CPU image (what the GPU buffer holds after the last write). */
|
|
135
|
+
getImage(): EntityColorTableImage;
|
|
136
|
+
/** Bytes the last `write` / `clear` uploaded. */
|
|
137
|
+
getLastUploadBytes(): number;
|
|
138
|
+
}
|
|
139
|
+
export {};
|
|
140
|
+
//# sourceMappingURL=entity-color-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-color-table.d.ts","sourceRoot":"","sources":["../src/entity-color-table.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,KAAK,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtD,uGAAuG;AACvG,eAAO,MAAM,sBAAsB,aAAa,CAAC;AACjD,2CAA2C;AAC3C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAG3C,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,WAAY,CAAC;AAI7C,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,wGAAwG;AACxG,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQvD;AAED,gEAAgE;AAChE,MAAM,WAAW,qBAAq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|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/** Key value of an unused slot. Federated ids stop far below it (`FederationRegistry`'s 2e9 limit). */
|
|
5
|
+
export const ENTITY_COLOR_EMPTY_KEY = 0xFFFFFFFF;
|
|
6
|
+
/** Header words before the key section. */
|
|
7
|
+
export const ENTITY_COLOR_HEADER_WORDS = 4;
|
|
8
|
+
const MIN_CAPACITY = 16;
|
|
9
|
+
const BYTES_PER_SLOT = 20; // one u32 key + four f32 colour lanes
|
|
10
|
+
/** Distinct full ids one draw can resolve from the 24-bit lane (see the module doc). */
|
|
11
|
+
export const ENTITY_LANE_ID_SPAN = 0x1000000;
|
|
12
|
+
/** Used when a device reports no limit (the WebGPU default for `maxStorageBufferBindingSize`). */
|
|
13
|
+
const DEFAULT_MAX_TABLE_BYTES = 128 * 1024 * 1024;
|
|
14
|
+
/** `overrideParams.y` bit: this draw applies the table. */
|
|
15
|
+
export const OVERRIDE_PARAM_PAINT = 1;
|
|
16
|
+
/** `overrideParams.y` bit: paint the override unlit and opaque (`RenderOptions.emphasizeOverrides`). */
|
|
17
|
+
export const OVERRIDE_PARAM_EMPHASIZE = 2;
|
|
18
|
+
/** murmur3's 32-bit finalizer; `entityColorSlotHash` in the WGSL is the same function. */
|
|
19
|
+
export function entityColorSlotHash(key) {
|
|
20
|
+
let h = key >>> 0;
|
|
21
|
+
h ^= h >>> 16;
|
|
22
|
+
h = Math.imul(h, 0x85ebca6b) >>> 0;
|
|
23
|
+
h ^= h >>> 13;
|
|
24
|
+
h = Math.imul(h, 0xc2b2ae35) >>> 0;
|
|
25
|
+
h ^= h >>> 16;
|
|
26
|
+
return h >>> 0;
|
|
27
|
+
}
|
|
28
|
+
const EMPTY_IMAGE = {
|
|
29
|
+
words: new Uint32Array(ENTITY_COLOR_HEADER_WORDS), capacity: 0, count: 0, maxProbe: 0, dropped: 0,
|
|
30
|
+
};
|
|
31
|
+
function isTableKey(id) {
|
|
32
|
+
return Number.isInteger(id) && id >= 0 && id < ENTITY_COLOR_EMPTY_KEY;
|
|
33
|
+
}
|
|
34
|
+
function capacityFor(entries, maxBytes) {
|
|
35
|
+
let capacity = MIN_CAPACITY;
|
|
36
|
+
while (capacity < entries * 2)
|
|
37
|
+
capacity *= 2;
|
|
38
|
+
while (capacity > MIN_CAPACITY && ENTITY_COLOR_HEADER_WORDS * 4 + capacity * BYTES_PER_SLOT > maxBytes)
|
|
39
|
+
capacity /= 2;
|
|
40
|
+
return capacity;
|
|
41
|
+
}
|
|
42
|
+
/** Build the buffer image for `overrides` (keys are scene ids, colours linear 0..1 RGBA). */
|
|
43
|
+
export function buildEntityColorTableImage(overrides, maxBytes = DEFAULT_MAX_TABLE_BYTES) {
|
|
44
|
+
let entries = 0;
|
|
45
|
+
for (const id of overrides.keys())
|
|
46
|
+
if (isTableKey(id))
|
|
47
|
+
entries++;
|
|
48
|
+
if (entries === 0)
|
|
49
|
+
return EMPTY_IMAGE;
|
|
50
|
+
const capacity = capacityFor(entries, maxBytes);
|
|
51
|
+
const limit = Math.min(entries, capacity / 2);
|
|
52
|
+
const colorBase = ENTITY_COLOR_HEADER_WORDS + capacity;
|
|
53
|
+
const words = new Uint32Array(colorBase + capacity * 4);
|
|
54
|
+
const colors = new Float32Array(words.buffer);
|
|
55
|
+
words.fill(ENTITY_COLOR_EMPTY_KEY, ENTITY_COLOR_HEADER_WORDS, colorBase);
|
|
56
|
+
const mask = capacity - 1;
|
|
57
|
+
let count = 0;
|
|
58
|
+
let maxProbe = 0;
|
|
59
|
+
for (const [id, rgba] of overrides) {
|
|
60
|
+
if (count === limit)
|
|
61
|
+
break;
|
|
62
|
+
if (!isTableKey(id))
|
|
63
|
+
continue;
|
|
64
|
+
let slot = entityColorSlotHash(id) & mask;
|
|
65
|
+
let probe = 0;
|
|
66
|
+
while (words[ENTITY_COLOR_HEADER_WORDS + slot] !== ENTITY_COLOR_EMPTY_KEY) {
|
|
67
|
+
slot = (slot + 1) & mask;
|
|
68
|
+
probe++;
|
|
69
|
+
}
|
|
70
|
+
words[ENTITY_COLOR_HEADER_WORDS + slot] = id;
|
|
71
|
+
colors.set([rgba[0], rgba[1], rgba[2], rgba[3]], colorBase + slot * 4);
|
|
72
|
+
if (probe > maxProbe)
|
|
73
|
+
maxProbe = probe;
|
|
74
|
+
count++;
|
|
75
|
+
}
|
|
76
|
+
words[0] = capacity;
|
|
77
|
+
words[1] = maxProbe;
|
|
78
|
+
words[2] = count;
|
|
79
|
+
words[3] = colorBase;
|
|
80
|
+
return { words, capacity, count, maxProbe, dropped: entries - count };
|
|
81
|
+
}
|
|
82
|
+
/** CPU mirror of the shader lookup: the colour stored for `id`, or null (sentinel). */
|
|
83
|
+
export function lookupEntityColor(image, id) {
|
|
84
|
+
if (image.count === 0 || !isTableKey(id))
|
|
85
|
+
return null;
|
|
86
|
+
const { words, capacity } = image;
|
|
87
|
+
const colorBase = words[3];
|
|
88
|
+
const mask = capacity - 1;
|
|
89
|
+
let slot = entityColorSlotHash(id) & mask;
|
|
90
|
+
for (let i = 0; i <= image.maxProbe && i < capacity; i++) {
|
|
91
|
+
const key = words[ENTITY_COLOR_HEADER_WORDS + slot];
|
|
92
|
+
if (key === id) {
|
|
93
|
+
const c = new Float32Array(words.buffer, (colorBase + slot * 4) * 4, 4);
|
|
94
|
+
return [c[0], c[1], c[2], c[3]];
|
|
95
|
+
}
|
|
96
|
+
if (key === ENTITY_COLOR_EMPTY_KEY)
|
|
97
|
+
return null;
|
|
98
|
+
slot = (slot + 1) & mask;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The anchor a draw passes so the shader can rebuild full ids from 24-bit
|
|
104
|
+
* lanes: the smallest id, or null when the ids span 2^24 or more (or are not
|
|
105
|
+
* table keys) and the draw must stay unpainted.
|
|
106
|
+
*/
|
|
107
|
+
export function entityIdAnchor(ids) {
|
|
108
|
+
if (ids.length === 0)
|
|
109
|
+
return null;
|
|
110
|
+
let min = Infinity;
|
|
111
|
+
let max = -Infinity;
|
|
112
|
+
for (let i = 0; i < ids.length; i++) {
|
|
113
|
+
const id = ids[i];
|
|
114
|
+
if (!isTableKey(id))
|
|
115
|
+
return null;
|
|
116
|
+
if (id < min)
|
|
117
|
+
min = id;
|
|
118
|
+
if (id > max)
|
|
119
|
+
max = id;
|
|
120
|
+
}
|
|
121
|
+
return max - min < ENTITY_LANE_ID_SPAN ? min : null;
|
|
122
|
+
}
|
|
123
|
+
/** CPU mirror of the shader's `resolveLaneEntityId`: the full id behind a lane under `anchor`. */
|
|
124
|
+
export function resolveLaneEntityId(anchor, lane) {
|
|
125
|
+
return (anchor + (((lane >>> 0) - anchor) & 0x00FFFFFF)) >>> 0;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* `key` qualified by the 2^24 page of `id` (unchanged for ids below 2^24).
|
|
129
|
+
* Scene bucket keys go through this, so no batch holds ids from two pages and
|
|
130
|
+
* {@link entityIdAnchor} never refuses a bucket batch or its fragments.
|
|
131
|
+
*/
|
|
132
|
+
export function entityIdPageKey(id, key) {
|
|
133
|
+
const page = Math.floor(id / ENTITY_LANE_ID_SPAN);
|
|
134
|
+
return page > 0 ? `p${page}~${key}` : key;
|
|
135
|
+
}
|
|
136
|
+
const anchorCache = new WeakMap();
|
|
137
|
+
/** {@link entityIdAnchor} of a batch, cached per batch object (a batch's `expressIds` never change). */
|
|
138
|
+
export function batchEntityIdAnchor(batch) {
|
|
139
|
+
let anchor = anchorCache.get(batch);
|
|
140
|
+
if (anchor === undefined) {
|
|
141
|
+
anchor = entityIdAnchor(batch.expressIds);
|
|
142
|
+
anchorCache.set(batch, anchor);
|
|
143
|
+
}
|
|
144
|
+
return anchor;
|
|
145
|
+
}
|
|
146
|
+
const hasOverrideCache = new WeakMap();
|
|
147
|
+
/**
|
|
148
|
+
* Whether any entity of `batch` is overridden, cached per batch for one
|
|
149
|
+
* override `generation` (`Scene.getColorOverrideGeneration`). A batch with none
|
|
150
|
+
* is drawn with the table off, so its fragments skip the lookup entirely.
|
|
151
|
+
*/
|
|
152
|
+
export function batchHasColorOverride(batch, overrides, generation) {
|
|
153
|
+
if (!overrides || overrides.size === 0)
|
|
154
|
+
return false;
|
|
155
|
+
const cached = hasOverrideCache.get(batch);
|
|
156
|
+
if (cached && cached.generation === generation)
|
|
157
|
+
return cached.has;
|
|
158
|
+
const has = batch.expressIds.some((id) => overrides.has(id));
|
|
159
|
+
hasOverrideCache.set(batch, { generation, has });
|
|
160
|
+
return has;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Write a draw's `overrideParams` lanes (x = anchor, y = mode bits). A null
|
|
164
|
+
* anchor, or `paint = false`, writes zeros: the draw keeps its own colour.
|
|
165
|
+
*/
|
|
166
|
+
export function packOverrideParams(out, anchor, paint, emphasize) {
|
|
167
|
+
if (paint && anchor !== null) {
|
|
168
|
+
out[0] = anchor;
|
|
169
|
+
out[1] = OVERRIDE_PARAM_PAINT | (emphasize ? OVERRIDE_PARAM_EMPHASIZE : 0);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
out[0] = 0;
|
|
173
|
+
out[1] = 0;
|
|
174
|
+
}
|
|
175
|
+
out[2] = 0;
|
|
176
|
+
out[3] = 0;
|
|
177
|
+
}
|
|
178
|
+
/** Owns the table's CPU image and its GPU buffer. One per `Scene`. */
|
|
179
|
+
export class EntityColorTable {
|
|
180
|
+
image = EMPTY_IMAGE;
|
|
181
|
+
buffer = null;
|
|
182
|
+
bufferDevice = null;
|
|
183
|
+
bufferBytes = 0;
|
|
184
|
+
uploadedBytes = 0;
|
|
185
|
+
warnedDropped = false; // per table, i.e. per scene
|
|
186
|
+
/** Replace the table with `overrides` and upload it. */
|
|
187
|
+
write(device, overrides) {
|
|
188
|
+
const limits = device.limits;
|
|
189
|
+
const maxBytes = Math.min(limits?.maxStorageBufferBindingSize ?? DEFAULT_MAX_TABLE_BYTES, limits?.maxBufferSize ?? DEFAULT_MAX_TABLE_BYTES);
|
|
190
|
+
this.image = buildEntityColorTableImage(overrides, maxBytes);
|
|
191
|
+
if (this.image.dropped > 0 && !this.warnedDropped) {
|
|
192
|
+
this.warnedDropped = true;
|
|
193
|
+
console.warn(`[EntityColorTable] ${this.image.dropped} colour overrides exceed the device's storage-buffer limit and are not painted.`);
|
|
194
|
+
}
|
|
195
|
+
const bytes = this.image.words.byteLength;
|
|
196
|
+
if (!this.buffer || this.bufferDevice !== device || this.bufferBytes < bytes) {
|
|
197
|
+
this.buffer?.destroy();
|
|
198
|
+
this.bufferBytes = Math.max(bytes, ENTITY_COLOR_HEADER_WORDS * 4);
|
|
199
|
+
this.buffer = device.createBuffer({
|
|
200
|
+
label: 'entity-color-table',
|
|
201
|
+
size: this.bufferBytes,
|
|
202
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
|
|
203
|
+
});
|
|
204
|
+
this.bufferDevice = device;
|
|
205
|
+
}
|
|
206
|
+
device.queue.writeBuffer(this.buffer, 0, this.image.words);
|
|
207
|
+
this.uploadedBytes = bytes;
|
|
208
|
+
}
|
|
209
|
+
/** Empty the table: only the 16-byte header is rewritten (count 0 disables every lookup). */
|
|
210
|
+
clear() {
|
|
211
|
+
this.image = EMPTY_IMAGE;
|
|
212
|
+
this.uploadedBytes = 0;
|
|
213
|
+
if (this.buffer && this.bufferDevice) {
|
|
214
|
+
this.bufferDevice.queue.writeBuffer(this.buffer, 0, EMPTY_IMAGE.words);
|
|
215
|
+
this.uploadedBytes = EMPTY_IMAGE.words.byteLength;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/** Drop the GPU buffer (device loss, scene teardown); the CPU image survives for re-upload. */
|
|
219
|
+
releaseGpu() {
|
|
220
|
+
this.buffer?.destroy();
|
|
221
|
+
this.buffer = null;
|
|
222
|
+
this.bufferDevice = null;
|
|
223
|
+
this.bufferBytes = 0;
|
|
224
|
+
}
|
|
225
|
+
/** The buffer the renderer binds, or null while nothing was ever written. */
|
|
226
|
+
getBuffer() {
|
|
227
|
+
return this.buffer;
|
|
228
|
+
}
|
|
229
|
+
/** The current CPU image (what the GPU buffer holds after the last write). */
|
|
230
|
+
getImage() {
|
|
231
|
+
return this.image;
|
|
232
|
+
}
|
|
233
|
+
/** Bytes the last `write` / `clear` uploaded. */
|
|
234
|
+
getLastUploadBytes() {
|
|
235
|
+
return this.uploadedBytes;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=entity-color-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-color-table.js","sourceRoot":"","sources":["../src/entity-color-table.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAuD/D,uGAAuG;AACvG,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AACjD,2CAA2C;AAC3C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,cAAc,GAAG,EAAE,CAAC,CAAC,sCAAsC;AACjE,wFAAwF;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAC7C,kGAAkG;AAClG,MAAM,uBAAuB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,wGAAwG;AACxG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C,0FAA0F;AAC1F,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;IAClB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CA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B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,6EAA6E;IAC7E,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,8EAA8E;IAC9E,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,iDAAiD;IACjD,kBAAkB;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* pre-check skips the frame, and `containFrameThrow` catches whatever a
|
|
7
7
|
* mid-frame call throws. Every upload call site that runs OUTSIDE that loop —
|
|
8
8
|
* `addMeshes`, `loadGeometry`, `addMesh`, `ensureMeshResources`,
|
|
9
|
-
* `createMeshFromData`, and the viewer's `
|
|
9
|
+
* `createMeshFromData`, and the viewer's `setAuthoringOverlayMeshes` — has none of
|
|
10
10
|
* that. Before this module, a `device.createBuffer()` on a lost-but-not-yet-
|
|
11
11
|
* `isInitialized()==false` device (see `getGPUDevice()`'s doc: a loss never
|
|
12
12
|
* calls `destroy()`, so the zombie device stays "initialized") threw straight
|
package/dist/gpu-upload-guard.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* pre-check skips the frame, and `containFrameThrow` catches whatever a
|
|
10
10
|
* mid-frame call throws. Every upload call site that runs OUTSIDE that loop —
|
|
11
11
|
* `addMeshes`, `loadGeometry`, `addMesh`, `ensureMeshResources`,
|
|
12
|
-
* `createMeshFromData`, and the viewer's `
|
|
12
|
+
* `createMeshFromData`, and the viewer's `setAuthoringOverlayMeshes` — has none of
|
|
13
13
|
* that. Before this module, a `device.createBuffer()` on a lost-but-not-yet-
|
|
14
14
|
* `isInitialized()==false` device (see `getGPUDevice()`'s doc: a loss never
|
|
15
15
|
* calls `destroy()`, so the zombie device stays "initialized") threw straight
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU copies of the hovered entity's pieces for the hover pre-highlight mask
|
|
3
|
+
* (#5390). A batched model has no individual mesh for an entity that is not
|
|
4
|
+
* selected, so the hover outline would otherwise never draw.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately kept OUT of `Scene.meshes`: hydrated scene meshes are also
|
|
7
|
+
* drawn by the main pass, so a hovered translucent entity would blend twice
|
|
8
|
+
* over its own batch copy. These copies are only ever drawn into the mask.
|
|
9
|
+
*
|
|
10
|
+
* Every piece of the entity is uploaded (a window or a layered wall is several
|
|
11
|
+
* pieces), through the same `uploadIndividualMesh` selection hydration uses,
|
|
12
|
+
* so the outline is bit-coincident with the batch it traces. The copies are
|
|
13
|
+
* rebuilt only when the hovered (model, id) changes, and the previous ones are
|
|
14
|
+
* destroyed then; `release()` frees them when nothing is hovered.
|
|
15
|
+
*/
|
|
16
|
+
import type { MeshData } from '@ifc-lite/geometry';
|
|
17
|
+
import { type IndividualMeshFrame, type IndividualMeshGpu } from './individual-mesh-upload.js';
|
|
18
|
+
export declare class HoverMeshCache {
|
|
19
|
+
private key;
|
|
20
|
+
private pieces;
|
|
21
|
+
/**
|
|
22
|
+
* The GPU pieces for `(modelIndex, id)`: cached while the key is unchanged,
|
|
23
|
+
* otherwise `pieces()` is re-read and uploaded.
|
|
24
|
+
*/
|
|
25
|
+
resolve(device: GPUDevice, id: number, modelIndex: number | undefined, pieces: () => readonly MeshData[] | undefined, frameOf: (meshData: MeshData) => IndividualMeshFrame): readonly IndividualMeshGpu[];
|
|
26
|
+
/** Destroy the cached copies. Idempotent. */
|
|
27
|
+
release(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=hover-mesh-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-mesh-cache.d.ts","sourceRoot":"","sources":["../src/hover-mesh-cache.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAwB,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErH,qBAAa,cAAc;IACzB,OAAO,CAAC,GAAG,CAAuB;IAClC,OAAO,CAAC,MAAM,CAA2B;IAEzC;;;OAGG;IACH,OAAO,CACL,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,SAAS,QAAQ,EAAE,GAAG,SAAS,EAC7C,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,mBAAmB,GACnD,SAAS,iBAAiB,EAAE;IAS/B,6CAA6C;IAC7C,OAAO,IAAI,IAAI;CAQhB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { uploadIndividualMesh } from './individual-mesh-upload.js';
|
|
5
|
+
export class HoverMeshCache {
|
|
6
|
+
key = null;
|
|
7
|
+
pieces = [];
|
|
8
|
+
/**
|
|
9
|
+
* The GPU pieces for `(modelIndex, id)`: cached while the key is unchanged,
|
|
10
|
+
* otherwise `pieces()` is re-read and uploaded.
|
|
11
|
+
*/
|
|
12
|
+
resolve(device, id, modelIndex, pieces, frameOf) {
|
|
13
|
+
const key = `${modelIndex ?? 'any'}:${id}`;
|
|
14
|
+
if (key === this.key)
|
|
15
|
+
return this.pieces;
|
|
16
|
+
this.release();
|
|
17
|
+
this.key = key;
|
|
18
|
+
this.pieces = (pieces() ?? []).map((meshData) => uploadIndividualMesh(device, meshData, frameOf(meshData)));
|
|
19
|
+
return this.pieces;
|
|
20
|
+
}
|
|
21
|
+
/** Destroy the cached copies. Idempotent. */
|
|
22
|
+
release() {
|
|
23
|
+
for (const piece of this.pieces) {
|
|
24
|
+
piece.vertexBuffer.destroy();
|
|
25
|
+
piece.indexBuffer.destroy();
|
|
26
|
+
}
|
|
27
|
+
this.pieces = [];
|
|
28
|
+
this.key = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=hover-mesh-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-mesh-cache.js","sourceRoot":"","sources":["../src/hover-mesh-cache.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAmB/D,OAAO,EAAE,oBAAoB,EAAoD,MAAM,6BAA6B,CAAC;AAErH,MAAM,OAAO,cAAc;IACjB,GAAG,GAAkB,IAAI,CAAC;IAC1B,MAAM,GAAwB,EAAE,CAAC;IAEzC;;;OAGG;IACH,OAAO,CACL,MAAiB,EACjB,EAAU,EACV,UAA8B,EAC9B,MAA6C,EAC7C,OAAoD;QAEpD,MAAM,GAAG,GAAG,GAAG,UAAU,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;QAC3C,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC5G,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,6CAA6C;IAC7C,OAAO;QACL,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC7B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;IAClB,CAAC;CACF"}
|