Struct bevy::pbr::experimental::meshlet::MeshletMesh
pub struct MeshletMesh {
pub worst_case_meshlet_triangles: u64,
pub vertex_data: Arc<[u8]>,
pub vertex_ids: Arc<[u32]>,
pub indices: Arc<[u8]>,
pub meshlets: Arc<[Meshlet]>,
pub bounding_spheres: Arc<[MeshletBoundingSpheres]>,
}
meshlet
only.Expand description
A mesh that has been pre-processed into multiple small clusters of triangles called meshlets.
A bevy_render::mesh::Mesh
can be converted to a MeshletMesh
using MeshletMesh::from_mesh
when the meshlet_processor
cargo feature is enabled.
The conversion step is very slow, and is meant to be ran once ahead of time, and not during runtime. This type of mesh is not suitable for
dynamically generated geometry.
There are restrictions on the crate::Material
functionality that can be used with this type of mesh.
- Materials have no control over the vertex shader or vertex attributes.
- Materials must be opaque. Transparent, alpha masked, and transmissive materials are not supported.
- Materials must use the
crate::Material::meshlet_mesh_fragment_shader
method (and similar variants for prepass/deferred shaders) which requires certain shader patterns that differ from the regular material shaders. - Limited control over
bevy_render::render_resource::RenderPipelineDescriptor
attributes.
See also super::MaterialMeshletMeshBundle
and super::MeshletPlugin
.
Fields§
§worst_case_meshlet_triangles: u64
The total amount of triangles summed across all LOD 0 meshlets in the mesh.
vertex_data: Arc<[u8]>
Raw vertex data bytes for the overall mesh.
vertex_ids: Arc<[u32]>
Indices into vertex_data
.
indices: Arc<[u8]>
Indices into vertex_ids
.
meshlets: Arc<[Meshlet]>
The list of meshlets making up this mesh.
bounding_spheres: Arc<[MeshletBoundingSpheres]>
Spherical bounding volumes.
Implementations§
§impl MeshletMesh
impl MeshletMesh
pub fn from_mesh(
mesh: &Mesh
) -> Result<MeshletMesh, MeshToMeshletMeshConversionError>
pub fn from_mesh( mesh: &Mesh ) -> Result<MeshletMesh, MeshToMeshletMeshConversionError>
Process a Mesh
to generate a MeshletMesh
.
This process is very slow, and should be done ahead of time, and not at runtime.
This function requires the meshlet_processor
cargo feature.
The input mesh must:
- Use
PrimitiveTopology::TriangleList
- Use indices
- Have the exact following set of vertex attributes:
{POSITION, NORMAL, UV_0, TANGENT}
Trait Implementations§
§impl Clone for MeshletMesh
impl Clone for MeshletMesh
§fn clone(&self) -> MeshletMesh
fn clone(&self) -> MeshletMesh
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<'de> Deserialize<'de> for MeshletMesh
impl<'de> Deserialize<'de> for MeshletMesh
§fn deserialize<__D>(
__deserializer: __D
) -> Result<MeshletMesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<MeshletMesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for MeshletMesh
impl Serialize for MeshletMesh
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl TypePath for MeshletMesh
impl TypePath for MeshletMesh
§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
§impl VisitAssetDependencies for MeshletMesh
impl VisitAssetDependencies for MeshletMesh
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl Asset for MeshletMesh
Auto Trait Implementations§
impl Freeze for MeshletMesh
impl RefUnwindSafe for MeshletMesh
impl Send for MeshletMesh
impl Sync for MeshletMesh
impl Unpin for MeshletMesh
impl UnwindSafe for MeshletMesh
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.§impl<A> AssetContainer for Awhere
A: Asset,
impl<A> AssetContainer for Awhere
A: Asset,
fn insert(self: Box<A>, id: UntypedAssetId, world: &mut World)
fn asset_type_name(&self) -> &'static str
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path
.§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident
.§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name
.§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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> ⓘ
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> ⓘ
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