polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
27 lines (26 loc) • 855 B
JavaScript
import {BaseNodeGlMathFunctionArgBoolean2GlNode} from "./_BaseMathFunctionArgBoolean2";
function MathFunctionArg2BooleanFactory(type, options) {
return class Node extends BaseNodeGlMathFunctionArgBoolean2GlNode {
static type() {
return type;
}
initializeNode() {
super.initializeNode();
this.io.connection_points.set_input_name_function(this._gl_input_name.bind(this));
this.io.connection_points.set_output_name_function(this._gl_output_name.bind(this));
}
boolean_operation() {
return options.op;
}
_gl_output_name(index) {
return type;
}
_gl_input_name(index = 0) {
return `${type}${index}`;
}
};
}
export class AndGlNode extends MathFunctionArg2BooleanFactory("and", {op: "&&"}) {
}
export class OrGlNode extends MathFunctionArg2BooleanFactory("or", {op: "||"}) {
}