@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
75 lines (74 loc) • 2.69 kB
JavaScript
"use strict";
import { TypedSopNode } from "./_Base";
import { CameraPostProcessSopOperation } from "../../operations/sop/CameraPostProcess";
import { HierarchyParamConfigAll, ParamConfig } from "../utils/params/ParamsConfig";
import { CameraSopNodeType, NetworkNodeType, NodeContext } from "../../poly/NodeContext";
import {
EffectComposerController,
PostProcessNetworkParamsConfigMixin
} from "../post/utils/EffectComposerController";
import { DisplayNodeController } from "../utils/DisplayNodeController";
const DEFAULT = CameraPostProcessSopOperation.DEFAULT_PARAMS;
export function CameraPostProcessParamsMixin(Base) {
return class Mixin extends Base {
constructor() {
super(...arguments);
/** @param set to true to define the post process nodes from a different node than this one */
this.useOtherNode = ParamConfig.BOOLEAN(DEFAULT.useOtherNode);
/** @param other parent node containing the post process nodes that will make up the passes used */
this.node = ParamConfig.NODE_PATH("", {
visibleIf: { useOtherNode: 1 },
nodeSelection: {
types: [NetworkNodeType.POST, CameraSopNodeType.POST_PROCESS]
},
dependentOnFoundNode: true,
separatorAfter: true
});
}
};
}
class CameraPostProcessSopParamsConfig extends PostProcessNetworkParamsConfigMixin(
CameraPostProcessParamsMixin(HierarchyParamConfigAll)
) {
}
const ParamsConfig = new CameraPostProcessSopParamsConfig();
export class CameraPostProcessSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
/*
children
*/
this.effectsComposerController = new EffectComposerController(this);
this.displayNodeController = new DisplayNodeController(
this,
this.effectsComposerController.displayNodeControllerCallbacks()
);
this._childrenControllerContext = NodeContext.POST;
}
static type() {
return CameraSopNodeType.POST_PROCESS;
}
initializeNode() {
this.io.inputs.setCount(1);
this.io.inputs.initInputsClonedState(CameraPostProcessSopOperation.INPUT_CLONED_STATE);
}
cook(inputCoreGroups) {
this._operation = this._operation || new CameraPostProcessSopOperation(this._scene, this.states, this);
const coreGroup = this._operation.cook(inputCoreGroups, this.pv);
this.setCoreGroup(coreGroup);
}
setTextureType(textureType) {
this.p.tTextureType.set(1);
this.p.textureType.set(textureType);
}
createNode(node_class, options) {
return super.createNode(node_class, options);
}
children() {
return super.children();
}
nodesByType(type) {
return super.nodesByType(type);
}
}