@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
68 lines (67 loc) • 2.48 kB
JavaScript
;
import { NodeParamsConfig } from "../utils/params/ParamsConfig";
import {
UniformsTransparencyParamConfig,
UniformsTransparencyController
} from "./utils/UniformsTransparencyController";
import {
AdvancedCommonController,
AdvancedCommonParamConfig
} from "./utils/AdvancedCommonController";
import { TypedBuilderMatNode, BaseBuilderParamConfig } from "./_BaseBuilder";
import { AssemblerName } from "../../poly/registers/assemblers/_BaseRegister";
import { Poly } from "../../Poly";
import { FogParamConfig, UniformFogController } from "./utils/UniformsFogController";
import { DefaultFolderParamConfig } from "./utils/DefaultFolder";
import { AdvancedFolderParamConfig } from "./utils/AdvancedFolder";
import { PointsSizeController, PointsParamConfig } from "./utils/PointsSizeController";
import { MatType } from "../../poly/registers/nodes/types/Mat";
import {
CustomMaterialPointsParamConfig,
materialPointsAssemblerCustomMaterialRequested
} from "./utils/customMaterials/CustomMaterialPoints";
class PointsBuilderMatParamsConfig extends CustomMaterialPointsParamConfig(
FogParamConfig(
AdvancedCommonParamConfig(
BaseBuilderParamConfig(
/* advanced */
AdvancedFolderParamConfig(
UniformsTransparencyParamConfig(PointsParamConfig(DefaultFolderParamConfig(NodeParamsConfig)))
)
)
)
)
) {
}
const ParamsConfig = new PointsBuilderMatParamsConfig();
export class PointsBuilderMatNode extends TypedBuilderMatNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
this.controllers = {
advancedCommon: new AdvancedCommonController(this),
pointsSize: new PointsSizeController(this),
uniformFog: new UniformFogController(this),
uniformTransparency: new UniformsTransparencyController(this)
};
this.controllersList = Object.values(this.controllers);
}
static type() {
return MatType.POINTS_BUILDER;
}
usedAssembler() {
return AssemblerName.GL_POINTS;
}
_createAssemblerController() {
return Poly.assemblersRegister.assembler(this, this.usedAssembler());
}
customMaterialRequested(customName) {
return materialPointsAssemblerCustomMaterialRequested(this, customName);
}
async cook() {
this._material = this._material || this.createMaterial();
await Promise.all(this.controllersPromises(this._material));
this.compileIfRequired(this._material);
this.setMaterial(this._material);
}
}