Convert colors to linear RGB before uploading in solid pipelines
This commit is contained in:
parent
b957453404
commit
6246584209
2 changed files with 9 additions and 5 deletions
|
|
@ -63,13 +63,15 @@ impl Program {
|
||||||
}
|
}
|
||||||
|
|
||||||
if color != &self.uniform_data.color {
|
if color != &self.uniform_data.color {
|
||||||
|
let [r, g, b, a] = color.into_linear();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
gl.uniform_4_f32(
|
gl.uniform_4_f32(
|
||||||
Some(&self.uniform_data.color_location),
|
Some(&self.uniform_data.color_location),
|
||||||
color.r,
|
r,
|
||||||
color.g,
|
g,
|
||||||
color.b,
|
b,
|
||||||
color.a,
|
a,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,11 @@ pub(super) struct Uniforms {
|
||||||
|
|
||||||
impl Uniforms {
|
impl Uniforms {
|
||||||
pub fn new(transform: Transformation, color: Color) -> Self {
|
pub fn new(transform: Transformation, color: Color) -> Self {
|
||||||
|
let [r, g, b, a] = color.into_linear();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
transform: transform.into(),
|
transform: transform.into(),
|
||||||
color: Vec4::new(color.r, color.g, color.b, color.a),
|
color: Vec4::new(r, g, b, a),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue