Commit Graph

2787 Commits

Author SHA1 Message Date
484c3579d7 Fix a memory leak in HLSLMacro class due to use of std::string.
The HLSLMacro struct is manually malloc'd, not using new/delete, so the std::string destructor is never called on the instance stored in the class.

Fixed by using a char* allocated by HLSLTree, which will then properly take care of deleting it after parsing is complete.
2024-01-19 11:57:06 +01:00
7cb79fe5b5 Improve robustness and fix leaking of hlslparser's Array memory management. 2024-01-19 11:57:06 +01:00
04bf637aa1 Make X wave rotatable via "mystery" wave parameter.
Addition from Incubo's BeatDrop code.
2023-12-30 15:07:05 +01:00
37352ee667 Added additional test presets for the waveform modes. 2023-12-30 14:56:35 +01:00
74ed428430 Added seven additional waveform modes from Milkdrop 3
Waveform code was kindly provided and used with permission by Milkdrop2077.

Had to make a few amends though, as some sample offsets went over the allocated waveform sample count (>480), leading to memory issues.
2023-12-30 14:56:35 +01:00
1350028430 Move default waveform math to separate classes.
Gets rid of this hube WaveformMath() function and provides a framework to easily add more wave modes.
2023-12-30 14:56:35 +01:00
9762297909 Properly namespace all classes under "::libprojectM" 2023-12-30 14:56:35 +01:00
39605b645a Fixed a few compiler warnings. 2023-12-30 14:56:35 +01:00
b9eae98279 Added line in .gitignore to avoid pushing dependencies installed via vcpkg 2023-12-29 22:28:30 +01:00
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
2911adfb40 Moved build-gtest to the projectm namespace 2023-12-27 16:30:37 -06:00
102aef23e0 Update emsdk version to current release 3.1.51 2023-12-27 16:30:37 -06:00
150436b381 Update mymindstorm/setup-emsdk GitHub Action to v13 2023-12-27 16:30:37 -06: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
2f14cc1972 Updated 'Windows' section of the BUILDING docs 2023-11-16 15:01:37 -06:00
4b6421b168 Added gtest to vcpkg dependencies 2023-11-16 15:01:37 -06:00
42edc62ea1 Remove dependency install from Windows github action 2023-11-16 15:01:37 -06:00
0c86ed25ef Added vcpkg configuration. Contributor: @insel-maz 2023-11-16 15:01:37 -06: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
0a0fd082cf Update projectm-eval submodule commit 2023-11-11 17:40:57 +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