Planeshift
psWorld Class Reference

psWorld is in charge of managing all regions (zone map files) and loading/unloading them as needed. More...

#include <psworld.h>

Classes

class  sectorTransformation
 

Public Member Functions

void BuildWarpCache ()
 
bool Connected (const iSector *from, const iSector *to)
 Checks whether 2 sectors are connected via a warp portal. More...
 
float Distance (const csVector3 &from_pos, const iSector *from_sector, csVector3 to_pos, const iSector *to_sector)
 Calculate the distance between two to points either in same or different sectors. Return INFINITY_DISTANCE if no connection sectors where found. More...
 
float Distance (iMeshWrapper *ent1, iMeshWrapper *ent2)
 Calculate the distance between two meshes either in same or different sectors. More...
 
float Distance2 (const csVector3 &from_pos, const iSector *from_sector, csVector3 to_pos, const iSector *to_sector)
 Calculate the 2d distance between two to points either in same or different sectors. Return INFINITY_DISTANCE if no connection sectors where found. More...
 
void DumpWarpCache ()
 
void GetAllRegionNames (csString &str)
 This makes a string out of all region names, separated by | chars. More...
 
iEngine * GetEngine ()
 obtain the engine. More...
 
void GetPosition (iMeshWrapper *entity, csVector3 &pos, float *yrot, iSector *&sector)
 Return an enties position. More...
 
bool Initialize (iObjectRegistry *object_reg)
 Initialize psWorld. More...
 
bool NewRegion (const char *mapfile)
 Create a new psRegion entry and load it if specified. More...
 
 psWorld ()
 
bool WarpSpace (const iSector *from, const iSector *to, csVector3 &pos)
 Changes pos according to the warp portal between adjacent sectors from and to. More...
 
bool WarpSpaceRelative (const iSector *from, const iSector *to, csVector3 &pos)
 Changes pos according to the warp portal between adjacent sectors from and to using a relative transformation. More...
 
 ~psWorld ()
 

Static Public Member Functions

static csVector3 Matrix2Rot (const csMatrix3 &mat)
 obtain the rotation about the axes - expensive. More...
 
static float Matrix2YRot (const csMatrix3 &mat)
 obtain final rotation about y axis of an object. More...
 

Protected Attributes

csWeakRef< iEngine > engine
 
csRef< iBgLoader > loader
 
iObjectRegistry * object_reg
 
csRef< iStringArray > regions
 
csArray< sectorTransformationtransarray
 

Detailed Description

psWorld is in charge of managing all regions (zone map files) and loading/unloading them as needed.

The main user of this class is EntityManager.

Definition at line 47 of file psworld.h.

Constructor & Destructor Documentation

psWorld::psWorld ( )
psWorld::~psWorld ( )

Member Function Documentation

void psWorld::BuildWarpCache ( )
bool psWorld::Connected ( const iSector *  from,
const iSector *  to 
)

Checks whether 2 sectors are connected via a warp portal.

float psWorld::Distance ( const csVector3 &  from_pos,
const iSector *  from_sector,
csVector3  to_pos,
const iSector *  to_sector 
)

Calculate the distance between two to points either in same or different sectors. Return INFINITY_DISTANCE if no connection sectors where found.

float psWorld::Distance ( iMeshWrapper *  ent1,
iMeshWrapper *  ent2 
)

Calculate the distance between two meshes either in same or different sectors.

float psWorld::Distance2 ( const csVector3 &  from_pos,
const iSector *  from_sector,
csVector3  to_pos,
const iSector *  to_sector 
)

Calculate the 2d distance between two to points either in same or different sectors. Return INFINITY_DISTANCE if no connection sectors where found.

void psWorld::DumpWarpCache ( )
void psWorld::GetAllRegionNames ( csString &  str)

This makes a string out of all region names, separated by | chars.

iEngine* psWorld::GetEngine ( )
inline

obtain the engine.

Returns
returns the engine.

Definition at line 157 of file psworld.h.

void psWorld::GetPosition ( iMeshWrapper *  entity,
csVector3 &  pos,
float yrot,
iSector *&  sector 
)

Return an enties position.

bool psWorld::Initialize ( iObjectRegistry *  object_reg)

Initialize psWorld.

static csVector3 psWorld::Matrix2Rot ( const csMatrix3 &  mat)
static

obtain the rotation about the axes - expensive.

Returns
returns (pitch, roll, yaw) vector
Remarks
note that the y component is not necessarily equal to the value Matrix2YRot would yield.
Note
all result values are in [0;2*PI) range
static float psWorld::Matrix2YRot ( const csMatrix3 &  mat)
static

obtain final rotation about y axis of an object.

Returns
angle about y axis in the range [0;2*PI)
Note
the returned angle is the final one - it may be a result of several rotations.
See also
Matrix2Rot
bool psWorld::NewRegion ( const char *  mapfile)

Create a new psRegion entry and load it if specified.

bool psWorld::WarpSpace ( const iSector *  from,
const iSector *  to,
csVector3 &  pos 
)

Changes pos according to the warp portal between adjacent sectors from and to.

bool psWorld::WarpSpaceRelative ( const iSector *  from,
const iSector *  to,
csVector3 &  pos 
)

Changes pos according to the warp portal between adjacent sectors from and to using a relative transformation.

Member Data Documentation

csWeakRef<iEngine> psWorld::engine
protected

Definition at line 52 of file psworld.h.

csRef<iBgLoader> psWorld::loader
protected

Definition at line 53 of file psworld.h.

iObjectRegistry* psWorld::object_reg
protected

Definition at line 51 of file psworld.h.

csRef<iStringArray> psWorld::regions
protected

Definition at line 50 of file psworld.h.

csArray<sectorTransformation> psWorld::transarray
protected

Definition at line 98 of file psworld.h.


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