Skip to content

Commit

Permalink
Use shared shader types
Browse files Browse the repository at this point in the history
  • Loading branch information
jgayfer committed Aug 1, 2024
1 parent 2e34361 commit 8213bbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
13 changes: 1 addition & 12 deletions src/render/light_map/light_map.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::view::View
#import bevy_light_2d::types::{AmbientLight2d, PointLight2d};

fn world_to_ndc(world_position: vec2<f32>) -> vec2<f32> {
return (view.clip_from_world * vec4(world_position, 0.0, 1.0)).xy;
Expand Down Expand Up @@ -30,18 +31,6 @@ fn ndc_to_uv(ndc: vec2<f32>) -> vec2<f32> {
// ensure our point lights can fit in 4kb.
const MAX_POINT_LIGHTS: u32 = 82u;

struct PointLight2d {
center: vec2f,
radius: f32,
color: vec4<f32>,
intensity: f32,
falloff: f32
}

struct AmbientLight2d {
color: vec4<f32>
}

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

Expand Down
6 changes: 3 additions & 3 deletions src/render/types.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ struct LightOccluder2d {
}

struct PointLight2d {
center: vec2<f32>,
center: vec2f,
radius: f32,
color: vec4<f32>,
falloff: f32,
intensity: f32,
radius: f32,
falloff: f32
}

0 comments on commit 8213bbe

Please sign in to comment.