Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
NodeGraphCore.h
Go to the documentation of this file.
1/**
2 * @file NodeGraphCore.h
3 * @brief Core data structures for generic node graph system
4 * @author Olympe Engine
5 * @date 2026-02-18
6 *
7 * @details
8 * Provides generic data structures for node-based graphs that can be reused
9 * across multiple editors (BehaviorTree, HFSM, Animation, Blueprint).
10 * All code strictly compliant with C++14 standard.
11 */
12
13#pragma once
14
15#include <cstdint>
16#include <string>
17#include <vector>
18#include <map>
19#include "../vector.h"
20
21namespace Olympe {
22namespace NodeGraph {
23
24// ============================================================================
25// ID Types
26// ============================================================================
27
28struct GraphId {
30
31 bool operator==(const GraphId& other) const { return value == other.value; }
32 bool operator!=(const GraphId& other) const { return value != other.value; }
33 bool operator<(const GraphId& other) const { return value < other.value; }
34};
35
36struct NodeId {
38
39 bool operator==(const NodeId& other) const { return value == other.value; }
40 bool operator!=(const NodeId& other) const { return value != other.value; }
41 bool operator<(const NodeId& other) const { return value < other.value; }
42};
43
44struct PinId {
46
47 bool operator==(const PinId& other) const { return value == other.value; }
48 bool operator!=(const PinId& other) const { return value != other.value; }
49 bool operator<(const PinId& other) const { return value < other.value; }
50};
51
52struct LinkId {
54
55 bool operator==(const LinkId& other) const { return value == other.value; }
56 bool operator!=(const LinkId& other) const { return value != other.value; }
57 bool operator<(const LinkId& other) const { return value < other.value; }
58};
59
60// ============================================================================
61// Basic Structures
62// ============================================================================
63
64using Vector2 = Vector; // Assuming Vector2 is defined in a common math library
65/*struct Vector2 {
66 float x = 0.0f;
67 float y = 0.0f;
68
69 Vector2() = default;
70 Vector2(float inX, float inY) : x(inX), y(inY) {}
71};/**/
72
73// ============================================================================
74// Node Data
75// ============================================================================
76
77struct NodeData {
79 std::string type;
80 std::string name;
82 std::map<std::string, std::string> parameters;
83 std::vector<NodeId> children;
85};
86
87// ============================================================================
88// Pin Data
89// ============================================================================
90
91struct PinData {
94 std::string type;
95 std::string name;
96};
97
98// ============================================================================
99// Link Data
100// ============================================================================
101
107
108// ============================================================================
109// Editor State
110// ============================================================================
111
113 float zoom = 1.0f;
115 std::vector<NodeId> selectedNodes;
116 std::string layoutDirection = "TopToBottom";
117};
118
119// ============================================================================
120// Layout Direction
121// ============================================================================
122
124 TopToBottom = 0,
125 BottomToTop = 1,
126 LeftToRight = 2,
127 RightToLeft = 3
128};
129
130// ============================================================================
131// Auto-Layout Configuration
132// ============================================================================
133
135 LayoutDirection direction = LayoutDirection::TopToBottom;
136 float horizontalSpacing = 150.0f; // Spacing between sibling nodes
137 float verticalSpacing = 100.0f; // Spacing between tree levels
138 float nodeWidth = 120.0f; // Estimated node width
139 float nodeHeight = 60.0f; // Estimated node height
140 float paddingX = 50.0f; // Left/right padding
141 float paddingY = 50.0f; // Top/bottom padding
142};
143
144} // namespace NodeGraph
145} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
< Provides AssetID and INVALID_ASSET_ID
@ Vector
3-component vector (Vector from vector.h)
@ LeftToRight
Horizontal left-to-right layout.
@ TopToBottom
Traditional top-down layout (vertical)
std::vector< NodeId > selectedNodes
bool operator!=(const GraphId &other) const
bool operator<(const GraphId &other) const
bool operator==(const GraphId &other) const
bool operator==(const LinkId &other) const
bool operator!=(const LinkId &other) const
bool operator<(const LinkId &other) const
std::map< std::string, std::string > parameters
std::vector< NodeId > children
bool operator!=(const NodeId &other) const
bool operator<(const NodeId &other) const
bool operator==(const NodeId &other) const
bool operator!=(const PinId &other) const
bool operator==(const PinId &other) const
bool operator<(const PinId &other) const