From 5a96f9cbe8ea9585f7f70504233c74f5c48b717e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sun, 19 May 2024 23:41:41 +0200 Subject: [PATCH] feat: add culler to plans example --- packages/front/src/fragments/Plans/example.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/front/src/fragments/Plans/example.ts b/packages/front/src/fragments/Plans/example.ts index ae149cd26..d841b416b 100644 --- a/packages/front/src/fragments/Plans/example.ts +++ b/packages/front/src/fragments/Plans/example.ts @@ -69,6 +69,18 @@ const edges = components.get(OBCF.ClipEdges); const highlighter = components.get(OBCF.Highlighter); highlighter.setup({ world }); +const cullers = components.get(OBC.Cullers); +const culler = cullers.create(world); +for (const fragment of model.items) { + culler.add(fragment.mesh); +} + +culler.needsUpdate = true; + +world.camera.controls.addEventListener("sleep", () => { + culler.needsUpdate = true; +}); + // Create thick style const grayFill = new THREE.MeshBasicMaterial({ color: "gray", side: 2 });