Skip to content

Commit

Permalink
Make params mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
johanhelsing committed Aug 16, 2022
1 parent d6d9377 commit 2946b97
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn setup(
color,
sdf: box_sdf.clone(),
frame: Frame::Quad(f32::max(size.x, size.y) + padding),
params: Some(Vec4::new(size.x, size.y, 0., 0.)),
params: Vec4::new(size.x, size.y, 0., 0.),
..Default::default()
},
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct SmudShape {
/// Parameters to pass to shapes, for things such as width of a box
// perhaps it would be a better idea to have this as a separate component?
// keeping it here for now...
pub params: Option<Vec4>,
pub params: Vec4,
}

impl Default for SmudShape {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ var<uniform> time: Time;
#[derive(Component, Clone, Debug)]
struct ExtractedShape {
color: Color,
params: Option<Vec4>,
params: Vec4,
frame: f32,
sdf_shader: Handle<Shader>, // todo could be HandleId?
fill_shader: Handle<Shader>, // todo could be HandleId?
Expand Down Expand Up @@ -594,7 +594,7 @@ fn queue_shapes(
// | ((color[3] * 255.0) as u32) << 24;

let color = extracted_shape.color.as_linear_rgba_f32();
let params = extracted_shape.params.unwrap_or_default().to_array();
let params = extracted_shape.params.to_array();

let position = extracted_shape.transform.translation();
let z = position.z;
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ fn prepare_ui_shapes(
}

let color = extracted_shape.color.as_linear_rgba_f32();
let params = extracted_shape.params.unwrap_or_default().to_array();
let params = extracted_shape.params.to_array();

let position = position.into();
// let position = Vec3::ZERO.into();
Expand Down

0 comments on commit 2946b97

Please sign in to comment.