gwnavruntime/channel/stringpulledbubblelist.h Source File

stringpulledbubblelist.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 #pragma once
8 
10 
11 
12 namespace Kaim
13 {
14 
15 class DisplayListManager;
16 class StringPuller;
17 
18 
19 class StringPullerPersistentDisplayListIds
20 {
21 public:
22  StringPullerPersistentDisplayListIds()
23  : m_displayListManager(nullptr)
24  , m_singleFrame(true)
25  , m_displayListId_Edges(KyUInt32MAXVAL)
26  , m_displayListId_Sectors(KyUInt32MAXVAL)
27  {}
28 
29  ~StringPullerPersistentDisplayListIds() {}
30 
31  void Initialize(DisplayListManager* displayListManager);
32  void Release();
33 
34 public:
35  DisplayListManager* m_displayListManager;
36  bool m_singleFrame;
37 
38  BubbleArrayPersistentDisplayListIds m_bubbleArrayPersistentDisplayListIds;
39  KyUInt32 m_displayListId_Edges;
40  KyUInt32 m_displayListId_Sectors;
41 };
42 
43 class StringPulledBubbleListDisplayConfig
44 {
45 public:
46  StringPulledBubbleListDisplayConfig() { SetDefaults(); }
47 
48  void SetDefaults();
49 
50  Color m_edgeColor;
51  Color m_sectorStartColor;
52  Color m_sectorEndColor;
53 
54  KyFloat32 m_arrowWidth; // if 0.0f, render just a line
55 
56  BubbleArrayDisplayConfig m_bubbleArrayDisplayConfig;
57  StringPullerPersistentDisplayListIds m_persistentDisplayListIds;
58 };
59 
60 
61 
62 class StringPulledEdge
63 {
64 public:
65  StringPulledEdge() {}
66 
67  Vec3f m_start;
68  Vec3f m_end;
69  Vec2f m_normalizedDir;
70 };
71 
72 class StringPulledBubbleList
73 {
74 public:
75  StringPulledBubbleList() {}
76 
77  void Clear();
78  void Reserve(KyUInt32 bubbleCount);
79  void Resize(KyUInt32 bubbleCount);
80  void PushBubble(const Bubble& bubble, KyUInt32 bubbleIndex) { m_bubbleArray.PushBack(bubble); m_bubbleIndexArray.PushBack(bubbleIndex); }
81  void Append(const StringPulledBubbleList& other);
82  KyResult Finalize();
83 
84  bool IsEmpty() const { return m_bubbleArray.IsEmpty(); }
85  KyUInt32 GetBubbleCount() const { return m_bubbleArray.GetCount(); }
86  const Bubble& GetBubble(KyUInt32 bubbleIdx) const { return m_bubbleArray[bubbleIdx]; }
87  KyUInt32 GetBubbleIndex(KyUInt32 bubbleIdx) const { return m_bubbleIndexArray[bubbleIdx]; }
88  KyUInt32 GetEdgeCount() const { return m_edges.GetCount(); }
89  const StringPulledEdge& GetEdge(KyUInt32 edgeIdx) const { return m_edges[edgeIdx]; }
90 
91  void SendVisualDebug(DisplayListManager* displayListManager, const StringPulledBubbleListDisplayConfig& displayConfig, const char* name, const char* group, KyUInt32 visualDebugId = KyUInt32MAXVAL) const;
92 
93 private:
94  BubbleArray m_bubbleArray;
95  KyArray<KyUInt32> m_bubbleIndexArray;
96  KyArray<StringPulledEdge> m_edges;
97 };
98 
99 } // namespace Kaim
100 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68
float KyFloat32
float
Definition: types.h:32