UNPKG

@polygonjs/polygonjs

Version:

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

36 lines (35 loc) 1.08 kB
"use strict"; import { MeshDistanceMaterial } from "three"; import { FrontSide } from "three"; import { PrimitiveMatNode } from "./_Base"; import { NodeParamsConfig } from "../utils/params/ParamsConfig"; import { AdvancedCommonController, AdvancedCommonParamConfig } from "./utils/AdvancedCommonController"; class MeshDistanceMatParamsConfig extends AdvancedCommonParamConfig(NodeParamsConfig) { } const ParamsConfig = new MeshDistanceMatParamsConfig(); export class MeshDistanceMatNode extends PrimitiveMatNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; this.controllers = { advancedCommon: new AdvancedCommonController(this) }; this.controllersList = Object.values(this.controllers); } static type() { return "meshDistance"; } createMaterial() { return new MeshDistanceMaterial({ side: FrontSide }); } async cook() { this._material = this._material || this.createMaterial(); await Promise.all(this.controllersPromises(this._material)); this.setMaterial(this._material); } }