Kaim::NavGraphBlobBuilder Class Reference

#include <navgraphblobbuilder.h>

Class Description

This class allows you to build a NavGraph, which you can then add to the NavData for a sector.

This class is typically used in a custom post-processing phase after generating the NavMesh for a terrain.

+ Examples:

Inherits Kaim::BaseBlobBuilder< NavGraphBlob >.

Public Member Functions

KyUInt32 AddNavTag (const DynamicNavTag *dynamicNavTag)
 
NavGraphBlobBuild (BlobHandler< NavGraphBlob > &blobHandler)
 
void BuildFlatBlob (NavGraphBlob &blob)
 
void DoAllocAndBuildReferencedBlob (BlobBuffer *blobBuffer, BlobRef< NavGraphBlob > *blobRef)
 
void DoBuildAllocatedBlob (BlobBuffer *blobBuffer, NavGraphBlob *blob)
 
BlobBuffer * GetBlobBufferToBuildThis ()
 
bool IsWriteMode ()
 

Public Attributes

NavGraphBlobm_blob
 
BlobBuffer * m_blobBuffer
 

Private Member Functions

virtual void DoBuild ()
 

Add vertices

KyUInt32 AddVertexWithoutNavTag (const Vec3f &position, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
 
KyUInt32 AddVertexWithUnsharedNavTag (const Vec3f &position, DynamicNavTag *dynamicNavTag, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
 
KyUInt32 AddVertexWithNavTag (const Vec3f &position, KyUInt32 navTagIdx, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
 

Add Monodirectional edges

KyUInt32 AddMonodirectionalEdgeWithoutNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx)
 
KyUInt32 AddMonodirectionalEdgeWithUnsharedNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag *dynamicNavTag)
 
KyUInt32 AddMonodirectionalEdgeWithNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, KyUInt32 navTagIdx)
 

Add Bidirectional edges

void AddBidirectionalEdgeWithoutNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx)
 
KyResult AddBidirectionalEdgeWithUnsharedNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag *dynamicNavTag)
 
void AddBidirectionalEdgeWithNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, KyUInt32 navTagIdx)
 
void SetName (const char *graphName)
 

Deprecated ExclusiveNavTag

The term 'ExclusiveNavTag' was confusing or ambiguous, it is not exclusive as in DynamicNavTag::IsExclusive().

It means a uniquely used NavTag in the NavGraph, no other edge or vertex is expected to use this NavTag.

Please use the Add*WithUnsharedNavTag functions instead.

KyUInt32 AddVertexWithExclusiveNavTag (const Vec3f &position, DynamicNavTag *dynamicNavTag, NavGraphVertexLinkType vertexType=NavGraphVertexLinkType_LinkToNavMesh)
 
KyUInt32 AddMonodirectionalEdgeWithExclusiveNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag *dynamicNavTag)
 
void AddBidirectionalEdgeWithExclusiveNavTag (KyUInt32 startVertexIdx, KyUInt32 endVertexIdx, DynamicNavTag *dynamicNavTag)
 

For internal use only

KyUInt32 m_visualDebugId
 
String m_name
 
KyArrayPOD< const DynamicNavTag * > m_navTags
 
KyArray< NavGraphBlobBuilder_Vertex > m_vertices
 
KyArray< NavGraphBlobBuilder_Edge > m_edges
 

Member Function Documentation

void Kaim::NavGraphBlobBuilder::AddBidirectionalEdgeWithNavTag ( KyUInt32  startVertexIdx,
KyUInt32  endVertexIdx,
KyUInt32  navTagIdx 
)

Adds a bidirectional edge that connects the specified vertices.

NOTE: this function will create two mono-directional edges. One from startVertexIdx to endVertexIdx and One from endVertexIdx to startVertexIdx the edge will be associated to the NavTag that is not supposed to be associated to other vertices or edges

Parameters
startVertexIdxThe index of the starting vertex for the edge, which was returned by AddVertex().
endVertexIdxThe index of the ending vertex for the edge, which was returned by AddVertex().
navTagIdxThe associated navTag index that has already been added to Graph
+ Examples:
void Kaim::NavGraphBlobBuilder::AddBidirectionalEdgeWithoutNavTag ( KyUInt32  startVertexIdx,
KyUInt32  endVertexIdx 
)

Adds a bidirectional edge that connects the specified vertices.

NOTE: this function will create two mono-directional edges. One from startVertexIdx to endVertexIdx and One from endVertexIdx to startVertexIdx.

No navTag will be associated to this edge.

Parameters
startVertexIdxThe index of the starting vertex for the edge, which was returned by AddVertex().
endVertexIdxThe index of the ending vertex for the edge, which was returned by AddVertex().
+ Examples:
KyResult Kaim::NavGraphBlobBuilder::AddBidirectionalEdgeWithUnsharedNavTag ( KyUInt32  startVertexIdx,
KyUInt32  endVertexIdx,
DynamicNavTag *  dynamicNavTag 
)

Adds a bidirectional edge that connects the specified vertices.

NOTE: this function will create two mono-directional edges. One from startVertexIdx to endVertexIdx and one from endVertexIdx to startVertexIdx.

The edge will be associated to the NavTag that is not supposed to be associated to other vertices or edges

Parameters
startVertexIdxThe index of the starting vertex for the edge, which was returned by AddVertex().
endVertexIdxThe index of the ending vertex for the edge, which was returned by AddVertex().
dynamicNavTagA pointer to the associated dynamicNavTag that will be added to the NavGraph
Returns
KY_ERROR if NavTag is exclusive which is not valid for NavGraphs.
KyUInt32 Kaim::NavGraphBlobBuilder::AddMonodirectionalEdgeWithNavTag ( KyUInt32  startVertexIdx,
KyUInt32  endVertexIdx,
KyUInt32  navTagIdx 
)

Adds a new edge that connects the specified vertices.

Note that the edge is mono-directional, from the startVertex to the endVertex. If you want your characters to be able to plan paths that go between the two vertices in either direction, you must add a second edge from the endVertex to the startVertex, or use AddBidirectionalEdgeWithoutNavTag() instead. the edge will be associated to the NavTag that is not supposed to be associated to other vertices or edges

Parameters
startVertexIdxThe index of the starting vertex for the edge, which was returned by AddVertex().
endVertexIdxThe index of the ending vertex for the edge, which was returned by AddVertex().
navTagIdxThe associated navTag index that has already been added to Graph
Returns
the index of the newly created edge.
KyUInt32 Kaim::NavGraphBlobBuilder::AddMonodirectionalEdgeWithoutNavTag ( KyUInt32  startVertexIdx,
KyUInt32  endVertexIdx 
)

Adds a new edge that connects the specified vertices.

NOTE: the edge is mono-directional, from the startVertex to the endVertex. If you want your characters to be able to plan paths that go between the two vertices in either direction, you must add a second edge from the endVertex to the startVertex, or use AddBidirectionalEdgeWithoutNavTag() instead.

No navTag will be associated to this edge.

Parameters
startVertexIdxThe index of the starting vertex for the edge, which was returned by AddVertex().
endVertexIdxThe index of the ending vertex for the edge, which was returned by AddVertex().
Returns
the index of the newly created edge.
KyUInt32 Kaim::NavGraphBlobBuilder::AddMonodirectionalEdgeWithUnsharedNavTag ( KyUInt32  startVertexIdx,
KyUInt32  endVertexIdx,
DynamicNavTag *  dynamicNavTag 
)

Adds a new edge that connects the specified vertices.

NOTE: the edge is mono-directional, from the startVertex to the endVertex. If you want your characters to be able to plan paths that go between the two vertices in either direction, you must add a second edge from the endVertex to the startVertex, or use AddBidirectionalEdgeWithoutNavTag() instead.

The edge will be associated to the NavTag that is not supposed to be associated to other vertices or edges.

Parameters
startVertexIdxThe index of the starting vertex for the edge, which was returned by AddVertex().
endVertexIdxThe index of the ending vertex for the edge, which was returned by AddVertex().
dynamicNavTagA pointer to the associated dynamicNavTag that will be added to the NavGraph
Returns
the index of the newly created edge, or KyUInt32MAXVAL if NavTag is exclusive which is not valid for NavGraphs.
KyUInt32 Kaim::NavGraphBlobBuilder::AddNavTag ( const DynamicNavTag *  dynamicNavTag)

Adds a NavTag that will be associated to edge and/or vertices.

Parameters
dynamicNavTagA pointer to the associated dynamicNavTag that will be added to the NavGraph.
Returns
the index of the NavTag that should pass as parameters to associate this NavTag to vertices and/or edges, or KyUInt32MAXVAL if NavTag is exclusive which is not valid for NavGraphs.
+ Examples:
KyUInt32 Kaim::NavGraphBlobBuilder::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.

Parameters
positionThe position of the vertex in 3D space, in the Gameware Navigation coordinate system.
navTagIdxThe associated navTag index that has already been added to Graph .
vertexTypeA tag provides the way the vertex will be connected or not at run-time.
Returns
the index of the newly created vertex.
+ Examples:
KyUInt32 Kaim::NavGraphBlobBuilder::AddVertexWithoutNavTag ( const Vec3f position,
NavGraphVertexLinkType  vertexType = NavGraphVertexLinkType_LinkToNavMesh 
)

Adds a new vertex to the Graph with no associated NavTag.

Parameters
positionThe position of the vertex in 3D space, in the Gameware Navigation coordinate system.
vertexTypeA tag provides the way the vertex will be connected or not at run-time.
Returns
the index of the newly created vertex.
+ Examples:
KyUInt32 Kaim::NavGraphBlobBuilder::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 other vertices or edges.

Parameters
positionThe position of the vertex in 3D space, in the Gameware Navigation coordinate system.
dynamicNavTagA pointer to the associated dynamicNavTag that will be added to the NavGraph.
vertexTypeA tag providing the way the vertex will be connected at run-time (if conntected).
Returns
the index of the newly created vertex, or KyUInt32MAXVAL if NavTag is exclusive which is not valid for NavGraphs.
NavGraphBlob * Kaim::BaseBlobBuilder< NavGraphBlob >::Build ( BlobHandler< NavGraphBlob > &  blobHandler)
inherited

This method:

  1. Calls DoBuild() in COUNT mode to determine the amount of memory needed for the blob to be built.

  1. Allocates the amount of memory in the specified BlobHandler.
  2. Calls DoBuild() again, in WRITE mode, to actually build the blob in the buffer allocated by the BlobHandler.
+ Examples:
void Kaim::BaseBlobBuilder< NavGraphBlob >::BuildFlatBlob ( NavGraphBlob blob)
inherited

Simple way to use DoBuild in case of flat blob (that is, a blob that does not have a BlobArray or BlobRef)

void Kaim::BaseBlobBuilder< NavGraphBlob >::DoAllocAndBuildReferencedBlob ( BlobBuffer *  blobBuffer,
BlobRef< NavGraphBlob > *  blobRef 
)
inherited

For internal use. Use BUILD_REFERENCED_BLOB instead.

virtual void Kaim::NavGraphBlobBuilder::DoBuild ( )
privatevirtual

Implement this function in any class that derives from BaseBlobBuilder.

Its responsibility is to set the data for each class member maintained by m_blob. In your implementation, use one of the macros sets supplied for this purpose:

Implements Kaim::BaseBlobBuilder< NavGraphBlob >.

void Kaim::BaseBlobBuilder< NavGraphBlob >::DoBuildAllocatedBlob ( BlobBuffer *  blobBuffer,
NavGraphBlob blob 
)
inherited

For internal use. Use BLOB_BUILD instead.

BlobBuffer* Kaim::BaseBlobBuilder< NavGraphBlob >::GetBlobBufferToBuildThis ( )
inlineinherited

For internal use. Check if m_buildingPart == BUILDING_SHALLOW_PART and return this.

bool Kaim::BaseBlobBuilder< NavGraphBlob >::IsWriteMode ( )
inlineinherited

Indicates whether the builder is operating in COUNT mode or in WRITE mode.

This can be used in implementations of DoBuild().

void Kaim::NavGraphBlobBuilder::SetName ( const char *  graphName)

// optional, only for Visual Debug

Member Data Documentation

The blob maintained by this builder. Only modify using the macros listed under DoBuild().

BlobBuffer* Kaim::BaseBlobBuilder< NavGraphBlob >::m_blobBuffer
inherited

For internal use. Use BLOB_SET and BLOB_ARRAY instead.


The documentation for this class was generated from the following file: