WIP shadowmapping
This commit is contained in:
parent
2fdae1a23a
commit
ac67a3d4de
9 changed files with 270 additions and 122 deletions
51
res/shaders/globals.wgsl
Normal file
51
res/shaders/globals.wgsl
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Vertex shader
|
||||
|
||||
struct CameraUniform {
|
||||
view: mat4x4<f32>,
|
||||
proj: mat4x4<f32>,
|
||||
position: vec4<f32>,
|
||||
}
|
||||
@group(0) @binding(0)
|
||||
var<uniform> camera: CameraUniform;
|
||||
|
||||
struct Light {
|
||||
position: vec3<f32>,
|
||||
color: vec4<f32>,
|
||||
}
|
||||
@group(1) @binding(0)
|
||||
var<uniform> light: Light;
|
||||
|
||||
struct VertexInput {
|
||||
@location(0) position: vec3<f32>,
|
||||
@location(1) tex_coords: vec2<f32>,
|
||||
@location(2) normal: vec3<f32>,
|
||||
@location(3) tangent: vec3<f32>,
|
||||
@location(4) bitangent: vec3<f32>,
|
||||
}
|
||||
|
||||
struct InstanceInput {
|
||||
@location(5) model_matrix_0: vec4<f32>,
|
||||
@location(6) model_matrix_1: vec4<f32>,
|
||||
@location(7) model_matrix_2: vec4<f32>,
|
||||
@location(8) model_matrix_3: vec4<f32>,
|
||||
@location(9) normal_matrix_0: vec3<f32>,
|
||||
@location(10) normal_matrix_1: vec3<f32>,
|
||||
@location(11) normal_matrix_2: vec3<f32>,
|
||||
}
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) clip_position: vec4<f32>,
|
||||
@location(0) tex_coords: vec2<f32>,
|
||||
@location(1) tangent_position: vec3<f32>,
|
||||
@location(2) tangent_light_position: vec3<f32>,
|
||||
@location(3) tangent_view_position: vec3<f32>,
|
||||
@location(4) world_position: vec3<f32>,
|
||||
@location(5) light_local_position: vec4<f32>,
|
||||
}
|
||||
|
||||
// Fragment shader
|
||||
|
||||
@group(1)@binding(1)
|
||||
var t_light_depth: texture_depth_2d;
|
||||
@group(1) @binding(2)
|
||||
var s_light_depth: sampler_comparison;
|
Loading…
Add table
Add a link
Reference in a new issue