UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

38 lines (37 loc) 1.45 kB
"use strict"; import { BaseBuilderParamConfig, TypedBuilderMatNode } from "./_BaseBuilder"; import { NodeParamsConfig } from "../utils/params/ParamsConfig"; import { VolumeController, VolumeParamConfig } from "./utils/VolumeController"; import { AssemblerName } from "../../poly/registers/assemblers/_BaseRegister"; import { Poly } from "../../Poly"; import { MatType } from "../../poly/registers/nodes/types/Mat"; class VolumeBuilderMatParamsConfig extends BaseBuilderParamConfig(VolumeParamConfig(NodeParamsConfig)) { } const ParamsConfig = new VolumeBuilderMatParamsConfig(); export class VolumeBuilderMatNode extends TypedBuilderMatNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; // public override customMaterialRequested(customName: CustomMaterialName): boolean { // return materialVolumeAssemblerCustomMaterialRequested(this, customName); // } this._volumeController = new VolumeController(this); } static type() { return MatType.VOLUME_BUILDER; } usedAssembler() { return AssemblerName.GL_VOLUME; } _createAssemblerController() { return Poly.assemblersRegister.assembler(this, this.usedAssembler()); } initializeNode() { } async cook() { this._material = this._material || this.createMaterial(); this._volumeController.updateUniformsFromParams(this._material); this.compileIfRequired(this._material); this.setMaterial(this._material); } }