mirror of
https://github.com/guilhermewerner/wgpu-renderer
synced 2025-06-15 13:24:20 +00:00
3d camera
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
// Vertex shader
|
||||
|
||||
[[block]]
|
||||
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>;
|
||||
@ -16,7 +24,7 @@ fn main(
|
||||
) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.tex_coords = model.tex_coords;
|
||||
out.clip_position = vec4<f32>(model.position, 1.0);
|
||||
out.clip_position = camera.view_proj * vec4<f32>(model.position, 1.0); // 3.
|
||||
return out;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user