Skip to content

Conversation

@Daynlight
Copy link
Owner

@Daynlight Daynlight commented Dec 20, 2025

This pull request refactors how points are managed and drawn in the plotting examples, standardizing the use of the Plot2D class and simplifying point rendering logic. The changes remove manual array management of points, instead leveraging Plot2D's point_cell for storage and rendering. Additionally, the resource management in Plot2D is updated to use automatic stack allocation rather than raw pointers.

Refactoring and simplification of plotting logic:

  • Replaced manual arrays of Point objects with the use of Plot2D::point_cell for storing and managing points in Examples/Curve Bezier/Graphite.cpp and Examples/Sin/Graphite.cpp. Drawing is now handled by a single call to plot.draw(), removing explicit loops over points. [1] [2] [3] [4] [5] [6]
  • Updated the plotting example in Examples/Plots/Graphite.cpp to use plot.point_cell for consistent point management.

Code cleanup and dependency management:

  • Removed unnecessary includes such as Plot2D.h, Math.h, and stdio.h from example files, reducing dependencies and improving clarity. [1] [2] [3]

Resource management and rendering improvements in Plot2D:

  • Refactored Plot2D to use stack-allocated Mesh and DrawShader objects instead of raw pointers, simplifying construction, destruction, and usage of these objects. [1] [2] [3] [4]
  • Updated the drawPoint method to use the new stack-allocated objects and modernized method calls (e.g., using shader.bind() instead of shader->bind()).

These changes collectively make the plotting code more robust, easier to maintain, and less error-prone by leveraging higher-level abstractions and modern C++ practices.

@Daynlight Daynlight merged commit 380849a into dev Dec 20, 2025
@Daynlight Daynlight deleted the full_plot branch December 20, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants