\doxysection{Shader\+Graph.\+h}
\hypertarget{_shader_graph_8h_source}{}\label{_shader_graph_8h_source}\index{Include/Graph/ShaderGraph.h@{Include/Graph/ShaderGraph.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00002\ \textcolor{comment}{//\ Copyright\ 2024\ Medusa\ Slockbower}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ Licensed\ under\ the\ Apache\ License,\ Version\ 2.0\ (the\ "{}License"{});}}
\DoxyCodeLine{00004\ \textcolor{comment}{//\ you\ may\ not\ use\ this\ file\ except\ in\ compliance\ with\ the\ License.}}
\DoxyCodeLine{00005\ \textcolor{comment}{//\ You\ may\ obtain\ a\ copy\ of\ the\ License\ at}}
\DoxyCodeLine{00006\ \textcolor{comment}{//}}
\DoxyCodeLine{00007\ \textcolor{comment}{//\ \ http://www.apache.org/licenses/LICENSE-\/2.0}}
\DoxyCodeLine{00008\ \textcolor{comment}{//}}
\DoxyCodeLine{00009\ \textcolor{comment}{//\ Unless\ required\ by\ applicable\ law\ or\ agreed\ to\ in\ writing,\ software}}
\DoxyCodeLine{00010\ \textcolor{comment}{//\ distributed\ under\ the\ License\ is\ distributed\ on\ an\ "{}AS\ IS"{}\ BASIS,}}
\DoxyCodeLine{00011\ \textcolor{comment}{//\ WITHOUT\ WARRANTIES\ OR\ CONDITIONS\ OF\ ANY\ KIND,\ either\ express\ or\ implied.}}
\DoxyCodeLine{00012\ \textcolor{comment}{//\ See\ the\ License\ for\ the\ specific\ language\ governing\ permissions\ and}}
\DoxyCodeLine{00013\ \textcolor{comment}{//\ limitations\ under\ the\ License.}}
\DoxyCodeLine{00014\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#ifndef\ SHADERGRAPH\_H}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#define\ SHADERGRAPH\_H}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <Editor/EditorWindow.h>}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ <unordered\_map>}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#include\ <filesystem>}}
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#include\ <unordered\_set>}}
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#include\ <stack>}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{preprocessor}{\#include\ <open-\/cpp-\/utils/startup.h>}}
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#include\ <open-\/cpp-\/utils/directed\_tree.h>}}
\DoxyCodeLine{00029\ \textcolor{preprocessor}{\#include\ <open-\/cpp-\/utils/optional.h>}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{namespace\ }ocu\ =\ open\_cpp\_utils;}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \textcolor{preprocessor}{\#define\ RegisterNode(Name,\ Type)\ \(\backslash\)}}
\DoxyCodeLine{00034\ \textcolor{preprocessor}{\ \ \ \ Node*\ Create\#\#Type(ShaderGraph\&\ graph,\ ImVec2\ pos)\ \{\ return\ new\ Type(graph,\ pos);\ \}\ \(\backslash\)}}
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\ \ \ \ STARTUP(\_Register\#\#Type)\ \{\ ShaderGraph::Register(Name,\ Create\#\#Type);\ \}}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{keyword}{namespace\ }OpenShaderDesigner}
\DoxyCodeLine{00038\ \{}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{keyword}{class\ }ShaderGraph;}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keyword}{using\ }PinId\ =\ uint16\_t;}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keyword}{using\ }NodeId\ =\ uint32\_t;}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}}
\DoxyCodeLine{00044\ \ \ \ \ \{}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr_1_1_hash}{Hash}}}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{size\_t}\ operator()(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ p)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00048\ \textcolor{keyword}{\ \ \ \ \ \ \ \ \ \ \ \ }\{}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p.hash();}
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ NodeId\ \mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}};}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ PinId\ \ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin}{Pin}};}
\DoxyCodeLine{00055\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ Input;}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{size\_t}\ hash()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ (Input\ ?\ 0\ :\ 0x8000000)\ |\ static\_cast<size\_t>(\mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}})\ <<\ 32\ |\ static\_cast<size\_t>(\mbox{\hyperlink{struct_open_shader_designer_1_1_pin}{Pin}}\ \&\ 0x7FFFFFFF);\ \}}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ operator<(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ o)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ hash()\ <\ o.hash();\ \}}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ PinPtr\&\ o)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ hash()\ ==\ o.hash();\ \}}
\DoxyCodeLine{00061\ \ \ \ \ \};}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{struct_open_shader_designer_1_1_pin}{Pin}}}
\DoxyCodeLine{00064\ \ \ \ \ \{}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \textcolor{keyword}{enum}\ PinType}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \ \ \ \ INT\ =\ 0}
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ ,\ \ \ UINT}
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ ,\ \ \ FLOAT}
\DoxyCodeLine{00070\ \ \ \ \ \ \ \ \ ,\ \ \ VECTOR}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ ,\ \ \ ANY}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ ,\ \ \ COUNT}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \textcolor{keyword}{enum}\ PinDirection}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \ \ \ \ INPUT}
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ ,\ \ \ OUTPUT}
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \textcolor{keyword}{inline}\ \textcolor{keyword}{const}\ \textcolor{keyword}{static}\ ImColor\ Colors[COUNT]\ =\ \{}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \ \ \ \ ImColor(0xB9,\ 0xF5,\ 0x94)}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ ,\ \ \ ImColor(0x8C,\ 0xC0,\ 0x8C)}
\DoxyCodeLine{00085\ \ \ \ \ \ \ \ \ ,\ \ \ ImColor(0x37,\ 0x95,\ 0x85)}
\DoxyCodeLine{00086\ \ \ \ \ \ \ \ \ ,\ \ \ ImColor(0xE3,\ 0x7D,\ 0xDC)}
\DoxyCodeLine{00087\ \textcolor{comment}{//\ \ \ \ \ \ ,\ \ \ ImColor(0xD2,\ 0x6E,\ 0x46)}}
\DoxyCodeLine{00088\ \ \ \ \ \ \ \ \ ,\ \ \ ImColor(0xD2,\ 0xD5,\ 0xD3)}
\DoxyCodeLine{00089\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \textcolor{keyword}{inline}\ \textcolor{keyword}{const}\ \textcolor{keyword}{static}\ std::string\ TypeNames[COUNT]\ =\ \{}
\DoxyCodeLine{00092\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Int"{}}}
\DoxyCodeLine{00093\ \ \ \ \ \ \ \ \ ,\ \ \ \textcolor{stringliteral}{"{}Unsigned\ Int"{}}}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ ,\ \ \ \textcolor{stringliteral}{"{}Float"{}}}
\DoxyCodeLine{00095\ \ \ \ \ \ \ \ \ ,\ \ \ \textcolor{stringliteral}{"{}Vector"{}}}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ std::string\ \ \ Name;}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ PinType\ \ \ \ \ \ \ Type;}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ PinDirection\ \ Direction;}
\DoxyCodeLine{00101\ \ \ \ \ \};}
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}}
\DoxyCodeLine{00104\ \ \ \ \ \{}
\DoxyCodeLine{00105\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00106\ \ \ \ \ \ \ \ \ ImVec2\ Position\ =\ \{\ 0,\ 0\ \};}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00108\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00109\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00110\ \ \ \ \ \ \ \ \ \ \ \ \ std::string\ Title\ =\ \textcolor{stringliteral}{"{}Node"{}};}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ \ \ \ \ Color\ =\ Pin::Colors[Pin::VECTOR];}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ Enabled\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ \}\ Header;}
\DoxyCodeLine{00114\ }
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<Pin>\ Inputs,\ Outputs;}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \ \ \ \ \ DynamicInputs\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \}\ IO;}
\DoxyCodeLine{00120\ }
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \ \ \ \ ImVec2\ Size;}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ Const;}
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ \}\ Info;}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}(}
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}\&\ graph,\ ImVec2\ pos}
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ ,\ \ \ \textcolor{keyword}{const}\ std::string\&\ title,\ ImColor\ color}
\DoxyCodeLine{00130\ \ \ \ \ \ \ \ \ ,\ \ \ \textcolor{keyword}{const}\ std::vector<Pin>\&\ inputs,\ \textcolor{keywordtype}{bool}\ dyn\_inputs}
\DoxyCodeLine{00131\ \ \ \ \ \ \ \ \ ,\ \ \ \textcolor{keyword}{const}\ std::vector<Pin>\&\ outputs}
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ ,\ \ \ \textcolor{keywordtype}{bool}\ constant\ =\ \textcolor{keyword}{false});}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{struct_open_shader_designer_1_1_node}{\string~Node}}()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}*\ Copy(\mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}\&\ graph)\ \textcolor{keyword}{const}\ =\ 0;}
\DoxyCodeLine{00136\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ Inspect()\ =\ 0;}
\DoxyCodeLine{00137\ \ \ \ \ \};}
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00139\ \ \ \ \ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}}
\DoxyCodeLine{00140\ \ \ \ \ \ \ \ \ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_open_shader_designer_1_1_editor_window}{EditorWindow}}}
\DoxyCodeLine{00141\ \ \ \ \ \{}
\DoxyCodeLine{00142\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}};}
\DoxyCodeLine{00144\ }
\DoxyCodeLine{00145\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }Connection\ =\ std::pair<const\ PinPtr,\ PinPtr>;}
\DoxyCodeLine{00146\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }ConnectionMap\ =\ std::unordered\_multimap<PinPtr,\ PinPtr,\ PinPtr::Hash>;}
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00148\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }Line}
\DoxyCodeLine{00149\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00150\ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ Color;}
\DoxyCodeLine{00151\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ Thickness;}
\DoxyCodeLine{00152\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00153\ }
\DoxyCodeLine{00154\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }ConstructorPtr\ =\ \mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}*(*)(\mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}\&,\ ImVec2);}
\DoxyCodeLine{00155\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }ContextMenuItem}
\DoxyCodeLine{00156\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00157\ \ \ \ \ \ \ \ \ \ \ \ \ std::string\ Name;}
\DoxyCodeLine{00158\ \ \ \ \ \ \ \ \ \ \ \ \ ConstructorPtr\ \ \ \ Constructor;}
\DoxyCodeLine{00159\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00161\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }GraphState}
\DoxyCodeLine{00162\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}\&\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Parent;}
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<Node*>\ \ \ \ \ \ \ \ \ Nodes;}
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \ \ \ \ std::unordered\_set<PinId>\ \ Erased;}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ \ \ \ \ ConnectionMap\ \ \ \ \ \ \ \ \ \ \ \ \ \ Connections;}
\DoxyCodeLine{00167\ }
\DoxyCodeLine{00168\ \ \ \ \ \ \ \ \ \ \ \ \ GraphState(\mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}\&\ parent);}
\DoxyCodeLine{00169\ \ \ \ \ \ \ \ \ \ \ \ \ GraphState(\textcolor{keyword}{const}\ GraphState\&\ other);}
\DoxyCodeLine{00170\ \ \ \ \ \ \ \ \ \ \ \ \ \string~GraphState();}
\DoxyCodeLine{00171\ }
\DoxyCodeLine{00172\ \ \ \ \ \ \ \ \ \ \ \ \ GraphState\&\ operator=(\textcolor{keyword}{const}\ GraphState\&\ other);}
\DoxyCodeLine{00173\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00174\ }
\DoxyCodeLine{00175\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }ContextMenuHierarchy\ =\ ocu::directed\_tree<ContextMenuItem>;}
\DoxyCodeLine{00176\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }ContextID\ =\ ContextMenuHierarchy::node;}
\DoxyCodeLine{00177\ \ \ \ \ \ \ \ \ \textcolor{keyword}{inline}\ \textcolor{keyword}{static}\ ContextMenuHierarchy\ ContextMenu;}
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00179\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Helper\ functions}}
\DoxyCodeLine{00180\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ CalculateWidth(\mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}\&\ node);}
\DoxyCodeLine{00181\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ CalculateHeight(\mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}\&\ node);}
\DoxyCodeLine{00182\ }
\DoxyCodeLine{00183\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Base\ Draw\ and\ Input\ functions}}
\DoxyCodeLine{00184\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ HandleInput();}
\DoxyCodeLine{00185\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ DrawGrid();}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ DrawNode(\mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}\&\ node,\ NodeId\ \textcolor{keywordtype}{id});}
\DoxyCodeLine{00187\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ DrawPin(NodeId\ node\_id,\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin}{Pin}}\&\ pin,\ PinId\ pin\_id,\ ImVec2\ location,\ \textcolor{keywordtype}{bool}\ input);}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ DrawContextMenu();}
\DoxyCodeLine{00189\ }
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Connection\ functions}}
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ DrawConnections();}
\DoxyCodeLine{00192\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ DrawConnection(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ a,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ b);}
\DoxyCodeLine{00193\ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ StartConnection(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ ptr)\ -\/>\ void;}
\DoxyCodeLine{00194\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ StopConnection();}
\DoxyCodeLine{00195\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ CreateConnection(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ a,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ b);}
\DoxyCodeLine{00196\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ EraseConnection(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ a,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ b);}
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ EraseConnections(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ a);}
\DoxyCodeLine{00198\ }
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ NodeId\ AddNode(\mbox{\hyperlink{struct_open_shader_designer_1_1_node}{Node}}*\ node);}
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ RemoveNode(NodeId\ \textcolor{keywordtype}{id});}
\DoxyCodeLine{00201\ }
\DoxyCodeLine{00202\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Clipboard\ functionality}}
\DoxyCodeLine{00203\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ ClearClipboard();}
\DoxyCodeLine{00204\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ Copy();}
\DoxyCodeLine{00205\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ Paste(\textcolor{keyword}{const}\ ImVec2\&\ location);}
\DoxyCodeLine{00206\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ EraseSelection();}
\DoxyCodeLine{00207\ }
\DoxyCodeLine{00208\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ History\ Functionality}}
\DoxyCodeLine{00209\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ PushState();}
\DoxyCodeLine{00210\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ PopState();}
\DoxyCodeLine{00211\ }
\DoxyCodeLine{00212\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Helper\ functions}}
\DoxyCodeLine{00213\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ BezierOffset(\textcolor{keyword}{const}\ ImVec2\&\ out,\ \textcolor{keyword}{const}\ ImVec2\&\ in);}
\DoxyCodeLine{00214\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ AABB(\textcolor{keyword}{const}\ ImVec2\&\ a0,\ \textcolor{keyword}{const}\ ImVec2\&\ a1,\ \textcolor{keyword}{const}\ ImVec2\&\ b0,\ \textcolor{keyword}{const}\ ImVec2\&\ b1);}
\DoxyCodeLine{00215\ }
\DoxyCodeLine{00216\ \ \ \ \ \ \ \ \ ImVec2\ GridToScreen(\textcolor{keyword}{const}\ ImVec2\&\ position);}
\DoxyCodeLine{00217\ \ \ \ \ \ \ \ \ ImVec2\ ScreenToGrid(\textcolor{keyword}{const}\ ImVec2\&\ position);}
\DoxyCodeLine{00218\ \ \ \ \ \ \ \ \ ImVec2\ SnapToGrid(\textcolor{keyword}{const}\ ImVec2\&\ position);}
\DoxyCodeLine{00219\ }
\DoxyCodeLine{00220\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin}{Pin}}\&\ GetPin(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_open_shader_designer_1_1_pin_ptr}{PinPtr}}\&\ ptr);}
\DoxyCodeLine{00221\ }
\DoxyCodeLine{00222\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}();}
\DoxyCodeLine{00224\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{\string~ShaderGraph}}();}
\DoxyCodeLine{00225\ }
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph_ab165317b9a0b95648df1e7009c220a04}{OnOpen}}()\ \textcolor{keyword}{override};}
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph_af028ed8ea55d12a1bb2bcf51c817398b}{DrawWindow}}()\ \textcolor{keyword}{override};}
\DoxyCodeLine{00228\ }
\DoxyCodeLine{00229\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ Register(\textcolor{keyword}{const}\ std::filesystem::path\&\ path,\ ConstructorPtr\ constructor);}
\DoxyCodeLine{00230\ }
\DoxyCodeLine{00231\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00232\ \ \ \ \ \ \ \ \ GraphState\ \ \ \ \ \ \ \ \ \ \ \ \ State;}
\DoxyCodeLine{00233\ \ \ \ \ \ \ \ \ std::stack<GraphState>\ History;}
\DoxyCodeLine{00234\ }
\DoxyCodeLine{00235\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00236\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00237\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00238\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00239\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ BackgroundColor;}
\DoxyCodeLine{00240\ }
\DoxyCodeLine{00241\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00242\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00243\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Line\ Thin,\ Thick;}
\DoxyCodeLine{00244\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ Padding;}
\DoxyCodeLine{00245\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\ Lines;}
\DoxyCodeLine{00246\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ Grid;}
\DoxyCodeLine{00247\ }
\DoxyCodeLine{00248\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00250\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ Rounding;}
\DoxyCodeLine{00251\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Line\ Border,\ SelectedBorder;}
\DoxyCodeLine{00252\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ Content;}
\DoxyCodeLine{00253\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ Title;}
\DoxyCodeLine{00254\ }
\DoxyCodeLine{00255\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00256\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00257\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ Padding;}
\DoxyCodeLine{00258\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ BorderThickness;}
\DoxyCodeLine{00259\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ Background;}
\DoxyCodeLine{00260\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ Text;}
\DoxyCodeLine{00261\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Line\ Connections;}
\DoxyCodeLine{00262\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\ Pins;}
\DoxyCodeLine{00263\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ Nodes;}
\DoxyCodeLine{00264\ }
\DoxyCodeLine{00265\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00266\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00267\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ImColor\ Background;}
\DoxyCodeLine{00268\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Line\ \ \ \ Border;}
\DoxyCodeLine{00269\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ Selection;}
\DoxyCodeLine{00270\ }
\DoxyCodeLine{00271\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ FontSize;}
\DoxyCodeLine{00272\ \ \ \ \ \ \ \ \ \}\ Style;}
\DoxyCodeLine{00273\ }
\DoxyCodeLine{00274\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00275\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00276\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00277\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00278\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00279\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00280\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ Rate,\ Smoothing;}
\DoxyCodeLine{00281\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\ Scroll;}
\DoxyCodeLine{00282\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ Input;}
\DoxyCodeLine{00283\ \ \ \ \ \ \ \ \ \}\ Settings;}
\DoxyCodeLine{00284\ }
\DoxyCodeLine{00285\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00286\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00287\ \ \ \ \ \ \ \ \ \ \ \ \ ImVec2\ \ \ \ \ \ \ \ \ \ \ Location,\ ScreenLocation,\ Delta;}
\DoxyCodeLine{00288\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ \ \ \ \ \ \ \ \ \ \ \ Scroll;}
\DoxyCodeLine{00289\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \ \ \ \ \ ClickedSomething;}
\DoxyCodeLine{00290\ }
\DoxyCodeLine{00291\ \ \ \ \ \ \ \ \ \ \ \ \ ocu::optional<NodeId>\ FocusedNode;}
\DoxyCodeLine{00292\ \ \ \ \ \ \ \ \ \ \ \ \ std::unordered\_map<NodeId,\ ImVec2>\ Locks;}
\DoxyCodeLine{00293\ \ \ \ \ \ \ \ \ \ \ \ \ std::unordered\_set<NodeId>\ DragSelect;}
\DoxyCodeLine{00294\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ LocksDragged,\ NodeHovered;}
\DoxyCodeLine{00295\ \ \ \ \ \ \ \ \ \ \ \ \ ocu::optional<PinPtr>\ NewConnection;}
\DoxyCodeLine{00296\ \ \ \ \ \ \ \ \ \ \ \ \ std::unordered\_set<NodeId>\ Selected;}
\DoxyCodeLine{00297\ \ \ \ \ \ \ \ \ \}\ Mouse;}
\DoxyCodeLine{00298\ }
\DoxyCodeLine{00299\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00300\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00301\ \ \ \ \ \ \ \ \ \ \ \ \ ImVec2\ Location;}
\DoxyCodeLine{00302\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ \ Zoom,\ Scroll;}
\DoxyCodeLine{00303\ \ \ \ \ \ \ \ \ \}\ Camera;}
\DoxyCodeLine{00304\ }
\DoxyCodeLine{00305\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00306\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00307\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<Node*>\ Nodes;}
\DoxyCodeLine{00308\ \ \ \ \ \ \ \ \ \ \ \ \ ConnectionMap\ \ \ \ \ \ Connections;}
\DoxyCodeLine{00309\ \ \ \ \ \ \ \ \ \}\ Clipboard;}
\DoxyCodeLine{00310\ }
\DoxyCodeLine{00311\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ Focused;}
\DoxyCodeLine{00312\ \ \ \ \ \ \ \ \ ImVec2\ ContextMenuPosition;}
\DoxyCodeLine{00313\ }
\DoxyCodeLine{00314\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_open_shader_designer_1_1_inspector}{Inspector}};}
\DoxyCodeLine{00315\ \ \ \ \ \};}
\DoxyCodeLine{00316\ }
\DoxyCodeLine{00317\ \ \ \ \ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_open_shader_designer_1_1_inspector}{Inspector}}}
\DoxyCodeLine{00318\ \ \ \ \ \ \ \ \ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_open_shader_designer_1_1_editor_window}{EditorWindow}}}
\DoxyCodeLine{00319\ \ \ \ \ \{}
\DoxyCodeLine{00320\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00321\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_open_shader_designer_1_1_inspector}{Inspector}}();}
\DoxyCodeLine{00322\ }
\DoxyCodeLine{00323\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_open_shader_designer_1_1_inspector_a69fb8726df2442514a65dc29a9660c24}{DrawWindow}}()\ \textcolor{keyword}{override};}
\DoxyCodeLine{00324\ }
\DoxyCodeLine{00325\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00326\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}}*\ Graph;}
\DoxyCodeLine{00327\ }
\DoxyCodeLine{00328\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_open_shader_designer_1_1_shader_graph}{ShaderGraph}};}
\DoxyCodeLine{00329\ \ \ \ \ \};}
\DoxyCodeLine{00330\ \}}
\DoxyCodeLine{00331\ }
\DoxyCodeLine{00332\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//SHADERGRAPH\_H}}

\end{DoxyCode}
