Convert colors to linear RGB before uploading in solid pipelines

This commit is contained in:
Héctor Ramón Jiménez 2022-11-03 04:37:23 +01:00
parent b957453404
commit 6246584209
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 9 additions and 5 deletions

View file

@ -63,13 +63,15 @@ impl Program {
}
if color != &self.uniform_data.color {
let [r, g, b, a] = color.into_linear();
unsafe {
gl.uniform_4_f32(
Some(&self.uniform_data.color_location),
color.r,
color.g,
color.b,
color.a,
r,
g,
b,
a,
);
}

View file

@ -20,9 +20,11 @@ pub(super) struct Uniforms {
impl Uniforms {
pub fn new(transform: Transformation, color: Color) -> Self {
let [r, g, b, a] = color.into_linear();
Self {
transform: transform.into(),
color: Vec4::new(color.r, color.g, color.b, color.a),
color: Vec4::new(r, g, b, a),
}
}
}