@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
150 lines (149 loc) • 5.44 kB
JavaScript
"use strict";
import { ParamConfig } from "../../../../../engine/nodes/utils/params/ParamsConfig";
export function SOPQUADTesselationParamConfig(Base) {
return class Mixin extends Base {
constructor() {
super(...arguments);
/** @param triangles */
this.triangles = ParamConfig.BOOLEAN(true);
/** @param wireframe */
this.wireframe = ParamConfig.BOOLEAN(true, {
separatorBefore: true
});
/** @param unsharedEdges */
this.unsharedEdges = ParamConfig.BOOLEAN(false, {
visibleIf: { wireframe: true }
});
/** @param wireframe color */
this.wireframeColor = ParamConfig.COLOR([0, 0, 0], {
visibleIf: { wireframe: true }
});
/** @param connections */
this.connections = ParamConfig.BOOLEAN(false, {
separatorBefore: true
});
/** @param connectionsBetweenQuadsSharingEdge */
this.connectionsBetweenQuadsSharingEdge = ParamConfig.BOOLEAN(true, {
visibleIf: { connections: true }
});
/** @param connectionsBetweenQuadsSharingPointOnly */
this.connectionsBetweenQuadsSharingPointOnly = ParamConfig.BOOLEAN(true, {
visibleIf: { connections: true }
});
/** @param connections color */
this.connectionsColor = ParamConfig.COLOR([0, 0, 0], {
visibleIf: { connections: true }
});
/** @param center */
this.center = ParamConfig.BOOLEAN(false, {
separatorBefore: true
});
/** @param innerRadius */
this.innerRadius = ParamConfig.BOOLEAN(false, {
visibleIf: { center: true }
});
/** @param outerRadius */
this.outerRadius = ParamConfig.BOOLEAN(false, {
visibleIf: { center: true }
});
/** @param edgeCenterVectors */
this.edgeCenterVectors = ParamConfig.BOOLEAN(false, {
visibleIf: { center: true }
});
/** @param edgeNearestPointVectors */
this.edgeNearestPointVectors = ParamConfig.BOOLEAN(false, {
visibleIf: { center: true }
});
/** @param split quads */
this.splitQuads = ParamConfig.BOOLEAN(false, {
separatorBefore: true,
visibleIf: [{ triangles: true }, { wireframe: true }]
});
/** @param pointAttributes */
this.pointAttributes = ParamConfig.STRING("*", {
visibleIf: [{ triangles: true }]
});
/** @param primitiveAttributes */
this.primitiveAttributes = ParamConfig.STRING("*");
}
};
}
export function OBJQUADTesselationParamConfig(Base) {
return class Mixin extends Base {
constructor() {
super(...arguments);
/** @param wireframe */
this.QUADTriangles = ParamConfig.BOOLEAN(true);
/** @param wireframe */
this.QUADWireframe = ParamConfig.BOOLEAN(true, {
separatorBefore: true
});
/** @param unsharedEdges */
this.QUADUnsharedEdges = ParamConfig.BOOLEAN(false, {
visibleIf: { wireframe: true }
});
/** @param wireframe color */
this.QUADWireframeColor = ParamConfig.COLOR([0, 0, 0], {
visibleIf: { QUADWireframe: true }
});
/** @param connections */
this.QUADConnections = ParamConfig.BOOLEAN(false, {
separatorBefore: true
});
/** @param connectionsBetweenQuadsSharingEdge */
this.QUADConnectionsBetweenQuadsSharingEdge = ParamConfig.BOOLEAN(true, {
visibleIf: { QuadConnections: true }
});
/** @param connectionsBetweenQuadsSharingPointOnly */
this.QUADConnectionsBetweenQuadsSharingPointOnly = ParamConfig.BOOLEAN(true, {
visibleIf: { QuadConnections: true }
});
/** @param connections color */
this.QUADConnectionsColor = ParamConfig.COLOR([0, 0, 0], {
visibleIf: { QuadConnections: true }
});
/** @param center */
this.QUADCenter = ParamConfig.BOOLEAN(false, {
separatorBefore: true
});
/** @param QUADInnerRadius */
this.QUADInnerRadius = ParamConfig.BOOLEAN(false, {
visibleIf: { QUADCenter: true }
});
/** @param QUADOuterRadius */
this.QUADOuterRadius = ParamConfig.BOOLEAN(false, {
visibleIf: { QUADCenter: true }
});
/** @param QUADEdgeCenterVectors */
this.QUADEdgeCenterVectors = ParamConfig.BOOLEAN(false, {
visibleIf: { QUADCenter: true }
});
/** @param QUADEdgeNearestPointVectors */
this.QUADEdgeNearestPointVectors = ParamConfig.BOOLEAN(false, {
visibleIf: { QUADCenter: true }
});
/** @param split quads */
this.QUADSplitQuads = ParamConfig.BOOLEAN(false, {
separatorBefore: true,
visibleIf: [{ QUADTriangles: true }, { QUADWireframe: true }]
});
/** @param pointAttributes */
this.QUADPointAttributes = ParamConfig.STRING("*", {
visibleIf: [{ QUADTriangles: true }]
});
/** @param primitiveAttributes */
this.QUADPrimitiveAttributes = ParamConfig.STRING("*");
}
};
}
export const TESSELATION_PARAM_NAMES = /* @__PURE__ */ new Set(["QUADTriangles", "QUADWireframe"]);
export function addQUADTesselationParamsCallback(node, callback) {
node.params.onParamsCreated("QUADtesselationParamsHooks", () => {
const params = node.params.all;
for (const param of params) {
if (TESSELATION_PARAM_NAMES.has(param.name())) {
param.options.setOption("callback", callback);
}
}
});
}