Commit Graph

2158 Commits

Author SHA1 Message Date
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
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
ef62ddf480 Add omptl to Renderer linked library list. 2023-09-11 10:19:48 +02:00
feb7a3330a A few Windows build fixes 2023-09-11 10:19:48 +02:00
4b3226ac3a Added projectM-Eval as submodule, flipped rendering stuff around a bit more. 2023-09-11 10:19:48 +02:00
74bd99a46f Fix idle preset and filters, load logo textures y-flipped.
Idle preset doesn't render the same way as before, as it was presumably adapted to projectM's previous math. It's now a bit more complex, with the M tilting, a sine waveform at the bottom and some other tweaks.

The filter mesh was broken, so the effects didn't render at all.
2023-09-11 10:19:48 +02:00
75fe0f0ede Fixed more UV coordinate issues in the warp shader.
Main issue was a wrong -, replaced with + in the rotation calculation. Plus we shouldn't negate the Y pos, as this may mess up UV calculations done in HLSL.
2023-09-11 10:19:48 +02:00
2707a1d221 Fix uv_orig coordinates in warp shader.
Should fix visuals in about half of the presets.
2023-09-11 10:19:47 +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
df7cd08bdc Fill both spectrum channels with data. 2023-09-11 10:19:47 +02:00
f88fe7018e Fix wrong assignment in per-frame context. 2023-09-11 10:19:47 +02:00
904292e577 Implemented motion vector grid.
Have to do the motion reverse-propagation on the GPU, as the warp mesh is also calculated there. This is done storing the U/V warp coordinates in a separate texture attachment and then read the (already interpolated) coordinate in the next frame.

Added a second color buffer output to the HLSL shader to accomplish it with both the default warp shader and preset-supplied ones. Luckily, the HLSL transpiler knows what to do.

Since all framebuffer textures must match in size, this adds a bit more VRAM usage. We also need to mask all other draw calls from writing to the second texture expect in the warp shader.
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
09607a29c9 Fix issues with the framebuffer implementation and reenable it.
Mainly forgot to call glDrawBuffers() and created the color attachment with a completely wrong pixel format specifier.
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
62b84ef724 Added a framebuffer class for drawing the presets into. 2023-09-11 10:19:47 +02:00
7db50da0c9 A few fixes for warnings etc. 2023-09-11 10:19:46 +02:00
6e49989301 Fixed some typo, added missing call to RegisterBuiltinVariables(). 2023-09-11 10:19:46 +02:00
e48e6f3962 Remove call to deleted function. 2023-09-11 10:19:46 +02:00
a55fa071b4 Fix a few linker issues with the eval lib. 2023-09-11 10:19:46 +02:00
5c5bb0a147 PresetFileParser: Fix line reader and a compiler warning, re-add tests.
Don't skip lines with no data after "=", as there are many presets with empty code lines. skipping it would create a gap in the line numbers, aborting the loop in GetCode() early.
2023-09-11 10:19:46 +02:00