lol idk #1

Open
Quaternions wants to merge 99 commits from StrafesNET/strafe-client:master into master
Showing only changes of commit 3be9730b52 - Show all commits

View File

@ -149,8 +149,8 @@ impl GraphicsState{
}
pub fn generate_models(&mut self,device:&wgpu::Device,queue:&wgpu::Queue,map:&map::CompleteMap,textures:strafesnet_texture_loader::texture_loader::Textures){
//generate texture view per texture
let texture_views:Vec<wgpu::TextureView>=textures.into_iter().map(|(texture_id,texture_data)|{
let image=ddsfile::Dds::read(std::io::Cursor::new(texture_data)).unwrap();
let texture_views:HashMap<strafesnet_common::model::TextureId,wgpu::TextureView>=textures.into_iter().filter_map(|(texture_id,texture_data)|{
let image=ddsfile::Dds::read(std::io::Cursor::new(texture_data)).ok()?;
let (mut width,mut height)=(image.get_width(),image.get_height());
@ -192,11 +192,11 @@ impl GraphicsState{
wgpu::util::TextureDataOrder::LayerMajor,
&image.data,
);
texture.create_view(&wgpu::TextureViewDescriptor{
Some((texture_id,texture.create_view(&wgpu::TextureViewDescriptor{
label:Some(format!("Texture{} View",texture_id.get()).as_str()),
dimension:Some(wgpu::TextureViewDimension::D2),
..wgpu::TextureViewDescriptor::default()
})
})))
}).collect();
let num_textures=texture_views.len();
@ -488,10 +488,9 @@ impl GraphicsState{
usage:wgpu::BufferUsages::UNIFORM|wgpu::BufferUsages::COPY_DST,
});
let render_config=&map.render_configs[model.render_config.get() as usize];
let texture_view=match render_config.texture{
Some(texture_id)=>&texture_views[texture_id.get() as usize],
None=>&self.temp_squid_texture_view,
};
let texture_view=render_config.texture.and_then(|texture_id|
texture_views.get(&texture_id)
).unwrap_or(&self.temp_squid_texture_view);
let bind_group=device.create_bind_group(&wgpu::BindGroupDescriptor{
layout:&self.bind_group_layouts.model,
entries:&[