gwnavgeneration/boundary/boundarygraphblobvisualgeometrybuilder.h Source File

boundarygraphblobvisualgeometrybuilder.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 #pragma once
8 
13 
14 namespace Kaim
15 {
16 
17 class VisualGeometryBuilder;
18 class BoundaryGraphBlob;
19 class BoundaryGraphBlobVertex;
20 class BoundaryGraphBlobEdge;
21 class BoundaryGraphBlobContour;
22 class BoundaryGraphBlobPolygon;
23 class BoundaryGraphBlobSimplifyPolyline;
24 class BoundaryGraphBlobSimplifiedHalfEdge;
25 class BoundaryGraphBlobSimplifiedContour;
26 class BoundaryGraphBlobSimplifiedPolygon;
27 class Color;
28 
29 
30 class BoundaryGraphBlobVisualGeometryBuilder : public IVisualGeometryBuilder
31 {
32 public:
33  typedef BoundaryGraphBlobVertex Vertex;
34  typedef BoundaryGraphBlobEdge Edge;
35  typedef BoundaryGraphBlobContour Contour;
36  typedef BoundaryGraphBlobPolygon Polygon;
37  typedef BoundaryGraphBlobSimplifyPolyline SimplifyPolyline;
38  typedef BoundaryGraphBlobSimplifiedHalfEdge SimplifiedEdge;
39  typedef BoundaryGraphBlobSimplifiedContour SimplifiedContour;
40  typedef BoundaryGraphBlobSimplifiedPolygon SimplifiedPolygon;
41 
42 public:
43  enum EdgeColorScheme
44  {
45  FromEdgeType,
46  FromContourWinding,
47  FromPolygonIdx,
48  FromPolygonColor
49  };
50 
51  class EdgeVisualInfo
52  {
53  public:
54  EdgeVisualInfo() :
55  m_polygonColor(PixelColor_Unset), m_contourWinding(ContourWinding_Unset), m_polygonIdx(0) {}
56 
57  public:
58  PixelColor m_polygonColor;
59  ContourWinding m_contourWinding;
60  KyUInt32 m_polygonIdx;
61  };
62 
63 public:
64  BoundaryGraphBlobVisualGeometryBuilder(BoundaryGraphBlob* boundaryGraphBlob);
65  virtual void DoBuild();
66 
67 private:
68  Vec3f GetVertexPos(const Vertex& vertex);
69 
70  void BuildStaticVerticesGeometry(Color color);
71  void BuildNarrowVerticesGeometry(Color color);
72 
73  void BuildEdgeGeometry(const Edge& edge, EdgeVisualInfo& edgeVisualInfo);
74  void BuildContourGeometry(const Contour& contour, EdgeVisualInfo& edgeVisualInfo);
75  void BuildPolygonsGeometry();
76 
77  void BuildSimplifiedEdgeGeometry(const SimplifiedEdge& simplifiedEdge, EdgeVisualInfo& edgeVisualInfo);
78  void BuildSimplifiedContourGeometry(const SimplifiedContour& simplifiedContour, EdgeVisualInfo& edgeVisualInfo);
79  void BuildSimplifiedPolygonsGeometry();
80 
81  void BuildSimplifyPolylinesGeometry();
82  void BuildSimplifySegmentGeometry(const Vertex& start, const Vertex& end, KyUInt32 polylineIdx);
83 
84  Color GetEdgeColor(const EdgeVisualInfo& edgeVisualInfo, const BoundaryEdgeType& edgeType);
85 
86 private:
87  const BoundaryGraphBlob* m_graph;
88  KyFloat32 m_rasterPrecision;
89  EdgeColorScheme m_edgeColorScheme;
90  const Vertex* m_vertices;
91  const Edge* m_edges;
92  const Contour* m_contours;
93  const Polygon* m_polygons;
94  const SimplifyPolyline* m_simplifyPolylines;
95  const SimplifiedEdge* m_simplifiedEdges;
96  const SimplifiedContour* m_simplifiedContours;
97  const SimplifiedPolygon* m_simplifiedPolygons;
98 
99  KyFloat32 m_staticVerticesheight;
100  KyFloat32 m_polygonsOffset; // the initial ones
101  KyFloat32 m_simplifiedPolygonsOffset;
102  KyFloat32 m_simplifyPolylineOffset;
103 
104  // TODO: instead of some display_this, display_that or level_of_detail.
105  // We should have Group/Name to activate/deactivate checkboxes in the NavigationLab just as for display lists.
106  bool m_displayNarrowVertices;
107  bool m_displaySimplifyPolylines;
108 };
109 
110 
111 }
112 
113 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
float KyFloat32
float
Definition: types.h:32