Struct rin::graphics::Camera [−][src]
pub struct Camera { /* fields omitted */ }
Perspective camera that can be positioned and oriented in 3d space as a Node
Implementations
impl Camera
[src]
impl Camera
[src]pub fn new(
eye: Point<f32, U3>,
look_at: Point<f32, U3>,
up: Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>,
fov: Deg<f32>,
aspect_ratio: f32
) -> Result<Camera, Error>
[src]
eye: Point<f32, U3>,
look_at: Point<f32, U3>,
up: Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>,
fov: Deg<f32>,
aspect_ratio: f32
) -> Result<Camera, Error>
Create a new camera.
pub fn new_with_frustum(
eye: Point<f32, U3>,
look_at: Point<f32, U3>,
up: Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>,
fov: Deg<f32>,
aspect_ratio: f32,
znear: f32,
zfar: f32
) -> Result<Camera, Error>
[src]
eye: Point<f32, U3>,
look_at: Point<f32, U3>,
up: Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>,
fov: Deg<f32>,
aspect_ratio: f32,
znear: f32,
zfar: f32
) -> Result<Camera, Error>
Creates a new camera from frustum values.
pub fn with_pixel_coordinates(
size: Matrix<i32, U2, U1, <DefaultAllocator as Allocator<i32, U2, U1>>::Buffer>,
fov: Deg<f32>,
coordinate_origin: CoordinateOrigin
) -> Camera
[src]
size: Matrix<i32, U2, U1, <DefaultAllocator as Allocator<i32, U2, U1>>::Buffer>,
fov: Deg<f32>,
coordinate_origin: CoordinateOrigin
) -> Camera
Creates an orthographic camera ready to be used in two dimensional applications
The resulting view will have the same coordinates as the passed size and everything drawn at z = 0 within that viewport will be visible at it’s size in pixels
pub fn projection(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
Projection matrix
pub fn view(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
View matrix
pub fn projection_view(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
Projection * View
pub fn fov(&self) -> Deg<f32>
[src]
Vertical field of view
pub fn hfov(&self) -> Deg<f32>
[src]
Horizontal field of view
pub fn set_fov(&mut self, fov: Deg<f32>)
[src]
Set vertical field of view
pub fn focal_length(&self) -> f32
[src]
Return the camera focal length in mm
pub fn set_focal_length(&mut self, f: f32)
[src]
Set the focal length in mm
Internally changes the field of view of the camera based on the current sensor width
pub fn set_sensor_width(&mut self, w: f32)
[src]
Set the camera sensor width in mm
Internally chanages the field of view of the camera based on the current focal length
pub fn near_far_clip(&self) -> (f32, Option<f32>)
[src]
Near and far clip planes as a tuple
pub fn near_clip(&self) -> f32
[src]
Near clip
pub fn far_clip(&self) -> Option<f32>
[src]
Far clip
pub fn set_near(&mut self, near: f32)
[src]
pub fn set_far(&mut self, far: f32)
[src]
pub fn set_far_at_infinity(&mut self)
[src]
pub fn set_reversed_z(&mut self, reversed_z: bool)
[src]
pub fn set_near_far<F>(&mut self, near: f32, far: F) where
F: Into<Option<f32>>,
[src]
F: Into<Option<f32>>,
pub fn set_aspect_ratio(&mut self, aspect: f32)
[src]
pub fn target(&self) -> &Point<f32, U3>
[src]
Target the camera will look at, the target will change if the camera is moved or re-oriented
pub fn set_target(&mut self, target: Point<f32, U3>)
[src]
pub fn enable_depth_clamp(&mut self)
[src]
Enables depth clamping
Doesn’t really change the projection or view matrices of the camera but can be use as a flag to signal a renderer to do depth clamping.
pub fn disable_depth_clamp(&mut self)
[src]
Disables depth clamping
Doesn’t really change the projection or view matrices of the camera but can be use as a flag to signal a renderer to not do depth clamping.
pub fn depth_clamp(&self) -> bool
[src]
Returns if depth clamping is enabled
Doesn’t really change the projection or view matrices of the camera but can be use as a flag to signal a renderer to do depth clamping or not.
pub fn far_at_infinity(&self) -> bool
[src]
pub fn reversed_z(&self) -> bool
[src]
pub fn set_oblique_near_clip_plane<P>(&mut self, plane: P) where
P: Into<Option<Matrix<f32, U4, U1, <DefaultAllocator as Allocator<f32, U4, U1>>::Buffer>>>,
[src]
P: Into<Option<Matrix<f32, U4, U1, <DefaultAllocator as Allocator<f32, U4, U1>>::Buffer>>>,
Changes the projection matrix to set an oblique clip plane
Useful for reflections / refractions
pub fn oblique_clip_plane(
&self
) -> Option<&Matrix<f32, U4, U1, <DefaultAllocator as Allocator<f32, U4, U1>>::Buffer>>
[src]
&self
) -> Option<&Matrix<f32, U4, U1, <DefaultAllocator as Allocator<f32, U4, U1>>::Buffer>>
pub fn update(&mut self) -> bool
[src]
Call every frame to update the camera matrices
Returns true if the camera changed since the last udpate
Trait Implementations
impl CameraExt for Camera
[src]
impl CameraExt for Camera
[src]pub fn projection(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
pub fn view(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
pub fn projection_view(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
pub fn fov(&self) -> Option<Deg<f32>>
[src]
pub fn width(&self) -> Option<f32>
[src]
pub fn near_far_clip(&self) -> (f32, Option<f32>)
[src]
pub fn near_clip(&self) -> f32
[src]
pub fn far_clip(&self) -> Option<f32>
[src]
pub fn set_near(&mut self, near: f32)
[src]
pub fn set_far(&mut self, far: f32)
[src]
pub fn set_near_far(&mut self, near: f32, far: f32)
[src]
pub fn set_aspect_ratio(&mut self, aspect: f32)
[src]
pub fn hfov(&self) -> Option<Deg<f32>>
[src]
pub fn focal_length(&self) -> Option<f32>
[src]
pub fn sensor_width_mm(&self) -> Option<f32>
[src]
pub fn aspect_ratio(&self) -> f32
[src]
pub fn target(&self) -> &Point<f32, U3>
[src]
pub fn up(
&self
) -> &Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> &Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
pub fn set_target(&mut self, target: Point<f32, U3>)
[src]
pub fn enable_depth_clamp(&mut self)
[src]
pub fn disable_depth_clamp(&mut self)
[src]
pub fn depth_clamp(&self) -> bool
[src]
pub fn set_reversed_z(&mut self, reversed_z: bool)
[src]
pub fn reversed_z(&self) -> bool
[src]
pub fn far_at_infinity(&self) -> bool
[src]
pub fn update(&mut self) -> bool
[src]
impl CameraPerspective for Camera
[src]
impl CameraPerspective for Camera
[src]impl<'de> Deserialize<'de> for Camera
[src]
impl<'de> Deserialize<'de> for Camera
[src]pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Camera, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Camera, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl NodeMut for Camera
[src]
impl NodeMut for Camera
[src]pub fn node_mut(&mut self) -> &mut Node
[src]
pub fn update_with_parent_parts(
&mut self,
parent_loc: Option<&Node>,
parent_orientation: Option<&Node>,
parent_scale: Option<&Node>
) -> bool
[src]
&mut self,
parent_loc: Option<&Node>,
parent_orientation: Option<&Node>,
parent_scale: Option<&Node>
) -> bool
pub fn look_at(
&mut self,
at: &Point<f32, U3>,
up: &Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
) -> Result<(), Error>
[src]
&mut self,
at: &Point<f32, U3>,
up: &Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
) -> Result<(), Error>
pub fn rotate(
&mut self,
angle: Rad<f32>,
axis: &Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
)
[src]
&mut self,
angle: Rad<f32>,
axis: &Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
)
pub fn append_orientation(&mut self, orientation: &Unit<Quaternion<f32>>)
[src]
pub fn tilt(&mut self, angle: Rad<f32>)
[src]
pub fn pan(&mut self, angle: Rad<f32>)
[src]
pub fn roll(&mut self, angle: Rad<f32>)
[src]
pub fn set_scale(
&mut self,
Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
)
[src]
&mut self,
Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
)
pub fn translate(
&mut self,
t: &Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
)
[src]
&mut self,
t: &Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
)
pub fn set_position(&mut self, pos: Point<f32, U3>)
[src]
pub fn set_angle_axis(
&mut self,
angle: Rad<f32>,
axis: &Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
)
[src]
&mut self,
angle: Rad<f32>,
axis: &Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
)
pub fn set_orientation(&mut self, orientation: Unit<Quaternion<f32>>)
[src]
pub fn update_with_parent(&mut self, parent: Option<&Node>) -> bool
[src]
impl NodeRef for Camera
[src]
impl NodeRef for Camera
[src]pub fn node(&self) -> &Node
[src]
pub fn position(&self) -> Point<f32, U3>
[src]
pub fn orientation(&self) -> Unit<Quaternion<f32>>
[src]
pub fn rotation(&self) -> Rotation<f32, U3>
[src]
pub fn scale(
&self
) -> Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
[src]
&self
) -> Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
pub fn local_x_axis(
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
pub fn local_y_axis(
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
pub fn local_z_axis(
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
pub fn global_x_axis(
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
pub fn global_y_axis(
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
pub fn global_z_axis(
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> Unit<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
pub fn local_transformation(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
pub fn global_transformation(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
pub fn global_position(&self) -> Point<f32, U3>
[src]
pub fn global_orientation(&self) -> Unit<Quaternion<f32>>
[src]
pub fn global_scale(
&self
) -> Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
[src]
&self
) -> Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>
pub fn inv_local_transformation(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
pub fn inv_global_transformation(
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
[src]
&self
) -> Matrix<f32, U4, U4, <DefaultAllocator as Allocator<f32, U4, U4>>::Buffer>
impl Serialize for Camera
[src]
impl Serialize for Camera
[src]pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnwindSafe for Camera
Blanket Implementations
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
[src]
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,