gwnavruntime/channel/channelarrayblob.h Source File

channelarrayblob.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: MAMU - secondary contact: NOBODY
9 
10 #ifndef Navigation_ChannelArray_Blob_H
11 #define Navigation_ChannelArray_Blob_H
12 
16 
17 namespace Kaim
18 {
19 
20 class Gate;
21 class Channel;
22 class ChannelArray;
23 
24 class GateBlob
25 {
26 public:
27  GateBlob() {}
28 
29  KyUInt32 m_type; // cast this as GateType
30  Vec3f m_leftPos;
31  Vec3f m_pathPos;
32  Vec3f m_rightPos;
33  KyFloat32 m_leftWidth;
34  KyFloat32 m_rightWidth;
35 };
36 
37 inline void SwapEndianness(Endianness::Target e, GateBlob& self)
38 {
39  SwapEndianness(e, self.m_type);
40  SwapEndianness(e, self.m_leftPos);
41  SwapEndianness(e, self.m_pathPos);
42  SwapEndianness(e, self.m_rightPos);
43  SwapEndianness(e, self.m_leftWidth);
44  SwapEndianness(e, self.m_rightWidth);
45 }
46 
47 class GateBlobBuilder : public BaseBlobBuilder<GateBlob>
48 {
49  KY_CLASS_WITHOUT_COPY(GateBlobBuilder)
50 
51 public:
52  GateBlobBuilder(const Gate* gate) : m_gate(gate) {}
53 
54  virtual void DoBuild();
55 
56 private:
57  const Gate* m_gate;
58 };
59 
60 // ----------------------------- Channel blob -------------------------------
61 
62 class ChannelBlob
63 {
64  KY_ROOT_BLOB_CLASS(Runtime, ChannelBlob, 0)
65 
66 public:
67  ChannelBlob() {}
68 
69 public:
70  BlobArray<GateBlob> m_gates;
71  BlobArray<Vec2f> m_preChannelPolyline;
72  BlobArray<Vec2f> m_postChannelPolyline;
73 };
74 
75 inline void SwapEndianness(Endianness::Target e, ChannelBlob& self)
76 {
77  SwapEndianness(e, self.m_gates);
78  SwapEndianness(e, self.m_preChannelPolyline);
79  SwapEndianness(e, self.m_postChannelPolyline);
80 }
81 
82 class ChannelBlobBuilder : public BaseBlobBuilder<ChannelBlob>
83 {
84  KY_CLASS_WITHOUT_COPY(ChannelBlobBuilder)
85 
86 public:
87  ChannelBlobBuilder(const Channel* channel) : m_channel(channel) {}
88 
89  virtual void DoBuild();
90 
91 private:
92  const Channel* m_channel;
93 };
94 
95 
96 // ---------------------------------- Channel array blob ----------------------------------
97 
98 class ChannelArrayBlob
99 {
100  KY_ROOT_BLOB_CLASS(Runtime, ChannelArrayBlob, 0)
101 
102 public:
103  ChannelArrayBlob() {}
104 
105 public:
106  KyUInt32 m_visualDebugId;
107  BlobArray<ChannelBlob> m_channelArray;
108 };
109 
110 inline void SwapEndianness(Endianness::Target e, ChannelArrayBlob& self)
111 {
112  SwapEndianness(e, self.m_visualDebugId);
113  SwapEndianness(e, self.m_channelArray);
114 }
115 
116 class ChannelArrayBlobBuilder : public BaseBlobBuilder<ChannelArrayBlob>
117 {
118  KY_CLASS_WITHOUT_COPY(ChannelArrayBlobBuilder)
119 
120 public:
121  ChannelArrayBlobBuilder(const ChannelArray* channelArray, KyUInt32 visualDebugId) : m_channelArray(channelArray), m_visualDebugId(visualDebugId) {}
122 
123  virtual void DoBuild();
124 
125 private:
126  const ChannelArray* m_channelArray;
127  KyUInt32 m_visualDebugId;
128 };
129 
130 
131 } // namespace Kaim
132 
133 #endif
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
Definition: gamekitcrowddispersion.h:20
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43