Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
#include <CCmpRallyPointRenderer.h>
Public Member Functions | |
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 |
virtual void | UpdateMessageSubscriptions () |
void | AddPosition_wrapper (const CFixedVector2D &pos) override |
Add another position at which a marker should be displayed, connected to the previous one. More... | |
void | SetPosition (const CFixedVector2D &pos) override |
Sets the position at which the rally point marker should be displayed. More... | |
void | UpdatePosition (u32 rallyPointId, const CFixedVector2D &pos) override |
Updates the position of one given rally point marker. More... | |
void | SetDisplayed (bool displayed) override |
Sets whether the rally point marker and line should be displayed. More... | |
void | Reset () override |
Reset the positions of this rally point marker. More... | |
void | UpdateColor () override |
Updates the line color. More... | |
bool | IsSet () const override |
Returns true if at least one display rally point is set; i.e., if we have a point to render our marker/line at. More... | |
int | GetComponentTypeId () const override |
virtual void | SetDisplayed (bool displayed)=0 |
Sets whether the rally point marker and line should be displayed. More... | |
virtual void | SetPosition (const CFixedVector2D &position)=0 |
Sets the position at which the rally point marker should be displayed. More... | |
virtual void | UpdatePosition (u32 rallyPointId, const CFixedVector2D &position)=0 |
Updates the position of one given rally point marker. More... | |
virtual void | AddPosition_wrapper (const CFixedVector2D &position)=0 |
Add another position at which a marker should be displayed, connected to the previous one. More... | |
virtual void | Reset ()=0 |
Reset the positions of this rally point marker. More... | |
virtual bool | IsSet () const =0 |
Returns true if at least one display rally point is set. More... | |
virtual void | UpdateColor ()=0 |
Updates the line color. 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 std::string | GetSchema () |
static void | ClassInit (CComponentManager &componentManager) |
static IComponent * | Allocate (const ScriptInterface &, JS::HandleValue) |
static void | Deallocate (IComponent *cmp) |
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 () |
Protected Attributes | |
std::vector< CFixedVector2D > | m_RallyPoints |
Display position of the rally points. More... | |
std::vector< std::vector< CVector2D > > | m_Path |
Full path to the rally points as returned by the pathfinder, with some post-processing applied to reduce zig/zagging. More... | |
std::vector< std::vector< SVisibilitySegment > > | m_VisibilitySegments |
Visibility segments of the rally point paths; splits the path into SoD/non-SoD segments. More... | |
bool | m_Displayed |
Should we render the rally points and the path lines? (set from JS when e.g. More... | |
bool | m_SmoothPath |
Smooth the path before rendering? More... | |
std::vector< entity_id_t > | m_MarkerEntityIds |
Entity IDs of the rally point markers. More... | |
size_t | m_LastMarkerCount |
player_id_t | m_LastOwner |
Last seen owner of this entity (used to keep track of ownership changes). More... | |
std::wstring | m_MarkerTemplate |
Template name of the rally point markers. More... | |
float | m_LineThickness |
Marker connector line settings (loaded from XML) More... | |
CColor | m_LineColor |
CColor | m_LineDashColor |
SOverlayTexturedLine::LineCapType | m_LineStartCapType |
SOverlayTexturedLine::LineCapType | m_LineEndCapType |
std::wstring | m_LineTexturePath |
std::wstring | m_LineTextureMaskPath |
std::string | m_LinePassabilityClass |
Pathfinder passability class to use for computing the (long-range) marker line path. More... | |
CTexturePtr | m_Texture |
CTexturePtr | m_TextureMask |
std::vector< std::vector< SOverlayTexturedLine > > | m_TexturedOverlayLines |
Textured overlay lines to be used for rendering the marker line. More... | |
bool | m_EnableDebugNodeOverlay |
Draw little overlay circles to indicate where the exact path points are. More... | |
std::vector< std::vector< SOverlayLine > > | m_DebugNodeOverlays |
Private Member Functions | |
void | AddPosition (CFixedVector2D pos, bool recompute) |
Helper function for AddPosition_wrapper and SetPosition. More... | |
void | UpdateLineColor () |
Helper function to set the line color to its owner's color. More... | |
void | UpdateMarkers () |
Repositions the rally point markers; moves them outside of the world (ie. More... | |
void | RecomputeAllRallyPointPaths () |
Recomputes all the full paths from this entity to the rally point and from the rally point to the next, and does all the necessary post-processing to make them prettier. More... | |
void | RecomputeRallyPointPath_wrapper (size_t index) |
Recomputes the full path for m_Path[ index ], and does all the necessary post-processing to make it prettier. More... | |
void | RecomputeRallyPointPath (size_t index, CmpPtr< ICmpPosition > &cmpPosition, CmpPtr< ICmpFootprint > &cmpFootprint, CmpPtr< ICmpPathfinder > cmpPathfinder) |
Recomputes the full path from this entity/the previous rally point to the next rally point, and does all the necessary post-processing to make it prettier. More... | |
void | UpdateOverlayLines () |
Checks for changes to the SoD to the previously saved state, and reconstructs the visibility segments and overlay lines to match if necessary. More... | |
void | ConstructAllOverlayLines () |
Sets up all overlay lines for rendering according to the current full path and visibility segments. More... | |
void | ConstructOverlayLines (size_t index) |
Sets up the overlay lines for rendering according to the full path and visibility segments at index . More... | |
void | GetClosestsEdgePointFrom (CFixedVector2D &result, CFixedVector2D &start, CmpPtr< ICmpPosition > cmpPosition, CmpPtr< ICmpFootprint > cmpFootprint) const |
Get the point on the footprint edge that's as close from "start" as possible. More... | |
void | GetVisibilitySegments (std::vector< SVisibilitySegment > &out, size_t index) const |
Returns a list of indices of waypoints in the current path (m_Path[index]) where the LOS visibility changes, ordered from building/previous rally point to rally point. More... | |
void | ReduceSegmentsByVisibility (std::vector< CVector2D > &coords, unsigned maxSegmentLinks=0, bool floating=true) const |
Simplifies the path by removing waypoints that lie between two points that are visible from one another. More... | |
void | RenderSubmit (SceneCollector &collector, const CFrustum &frustum, bool culling) |
Static Private Member Functions | |
static void | MergeVisibilitySegments (std::vector< SVisibilitySegment > &segments) |
Helper function to GetVisibilitySegments, factored out for testing. More... | |
Additional Inherited Members | |
Public Types inherited from IComponent | |
using | AllocFunc = IComponent *(*)(const ScriptInterface &scriptInterface, JS::HandleValue ctor) |
using | DeallocFunc = void(*)(IComponent *) |
|
private |
Helper function for AddPosition_wrapper and SetPosition.
|
overridevirtual |
Add another position at which a marker should be displayed, connected to the previous one.
Implements ICmpRallyPointRenderer.
|
inlinestatic |
|
static |
|
private |
Sets up all overlay lines for rendering according to the current full path and visibility segments.
Splits the line into solid and dashed pieces (for the SoD). Should be called whenever the SoD has changed. If no full path is currently set, this method does nothing.
|
private |
Sets up the overlay lines for rendering according to the full path and visibility segments at index
.
Splits the line into solid and dashed pieces (for the SoD). Should be called whenever the SoD of the path at index
has changed.
|
inlinestatic |
|
overridevirtual |
Implements IComponent.
|
overridevirtual |
Implements IComponent.
|
private |
Get the point on the footprint edge that's as close from "start" as possible.
|
inlineoverridevirtual |
Implements IComponent.
|
static |
|
private |
Returns a list of indices of waypoints in the current path (m_Path[index]) where the LOS visibility changes, ordered from building/previous rally point to rally point.
Used to construct the overlay line segments and track changes to the SoD.
|
overridevirtual |
Reimplemented from IComponent.
|
overridevirtual |
Implements IComponent.
|
overridevirtual |
Returns true if at least one display rally point is set; i.e., if we have a point to render our marker/line at.
Implements ICmpRallyPointRenderer.
|
staticprivate |
Helper function to GetVisibilitySegments, factored out for testing.
Merges single-point segments with its neighbouring segments. You should not have to call this method directly.
|
private |
Recomputes all the full paths from this entity to the rally point and from the rally point to the next, and does all the necessary post-processing to make them prettier.
Should be called whenever all rally points' position changes.
|
private |
Recomputes the full path from this entity/the previous rally point to the next rally point, and does all the necessary post-processing to make it prettier.
This doesn't check if we have a valid position or if a rally point is set.
You shouldn't need to call this method directly.
|
private |
Recomputes the full path for m_Path[ index
], and does all the necessary post-processing to make it prettier.
Should be called whenever either the starting position or the rally point's position changes.
|
private |
Simplifies the path by removing waypoints that lie between two points that are visible from one another.
This is primarily intended to reduce some unnecessary curviness of the path; the pathfinder returns a mathematically (near-)optimal path, which will happily curve and bend to reduce costs. Visually, it doesn't make sense for a rally point path to curve and bend when it could just as well have gone in a straight line; that's why we have this, to make it look more natural.
coords
array of path coordinates to simplify maxSegmentLinks
if non-zero, indicates the maximum amount of consecutive node-to-node links that can be joined into a single link. If this value is set to e.g. 1, then no reductions will be performed. A value of 3 means that at most 3 consecutive node links will be joined into a single link. floating
whether to consider nodes who are under the water level as floating on top of the water
|
private |
|
overridevirtual |
Reset the positions of this rally point marker.
Implements ICmpRallyPointRenderer.
|
overridevirtual |
Implements IComponent.
|
overridevirtual |
Sets whether the rally point marker and line should be displayed.
Implements ICmpRallyPointRenderer.
|
overridevirtual |
Sets the position at which the rally point marker should be displayed.
Discards all previous positions
Implements ICmpRallyPointRenderer.
|
overridevirtual |
Updates the line color.
Implements ICmpRallyPointRenderer.
|
private |
Helper function to set the line color to its owner's color.
|
private |
Repositions the rally point markers; moves them outside of the world (ie.
hides them), or positions them at the currently set rally points. Also updates the actor's variation according to the entity's current owning player's civilization.
Should be called whenever either the position of a rally point changes (including whether it is set or not), or the display flag changes, or the ownership of the entity changes.
|
virtual |
|
private |
Checks for changes to the SoD to the previously saved state, and reconstructs the visibility segments and overlay lines to match if necessary.
Does nothing if the rally point lines are not currently set to be displayed, or if no rally point is set.
|
overridevirtual |
Updates the position of one given rally point marker.
Implements ICmpRallyPointRenderer.
|
protected |
|
protected |
Should we render the rally points and the path lines? (set from JS when e.g.
the unit is selected/deselected)
|
protected |
Draw little overlay circles to indicate where the exact path points are.
|
protected |
|
protected |
Last seen owner of this entity (used to keep track of ownership changes).
|
protected |
|
protected |
|
protected |
|
protected |
Pathfinder passability class to use for computing the (long-range) marker line path.
|
protected |
|
protected |
|
protected |
|
protected |
Marker connector line settings (loaded from XML)
|
protected |
Entity IDs of the rally point markers.
|
protected |
Template name of the rally point markers.
|
protected |
Full path to the rally points as returned by the pathfinder, with some post-processing applied to reduce zig/zagging.
|
protected |
Display position of the rally points.
Note that this are merely the display positions; they not necessarily the same as the actual positions used in the simulation at any given time. In particular, we need this separate copy to support instantaneously rendering the rally point markers/lines when the user sets one in-game (instead of waiting until the network-synchronization code sets it on the RallyPoint component, which might take up to half a second).
|
protected |
Smooth the path before rendering?
|
protected |
|
protected |
Textured overlay lines to be used for rendering the marker line.
There can be multiple because we may need to render dashes for segments that are inside the SoD.
|
protected |
|
protected |
Visibility segments of the rally point paths; splits the path into SoD/non-SoD segments.