85 boost_left_[index] = val;
92 boost_right_[index] = val;
133 fill_color_from_ = fill_color_from;
134 fill_color_to_ = fill_color_to;
159 void boostLeftRange(
float start,
float end,
int buffer_vertices,
float min);
164 void boostRightRange(
float start,
float end,
int buffer_vertices,
float min);
169 void boostRange(
float* boosts,
float start,
float end,
int buffer_vertices,
float min);
206 Colour fill_color_from_;
207 Colour fill_color_to_;
217 float fill_boost_amount_;
218 bool enable_backward_boost_;
222 bool last_drawn_left_;
223 bool last_negative_boost_;
225 bool any_boost_value_;
227 int num_line_vertices_;
228 int num_fill_vertices_;
229 int num_line_floats_;
230 int num_fill_floats_;
232 OpenGLShaderProgram* shader_;
233 std::unique_ptr<OpenGLShaderProgram::Uniform> scale_uniform_;
234 std::unique_ptr<OpenGLShaderProgram::Uniform> color_uniform_;
235 std::unique_ptr<OpenGLShaderProgram::Uniform> boost_uniform_;
236 std::unique_ptr<OpenGLShaderProgram::Uniform> line_width_uniform_;
237 std::unique_ptr<OpenGLShaderProgram::Attribute> position_;
239 OpenGLShaderProgram* fill_shader_;
240 std::unique_ptr<OpenGLShaderProgram::Uniform> fill_scale_uniform_;
241 std::unique_ptr<OpenGLShaderProgram::Uniform> fill_color_from_uniform_;
242 std::unique_ptr<OpenGLShaderProgram::Uniform> fill_color_to_uniform_;
243 std::unique_ptr<OpenGLShaderProgram::Uniform> fill_center_uniform_;
244 std::unique_ptr<OpenGLShaderProgram::Uniform> fill_boost_amount_uniform_;
245 std::unique_ptr<OpenGLShaderProgram::Attribute> fill_position_;
247 GLuint vertex_array_object_;
250 GLuint indices_buffer_;
252 std::unique_ptr<float[]> x_;
253 std::unique_ptr<float[]> y_;
254 std::unique_ptr<float[]> boost_left_;
255 std::unique_ptr<float[]> boost_right_;
256 std::unique_ptr<float[]> line_data_;
257 std::unique_ptr<float[]> fill_data_;
258 std::unique_ptr<int[]> indices_data_;
A base component class that integrates JUCE's Component with OpenGL rendering.
Definition open_gl_component.h:20
A component for rendering lines with optional filling and boost effects using OpenGL.
Definition open_gl_line_renderer.h:16
virtual void init(OpenGlWrapper &open_gl) override
Initializes OpenGL resources for rendering the line.
Definition open_gl_line_renderer.cpp:78
virtual void destroy(OpenGlWrapper &open_gl) override
Destroys OpenGL resources allocated by this line renderer.
Definition open_gl_line_renderer.cpp:468
force_inline float xAt(int index) const
Gets the x-coordinate of a point at a given index.
Definition open_gl_line_renderer.h:81
force_inline void setFillCenter(float fill_center)
Sets the vertical center for the fill area.
Definition open_gl_line_renderer.h:138
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the line using OpenGL.
Definition open_gl_line_renderer.cpp:464
force_inline void setYAt(int index, float val)
Sets the y-coordinate of a point, marking data as dirty.
Definition open_gl_line_renderer.h:98
force_inline void setFill(bool fill)
Enables or disables filling below the line.
Definition open_gl_line_renderer.h:124
void decayBoosts(vital::poly_float mult)
Decays all boosts by a multiplicative factor, allowing animated damping.
Definition open_gl_line_renderer.cpp:185
static constexpr int kLineFloatsPerVertex
Floats per vertex in the line data (x, y, and potentially others).
Definition open_gl_line_renderer.h:19
force_inline void setFillBoostAmount(float boost_amount)
Sets the boost amount that affects fill thickness.
Definition open_gl_line_renderer.h:147
force_inline void setBoost(float boost)
Sets a global boost value affecting line thickness.
Definition open_gl_line_renderer.h:69
static constexpr int kFillVerticesPerPoint
Number of vertices per point in the fill representation.
Definition open_gl_line_renderer.h:25
force_inline float boostLeftAt(int index) const
Gets the left-side boost at a given point index.
Definition open_gl_line_renderer.h:72
force_inline void setBoostAmount(float boost_amount)
Sets the boost amount that affects line thickness.
Definition open_gl_line_renderer.h:144
virtual ~OpenGlLineRenderer()
Destructor.
Definition open_gl_line_renderer.cpp:76
force_inline void setBoostRight(int index, float val)
Sets the right-side boost for a point, marking data as dirty.
Definition open_gl_line_renderer.h:91
force_inline void setFillColor(Colour fill_color)
Sets a uniform fill color if only one color is needed.
Definition open_gl_line_renderer.h:127
force_inline void setXAt(int index, float val)
Sets the x-coordinate of a point, marking data as dirty.
Definition open_gl_line_renderer.h:105
void boostRightRange(float start, float end, int buffer_vertices, float min)
Boosts right-side range of the line.
Definition open_gl_line_renderer.cpp:124
static constexpr int kFillFloatsPerVertex
Floats per vertex in the fill data (x, y, and boost value).
Definition open_gl_line_renderer.h:21
static constexpr int kLineVerticesPerPoint
Number of vertices per point in the line representation.
Definition open_gl_line_renderer.h:23
force_inline void setFit(bool fit)
Enables fitting the line inside the available area.
Definition open_gl_line_renderer.h:141
void setLineVertices(bool left)
Sets line vertices according to the current line and boost data.
Definition open_gl_line_renderer.cpp:236
force_inline void setFillColors(Colour fill_color_from, Colour fill_color_to)
Sets a gradient fill from one color to another.
Definition open_gl_line_renderer.h:132
bool anyBoostValue()
Checks if any boost value is set.
Definition open_gl_line_renderer.h:202
void setFillVertices(bool left)
Sets fill vertices according to the current line and boost data.
Definition open_gl_line_renderer.cpp:196
static constexpr int kLineFloatsPerPoint
Floats per point in the line data (6 vertices * 3 floats each).
Definition open_gl_line_renderer.h:27
OpenGlLineRenderer(int num_points, bool loop=false)
Constructs an OpenGlLineRenderer for a given number of points.
Definition open_gl_line_renderer.cpp:35
force_inline void setLineWidth(float width)
Sets the line width in pixels.
Definition open_gl_line_renderer.h:66
static constexpr int kFillFloatsPerPoint
Floats per point in the fill data (2 vertices * 4 floats each).
Definition open_gl_line_renderer.h:29
force_inline float yAt(int index) const
Gets the y-coordinate of a point at a given index.
Definition open_gl_line_renderer.h:78
force_inline void setColor(Colour color)
Sets the line color.
Definition open_gl_line_renderer.h:63
force_inline float boostRightAt(int index) const
Gets the right-side boost at a given point index.
Definition open_gl_line_renderer.h:75
void boostRange(float *boosts, float start, float end, int buffer_vertices, float min)
Boosts a range for the given boost array.
Definition open_gl_line_renderer.cpp:128
force_inline int numPoints() const
Gets the number of points in the line.
Definition open_gl_line_renderer.h:186
force_inline void setBoostLeft(int index, float val)
Sets the left-side boost for a point, marking data as dirty.
Definition open_gl_line_renderer.h:84
void drawLines(OpenGlWrapper &open_gl, bool left)
Draws the line and optional fill using OpenGL.
Definition open_gl_line_renderer.cpp:386
force_inline void setIndex(int index)
Sets an index used for custom behavior (e.g., multiple line sets).
Definition open_gl_line_renderer.h:150
void boostLeftRange(float start, float end, int buffer_vertices, float min)
Boosts left-side range of the line.
Definition open_gl_line_renderer.cpp:120
force_inline Colour color() const
Gets the current line color.
Definition open_gl_line_renderer.h:189
void enableBackwardBoost(bool enable)
Enables backward boost calculation for symmetrical line deformation.
Definition open_gl_line_renderer.h:183
#define VITAL_ASSERT(x)
Definition common.h:11
#define force_inline
Definition common.h:23
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600