projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.22k stars 364 forks source link

Visitor pattern in renderitem implemented in waveform #719

Closed mauricio790 closed 9 months ago

revmischa commented 11 months ago

Cool... what is it? Could you please describe what you did and why and maybe a screenshot if relevant? Thanks for your contribution!

kblaschke commented 11 months ago

The whole RenderItem structure was kind of a pain in the ass, and was completely refactored in my current working branch for the 4.1 release. I kept the class, but turned it into a base class containing a few often-used OpenGL members (coordinates, VBO/VAO IDs), but the old way of adding items to a list and rendering them is gone, as it was really hard to debug, plus following the rendering order was nearly impossible.

Please have a look at the branch, which is almost ready for merging, and see if you find some potential of applying the idea there:

https://github.com/kblaschke/projectm/tree/rewrite-preset-parser/src/libprojectM

kblaschke commented 9 months ago

I've just merged PR #716 into master, which has removed the above RenderItem ping-pong game between MilkdropPreset and Renderer. The whole Milkdrop preset rendering is now confined in the MilkdropPreset submodule, while Renderer now (mostly) contains classes supporting specific rendering objects like textures, shaders and framebuffer in an attempt to encapsulate more and more render API specific functionality in classes, so it'll be easier to port projectM to other rendering APIs like Vulkan in the future.

I'll close this PR as there's no longer a need to implement a visitor pattern for these rendering items as they're rendered in a fixed, specific order from the MilkdropPreset class.