Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
PathGenerator Class Reference

#include <PathGenerator.h>

Collaboration diagram for PathGenerator:

Public Member Functions

bool CalculatePath (float destX, float destY, float destZ, bool forceDest=false)
G3D::Vector3 const & GetActualEndPosition () const
G3D::Vector3 const & GetEndPosition () const
Movement::PointsArray const & GetPath () const
PathType GetPathType () const
G3D::Vector3 const & GetStartPosition () const
 PathGenerator (Unit const *owner)
void SetPathLengthLimit (float distance)
void SetUseStraightPath (bool useStraightPath)
 ~PathGenerator ()

Private Member Functions

void BuildPointPath (float const *startPoint, float const *endPoint)
void BuildPolyPath (G3D::Vector3 const &startPos, G3D::Vector3 const &endPos)
void BuildShortcut ()
void Clear ()
void CreateFilter ()
void DensifyGroundPath ()
float Dist3DSqr (G3D::Vector3 const &p1, G3D::Vector3 const &p2) const
dtStatus FindSmoothPath (float const *startPos, float const *endPos, dtPolyRef const *polyPath, uint32 polyPathSize, float *smoothPath, int *smoothPathSize, uint32 smoothPathMaxSize)
uint32 FixupCorridor (dtPolyRef *path, uint32 npath, uint32 maxPath, dtPolyRef const *visited, uint32 nvisited)
NavTerrain GetNavTerrain (float x, float y, float z)
dtPolyRef GetPathPolyByPosition (dtPolyRef const *polyPath, uint32 polyPathSize, float const *Point, float *Distance=NULL) const
dtPolyRef GetPolyByLocation (float const *Point, float *Distance) const
bool GetSteerTarget (float const *startPos, float const *endPos, float minTargetDist, dtPolyRef const *path, uint32 pathSize, float *steerPos, unsigned char &steerPosFlag, dtPolyRef &steerPosRef)
bool HaveTile (G3D::Vector3 const &p) const
bool InRange (G3D::Vector3 const &p1, G3D::Vector3 const &p2, float r, float h) const
bool InRangeYZX (float const *v1, float const *v2, float r, float h) const
void NormalizePath ()
void SetActualEndPosition (G3D::Vector3 const &point)
void SetEndPosition (G3D::Vector3 const &point)
void SetStartPosition (G3D::Vector3 const &point)
void UpdateFilter ()

Static Private Member Functions

static float ResolveTerrainZ (Unit const *unit, float x, float y, float z)

Private Attributes

G3D::Vector3 _actualEndPosition
G3D::Vector3 _endPosition
dtQueryFilter _filter
bool _forceDestination
dtNavMesh const * _navMesh
dtNavMeshQuery const * _navMeshQuery
Movement::PointsArray _pathPoints
dtPolyRef _pathPolyRefs [MAX_PATH_LENGTH]
uint32 _pointPathLimit
uint32 _polyLength
Unit const *const _sourceUnit
G3D::Vector3 _startPosition
PathType _type
bool _useStraightPath

Detailed Description

Definition at line 39 of file PathGenerator.h.

Constructor & Destructor Documentation

◆ PathGenerator()

◆ ~PathGenerator()

PathGenerator::~PathGenerator ( )

Definition at line 37 of file PathGenerator.cpp.

References _sourceUnit, and SF_LOG_DEBUG.

Member Function Documentation

◆ BuildPointPath()

◆ BuildPolyPath()

void PathGenerator::BuildPolyPath ( G3D::Vector3 const & startPos,
G3D::Vector3 const & endPos )
private

◆ BuildShortcut()

void PathGenerator::BuildShortcut ( )
private

◆ CalculatePath()

◆ Clear()

void PathGenerator::Clear ( )
inlineprivate

Definition at line 90 of file PathGenerator.h.

References _pathPoints, and _polyLength.

Referenced by BuildPolyPath(), and BuildShortcut().

◆ CreateFilter()

void PathGenerator::CreateFilter ( )
private

◆ DensifyGroundPath()

void PathGenerator::DensifyGroundPath ( )
private

◆ Dist3DSqr()

float PathGenerator::Dist3DSqr ( G3D::Vector3 const & p1,
G3D::Vector3 const & p2 ) const
private

Definition at line 863 of file PathGenerator.cpp.

Referenced by BuildPointPath().

◆ FindSmoothPath()

dtStatus PathGenerator::FindSmoothPath ( float const * startPos,
float const * endPos,
dtPolyRef const * polyPath,
uint32 polyPathSize,
float * smoothPath,
int * smoothPathSize,
uint32 smoothPathMaxSize )
private

◆ FixupCorridor()

uint32 PathGenerator::FixupCorridor ( dtPolyRef * path,
uint32 npath,
uint32 maxPath,
dtPolyRef const * visited,
uint32 nvisited )
private

Definition at line 645 of file PathGenerator.cpp.

Referenced by FindSmoothPath().

◆ GetActualEndPosition()

G3D::Vector3 const & PathGenerator::GetActualEndPosition ( ) const
inline

◆ GetEndPosition()

G3D::Vector3 const & PathGenerator::GetEndPosition ( ) const
inline

Definition at line 55 of file PathGenerator.h.

References _endPosition.

Referenced by BuildPointPath(), and mmaps_commandscript::HandleMmapPathCommand().

◆ GetNavTerrain()

NavTerrain PathGenerator::GetNavTerrain ( float x,
float y,
float z )
private

◆ GetPath()

◆ GetPathPolyByPosition()

dtPolyRef PathGenerator::GetPathPolyByPosition ( dtPolyRef const * polyPath,
uint32 polyPathSize,
float const * Point,
float * Distance = NULL ) const
private

Definition at line 76 of file PathGenerator.cpp.

References _navMeshQuery, INVALID_POLYREF, and VERTEX_SIZE.

Referenced by GetPolyByLocation().

◆ GetPathType()

PathType PathGenerator::GetPathType ( ) const
inline

◆ GetPolyByLocation()

dtPolyRef PathGenerator::GetPolyByLocation ( float const * Point,
float * Distance ) const
private

◆ GetStartPosition()

G3D::Vector3 const & PathGenerator::GetStartPosition ( ) const
inline

◆ GetSteerTarget()

bool PathGenerator::GetSteerTarget ( float const * startPos,
float const * endPos,
float minTargetDist,
dtPolyRef const * path,
uint32 pathSize,
float * steerPos,
unsigned char & steerPosFlag,
dtPolyRef & steerPosRef )
private

Definition at line 690 of file PathGenerator.cpp.

References _navMeshQuery, InRangeYZX(), and VERTEX_SIZE.

Referenced by FindSmoothPath().

◆ HaveTile()

bool PathGenerator::HaveTile ( G3D::Vector3 const & p) const
private

Workaround For some reason, often the tx and ty variables wont get a valid value Use this check to prevent getting negative tile coords and crashing on getTileAt

Definition at line 629 of file PathGenerator.cpp.

References _navMesh, and VERTEX_SIZE.

Referenced by CalculatePath().

◆ InRange()

bool PathGenerator::InRange ( G3D::Vector3 const & p1,
G3D::Vector3 const & p2,
float r,
float h ) const
private

Definition at line 857 of file PathGenerator.cpp.

Referenced by BuildPointPath().

◆ InRangeYZX()

bool PathGenerator::InRangeYZX ( float const * v1,
float const * v2,
float r,
float h ) const
private

Definition at line 849 of file PathGenerator.cpp.

Referenced by FindSmoothPath(), and GetSteerTarget().

◆ NormalizePath()

void PathGenerator::NormalizePath ( )
private

Definition at line 540 of file PathGenerator.cpp.

References _pathPoints, _sourceUnit, and DensifyGroundPath().

Referenced by BuildPointPath(), and BuildShortcut().

◆ ResolveTerrainZ()

float PathGenerator::ResolveTerrainZ ( Unit const * unit,
float x,
float y,
float z )
staticprivate

◆ SetActualEndPosition()

void PathGenerator::SetActualEndPosition ( G3D::Vector3 const & point)
inlineprivate

Definition at line 85 of file PathGenerator.h.

References _actualEndPosition.

Referenced by BuildPointPath(), and BuildPolyPath().

◆ SetEndPosition()

void PathGenerator::SetEndPosition ( G3D::Vector3 const & point)
inlineprivate

Definition at line 84 of file PathGenerator.h.

References _actualEndPosition, and _endPosition.

Referenced by CalculatePath().

◆ SetPathLengthLimit()

void PathGenerator::SetPathLengthLimit ( float distance)
inline

◆ SetStartPosition()

void PathGenerator::SetStartPosition ( G3D::Vector3 const & point)
inlineprivate

Definition at line 83 of file PathGenerator.h.

References _startPosition.

Referenced by CalculatePath().

◆ SetUseStraightPath()

void PathGenerator::SetUseStraightPath ( bool useStraightPath)
inline

Definition at line 50 of file PathGenerator.h.

References _useStraightPath.

Referenced by mmaps_commandscript::HandleMmapPathCommand().

◆ UpdateFilter()

void PathGenerator::UpdateFilter ( )
private

Definition at line 593 of file PathGenerator.cpp.

References _filter, _sourceUnit, and GetNavTerrain().

Referenced by CalculatePath(), and CreateFilter().

Member Data Documentation

◆ _actualEndPosition

G3D::Vector3 PathGenerator::_actualEndPosition
private

Definition at line 75 of file PathGenerator.h.

Referenced by GetActualEndPosition(), SetActualEndPosition(), and SetEndPosition().

◆ _endPosition

G3D::Vector3 PathGenerator::_endPosition
private

Definition at line 74 of file PathGenerator.h.

Referenced by GetEndPosition(), PathGenerator(), and SetEndPosition().

◆ _filter

dtQueryFilter PathGenerator::_filter
private

◆ _forceDestination

bool PathGenerator::_forceDestination
private

Definition at line 70 of file PathGenerator.h.

Referenced by BuildPointPath(), CalculatePath(), and PathGenerator().

◆ _navMesh

dtNavMesh const* PathGenerator::_navMesh
private

Definition at line 78 of file PathGenerator.h.

Referenced by CalculatePath(), FindSmoothPath(), HaveTile(), and PathGenerator().

◆ _navMeshQuery

dtNavMeshQuery const* PathGenerator::_navMeshQuery
private

◆ _pathPoints

Movement::PointsArray PathGenerator::_pathPoints
private

◆ _pathPolyRefs

dtPolyRef PathGenerator::_pathPolyRefs[MAX_PATH_LENGTH]
private

Definition at line 63 of file PathGenerator.h.

Referenced by BuildPointPath(), BuildPolyPath(), GetPolyByLocation(), and PathGenerator().

◆ _pointPathLimit

uint32 PathGenerator::_pointPathLimit
private

Definition at line 71 of file PathGenerator.h.

Referenced by BuildPointPath(), PathGenerator(), and SetPathLengthLimit().

◆ _polyLength

uint32 PathGenerator::_polyLength
private

◆ _sourceUnit

Unit const* const PathGenerator::_sourceUnit
private

◆ _startPosition

G3D::Vector3 PathGenerator::_startPosition
private

Definition at line 73 of file PathGenerator.h.

Referenced by GetStartPosition(), and SetStartPosition().

◆ _type

PathType PathGenerator::_type
private

◆ _useStraightPath

bool PathGenerator::_useStraightPath
private

Definition at line 69 of file PathGenerator.h.

Referenced by BuildPointPath(), PathGenerator(), and SetUseStraightPath().


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