-
Notifications
You must be signed in to change notification settings - Fork 317
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
components::ColorRGBA
should use an array
#2782
Comments
agreed! Either the struct as suggested or |
I think |
Let's improve the docs for 0.9, but not change the type until 0.10 |
### What * Related to #2782 ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3289) (if applicable) - [PR Build Summary](https://build.rerun.io/pr/3289) - [Docs preview](https://rerun.io/preview/cbd599a8e94ff31bff87f7ab42d5a6ac441b3d0d/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/cbd599a8e94ff31bff87f7ab42d5a6ac441b3d0d/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://ref.rerun.io/dev/bench/) - [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
I've improved the docs now, but will leave this issue open as a reminder to change the implementation to the more natural |
components::ColorRGBA
should either document how the public u32
works, or use an arraycomponents::ColorRGBA
should use an array
This is a Rust API design nitpick.
As of
rerun 0.7.0
,rerun::components::ColorRGBA
publicly uses au32
to store the color. This is an unnecessary complication, becauseu32
s have endianness which confuses the question of which color component ordering in memory is actually meant. (For example, on little-endian architectures — most computers today — the components are actually stored as what someone discussing image formats would call ABGR, not RGBA.) In my opinion, the representation should actually be either[u32; 4]
(with an explicitly documented meaning of each array index) or a structEither one of these nails down the memory representation unambiguously, and will be representation-compatible (i.e. transmutable) with someone else's RGBA color type when it's actually RGBA and not ABGR.
Another option is to make the existing
u32
field private, so that the interpretation of it is entirely an implementation detail ofrerun
.The text was updated successfully, but these errors were encountered: