Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Public Types | |
enum | EShape { FOOTPRINT , CIRCLE , SQUARE } |
Public Types inherited from IComponent | |
using | AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor) |
using | DeallocFunc = void(*)(IComponent *) |
Public Member Functions | |
int | GetComponentTypeId () const override |
CCmpSelectable () | |
~CCmpSelectable () | |
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 |
void | SetSelectionHighlight (const CColor &color, bool selected) override |
Sets the selection highlight state. More... | |
void | SetSelectionHighlightAlpha (float alpha) override |
Sets the alpha of the selection highlight. More... | |
void | SetVisibility (bool visible) override |
Enables or disables rendering of an entity's selectable. More... | |
bool | IsEditorOnly () const override |
Returns true if the entity is only selectable in Atlas editor, e.g. More... | |
void | RenderSubmit (SceneCollector &collector, const CFrustum &frustum, bool culling) |
void | UpdateTexturedLineOverlay (const SOverlayDescriptor *overlayDescriptor, SOverlayTexturedLine &overlay, float frameOffset) |
Draw a textured line overlay. More... | |
void | UpdateDynamicOverlay (float frameOffset) |
Called from the interpolation handler; responsible for ensuring the dynamic overlay (provided we're using one) is up-to-date and ready to be submitted to the next rendering run. More... | |
void | InvalidateStaticOverlay () |
Explicitly invalidates the static overlay. More... | |
void | UpdateMessageSubscriptions () |
Subscribe/unsubscribe to MT_Interpolate, MT_RenderSubmit, depending on whether we will do any actual work when receiving them. More... | |
void | UpdateColor () override |
Set the color of the current owner. More... | |
virtual bool | IsEditorOnly () const =0 |
Returns true if the entity is only selectable in Atlas editor, e.g. More... | |
virtual void | SetSelectionHighlight (const CColor &color, bool selected)=0 |
Sets the selection highlight state. More... | |
virtual void | SetVisibility (bool visible)=0 |
Enables or disables rendering of an entity's selectable. More... | |
virtual void | UpdateColor ()=0 |
Updates the selection color to match the current owner. More... | |
virtual void | SetSelectionHighlightAlpha (float alpha)=0 |
Sets the alpha of the selection highlight. More... | |
Public Member Functions inherited from IComponent | |
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 |
Static Public Member Functions | |
static void | ClassInit (CComponentManager &componentManager) |
static IComponent * | Allocate (const ScriptInterface &, JS::HandleValue) |
static void | Deallocate (IComponent *cmp) |
static std::string | GetSchema () |
Static Public Member Functions inherited from ICmpSelectable | |
static void | SetOverrideVisibility (bool visible) |
Enables or disables rendering of all entities selectable. More... | |
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 () |
Public Attributes | |
EShape | m_Shape |
entity_pos_t | m_Width |
entity_pos_t | m_Height |
Private Attributes | |
SOverlayDescriptor | m_OverlayDescriptor |
SOverlayTexturedLine * | m_BuildingOverlay |
SOverlayQuad * | m_UnitOverlay |
CBoundingBoxAligned | m_UnitOverlayBoundingBox |
SOverlayLine * | m_DebugBoundingBoxOverlay |
SOverlayLine * | m_DebugSelectionBoxOverlay |
bool | m_EnabledInterpolate |
bool | m_EnabledRenderSubmit |
bool | m_Visible |
bool | m_EditorOnly |
bool | m_AlwaysVisible |
bool | m_Selected |
Whether the parent entity is selected (caches GUI's selection state). More... | |
CColor | m_Color |
Current selection overlay color. Alpha component is subject to fading. More... | |
bool | m_Cached |
Whether the selectable's player color has been cached for rendering. More... | |
float | m_AlphaMin |
Minimum value for current selection overlay alpha. More... | |
float | m_FadeBaselineAlpha |
Baseline alpha value to start fading from. Constant during a single fade. More... | |
float | m_FadeDeltaAlpha |
Delta between target and baseline alpha. Constant during a single fade. Can be positive or negative. More... | |
float | m_FadeProgress |
Linear time progress of the fade, between 0 and m_FadeDuration. More... | |
Static Private Attributes | |
static const float | FADE_DURATION = 0.3f |
Total duration of a single fade, in seconds. More... | |
static const char * | TEXTUREBASEPATH = "art/textures/selection/" |
Additional Inherited Members | |
Static Public Attributes inherited from ICmpSelectable | |
static bool | ms_EnableDebugOverlays = false |
Static Protected Attributes inherited from ICmpSelectable | |
static bool | m_OverrideVisible = true |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlineoverridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
Implements IComponent.
|
inlinestatic |
|
overridevirtual |
Reimplemented from IComponent.
|
inlineoverridevirtual |
Implements IComponent.
void CCmpSelectable::InvalidateStaticOverlay | ( | ) |
Explicitly invalidates the static overlay.
|
inlineoverridevirtual |
Returns true if the entity is only selectable in Atlas editor, e.g.
a decorative visual actor.
Implements ICmpSelectable.
void CCmpSelectable::RenderSubmit | ( | SceneCollector & | collector, |
const CFrustum & | frustum, | ||
bool | culling | ||
) |
|
inlineoverridevirtual |
Implements IComponent.
|
inlineoverridevirtual |
Sets the selection highlight state.
The highlight is typically a circle/square overlay around the unit.
color | color and alpha of the selection highlight. Set color.a = 0 to hide the highlight. |
selected | whether the entity is selected; affects desaturation for always visible highlights. |
Implements ICmpSelectable.
|
inlineoverridevirtual |
Sets the alpha of the selection highlight.
Set to 0 to hide the highlight.
Implements ICmpSelectable.
|
inlineoverridevirtual |
Enables or disables rendering of an entity's selectable.
visible | Whether the selectable should be visible. |
Implements ICmpSelectable.
|
overridevirtual |
Set the color of the current owner.
Implements ICmpSelectable.
void CCmpSelectable::UpdateDynamicOverlay | ( | float | frameOffset | ) |
Called from the interpolation handler; responsible for ensuring the dynamic overlay (provided we're using one) is up-to-date and ready to be submitted to the next rendering run.
void CCmpSelectable::UpdateMessageSubscriptions | ( | ) |
Subscribe/unsubscribe to MT_Interpolate, MT_RenderSubmit, depending on whether we will do any actual work when receiving them.
(This is to avoid the performance cost of receiving messages in the typical case when the entity is not selected.)
Must be called after changing m_Visible, m_FadeDeltaAlpha, m_Color.a
void CCmpSelectable::UpdateTexturedLineOverlay | ( | const SOverlayDescriptor * | overlayDescriptor, |
SOverlayTexturedLine & | overlay, | ||
float | frameOffset | ||
) |
Draw a textured line overlay.
|
staticprivate |
Total duration of a single fade, in seconds.
Assumed constant for now; feel free to change this into a member variable if you need to adjust it per component.
|
private |
Minimum value for current selection overlay alpha.
|
private |
|
private |
|
private |
Whether the selectable's player color has been cached for rendering.
|
private |
Current selection overlay color. Alpha component is subject to fading.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Baseline alpha value to start fading from. Constant during a single fade.
|
private |
Delta between target and baseline alpha. Constant during a single fade. Can be positive or negative.
|
private |
Linear time progress of the fade, between 0 and m_FadeDuration.
entity_pos_t CCmpSelectable::m_Height |
|
private |
|
private |
Whether the parent entity is selected (caches GUI's selection state).
EShape CCmpSelectable::m_Shape |
|
private |
|
private |
|
private |
entity_pos_t CCmpSelectable::m_Width |
|
staticprivate |