Use only skinning data for vertices
This commit is contained in:
parent
49cda13e50
commit
1c4a6538cb
|
@ -5,13 +5,12 @@ struct CameraUniform {
|
|||
|
||||
struct VertexInput {
|
||||
[[location(0)]] position: vec3<f32>;
|
||||
[[location(1)]] color: vec3<f32>;
|
||||
[[location(1)]] tan_frame: u32;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
[[builtin(position)]] clip_position: vec4<f32>;
|
||||
[[location(0)]] position: vec3<f32>;
|
||||
[[location(1)]] color: vec3<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]]
|
||||
|
@ -28,7 +27,6 @@ fn vs_main(
|
|||
var out: VertexOutput;
|
||||
out.clip_position = camera.vp * vec4<f32>(world_pos, 1.0);
|
||||
out.position = world_pos;
|
||||
out.color = vertex.color;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -36,5 +34,5 @@ fn vs_main(
|
|||
fn fs_main(
|
||||
frag: VertexOutput,
|
||||
) -> [[location(0)]] vec4<f32> {
|
||||
return vec4<f32>(frag.color, 1.0);
|
||||
return vec4<f32>(1.0);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ pub struct ShaderInfo {
|
|||
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
pub struct Vertex {
|
||||
pub position: [f32; 3],
|
||||
pub color: [f32; 3],
|
||||
pub tan_frame: u32,
|
||||
}
|
||||
|
||||
impl Attribute for Vertex {
|
||||
|
@ -23,7 +23,7 @@ impl Attribute for Vertex {
|
|||
}
|
||||
|
||||
const VERTEX_ATTRS: &[wgpu::VertexAttribute] =
|
||||
&wgpu::vertex_attr_array![0 => Float32x3, 1 => Float32x3];
|
||||
&wgpu::vertex_attr_array![0 => Float32x3, 1 => Uint32];
|
||||
|
||||
impl Vertex {
|
||||
pub fn desc() -> wgpu::VertexBufferLayout<'static> {
|
||||
|
@ -81,15 +81,15 @@ impl MeshPass {
|
|||
let example_vertices = vec![
|
||||
Vertex {
|
||||
position: [-0.5, 0.5, 0.0],
|
||||
color: [1.0, 0.0, 0.0],
|
||||
tan_frame: 0,
|
||||
},
|
||||
Vertex {
|
||||
position: [0.5, 0.5, 0.0],
|
||||
color: [0.0, 1.0, 0.0],
|
||||
tan_frame: 0,
|
||||
},
|
||||
Vertex {
|
||||
position: [0.0, -0.5, 0.0],
|
||||
color: [0.0, 0.0, 1.0],
|
||||
tan_frame: 0,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue