Manages the creation, update, and rendering of animated markers along a QPainterPath.
More...
#include <path_markers_manager.h>
|
| struct | PathMarker |
| | Structure representing a single animated marker moving along the path. More...
|
| |
|
| void | DrawMarkers (QPainter &painter, const QPainterPath &blob_path, qint64 current_time) |
| | Draws all managed markers onto the provided QPainter. Calculates the time delta since the last draw call, updates marker states, determines marker positions on the given path, and calls the appropriate drawing function for each marker type. Initializes markers if the list is empty.
|
| |
| const PathMarker & | GetMarker (const size_t index) const |
| | Gets a constant reference to a specific marker by its index. Performs bounds checking via std::vector::at().
|
| |
| size_t | GetMarkerCount () const |
| | Gets the current number of active markers.
|
| |
| void | InitializeMarkers () |
| | Initializes or resets the set of markers. Clears existing markers and creates a new random set with varying types, speeds, and appearances. Ensures that the same marker type is not generated twice consecutively.
|
| |
| | PathMarkersManager () |
| | Constructs a PathMarkersManager. Initializes last update time to 0.
|
| |
| void | UpdateMarkers (double delta_time) |
| | Updates the state of all markers based on the elapsed time. Calculates new positions, color phases, wave phases, and quantum states.
|
| |
|
| static void | CalculateTrailPoints (PathMarker &marker, const QPainterPath &blob_path, double position, double path_length) |
| | Calculates the points needed to draw the trailing effect for an impulse marker. Populates the marker's trailPoints vector.
|
| |
| static void | DrawImpulseMarker (QPainter &painter, const PathMarker &marker, const QPointF &position, const QColor &marker_color, qint64 current_time) |
| | Draws a marker of type 0 (Impulse). Renders a cyberpunk-style head element and a fading trail using pre-calculated points.
|
| |
| static void | DrawQuantumMarker (QPainter &painter, const PathMarker &marker, const QPointF &position, const QColor &marker_color, qint64 current_time) |
| | Draws a marker of type 2 (Quantum). Renders a central point and several orbiting "quantum copies" whose appearance and behavior change based on the marker's quantumState and quantumStateTime. Includes connecting lines ("entanglement").
|
| |
| static void | DrawWaveMarker (QPainter &painter, const PathMarker &marker, const QPointF &position, const QColor &marker_color) |
| | Draws a marker of type 1 (Wave). Renders expanding concentric rings and a subtle distortion effect originating from the marker position.
|
| |
| static QColor | GetMarkerColor (int marker_type, double color_phase) |
| | Determines the appropriate color for a marker based on its type and current color phase. Uses HSV color manipulation for smooth transitions.
|
| |
Manages the creation, update, and rendering of animated markers along a QPainterPath.
This class creates several types of markers (energy impulses, disturbance waves, quantum effects) that move along a given path (typically the blob's outline). Each marker type has unique visual characteristics and animation behavior. The manager handles marker initialization, position updates based on time, and drawing logic using QPainter.
◆ PathMarkersManager()
| PathMarkersManager::PathMarkersManager |
( |
| ) |
|
|
inline |
◆ CalculateTrailPoints()
| void PathMarkersManager::CalculateTrailPoints |
( |
PathMarker & | marker, |
|
|
const QPainterPath & | blob_path, |
|
|
double | position, |
|
|
double | path_length ) |
|
staticprivate |
Calculates the points needed to draw the trailing effect for an impulse marker. Populates the marker's trailPoints vector.
- Parameters
-
| marker | Reference to the PathMarker (type 0) whose trail points are being calculated (modified). |
| blob_path | The path along which the marker moves. |
| position | The current absolute position (distance along the path) of the marker head. |
| path_length | The total length of the blobPath. |
◆ DrawImpulseMarker()
| void PathMarkersManager::DrawImpulseMarker |
( |
QPainter & | painter, |
|
|
const PathMarker & | marker, |
|
|
const QPointF & | position, |
|
|
const QColor & | marker_color, |
|
|
qint64 | current_time ) |
|
staticprivate |
Draws a marker of type 0 (Impulse). Renders a cyberpunk-style head element and a fading trail using pre-calculated points.
- Parameters
-
| painter | The QPainter to use for drawing. |
| marker | The PathMarker data. |
| position | The calculated position (QPointF) on the painter where the marker head should be drawn. |
| marker_color | The base color for the marker. |
| current_time | The current timestamp for potential time-based effects (e.g., flickering). |
◆ DrawMarkers()
| void PathMarkersManager::DrawMarkers |
( |
QPainter & | painter, |
|
|
const QPainterPath & | blob_path, |
|
|
qint64 | current_time ) |
Draws all managed markers onto the provided QPainter. Calculates the time delta since the last draw call, updates marker states, determines marker positions on the given path, and calls the appropriate drawing function for each marker type. Initializes markers if the list is empty.
- Parameters
-
| painter | The QPainter to use for drawing. |
| blob_path | The QPainterPath along which the markers should be drawn. |
| current_time | The current timestamp in milliseconds (e.g., from QDateTime::currentMSecsSinceEpoch()). |
◆ DrawQuantumMarker()
| void PathMarkersManager::DrawQuantumMarker |
( |
QPainter & | painter, |
|
|
const PathMarker & | marker, |
|
|
const QPointF & | position, |
|
|
const QColor & | marker_color, |
|
|
qint64 | current_time ) |
|
staticprivate |
Draws a marker of type 2 (Quantum). Renders a central point and several orbiting "quantum copies" whose appearance and behavior change based on the marker's quantumState and quantumStateTime. Includes connecting lines ("entanglement").
- Parameters
-
| painter | The QPainter to use for drawing. |
| marker | The PathMarker data (uses quantumState, quantumStateTime, etc.). |
| position | The calculated position (QPointF) on the painter for the central point. |
| marker_color | The base color for the marker. |
| current_time | The current timestamp for time-based animation effects. |
◆ DrawWaveMarker()
| void PathMarkersManager::DrawWaveMarker |
( |
QPainter & | painter, |
|
|
const PathMarker & | marker, |
|
|
const QPointF & | position, |
|
|
const QColor & | marker_color ) |
|
staticprivate |
Draws a marker of type 1 (Wave). Renders expanding concentric rings and a subtle distortion effect originating from the marker position.
- Parameters
-
| painter | The QPainter to use for drawing. |
| marker | The PathMarker data (uses wavePhase). |
| position | The calculated position (QPointF) on the painter, representing the wave's origin. |
| marker_color | The base color for the marker. |
◆ GetMarker()
| const PathMarker & PathMarkersManager::GetMarker |
( |
const size_t | index | ) |
const |
|
inline |
Gets a constant reference to a specific marker by its index. Performs bounds checking via std::vector::at().
- Parameters
-
| index | The index of the desired marker. |
- Returns
- A constant reference to the PathMarker struct.
- Exceptions
-
| out_of_range | if the index is invalid. |
◆ GetMarkerColor()
| QColor PathMarkersManager::GetMarkerColor |
( |
int | marker_type, |
|
|
double | color_phase ) |
|
staticprivate |
Determines the appropriate color for a marker based on its type and current color phase. Uses HSV color manipulation for smooth transitions.
- Parameters
-
| marker_type | The type of the marker (0, 1, or 2). |
| color_phase | The current color phase (0.0 to 1.0). |
- Returns
- The calculated QColor for the marker.
◆ GetMarkerCount()
| size_t PathMarkersManager::GetMarkerCount |
( |
| ) |
const |
|
inline |
Gets the current number of active markers.
- Returns
- The number of markers in the m_markers vector.
◆ InitializeMarkers()
| void PathMarkersManager::InitializeMarkers |
( |
| ) |
|
Initializes or resets the set of markers. Clears existing markers and creates a new random set with varying types, speeds, and appearances. Ensures that the same marker type is not generated twice consecutively.
◆ UpdateMarkers()
| void PathMarkersManager::UpdateMarkers |
( |
double | delta_time | ) |
|
Updates the state of all markers based on the elapsed time. Calculates new positions, color phases, wave phases, and quantum states.
- Parameters
-
| delta_time | Time elapsed since the last update in seconds. |
◆ last_update_time_
| qint64 PathMarkersManager::last_update_time_ |
|
private |
Timestamp (milliseconds since epoch) of the last call to drawMarkers, used for calculating deltaTime.
◆ markers_
| std::vector<PathMarker> PathMarkersManager::markers_ |
|
private |
The documentation for this class was generated from the following files: