Pyrogenesis
trunk
|
Public Member Functions | |
virtual int | GetComponentTypeId () const |
virtual void | Init (const CParamNode ¶mNode) |
virtual void | Deinit () |
template<typename S > | |
void | SerializeCommon (S &serialize) |
virtual void | Serialize (ISerializer &serialize) |
virtual void | Deserialize (const CParamNode ¶mNode, IDeserializer &deserialize) |
virtual void | HandleMessage (const CMessage &msg, bool global) |
virtual void | SetBounds (entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1) |
Set the bounds of the world. More... | |
void | ResetSubdivisions (entity_pos_t x1, entity_pos_t z1) |
virtual tag_t | AddUnitShape (entity_id_t ent, entity_pos_t x, entity_pos_t z, entity_pos_t clearance, flags_t flags, entity_id_t group) |
Register a unit shape. More... | |
virtual tag_t | AddStaticShape (entity_id_t ent, entity_pos_t x, entity_pos_t z, entity_angle_t a, entity_pos_t w, entity_pos_t h, flags_t flags, entity_id_t group, entity_id_t group2) |
Register a static shape. More... | |
virtual ObstructionSquare | GetUnitShapeObstruction (entity_pos_t x, entity_pos_t z, entity_pos_t clearance) const |
virtual ObstructionSquare | GetStaticShapeObstruction (entity_pos_t x, entity_pos_t z, entity_angle_t a, entity_pos_t w, entity_pos_t h) const |
virtual void | MoveShape (tag_t tag, entity_pos_t x, entity_pos_t z, entity_angle_t a) |
Adjust the position and angle of an existing shape. More... | |
virtual void | SetUnitMovingFlag (tag_t tag, bool moving) |
Set whether a unit shape is moving or stationary. More... | |
virtual void | SetUnitControlGroup (tag_t tag, entity_id_t group) |
Set the control group of a unit shape. More... | |
virtual void | SetStaticControlGroup (tag_t tag, entity_id_t group, entity_id_t group2) |
Sets the control group of a static shape. More... | |
virtual void | RemoveShape (tag_t tag) |
Remove an existing shape. More... | |
virtual ObstructionSquare | GetObstruction (tag_t tag) const |
Get the obstruction square representing the given shape. More... | |
virtual bool | TestLine (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, bool relaxClearanceForUnits=false) const |
Collision test a flat-ended thick line against the current set of shapes. More... | |
virtual bool | TestStaticShape (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, std::vector< entity_id_t > *out) const |
Collision test a static square shape against the current set of shapes. More... | |
virtual bool | TestUnitShape (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, std::vector< entity_id_t > *out) const |
Collision test a unit shape against the current set of registered shapes, and optionally writes a list of the colliding shapes' entities to an output list. More... | |
virtual void | Rasterize (Grid< NavcellData > &grid, const std::vector< PathfinderPassability > &passClasses, bool fullUpdate) |
Convert the current set of shapes onto a navcell grid, for all passability classes contained in passClasses . More... | |
virtual void | GetObstructionsInRange (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const |
Find all the obstructions that are inside (or partially inside) the given range. More... | |
virtual void | GetUnitObstructionsInRange (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const |
virtual void | GetStaticObstructionsInRange (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const |
virtual void | GetUnitsOnObstruction (const ObstructionSquare &square, std::vector< entity_id_t > &out, const IObstructionTestFilter &filter, bool strict=false) const |
Returns the entity IDs of all unit shapes that intersect the given obstruction square, filtering out using the given filter. More... | |
virtual void | SetPassabilityCircular (bool enabled) |
Set the passability to be restricted to a circular map. More... | |
virtual bool | GetPassabilityCircular () const |
virtual void | SetDebugOverlay (bool enabled) |
Toggle the rendering of debug info. More... | |
void | RenderSubmit (SceneCollector &collector) |
virtual void | UpdateInformations (GridUpdateInformation &informations) |
Gets dirtiness information and resets it afterwards. More... | |
Public Member Functions inherited from IComponent | |
virtual | ~IComponent () |
CEntityHandle | GetEntityHandle () const |
void | SetEntityHandle (CEntityHandle ent) |
entity_id_t | GetEntityId () const |
CEntityHandle | GetSystemEntity () const |
const CSimContext & | GetSimContext () const |
void | SetSimContext (const CSimContext &context) |
virtual bool | NewJSObject (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 |
Static Public Member Functions | |
static void | ClassInit (CComponentManager &componentManager) |
static IComponent * | Allocate (ScriptInterface &, JS::HandleValue) |
static void | Deallocate (IComponent *cmp) |
static std::string | GetSchema () |
Static Public Member Functions inherited from IComponent | |
static std::string | GetSchema () |
static u8 | GetSerializationVersion () |
Public Attributes | |
bool | m_DebugOverlayEnabled |
bool | m_DebugOverlayDirty |
std::vector< SOverlayLine > | m_DebugOverlayLines |
SpatialSubdivision | m_UnitSubdivision |
SpatialSubdivision | m_StaticSubdivision |
std::map< u32, UnitShape > | m_UnitShapes |
std::map< u32, StaticShape > | m_StaticShapes |
u32 | m_UnitShapeNext |
u32 | m_StaticShapeNext |
entity_pos_t | m_MaxClearance |
bool | m_PassabilityCircular |
entity_pos_t | m_WorldX0 |
entity_pos_t | m_WorldZ0 |
entity_pos_t | m_WorldX1 |
entity_pos_t | m_WorldZ1 |
u16 | m_TerrainTiles |
Private Member Functions | |
void | MakeDirtyAll () |
Mark all previous Rasterize()d grids as dirty, and the debug display. More... | |
void | MakeDirtyDebug () |
Mark the debug display as dirty. More... | |
void | MarkDirtinessGrid (const entity_pos_t &x, const entity_pos_t &z, const entity_pos_t &r) |
void | MarkDirtinessGrid (const entity_pos_t &x, const entity_pos_t &z, const CFixedVector2D &hbox) |
void | MakeDirtyStatic (flags_t flags, u32 index, const StaticShape &shape) |
Mark all previous Rasterize()d grids as dirty, if they depend on this shape. More... | |
void | MakeDirtyUnit (flags_t flags, u32 index, const UnitShape &shape) |
Mark all previous Rasterize()d grids as dirty, if they depend on this shape. More... | |
bool | IsInWorld (entity_pos_t x, entity_pos_t z, entity_pos_t r) const |
Return whether the given point is within the world bounds by at least r. More... | |
bool | IsInWorld (const CFixedVector2D &p) const |
Return whether the given point is within the world bounds. More... | |
void | RasterizeHelper (Grid< NavcellData > &grid, ICmpObstructionManager::flags_t requireMask, bool fullUpdate, pass_class_t appliedMask, entity_pos_t clearance=fixed::Zero()) const |
Private Attributes | |
GridUpdateInformation | m_UpdateInformations |
std::vector< u32 > | m_DirtyStaticShapes |
std::vector< u32 > | m_DirtyUnitShapes |
Additional Inherited Members | |
Public Types inherited from ICmpObstructionManager | |
enum | EFlags { FLAG_BLOCK_MOVEMENT = (1 << 0), FLAG_BLOCK_FOUNDATION = (1 << 1), FLAG_BLOCK_CONSTRUCTION = (1 << 2), FLAG_BLOCK_PATHFINDING = (1 << 3), FLAG_MOVING = (1 << 4) } |
Boolean flags affecting the obstruction behaviour of a shape. More... | |
typedef u8 | flags_t |
Bitmask of EFlag values. More... | |
|
inlinevirtual |
Register a static shape.
ent | entity ID associated with this shape (or INVALID_ENTITY if none) |
x,z | coordinates of center, in world space |
a | angle of rotation (clockwise from +Z direction) |
w | width (size along X axis) |
h | height (size along Z axis) |
flags | a set of EFlags values |
group | primary control group of the shape. Must be a valid control group ID. |
group2 | Optional; secondary control group of the shape. Defaults to INVALID_ENTITY. |
Implements ICmpObstructionManager.
|
inlinevirtual |
Register a unit shape.
ent | entity ID associated with this shape (or INVALID_ENTITY if none) |
x,z | coordinates of center, in world space |
clearance | pathfinding clearance of the unit (works as a radius) |
flags | a set of EFlags values |
group | control group (typically the owner entity, or a formation controller entity
|
Implements ICmpObstructionManager.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinevirtual |
Implements IComponent.
|
inlinevirtual |
Implements IComponent.
|
inlinevirtual |
Implements IComponent.
|
inlinevirtual |
Get the obstruction square representing the given shape.
tag | tag of shape (must be valid) |
Implements ICmpObstructionManager.
|
virtual |
Find all the obstructions that are inside (or partially inside) the given range.
filter | filter to restrict the shapes that are counted |
x0 | X coordinate of left edge of range |
z0 | Z coordinate of bottom edge of range |
x1 | X coordinate of right edge of range |
z1 | Z coordinate of top edge of range |
squares | output list of obstructions |
Implements ICmpObstructionManager.
|
inlinevirtual |
Implements ICmpObstructionManager.
|
inlinestatic |
|
virtual |
Implements ICmpObstructionManager.
|
inlinevirtual |
Implements ICmpObstructionManager.
|
virtual |
Implements ICmpObstructionManager.
|
inlinevirtual |
Implements ICmpObstructionManager.
|
virtual |
Returns the entity IDs of all unit shapes that intersect the given obstruction square, filtering out using the given filter.
square | the Obstruction squre we want to compare with. |
out | output list of obstructions |
filter | filter for the obstructing units |
strict | whether to be strict in the check or more permissive (ie rasterize more or less). Default false. |
Implements ICmpObstructionManager.
|
inlinevirtual |
Reimplemented from IComponent.
|
inlinevirtual |
Implements IComponent.
|
inlineprivate |
Return whether the given point is within the world bounds by at least r.
|
inlineprivate |
Return whether the given point is within the world bounds.
|
inlineprivate |
Mark all previous Rasterize()d grids as dirty, and the debug display.
Call this when the world bounds have changed.
|
inlineprivate |
Mark the debug display as dirty.
Call this when nothing has changed except a unit's 'moving' flag.
|
inlineprivate |
Mark all previous Rasterize()d grids as dirty, if they depend on this shape.
Call this when a static shape has changed.
|
inlineprivate |
Mark all previous Rasterize()d grids as dirty, if they depend on this shape.
Call this when a unit shape has changed.
|
inlineprivate |
|
inlineprivate |
|
inlinevirtual |
Adjust the position and angle of an existing shape.
tag | tag of shape (must be valid) |
x | X coordinate of center, in world space |
z | Z coordinate of center, in world space |
a | angle of rotation (clockwise from +Z direction); ignored for unit shapes |
Implements ICmpObstructionManager.
|
virtual |
Convert the current set of shapes onto a navcell grid, for all passability classes contained in passClasses
.
If fullUpdate
is false, the function will only go through dirty shapes. Shapes are expanded by the passClasses
clearances, by ORing their masks onto the grid
.
Implements ICmpObstructionManager.
|
private |
|
inlinevirtual |
Remove an existing shape.
The tag will be made invalid and must not be used after this.
tag | tag of shape (must be valid) |
Implements ICmpObstructionManager.
void CCmpObstructionManager::RenderSubmit | ( | SceneCollector & | collector | ) |
|
inline |
|
inlinevirtual |
Implements IComponent.
|
inline |
|
inlinevirtual |
Set the bounds of the world.
Any point outside the bounds is considered obstructed.
x0,z0,x1,z1 | Coordinates of the corners of the world |
Implements ICmpObstructionManager.
|
inlinevirtual |
Toggle the rendering of debug info.
Implements ICmpObstructionManager.
|
inlinevirtual |
Set the passability to be restricted to a circular map.
Implements ICmpObstructionManager.
|
inlinevirtual |
Sets the control group of a static shape.
tag | Tag of the shape to set the control group for. Must be a valid and static shape tag. |
group | Control group entity ID. |
Implements ICmpObstructionManager.
|
inlinevirtual |
Set the control group of a unit shape.
tag | tag of shape (must be valid and a unit shape) |
group | control group entity ID |
Implements ICmpObstructionManager.
|
inlinevirtual |
Set whether a unit shape is moving or stationary.
tag | tag of shape (must be valid and a unit shape) |
moving | whether the unit is currently moving through the world or is stationary |
Implements ICmpObstructionManager.
|
virtual |
Collision test a flat-ended thick line against the current set of shapes.
The line caps extend by r
beyond the end points. Only intersections going from outside to inside a shape are counted.
filter | filter to restrict the shapes that are counted |
x0 | X coordinate of line's first point |
z0 | Z coordinate of line's first point |
x1 | X coordinate of line's second point |
z1 | Z coordinate of line's second point |
r | radius (half width) of line |
relaxClearanceForUnits | whether unit-unit collisions should be more permissive. |
Implements ICmpObstructionManager.
|
virtual |
Collision test a static square shape against the current set of shapes.
filter | filter to restrict the shapes that are being tested against |
x | X coordinate of center |
z | Z coordinate of center |
a | angle of rotation (clockwise from +Z direction) |
w | width (size along X axis) |
h | height (size along Z axis) |
out | if non-NULL, all colliding shapes' entities will be added to this list |
Implements ICmpObstructionManager.
|
virtual |
Collision test a unit shape against the current set of registered shapes, and optionally writes a list of the colliding shapes' entities to an output list.
filter | filter to restrict the shapes that are being tested against |
x | X coordinate of shape's center |
z | Z coordinate of shape's center |
clearance | clearance of the shape's unit |
out | if non-NULL, all colliding shapes' entities will be added to this list |
Implements ICmpObstructionManager.
|
inlinevirtual |
Gets dirtiness information and resets it afterwards.
Then it's the role of CCmpPathfinder to pass the information to other components if needed. (AIs, etc.) The return value is false if an update is unnecessary.
Implements ICmpObstructionManager.
bool CCmpObstructionManager::m_DebugOverlayDirty |
bool CCmpObstructionManager::m_DebugOverlayEnabled |
std::vector<SOverlayLine> CCmpObstructionManager::m_DebugOverlayLines |
|
private |
|
private |
entity_pos_t CCmpObstructionManager::m_MaxClearance |
bool CCmpObstructionManager::m_PassabilityCircular |
u32 CCmpObstructionManager::m_StaticShapeNext |
std::map<u32, StaticShape> CCmpObstructionManager::m_StaticShapes |
SpatialSubdivision CCmpObstructionManager::m_StaticSubdivision |
u16 CCmpObstructionManager::m_TerrainTiles |
u32 CCmpObstructionManager::m_UnitShapeNext |
SpatialSubdivision CCmpObstructionManager::m_UnitSubdivision |
|
private |
entity_pos_t CCmpObstructionManager::m_WorldX0 |
entity_pos_t CCmpObstructionManager::m_WorldX1 |
entity_pos_t CCmpObstructionManager::m_WorldZ0 |
entity_pos_t CCmpObstructionManager::m_WorldZ1 |