mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 00:04:15 +00:00
Use the generated struct in the teapot example
This commit is contained in:
parent
d82726eedd
commit
ca4c99ec92
@ -81,7 +81,7 @@ fn write_struct(doc: &parse::Spirv, struct_id: u32, members: &[u32]) -> String {
|
||||
current_rust_offset = None;
|
||||
}
|
||||
|
||||
members_defs.push(format!("{name}: {ty}", name = member_name, ty = ty));
|
||||
members_defs.push(format!("pub {name}: {ty}", name = member_name, ty = ty));
|
||||
}
|
||||
|
||||
format!("#[repr(C)]\n#[derive(Copy, Clone, Debug, Default)]\n\
|
||||
|
@ -109,14 +109,14 @@ fn main() {
|
||||
let view = cgmath::Matrix4::look_at(cgmath::Point3::new(0.3, 0.3, 1.0), cgmath::Point3::new(0.0, 0.0, 0.0), cgmath::Vector3::new(0.0, -1.0, 0.0));
|
||||
let scale = cgmath::Matrix4::from_scale(0.01);
|
||||
|
||||
let uniform_buffer = vulkano::buffer::Buffer::<([[f32; 4]; 4], [[f32; 4]; 4]), _>
|
||||
let uniform_buffer = vulkano::buffer::Buffer::<vs::Data, _>
|
||||
::new(&device, &vulkano::buffer::Usage::all(),
|
||||
vulkano::memory::HostVisible, &queue)
|
||||
.expect("failed to create buffer");
|
||||
{
|
||||
let mut mapping = uniform_buffer.try_write().unwrap();
|
||||
mapping.0 = (view * scale).into();
|
||||
mapping.1 = proj.into();
|
||||
mapping.worldview = (view * scale).into();
|
||||
mapping.proj = proj.into();
|
||||
}
|
||||
|
||||
mod vs { include!{concat!(env!("OUT_DIR"), "/shaders/examples/teapot_vs.glsl")} }
|
||||
|
Loading…
Reference in New Issue
Block a user