Skip to content

Commit 51b5062

Browse files
Chau TranChau Tran
Chau Tran
authored and
Chau Tran
committed
fix(soba): catch up with latest fix with mesh refraction material from r3f
1 parent 204bb49 commit 51b5062

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libs/soba/materials/src/mesh-refraction-material/mesh-refraction-material.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { NgIf } from '@angular/common';
22
import { Component, computed, CUSTOM_ELEMENTS_SCHEMA, effect, inject, Input } from '@angular/core';
33
import { extend, getLocalState, injectBeforeRender, injectNgtRef, NgtSignalStore, NgtStore } from 'angular-three';
44
import { MeshRefractionMaterial } from 'angular-three-soba/shaders';
5-
import { MeshBVH, SAH } from 'three-mesh-bvh';
5+
import { MeshBVH, MeshBVHUniformStruct, SAH } from 'three-mesh-bvh';
66

77
extend({ MeshRefractionMaterial });
88

@@ -139,8 +139,9 @@ export class NgtsMeshRefractionMaterial extends NgtSignalStore<NgtsMeshRefractio
139139
if (!material) return;
140140
const geometry = getLocalState(material).parent()?.geometry;
141141
if (geometry) {
142+
(material as any).bvh = new MeshBVHUniformStruct();
142143
(material as any).bvh.updateFrom(
143-
new MeshBVH(geometry.toNonIndexed(), { lazyGeneration: false, strategy: SAH } as any)
144+
new MeshBVH(geometry.clone().toNonIndexed(), { lazyGeneration: false, strategy: SAH } as any)
144145
);
145146
}
146147
});

0 commit comments

Comments
 (0)