pub struct Camera {
pub position: Point3<f32>,
pub target: Point3<f32>,
pub up: Vector3<f32>,
/* private fields */
}Expand description
Represents a camera in a 3D scene.
The camera defines the view and projection matrices used to render the scene.
Fields§
§position: Point3<f32>The position of the camera in world space.
target: Point3<f32>The target point the camera is looking at.
up: Vector3<f32>The up vector of the camera, defining its orientation.
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn new(
position: Point3<f32>,
target: Point3<f32>,
up: Vector3<f32>,
camera_type: CameraType,
) -> Self
pub fn new( position: Point3<f32>, target: Point3<f32>, up: Vector3<f32>, camera_type: CameraType, ) -> Self
Creates a new camera with the specified position, target, up vector, and projection type.
§Arguments
position- The position of the camera in world space.target- The target point the camera is looking at.up- The up vector of the camera, defining its orientation.camera_type- The type of projection used by the camera (perspective or orthographic).
§Returns
A Camera instance with the specified parameters.
Sourcepub fn view_matrix(&self) -> Matrix4<f32>
pub fn view_matrix(&self) -> Matrix4<f32>
Returns the view matrix for the camera.
The view matrix transforms world coordinates into camera coordinates. The returned matrix is a right-handed matrix, meaning that the camera is assumed to be looking down the negative z-axis of the world space.
Sourcepub fn projection_matrix(&self) -> Matrix4<f32>
pub fn projection_matrix(&self) -> Matrix4<f32>
Returns the projection matrix for the camera.
The projection matrix transforms camera coordinates into normalized device coordinates. The returned matrix is a right-handed matrix, meaning that the camera is assumed to be looking down the negative z-axis of the camera space.
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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