Skip to content

Const all the floating point arithmetic #16124

@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

As seen in #16091, floating point arithmetic can now be used in constant functions! This is a valuable API improvement, as it allows users to define their own derived constants using our handy math operations.

What solution would you like?

We should constify our APIs, one crate at a time. The critical ones are:

  • bevy_math
  • bevy_color
  • bevy_ui

This should be kept to relatively simple functions and methods: only things that we can commit to being const indefinitely.

What alternative(s) have you considered?

Do let me know if I've missed a crate that needs this treatment!

Additional context

glam is open to making much of their API const which will unblock a ton of improvements in Bevy itself, although it's harder than one might expect there, due to SIMD support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ColorColor spaces and color mathA-MathFundamental domain-agnostic mathematical operationsA-UIGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-TrivialNice and easy! A great choice to get started with BevyS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions