Add HasMeshHandle and impl for MeshHandle
This commit is contained in:
parent
5b75299832
commit
c6a3ee6b19
|
@ -45,9 +45,9 @@
|
||||||
//! TODO: make spillover buffers GPU-transferrable on iGPUs
|
//! TODO: make spillover buffers GPU-transferrable on iGPUs
|
||||||
|
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use std::sync::Arc;
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub mod attr;
|
pub mod attr;
|
||||||
pub mod group;
|
pub mod group;
|
||||||
|
@ -93,6 +93,18 @@ pub struct MeshHandle {
|
||||||
pub(crate) sub: usize,
|
pub(crate) sub: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl HasMeshHandle for MeshHandle {
|
||||||
|
fn get_mesh_handle(&self) -> &Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A trait for structs containing [MeshHandles][MeshHandle] that are not
|
||||||
|
/// themselves handles. Used for iteration.
|
||||||
|
pub trait HasMeshHandle {
|
||||||
|
fn get_mesh_handle(&self) -> &MeshHandle;
|
||||||
|
}
|
||||||
|
|
||||||
/// The top-level mesh data pool.
|
/// The top-level mesh data pool.
|
||||||
pub struct MeshPool {
|
pub struct MeshPool {
|
||||||
staging: StagingPool,
|
staging: StagingPool,
|
||||||
|
@ -122,7 +134,8 @@ impl MeshPool {
|
||||||
}
|
}
|
||||||
|
|
||||||
let group_index = self.groups.len();
|
let group_index = self.groups.len();
|
||||||
self.groups.push(MeshGroup::new(group_index, self.attr_store.clone()));
|
let attr_store = self.attr_store.clone();
|
||||||
|
self.groups.push(MeshGroup::new(group_index, attr_store));
|
||||||
let group = self.groups.get_mut(group_index).unwrap();
|
let group = self.groups.get_mut(group_index).unwrap();
|
||||||
|
|
||||||
let (handle, copies) = group.load(buf)?;
|
let (handle, copies) = group.load(buf)?;
|
||||||
|
|
Loading…
Reference in New Issue