Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Milkdrop user sprites and add API methods to control them #862

Merged
merged 11 commits into from
Feb 27, 2025

Conversation

kblaschke
Copy link
Member

Added user sprites as supported by Milkdrop, with the exception that projectM won't support color keying (which is broken in original Milkdrop anyway as the color isn't properly parsed and always set to black). All other sprite features are supported:

  • Loading images
  • Animating the sprite via expressions (location, size, rotation, texture repeat in both axes).
  • All four blend modes (as mentioned, mode 4 uses the texture alpha instead of a color key).
  • Code-controlled removal of a sprite.
  • Preset burn-in effect, both for the whole duration and when the sprite is "done".

Reason for this deviation is that OpenGL (or any other 3D API except for older DX versions) do not support a color key to be set for textures. In projectM, images with alpha channel support such as PNG, GIF, TIFF or DDS can be used to achieve transparency in blend mode 4. All other diplay modes work fine.

Another change is that projectM will properly keep the sprite's correct aspect ratio, which was also bugged in Milkdrop (it always scales the image as if a 4:3 render aspect is used).

Since sprites are solely user-supplied, these "fixes" should not create any issues.

By default, projectM will allow up to 16 concurrent sprites to be rendered, but this limit can be changed via the API. Setting it to 0 will disable sprites. The implementation uses a factory pattern, using a type nyme to identify the sprite type. This will allow us to add more sprite implementations without changing the API.

One open question: should be also add a method that returns a list of supported sprite types? This would make it easier for an application to detect supported sprite types.

This PR closes #734

@kblaschke kblaschke added this to the 4.2 milestone Dec 16, 2024
@kblaschke kblaschke self-assigned this Dec 16, 2024
@kblaschke kblaschke marked this pull request as ready for review February 27, 2025 14:43
@kblaschke kblaschke merged commit fa67d83 into projectM-visualizer:master Feb 27, 2025
9 checks passed
@kblaschke kblaschke deleted the user-sprites branch February 27, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Support Milkdrop user sprites
2 participants