gwnavruntime/visualsystem/displaylistblob.h Source File

displaylistblob.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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 
8 // primary contact: BRGR - secondary contact: MAMU
9 #ifndef Navigation_DisplayListBlob_H
10 #define Navigation_DisplayListBlob_H
11 
12 
25 
26 
27 namespace Kaim
28 {
29 
30 class DisplayShape
31 {
32  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_VisualSystem)
33 
34 public:
35  DisplayShape()
36  : m_displayShapeType(KyUInt32MAXVAL)
37  {}
38 
39  void Clear() { m_data.Clear(); }
40  void Reserve(KyUInt32 numberOfFloat) { m_data.Reserve(numberOfFloat); }
41  void Push(KyUInt32 value) { m_data.PushBack((KyFloat32)value); }
42  void Push(KyFloat32 value) { m_data.PushBack(value); }
43 
44  void Push3(const Vec3f& pos)
45  {
46  m_data.PushBack(pos.x);
47  m_data.PushBack(pos.y);
48  m_data.PushBack(pos.z);
49  }
50 
51  void Push6(const Box3f& box)
52  {
53  Push3(box.m_min);
54  Push3(box.m_max);
55  }
56 
57  void Push12(const Transform& transform)
58  {
59  Push3(transform.m_rotationMatrix.GetRow(0));
60  Push3(transform.m_rotationMatrix.GetRow(1));
61  Push3(transform.m_rotationMatrix.GetRow(2));
62  Push3(transform.m_translation);
63  }
64 
65 public: // internal
66  KyUInt32 m_displayShapeType;
67  KyArrayPOD<KyFloat32, MemStat_VisualSystem> m_data;
68  VisualShapeColor m_color;
69 };
70 
71 class DisplayShapeBlob
72 {
73  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_VisualSystem)
74 
75 public:
76  KyUInt32 m_displayShapeType; //enum DisplayShapeType
77  BlobArray<KyFloat32> m_data;
78  VisualColor m_triangleColor;
79  VisualColor m_lineColor;
80 };
81 
82 inline void SwapEndianness(Kaim::Endianness::Target e, DisplayShapeBlob& self)
83 {
84  SwapEndianness(e, self.m_displayShapeType);
85  SwapEndianness(e, self.m_data);
86  SwapEndianness(e, self.m_triangleColor);
87  SwapEndianness(e, self.m_lineColor);
88 }
89 
90 
91 class DisplayText
92 {
93  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_VisualSystem)
94 
95 public:
96  Vec3f m_position;
97  KyArrayPOD<char, MemStat_VisualSystem> m_text;
98  VisualColor m_color;
99 };
100 
101 class DisplayTextBlob
102 {
103  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_VisualSystem)
104 
105 public:
106  Vec3f m_position;
107  BlobArray<char> m_text;
108  VisualColor m_color;
109 };
110 
111 inline void SwapEndianness(Kaim::Endianness::Target e, DisplayTextBlob& self)
112 {
113  SwapEndianness(e, self.m_position);
114  SwapEndianness(e, self.m_text);
115  SwapEndianness(e, self.m_color);
116 }
117 
120 {
121  DisplayListLifeSpan_SingleFrame,
123 };
124 
125 class DisplayListBlob
126 {
127  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_VisualSystem)
128  KY_ROOT_BLOB_CLASS(VisualDebug, DisplayListBlob, 1)
130 public:
131  DisplayListLifeSpan GetDisplayListLifeSpan() const
132  {
133  if (m_displayListId == KyUInt32MAXVAL ||
134  m_displayListId == GetDisplayListIdForLifeSpanUserControlledWithoutDisplayListId())
135  {
137  }
138  else
139  {
140  return DisplayListLifeSpan_SingleFrame;
141  }
142  }
143 
144  static KyUInt32 GetDisplayListIdForLifeSpanUserControlledWithoutDisplayListId() { return KyUInt32MAXVAL - 1; }
145 
146 public:
147  BlobArray<char> m_listName;
148  BlobArray<char> m_groupName;
149  BlobArray<DisplayTextBlob> m_textBlobs;
150  BlobArray<DisplayShapeBlob> m_shapeBlobs;
151  KyUInt32 m_showInLabWhenNotSelected;
152  KyUInt32 m_showInLabWhenSelected;
153  KyUInt32 m_worldElementId;
154  KyUInt32 m_displayListId;
155 };
156 
157 inline void SwapEndianness(Kaim::Endianness::Target e, DisplayListBlob& self)
158 {
159  SwapEndianness(e, self.m_displayListId);
160  SwapEndianness(e, self.m_worldElementId);
161  SwapEndianness(e, self.m_listName);
162  SwapEndianness(e, self.m_groupName);
163  SwapEndianness(e, self.m_textBlobs);
164  SwapEndianness(e, self.m_shapeBlobs);
165  SwapEndianness(e, self.m_showInLabWhenNotSelected);
166  SwapEndianness(e, self.m_showInLabWhenSelected);
167 }
168 
169 }
170 
171 #endif // Navigation_DisplayListBlob_H
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
displayList available in the NavigationLab only at the frame when it was sent
Definition: displaylistblob.h:129
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
DisplayListLifeSpan
Indicates if the displayList will be only visible when received, or will be remanent until replaced o...
Definition: displaylistblob.h:126