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

Fixed #788: Encode/derive case classes as UniformBlocks #789

Merged
merged 2 commits into from
Nov 17, 2024

Conversation

davesmith00000
Copy link
Member

The main goal of this PR is to drastically improve how easy it is to send data to shaders. We've gone from having to know about all of this:

ShaderData(
  Shaders.externalId,
  UniformBlock(
    UniformBlockName("CustomData"),
    Batch(
      Uniform("ALPHA")        -> float(0.75),
      Uniform("BORDER_COLOR") -> vec3(1.0, 1.0, 0.0)
    )
  )
)

...to a very familiar this:

ShaderData(Shaders.externalId)
  .addUniformData(CustomData(0.75, RGB(1.0, 1.0, 0.0)))

final case class CustomData(ALPHA: Float, BORDER_COLOR: RGB) derives ToUniformBlock

The conversion process supports all the same types we used to support, but now we don't need any specialised syntax - WHICH MEANS - all the old imports for shaders have gone - WHICH MEANS - no more term/import collisions with Ultraviolet!! 🎉

Additional clean up work done in this PR:

  • Deprecates BlendShaderData
  • Removes all shader primitives from the default import
  • Removes import indigo.shaders.* - not needed
  • Moves ShaderData to live with Shader classes, rather than Material classes
  • ShaderData no longer unnecessarily extends Material

@davesmith00000 davesmith00000 requested a review from a team November 16, 2024 16:49
@davesmith00000 davesmith00000 self-assigned this Nov 16, 2024
@davesmith00000 davesmith00000 merged commit 4914755 into main Nov 17, 2024
2 checks passed
@davesmith00000 davesmith00000 deleted the issue/788/derive-uniform-blocks branch November 17, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant