use crate::resources::mesh::mesh_store::MeshId;
use std::collections::HashMap;
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) struct PerObjectKey {
pub(crate) pick_id: u64,
pub(crate) occurrence: u32,
}
pub(crate) struct PerObjectCacheEntry {
pub(crate) uniform_buf: wgpu::Buffer,
pub(crate) bind_group: Option<wgpu::BindGroup>,
pub(crate) cache_key: u64,
pub(crate) last_uniform: Option<crate::resources::ObjectUniform>,
pub(crate) last_frame: u64,
}
pub(crate) struct PerObjectState {
pub(crate) cache: HashMap<PerObjectKey, PerObjectCacheEntry>,
pub(crate) bind_groups: Vec<Option<wgpu::BindGroup>>,
pub(crate) wireframe_uniform_bufs: Vec<wgpu::Buffer>,
pub(crate) wireframe_bind_groups: Vec<wgpu::BindGroup>,
pub(crate) tvm_wireframe_draws: Vec<MeshId>,
pub(crate) tvm_wireframe_buf: Option<wgpu::Buffer>,
pub(crate) tvm_wireframe_bg: Option<wgpu::BindGroup>,
}
impl PerObjectState {
pub(crate) fn new() -> Self {
Self {
cache: HashMap::new(),
bind_groups: Vec::new(),
wireframe_uniform_bufs: Vec::new(),
wireframe_bind_groups: Vec::new(),
tvm_wireframe_draws: Vec::new(),
tvm_wireframe_buf: None,
tvm_wireframe_bg: None,
}
}
}