|
int | GetComponentTypeId () const override |
|
void | Init (const CParamNode ¶mNode) override |
|
void | Deinit () override |
|
void | Serialize (ISerializer &serialize) override |
|
void | Deserialize (const CParamNode ¶mNode, IDeserializer &deserialize) override |
|
void | HandleMessage (const CMessage &msg, bool global) override |
|
SUnit * | LookupUnit (tag_t tag) |
|
tag_t | AddUnit (CEntityHandle entity, CUnit *actor, const CBoundingSphere &boundsApprox, int flags) override |
|
void | RemoveUnit (tag_t tag) override |
|
void | RecomputeSweptBounds (SUnit *unit) |
|
void | UpdateUnit (tag_t tag, CUnit *actor, const CBoundingSphere &boundsApprox) override |
|
void | UpdateUnitPos (tag_t tag, bool inWorld, const CVector3D &pos0, const CVector3D &pos1) override |
|
void | TurnStart () |
|
void | Interpolate (float frameTime, float frameOffset) |
|
void | RenderSubmit (SceneCollector &collector, const CFrustum &frustum, bool culling) |
|
void | UpdateVisibility (SUnit &unit) const |
|
float | GetFrameOffset () const override |
| Returns the frame offset from the last Interpolate message. More...
|
|
void | SetDebugOverlay (bool enabled) override |
| Toggle the rendering of debug info. More...
|
|
void | PickAllEntitiesAtPoint (std::vector< std::pair< CEntityHandle, CVector3D > > &outEntities, const CVector3D &origin, const CVector3D &dir, bool allowEditorSelectables) const override |
| Return a list of visual entities along with their center point. More...
|
|
virtual tag_t | AddUnit (CEntityHandle entity, CUnit *unit, const CBoundingSphere &boundsApprox, int flags)=0 |
|
virtual void | RemoveUnit (tag_t tag)=0 |
|
virtual void | UpdateUnit (tag_t tag, CUnit *unit, const CBoundingSphere &boundsApprox)=0 |
|
virtual void | UpdateUnitPos (tag_t tag, bool inWorld, const CVector3D &pos0, const CVector3D &pos1)=0 |
|
virtual void | PickAllEntitiesAtPoint (std::vector< std::pair< CEntityHandle, CVector3D > > &outEntities, const CVector3D &origin, const CVector3D &dir, bool allowEditorSelectables) const =0 |
| Return a list of visual entities along with their center point. More...
|
|
virtual float | GetFrameOffset () const =0 |
| Returns the frame offset from the last Interpolate message. More...
|
|
virtual void | SetDebugOverlay (bool enabled)=0 |
| Toggle the rendering of debug info. More...
|
|
virtual | ~IComponent () |
|
virtual void | Init (const CParamNode ¶mNode)=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 CSimContext & | GetSimContext () const |
|
void | SetSimContext (const CSimContext &context) |
|
virtual void | Serialize (ISerializer &serialize)=0 |
|
virtual void | Deserialize (const CParamNode ¶mNode, 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 |
|
Efficiently(ish) renders all the units in the world.
The class maintains a list of all units that currently exist, and the data needed for frustum-culling them. To minimise the amount of work done per frame (despite a unit's interpolated position changing every frame), the culling data is only updated once per turn: we store the position at the start of the turn, and the position at the end of the turn, and assume the unit might be anywhere between those two points (linearly).
(Note this is a slightly invalid assumption: units don't always move linearly, since their interpolated position depends on terrain and water. But over a single turn it's probably going to be a good enough approximation, and will only break for units that both start and end the turn off-screen.)
We want to ignore rotation entirely, since it's a complex function of interpolated position and terrain. So we store a bounding sphere, which is rotation-independent, instead of a bounding box.