Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
path_markers_manager.h
Go to the documentation of this file.
1#ifndef PATH_MARKERS_MANAGER_H
2#define PATH_MARKERS_MANAGER_H
3
4#include <qglobal.h>
5#include <vector>
6
7class QColor;
8class QPainterPath;
9class QPainter;
10class QPointF;
11
21public:
25 struct PathMarker {
26 double position;
28 int size;
30 double color_phase;
31 double color_speed;
32 double tail_length;
33 double wave_phase;
35 double speed;
36
40
41 std::vector<QPointF> trail_points;
43 };
44
50
56 void InitializeMarkers();
57
63 void UpdateMarkers(double delta_time);
64
74 void DrawMarkers(QPainter &painter, const QPainterPath &blob_path, qint64 current_time);
75
80 size_t GetMarkerCount() const {
81 return markers_.size();
82 }
83
91 const PathMarker &GetMarker(const size_t index) const {
92 return markers_.at(index);
93 }
94
95private:
97 std::vector<PathMarker> markers_;
100
109 static void CalculateTrailPoints(PathMarker &marker, const QPainterPath &blob_path, double position,
110 double path_length);
111
121 static void DrawImpulseMarker(QPainter &painter, const PathMarker &marker, const QPointF &position,
122 const QColor &marker_color, qint64 current_time);
123
132 static void DrawWaveMarker(QPainter &painter, const PathMarker &marker, const QPointF &position,
133 const QColor &marker_color);
134
145 static void DrawQuantumMarker(QPainter &painter, const PathMarker &marker, const QPointF &position,
146 const QColor &marker_color, qint64 current_time);
147
155 static QColor GetMarkerColor(int marker_type, double color_phase);
156};
157
158#endif // PATH_MARKERS_MANAGER_H
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" who...
Definition path_markers_manager.cpp:349
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 p...
Definition path_markers_manager.cpp:212
static QColor GetMarkerColor(int marker_type, double color_phase)
Determines the appropriate color for a marker based on its type and current color phase....
Definition path_markers_manager.cpp:436
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 c...
Definition path_markers_manager.cpp:123
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 or...
Definition path_markers_manager.cpp:305
void UpdateMarkers(double delta_time)
Updates the state of all markers based on the elapsed time. Calculates new positions,...
Definition path_markers_manager.cpp:68
std::vector< PathMarker > markers_
Vector storing all the active PathMarker objects.
Definition path_markers_manager.h:97
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'...
Definition path_markers_manager.cpp:181
void InitializeMarkers()
Initializes or resets the set of markers. Clears existing markers and creates a new random set with v...
Definition path_markers_manager.cpp:8
PathMarkersManager()
Constructs a PathMarkersManager. Initializes last update time to 0.
Definition path_markers_manager.h:48
qint64 last_update_time_
Timestamp (milliseconds since epoch) of the last call to drawMarkers, used for calculating deltaTime.
Definition path_markers_manager.h:99
size_t GetMarkerCount() const
Gets the current number of active markers.
Definition path_markers_manager.h:80
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...
Definition path_markers_manager.h:91
Structure representing a single animated marker moving along the path.
Definition path_markers_manager.h:25
double speed
Individual movement speed of the marker along the path.
Definition path_markers_manager.h:35
double position
Current position along the path, normalized (0.0 to 1.0).
Definition path_markers_manager.h:26
double color_speed
Speed at which the color phase changes.
Definition path_markers_manager.h:31
double quantum_offset
Random offset for quantum effect timing (type 2).
Definition path_markers_manager.h:34
double quantum_state_time
Time elapsed in the current quantum state.
Definition path_markers_manager.h:38
double quantum_state_duration
Total duration planned for the current quantum state.
Definition path_markers_manager.h:39
int marker_type
Type of marker: 0=Impulse, 1=Wave, 2=Quantum.
Definition path_markers_manager.h:27
int quantum_state
Current state: 0=Single, 1=Expanding, 2=Fragmented, 3=Collapsing.
Definition path_markers_manager.h:37
std::vector< QPointF > trail_points
Pre-calculated points for rendering the trail of impulse markers (type 0).
Definition path_markers_manager.h:41
int size
Base size of the marker in pixels.
Definition path_markers_manager.h:28
double color_phase
Current phase for color cycling (0.0 to 1.0).
Definition path_markers_manager.h:30
double tail_length
Length of the trail for impulse markers (type 0), normalized to path length.
Definition path_markers_manager.h:32
int direction
Direction of movement along the path (1 or -1).
Definition path_markers_manager.h:29
double wave_phase
Current phase/radius of the disturbance wave (type 1).
Definition path_markers_manager.h:33