Planeshift
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

psPath Class Reference

#include <pspath.h>

List of all members.

Public Types

enum  Direction { FORWARD, REVERSE }
typedef csPDelArray< psPathPointPathPointArray

Public Member Functions

psPathPointAddPoint (Location *loc, bool first=false)
 Add a new point to the path.
psPathPointAddPoint (iDataConnection *db, const csVector3 &pos, const char *sectorName, bool first=false)
 Add a new point to the path and update db.
psPathPointAddPoint (const csVector3 &pos, float radius, const char *sectorName, bool first=false)
 Add a new point to the path.
bool Adjust (iDataConnection *db, int index, csVector3 &pos, csString sector)
 Adjust a point in the path.
float CalculateIncidentAngle (csVector3 &pos, csVector3 &dest)
 Utility function to calcualte angle to point between to points.
bool Create (iDataConnection *db)
 Create a path in the db.
virtual psPathAnchorCreatePathAnchor ()
 Return a path anchor to this path.
virtual float Distance (psWorld *world, iEngine *engine, const csVector3 &pos, const iSector *sector, int *index=NULL, float *fraction=NULL) const
 Calculate distance from point to path.
virtual float DistancePoint (psWorld *world, iEngine *engine, const csVector3 &pos, const iSector *sector, int *index=NULL, bool include_ends=false) const
 Calculate distance from point to path points.
psPathPointFindPoint (int id)
 Get Path Point by id.
int FindPointIndex (int id) const
 Get Path Point index by id.
int FindPointIndex (const psPathPoint *point) const
 Get Path Point index by point.
size_t FindPointsInSector (iEngine *engine, iSector *sector, csList< psPathPoint * > &list)
 Get all points in the given sector for this path.
psPathPointGetEndPoint (Direction direction)
 Get the end point.
csVector3 GetEndPos (Direction direction)
 Get the end point position.
float GetEndRot (Direction direction)
 Get the end rotation.
iSector * GetEndSector (iEngine *engine, Direction direction)
 Get the end sector.
WaypointGetEndWaypoint (Direction direction)
 Get the end waypoint.
csString GetFlags () const
 Return a string of flags.
int GetID () const
 Get ID of the path.
virtual float GetLength (psWorld *world, iEngine *engine, int index)
 Get the length of one segment of the path.
virtual float GetLength (psWorld *world, iEngine *engine)
 Get the total length of all path segments.
virtual const char * GetName () const
 Get name of the path.
virtual int GetNumPoints () const
 Get number of points in path.
const psPathPointGetPoint (int index) const
psPathPointGetPoint (int index)
psPathPointGetStartPoint (Direction direction)
 Get the start point.
WaypointGetStartWaypoint (Direction direction)
 Get the start waypoint.
psPathPointInsertPoint (iDataConnection *db, int index, const csVector3 &pos, const char *sectorName)
 Insert a new point to the path and update db.
bool Load (iDataConnection *db, iEngine *engine)
 Load the path from the db.
virtual void Precalculate (psWorld *world, iEngine *engine, bool forceUpdate=false)
 Precalculate values needed for anchors.
 psPath (int pathID, csString name, psString flagStr)
 psPath (csString name, Waypoint *wp1, Waypoint *wp2, psString flagStr)
bool RemovePoint (iDataConnection *db, int index)
 Remova a point from the path and update db.
bool RemovePoint (int index)
 Remova a point from the path.
bool RemovePoint (iDataConnection *db, psPathPoint *point)
 Remova a point from the path and update db.
bool Rename (iDataConnection *db, const char *name)
 Rename the path and update the db.
void Rename (const char *name)
 Rename the path.
void SetEnd (Waypoint *wp)
 Set the end of the path.
bool SetFlag (const csString &flagstr, bool enable)
 Set the flags from a string.
bool SetFlag (iDataConnection *db, const csString &flagstr, bool enable)
 Set the flags from a string and update the db.
void SetFlags (const psString &flagStr)
 Set the flags from a string.
void SetStart (Waypoint *wp)
 Set the start of the path.
bool UpdatePrevPointIndexes (iDataConnection *db)
 Update the indexes, after insert and removal of points.
virtual ~psPath ()

Public Attributes

Waypointend
 This path end waypoint.
int id
csString name
bool noWander
bool oneWay
 Flags.
PathPointArray points
 The points this path consists of including start wp and end wp.
bool precalculationValid
Waypointstart
 This path start waypoint.
bool teleport
 Teleport between the waypoints.
float totalDistance

Protected Member Functions

virtual void GetInterpolatedForward (int index, float fraction, csVector3 &forward)=0
 Get the interpolated forward vector.
virtual void GetInterpolatedPosition (int index, float fraction, csVector3 &pos)=0
 Get the interpolated position.
virtual void GetInterpolatedUp (int index, float fraction, csVector3 &up)=0
 Get the interpolated up vector.
virtual void PrecalculatePath (psWorld *world, iEngine *engine)=0
 Do the actual precalculate work.

Detailed Description

Definition at line 152 of file pspath.h.


Member Typedef Documentation

typedef csPDelArray<psPathPoint> psPath::PathPointArray

Definition at line 161 of file pspath.h.


Member Enumeration Documentation

Enumerator:
FORWARD 
REVERSE 

Definition at line 156 of file pspath.h.


Constructor & Destructor Documentation

psPath::psPath ( csString  name,
Waypoint wp1,
Waypoint wp2,
psString  flagStr 
)
psPath::psPath ( int  pathID,
csString  name,
psString  flagStr 
)
virtual psPath::~psPath ( ) [virtual]

Member Function Documentation

psPathPoint* psPath::AddPoint ( Location loc,
bool  first = false 
)

Add a new point to the path.

psPathPoint* psPath::AddPoint ( iDataConnection *  db,
const csVector3 &  pos,
const char *  sectorName,
bool  first = false 
)

Add a new point to the path and update db.

psPathPoint* psPath::AddPoint ( const csVector3 &  pos,
float  radius,
const char *  sectorName,
bool  first = false 
)

Add a new point to the path.

bool psPath::Adjust ( iDataConnection *  db,
int  index,
csVector3 &  pos,
csString  sector 
)

Adjust a point in the path.

float psPath::CalculateIncidentAngle ( csVector3 &  pos,
csVector3 &  dest 
)

Utility function to calcualte angle to point between to points.

bool psPath::Create ( iDataConnection *  db)

Create a path in the db.

virtual psPathAnchor* psPath::CreatePathAnchor ( ) [virtual]

Return a path anchor to this path.

virtual float psPath::Distance ( psWorld world,
iEngine *  engine,
const csVector3 &  pos,
const iSector *  sector,
int index = NULL,
float fraction = NULL 
) const [virtual]

Calculate distance from point to path.

virtual float psPath::DistancePoint ( psWorld world,
iEngine *  engine,
const csVector3 &  pos,
const iSector *  sector,
int index = NULL,
bool  include_ends = false 
) const [virtual]

Calculate distance from point to path points.

psPathPoint* psPath::FindPoint ( int  id)

Get Path Point by id.

int psPath::FindPointIndex ( int  id) const

Get Path Point index by id.

int psPath::FindPointIndex ( const psPathPoint point) const

Get Path Point index by point.

size_t psPath::FindPointsInSector ( iEngine *  engine,
iSector *  sector,
csList< psPathPoint * > &  list 
)

Get all points in the given sector for this path.

psPathPoint* psPath::GetEndPoint ( Direction  direction)

Get the end point.

csVector3 psPath::GetEndPos ( Direction  direction)

Get the end point position.

float psPath::GetEndRot ( Direction  direction)

Get the end rotation.

iSector* psPath::GetEndSector ( iEngine *  engine,
Direction  direction 
)

Get the end sector.

Waypoint* psPath::GetEndWaypoint ( Direction  direction)

Get the end waypoint.

csString psPath::GetFlags ( ) const

Return a string of flags.

int psPath::GetID ( ) const [inline]

Get ID of the path.

Definition at line 262 of file pspath.h.

virtual void psPath::GetInterpolatedForward ( int  index,
float  fraction,
csVector3 &  forward 
) [protected, pure virtual]

Get the interpolated forward vector.

Implemented in psLinearPath.

virtual void psPath::GetInterpolatedPosition ( int  index,
float  fraction,
csVector3 &  pos 
) [protected, pure virtual]

Get the interpolated position.

Implemented in psLinearPath.

virtual void psPath::GetInterpolatedUp ( int  index,
float  fraction,
csVector3 &  up 
) [protected, pure virtual]

Get the interpolated up vector.

Implemented in psLinearPath.

virtual float psPath::GetLength ( psWorld world,
iEngine *  engine,
int  index 
) [virtual]

Get the length of one segment of the path.

virtual float psPath::GetLength ( psWorld world,
iEngine *  engine 
) [virtual]

Get the total length of all path segments.

virtual const char* psPath::GetName ( ) const [inline, virtual]

Get name of the path.

Definition at line 259 of file pspath.h.

virtual int psPath::GetNumPoints ( ) const [inline, virtual]

Get number of points in path.

Definition at line 256 of file pspath.h.

psPathPoint* psPath::GetPoint ( int  index)
const psPathPoint* psPath::GetPoint ( int  index) const
psPathPoint* psPath::GetStartPoint ( Direction  direction)

Get the start point.

Waypoint* psPath::GetStartWaypoint ( Direction  direction)

Get the start waypoint.

psPathPoint* psPath::InsertPoint ( iDataConnection *  db,
int  index,
const csVector3 &  pos,
const char *  sectorName 
)

Insert a new point to the path and update db.

bool psPath::Load ( iDataConnection *  db,
iEngine *  engine 
)

Load the path from the db.

virtual void psPath::Precalculate ( psWorld world,
iEngine *  engine,
bool  forceUpdate = false 
) [virtual]

Precalculate values needed for anchors.

virtual void psPath::PrecalculatePath ( psWorld world,
iEngine *  engine 
) [protected, pure virtual]

Do the actual precalculate work.

Implemented in psLinearPath.

bool psPath::RemovePoint ( iDataConnection *  db,
int  index 
)

Remova a point from the path and update db.

bool psPath::RemovePoint ( int  index)

Remova a point from the path.

bool psPath::RemovePoint ( iDataConnection *  db,
psPathPoint point 
)

Remova a point from the path and update db.

void psPath::Rename ( const char *  name)

Rename the path.

bool psPath::Rename ( iDataConnection *  db,
const char *  name 
)

Rename the path and update the db.

void psPath::SetEnd ( Waypoint wp)

Set the end of the path.

bool psPath::SetFlag ( const csString &  flagstr,
bool  enable 
)

Set the flags from a string.

bool psPath::SetFlag ( iDataConnection *  db,
const csString &  flagstr,
bool  enable 
)

Set the flags from a string and update the db.

void psPath::SetFlags ( const psString flagStr)

Set the flags from a string.

void psPath::SetStart ( Waypoint wp)

Set the start of the path.

bool psPath::UpdatePrevPointIndexes ( iDataConnection *  db)

Update the indexes, after insert and removal of points.


Member Data Documentation

This path end waypoint.

Definition at line 166 of file pspath.h.

Definition at line 163 of file pspath.h.

csString psPath::name

Definition at line 164 of file pspath.h.

Definition at line 171 of file pspath.h.

Flags.

Definition at line 170 of file pspath.h.

The points this path consists of including start wp and end wp.

Definition at line 167 of file pspath.h.

Definition at line 174 of file pspath.h.

This path start waypoint.

Definition at line 165 of file pspath.h.

Teleport between the waypoints.

Definition at line 172 of file pspath.h.

Definition at line 175 of file pspath.h.


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