6#ifndef SF_PATH_GENERATOR_H
7#define SF_PATH_GENERATOR_H
9#include "DetourNavMesh.h"
10#include "DetourNavMeshQuery.h"
19#define MAX_PATH_LENGTH 74
20#define MAX_POINT_PATH_LENGTH 74
22#define SMOOTH_PATH_STEP_SIZE 4.0f
23#define SMOOTH_PATH_SLOP 0.3f
26#define INVALID_POLYREF 0
47 bool CalculatePath(
float destX,
float destY,
float destZ,
bool forceDest =
false);
96 bool InRange(G3D::Vector3
const& p1, G3D::Vector3
const& p2,
float r,
float h)
const;
97 float Dist3DSqr(G3D::Vector3
const& p1, G3D::Vector3
const& p2)
const;
98 bool InRangeYZX(
float const* v1,
float const* v2,
float r,
float h)
const;
102 bool HaveTile(G3D::Vector3
const& p)
const;
104 void BuildPolyPath(G3D::Vector3
const& startPos, G3D::Vector3
const& endPos);
105 void BuildPointPath(
float const* startPoint,
float const* endPoint);
114 bool GetSteerTarget(
float const* startPos,
float const* endPos,
float minTargetDist, dtPolyRef
const* path,
uint32 pathSize,
float* steerPos,
115 unsigned char& steerPosFlag, dtPolyRef& steerPosRef);
116 dtStatus
FindSmoothPath(
float const* startPos,
float const* endPos,
117 dtPolyRef
const* polyPath,
uint32 polyPathSize,
118 float* smoothPath,
int* smoothPathSize,
uint32 smoothPathMaxSize);
#define SMOOTH_PATH_STEP_SIZE
#define MAX_POINT_PATH_LENGTH
@ PATHFIND_NOT_USING_PATH
PathGenerator(Unit const *owner)
Movement::PointsArray const & GetPath() const
G3D::Vector3 _startPosition
bool HaveTile(G3D::Vector3 const &p) const
void SetActualEndPosition(G3D::Vector3 const &point)
G3D::Vector3 const & GetStartPosition() const
float Dist3DSqr(G3D::Vector3 const &p1, G3D::Vector3 const &p2) const
G3D::Vector3 _actualEndPosition
PathType GetPathType() const
dtStatus FindSmoothPath(float const *startPos, float const *endPos, dtPolyRef const *polyPath, uint32 polyPathSize, float *smoothPath, int *smoothPathSize, uint32 smoothPathMaxSize)
Unit const *const _sourceUnit
dtNavMeshQuery const * _navMeshQuery
G3D::Vector3 const & GetEndPosition() const
void SetPathLengthLimit(float distance)
dtPolyRef GetPolyByLocation(float const *Point, float *Distance) const
void BuildPolyPath(G3D::Vector3 const &startPos, G3D::Vector3 const &endPos)
bool InRangeYZX(float const *v1, float const *v2, float r, float h) const
void SetStartPosition(G3D::Vector3 const &point)
uint32 FixupCorridor(dtPolyRef *path, uint32 npath, uint32 maxPath, dtPolyRef const *visited, uint32 nvisited)
dtPolyRef _pathPolyRefs[MAX_PATH_LENGTH]
Movement::PointsArray _pathPoints
bool InRange(G3D::Vector3 const &p1, G3D::Vector3 const &p2, float r, float h) const
NavTerrain GetNavTerrain(float x, float y, float z)
void BuildPointPath(float const *startPoint, float const *endPoint)
dtNavMesh const * _navMesh
dtPolyRef GetPathPolyByPosition(dtPolyRef const *polyPath, uint32 polyPathSize, float const *Point, float *Distance=NULL) const
bool CalculatePath(float destX, float destY, float destZ, bool forceDest=false)
bool GetSteerTarget(float const *startPos, float const *endPos, float minTargetDist, dtPolyRef const *path, uint32 pathSize, float *steerPos, unsigned char &steerPosFlag, dtPolyRef &steerPosRef)
void SetEndPosition(G3D::Vector3 const &point)
void SetUseStraightPath(bool useStraightPath)
G3D::Vector3 const & GetActualEndPosition() const
static float ResolveTerrainZ(Unit const *unit, float x, float y, float z)
G3D::Vector3 _endPosition
std::vector< Vector3 > PointsArray