gwnavruntime/channel/channelarrayblob.h Source File

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