Skip to content

Commit 9fbf725

Browse files
committed
need clipping plane update if mesh or deformation changed
1 parent 7d4db20 commit 9fbf725

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

ngsolve_webgpu/clipping.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ def colormap(self):
9494
def colormap(self, value: Colormap):
9595
self.gpu_objects.colormap = value
9696

97+
def set_needs_update(self):
98+
"""Invalidate cached state so build_clip_plane runs on next update."""
99+
self._last_clipping_bytes = None
100+
super().set_needs_update()
101+
97102
def update(self, options: RenderOptions):
98103
self.data.update(options)
99104
if self.data.data_3d is None:
@@ -127,7 +132,10 @@ def update(self, options: RenderOptions):
127132
)
128133
self.gpu_objects.complex_settings.update(options)
129134
if not self._js_compute:
130-
# Only recompute clipping triangles when the plane actually changed
135+
# Only recompute clipping triangles when inputs actually changed.
136+
# Clipping plane changes are detected by comparing uniform bytes.
137+
# Mesh/deformation changes go through set_needs_update() which
138+
# invalidates _last_clipping_bytes, forcing a rebuild.
131139
clipping_bytes = bytes(self._clipping.uniforms)
132140
if clipping_bytes != self._last_clipping_bytes:
133141
self._last_clipping_bytes = clipping_bytes

0 commit comments

Comments
 (0)