@ifc-lite/renderer 1.15.3 → 1.16.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.
@@ -83,8 +83,14 @@ export declare const PIPELINE_CONSTANTS: {
83
83
  readonly FLAGS_BYTE_OFFSET: 176;
84
84
  /** Default MSAA sample count */
85
85
  readonly DEFAULT_SAMPLE_COUNT: 4;
86
- /** Depth format for reverse-Z */
87
- readonly DEPTH_FORMAT: "depth32float";
86
+ /**
87
+ * Depth/stencil format used by RenderPipeline. Switched from depth32float
88
+ * to depth24plus-stencil8 when the 3D section work introduced a render
89
+ * pass shared by the main opaque, the section-plane preview, and the 2D
90
+ * overlay cap — WebGPU requires a single depth-stencil format across all
91
+ * pipelines that write to the same pass attachment.
92
+ */
93
+ readonly DEPTH_FORMAT: "depth24plus-stencil8";
88
94
  };
89
95
  export declare const LIGHTING_CONSTANTS: {
90
96
  readonly SUN_LIGHT: {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,eAAO,MAAM,gBAAgB;IAE3B,0DAA0D;;IAE1D,6CAA6C;;IAI7C,kCAAkC;;IAElC,4CAA4C;;IAE5C,2BAA2B;;IAE3B,uBAAuB;;IAEvB,mCAAmC;;IAEnC,sDAAsD;;;;;;;;;;;;;;;;;;;;IAYtD,iDAAiD;;IAEjD,2CAA2C;;IAE3C,uCAAuC;;IAIvC,wDAAwD;;IAExD,wDAAwD;;IAExD,2CAA2C;;IAI3C,uCAAuC;;IAEvC,qCAAqC;;IAIrC,0CAA0C;;IAE1C,6CAA6C;;IAE7C,yCAAyC;;;;;;;CAKjC,CAAC;AAMX,eAAO,MAAM,aAAa;IACxB,qDAAqD;;IAErD,uCAAuC;;IAEvC,yBAAyB;;CAEjB,CAAC;AAMX,eAAO,MAAM,eAAe;IAC1B,+CAA+C;;CAEvC,CAAC;AAMX,eAAO,MAAM,kB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AC;AAMX,eAAO,MAAM,cAAc;IACzB,4DAA4D;;IAE5D,yBAAyB;;CAEjB,CAAC"}
package/dist/constants.js CHANGED
@@ -93,8 +93,14 @@ export const PIPELINE_CONSTANTS = {
93
93
  /** Default MSAA sample count */
94
94
  DEFAULT_SAMPLE_COUNT: 4,
95
95
  // Depth buffer
96
- /** Depth format for reverse-Z */
97
- DEPTH_FORMAT: 'depth32float',
96
+ /**
97
+ * Depth/stencil format used by RenderPipeline. Switched from depth32float
98
+ * to depth24plus-stencil8 when the 3D section work introduced a render
99
+ * pass shared by the main opaque, the section-plane preview, and the 2D
100
+ * overlay cap — WebGPU requires a single depth-stencil format across all
101
+ * pipelines that write to the same pass attachment.
102
+ */
103
+ DEPTH_FORMAT: 'depth24plus-stencil8',
98
104
  };
99
105
  // ============================================================================
100
106
  // Lighting Constants (for shaders)
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;GAEG;AAEH,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,iBAAiB;IACjB,0DAA0D;IAC1D,cAAc,EAAE,IAAI;IACpB,6CAA6C;IAC7C,sBAAsB,EAAE,KAAK;IAE7B,kBAAkB;IAClB,kCAAkC;IAClC,kBAAkB,EAAE,GAAG;IACvB,4CAA4C;IAC5C,iBAAiB,EAAE,IAAI;IACvB,2BAA2B;IAC3B,oBAAoB,EAAE,KAAK;IAC3B,uBAAuB;IACvB,gBAAgB,EAAE,KAAK;IACvB,mCAAmC;IACnC,cAAc,EAAE,GAAG;IACnB,sDAAsD;IACtD,wBAAwB,EAAE,OAAO;IAEjC,uBAAuB;IACvB,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAW;IACnD,cAAc,EAAE,EAAE,CAAC,EAAE,CA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+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,4DAA4D;IAC5D,sBAAsB,EAAE,GAAG;IAC3B,yBAAyB;IACzB,aAAa,EAAE,YAAqB;CAC5B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,7 +10,9 @@ export { Picker } from './picker.js';
10
10
  export { MathUtils } from './math.js';
11
11
  export { SectionPlaneRenderer } from './section-plane.js';
12
12
  export { Section2DOverlayRenderer } from './section-2d-overlay.js';
13
- export type { Section2DOverlayOptions, CutPolygon2D, DrawingLine2D } from './section-2d-overlay.js';
13
+ export { DEFAULT_CAP_STYLE, HATCH_PATTERN_IDS } from './section-cap-style.js';
14
+ export type { SectionCapStyle, HatchPatternId } from './section-cap-style.js';
15
+ export type { Section2DOverlayOptions, Section2DOverlayCapStyle, CutPolygon2D, DrawingLine2D } from './section-2d-overlay.js';
14
16
  export { Raycaster } from './raycaster.js';
15
17
  export { SnapDetector, SnapType } from './snap-detector.js';
16
18
  export { BVH } from './bvh.js';
@@ -52,6 +54,7 @@ export declare class Renderer {
52
54
  private lastRenderErrorTime;
53
55
  private readonly RENDER_ERROR_THROTTLE_MS;
54
56
  private _renderRequested;
57
+ private _loggedSectionBounds;
55
58
  private readonly uniformScratch;
56
59
  private readonly uniformScratchU32;
57
60
  constructor(canvas: HTMLCanvasElement);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MA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AK,EAAE,aAAa,EAAE,EACtB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,EAC/B,QAAQ,EAAE,MAAM,EAAG,mBAAmB;IACtC,YAAY,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,EAAG,2CAA2C;IAC3F,OAAO,GAAE,OAAe,GACzB,IAAI;IAqBP;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAM7B;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,WAAW,IAAI,cAAc,GAAG,IAAI;IAIpC;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,YAAY,IAAI,SAAS,GAAG,IAAI;IAOhC;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAqBjD;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI;IA8Bf;;OAEG;IACH,SAAS,IAAI,iBAAiB;CAGjC"}
package/dist/index.js CHANGED
@@ -12,6 +12,10 @@ export { Picker } from './picker.js';
12
12
  export { MathUtils } from './math.js';
13
13
  export { SectionPlaneRenderer } from './section-plane.js';
14
14
  export { Section2DOverlayRenderer } from './section-2d-overlay.js';
15
+ // Section cap styling (hatch pattern ids + default colours). The cap itself
16
+ // is now rendered by Section2DOverlayRenderer's fill pass; this module just
17
+ // holds the styling primitives shared with the store and UI.
18
+ export { DEFAULT_CAP_STYLE, HATCH_PATTERN_IDS } from './section-cap-style.js';
15
19
  export { Raycaster } from './raycaster.js';
16
20
  export { SnapDetector, SnapType } from './snap-detector.js';
17
21
  export { BVH } from './bvh.js';
@@ -32,6 +36,7 @@ import { FrustumUtils } from '@ifc-lite/spatial';
32
36
  import { deduplicateMeshes } from '@ifc-lite/geometry';
33
37
  import { SectionPlaneRenderer } from './section-plane.js';
34
38
  import { Section2DOverlayRenderer } from './section-2d-overlay.js';
39
+ import { DEFAULT_CAP_STYLE, HATCH_PATTERN_IDS } from './section-cap-style.js';
35
40
  import { PickingManager } from './picking-manager.js';
36
41
  import { RaycastEngine } from './raycast-engine.js';
37
42
  import { PostProcessor } from './post-processor.js';
@@ -68,6 +73,9 @@ export class Renderer {
68
73
  // Dirty flag: set by requestRender(), consumed by the animation loop.
69
74
  // Centralises all render scheduling — callers never call render() directly.
70
75
  _renderRequested = false;
76
+ // One-shot log guard — prints Y-up clip bounds on first section-enable so
77
+ // users can confirm the slider is operating on the intended range.
78
+ _loggedSectionBounds = false;
71
79
  // Pooled per-frame buffers to avoid GC pressure from per-batch Float32Array allocations
72
80
  // A single 192-byte uniform buffer (48 floats) is reused for all batches/meshes within a frame
73
81
  uniformScratch = new Float32Array(48);
@@ -629,21 +637,16 @@ export class Renderer {
629
637
  };
630
638
  }
631
639
  if (options.sectionPlane) {
632
- // Get model bounds from ALL geometry sources: individual meshes AND batched meshes
640
+ // Get model bounds from batched meshes. We deliberately EXCLUDE
641
+ // individual meshes (`this.scene.getMeshes()`) here: those are
642
+ // created lazily for selection highlighting and can live at
643
+ // unexpected world positions (e.g. legacy transforms, overlay
644
+ // helpers), which would inflate the bounds range and make
645
+ // "1% of the slider" span the entire real model — producing
646
+ // the reported symptom where the model pops from fully visible
647
+ // to fully invisible across a tiny slider range.
633
648
  const boundsMin = { x: Infinity, y: Infinity, z: Infinity };
634
649
  const boundsMax = { x: -Infinity, y: -Infinity, z: -Infinity };
635
- // Check individual meshes
636
- for (const mesh of meshes) {
637
- if (mesh.bounds) {
638
- boundsMin.x = Math.min(boundsMin.x, mesh.bounds.min[0]);
639
- boundsMin.y = Math.min(boundsMin.y, mesh.bounds.min[1]);
640
- boundsMin.z = Math.min(boundsMin.z, mesh.bounds.min[2]);
641
- boundsMax.x = Math.max(boundsMax.x, mesh.bounds.max[0]);
642
- boundsMax.y = Math.max(boundsMax.y, mesh.bounds.max[1]);
643
- boundsMax.z = Math.max(boundsMax.z, mesh.bounds.max[2]);
644
- }
645
- }
646
- // Check batched meshes (most geometry is here!)
647
650
  const batchedMeshes = this.scene.getBatchedMeshes();
648
651
  for (const batch of batchedMeshes) {
649
652
  if (batch.bounds) {
@@ -655,6 +658,21 @@ export class Renderer {
655
658
  boundsMax.z = Math.max(boundsMax.z, batch.bounds.max[2]);
656
659
  }
657
660
  }
661
+ // If no batched meshes have bounds yet (streaming, degenerate
662
+ // models), fall back to individual meshes so at least the
663
+ // slider has a workable range.
664
+ if (!Number.isFinite(boundsMin.x)) {
665
+ for (const mesh of meshes) {
666
+ if (mesh.bounds) {
667
+ boundsMin.x = Math.min(boundsMin.x, mesh.bounds.min[0]);
668
+ boundsMin.y = Math.min(boundsMin.y, mesh.bounds.min[1]);
669
+ boundsMin.z = Math.min(boundsMin.z, mesh.bounds.min[2]);
670
+ boundsMax.x = Math.max(boundsMax.x, mesh.bounds.max[0]);
671
+ boundsMax.y = Math.max(boundsMax.y, mesh.bounds.max[1]);
672
+ boundsMax.z = Math.max(boundsMax.z, mesh.bounds.max[2]);
673
+ }
674
+ }
675
+ }
658
676
  // Fallback if no bounds found
659
677
  if (!Number.isFinite(boundsMin.x)) {
660
678
  boundsMin.x = boundsMin.y = boundsMin.z = -100;
@@ -703,15 +721,57 @@ export class Renderer {
703
721
  normal[2] /= len;
704
722
  }
705
723
  }
706
- // Get axis-specific range based on semantic axis
707
- // Use min/max overrides from sectionPlane if provided (storey-based range)
724
+ // Get axis-specific range. The renderer's own `boundsMin/Max`
725
+ // are computed from the GPU vertex buffers this frame, so
726
+ // they are guaranteed to be in the same Y-up world space as
727
+ // `input.worldPos` in the shader. `options.sectionPlane.min/max`
728
+ // comes from the UI via `coordinateInfo.shiftedBounds` and can
729
+ // be stale during streaming or outright wrong during model
730
+ // load (initialised to {0,0,0} before the first bounds update)
731
+ // — using those directly was the cause of the "slider moves
732
+ // 1% and the whole model disappears" bug.
733
+ //
734
+ // Policy: always use the renderer's own bounds for the Y-up
735
+ // range. Only honour the UI override when it is a valid,
736
+ // non-degenerate range that lies INSIDE the actual mesh
737
+ // bounds (e.g. storey filtering from the level picker).
708
738
  const axisIdx = options.sectionPlane.axis === 'side' ? 'x' : options.sectionPlane.axis === 'down' ? 'y' : 'z';
709
- const minVal = options.sectionPlane.min ?? boundsMin[axisIdx];
710
- const maxVal = options.sectionPlane.max ?? boundsMax[axisIdx];
739
+ let minVal = boundsMin[axisIdx];
740
+ let maxVal = boundsMax[axisIdx];
741
+ const uiMin = options.sectionPlane.min;
742
+ const uiMax = options.sectionPlane.max;
743
+ if (Number.isFinite(uiMin) &&
744
+ Number.isFinite(uiMax) &&
745
+ uiMax - uiMin > 1e-6 &&
746
+ uiMin >= minVal - 1e-3 &&
747
+ uiMax <= maxVal + 1e-3) {
748
+ minVal = uiMin;
749
+ maxVal = uiMax;
750
+ }
711
751
  // Calculate plane distance from position percentage
712
752
  const range = maxVal - minVal;
713
753
  const distance = minVal + (options.sectionPlane.position / 100) * range;
714
754
  sectionPlaneData = { normal, distance, enabled: true };
755
+ // One-shot diagnostic: when section first becomes active,
756
+ // log the exact bounds + distance the shader will use.
757
+ // This is the fastest way to confirm "bounds mismatch" bugs
758
+ // without asking the user to run a debugger.
759
+ if (!this._loggedSectionBounds) {
760
+ this._loggedSectionBounds = true;
761
+ console.info('[Section] Y-up bounds used for clip:', {
762
+ axis: options.sectionPlane.axis,
763
+ axisIdx,
764
+ bounds: {
765
+ min: { x: boundsMin.x, y: boundsMin.y, z: boundsMin.z },
766
+ max: { x: boundsMax.x, y: boundsMax.y, z: boundsMax.z },
767
+ },
768
+ uiOverride: { min: uiMin, max: uiMax },
769
+ used: { min: minVal, max: maxVal },
770
+ position: options.sectionPlane.position,
771
+ distance,
772
+ batchedMeshCount: this.scene.getBatchedMeshes().length,
773
+ });
774
+ }
715
775
  }
716
776
  }
717
777
  // Reuse pooled scratch buffer for per-mesh uniform writes
@@ -749,8 +809,11 @@ export class Renderer {
749
809
  meshBuf[43] = 0;
750
810
  }
751
811
  // Flags (offset 44-47 as u32)
812
+ // flags.y packs: bit 0 = sectionEnabled, bit 1 = flipped
752
813
  meshFlags[0] = isSelected ? 1 : 0;
753
- meshFlags[1] = sectionPlaneData?.enabled ? 1 : 0;
814
+ meshFlags[1] =
815
+ (sectionPlaneData?.enabled ? 1 : 0) |
816
+ (options.sectionPlane?.flipped ? 2 : 0);
754
817
  meshFlags[2] = edgeEnabledU32;
755
818
  meshFlags[3] = edgeIntensityMilliU32;
756
819
  device.queue.writeBuffer(mesh.uniformBuffer, 0, meshBuf);
@@ -784,6 +847,11 @@ export class Renderer {
784
847
  depthClearValue: 0.0, // Reverse-Z: clear to 0.0 (far plane)
785
848
  depthLoadOp: 'clear',
786
849
  depthStoreOp: 'store',
850
+ // Stencil is cleared here and preserved for the cap pass
851
+ // that runs right after in the same frame.
852
+ stencilClearValue: 0,
853
+ stencilLoadOp: 'clear',
854
+ stencilStoreOp: 'store',
787
855
  },
788
856
  });
789
857
  pass.setPipeline(this.pipeline.getPipeline());
@@ -918,8 +986,16 @@ export class Renderer {
918
986
  tpl[42] = 0;
919
987
  tpl[43] = 0;
920
988
  }
921
- tplFlags[0] = 0; // not selected
922
- tplFlags[1] = sectionPlaneData?.enabled ? 1 : 0;
989
+ // flags layout (main shader):
990
+ // x = isSelected (0/1)
991
+ // y = sectionEnabled bitfield:
992
+ // bit 0 = enabled, bit 1 = flipped
993
+ // z = edgeEnabled (0/1)
994
+ // w = edgeIntensityMilli
995
+ tplFlags[0] = 0;
996
+ tplFlags[1] =
997
+ (sectionPlaneData?.enabled ? 1 : 0) |
998
+ (options.sectionPlane?.flipped ? 2 : 0);
923
999
  tplFlags[2] = edgeEnabledU32;
924
1000
  tplFlags[3] = edgeIntensityMilliU32;
925
1001
  // Helper function to render a batch — patches color into the shared template
@@ -945,7 +1021,11 @@ export class Renderer {
945
1021
  }
946
1022
  // PERFORMANCE FIX: Render partially visible batches as sub-batches (not individual meshes!)
947
1023
  // This is the key optimization: instead of 10,000+ individual draw calls,
948
- // we create cached sub-batches with only visible elements and render them as single draw calls
1024
+ // we create cached sub-batches with only visible elements and render them as single draw calls.
1025
+ // We also collect resolved opaque sub-batches so the section cap pass below can
1026
+ // include them in its parity count — otherwise hidden/isolated opaque geometry
1027
+ // would show open, un-capped cut holes.
1028
+ const opaqueSubBatches = [];
949
1029
  if (partiallyVisibleBatches.length > 0) {
950
1030
  for (const { sourceBatchKey, colorKey, visibleIds, color } of partiallyVisibleBatches) {
951
1031
  // Get or create a cached sub-batch for this visibility state
@@ -958,6 +1038,7 @@ export class Renderer {
958
1038
  }
959
1039
  else {
960
1040
  pass.setPipeline(this.pipeline.getPipeline());
1041
+ opaqueSubBatches.push(subBatch);
961
1042
  }
962
1043
  // Render the sub-batch as a single draw call
963
1044
  renderBatch(subBatch);
@@ -978,6 +1059,15 @@ export class Renderer {
978
1059
  }
979
1060
  pass.setPipeline(this.pipeline.getPipeline());
980
1061
  }
1062
+ // Filled, hatched 3D cut surfaces are now rendered by
1063
+ // Section2DOverlayRenderer using the exact polygons from
1064
+ // SectionCutter (triangle-plane intersection). The old
1065
+ // stencil-parity SectionCapRenderer is no longer in the
1066
+ // render loop — parity XOR on non-manifold IFC geometry
1067
+ // leaks stencil bits into empty sky, and no amount of
1068
+ // bounded quads or second-bit gating fixed that robustly.
1069
+ // See the 2D-overlay draw call further below in this same
1070
+ // render pass, which now emits the cap.
981
1071
  // Prepare selected meshes once, then render them LAST so transparent batches
982
1072
  // don't overwrite highlight color (glass otherwise appears unhighlighted).
983
1073
  const visibleSelectedIds = new Set();
@@ -1060,7 +1150,9 @@ export class Renderer {
1060
1150
  tpl[43] = 0;
1061
1151
  }
1062
1152
  tplFlags[0] = 0;
1063
- tplFlags[1] = sectionPlaneData?.enabled ? 1 : 0;
1153
+ tplFlags[1] =
1154
+ (sectionPlaneData?.enabled ? 1 : 0) |
1155
+ (options.sectionPlane?.flipped ? 2 : 0);
1064
1156
  tplFlags[2] = edgeEnabledU32;
1065
1157
  tplFlags[3] = edgeIntensityMilliU32;
1066
1158
  device.queue.writeBuffer(mesh.uniformBuffer, 0, tpl);
@@ -1116,7 +1208,9 @@ export class Renderer {
1116
1208
  tpl[43] = 0;
1117
1209
  }
1118
1210
  tplFlags[0] = 1; // isSelected
1119
- tplFlags[1] = sectionPlaneData?.enabled ? 1 : 0;
1211
+ tplFlags[1] =
1212
+ (sectionPlaneData?.enabled ? 1 : 0) |
1213
+ (options.sectionPlane?.flipped ? 2 : 0);
1120
1214
  tplFlags[2] = edgeEnabledU32;
1121
1215
  tplFlags[3] = edgeIntensityMilliU32;
1122
1216
  device.queue.writeBuffer(mesh.uniformBuffer, 0, tpl);
@@ -1162,7 +1256,9 @@ export class Renderer {
1162
1256
  const instancedMeshes = this.scene.getInstancedMeshes();
1163
1257
  if (instancedMeshes.length > 0) {
1164
1258
  // Update instanced pipeline uniforms
1165
- this.instancedPipeline.updateUniforms(viewProj, sectionPlaneData);
1259
+ this.instancedPipeline.updateUniforms(viewProj, sectionPlaneData
1260
+ ? { ...sectionPlaneData, flipped: options.sectionPlane?.flipped === true }
1261
+ : undefined);
1166
1262
  // Switch to instanced pipeline
1167
1263
  pass.setPipeline(this.instancedPipeline.getPipeline());
1168
1264
  for (const instancedMesh of instancedMeshes) {
@@ -1191,15 +1287,38 @@ export class Renderer {
1191
1287
  min: options.sectionPlane.min,
1192
1288
  max: options.sectionPlane.max,
1193
1289
  });
1194
- // Draw 2D section overlay on the section plane (when section is active, not preview)
1290
+ // Draw 2D section overlay on the section plane (when section is
1291
+ // active, not preview). The overlay is also the 3D SECTION CAP:
1292
+ // its polygon fills come from `SectionCutter` (exact triangle-
1293
+ // plane intersection), and the new fill shader applies the
1294
+ // user's screen-space hatch + colour directly on those
1295
+ // polygons. This replaces the old stencil-parity cap, which
1296
+ // bled hatch into empty sky on non-manifold IFC geometry —
1297
+ // the polygons here are mathematically correct, so the cap
1298
+ // silhouette matches the 2D drawing exactly.
1195
1299
  if (options.sectionPlane.enabled && this.section2DOverlayRenderer?.hasGeometry()) {
1300
+ const o = options.sectionPlane;
1301
+ const showFills = o.showCap !== false;
1302
+ const showOutlines = o.showOutlines !== false;
1303
+ const style = { ...DEFAULT_CAP_STYLE, ...(o.capStyle ?? {}) };
1196
1304
  this.section2DOverlayRenderer.draw(pass, {
1197
- axis: options.sectionPlane.axis,
1198
- position: options.sectionPlane.position,
1305
+ axis: o.axis,
1306
+ position: o.position,
1199
1307
  bounds: modelBounds,
1200
1308
  viewProj,
1201
- min: options.sectionPlane.min,
1202
- max: options.sectionPlane.max,
1309
+ min: o.min,
1310
+ max: o.max,
1311
+ showFills,
1312
+ showOutlines,
1313
+ capStyle: showFills ? {
1314
+ fillColor: style.fillColor,
1315
+ strokeColor: style.strokeColor,
1316
+ patternId: HATCH_PATTERN_IDS[style.pattern],
1317
+ spacingPx: style.spacingPx,
1318
+ angleRad: style.angleRad,
1319
+ widthPx: style.widthPx,
1320
+ secondaryAngleRad: style.secondaryAngleRad,
1321
+ } : undefined,
1203
1322
  });
1204
1323
  }
1205
1324
  }
@@ -1214,7 +1333,9 @@ export class Renderer {
1214
1333
  });
1215
1334
  this.postProcessor.apply(encoder, {
1216
1335
  targetView: textureView,
1217
- depthView: this.pipeline.getDepthTextureView(),
1336
+ // Depth-only view required because depth24plus-stencil8
1337
+ // cannot be sampled as texture_depth_* with aspect 'all'.
1338
+ depthView: this.pipeline.getDepthOnlyTextureView(),
1218
1339
  objectIdView: this.pipeline.getObjectIdTextureView(),
1219
1340
  contactQuality: contactEnabled && visualEnhancement.contactShading.quality === 'high' ? 'high' : 'low',
1220
1341
  radius: Math.min(3.0, Math.max(1.0, visualEnhancement.contactShading.radius)),
@@ -1433,6 +1554,8 @@ export class Renderer {
1433
1554
  destroy() {
1434
1555
  // Scene mesh GPU buffers
1435
1556
  this.scene.clear();
1557
+ // Re-arm the section-bounds diagnostic log for the next model.
1558
+ this._loggedSectionBounds = false;
1436
1559
  // Render pipelines (textures + uniform buffers)
1437
1560
  this.pipeline?.destroy();
1438
1561
  this.pipeline = null;