summaryrefslogtreecommitdiff
path: root/render/src/instance.rs
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2024-08-15 20:14:15 -0400
committerMicha White <botahamec@outlook.com>2024-08-15 20:14:15 -0400
commitf8a80039c74332e2101a177ef3fde31ef2077224 (patch)
treef887c96bf9879a28b7ce914ad96161f63ee83190 /render/src/instance.rs
parent488c7ed94b0662222fa0d825ab81b60b0b1e5d6c (diff)
Lots a changes
Diffstat (limited to 'render/src/instance.rs')
-rw-r--r--render/src/instance.rs19
1 files changed, 1 insertions, 18 deletions
diff --git a/render/src/instance.rs b/render/src/instance.rs
index e346cae..15317c7 100644
--- a/render/src/instance.rs
+++ b/render/src/instance.rs
@@ -18,12 +18,6 @@ pub struct Instance {
pub texture_coordinates: [f32; 2],
/// The size of the sprite's texture
pub texture_size: [f32; 2],
- /// The index of the texture atlas to use
- pub texture_atlas_index: u32,
- /// Rotation, in radians
- pub rotation: f32,
- /// z-index
- pub z_index: f32,
}
impl Default for Instance {
@@ -31,11 +25,8 @@ impl Default for Instance {
Self {
position: [0.0; 2],
size: [1.0; 2],
- rotation: 0.0,
- z_index: 0.0,
texture_coordinates: [0.0; 2],
texture_size: [1.0; 2],
- texture_atlas_index: 0,
}
}
}
@@ -150,18 +141,10 @@ impl InstanceBuffer {
self.expand_buffer(device);
}
- // the instances must be sorted by z-index before being handed to the GPU
- let sorted = {
- profiling::scope!("depth sorting");
- let mut sorted = self.instances.clone();
- sorted.sort_by(|a, b| a.z_index.total_cmp(&b.z_index));
- sorted
- };
-
queue.write_buffer(
&self.instance_buffer,
0 as wgpu::BufferAddress,
- bytemuck::cast_slice(&sorted),
+ bytemuck::cast_slice(&self.instances),
);
}
}