1#include "Generators/CPUNodeEditor/Nodes/SquareNode.h"
2#include "Base/ImGuiShapes.h"
3#include "Generators/CPUNodeEditor/CPUNodeEditor.h"
13 if (inputPins[0]->IsLinked())
15 x = inputPins[0]->other->Evaluate(input).value;
25 if (inputPins[1]->IsLinked())
27 x *= inputPins[1]->other->Evaluate(input).value;
40 value1 = data[
"value1"];
41 value2 = data[
"value2"];
47 data[
"type"] = MeshNodeEditor::MeshNodeType::Square;
48 data[
"value1"] = value1;
49 data[
"value2"] = value2;
53void SquareNode::OnRender()
56 inputPins[0]->Render();
58 if (inputPins[0]->IsLinked())
65 ImGui::PushItemWidth(100);
66 ImGui::DragFloat((
"##" + std::to_string(inputPins[0]->
id)).c_str(), &value1, 0.01f);
67 ImGui::PopItemWidth();
72 outputPins[0]->Render();
73 inputPins[1]->Render();
75 if (inputPins[1]->IsLinked())
82 ImGui::PushItemWidth(100);
83 ImGui::DragFloat((
"##" + std::to_string(inputPins[1]->
id)).c_str(), &value2, 0.01f);
84 ImGui::PopItemWidth();
87 ImGui::Text(
"Calculates k(X * X)");
90SquareNode::SquareNode()
94 outputPins.push_back(
new NodeEditorPin(NodeEditorPinType::Output));
95 headerColor = ImColor(MATH_NODE_COLOR);
a class to store JSON values