Struct dzahui::simulation::camera::CameraBuilder
source · pub struct CameraBuilder {
pub(crate) radius: Option<f32>,
theta: Option<f32>,
phi: Option<f32>,
fov: Option<f32>,
camera_sensitivity: Option<f32>,
camera_target: Option<Point3<f32>>,
}
Expand description
General Information
The camera builder. Gives some control to user, such as distance from target, initial position arround target, fov, speed, sensitivity and object being pointed at.
Fields
radius
- Distance to target.theta
- One of two angles that dictates camera position arround target (in a sphere).phi
- One of two angles that dictates camera position arround target (in a sphere).fov
- Field of view of projection matrix.camera_sensitivity
- Speed at which camera moves arround target (in a sphere).camera_target
- Point at which camera is looking.
Fields§
§radius: Option<f32>
§theta: Option<f32>
§phi: Option<f32>
§fov: Option<f32>
§camera_sensitivity: Option<f32>
§camera_target: Option<Point3<f32>>
Implementations§
source§impl CameraBuilder
impl CameraBuilder
sourcepub fn change_distance_to_object(self, radius: f32) -> Self
pub fn change_distance_to_object(self, radius: f32) -> Self
Changes distance (radius) to object centered
sourcepub fn with_target(self, x: f32, y: f32, z: f32) -> Self
pub fn with_target(self, x: f32, y: f32, z: f32) -> Self
Changes object being targeted
sourcepub fn with_camera_position(self, theta: f32, phi: f32) -> Self
pub fn with_camera_position(self, theta: f32, phi: f32) -> Self
Changes initial camera position in a sphere with center camera_target
sourcepub fn with_sensitivity(self, sensitivity: f32) -> Self
pub fn with_sensitivity(self, sensitivity: f32) -> Self
Changes camera movement sensitivity arround object being targeted
sourcepub(crate) fn build(self, mesh_length: f32, height: u32, width: u32) -> Camera
pub(crate) fn build(self, mesh_length: f32, height: u32, width: u32) -> Camera
General Information
Builds a Camera from parameters given.
Details
Camera moves arround a sphere (theta, phi, radius) centered on a point of an object with a given radius. Object on camera is projected on viewport via a projection matrix with a certain fov. There’s no plan to add orthogonal projection. Camera sensitivity helps move camera around sphere.
Parameters
self
- Every parameter appearing in Camera struct but not here is derived from the ones that do appearmesh_length
- Length of mesh to display in order to properly set radius if not givenheight
- Winow heightwidth
- Window width
Trait Implementations§
source§impl Debug for CameraBuilder
impl Debug for CameraBuilder
source§impl Default for CameraBuilder
impl Default for CameraBuilder
source§fn default() -> CameraBuilder
fn default() -> CameraBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for CameraBuilder
impl Send for CameraBuilder
impl Sync for CameraBuilder
impl Unpin for CameraBuilder
impl UnwindSafe for CameraBuilder
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.