WIP: Add SpectralColor type#24447
Draft
coreh wants to merge 2 commits into
Draft
Conversation
amtep
reviewed
May 26, 2026
Contributor
amtep
left a comment
There was a problem hiding this comment.
Hope you don't mind that I reviewed a draft :) I have some doc fixes and one question.
| #[cfg(feature = "bevy_reflect")] | ||
| use bevy_reflect::prelude::*; | ||
|
|
||
| /// A color produced by monochromatic light. (of a single wavelength) |
Contributor
There was a problem hiding this comment.
Suggested change
| /// A color produced by monochromatic light. (of a single wavelength) | |
| /// A color produced by monochromatic light (which is light of a single wavelength). |
| luminance: 1.0, | ||
| }; | ||
|
|
||
| /// Create a new spectral color with the given wavelength, luminance. |
Contributor
There was a problem hiding this comment.
Suggested change
| /// Create a new spectral color with the given wavelength, luminance. | |
| /// Create a new spectral color with the given wavelength and luminance. |
|
|
||
| let xyza = Xyza::new(x, y, z, 1.0); | ||
|
|
||
| let mut linear = Color::from(xyza).to_linear(); |
Contributor
There was a problem hiding this comment.
I checked, and for rows 43 to 57 this generates a linear color with the red value above 1.0, with a max of 2.5166698. Is that okay? LinearRgba says [0.0, 1.0] in its docs for the fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: This PR has been extracted from #14822
Objective
Solution
SpectralColortype, along with a CIE 1931 lookup table for 2-deg XYZ color matching function for conversion to tristimulus color spacesTesting