polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
48 lines (42 loc) • 1.74 kB
text/typescript
/**
* Creates a Points Material, which can be extended with GL nodes.
*
* @remarks
* This node can create children, which will be GL nodes. The GLSL code generated by the nodes will extend the Material.
*
*/
import {NodeParamsConfig} from '../utils/params/ParamsConfig';
import {ColorParamConfig, ColorsController} from './utils/UniformsColorsController';
import {SideParamConfig, SideController} from './utils/SideController';
import {DepthController, DepthParamConfig} from './utils/DepthController';
import {SkinningParamConfig, SkinningController} from './utils/SkinningController';
import {ShaderAssemblerPoints} from '../gl/code/assemblers/materials/Points';
import {TypedBuilderMatNode} from './_BaseBuilder';
import {AssemblerName} from '../../poly/registers/assemblers/_BaseRegister';
import {Poly} from '../../Poly';
class PointsMatParamsConfig extends SkinningParamConfig(
DepthParamConfig(SideParamConfig(ColorParamConfig(NodeParamsConfig)))
) {}
const ParamsConfig = new PointsMatParamsConfig();
export class PointsBuilderMatNode extends TypedBuilderMatNode<ShaderAssemblerPoints, PointsMatParamsConfig> {
params_config = ParamsConfig;
static type() {
return 'pointsBuilder';
}
public usedAssembler(): Readonly<AssemblerName.GL_POINTS> {
return AssemblerName.GL_POINTS;
}
protected _create_assembler_controller() {
return Poly.assemblersRegister.assembler(this, this.usedAssembler());
}
readonly depth_controller: DepthController = new DepthController(this);
initializeNode() {}
async cook() {
this.compile_if_required();
ColorsController.update(this);
SideController.update(this);
SkinningController.update(this);
this.depth_controller.update();
this.set_material(this.material);
}
}