pub struct Camera3D { /* private fields */ }Expand description
A 3D camera that defines the viewport into a 3D world using perspective or orthographic projection.
Implementations§
Source§impl Camera3D
Implements 3D camera transformation and projection methods for Camera3D.
impl Camera3D
Implements 3D camera transformation and projection methods for Camera3D.
Sourcepub fn create(
position: Vector3D,
target: Vector3D,
viewport_width: f64,
viewport_height: f64,
) -> Camera3D
pub fn create( position: Vector3D, target: Vector3D, viewport_width: f64, viewport_height: f64, ) -> Camera3D
Sourcepub fn forward(&self) -> Vector3D
pub fn forward(&self) -> Vector3D
Returns the forward direction (from position to target, normalized).
§Returns
Vector3D- The forward direction.
Sourcepub fn right(&self) -> Vector3D
pub fn right(&self) -> Vector3D
Returns the right direction (cross product of forward and up).
§Returns
Vector3D- The right direction.
Sourcepub fn view_matrix(&self) -> Matrix4x4
pub fn view_matrix(&self) -> Matrix4x4
Sourcepub fn projection_matrix(&self) -> Matrix4x4
pub fn projection_matrix(&self) -> Matrix4x4
Returns the perspective projection matrix for this camera.
§Returns
Matrix4x4- The projection matrix.
Sourcepub fn view_projection_matrix(&self) -> Matrix4x4
pub fn view_projection_matrix(&self) -> Matrix4x4
Sourcepub fn world_to_screen(&self, world: Vector3D) -> Vector3D
pub fn world_to_screen(&self, world: Vector3D) -> Vector3D
Sourcepub fn is_in_frustum(&self, world: Vector3D) -> bool
pub fn is_in_frustum(&self, world: Vector3D) -> bool
Sourcepub fn translate(&mut self, offset: Vector3D)
pub fn translate(&mut self, offset: Vector3D)
Moves the camera position by the given offset, keeping the target offset by the same amount.
§Arguments
Vector3D- The translation offset.
Source§impl Camera3D
impl Camera3D
pub fn get_position(&self) -> Vector3D
pub fn get_mut_position(&mut self) -> &mut Vector3D
pub fn set_position(&mut self, val: Vector3D) -> &mut Self
pub fn get_target(&self) -> Vector3D
pub fn get_mut_target(&mut self) -> &mut Vector3D
pub fn set_target(&mut self, val: Vector3D) -> &mut Self
pub fn get_up(&self) -> Vector3D
pub fn get_mut_up(&mut self) -> &mut Vector3D
pub fn set_up(&mut self, val: Vector3D) -> &mut Self
pub fn get_fov(&self) -> f64
pub fn get_mut_fov(&mut self) -> &mut f64
pub fn set_fov(&mut self, val: f64) -> &mut Self
pub fn get_near(&self) -> f64
pub fn get_mut_near(&mut self) -> &mut f64
pub fn set_near(&mut self, val: f64) -> &mut Self
pub fn get_far(&self) -> f64
pub fn get_mut_far(&mut self) -> &mut f64
pub fn set_far(&mut self, val: f64) -> &mut Self
pub fn get_viewport_width(&self) -> f64
pub fn get_mut_viewport_width(&mut self) -> &mut f64
pub fn set_viewport_width(&mut self, val: f64) -> &mut Self
pub fn get_viewport_height(&self) -> f64
pub fn get_mut_viewport_height(&mut self) -> &mut f64
pub fn set_viewport_height(&mut self, val: f64) -> &mut Self
Trait Implementations§
impl Copy for Camera3D
Source§impl Default for Camera3D
Implements Default for Camera3D as a camera at (0, 0, 5) looking at the origin.
impl Default for Camera3D
Implements Default for Camera3D as a camera at (0, 0, 5) looking at the origin.
Source§impl PartialOrd for Camera3D
impl PartialOrd for Camera3D
impl StructuralPartialEq for Camera3D
Auto Trait Implementations§
impl Freeze for Camera3D
impl RefUnwindSafe for Camera3D
impl Send for Camera3D
impl Sync for Camera3D
impl Unpin for Camera3D
impl UnsafeUnpin for Camera3D
impl UnwindSafe for Camera3D
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
Mutably borrows from an owned value. Read more