hi all,
This is just a little projet inspired by the open-source CoverJuke (sourceforge.net) and rewrite with and for Juce. This is a cool initial project but write for SDL & Cie. There is 3 important rewritten classes : Context, OpenGL, Plugin.
CoverFlowContext
This is the main thread managing the animation. The class is thread safe, so you can use it without problem i think.
You can add easily a 2D background and foreground to our 3D scene by using Juce Image classe. And access to few globals parameters.
This main classe inherit of :
CoverFlowOpenGL
That is the class that manage the OpenGL work. In principle, you don’t need to have to work with, all the operations are managed by the context.
CoverFlowPlugin
This is a factory for the actual plugins (6 differents animations). Very simple way to do, not the better but work great. The previous CoverFlowOpenGL call the process() of this and the classe work with the selected strategy (plugin).
CoverFlowPluginInterface
This is just a base class from all the plugins are derivated. A simple pure virtual.
CoverFlowPluginXXX
Where XXX can be Original, Circle, Vista, XBox, Tera & Power. Each one is just few lines of code to generate specific mode of rendering.
Original (iTunes like)
Power
Tera
Vista
Circle
XBox
I’ve add for the demo :
CoverFlowComponent
This is a “bad way to write” class, just for the demonstration of the principle of 2D background & foreground generated “on the fly”. Look at that you will read some of my stupid code :? It is a spaghetti way to do the loading of textures.
In this ZIP archive you will find a Win32 version of the project that use :
coverflow.exe
A little executable of the project
coverflow.xml
Is the definition of the cover. The artist name, the title of the song, and the name of the picture in the subdirectory. One more time it’s just for the demo.
/covers/
A subdirectory that contain few covers. Don’t hesitate to test with highest quality pictures !
The main idea :
The concept is simple.
-
I produce “on the fly” the background picture that is a gradient fill with a tile fill with opacity. The idea is to share the background between the Juce component background and the OpenGL background. You can resized the window, the background is regenerated “on the fly” to the right size. Why do that ? Because i need to “synchonize” the 2D background of the OpenGL component with the Juce component. In this case, the diagonal tiles are perfectly maintain and the illusion is correct.
-
The OpenGL “coverflow” is draw. Note that I add a black stroke around the covers after the loading.
-
I produce a second “on the fly” picture for the foreground. The only difference between background and foreground is the Color type. The background is RGB and the foreground is RGBA to allow transparency over the 3D scene. The mini-cover, the stars, and the text are generated “on the fly” too.
-
I can add my Combobox and my Scrollbar in the bottom of my component. The illusion is correct.
The code of the OpenGL animation can be easily extended, there’s already some unused parameters like :
[list]
Scene Zoom
Horizontal & Vertical Move
Horizontal & Vertical Angle
The size of the reflection
The aspect ratio of the covers …[/list]
The Picking mode work (the mouse click in the z-order 3D scene) but can be enhanced too.
I hope you like that ! Maybe someone will be interrested to work on this project and make it a real “CoverFlowComponent” for Juce. I don’t have time to do that.
This is a little gift for this new year If you want I can post a really cool FFT-based Vu-Meter that is really incredible.
Sorry for my poor english.,
Max
Note about the sources : Because I work now with the latest GIT version of Juce. There’s some changes on the graphics classes, so I have add a #define JUCE_GIT in the “includes.h”. If you work with the current stable release (1.50) you need to put this one to 0 (or comment the line).
[attachment=0]coverflow-src.zip[/attachment]