Migrate to tutorial 13 / threading
This commit is contained in:
parent
fe8a47d14d
commit
6f68444dc7
43 changed files with 4085 additions and 1163 deletions
BIN
res/cobble-diffuse.png
Normal file
BIN
res/cobble-diffuse.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
BIN
res/cobble-normal.png
Normal file
BIN
res/cobble-normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 MiB |
BIN
res/cube-diffuse.jpg
Normal file
BIN
res/cube-diffuse.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
res/cube-normal.png
Normal file
BIN
res/cube-normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 KiB |
14
res/cube.mtl
Normal file
14
res/cube.mtl
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Blender MTL File: 'cube.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material.001
|
||||
Ns 323.999994
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Bump cube-normal.png
|
||||
map_Kd cube-diffuse.jpg
|
1143
res/cube.obj
Normal file
1143
res/cube.obj
Normal file
File diff suppressed because it is too large
Load diff
BIN
res/cube.zip
Normal file
BIN
res/cube.zip
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
Before Width: | Height: | Size: 44 KiB |
|
@ -1,49 +0,0 @@
|
|||
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>;
|
||||
};
|
||||
|
||||
struct CameraUniform {
|
||||
view_proj: mat4x4<f32>;
|
||||
};
|
||||
[[group(1), binding(0)]]
|
||||
var<uniform> camera: CameraUniform;
|
||||
|
||||
struct VertexInput {
|
||||
[[location(0)]] position: vec3<f32>;
|
||||
[[location(1)]] tex_coords: vec2<f32>;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
[[builtin(position)]] clip_position: vec4<f32>;
|
||||
[[location(0)]] tex_coords: vec2<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vs_main(
|
||||
model: VertexInput,
|
||||
instance: InstanceInput,
|
||||
) -> VertexOutput {
|
||||
let model_matrix = mat4x4<f32>(
|
||||
instance.model_matrix_0,
|
||||
instance.model_matrix_1,
|
||||
instance.model_matrix_2,
|
||||
instance.model_matrix_3,
|
||||
);
|
||||
var out: VertexOutput;
|
||||
out.tex_coords = model.tex_coords;
|
||||
out.clip_position = camera.view_proj * model_matrix * vec4<f32>(model.position, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
[[group(0), binding(0)]]
|
||||
var t_diffuse: texture_2d<f32>;
|
||||
[[group(0), binding(1)]]
|
||||
var s_diffuse: sampler;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fs_main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
|
||||
return textureSample(t_diffuse, s_diffuse, in.tex_coords);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue