summaryrefslogtreecommitdiff
path: root/client/src/render/scene
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-27 15:26:00 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-27 15:26:00 +0100
commitc121d94f0b27bc04ffbdca55cd0939c1401d5a2e (patch)
tree67ac9da1f994c24b9a3e8e8d2adc2e334d2e34a5 /client/src/render/scene
parent6b5c44d58e6c6d3df360396a0897290fc603699b (diff)
downloadweareserver-c121d94f0b27bc04ffbdca55cd0939c1401d5a2e.tar
weareserver-c121d94f0b27bc04ffbdca55cd0939c1401d5a2e.tar.bz2
weareserver-c121d94f0b27bc04ffbdca55cd0939c1401d5a2e.tar.zst
clippy: fixes and ignores
Diffstat (limited to 'client/src/render/scene')
-rw-r--r--client/src/render/scene/demand_map.rs6
-rw-r--r--client/src/render/scene/draw.rs2
-rw-r--r--client/src/render/scene/mod.rs24
-rw-r--r--client/src/render/scene/textures.rs10
4 files changed, 22 insertions, 20 deletions
diff --git a/client/src/render/scene/demand_map.rs b/client/src/render/scene/demand_map.rs
index c27eaac..dc73142 100644
--- a/client/src/render/scene/demand_map.rs
+++ b/client/src/render/scene/demand_map.rs
@@ -29,6 +29,12 @@ struct DemandMapState<K, V> {
needed: HashSet<K>,
size_metric: usize,
}
+impl<K: Hash + Eq + Clone, V: Clone> Default for DemandMap<K, V> {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl<K: Hash + Eq + Clone, V: Clone> DemandMap<K, V> {
pub fn new() -> Self {
Self {
diff --git a/client/src/render/scene/draw.rs b/client/src/render/scene/draw.rs
index 1109401..b2bf19e 100644
--- a/client/src/render/scene/draw.rs
+++ b/client/src/render/scene/draw.rs
@@ -53,7 +53,7 @@ impl ScenePipeline {
},
})],
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
- view: &depth,
+ view: depth,
depth_ops: Some(Operations {
load: LoadOp::Clear(1.),
store: StoreOp::Store,
diff --git a/client/src/render/scene/mod.rs b/client/src/render/scene/mod.rs
index 16eecfc..7743409 100644
--- a/client/src/render/scene/mod.rs
+++ b/client/src/render/scene/mod.rs
@@ -293,13 +293,11 @@ impl ScenePreparer {
}) {
tex_albedo = Some(bg)
}
- } else {
- if let Some((_tex, bg)) = self
- .placeholder_textures
- .try_get(TextureIdentityKind::Multiply)
- {
- tex_albedo = Some(bg)
- }
+ } else if let Some((_tex, bg)) = self
+ .placeholder_textures
+ .try_get(TextureIdentityKind::Multiply)
+ {
+ tex_albedo = Some(bg)
}
let mut tex_normal = None;
if let Some(normalres) = part.tex_normal {
@@ -309,13 +307,11 @@ impl ScenePreparer {
}) {
tex_normal = Some(bg)
}
- } else {
- if let Some((_tex, bg)) = self
- .placeholder_textures
- .try_get(TextureIdentityKind::Normal)
- {
- tex_normal = Some(bg)
- }
+ } else if let Some((_tex, bg)) = self
+ .placeholder_textures
+ .try_get(TextureIdentityKind::Normal)
+ {
+ tex_normal = Some(bg)
}
let material = self.materials.try_get({
diff --git a/client/src/render/scene/textures.rs b/client/src/render/scene/textures.rs
index 4f2b01c..462cb53 100644
--- a/client/src/render/scene/textures.rs
+++ b/client/src/render/scene/textures.rs
@@ -27,8 +27,8 @@ use std::{
use wgpu::{
AddressMode, BindGroup, BindGroupDescriptor, BindGroupEntry, BindGroupLayout, BindingResource,
Color, ColorTargetState, ColorWrites, CommandEncoderDescriptor, Device, Extent3d, FilterMode,
- ImageDataLayout, LoadOp, Operations, Queue, RenderPassColorAttachment, RenderPassDescriptor,
- RenderPipeline, SamplerDescriptor, StoreOp, Texture, TextureAspect, TextureDescriptor,
+ LoadOp, Operations, Queue, RenderPassColorAttachment, RenderPassDescriptor, RenderPipeline,
+ SamplerDescriptor, StoreOp, TexelCopyBufferLayout, Texture, TextureAspect, TextureDescriptor,
TextureDimension, TextureFormat, TextureUsages, TextureViewDescriptor, include_wgsl,
};
@@ -193,7 +193,7 @@ fn create_texture(
});
let bind_group = device.create_bind_group(&BindGroupDescriptor {
label: None,
- layout: &bgl,
+ layout: bgl,
entries: &[
BindGroupEntry {
binding: 0,
@@ -246,7 +246,7 @@ fn create_texture(
queue.write_texture(
texture.as_image_copy(),
data,
- ImageDataLayout {
+ TexelCopyBufferLayout {
bytes_per_row: Some(width * 4),
rows_per_image: None,
offset: 0,
@@ -287,7 +287,7 @@ fn create_texture(
occlusion_query_set: None,
});
- rpass.set_pipeline(&mip_pipeline);
+ rpass.set_pipeline(mip_pipeline);
rpass.set_bind_group(0, &mip_bind_group, &[]);
rpass.draw(0..3, 0..1);
}