se_core::Pos Class Reference

Position, movement and volume info. More...

#include <Pos.hpp>

List of all members.

Public Types

enum  Direction {
  EAST = 0, SOUTH_EAST = 32, SOUTH = 64, SOUTH_WEST = 96,
  WEST = 128, NORTH_WEST = 160, NORTH = 192, NORTH_EAST = 224
}
 A mapping of some common directions to Braybrookians in the xz-plane. More...
enum  { MAX_ANIMS = 4 }
 Animation state. More...

Public Member Functions

 Pos ()
 Constructor.
void setPos (const Pos &original)
 Copy all values of original into this.
void setXZ (const Pos &original)
 Copy x and z coordinates from a source.
void setLocalCoor (Point3 &original)
 Set local coordinate.
const Point3worldCoor () const
 Return world coordinate.
Point3worldCoor ()
 Return world coordinate.
const ViewPointworldViewPoint () const
ViewPointworldViewPoint ()
const Euler3worldFace () const
Euler3worldFace ()
const Point3localCoor () const
Point3localCoor ()
const ViewPointlocalViewPoint () const
ViewPointlocalViewPoint ()
const Euler3localFace () const
Euler3localFace ()
bool localEquals (const ViewPoint &vp) const
bool localEquals (const Pos &p) const
bool worldEquals (const ViewPoint &vp) const
bool worldEquals (const Pos &p) const
void setArea (PosComponent &area, bool doKeepWorldCoor=false)
 Set new area.
void setArea (PosComponent &area, const ViewPoint &vp, bool isLocalViewPoint=true)
 Set area and viewpoint.
void resetArea ()
 Leave any area.
void setParent (PosComponent &p, bool doKeepWorldCoor=false)
 Set parent.
void resetParent (bool doKeepWorldCoor=true)
 Set parent to none.
bool hasParent () const
 Does the Pos have a parent?
bool didParentMove () const
 Did the parent move last tick? If the parent moved, the world coordinate of this position has changed.
PosComponentparent ()
 Get parent.
const PosComponentparent () const
 Get parent.
void updateWorldViewPoint ()
 Update the world_ viewpoint according to the parents nextPos().
void areaCoor (const PosComponent &area, Point3 &dest) const
void areaFace (const PosComponent &area, Euler3 &dest) const
void areaViewPoint (const PosComponent &area, ViewPoint &dest) const
void updateLocalViewPoint ()
 Update the local_ viewpoint according to the world_ viewpoint and the parents nextPos().
PosComponentarea ()
 The area the Pos is presently in.
const PosComponentarea () const
 The area the Pos is presently in.
bool hasArea () const
 Does the Pos have an area?
bool hasArea (Composite &area) const
bool hasArea (Component &area) const
bool hasArea (PosComponent &area) const
short terrainStyle () const
 The terrain style at the present position.
long touchedTerrain () const
 The terrain styles at the present position and nearby.
bool isKeyFramePath (const Pos &other) const
 Used to check if the positions are in the same or in neighbouring areas.
short clockwiseFaceDirection (short subdivisions) const
 Gets the face direction of the position.
bool hasInFront (const Point3 &coor) const
 Check if coor is in front of the pos.
bray_t xzFaceAwayAngle (const Point3 &towards) const
 Calculate the eyeing angle.
coor_t radius () const
 Get the radius of the position.
void setRadius (coor_t radius)
 Set the radius of the position.
void setBounds (coor_t radius)
void setBounds (coor_t radius, coor_t height)
void setBounds (const BoundingBox &b)
bool hasInside (const Point3 &p) const
bool isInsideCollisionRange (const Pos &p) const
 Check if two positions are inside collition range.
bool isInsideCollisionRangeLinf (const Pos &p) const
 Check if two positions are within collision range.
bool isGrounded () const
 Indicates that the pos is not somehow floating in air (climbin, falling, etc.).
void setGrounded (bool state)
 Set wether the character is grounded.
void setIndex (short i)
 Set index of the position.
short index () const
 Get the index of the Pos.
bool hasIndex () const
 Does the Pos have an index?
void setNoIndex ()
 Set index to none (-1).
PosComponentupdateArea ()
void updateIndex ()
Animanim (int index)
 Animation state.
const Animanim (int index) const
 Animation state.
void swapAnims (int a, int b)
 Swap 2 animations.
void updateY ()
 Update y coordinate to reflect Area height and present Pos layer.
void reset ()

Public Attributes

PosComponentarea_
 The area this position is inside.
PosComponentparent_
 The parent of this position.
ViewPoint local_
 The position in local coordinates.
ViewPoint world_
 The position in world coordinates.
Anim anim_ [MAX_ANIMS]
BoundingBox bounds_
 Axis aligned bounding box.
short index_
 Area's id of the layer that this position is resting on.
bool isGrounded_

Static Public Attributes

const short TS_VOID = 0
const long TSM_VOID = (1 << TS_VOID)


Detailed Description

Position, movement and volume info.

The Pos class maintains coordinates, volume and movement info for Thing and subclasses.

Definition at line 41 of file Pos.hpp.


Member Enumeration Documentation

anonymous enum
 

Animation state.

Enumeration values:
MAX_ANIMS 

Definition at line 446 of file Pos.hpp.

enum se_core::Pos::Direction
 

A mapping of some common directions to Braybrookians in the xz-plane.

Enumeration values:
EAST 
SOUTH_EAST 
SOUTH 
SOUTH_WEST 
WEST 
NORTH_WEST 
NORTH 
NORTH_EAST 

Definition at line 49 of file Pos.hpp.


Constructor & Destructor Documentation

se_core::Pos::Pos  ) 
 

Constructor.

Definition at line 37 of file Pos.cpp.


Member Function Documentation

const Anim& se_core::Pos::anim int  index  )  const [inline]
 

Animation state.

const version.

Definition at line 397 of file Pos.hpp.

Anim& se_core::Pos::anim int  index  )  [inline]
 

Animation state.

Definition at line 388 of file Pos.hpp.

Referenced by se_core::DefaultTC::_pop(), se_core::CoDefault::_pop(), se_core::PhDefault::blendAnims(), and se_basic::SimpleAreaThingEncoder::encode().

const PosComponent* se_core::Pos::area  )  const [inline]
 

The area the Pos is presently in.

const version.

Definition at line 219 of file Pos.hpp.

PosComponent* se_core::Pos::area  )  [inline]
 

The area the Pos is presently in.

Definition at line 213 of file Pos.hpp.

Referenced by se_basic::PhTrackingCamera::calcNext(), se_basic::PhCirclingCamera::calcNext(), se_core::PhDefault::clampToGround(), se_basic::NavMeshArea::isLineOfSight(), se_basic::NavMeshArea::path(), se_core::PhDefault::revertXZ(), and se_core::SpawnComponent::spawn().

void se_core::Pos::areaCoor const PosComponent area,
Point3 dest
const
 

Definition at line 297 of file Pos.cpp.

References Assert, se_core::ViewPoint::coor_, se_core::Euler3::isIdentity(), se_core::PosComponent::nextPos(), se_core::Tuple3::set(), se_core::Tuple3::sub(), world_, and worldFace().

void se_core::Pos::areaFace const PosComponent area,
Euler3 dest
const
 

Definition at line 305 of file Pos.cpp.

References Assert, se_core::ViewPoint::face_, se_core::Euler3::isIdentity(), se_core::PosComponent::nextPos(), se_core::Euler3::set(), se_core::Euler3::sub(), world_, and worldFace().

void se_core::Pos::areaViewPoint const PosComponent area,
ViewPoint dest
const
 

Definition at line 313 of file Pos.cpp.

References se_core::PosComponent::nextPos(), se_core::ViewPoint::setViewPoint(), se_core::ViewPoint::sub(), and world_.

short se_core::Pos::clockwiseFaceDirection short  subdivisions  )  const
 

Gets the face direction of the position.

0 is north. 1 is the next subdivision in a clockwise direction. This means east with 4 subdivisions and north_east with 8.

bool se_core::Pos::didParentMove  )  const
 

Did the parent move last tick? If the parent moved, the world coordinate of this position has changed.

The engine uses this method to check wether it needs to update the world viewpoint.

Definition at line 188 of file Pos.cpp.

References se_core::PosComponent::didMove().

bool se_core::Pos::hasArea PosComponent area  )  const [inline]
 

Definition at line 229 of file Pos.hpp.

bool se_core::Pos::hasArea Component area  )  const
 

Definition at line 242 of file Pos.cpp.

References se_core::Component::owner().

bool se_core::Pos::hasArea Composite area  )  const
 

Definition at line 236 of file Pos.cpp.

References se_core::Component::owner().

bool se_core::Pos::hasArea  )  const [inline]
 

Does the Pos have an area?

Definition at line 225 of file Pos.hpp.

Referenced by se_basic::PhCirclingCamera::calcNext(), isKeyFramePath(), se_basic::NavMeshArea::path(), and se_basic::EnterTo::perform().

bool se_core::Pos::hasIndex  )  const [inline]
 

Does the Pos have an index?

Definition at line 375 of file Pos.hpp.

Referenced by se_core::PhDefault::isBlocked().

bool se_core::Pos::hasInFront const Point3 coor  )  const
 

Check if coor is in front of the pos.

Return true if the coor is in front of the pos, and thus visible to the pos if the the landscape otherwise allows it.

Parameters:
coor The Coor to check for.
Returns:
True if coor is in front, false otherwise.

Definition at line 343 of file Pos.cpp.

References LogFatal.

bool se_core::Pos::hasInside const Point3 p  )  const [inline]
 

Definition at line 315 of file Pos.hpp.

References se_core::BoundingBox::hasInside().

bool se_core::Pos::hasParent  )  const [inline]
 

Does the Pos have a parent?

Definition at line 174 of file Pos.hpp.

Referenced by se_basic::PhCirclingCamera::calcNext().

short se_core::Pos::index  )  const [inline]
 

Get the index of the Pos.

The meaning of this value is at the discretion of the Area the Pos is inside. -1 does mean that the index is not in in use.

Definition at line 370 of file Pos.hpp.

Referenced by se_core::PhDefault::clampToGround(), se_basic::NavMeshArea::farthestLineOfSight(), se_basic::NavMesh::isInLineOfSight(), se_basic::NavMeshArea::isLineOfSight(), se_basic::NavMeshArea::path(), se_basic::NavMeshArea::slideAngle(), and se_basic::NavMeshArea::wallAngle().

bool se_core::Pos::isGrounded  )  const [inline]
 

Indicates that the pos is not somehow floating in air (climbin, falling, etc.).

Definition at line 344 of file Pos.hpp.

Referenced by se_core::PhDefault::clampToGround(), and se_basic::SimpleAreaThingEncoder::encode().

bool se_core::Pos::isInsideCollisionRange const Pos p  )  const
 

Check if two positions are inside collition range.

See if the sum of the radies are larger than the distance between the two positions.

Parameters:
p The position to check against.
Returns:
true if inside collision range, false if not

Definition at line 329 of file Pos.cpp.

References coor_double_t, radius(), and worldCoor().

bool se_core::Pos::isInsideCollisionRangeLinf const Pos p  )  const
 

Check if two positions are within collision range.

Check if the two positions are within collision range of each other, but use a collision square instead of a circle.

Parameters:
p The position to check against.

Definition at line 336 of file Pos.cpp.

References coor_t, radius(), and worldCoor().

bool se_core::Pos::isKeyFramePath const Pos other  )  const
 

Used to check if the positions are in the same or in neighbouring areas.

If not, keframe interpolation would be meaningless.

Definition at line 66 of file Pos.cpp.

References area_, and hasArea().

Referenced by se_core::PhDefault::calcNext(), and se_basic::PhTrackingCamera::calcNext().

Point3& se_core::Pos::localCoor  )  [inline]
 

Definition at line 105 of file Pos.hpp.

const Point3& se_core::Pos::localCoor  )  const [inline]
 

Definition at line 104 of file Pos.hpp.

Referenced by se_core::PhDefault::applyForces(), se_core::PhDefault::clampToGround(), se_basic::NavMesh::isInLineOfSight(), se_basic::NavMeshArea::path(), se_core::PhDefault::revertXZ(), and setXZ().

bool se_core::Pos::localEquals const Pos p  )  const [inline]
 

Definition at line 122 of file Pos.hpp.

References local_.

bool se_core::Pos::localEquals const ViewPoint vp  )  const [inline]
 

Definition at line 118 of file Pos.hpp.

Euler3& se_core::Pos::localFace  )  [inline]
 

Definition at line 114 of file Pos.hpp.

const Euler3& se_core::Pos::localFace  )  const [inline]
 

Definition at line 113 of file Pos.hpp.

Referenced by se_core::PhDefault::applyForces(), and se_client::PlayerParser::parse().

ViewPoint& se_core::Pos::localViewPoint  )  [inline]
 

Definition at line 107 of file Pos.hpp.

const ViewPoint& se_core::Pos::localViewPoint  )  const [inline]
 

Definition at line 106 of file Pos.hpp.

const PosComponent* se_core::Pos::parent  )  const [inline]
 

Get parent.

const version.

Definition at line 192 of file Pos.hpp.

PosComponent* se_core::Pos::parent  )  [inline]
 

Get parent.

Definition at line 187 of file Pos.hpp.

Referenced by se_basic::PhCirclingCamera::calcNext().

coor_t se_core::Pos::radius  )  const [inline]
 

Get the radius of the position.

Definition at line 288 of file Pos.hpp.

References coor_t.

Referenced by se_ogre::O3dAreaComponent::compileStaticGeometry(), isInsideCollisionRange(), and isInsideCollisionRangeLinf().

void se_core::Pos::reset  )  [inline]
 

Definition at line 420 of file Pos.hpp.

References se_core::BoundingBox::reset().

void se_core::Pos::resetArea  ) 
 

Leave any area.

Definition at line 278 of file Pos.cpp.

void se_core::Pos::resetParent bool  doKeepWorldCoor = true  ) 
 

Set parent to none.

Parameters:
doKeepWorldCoor wether the local viewpoint should be updated to maintain the world viewpoint

Definition at line 175 of file Pos.cpp.

void se_core::Pos::setArea PosComponent area,
const ViewPoint vp,
bool  isLocalViewPoint = true
 

Set area and viewpoint.

Parameters:
area new area
vp new viewpoint
isLocalViewPoint wether vp is a viewpoint in local space or world space

Definition at line 217 of file Pos.cpp.

void se_core::Pos::setArea PosComponent area,
bool  doKeepWorldCoor = false
 

Set new area.

Parameters:
area new area of position.
doKeepWorldCoor wether the local viewpoint should be updated to maintain the world coordinate

Definition at line 204 of file Pos.cpp.

Referenced by se_basic::PhTrackingCamera::calcNext(), se_basic::PhCirclingCamera::calcNext(), se_basic::LeaveToAndStopScript::perform(), se_basic::EnterTo::perform(), and se_core::PhDefault::revertXZ().

void se_core::Pos::setBounds const BoundingBox b  )  [inline]
 

Definition at line 311 of file Pos.hpp.

void se_core::Pos::setBounds coor_t  radius,
coor_t  height
[inline]
 

Definition at line 306 of file Pos.hpp.

void se_core::Pos::setBounds coor_t  radius  )  [inline]
 

Definition at line 301 of file Pos.hpp.

Referenced by se_basic::SimpleActorFactory::create().

void se_core::Pos::setGrounded bool  state  )  [inline]
 

Set wether the character is grounded.

It is up to the physics object what they want to do with this state - typically they set the things y identically to the ground height.

Definition at line 351 of file Pos.hpp.

Referenced by se_core::PhDefault::clampToGround().

void se_core::Pos::setIndex short  i  )  [inline]
 

Set index of the position.

The meaning of this value is at the discretion of the Area the Pos is inside.

Definition at line 362 of file Pos.hpp.

void se_core::Pos::setLocalCoor Point3 original  )  [inline]
 

Set local coordinate.

Parameters:
original the new coordinate.

Definition at line 77 of file Pos.hpp.

void se_core::Pos::setNoIndex  )  [inline]
 

Set index to none (-1).

Definition at line 380 of file Pos.hpp.

void se_core::Pos::setParent PosComponent p,
bool  doKeepWorldCoor = false
 

Set parent.

Parameters:
p the new parent.
doKeepWorldCoor wether the local viewpoint should be updated to maintain the world viewpoint

Definition at line 194 of file Pos.cpp.

References se_core::PosComponent::nextPos(), and world_.

void se_core::Pos::setPos const Pos original  ) 
 

Copy all values of original into this.

Definition at line 143 of file Pos.cpp.

References anim_, area_, bounds_, index_, isGrounded_, local_, parent_, and world_.

void se_core::Pos::setRadius coor_t  radius  )  [inline]
 

Set the radius of the position.

Parameters:
r The new radius (as coor_t, fixed point decimal ).

Definition at line 296 of file Pos.hpp.

void se_core::Pos::setXZ const Pos original  ) 
 

Copy x and z coordinates from a source.

Both local and world coordinates are copied. This is useful for resetting movement in the xz-plane.

Definition at line 164 of file Pos.cpp.

References area_, localCoor(), worldCoor(), se_core::Tuple3::x_, and se_core::Tuple3::z_.

void se_core::Pos::swapAnims int  a,
int  b
 

Swap 2 animations.

Definition at line 157 of file Pos.cpp.

short se_core::Pos::terrainStyle  )  const
 

The terrain style at the present position.

The request is passed on to the area the Pos is within. If the Pos does not have an area, TS_VOID is returned.

Definition at line 49 of file Pos.cpp.

Referenced by se_core::PhDefault::isBlocked().

long se_core::Pos::touchedTerrain  )  const
 

The terrain styles at the present position and nearby.

The request is passed on to the area the Pos is within. If the Pos does not have an area, TSM_VOID is returned.

Definition at line 57 of file Pos.cpp.

PosComponent * se_core::Pos::updateArea  ) 
 

Definition at line 248 of file Pos.cpp.

Referenced by se_core::PhDefault::calcNext().

void se_core::Pos::updateIndex  ) 
 

Definition at line 270 of file Pos.cpp.

void se_core::Pos::updateLocalViewPoint  ) 
 

Update the local_ viewpoint according to the world_ viewpoint and the parents nextPos().

Definition at line 319 of file Pos.cpp.

References se_core::ViewPoint::setViewPoint(), and se_core::ViewPoint::sub().

Referenced by se_basic::PhCirclingCamera::calcNext(), and se_core::PhDefault::clampToGround().

void se_core::Pos::updateWorldViewPoint  ) 
 

Update the world_ viewpoint according to the parents nextPos().

The parents nextPos().world_ must already be updated.

Definition at line 287 of file Pos.cpp.

Referenced by se_core::PhDefault::applyForces(), and se_basic::PhTrackingCamera::calcNext().

void se_core::Pos::updateY  ) 
 

Update y coordinate to reflect Area height and present Pos layer.

Does nothing if the coordinate has no layer. If the Pos has a layer, updates the y coordinate to reflect the height of the area at the present layer, x and z coordinate.

Parameters:
area The area to check height in.

Definition at line 351 of file Pos.cpp.

Point3& se_core::Pos::worldCoor  )  [inline]
 

Return world coordinate.

Returns:
a reference to the world coordinate of the position

Definition at line 91 of file Pos.hpp.

const Point3& se_core::Pos::worldCoor  )  const [inline]
 

Return world coordinate.

Returns:
a reference to the world coordinate of the position

Definition at line 85 of file Pos.hpp.

Referenced by se_basic::PhCirclingCamera::calcNext(), se_core::PhDefault::clampToGround(), se_basic::NavMeshArea::farthestLineOfSight(), se_core::ThingCollide::isGuilty(), isInsideCollisionRange(), isInsideCollisionRangeLinf(), se_basic::NavMeshArea::isLineOfSight(), se_basic::NavMeshArea::path(), se_core::PhDefault::revertXZ(), setXZ(), se_basic::NavMeshArea::slideAngle(), and se_basic::NavMeshArea::wallAngle().

bool se_core::Pos::worldEquals const Pos p  )  const [inline]
 

Definition at line 130 of file Pos.hpp.

References world_.

bool se_core::Pos::worldEquals const ViewPoint vp  )  const [inline]
 

Definition at line 126 of file Pos.hpp.

Euler3& se_core::Pos::worldFace  )  [inline]
 

Definition at line 100 of file Pos.hpp.

const Euler3& se_core::Pos::worldFace  )  const [inline]
 

Definition at line 99 of file Pos.hpp.

Referenced by areaCoor(), areaFace(), and se_basic::PhCirclingCamera::calcNext().

ViewPoint& se_core::Pos::worldViewPoint  )  [inline]
 

Definition at line 93 of file Pos.hpp.

const ViewPoint& se_core::Pos::worldViewPoint  )  const [inline]
 

Definition at line 92 of file Pos.hpp.

Referenced by se_basic::SimpleAreaThingEncoder::encode().

bray_t se_core::Pos::xzFaceAwayAngle const Point3 towards  )  const
 

Calculate the eyeing angle.

Calculetes the difference between the facing angle of this Pos and the angle towards the Point3 towards.

Parameters:
towards The Coor that the Pos tries to see.
Returns:
The absolute minimum difference in braybrookians (giving possible values of 0-128)


Member Data Documentation

Anim se_core::Pos::anim_[MAX_ANIMS]
 

Definition at line 447 of file Pos.hpp.

Referenced by setPos().

PosComponent* se_core::Pos::area_
 

The area this position is inside.

Definition at line 434 of file Pos.hpp.

Referenced by isKeyFramePath(), setPos(), and setXZ().

BoundingBox se_core::Pos::bounds_
 

Axis aligned bounding box.

Definition at line 452 of file Pos.hpp.

Referenced by se_basic::NavMeshArea::path(), setPos(), and se_core::CollisionComponent::whenDoesGeometryCollide().

short se_core::Pos::index_
 

Area's id of the layer that this position is resting on.

Definition at line 455 of file Pos.hpp.

Referenced by se_core::PhDefault::revertXZ(), and setPos().

bool se_core::Pos::isGrounded_
 

Definition at line 457 of file Pos.hpp.

Referenced by setPos().

ViewPoint se_core::Pos::local_
 

The position in local coordinates.

Definition at line 440 of file Pos.hpp.

Referenced by se_basic::PhTrackingCamera::calcNext(), localEquals(), se_basic::EnterTo::perform(), and setPos().

PosComponent* se_core::Pos::parent_
 

The parent of this position.

Definition at line 437 of file Pos.hpp.

Referenced by setPos().

const short se_core::Pos::TS_VOID = 0 [static]
 

Definition at line 43 of file Pos.hpp.

const long se_core::Pos::TSM_VOID = (1 << TS_VOID) [static]
 

Definition at line 44 of file Pos.hpp.

ViewPoint se_core::Pos::world_
 

The position in world coordinates.

Definition at line 443 of file Pos.hpp.

Referenced by se_core::CollisionAreaComponent::_testCollisionCandidates(), se_core::CollisionAreaComponent::_testCollisionCandidates2(), areaCoor(), areaFace(), areaViewPoint(), se_basic::PhCirclingCamera::calcNext(), se_ogre::O3dAreaComponent::compileStaticGeometry(), setParent(), setPos(), se_core::SpawnComponent::spawn(), se_ogre::ThingBillboard::ThingBillboard(), and worldEquals().


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

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:27 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo