Skip to content

Commit 511ccfd

Browse files
committed
Minor consistency change.
1 parent 8fc3f63 commit 511ccfd

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

shaders/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub fn fs(constants: &ShaderConstants, mut frag_coord: Vec2) -> Vec4 {
7575
let shader_input: ShaderInput;
7676
let shader_output = &mut ShaderResult { color: Vec4::ZERO };
7777

78-
if constants.grid == 0 {
78+
if constants.grid_mode == 0 {
7979
shader_input = ShaderInput {
8080
resolution,
8181
time,

shaders/src/shared_data.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ use bytemuck::{Pod, Zeroable};
44
#[derive(Copy, Clone, Pod, Zeroable)]
55
#[allow(unused_attributes)]
66
pub struct ShaderConstants {
7-
/// Boolean value indicating whether all shaders are rendered in a grid layout.
8-
pub grid: u32,
97
pub width: u32,
108
pub height: u32,
119
pub time: f32,
10+
11+
// UI state
12+
/// Boolean value indicating whether all shaders are rendered in a grid layout.
13+
pub grid_mode: u32,
14+
pub shader_to_show: u32,
15+
16+
// Mouse state.
1217
pub cursor_x: f32,
1318
pub cursor_y: f32,
1419
pub drag_start_x: f32,
@@ -17,5 +22,4 @@ pub struct ShaderConstants {
1722
pub drag_end_y: f32,
1823
pub mouse_left_pressed: u32,
1924
pub mouse_left_clicked: u32,
20-
pub shader_to_show: u32,
2125
}

src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ struct ShaderToyApp {
2929
shader_module: Option<wgpu::ShaderModule>,
3030
close_requested: bool,
3131
start: Instant,
32+
3233
// UI state
3334
grid_mode: bool,
3435
shader_to_show: u32,
36+
3537
// Mouse state.
3638
cursor_x: f32,
3739
cursor_y: f32,
@@ -250,7 +252,7 @@ impl ShaderToyApp {
250252
mouse_left_pressed: self.mouse_left_pressed as u32,
251253
mouse_left_clicked: self.mouse_left_clicked as u32,
252254
shader_to_show: self.shader_to_show,
253-
grid: self.grid_mode as u32,
255+
grid_mode: self.grid_mode as u32,
254256
};
255257
self.mouse_left_clicked = false;
256258
rpass.set_pipeline(self.render_pipeline.as_ref().unwrap());

0 commit comments

Comments
 (0)