Pyrogenesis  trunk
Public Member Functions | List of all members
ICmpPosition Class Referenceabstract

Represents an entity's position in the world (plus its orientation). More...

#include <ICmpPosition.h>

Inheritance diagram for ICmpPosition:
Inheritance graph
[legend]
Collaboration diagram for ICmpPosition:
Collaboration graph
[legend]

Public Member Functions

virtual void SetTurretParent (entity_id_t parent, const CFixedVector3D &offset)=0
 Set this as a turret of an other entity. More...
 
virtual entity_id_t GetTurretParent () const =0
 Get the turret parent of this entity. More...
 
virtual void UpdateTurretPosition ()=0
 Has to be called to update the simulation position of the turret. More...
 
virtual std::set< entity_id_t > * GetTurrets ()=0
 Get the list of turrets to read or edit. More...
 
virtual bool IsInWorld () const =0
 Returns true if the entity currently exists at a defined position in the world. More...
 
virtual void MoveOutOfWorld ()=0
 Causes IsInWorld to return false. More...
 
virtual void MoveTo (entity_pos_t x, entity_pos_t z)=0
 Move smoothly to the given location. More...
 
virtual void MoveAndTurnTo (entity_pos_t x, entity_pos_t z, entity_angle_t ry)=0
 Combines MoveTo and TurnTo to avoid an uncessary "AdvertisePositionChange". More...
 
virtual void JumpTo (entity_pos_t x, entity_pos_t z)=0
 Move immediately to the given location, with no interpolation. More...
 
virtual void SetHeightOffset (entity_pos_t dy)=0
 Set the vertical offset above the terrain/water surface. More...
 
virtual entity_pos_t GetHeightOffset () const =0
 Returns the current vertical offset above the terrain/water surface. More...
 
virtual void SetHeightFixed (entity_pos_t y)=0
 Set the vertical position above the map zero point. More...
 
virtual entity_pos_t GetHeightFixed () const =0
 Returns the current vertical offset above above the map zero point. More...
 
virtual entity_pos_t GetHeightAtFixed (entity_pos_t x, entity_pos_t z) const =0
 Returns the vertical offset above above the map zero point the unit would have at the given position. More...
 
virtual bool IsHeightRelative () const =0
 Returns true iff the entity will follow the terrain height (possibly with an offset) More...
 
virtual void SetHeightRelative (bool flag)=0
 When set to true, the entity will follow the terrain height (possibly with an offset) When set to false, it's height won't change automatically. More...
 
virtual bool CanFloat () const =0
 Returns whether the entity can float on water. More...
 
virtual void SetFloating (bool flag)=0
 Set the entity to float on water. More...
 
virtual void SetActorFloating (bool flag)=0
 Set the entity to float on water, in a non-network-synchronised visual-only way. More...
 
virtual void SetConstructionProgress (fixed progress)=0
 Set construction progress of the model, this affects the rendered position of the model. More...
 
virtual CFixedVector3D GetPosition () const =0
 Returns the current x,y,z position (no interpolation). More...
 
virtual CFixedVector2D GetPosition2D () const =0
 Returns the current x,z position (no interpolation). More...
 
virtual CFixedVector3D GetPreviousPosition () const =0
 Returns the previous turn's x,y,z position (no interpolation). More...
 
virtual CFixedVector2D GetPreviousPosition2D () const =0
 Returns the previous turn's x,z position (no interpolation). More...
 
virtual fixed GetTurnRate () const =0
 Returns the turn rate in radians per second. More...
 
virtual void TurnTo (entity_angle_t y)=0
 Rotate smoothly to the given angle around the upwards axis. More...
 
virtual void SetYRotation (entity_angle_t y)=0
 Rotate immediately to the given angle around the upwards axis. More...
 
virtual void SetXZRotation (entity_angle_t x, entity_angle_t z)=0
 Rotate immediately to the given angles around the X (pitch) and Z (roll) axes. More...
 
virtual CFixedVector3D GetRotation () const =0
 Returns the current rotation (relative to the upwards axis), as Euler angles with X=pitch, Y=yaw, Z=roll. More...
 
virtual fixed GetDistanceTravelled () const =0
 Returns the distance that the unit will be interpolated over, i.e. More...
 
virtual void GetInterpolatedPosition2D (float frameOffset, float &x, float &z, float &rotY) const =0
 Get the current interpolated 2D position and orientation, for rendering. More...
 
virtual CMatrix3D GetInterpolatedTransform (float frameOffset) const =0
 Get the current interpolated transform matrix, for rendering. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
virtual void Init (const CParamNode &paramNode)=0
 
virtual void Deinit ()=0
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual void Serialize (ISerializer &serialize)=0
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)=0
 
virtual bool NewJSObject (const ScriptInterface &scriptInterface, JS::MutableHandleObject out) const
 Returns false by default, indicating that a scripted wrapper of this IComponent is not supported. More...
 
virtual JS::Value GetJSInstance () const
 
virtual int GetComponentTypeId () const =0
 

Additional Inherited Members

- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static void RegisterComponentType (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static void RegisterComponentTypeScriptWrapper (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static u8 GetSerializationVersion ()
 

Detailed Description

Represents an entity's position in the world (plus its orientation).

Entity positions are determined by the following:

Orientations consist of the following:

Entities can also be 'outside the world' (e.g. hidden inside a building), in which case they have no position. Callers must check the entity is in the world, before querying its position.

Member Function Documentation

◆ CanFloat()

virtual bool ICmpPosition::CanFloat ( ) const
pure virtual

Returns whether the entity can float on water.

Implemented in CCmpPosition.

◆ GetDistanceTravelled()

virtual fixed ICmpPosition::GetDistanceTravelled ( ) const
pure virtual

Returns the distance that the unit will be interpolated over, i.e.

the distance travelled since the start of the turn.

Implemented in CCmpPosition.

◆ GetHeightAtFixed()

virtual entity_pos_t ICmpPosition::GetHeightAtFixed ( entity_pos_t  x,
entity_pos_t  z 
) const
pure virtual

Returns the vertical offset above above the map zero point the unit would have at the given position.

Implemented in CCmpPosition.

◆ GetHeightFixed()

virtual entity_pos_t ICmpPosition::GetHeightFixed ( ) const
pure virtual

Returns the current vertical offset above above the map zero point.

Implemented in CCmpPosition.

◆ GetHeightOffset()

virtual entity_pos_t ICmpPosition::GetHeightOffset ( ) const
pure virtual

Returns the current vertical offset above the terrain/water surface.

Implemented in CCmpPosition.

◆ GetInterpolatedPosition2D()

virtual void ICmpPosition::GetInterpolatedPosition2D ( float  frameOffset,
float &  x,
float &  z,
float &  rotY 
) const
pure virtual

Get the current interpolated 2D position and orientation, for rendering.

Must not be called unless IsInWorld is true.

Implemented in CCmpPosition.

◆ GetInterpolatedTransform()

virtual CMatrix3D ICmpPosition::GetInterpolatedTransform ( float  frameOffset) const
pure virtual

Get the current interpolated transform matrix, for rendering.

Must not be called unless IsInWorld is true.

Implemented in CCmpPosition.

◆ GetPosition()

virtual CFixedVector3D ICmpPosition::GetPosition ( ) const
pure virtual

Returns the current x,y,z position (no interpolation).

Depends on the current terrain heightmap. Must not be called unless IsInWorld is true.

Implemented in CCmpPosition.

◆ GetPosition2D()

virtual CFixedVector2D ICmpPosition::GetPosition2D ( ) const
pure virtual

Returns the current x,z position (no interpolation).

Must not be called unless IsInWorld is true.

Implemented in CCmpPosition.

◆ GetPreviousPosition()

virtual CFixedVector3D ICmpPosition::GetPreviousPosition ( ) const
pure virtual

Returns the previous turn's x,y,z position (no interpolation).

Depends on the current terrain heightmap. Must not be called unless IsInWorld is true.

Implemented in CCmpPosition.

◆ GetPreviousPosition2D()

virtual CFixedVector2D ICmpPosition::GetPreviousPosition2D ( ) const
pure virtual

Returns the previous turn's x,z position (no interpolation).

Must not be called unless IsInWorld is true.

Implemented in CCmpPosition.

◆ GetRotation()

virtual CFixedVector3D ICmpPosition::GetRotation ( ) const
pure virtual

Returns the current rotation (relative to the upwards axis), as Euler angles with X=pitch, Y=yaw, Z=roll.

(TODO: is that the right way round?)

Implemented in CCmpPosition.

◆ GetTurnRate()

virtual fixed ICmpPosition::GetTurnRate ( ) const
pure virtual

Returns the turn rate in radians per second.

Implemented in CCmpPosition.

◆ GetTurretParent()

virtual entity_id_t ICmpPosition::GetTurretParent ( ) const
pure virtual

Get the turret parent of this entity.

Implemented in CCmpPosition.

◆ GetTurrets()

virtual std::set<entity_id_t>* ICmpPosition::GetTurrets ( )
pure virtual

Get the list of turrets to read or edit.

Implemented in CCmpPosition.

◆ IsHeightRelative()

virtual bool ICmpPosition::IsHeightRelative ( ) const
pure virtual

Returns true iff the entity will follow the terrain height (possibly with an offset)

Implemented in CCmpPosition.

◆ IsInWorld()

virtual bool ICmpPosition::IsInWorld ( ) const
pure virtual

Returns true if the entity currently exists at a defined position in the world.

Implemented in CCmpPosition.

◆ JumpTo()

virtual void ICmpPosition::JumpTo ( entity_pos_t  x,
entity_pos_t  z 
)
pure virtual

Move immediately to the given location, with no interpolation.

Implemented in CCmpPosition.

◆ MoveAndTurnTo()

virtual void ICmpPosition::MoveAndTurnTo ( entity_pos_t  x,
entity_pos_t  z,
entity_angle_t  ry 
)
pure virtual

Combines MoveTo and TurnTo to avoid an uncessary "AdvertisePositionChange".

Implemented in CCmpPosition.

◆ MoveOutOfWorld()

virtual void ICmpPosition::MoveOutOfWorld ( )
pure virtual

Causes IsInWorld to return false.

(Use MoveTo() or JumpTo() to move back into the world.)

Implemented in CCmpPosition.

◆ MoveTo()

virtual void ICmpPosition::MoveTo ( entity_pos_t  x,
entity_pos_t  z 
)
pure virtual

Move smoothly to the given location.

Implemented in CCmpPosition.

◆ SetActorFloating()

virtual void ICmpPosition::SetActorFloating ( bool  flag)
pure virtual

Set the entity to float on water, in a non-network-synchronised visual-only way.

(This is to support the 'floating' flag in actor XMLs.)

Implemented in CCmpPosition.

◆ SetConstructionProgress()

virtual void ICmpPosition::SetConstructionProgress ( fixed  progress)
pure virtual

Set construction progress of the model, this affects the rendered position of the model.

0.0 will be fully underground, 1.0 will be fully visible, 0.5 will be half underground.

Implemented in CCmpPosition.

◆ SetFloating()

virtual void ICmpPosition::SetFloating ( bool  flag)
pure virtual

Set the entity to float on water.

Implemented in CCmpPosition.

◆ SetHeightFixed()

virtual void ICmpPosition::SetHeightFixed ( entity_pos_t  y)
pure virtual

Set the vertical position above the map zero point.

Implemented in CCmpPosition.

◆ SetHeightOffset()

virtual void ICmpPosition::SetHeightOffset ( entity_pos_t  dy)
pure virtual

Set the vertical offset above the terrain/water surface.

Implemented in CCmpPosition.

◆ SetHeightRelative()

virtual void ICmpPosition::SetHeightRelative ( bool  flag)
pure virtual

When set to true, the entity will follow the terrain height (possibly with an offset) When set to false, it's height won't change automatically.

Implemented in CCmpPosition.

◆ SetTurretParent()

virtual void ICmpPosition::SetTurretParent ( entity_id_t  parent,
const CFixedVector3D offset 
)
pure virtual

Set this as a turret of an other entity.

Implemented in CCmpPosition.

◆ SetXZRotation()

virtual void ICmpPosition::SetXZRotation ( entity_angle_t  x,
entity_angle_t  z 
)
pure virtual

Rotate immediately to the given angles around the X (pitch) and Z (roll) axes.

Parameters
xradians around the X axis. (TODO: in which direction?)
zradians around the Z axis.
Note
if either x or z is non-zero, it will override terrain conformance mode

Implemented in CCmpPosition.

◆ SetYRotation()

virtual void ICmpPosition::SetYRotation ( entity_angle_t  y)
pure virtual

Rotate immediately to the given angle around the upwards axis.

Parameters
yclockwise radians from the +Z axis.

Implemented in CCmpPosition.

◆ TurnTo()

virtual void ICmpPosition::TurnTo ( entity_angle_t  y)
pure virtual

Rotate smoothly to the given angle around the upwards axis.

Parameters
yclockwise radians from the +Z axis.

Implemented in CCmpPosition.

◆ UpdateTurretPosition()

virtual void ICmpPosition::UpdateTurretPosition ( )
pure virtual

Has to be called to update the simulation position of the turret.

Implemented in CCmpPosition.


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