Skip to content

Commit 2fbe92f

Browse files
committed
fix: mesh2d_vertex_output is no longer from forward_io for 2d shaders
1 parent 5ddbdaf commit 2fbe92f

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

Diff for: assets/shaders/myshader_2d.wgsl

+4-7
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
#import bevy_sprite::mesh2d_view_bindings::globals
77
#import shadplay::shader_utils::common::{NEG_HALF_PI, shader_toy_default, rotate2D, TWO_PI}
88
#import bevy_render::view::View
9-
#import bevy_pbr::forward_io::VertexOutput
10-
11-
// #import bevy_sprite::mesh2d_vertex_output::VertexOutput
9+
#import bevy_sprite::mesh2d_vertex_output::VertexOutput
1210

1311
@group(0) @binding(0) var<uniform> view: View;
1412

@@ -21,10 +19,9 @@ fn fragment(mesh: VertexOutput) -> @location(0) vec4<f32> {
2119
uv = (uv * 2.0) - 1.0;
2220
let resolution = view.viewport.zw;
2321
let t = globals.time * SPEED;
24-
// uv.x *= resolution.x / resolution.y;
25-
// uv *= rotate2D(NEG_HALF_PI);
22+
uv.x *= resolution.x / resolution.y;
23+
uv *= rotate2D(NEG_HALF_PI);
2624

27-
// return vec4f(shader_toy_default(t, uv), 1.0);
28-
return vec4f(1.0);
25+
return vec4f(shader_toy_default(t, uv), 1.0);
2926
}
3027

Diff for: src/plugin.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use bevy::{
33
sprite::Material2dPlugin, window::WindowResized,
44
};
55
use bevy_panorbit_camera::PanOrbitCameraPlugin;
6-
use utils::init_default_state;
76

87
use crate::prelude::*;
98

@@ -29,7 +28,6 @@ impl Plugin for ShadPlayPlugin {
2928
//events:
3029
.add_event::<UserAddedTexture>()
3130
.add_event::<DragNDropShader>()
32-
.add_systems(Startup, init_default_state)
3331
// 3D
3432
.add_systems(OnEnter(AppState::ThreeD), setup_3d)
3533
.add_systems(OnExit(AppState::ThreeD), cleanup_3d)

Diff for: src/utils.rs

-4
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,6 @@ pub fn toggle_window_passthrough(
218218
}
219219
}
220220

221-
pub fn init_default_state(mut app_state: ResMut<NextState<AppState>>) {
222-
app_state.set(AppState::TwoD);
223-
}
224-
225221
/// System: Startup, initialises the scene's geometry. 3d only.
226222
pub fn init_shapes(
227223
mut meshes: ResMut<Assets<Mesh>>,

0 commit comments

Comments
 (0)