pub struct Camera {
pub eye: Vec3,
pub target: Vec3,
pub up: Vec3,
pub projection: Projection,
}Expand description
A look-at camera in world space (right-handed, +Y up, looking down −Z in its own view space).
Fields§
§eye: Vec3Eye position, world space.
target: Vec3Point the camera looks at, world space.
up: Vec3Up hint; need not be orthogonal to the view direction.
projection: ProjectionThe view-to-clip mapping.
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn look_at(eye: Vec3, target: Vec3, up: Vec3) -> Mat4
pub fn look_at(eye: Vec3, target: Vec3, up: Vec3) -> Mat4
Builds a right-handed world-to-view look-at transform.
Sourcepub fn framing_aabb(bound: &Aabb, aspect: f32) -> Self
pub fn framing_aabb(bound: &Aabb, aspect: f32) -> Self
Frames a world-space box tightly from the +Z axis with deterministic padding. This avoids the excess empty space introduced by first enclosing an anisotropic molecule in a sphere.
Sourcepub fn framing(bound: &BoundingSphere, aspect: f32) -> Self
pub fn framing(bound: &BoundingSphere, aspect: f32) -> Self
A camera looking at bound from a distance that frames it fully,
down the +Z axis with +Y up.
Sourcepub fn view_proj(&self) -> Mat4
pub fn view_proj(&self) -> Mat4
The clip-from-world matrix: projection composed with view, in that order, always.
Sourcepub fn frustum_planes(&self) -> [Vec4; 6]
pub fn frustum_planes(&self) -> [Vec4; 6]
The six frustum planes of view_proj, as (normal, d) packed into
Vec4 with the inside satisfying dot(n, p) + d >= 0. Order: left,
right, bottom, top, near, far.
Sourcepub fn focus_distance(&self) -> f32
pub fn focus_distance(&self) -> f32
Distance from eye to target.
Trait Implementations§
impl Copy for Camera
Source§impl<'de> Deserialize<'de> for Camera
impl<'de> Deserialize<'de> for Camera
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>,
impl StructuralPartialEq for Camera
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnsafeUnpin for Camera
impl UnwindSafe for Camera
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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