Fix compiler and clippy warnings
This commit is contained in:
parent
129619bb3d
commit
003338b828
3 changed files with 17 additions and 15 deletions
|
@ -15,7 +15,7 @@ impl Camera {
|
|||
let view = cgmath::Matrix4::look_at(self.eye, self.target, self.up);
|
||||
let proj = cgmath::perspective(cgmath::Deg(self.fovy), self.aspect, self.znear, self.zfar);
|
||||
|
||||
return proj * view;
|
||||
proj * view
|
||||
}
|
||||
}
|
||||
|
||||
|
|
28
src/main.rs
28
src/main.rs
|
@ -35,14 +35,16 @@ fn main() {
|
|||
if !state.input(event) {
|
||||
match event {
|
||||
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
|
||||
WindowEvent::KeyboardInput { input, .. } => match input {
|
||||
KeyboardInput {
|
||||
WindowEvent::KeyboardInput { input, .. } => {
|
||||
if let KeyboardInput {
|
||||
state: ElementState::Pressed,
|
||||
virtual_keycode: Some(VirtualKeyCode::Escape),
|
||||
..
|
||||
} => *control_flow = ControlFlow::Exit,
|
||||
_ => {}
|
||||
},
|
||||
} = input
|
||||
{
|
||||
*control_flow = ControlFlow::Exit
|
||||
}
|
||||
}
|
||||
WindowEvent::Resized(physical_size) => {
|
||||
state.resize(*physical_size);
|
||||
}
|
||||
|
@ -68,7 +70,7 @@ fn main() {
|
|||
#[derive(Debug, Copy, Clone)]
|
||||
struct Uniforms {
|
||||
view_position: cgmath::Vector4<f32>,
|
||||
view_proj: cgmath::Matrix4<f32>,
|
||||
view_proj: Mat4,
|
||||
}
|
||||
|
||||
impl Uniforms {
|
||||
|
@ -105,16 +107,16 @@ impl Instance {
|
|||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
struct InstanceRaw {
|
||||
model: cgmath::Matrix4<f32>,
|
||||
model: Mat4,
|
||||
}
|
||||
|
||||
unsafe impl bytemuck::Pod for InstanceRaw {}
|
||||
unsafe impl bytemuck::Zeroable for InstanceRaw {}
|
||||
|
||||
struct State {
|
||||
instance: wgpu::Instance,
|
||||
_instance: wgpu::Instance,
|
||||
surface: wgpu::Surface,
|
||||
adapter: wgpu::Adapter,
|
||||
_adapter: wgpu::Adapter,
|
||||
device: wgpu::Device,
|
||||
queue: wgpu::Queue,
|
||||
sc_desc: wgpu::SwapChainDescriptor,
|
||||
|
@ -131,7 +133,7 @@ struct State {
|
|||
|
||||
obj_model: Model,
|
||||
instances: Vec<Instance>,
|
||||
instance_buffer: wgpu::Buffer,
|
||||
_instance_buffer: wgpu::Buffer,
|
||||
|
||||
light: light::Light,
|
||||
light_buffer: wgpu::Buffer,
|
||||
|
@ -393,9 +395,9 @@ impl State {
|
|||
texture::Texture::create_depth_texture(&device, &sc_desc, "depth_texture");
|
||||
|
||||
Self {
|
||||
instance,
|
||||
_instance: instance,
|
||||
surface,
|
||||
adapter,
|
||||
_adapter: adapter,
|
||||
device,
|
||||
queue,
|
||||
sc_desc,
|
||||
|
@ -412,7 +414,7 @@ impl State {
|
|||
light_bind_group,
|
||||
light_render_pipeline,
|
||||
instances,
|
||||
instance_buffer,
|
||||
_instance_buffer: instance_buffer,
|
||||
render_pipeline,
|
||||
size,
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ pub struct Texture {
|
|||
}
|
||||
|
||||
impl Texture {
|
||||
pub fn from_bytes(
|
||||
pub fn _from_bytes(
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
bytes: &[u8],
|
||||
|
|
Loading…
Reference in a new issue