Skip to content
Snippets Groups Projects
Commit 5f672568 authored by Alexander Rose's avatar Alexander Rose
Browse files

fixed bounding sphere helper removal of old spheres

parent f90751aa
No related branches found
No related tags found
No related merge requests found
......@@ -299,11 +299,11 @@ namespace Canvas3D {
repr.renderObjects.forEach(o => scene.add(o))
}
reprRenderObjects.set(repr, newRO)
reprCount.next(reprRenderObjects.size)
scene.update()
if (debugHelper.isEnabled) debugHelper.update()
isUpdating = false
requestDraw(true)
reprCount.next(reprRenderObjects.size)
}
handleResize()
......@@ -327,11 +327,11 @@ namespace Canvas3D {
isUpdating = true
renderObjects.forEach(o => scene.remove(o))
reprRenderObjects.delete(repr)
reprCount.next(reprRenderObjects.size)
scene.update()
if (debugHelper.isEnabled) debugHelper.update()
isUpdating = false
requestDraw(true)
reprCount.next(reprRenderObjects.size)
}
},
update: () => scene.update(),
......
......@@ -45,6 +45,8 @@ export class BoundingSphereHelper {
if (newSceneData) this.sceneData = newSceneData
const oldRO = new Set<RenderObject>()
this.objectsData.forEach((_, ro) => oldRO.add(ro))
this.instancesData.forEach((_, ro) => oldRO.add(ro))
this.parent.forEach((r, ro) => {
const objectData = this.objectsData.get(ro)
const newObjectData = updateBoundingSphereData(this.scene, r.boundingSphere, objectData, ColorNames.tomato)
......@@ -69,6 +71,11 @@ export class BoundingSphereHelper {
this.scene.remove(objectData.renderObject)
this.objectsData.delete(ro)
}
const instanceData = this.instancesData.get(ro)
if (instanceData) {
this.scene.remove(instanceData.renderObject)
this.instancesData.delete(ro)
}
})
this.scene.update()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment