Commit Graph

2180 Commits

Author SHA1 Message Date
0dfefc2fa4 Fixed Windows build with latest SDK
Made changes to pmSDL.hpp in order to fix build errors related to order of included Windows libraries.
2023-12-29 22:27:48 +01:00
9b03314d19 Fix generator expressions showing up in pkgconfig files
Instead of using these expressions, adding "lib" in fron of static libs is now done via CMAKE_STATIC_LIBRARY_PREFIX when building static libs on Windows.
2023-11-26 13:52:10 +01:00
1e0f8c6b10 Fix position of headphones in idle preset.
Now that everything renders in the right orientation, the idle preset's headphones coordinates were a bit off, rendering at the bottom of the M logo.
2023-11-25 14:44:45 +01:00
b85b631c68 Fix shading language version detection when using WebGL
WebGL doesn't follow the OpenGL standard format for the glGetString(GL_SHADING_LANGUAGE_VERSION) return value. Chrome for example will return "OpenGL ES GLSL ES 3.00 (WebGL GLSL ES 3.00 (OpenGL ES GLSL ES 3.0 Chromium))", which does not start with the version number as the standard suggests.

This fix will simply cut off any text preceding the first digit found in the string, if any.
2023-11-25 03:36:53 +01:00
9c68339d1d Fixed some Doxygen comments in the audio headers. 2023-11-24 23:51:10 +01:00
cf7d08c2ff Consolidate how update methods are called.
Directly passing references to the affected members is easier to read in the main UpdateFrameAudioData() method.
2023-11-24 21:00:40 +01:00
f7f7f96638 Fix upper bound of frequency band calculation.
The "+1" somehow disappeared at some point...
2023-11-24 21:00:40 +01:00
36fb09ce30 Implemented waveform alignment algorithm.
Also consolidated the waveform sample count constant to keep it aligned over all classes.
2023-11-24 21:00:40 +01:00
69d2134fa2 Rewrite of audio data processing/beat detection.
Consolidated audio processing code into the PCM class, removing the BeatDetect class in the process. Beat detection now uses the same algorithm as Milkdrop, passing the proper relative bass/mid/treb values to presets. Makes many presets look less jumpy/flickering, as the values are now (smoothly) alternating around 1.0.

Updating frame audio is now done in a function that must specifically be called. Any subsequent calls to GetFrameAudioData() will then return the exact same copy of the audio data. As of now with the exception that new waveform data may be passed in via a separate thread, which will then be returned and might not match the spectrum data. Will fix that in a later commit.
2023-11-24 21:00:39 +01:00
045b05fa95 Replaced FFT implementation.
Removed the previous FFT algorithm, now using a modernized version of the original Milkdrop FFT transform which also has both an equalizer and frequency envelope, making it slightly more sophisticated.

Modernization mainly included replacing raw pointer arrays with std::vector and using STL types/functions for the calculation, specifically std::complex as the FFT heavily uses these numbers. This makes the code more compact and readable.

Manually tested both original and modernized versions of the class to test if the algorithm still returns the exact same results, which is the case.
2023-11-24 21:00:35 +01:00
e2617da5b9 Fix 1px of warped main image shining through the composite mesh at higher resolutions.
Now we don't add the half texel offset to the vertex coordinates, but to the calculated u/v, which will prevent the texture wrapping (happens mostly with "nearest" interpolation lookups) mentioned in Milkdrop's code from happening, but make the mesh exactly fill the screen.
2023-11-16 15:40:57 +01:00
f9bc83d636 Flip input to blur textures once, but not in subsequent passes. 2023-11-14 16:11:13 +01:00
9a73a883df Use our own Pi constant, as the Windows cmath header doesn't have the definition. 2023-11-11 17:41:00 +01:00
5e54983e6d Replace temp framebuffer blit with a final draw call in ProjectM class
This avoids two fullscreen draw calls during transitions, and should also be slightly faster than using glBlitFramebuffer().

As with all drawing operations, we currently don't really care about the target framebuffer size or aspect ratio and just draw a quad over the whole viewport.
2023-11-07 23:45:59 +01:00
aaf2f7485c Initialize new presets with the last frame of the previous preset.
This makes hard transitions a bit "smoother", as they won't always start from a black screen. Not really noticeable with fast presets, but some slow-warping ones will now gently dissolve the previous image.
2023-11-04 18:59:30 +01:00
29cc30a6a8 Generalize FlipTexture class as "CopyTexture" with optional x/y flip.
Also removed the use of MilkdropPreset's PresetState class and add a class-specific copy shader.
2023-11-04 18:59:30 +01:00
e99ae49c49 Added a few more transition effects. 2023-11-02 23:14:31 +01:00
c9b0ce0c2c Render random transitions.
The TimeKeeper-based "smoothing" code still needs to be cleaned up, same with the threading stuff which never really worked.
2023-11-01 23:16:30 +01:00
1ba6b1a25f Make sweep transition compile. 2023-11-01 23:14:10 +01:00
3b4149ef89 Fix a few issues in the transition effect renderer. 2023-11-01 23:13:45 +01:00
a179c0a986 Added transition shader manager for built-in effects. 2023-11-01 23:07:26 +01:00
cdb19bc0e8 Fix compiler warning: used struct instead of class. 2023-11-01 22:08:36 +01:00
b2dad28fa0 Pack transition shaders into a resource header.
Also added a "sweep" transition.
2023-11-01 22:07:02 +01:00
9191ff149e Add PresetTransition class to render the transition quad/shader.
Also added the required shader files. Still need to pack them as resources into the library.
2023-10-24 20:38:04 +02:00
37ec15d13b Add uniform setters for int[2..4] vectors in Shader class. 2023-10-24 19:31:42 +02:00
42966cdb7b Add method in Preset class to retrieve the current output texture. 2023-10-24 19:30:46 +02:00
2dfbb595cc Move MilkdropNoise class to Renderer directory.
It's only referenced from within TextureManager, plus we can reuse the noise generator for other things.
2023-10-24 16:41:30 +02:00
7b8af19fc4 Deleted the now unused Renderer class. 2023-10-24 16:39:37 +02:00
6645b9da00 Move shading language version parser to Shader class.
Also cleaned up the code a bit, the version string format is well-defined by the standard - we just have to cut off anything after the space if there is any.
2023-10-20 22:03:45 +02:00
8461bb9586 Remove a few compiler warnings due to type conversions.
Many of those internal types need a cleanup later to consolidate them a bit more.
2023-10-14 13:53:41 +02:00
ceca33a088 Don't reset presets after changing the mesh size.
The warp mesh is now always resized/recalculated dynamically when a frame is drawn, nothing needs to be reloaded anymore.
2023-10-14 13:52:35 +02:00
f7b503efc4 Constrain per-pixel mesh size from 8x8 to 300x300 and only allow multiples of two. 2023-10-14 13:37:13 +02:00
2f93d3f41b Reimplement random texture selection.
Use the same basic logic as Milkdrop. Also automatically declare a shorthand "texsize_randXX" uniform for prefixed random texture names as preset authors expect.
2023-10-06 22:11:09 +02:00
116de5733c Fix upside-down and vertical effect misalignment issues.
If anyone else can come up with a solution that doesn't involve up to three vertical flips, please implement.
2023-10-06 22:11:02 +02:00
483b32d546 Set library base name once in top-level CMakeLists.txt.
Will avoid making errors in future versions. Include dirs still are hard-coded, as they partially exist as paths in the source tree.
2023-10-06 12:51:22 +02:00
ce56c3ed09 Fix filenames of static libraries.
These were missing the "-4" suffix, and the static playlist library also used underscores instead of dashes.
2023-10-06 12:41:43 +02:00
b88f96b780 Fix CMake scripts, so they can be used via add_subdirectory(). 2023-09-19 18:38:43 +02:00
c08de98a7d Properly initialize u/v texture size for motion vectors. 2023-09-11 10:19:49 +02:00
48b8d6a0aa Restore framebuffer bindings after modifying texture attachments. 2023-09-11 10:19:49 +02:00
c266599933 Instead of color masking, attach/detach the motion vector u/v texture.
Only GLES 3.2 supports glColorMaski, which would exclude any platforms only supporting GLES 3.0 or 3.1, so we simply change the color attachment accordingly. This change also improves VRAM usage, as now there's only a single u/v texture used for both framebuffers as required.
2023-09-11 10:19:49 +02:00
561ea8cf8b Added methods to Framebuffer class to add externally created texture attachments and remove existing ones. 2023-09-11 10:19:49 +02:00
b05a8cc812 GLES: Use GL_BACK instead of GL_COLOR_ATTACHMENT0 with default framebuffer. 2023-09-11 10:19:49 +02:00
494718d2fa Added missing float precision specifiers in vertex/fragment shaders. 2023-09-11 10:19:49 +02:00
b7572ea936 Use glDrawBuffers instead of glDrawBuffer with GLES. 2023-09-11 10:19:49 +02:00
1c93302b7d Removed a few unused files. 2023-09-11 10:19:49 +02:00
a294b8a374 Fix two Emscripten/GLES compile issues. 2023-09-11 10:19:49 +02:00
b07163dd51 Check active preset after the preset switch event, as this might have failed.
Another option would be skipping the rendering if there's no active preset instead of displaying the idle preset.
2023-09-11 10:19:48 +02:00
e9438ee0f6 Deleted lots of unused files and code. 2023-09-11 10:19:48 +02:00
486c86cb7c Filename fix in comment. 2023-09-11 10:19:48 +02:00
e84acbca92 Renamed simple textured/untextured shaders to be more readable. 2023-09-11 10:19:48 +02:00