@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
30 lines (29 loc) • 704 B
JavaScript
;
import { TypedContainer } from "./_Base";
import { CoreMaterial } from "../../core/geometry/Material";
export class MaterialContainer extends TypedContainer {
set_content(content) {
super.set_content(content);
}
coreContentCloned() {
if (this._content) {
const cloned = CoreMaterial.clone(this._node.scene(), this._content, {
shareCustomUniforms: true,
addCustomMaterials: true
});
return cloned;
}
}
set_material(material) {
if (this._content != null) {
this._content.dispose();
}
this.set_content(material);
}
has_material() {
return this.has_content();
}
material() {
return this.content();
}
}