Compare commits

..

No commits in common. "99d4e51ee82f5089b7b79f3e98dfd78ecf1e7e26" and "355956e532b923f4f62c14d43d04d411a05f1e5c" have entirely different histories.

3 changed files with 1136 additions and 1136 deletions

View File

@ -19,13 +19,13 @@ struct Entity {
//temp? //temp?
struct ModelData { struct ModelData {
transform: glam::Mat4, transform: glam::Affine3A,
vertex_buf: wgpu::Buffer, vertex_buf: wgpu::Buffer,
entities: Vec<Entity>, entities: Vec<Entity>,
} }
struct Model { struct Model {
transform: glam::Mat4, transform: glam::Affine3A,
vertex_buf: wgpu::Buffer, vertex_buf: wgpu::Buffer,
entities: Vec<Entity>, entities: Vec<Entity>,
bind_group: wgpu::BindGroup, bind_group: wgpu::BindGroup,
@ -159,9 +159,9 @@ impl Skybox {
} }
} }
fn get_transform_uniform_data(transform:&glam::Mat4) -> [f32; 4*4] { fn get_transform_uniform_data(transform:&glam::Affine3A) -> [f32; 4*4] {
let mut raw = [0f32; 4*4]; let mut raw = [0f32; 4*4];
raw[0..16].copy_from_slice(&AsRef::<[f32; 4*4]>::as_ref(transform)[..]); raw[0..16].copy_from_slice(&AsRef::<[f32; 4*4]>::as_ref(&glam::Mat4::from(*transform))[..]);
raw raw
} }
@ -208,7 +208,7 @@ fn add_obj(device:&wgpu::Device,modeldatas:& mut Vec<ModelData>,source:&[u8]){
usage: wgpu::BufferUsages::VERTEX, usage: wgpu::BufferUsages::VERTEX,
}); });
modeldatas.push(ModelData { modeldatas.push(ModelData {
transform: glam::Mat4::default(), transform: glam::Affine3A::default(),
vertex_buf, vertex_buf,
entities, entities,
}) })
@ -233,8 +233,8 @@ impl strafe_client::framework::Example for Skybox {
add_obj(device,& mut modeldatas,include_bytes!("../models/suzanne.obj")); add_obj(device,& mut modeldatas,include_bytes!("../models/suzanne.obj"));
add_obj(device,& mut modeldatas,include_bytes!("../models/teapot.obj")); add_obj(device,& mut modeldatas,include_bytes!("../models/teapot.obj"));
println!("models.len = {:?}", modeldatas.len()); println!("models.len = {:?}", modeldatas.len());
modeldatas[1].transform=glam::Mat4::from_translation(glam::vec3(10.,5.,10.)); modeldatas[1].transform=glam::Affine3A::from_translation(glam::vec3(10.,5.,10.));
modeldatas[2].transform=glam::Mat4::from_translation(glam::vec3(-10.,5.,10.)); modeldatas[2].transform=glam::Affine3A::from_translation(glam::vec3(-10.,5.,10.));
let main_bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { let main_bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
label: None, label: None,