pub struct View3d { /* private fields */ }Expand description
Optional World resource enabling a 3D view beneath screen overlays.
The positive-y up axis is fixed; the perspective aspect follows the current logical viewport. Missing or disabled views publish no 3D content, even if the World retains visible cuboids. Switching views does not change gameplay or playback state. FrameUpdate may update this presentation resource.
Implementations§
Source§impl View3d
impl View3d
Sourcepub fn new(position: Vec3, target: Vec3) -> Result<Self, View3dError>
pub fn new(position: Vec3, target: Vec3) -> Result<Self, View3dError>
Creates an enabled view with 60-degree vertical FOV and a 0.1..1000 range.
Position and target must form a valid camera with positive-y up.
Sourcepub const fn vertical_fov_radians(self) -> f32
pub const fn vertical_fov_radians(self) -> f32
Returns the last configured perspective field of view in radians. Orthographic views retain this value but do not use it.
Sourcepub const fn near(self) -> WorldLength
pub const fn near(self) -> WorldLength
Returns the positive near clipping distance.
Sourcepub const fn far(self) -> WorldLength
pub const fn far(self) -> WorldLength
Returns the far clipping distance, greater than the near distance.
Sourcepub const fn background(self) -> Color
pub const fn background(self) -> Color
Returns the normalized straight-linear RGBA clear color. Engine performs the target’s premultiplied-alpha conversion.
Sourcepub const fn enabled(self) -> bool
pub const fn enabled(self) -> bool
Reports whether the World participates in 3D extraction and rendering.
Sourcepub const fn orthographic_span(self) -> Option<WorldLength>
pub const fn orthographic_span(self) -> Option<WorldLength>
Returns the orthographic vertical world span, or None for perspective.
Sourcepub const fn surface_policy(self) -> ThreeDSurfacePolicy
pub const fn surface_policy(self) -> ThreeDSurfacePolicy
Returns the filled-surface projection policy; strict by default.
Sourcepub fn set_surface_policy(&mut self, policy: ThreeDSurfacePolicy)
pub fn set_surface_policy(&mut self, policy: ThreeDSurfacePolicy)
Selects filled-surface validation without changing camera or world state.
Sourcepub const fn lighting(self) -> Lighting3d
pub const fn lighting(self) -> Lighting3d
Returns the ambient and optional directional illumination descriptor.
Sourcepub fn set_lighting(&mut self, lighting: Lighting3d)
pub fn set_lighting(&mut self, lighting: Lighting3d)
Replaces validated lighting; only Lambert surfaces use it.
Sourcepub fn set_fog(&mut self, fog: Option<Fog3d>)
pub fn set_fog(&mut self, fog: Option<Fog3d>)
Replaces validated fog; each surface must independently opt in. Fog never changes logical visibility, alpha or triangle budgets.
Sourcepub fn set_pose(
&mut self,
position: Vec3,
target: Vec3,
) -> Result<(), View3dError>
pub fn set_pose( &mut self, position: Vec3, target: Vec3, ) -> Result<(), View3dError>
Replaces the eye and look-at point atomically after basis validation.
Sourcepub fn set_perspective(
&mut self,
vertical_fov_radians: f32,
near: WorldLength,
far: WorldLength,
) -> Result<(), View3dError>
pub fn set_perspective( &mut self, vertical_fov_radians: f32, near: WorldLength, far: WorldLength, ) -> Result<(), View3dError>
Replaces perspective parameters atomically, preserving automatic aspect.
Sourcepub fn set_orthographic(
&mut self,
vertical_span: WorldLength,
near: WorldLength,
far: WorldLength,
) -> Result<(), View3dError>
pub fn set_orthographic( &mut self, vertical_span: WorldLength, near: WorldLength, far: WorldLength, ) -> Result<(), View3dError>
Selects orthographic projection with a vertical world span and automatic aspect. Invalid camera arithmetic leaves the entire previous view unchanged.
Sourcepub fn set_background(&mut self, background: Color) -> Result<(), View3dError>
pub fn set_background(&mut self, background: Color) -> Result<(), View3dError>
Replaces the normalized straight-linear RGBA clear color, or changes nothing.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enables or suppresses the complete 3D snapshot without removing cuboids.
Sourcepub fn camera(self, viewport: LogicalViewport) -> Result<Camera3d, View3dError>
pub fn camera(self, viewport: LogicalViewport) -> Result<Camera3d, View3dError>
Builds a CPU camera for the current logical viewport without allocation.
An extreme aspect ratio can be unrepresentable and returns a typed error.
Trait Implementations§
Source§impl Component for View3d
impl Component for View3d
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
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 moreimpl Copy for View3d
impl Resource for View3d
impl StructuralPartialEq for View3d
Auto Trait Implementations§
impl Freeze for View3d
impl RefUnwindSafe for View3d
impl Send for View3d
impl Sync for View3d
impl Unpin for View3d
impl UnsafeUnpin for View3d
impl UnwindSafe for View3d
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.