Fixes to docs for tutorial 10 and tutorial 11

pull/420/head
Ian Pieragostini 2 years ago
parent 6514c34f8d
commit ca614d6c68

@ -183,6 +183,7 @@ fn create_render_pipeline(
mask: !0,
alpha_to_coverage_enabled: false,
},
multiview: None,
})
}
```
@ -533,8 +534,8 @@ We're going to need to pull in the normal vector into our `shader.wgsl`.
```wgsl
struct VertexInput {
@location(0) position: vec3<f32>,
@location(1) tex_coords: vec2<f32>;
@location(2) normal: vec3<f32>; // NEW!
@location(1) tex_coords: vec2<f32>,
@location(2) normal: vec3<f32>, // NEW!
};
```
@ -542,10 +543,10 @@ We're also going to want to pass that value, as well as the vertex's position to
```wgsl
struct VertexOutput {
@builtin(position) clip_position: vec4<f32>;
@location(0) tex_coords: vec2<f32>;
@location(1) world_normal: vec3<f32>;
@location(2) world_position: vec3<f32>;
@builtin(position) clip_position: vec4<f32>,
@location(0) tex_coords: vec2<f32>,
@location(1) world_normal: vec3<f32>,
@location(2) world_position: vec3<f32>,
};
```
@ -719,21 +720,21 @@ Now we need to reconstruct the normal matrix in the vertex shader.
```wgsl
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(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>,
// NEW!
@location(9) normal_matrix_0: vec3<f32>;
@location(10) normal_matrix_1: vec3<f32>;
@location(11) normal_matrix_2: vec3<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) world_normal: vec3<f32>;
@location(2) world_position: vec3<f32>;
@builtin(position) clip_position: vec4<f32>,
@location(0) tex_coords: vec2<f32>,
@location(1) world_normal: vec3<f32>,
@location(2) world_position: vec3<f32>,
};
@vertex

@ -195,12 +195,12 @@ Basically, we can use the edges of our triangles, and our normal to calculate th
#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
pub struct ModelVertex {
position: [f32; 3],
tex_coords: [f32; 2],
normal: [f32; 3],
pub position: [f32; 3],
pub tex_coords: [f32; 2],
pub normal: [f32; 3],
// NEW!
tangent: [f32; 3],
bitangent: [f32; 3],
pub tangent: [f32; 3],
pub bitangent: [f32; 3],
}
```
@ -355,10 +355,10 @@ Since the normal map by default is in tangent space, we need to transform all th
```wgsl
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>;
@location(1) tex_coords: vec2<f32>,
@location(2) normal: vec3<f32>,
@location(3) tangent: vec3<f32>,
@location(4) bitangent: vec3<f32>,
};
```

Loading…
Cancel
Save