Skip to content

Commit 5aca264

Browse files
committed
fix(actor2d): ensure that the actor2D instances are re-sorted each frame
This ensures that they are rendered in the correct order for every frame even if their layer number changes between frames.
1 parent 29577ff commit 5aca264

File tree

1 file changed

+9
-0
lines changed
  • Sources/Rendering/OpenGL/Renderer

1 file changed

+9
-0
lines changed

Diff for: Sources/Rendering/OpenGL/Renderer/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ function vtkOpenGLRenderer(publicAPI, model) {
2424
publicAPI.updateLights();
2525
publicAPI.prepareNodes();
2626
publicAPI.addMissingNode(model.renderable.getActiveCamera());
27+
// Force all actor2D instances to be sorted and re-pushed as scenegraph nodes.
28+
// This ensures that they are rendered in the correct order.
29+
const actors2D = model.renderable.getActors2D();
30+
actors2D.forEach((ac) => {
31+
const vn = publicAPI.getViewNodeFor(ac);
32+
if (vn !== undefined) {
33+
publicAPI.removeNode(vn);
34+
}
35+
});
2736
publicAPI.addMissingNodes(model.renderable.getViewPropsWithNestedProps());
2837
publicAPI.removeUnusedNodes();
2938
}

0 commit comments

Comments
 (0)