Compare commits
2 Commits
1c9bc347f6
...
48091fc15d
Author | SHA1 | Date | |
---|---|---|---|
48091fc15d | |||
23857d38d9 |
11
src/main.rs
11
src/main.rs
@ -231,9 +231,11 @@ impl GraphicsData {
|
|||||||
//make aabb and run vertices to get realistic bounds
|
//make aabb and run vertices to get realistic bounds
|
||||||
m.instances.iter().map(|t|strafe_client::body::ModelPhysics::new(t.transform))
|
m.instances.iter().map(|t|strafe_client::body::ModelPhysics::new(t.transform))
|
||||||
).flatten().collect());
|
).flatten().collect());
|
||||||
|
println!("Physics Objects: {}",self.physics.models.len());
|
||||||
}
|
}
|
||||||
fn generate_model_graphics(&mut self,device:&wgpu::Device,mut modeldatas:Vec<ModelData>){
|
fn generate_model_graphics(&mut self,device:&wgpu::Device,mut modeldatas:Vec<ModelData>){
|
||||||
//drain the modeldata vec so entities can be /moved/ to models.entities
|
//drain the modeldata vec so entities can be /moved/ to models.entities
|
||||||
|
let mut instance_count=0;
|
||||||
self.models.reserve(modeldatas.len());
|
self.models.reserve(modeldatas.len());
|
||||||
for (i,modeldata) in modeldatas.drain(..).enumerate() {
|
for (i,modeldata) in modeldatas.drain(..).enumerate() {
|
||||||
let model_uniforms = get_instances_buffer_data(&modeldata.instances);
|
let model_uniforms = get_instances_buffer_data(&modeldata.instances);
|
||||||
@ -266,6 +268,7 @@ impl GraphicsData {
|
|||||||
usage: wgpu::BufferUsages::VERTEX,
|
usage: wgpu::BufferUsages::VERTEX,
|
||||||
});
|
});
|
||||||
//all of these are being moved here
|
//all of these are being moved here
|
||||||
|
instance_count+=modeldata.instances.len();
|
||||||
self.models.push(ModelGraphics{
|
self.models.push(ModelGraphics{
|
||||||
instances:modeldata.instances,
|
instances:modeldata.instances,
|
||||||
vertex_buf,
|
vertex_buf,
|
||||||
@ -284,6 +287,8 @@ impl GraphicsData {
|
|||||||
model_buf,
|
model_buf,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
println!("Graphics Objects: {}",self.models.len());
|
||||||
|
println!("Graphics Instances: {}",instance_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,7 +650,7 @@ impl strafe_client::framework::Example for GraphicsData {
|
|||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let skybox_image = ddsfile::Dds::read(&mut std::io::Cursor::new(&bytes)).unwrap();
|
let skybox_image = ddsfile::Dds::read(&mut std::io::Cursor::new(bytes)).unwrap();
|
||||||
|
|
||||||
let skybox_texture = device.create_texture_with_data(
|
let skybox_texture = device.create_texture_with_data(
|
||||||
queue,
|
queue,
|
||||||
@ -671,9 +676,9 @@ impl strafe_client::framework::Example for GraphicsData {
|
|||||||
|
|
||||||
//squid
|
//squid
|
||||||
let squid_texture_view={
|
let squid_texture_view={
|
||||||
let bytes = &include_bytes!("../images/squid.dds")[..];
|
let bytes = include_bytes!("../images/squid.dds");
|
||||||
|
|
||||||
let image = ddsfile::Dds::read(&mut std::io::Cursor::new(&bytes)).unwrap();
|
let image = ddsfile::Dds::read(&mut std::io::Cursor::new(bytes)).unwrap();
|
||||||
|
|
||||||
let size = wgpu::Extent3d {
|
let size = wgpu::Extent3d {
|
||||||
width: image.get_width(),
|
width: image.get_width(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user