gwnavgeneration/boundary/boundarygraphblob.h Source File

boundarygraphblob.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: GUAL - secondary contact: LASI
9 #ifndef GwNavGen_BoundaryGraphBlob_H
10 #define GwNavGen_BoundaryGraphBlob_H
11 
12 
22 
23 
24 namespace Kaim
25 {
26 
27 
28 class BoundaryGraphBlobVertex
29 {
30  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
31 public:
32  BoundaryPos m_boundaryPos; // in world (not local)
33  KyFloat32 m_altitude;
34  KyUInt32 m_ins[4];
35  KyUInt32 m_outs[4];
36  BoundaryVertexStaticStatus m_staticStatus;
37  KyUInt32 m_index;
38 };
39 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobVertex& self)
40 {
41  SwapEndianness(e, self.m_boundaryPos);
42  SwapEndianness(e, self.m_altitude);
43 
44  for (KyUInt32 i = 0; i < 4; ++i)
45  SwapEndianness(e, self.m_ins[i]);
46 
47  for (KyUInt32 i = 0; i < 4; ++i)
48  SwapEndianness(e, self.m_outs[i]);
49 
50  SwapEndianness(e, self.m_staticStatus);
51  SwapEndianness(e, self.m_index);
52 }
53 
54 
55 class BoundaryGraphBlobSimplifyPolyline
56 {
57  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
58 public:
59  KyUInt32 m_cycle;
60  BlobArray<KyUInt32> m_vertices;
61 };
62 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobSimplifyPolyline& self)
63 {
64  SwapEndianness(e, self.m_cycle);
65  SwapEndianness(e, self.m_vertices);
66 }
67 
68 
69 class BoundaryGraphBlobEdge
70 {
71  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
72 public:
73  void SetBoundaryEdgeType(BoundaryEdgeType type) { m_type = (KyUInt32)type; }
74  BoundaryEdgeType GetBoundaryEdgeType() const { return (BoundaryEdgeType)m_type; }
75 
76 public:
77  CardinalDir m_dir;
78  KyUInt32 m_type;
79  KyUInt32 m_vertex[2];
80  KyUInt32 m_next;
81  KyUInt32 m_pair;
82  KyUInt32 m_index;
83 };
84 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobEdge& self)
85 {
86  SwapEndianness(e, self.m_dir);
87  SwapEndianness(e, self.m_type);
88  SwapEndianness(e, self.m_vertex[0]);
89  SwapEndianness(e, self.m_vertex[1]);
90  SwapEndianness(e, self.m_next);
91  SwapEndianness(e, self.m_pair);
92  SwapEndianness(e, self.m_index);
93 }
94 
95 
96 class BoundaryGraphBlobContour
97 {
98  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
99 public:
100  KyUInt32 m_edgeCount;
101  KyUInt32 m_begin;
102  ContourWinding m_type;
103  PixelColor m_leftColor;
104  KyUInt32 m_index;
105 };
106 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobContour& self)
107 {
108  SwapEndianness(e, self.m_edgeCount);
109  SwapEndianness(e, self.m_begin);
110  SwapEndianness(e, self.m_type);
111  SwapEndianness(e, self.m_leftColor);
112  SwapEndianness(e, self.m_index);
113 }
114 
115 
116 class BoundaryGraphBlobPolygon
117 {
118  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
119 public:
120  PixelColor m_leftColor;
121  BlobArray<KyUInt32> m_contours;
122 };
123 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobPolygon& self)
124 {
125  SwapEndianness(e, self.m_leftColor);
126  SwapEndianness(e, self.m_contours);
127 }
128 
129 
130 class BoundaryGraphBlobSimplifiedHalfEdge
131 {
132  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
133 public:
134 public:
135  void SetBoundaryEdgeType(BoundaryEdgeType type) { m_type = (KyUInt32)type; }
136  BoundaryEdgeType GetBoundaryEdgeType() const { return (BoundaryEdgeType)m_type; }
137 
138 public:
139  KyUInt32 m_type;
140  KyUInt32 m_vertex[2];
141  KyUInt32 m_next;
142  KyUInt32 m_pair;
143  KyUInt32 m_index;
144 };
145 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobSimplifiedHalfEdge& self)
146 {
147  SwapEndianness(e, self.m_type);
148  SwapEndianness(e, self.m_vertex[0]);
149  SwapEndianness(e, self.m_vertex[1]);
150  SwapEndianness(e, self.m_next);
151  SwapEndianness(e, self.m_pair);
152  SwapEndianness(e, self.m_index);
153 }
154 
155 
156 class BoundaryGraphBlobSimplifiedContour
157 {
158  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
159 public:
160  KyUInt32 m_edgeCount;
161  KyUInt32 m_begin;
162  ContourWinding m_winding;
163  PixelColor m_leftColor;
164  KyUInt32 m_index;
165 };
166 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobSimplifiedContour& self)
167 {
168  SwapEndianness(e, self.m_edgeCount);
169  SwapEndianness(e, self.m_begin);
170  SwapEndianness(e, self.m_winding);
171  SwapEndianness(e, self.m_leftColor);
172  SwapEndianness(e, self.m_index);
173 }
174 
175 
176 class BoundaryGraphBlobSimplifiedPolygon
177 {
178  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
179 public:
180  PixelColor m_leftColor;
181  BlobArray<KyUInt32> m_simplifiedContours;
182 };
183 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlobSimplifiedPolygon& self)
184 {
185  SwapEndianness(e, self.m_leftColor);
186  SwapEndianness(e, self.m_simplifiedContours);
187 }
188 
189 
190 class BoundaryGraphBlob
191 {
192  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
193  KY_ROOT_BLOB_CLASS(Generator, BoundaryGraphBlob, 2)
194 
195 public:
196  typedef BoundaryGraphBlobVertex Vertex;
197  typedef BoundaryGraphBlobEdge Edge;
198  typedef BoundaryGraphBlobContour Contour;
199  typedef BoundaryGraphBlobPolygon Polygon;
200  typedef BoundaryGraphBlobSimplifyPolyline SimplifyPolyline;
201 
202  typedef BoundaryGraphBlobSimplifiedHalfEdge SimplifiedHalfEdge;
203  typedef BoundaryGraphBlobSimplifiedContour SimplifiedContour;
204  typedef BoundaryGraphBlobSimplifiedPolygon SimplifiedPolygon;
205 
206 public:
207  KyFloat32 m_rasterPrecision;
208  PixelAndCellGrid m_pixelAndCellGrid;
209  CellDesc m_cellDesc;
210  BlobArray<Vertex> m_vertices;
211  BlobArray<Edge> m_edges;
212  BlobArray<Contour> m_contours;
213  BlobArray<Polygon> m_polygons;
214  BlobArray<SimplifyPolyline> m_simplifyPolylines;
215  BlobArray<SimplifiedHalfEdge> m_simplifiedEdges;
216  BlobArray<SimplifiedContour> m_simplifiedContours;
217  BlobArray<SimplifiedPolygon> m_simplifiedPolygons;
218 };
219 inline void SwapEndianness(Endianness::Target e, BoundaryGraphBlob& self)
220 {
221  SwapEndianness(e, self.m_rasterPrecision);
222  SwapEndianness(e, self.m_pixelAndCellGrid);
223  SwapEndianness(e, self.m_cellDesc);
224  SwapEndianness(e, self.m_vertices);
225  SwapEndianness(e, self.m_edges);
226  SwapEndianness(e, self.m_contours);
227  SwapEndianness(e, self.m_polygons);
228  SwapEndianness(e, self.m_simplifyPolylines);
229  SwapEndianness(e, self.m_simplifiedEdges);
230  SwapEndianness(e, self.m_simplifiedContours);
231  SwapEndianness(e, self.m_simplifiedPolygons);
232 }
233 
234 
235 }
236 
237 
238 #endif
239 
KyUInt32 CardinalDir
Defines a type that refers to one of the cardinal points on the compass:
Definition: cardinaldir.h:23
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
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