* refactor swing animation to controller * idle animator!!!! * implelment state switch transition * a huge fix for UI server edit! * adjust ui scaling so main menu elements clip less * view bobbing, new config name, ws: * EXTREMELY important fixes to entities rendering * a lot of fixes, add dns resolve fallback * improve f3 E, fix modal not found edge case * set correctly target for old browsers, should fix ios 14 crash * unecessary big refactor, to fix ts err * fix isWysiwyg check * fix entities rendering count
18 lines
578 B
TypeScript
18 lines
578 B
TypeScript
import * as THREE from 'three'
|
|
|
|
export const disposeObject = (obj: THREE.Object3D, cleanTextures = false) => {
|
|
// not cleaning texture there as it might be used by other objects, but would be good to also do that
|
|
if (obj instanceof THREE.Mesh) {
|
|
obj.geometry?.dispose?.()
|
|
obj.material?.dispose?.()
|
|
}
|
|
if (obj.children) {
|
|
// eslint-disable-next-line unicorn/no-array-for-each
|
|
obj.children.forEach(child => disposeObject(child, cleanTextures))
|
|
}
|
|
if (cleanTextures) {
|
|
if (obj instanceof THREE.Mesh) {
|
|
obj.material?.map?.dispose?.()
|
|
}
|
|
}
|
|
}
|