pub struct CameraFrame {
pub pos: DVec3,
pub up: DVec3,
pub facing: DVec3,
pub near: f64,
pub far: f64,
pub perspective_blend: f64,
pub frame_height: f64,
pub scale: f64,
pub fovy: f64,
}Expand description
The data of a camera
The CameraFrame has a CameraFrame::perspective_blend property (default is 0.0),
which is used to blend between orthographic and perspective projection.
Fields§
§pos: DVec3The position
up: DVec3The up unit vec
facing: DVec3The facing unit vec
near: f64The near pane
far: f64The far pane
perspective_blend: f64The perspective blend value in [0.0, 1.0]
frame_height: f64Ortho: Top - Bottom
scale: f64Ortho: The scaling factor
fovy: f64Perspective: The field of view angle, used in perspective projection
Implementations§
Source§impl CameraFrame
impl CameraFrame
Source§impl CameraFrame
impl CameraFrame
Sourcepub fn set_view_matrix(&mut self, view_matrix: DMat4)
pub fn set_view_matrix(&mut self, view_matrix: DMat4)
Set the view matrix of the camera.
Sourcepub fn with_view_matrix(self, view_matrix: DMat4) -> Self
pub fn with_view_matrix(self, view_matrix: DMat4) -> Self
Set the view matrix of the camera and return the modified Self.
Sourcepub fn view_matrix(&self) -> DMat4
pub fn view_matrix(&self) -> DMat4
The view matrix of the camera
Sourcepub fn orthographic_mat(&self, aspect_ratio: f64) -> DMat4
pub fn orthographic_mat(&self, aspect_ratio: f64) -> DMat4
Use the given frame size as left, right, bottom, top to construct an orthographic matrix
Sourcepub fn perspective_mat(&self, aspect_ratio: f64) -> DMat4
pub fn perspective_mat(&self, aspect_ratio: f64) -> DMat4
Use the given frame aspect ratio to construct a perspective matrix
Sourcepub fn projection_matrix(&self, aspect_ratio: f64) -> DMat4
pub fn projection_matrix(&self, aspect_ratio: f64) -> DMat4
Use the given frame size to construct projection matrix
Sourcepub fn view_projection_matrix(&self, aspect_ratio: f64) -> DMat4
pub fn view_projection_matrix(&self, aspect_ratio: f64) -> DMat4
Use the given frame size to construct view projection matrix
Source§impl CameraFrame
impl CameraFrame
Sourcepub fn from_spherical(phi: f64, theta: f64, distance: f64) -> Self
pub fn from_spherical(phi: f64, theta: f64, distance: f64) -> Self
Create a perspective camera positioned using spherical coordinates (Z-up), looking at the origin.
phi: polar angle from +Z axis in radians (0 = straight up along +Z, π/2 = XY plane)theta: azimuth angle in radians (0 = +X direction, π/2 = +Y direction)distance: distance from the origin
Sourcepub fn set_spherical(
&mut self,
phi: f64,
theta: f64,
distance: f64,
target: DVec3,
) -> &mut Self
pub fn set_spherical( &mut self, phi: f64, theta: f64, distance: f64, target: DVec3, ) -> &mut Self
Position the camera using spherical coordinates (Z-up) around a target point.
phi: polar angle from +Z axis in radians (0 = straight up along +Z, π/2 = XY plane)theta: azimuth angle in radians (0 = +X direction, π/2 = +Y direction)distance: distance fromtargettarget: the point the camera looks at
Source§impl CameraFrame
impl CameraFrame
Sourcepub fn center_canvas_in_frame(
&mut self,
center: DVec3,
width: f64,
height: f64,
up: DVec3,
normal: DVec3,
aspect_ratio: f64,
) -> &mut Self
pub fn center_canvas_in_frame( &mut self, center: DVec3, width: f64, height: f64, up: DVec3, normal: DVec3, aspect_ratio: f64, ) -> &mut Self
Center the canvas in the frame when CameraFrame::perspective_blend is 1.0
Trait Implementations§
Source§impl Alignable for CameraFrame
impl Alignable for CameraFrame
Source§fn is_aligned(&self, _other: &Self) -> bool
fn is_aligned(&self, _other: &Self) -> bool
Source§fn align_with(&mut self, _other: &mut Self)
fn align_with(&mut self, _other: &mut Self)
Source§impl<G: Into<DAffine3>> ApplyTransform<G> for CameraFrame
impl<G: Into<DAffine3>> ApplyTransform<G> for CameraFrame
Source§impl Clone for CameraFrame
impl Clone for CameraFrame
Source§fn clone(&self) -> CameraFrame
fn clone(&self) -> CameraFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for CameraFrame
impl Component for CameraFrame
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 more§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_add [ComponentHook] for this [Component] if one is defined.§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_insert [ComponentHook] for this [Component] if one is defined.§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_discard [ComponentHook] for this [Component] if one is defined.§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_remove [ComponentHook] for this [Component] if one is defined.§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_despawn [ComponentHook] for this [Component] if one is defined.§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 CameraFrame
impl Debug for CameraFrame
Source§impl Default for CameraFrame
impl Default for CameraFrame
Source§impl Extract for CameraFrame
impl Extract for CameraFrame
Source§impl Interpolatable for CameraFrame
impl Interpolatable for CameraFrame
Source§impl PartialEq for CameraFrame
impl PartialEq for CameraFrame
impl StructuralPartialEq for CameraFrame
Auto Trait Implementations§
impl Freeze for CameraFrame
impl RefUnwindSafe for CameraFrame
impl Send for CameraFrame
impl Sync for CameraFrame
impl Unpin for CameraFrame
impl UnsafeUnpin for CameraFrame
impl UnwindSafe for CameraFrame
Blanket Implementations§
impl<T> AnyExtractCoreItem for T
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<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>
§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Bundle]’s component ids. This will be None if the component has not been registered.§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Component for T
impl<T> ConditionalSend for Twhere
T: Send,
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
§impl<T> FromTemplate for T
impl<T> FromTemplate for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> RotateTransform for T
impl<T> RotateTransform for T
Source§fn rotate_on_axis(&mut self, axis: DVec3, angle: f64) -> &mut T
fn rotate_on_axis(&mut self, axis: DVec3, angle: f64) -> &mut T
Source§fn rotate_on_x(&mut self, angle: f64) -> &mut Self
fn rotate_on_x(&mut self, angle: f64) -> &mut Self
Source§fn rotate_on_y(&mut self, angle: f64) -> &mut Self
fn rotate_on_y(&mut self, angle: f64) -> &mut Self
Source§fn rotate_on_z(&mut self, angle: f64) -> &mut Self
fn rotate_on_z(&mut self, angle: f64) -> &mut Self
Source§impl<T> ScaleTransform for T
impl<T> ScaleTransform for T
Source§impl<T> ScaleTransformExt for Twhere
T: ScaleTransform + ?Sized,
impl<T> ScaleTransformExt for Twhere
T: ScaleTransform + ?Sized,
Source§fn calc_scale_ratio(&self, hint: ScaleHint) -> DVec3where
Self: Aabb,
fn calc_scale_ratio(&self, hint: ScaleHint) -> DVec3where
Self: Aabb,
Source§fn scale_to(&mut self, hint: ScaleHint) -> &mut Selfwhere
Self: Aabb,
fn scale_to(&mut self, hint: ScaleHint) -> &mut Selfwhere
Self: Aabb,
Source§impl<T> ShiftTransform for T
impl<T> ShiftTransform for T
Source§impl<T> ShiftTransformExt for Twhere
T: ShiftTransform + ?Sized,
impl<T> ShiftTransformExt for Twhere
T: ShiftTransform + ?Sized,
Source§fn with_origin(
&mut self,
p: impl Locate<Self>,
f: impl FnOnce(&mut Self),
) -> &mut Self
fn with_origin( &mut self, p: impl Locate<Self>, f: impl FnOnce(&mut Self), ) -> &mut Self
Source§fn move_anchor_to<A>(&mut self, anchor: A, point: DVec3) -> &mut Selfwhere
A: Locate<Self>,
fn move_anchor_to<A>(&mut self, anchor: A, point: DVec3) -> &mut Selfwhere
A: Locate<Self>,
Source§impl<T> StaticAnim for Twhere
T: StaticAnimRequirement + 'static,
impl<T> StaticAnim for Twhere
T: StaticAnimRequirement + 'static,
impl<T> StaticAnimRequirement for Twhere
T: Clone + AnyExtractCoreItem,
§impl<T> Template for T
impl<T> Template for T
§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a [Template::Output].§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.Source§impl<T> TransformedExt for T
impl<T> TransformedExt for T
Source§fn transformed<G>(self, transform: G) -> Transformed<Self, G>
fn transformed<G>(self, transform: G) -> Transformed<Self, G>
self wrapped with transform stored exactly as G.Source§impl<T> UniformScaleTransform for T
impl<T> UniformScaleTransform for T
Source§fn scale_uniform(&mut self, s: f64) -> &mut T
fn scale_uniform(&mut self, s: f64) -> &mut T
s (at origin).