pub struct MeshVisual3d { /* private fields */ }Expand description
One transformed instance of an immutable host-built surface mesh.
The constructor and geometry setters validate transformed vertices and triangles before changing state. Extraction then clones only shared handles; it does not rebuild topology or interpolate transforms. Engine remains responsible for view-dependent clipping and GPU validation.
Implementations§
Source§impl MeshVisual3d
impl MeshVisual3d
Sourcepub fn new(
asset: MeshAsset3d,
transform: Transform3d,
color: Color,
) -> Result<Self, MeshVisualError>
pub fn new( asset: MeshAsset3d, transform: Transform3d, color: Color, ) -> Result<Self, MeshVisualError>
Creates an opaque mesh instance after CPU geometry validation.
Sourcepub fn with_surface(
asset: MeshAsset3d,
transform: Transform3d,
surface: SurfaceStyle3d,
) -> Result<Self, MeshVisualError>
pub fn with_surface( asset: MeshAsset3d, transform: Transform3d, surface: SurfaceStyle3d, ) -> Result<Self, MeshVisualError>
Creates an Opaque, Mask or Blend mesh with explicit Engine surface policy. Lambert requires host-supplied normals. View-dependent arithmetic remains Engine’s responsibility; this constructor does not duplicate GPU proofs.
Sourcepub const fn asset(&self) -> &MeshAsset3d
pub const fn asset(&self) -> &MeshAsset3d
Returns the shared immutable source topology.
Sourcepub const fn transform(&self) -> Transform3d
pub const fn transform(&self) -> Transform3d
Returns the current model-to-world transform.
Sourcepub const fn color(&self) -> Color
pub const fn color(&self) -> Color
Returns normalized straight-linear surface tint, including surface alpha.
Sourcepub const fn surface(&self) -> SurfaceStyle3d
pub const fn surface(&self) -> SurfaceStyle3d
Returns alpha, sidedness, lighting and fog policy plus surface tint.
Sourcepub const fn texture(&self) -> Option<&TextureVisual3d>
pub const fn texture(&self) -> Option<&TextureVisual3d>
Returns optional immutable texture pixels and independent sampling state.
Sourcepub const fn visible(&self) -> bool
pub const fn visible(&self) -> bool
Reports whether an enabled entity participates in 3D extraction.
Sourcepub fn set_asset(&mut self, asset: MeshAsset3d) -> Result<(), MeshVisualError>
pub fn set_asset(&mut self, asset: MeshAsset3d) -> Result<(), MeshVisualError>
Replaces topology atomically; invalid transformed geometry changes nothing.
Sourcepub fn set_transform(
&mut self,
transform: Transform3d,
) -> Result<(), MeshVisualError>
pub fn set_transform( &mut self, transform: Transform3d, ) -> Result<(), MeshVisualError>
Replaces the model-to-world transform, or preserves the previous value.
Sourcepub fn set_color(&mut self, color: Color) -> Result<(), MeshVisualError>
pub fn set_color(&mut self, color: Color) -> Result<(), MeshVisualError>
Replaces normalized surface tint while preserving alpha/lighting/fog policy. Opaque surfaces still reject alpha other than one. Failure changes nothing.
Sourcepub fn set_surface(
&mut self,
surface: SurfaceStyle3d,
) -> Result<(), MeshVisualError>
pub fn set_surface( &mut self, surface: SurfaceStyle3d, ) -> Result<(), MeshVisualError>
Replaces the complete surface policy, preserving geometry and texture. Enabling Lambert without model normals is rejected atomically.
Sourcepub fn set_texture(
&mut self,
texture: Option<TextureVisual3d>,
) -> Result<(), MeshVisualError>
pub fn set_texture( &mut self, texture: Option<TextureVisual3d>, ) -> Result<(), MeshVisualError>
Attaches or removes a texture. Attaching requires one UV per mesh vertex. Pixel snapshots are shared; no upload or image copying occurs here.
Sourcepub fn set_visible(&mut self, visible: bool)
pub fn set_visible(&mut self, visible: bool)
Changes visibility without discarding the host’s CPU asset.
Trait Implementations§
Source§impl Clone for MeshVisual3d
impl Clone for MeshVisual3d
Source§impl Component for MeshVisual3d
impl Component for MeshVisual3d
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for MeshVisual3d
impl Debug for MeshVisual3d
Source§impl PartialEq for MeshVisual3d
impl PartialEq for MeshVisual3d
impl StructuralPartialEq for MeshVisual3d
Auto Trait Implementations§
impl Freeze for MeshVisual3d
impl RefUnwindSafe for MeshVisual3d
impl Send for MeshVisual3d
impl Sync for MeshVisual3d
impl Unpin for MeshVisual3d
impl UnsafeUnpin for MeshVisual3d
impl UnwindSafe for MeshVisual3d
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
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.