polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
40 lines (39 loc) • 1.11 kB
JavaScript
import {TypedMatNode} from "../_Base";
import {BaseController as BaseController2} from "./_BaseController";
import {NodeParamsConfig, ParamConfig} from "../../utils/params/ParamsConfig";
export function DepthParamConfig(Base4) {
return class Mixin extends Base4 {
constructor() {
super(...arguments);
this.depthWrite = ParamConfig.BOOLEAN(1, {
cook: false,
callback: (node, param) => {
DepthController.update(node);
}
});
this.depthTest = ParamConfig.BOOLEAN(1, {
cook: false,
callback: (node, param) => {
DepthController.update(node);
}
});
}
};
}
class DepthParamsConfig extends DepthParamConfig(NodeParamsConfig) {
}
class DepthMapMatNode extends TypedMatNode {
}
export class DepthController extends BaseController2 {
constructor(node) {
super(node);
this.node = node;
}
async update() {
this.node.material.depthWrite = this.node.pv.depthWrite;
this.node.material.depthTest = this.node.pv.depthTest;
}
static async update(node) {
node.depth_controller.update();
}
}