format project

This commit is contained in:
Kurt Hutten
2021-08-01 09:55:07 +10:00
parent 625db5e26b
commit d8998a73b3
9 changed files with 215 additions and 180 deletions

View File

@@ -25,18 +25,18 @@ function Asset({ geometry: incomingGeo }) {
}, [incomingGeo])
if (!incomingGeo) return null
let groupData = incomingGeo.children ? incomingGeo : null
if(lastGroup && lastGroup != groupData){
const groupData = incomingGeo.children ? incomingGeo : null
if (lastGroup && lastGroup != groupData) {
state.scene.remove(lastGroup)
lastGroup.children.forEach(c=>c?.geometry?.dispose())
lastGroup.children.forEach((c) => c?.geometry?.dispose())
// returning <primitive object={groupData} /> does not add the new group to the scene
// there is probably some useRef magic that would make this work, but I don't have time to reseach it
/// FIXME - do this properly with useRef or other react magic
if(groupData) state.scene.add(groupData)
if (groupData) state.scene.add(groupData)
}
lastGroup = groupData
if(groupData) return <primitive object={groupData} />
if (groupData) return <primitive object={groupData} />
if (incomingGeo.children) return <primitive object={incomingGeo} />