Repair memory leak (materials)
This commit is contained in:
parent
e23e964486
commit
44d30bece3
|
@ -277,10 +277,12 @@ export function build(name: string, scene: Scene, shape: Shapes.Shape, customize
|
|||
const mat = new StandardMaterial(name + '.texture', scene);
|
||||
mat.diffuseColor = new Color3(shape.value.r, shape.value.g, shape.value.b);
|
||||
if (shape.value._variant === "transparent") mat.alpha = shape.value.alpha;
|
||||
return build(name + '.inner', scene, shape.value.shape, {
|
||||
const t = build(name + '.inner', scene, shape.value.shape, {
|
||||
... customize,
|
||||
material: async m => (await m.allnodes).forEach(n => n.material = mat),
|
||||
});
|
||||
t.cleanups.push(() => mat.dispose());
|
||||
return t;
|
||||
}
|
||||
|
||||
case "Sound": {
|
||||
|
|
Loading…
Reference in New Issue