gwnavgeneration/boundary/boundarygraphblobvisualgeometrybuilder.h Source File

boundarygraphblobvisualgeometrybuilder.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 
9 
10 
11 // primary contact: GUAL - secondary contact: NOBODY
12 #ifndef GwNavGen_BoundaryGraphBlobVisualGeometryBuilder_H
13 #define GwNavGen_BoundaryGraphBlobVisualGeometryBuilder_H
14 
19 
20 
21 namespace Kaim
22 {
23 
24 class VisualGeometryBuilder;
25 class BoundaryGraphBlob;
26 class BoundaryGraphBlobVertex;
27 class BoundaryGraphBlobEdge;
28 class BoundaryGraphBlobContour;
29 class BoundaryGraphBlobPolygon;
30 class BoundaryGraphBlobSimplifyPolyline;
31 class BoundaryGraphBlobSimplifiedHalfEdge;
32 class BoundaryGraphBlobSimplifiedContour;
33 class BoundaryGraphBlobSimplifiedPolygon;
34 class VisualColor;
35 
36 
37 class BoundaryGraphBlobVisualGeometryBuilder : public IVisualGeometryBuilder
38 {
39 public:
40  typedef BoundaryGraphBlobVertex VertexBlob;
41  typedef BoundaryGraphBlobEdge EdgeBlob;
42  typedef BoundaryGraphBlobContour ContourBlob;
43  typedef BoundaryGraphBlobPolygon PolygonBlob;
44  typedef BoundaryGraphBlobSimplifyPolyline SimplifyPolylineBlob;
45  typedef BoundaryGraphBlobSimplifiedHalfEdge SimplifiedEdgeBlob;
46  typedef BoundaryGraphBlobSimplifiedContour SimplifiedContourBlob;
47  typedef BoundaryGraphBlobSimplifiedPolygon SimplifiedPolygonBlob;
48 
49 public:
50  enum EdgeColorScheme
51  {
52  FromEdgeType,
53  FromContourWinding,
54  FromPolygonIdx,
55  FromPolygonColor
56  };
57 
58  class EdgeVisualInfo
59  {
60  public:
61  EdgeVisualInfo() :
62  m_polygonColor(PixelColor_Unset), m_contourWinding(ContourWinding_Unset), m_polygonIdx(0) {}
63 
64  public:
65  PixelColor m_polygonColor;
66  ContourWinding m_contourWinding;
67  KyUInt32 m_polygonIdx;
68  };
69 
70 public:
71  BoundaryGraphBlobVisualGeometryBuilder(BoundaryGraphBlob* boundaryGraphBlob);
72 
73  void SetEdgeColorScheme(EdgeColorScheme edgeColorScheme);
74 
75  virtual void DoBuild();
76 
77 private:
78  Vec3f GetVertexPos(const VertexBlob& vertex);
79 
80  void BuildStaticVerticesGeometry(VisualColor color);
81  void BuildNarrowVerticesGeometry(VisualColor color);
82 
83  void BuildEdgeGeometry(const EdgeBlob& edge, EdgeVisualInfo& edgeVisualInfo);
84  void BuildContourGeometry(const ContourBlob& contour, EdgeVisualInfo& edgeVisualInfo);
85  void BuildPolygonsGeometry();
86 
87  void BuildSimplifiedEdgeGeometry(const SimplifiedEdgeBlob& simplifiedEdge, EdgeVisualInfo& edgeVisualInfo);
88  void BuildSimplifiedContourGeometry(const SimplifiedContourBlob& contour, EdgeVisualInfo& edgeVisualInfo);
89  void BuildSimplifiedPolygonsGeometry();
90 
91  void BuildSimplifyPolylinesGeometry();
92  void BuildSimplifySegmentGeometry(const VertexBlob& start, const VertexBlob& end, KyUInt32 polylineIdx);
93 
94  VisualColor GetEdgeColor(const EdgeVisualInfo& edgeVisualInfo, const BoundaryEdgeType& edgeType);
95 
96 private:
97  const BoundaryGraphBlob* m_graph;
98  KyFloat32 m_rasterPrecision;
99  EdgeColorScheme m_edgeColorScheme;
100  const VertexBlob* m_vertices;
101  const EdgeBlob* m_edges;
102  const ContourBlob* m_contours;
103  const PolygonBlob* m_polygons;
104  const SimplifyPolylineBlob* m_simplifyPolylines;
105  const SimplifiedEdgeBlob* m_simplifiedEdges;
106  const SimplifiedContourBlob* m_simplifiedContours;
107  const SimplifiedPolygonBlob* m_simplifiedPolygons;
108 };
109 
110 
111 }
112 
113 
114 #endif //GwNavGen_BoundaryGraphBlobVisualGeometryBuilder_H
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