pub struct MeshBuffer {
pub metadata_buffer: TypedBuffer<MeshMetadata>,
pub base_buffer: AttributeBuffer<BaseMesh>,
pub skinned_buffer: AttributeBuffer<SkinnedMesh>,
pub index_buffer: AttributeBuffer<u32>,
/* private fields */
}Expand description
Gpu mesh buffer which holds all meshes in an Elements application.
A GpuMesh in the application just keeps an index into the metadata_buffer, and from there the shaders can look up exactly where to read position, normal etc. The “id“s (GpuMesh.index) are recycled, so even when a mesh is dropped and removed from the application, all current GpuMesh.index’s are still valid (and the content of the metadata is just updated at the index).
Fields§
§metadata_buffer: TypedBuffer<MeshMetadata>§base_buffer: AttributeBuffer<BaseMesh>§skinned_buffer: AttributeBuffer<SkinnedMesh>§index_buffer: AttributeBuffer<u32>Implementations§
Source§impl MeshBuffer
impl MeshBuffer
pub fn new(gpu: Arc<Gpu>) -> Self
pub fn insert(&mut self, mesh: &Mesh) -> Arc<GpuMesh>
pub fn update(&mut self)
pub fn get_mesh_metadata(&self, mesh: &GpuMesh) -> &MeshMetadata
pub fn size(&self) -> u64
pub fn n_meshes(&self) -> usize
pub fn total_bytes_used() -> usize
pub fn bind<'a>(&'a self, renderpass: &'a mut RenderPass<'a>)
pub fn indices_of(&self, mesh: &GpuMesh) -> Range<u32>
Auto Trait Implementations§
impl !Freeze for MeshBuffer
impl !RefUnwindSafe for MeshBuffer
impl Send for MeshBuffer
impl Sync for MeshBuffer
impl Unpin for MeshBuffer
impl !UnwindSafe for MeshBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more