gwnavruntime/navgraph/blobs/navgraphblobbuilder.h Source File

navgraphblobbuilder.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 
12 
13 
14 namespace Kaim
15 {
16 
17 class NavGraphBlob;
18 
22 class NavGraphBlobBuilder : public BaseBlobBuilder<NavGraphBlob>
23 {
24 public:
26 
27  KyUInt32 GetEdgeCount() const;
28  KyUInt32 GetVertexCount() const;
29  KyUInt32 GetNavTagCount() const;
30 
32 
36  KyUInt32 AddNavTag(const DynamicNavTag* dynamicNavTag);
37 
38 
39  // ---- Add vertices ----
40 
46 
52  KyUInt32 AddVertexWithUnsharedNavTag(const Vec3f& position, DynamicNavTag* dynamicNavTag, NavGraphVertexLinkType vertexType = NavGraphVertexLinkType_LinkToNavMesh);
53 
60 
61  // ---- Add Monodirectional edges ---
62 
71  KyUInt32 AddMonodirectionalEdgeWithoutNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx);
72 
82  KyUInt32 AddMonodirectionalEdgeWithUnsharedNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag* dynamicNavTag);
83 
93  KyUInt32 AddMonodirectionalEdgeWithNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, KyUInt32 navTagIdx);
94 
95  // ---- Add Bidirectional edges ---
96 
103  void AddBidirectionalEdgeWithoutNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx);
104 
113  KyResult AddBidirectionalEdgeWithUnsharedNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag* dynamicNavTag);
114 
122  void AddBidirectionalEdgeWithNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, KyUInt32 navTagIdx);
123 
124  void SetName(const char* graphName);
125 
126 public: // DEPRECATED functions
127 
128  // --------- Deprecated ExclusiveNavTag ---------
132 
133  KY_DEPRECATED(KyUInt32 AddVertexWithExclusiveNavTag(const Vec3f& position, DynamicNavTag* dynamicNavTag, NavGraphVertexLinkType vertexType = NavGraphVertexLinkType_LinkToNavMesh));
134  KY_DEPRECATED(KyUInt32 AddMonodirectionalEdgeWithExclusiveNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag* dynamicNavTag));
135  KY_DEPRECATED(void AddBidirectionalEdgeWithExclusiveNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag* dynamicNavTag));
136 
137 private:
138  virtual void DoBuild();
139 
140 public: // internal
141  KyUInt32 m_visualDebugId; // unused since NavGraphBlobs were sent into NavGraphArray blob from a NavData
142  String m_name; // optional, only for Visual Debug
144  KyArray<NavGraphBlobBuilder_Vertex> m_vertices; //< Graph Vertices.
145  KyArray<NavGraphBlobBuilder_Edge> m_edges; //< Graph Edges.
146 };
147 
148 
149 KY_INLINE KyUInt32 NavGraphBlobBuilder::GetEdgeCount() const { return m_edges.GetCount(); }
150 KY_INLINE KyUInt32 NavGraphBlobBuilder::GetVertexCount() const { return m_vertices.GetCount(); }
151 KY_INLINE KyUInt32 NavGraphBlobBuilder::GetNavTagCount() const { return m_navTags.GetCount(); }
152 
153 }
154 
KyUInt16 NavGraphVertexLinkType
Defines a type for a tag that determines whether or not a vertex in a NavGraph should be connected to...
Definition: navgraphtypes.h:24
KyUInt32 AddMonodirectionalEdgeWithUnsharedNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag *dynamicNavTag)
Adds a new edge that connects the specified vertices.
Definition: navgraphblobbuilder.cpp:63
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
static const NavGraphVertexLinkType NavGraphVertexLinkType_LinkToNavMesh
Indicates that this vertex should be connected to the NavMesh. If the vertex is outside, we try to link it inside.
Definition: navgraphtypes.h:26
void AddBidirectionalEdgeWithoutNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx)
Adds a bidirectional edge that connects the specified vertices.
Definition: navgraphblobbuilder.cpp:85
KyUInt32 AddVertexWithoutNavTag(const Vec3f &position, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
Adds a new vertex to the Graph with no associated NavTag.
Definition: navgraphblobbuilder.cpp:31
KyUInt32 AddVertexWithExclusiveNavTag(const Vec3f &position, DynamicNavTag *dynamicNavTag, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
The term 'ExclusiveNavTag' was confusing or ambiguous, it is not exclusive as in DynamicNavTag::IsExc...
Definition: navgraphblobbuilder.cpp:46
KyUInt32 AddMonodirectionalEdgeWithoutNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx)
Adds a new edge that connects the specified vertices.
Definition: navgraphblobbuilder.cpp:58
KyUInt32 AddMonodirectionalEdgeWithNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, KyUInt32 navTagIdx)
Adds a new edge that connects the specified vertices.
Definition: navgraphblobbuilder.cpp:76
KyUInt32 AddVertexWithNavTag(const Vec3f &position, KyUInt32 navTagIdx, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
Adds a new vertex to the Graph with an associated NavTag that has already been added to the graph...
Definition: navgraphblobbuilder.cpp:51
#define KY_DEPRECATED(expr)
The compiler issues a warning when a deprecated function or typedef is used.
Definition: types.h:93
Navigation return code class.
Definition: types.h:108
virtual void DoBuild()
Implement this function in any class that derives from BaseBlobBuilder.
Definition: navgraphblobbuilder.cpp:115
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
KyUInt32 AddVertexWithUnsharedNavTag(const Vec3f &position, DynamicNavTag *dynamicNavTag, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
Adds a new vertex to the Graph with an associated NavTag that is not supposed to be associated to oth...
Definition: navgraphblobbuilder.cpp:36
BaseBlobBuilder is an abstract base class that builds a blob within a contiguous block of memory...
Definition: baseblobbuilder.h:27
This class allows you to build a NavGraph, which you can then add to the NavData for a sector...
Definition: navgraphblobbuilder.h:22
KyResult AddBidirectionalEdgeWithUnsharedNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag *dynamicNavTag)
Adds a bidirectional edge that connects the specified vertices.
Definition: navgraphblobbuilder.cpp:90
void AddBidirectionalEdgeWithNavTag(KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, KyUInt32 navTagIdx)
Adds a bidirectional edge that connects the specified vertices.
Definition: navgraphblobbuilder.cpp:104
KyUInt32 AddNavTag(const DynamicNavTag *dynamicNavTag)
Adds a NavTag that will be associated to edge and/or vertices.
Definition: navgraphblobbuilder.cpp:17
3d vector using 32bits floating points.
Definition: vec3f.h:16
void SetName(const char *graphName)
// optional, only for Visual Debug
Definition: navgraphblobbuilder.cpp:110