Plasma Engine  2.0
Loading...
Searching...
No Matches
AnimGraph.h
1#pragma once
2
3#include <RendererCore/RendererCoreDLL.h>
4
5#include <Foundation/Containers/DynamicArray.h>
6#include <Foundation/Memory/InstanceDataAllocator.h>
7#include <Foundation/Types/UniquePtr.h>
8#include <RendererCore/AnimationSystem/AnimGraph/AnimGraphNode.h>
9
10class PL_RENDERERCORE_DLL plAnimGraph
11{
12 PL_DISALLOW_COPY_AND_ASSIGN(plAnimGraph);
13
14public:
17
18 void Clear();
19
21 void AddConnection(const plAnimGraphNode* pSrcNode, plStringView sSrcPinName, plAnimGraphNode* pDstNode, plStringView sDstPinName);
22
23 plResult Serialize(plStreamWriter& inout_stream) const;
24 plResult Deserialize(plStreamReader& inout_stream);
25
26 const plInstanceDataAllocator& GetInstanceDataAlloator() const { return m_InstanceDataAllocator; }
27 plArrayPtr<const plUniquePtr<plAnimGraphNode>> GetNodes() const { return m_Nodes; }
28
29 void PrepareForUse();
30
31private:
32 friend class plAnimGraphInstance;
33
34 struct ConnectionTo
35 {
36 plString m_sSrcPinName;
37 const plAnimGraphNode* m_pDstNode = nullptr;
38 plString m_sDstPinName;
39 plAnimGraphPin* m_pSrcPin = nullptr;
40 plAnimGraphPin* m_pDstPin = nullptr;
41 };
42
43 struct ConnectionsTo
44 {
46 };
47
48 void SortNodesByPriority();
49 void PreparePinMapping();
50 void AssignInputPinIndices();
51 void AssignOutputPinIndices();
52 plUInt16 ComputeNodePriority(const plAnimGraphNode* pNode, plMap<const plAnimGraphNode*, plUInt16>& inout_Prios, plUInt16& inout_uiOutputPrio) const;
53
54 bool m_bPreparedForUse = true;
55 plUInt32 m_uiInputPinCounts[plAnimGraphPin::Type::ENUM_COUNT];
56 plUInt32 m_uiPinInstanceDataOffset[plAnimGraphPin::Type::ENUM_COUNT];
58
60 plDynamicArray<plHybridArray<plUInt16, 1>> m_OutputPinToInputPinMapping[plAnimGraphPin::ENUM_COUNT];
61 plInstanceDataAllocator m_InstanceDataAllocator;
62
63 friend class plAnimGraphTriggerOutputPin;
64 friend class plAnimGraphNumberOutputPin;
65 friend class plAnimGraphBoolOutputPin;
69};
Definition AnimGraphPins.h:162
Definition AnimGraphPins.h:140
Definition AnimGraph.h:11
Definition AnimGraphInstance.h:15
Definition AnimGraphPins.h:194
Definition AnimGraphPins.h:216
Base class for all nodes in an plAnimGraphInstance.
Definition AnimGraphNode.h:36
Definition AnimGraphPins.h:118
Definition AnimGraphPins.h:29
Definition AnimGraphPins.h:92
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition DynamicArray.h:81
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Helper class to manager instance data allocation, construction and destruction.
Definition InstanceDataAllocator.h:35
Definition Map.h:408
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54