Commit Graph

87 Commits

Author SHA1 Message Date
15a083751d Set warp texel offset to 0 by default, as 0.5 introduces a drift.
Since this might be vendor-specific behavior, a new API function to configure the X/Y texel offsets has been added.

Signed-off-by: Kai Blaschke <kai.blaschke@kb-dev.net>
2025-12-02 08:50:46 +01:00
631573a4f0 Add user sprite proxy functions to ProjectM class. 2025-02-27 15:55:14 +01:00
1ed2967e35 Add transition/blending progress to render context 2025-02-27 15:55:13 +01:00
a2e9a91651 Add a global shader cache 2025-02-27 15:55:07 +01:00
f94f99d888 Make preset transitions use TimeKeeper instead of the system clock 2024-06-09 13:04:01 +02:00
2914d85ec3 Add API functions to set and retrieve frame times
Setting a custom frame time will result in stable animation speeds if projectM does not render at real-time speeds, e.g. while encoding a video from an audio file as fast as possible.
2024-06-09 12:51:35 +02:00
b0cdf4de7b Add optional FBO ID parameter to render function.
This will allow external apps to pass in any custom FBO to render to. Defaults to 0, keeping previous behavior if not given.
2024-06-08 17:22:23 +02:00
bd7d5574a2 Keep active preset running if loading fails.
Also don't cancel any transition in progress etc., so if the app retries with a different preset, we only smoothly transition to the new, working one.
2024-02-06 15:11:52 +01:00
a1d300f48c Include cleanup, plus a few small code improvements.
Also removed empty FrameAudioData implementation file.
2024-02-02 15:08:05 +01:00
27f3308ac3 Remove utterly useless multithreading switch
Since we're using OpenGL, everything has to be done in the same thread anyways. Besides that, the actual "multithreading" implementation was basically starting an empty thread that did absolutely nothing, then wait synchronously for it to complete and join it on the next frame.
2024-02-02 15:08:04 +01:00
7e45cbe1f9 Clean up minor warnings and code style
* Remove warnings for code in vendor folders
* Add pedantic and extra warnings in GCC only to projectM sources
* Rename ResetOpenGL to SetWindowSize
2024-02-01 11:27:10 -06:00
9762297909 Properly namespace all classes under "::libprojectM" 2023-12-30 14:56:35 +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
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
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
7b8af19fc4 Deleted the now unused Renderer class. 2023-10-24 16:39:37 +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
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
879c6c7111 Split StaticGlShaders class into shader files and code templates, removed ShaderEngine class.
Milkdrop shaders are now read from .vert/.frag and .inc files, then copied into a generated code file by CMake. Makes editing easier, as many IDEs can properly syntax-highlight the shader code.

The class was also moved into MilkdropPreset, as it's the only preset type which will ever make use of those shaders.

Deleted the now fully "dissolved" ShaderEngine class.
2023-09-11 10:19:48 +02:00
0ac9fe20f3 Finished final composite implementation, more fixes and cleanups.
Now rendering everything upside down to make up for the difference in UV coordinates in HLSL shaders.
2023-09-11 10:19:47 +02:00
ce0e5853b2 More work on shader stuff, warp/comp shaders now compile properly.
Fixed a transpile issue with a hack used by some preset authors to set a texture sampler to a different filter/wrap mode, removing the "sampler_state" block entirely now as there's no GLSL equivalent (samplers are solely configured on the application side).

Also consolidated a few vertex types into RenderItem and fixed a few old-school effects like DarkenCenter.
2023-09-11 10:19:47 +02:00
e603793402 Finished per-pixel mesh, started rework of warp/comp shaders and textures.
Moved per-pixel mesh texture coordinate calculations into the vertex shader. This is probably more performant than the SSE2 code in the old PresetFrameIO class, as the GPU is better at running this stuff in parallel.

All the texture management also needs some refactoring, so now that I've already broken everything, I can just do it as well.
2023-09-11 10:19:47 +02:00
102d4ba4cf Overhauled all primitives (waves, shapes and borders).
Now using Milkdrop's DX9 coordinate system for all vertex positions and have the vertex shader take care of transforming these into the OpenGL screen space. Makes calculations easier.

Also continued implementing per-pixel mesh and shader stuff.
2023-09-11 10:19:47 +02:00
e73b0f3092 Working on getting stuff being rendered again, focus on default waveform.
Fixed many typos, errors and crashes on the way.
2023-09-11 10:19:47 +02:00
e48e6f3962 Remove call to deleted function. 2023-09-11 10:19:46 +02:00
e7094aa190 Remove "Pipeline" classes and temp fix all compilation issues. 2023-09-11 10:19:46 +02:00
882321000b More rendering refactoring.
Continued refactoring work to make Milkdrop preset rendering more self-contained.
2023-09-11 10:19:45 +02:00
b9ef6a3974 Remove old expression parser and add the new projectm-eval lib.
Requires a general rewrite of the Milkdrop preset code. Previous implementation was tightly integrated into the code parser, so reusing this code wasn't possible. Additional refactoring was done, finished converting custom wave/shape implementations to use the new expression parser code.
2023-09-11 10:19:45 +02:00
46e720a7a7 Removed unused projectm_opengl_init_render_to_texture() API function. 2023-01-25 18:10:26 +01:00
e6b493a270 Removed unused projectm_set_texture_size() API function. 2023-01-25 18:09:02 +01:00
2b41fa256a Let developers provide an optional filename for dumping main texture contents. 2023-01-25 14:22:19 +01:00
bcaf98f2f1 Rename USE_THREADS to PROJECTM_USE_THREADS and export it in the package config file.
PROJECTM_USE_THREADS is only exported if ENABLE_CXX_INTERFACE is ON.
2023-01-24 17:56:12 +01:00
bff9e52c69 Reduce header footprint of optional C++ API files and export C++ symbols properly. 2023-01-24 17:47:39 +01:00
c8077a2145 Partially fix smooth blending.
There's still a sudden change between presets halfway through the transitions as the shaders are swapped, but fixing this would require a larger rewrite of how presets are rendered in the pipeline. Will do this later.
2023-01-07 15:52:51 +01:00
3dcb1f7a56 Fix preset change notification. 2023-01-07 15:52:51 +01:00
48f291b51c Removed config file support and added temp fix for mesh size change.
Mesh size is currently so deeply burrowed in the whole preset structure that changing it on the fly is basically impossible. For now, we'll reload the idle preset and reset the whole preset factory class tree to make sure all classes are properly reinitialized. If apps want to change the mesh size after startup, they need to reload the last played preset after changing the mesh size. This will be fixed in the future after the parser/equation compiler rewrite.
2023-01-07 15:52:50 +01:00
bbfc4f7170 Added API method for (re)setting texture search paths.
Was only possible on startup before, changing the paths required recreating the whole projectM instance. Now, the method will only reset the texture manager, but not the shaders and presets.
2023-01-07 15:52:50 +01:00
22b0ccc423 Removed some unused offset parameters in Renderer methods. 2023-01-07 15:52:46 +01:00
2410adc92e Fix file type string 2023-01-05 07:24:26 -06:00
e659d862b5 Remove built-in key handler and rename two API functions.
Renamed preset lock functions to be in line with all other getter/setter functions regarding their naming scheme.
2022-12-30 15:14:25 +01:00
b585017ba3 Fix a compile issue in emscripten by forward-declaring PipelineContext. 2022-12-06 15:03:10 +01:00
381fe4f51e Properly initialize idle preset and preset factory. 2022-12-04 21:51:36 +01:00
94ee2a360b Added remaining API functions and preset change callback. 2022-11-21 19:56:30 +01:00
2b1099a653 Implement external preset switching control and add stream loading support.
Lots of interconnected changes in this commit:
- Removed unnecessary name/author/filename members all over the place.
- Started using exceptions to deliver preset loading and rendering errors to the topmost ProjectM class.
- Added stream loading methods to factories and the base Preset class.
- Added new events for requesting preset switch and telling the user about loading errors.
- Consolidated preset switching logic in ProjectM class a bit.
2022-11-21 19:56:30 +01:00
b23b5ce25c Deleted all playlist-related code from libprojectM.
Note: SDL test UI won't compile after this commit. Will be fixed in a later commit, when the playlist library is done.
2022-11-21 19:56:28 +01:00
18b032a8ef API: Add missing setter for FPS value.
Also make sure to propagate the changed value to the preset code via the PipelineContext class. Keeping it in the settings struct for now. Storing a dynamic value in settings makes no sense, so it will be removed later.
2022-11-20 16:53:25 +01:00