Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
ICmpFootprint Class Referenceabstract

Footprints - an approximation of the entity's shape, used for collision detection and for rendering selection outlines. More...

#include <ICmpFootprint.h>

Inheritance diagram for ICmpFootprint:
Collaboration diagram for ICmpFootprint:

Public Types

enum  EShape { CIRCLE , SQUARE }
 
- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 

Public Member Functions

virtual void GetShape (EShape &shape, entity_pos_t &size0, entity_pos_t &size1, entity_pos_t &height) const =0
 Return the shape of this footprint. More...
 
JS::Value GetShape_wrapper () const
 GetShape wrapper for script calls. More...
 
virtual CFixedVector3D PickSpawnPoint (entity_id_t spawned) const =0
 Pick a sensible position to place a newly-spawned entity near this footprint, such that it won't be in an invalid (obstructed) location regardless of the spawned unit's orientation. More...
 
virtual CFixedVector3D PickSpawnPointBothPass (entity_id_t spawned) const =0
 Pick a sensible position to place a newly-spawned entity near this footprint, at the intersection between the footprint passability and the entity one. 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

- 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

Footprints - an approximation of the entity's shape, used for collision detection and for rendering selection outlines.

A footprint is either a circle (of some radius) or square (of some width and depth (actually it's a rectangle)), horizontally aligned, extruded to a given height.

Member Enumeration Documentation

◆ EShape

Enumerator
CIRCLE 
SQUARE 

Member Function Documentation

◆ GetShape()

virtual void ICmpFootprint::GetShape ( EShape shape,
entity_pos_t size0,
entity_pos_t size1,
entity_pos_t height 
) const
pure virtual

Return the shape of this footprint.

Shapes are horizontal circles or squares, extended vertically upwards to make cylinders or boxes.

Parameters
[out]shapeeither CIRCLE or SQUARE
[out]size0if CIRCLE then radius, else width (size in X axis)
[out]size1if CIRCLE then radius, else depth (size in Z axis)
[out]heightsize in Y axis

Implemented in CCmpFootprint.

◆ GetShape_wrapper()

JS::Value ICmpFootprint::GetShape_wrapper ( ) const

GetShape wrapper for script calls.

Returns { "type": "circle", "radius": 5.0, "height": 1.0 } or { "type": "square", "width": 5.0, "depth": 5.0, "height": 1.0 }

◆ PickSpawnPoint()

virtual CFixedVector3D ICmpFootprint::PickSpawnPoint ( entity_id_t  spawned) const
pure virtual

Pick a sensible position to place a newly-spawned entity near this footprint, such that it won't be in an invalid (obstructed) location regardless of the spawned unit's orientation.

Returns
the X and Z coordinates of the spawn point, with Y = 0; or the special value (-1, -1, -1) if there's no space

Implemented in CCmpFootprint.

◆ PickSpawnPointBothPass()

virtual CFixedVector3D ICmpFootprint::PickSpawnPointBothPass ( entity_id_t  spawned) const
pure virtual

Pick a sensible position to place a newly-spawned entity near this footprint, at the intersection between the footprint passability and the entity one.

Returns
the X and Z coordinates of the spawn point, with Y = 0; or the special value (-1, -1, -1) if there's no space

Implemented in CCmpFootprint.


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