pub struct CameraComponent {
pub fov: f32,
pub znear: f32,
pub zfar: f32,
pub active: bool,
}Expand description
A camera lens attached to an entity. active marks the single camera entity Play mode should
look through — a bool flag rather than a separate “active camera entity” reference, since
entities aren’t referenced by stable ID across a scene save/load (scripts look entities up by
name for the same reason). The UI is responsible for keeping at most one entity’s flag set
(radio-button semantics, see editor::draw_camera_editor); World::active_camera defends
against more than one somehow being set by just using the first it finds.
Fields§
§fov: f32Vertical field of view, in degrees — same convention as Camera::fov.
znear: f32§zfar: f32§active: boolImplementations§
Source§impl CameraComponent
impl CameraComponent
Sourcepub fn derive_camera(&self, transform: &Transform, aspect: f32) -> Camera
pub fn derive_camera(&self, transform: &Transform, aspect: f32) -> Camera
Looks down local -Z, rotated by transform.rotation into world space, then converted to
the yaw/pitch Camera stores via Camera::yaw_pitch_from_forward — any roll in
transform.rotation is dropped, since the FPS-style Camera has no roll to express it
with. aspect is viewport-derived, not stored on the component (mirrors how
Renderer::resize keeps Camera::aspect current rather than baking it into camera data).
Trait Implementations§
Source§impl Clone for CameraComponent
impl Clone for CameraComponent
Source§fn clone(&self) -> CameraComponent
fn clone(&self) -> CameraComponent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CameraComponent
Source§impl Debug for CameraComponent
impl Debug for CameraComponent
Source§impl Default for CameraComponent
impl Default for CameraComponent
Source§impl<'de> Deserialize<'de> for CameraComponent
impl<'de> Deserialize<'de> for CameraComponent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CameraComponent
impl RefUnwindSafe for CameraComponent
impl Send for CameraComponent
impl Sync for CameraComponent
impl Unpin for CameraComponent
impl UnsafeUnpin for CameraComponent
impl UnwindSafe for CameraComponent
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
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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> 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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<T> Variant for T
impl<T> Variant for T
§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Variant] trait object to &mut dyn Any.§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Variant] trait object to Box<dyn Any>.§fn clone_object(&self) -> Box<dyn Variant>
fn clone_object(&self) -> Box<dyn Variant>
Variant] trait object.