pub struct Camera {
    position: Point3<f64>,
    yaw: Rad<f64>,
    pitch: Rad<f64>,
    width: f64,
    height: f64,
}

Fields

position: Point3<f64>yaw: Rad<f64>pitch: Rad<f64>width: f64height: f64

Implementations

A transform which can be used to transform between clip and window space. Adopted from here (Direct3D).

Transforms coordinates in clip space to window coordinates.

Adopted from here (Direct3D).

Alternative implementation to clip_to_window. Transforms coordinates in clip space to window coordinates.

Adopted from here and here (Vulkan).

Order of transformations reversed: https://computergraphics.stackexchange.com/questions/6087/screen-space-coordinates-to-eye-space-conversion/6093 w is lost.

OpenGL explanation: https://www.khronos.org/opengl/wiki/Compute_eye_space_from_window_space#From_window_to_ndc

Alternative implementation to window_to_world

Adopted from here.

Gets the world coordinates for the specified window coordinates on the z=0 plane.

Calculates an Aabb2 bounding box which contains at least the visible area on the z=0 plane. One can think of it as being the bounding box of the geometry which forms the intersection between the viewing frustum and the z=0 plane.

This implementation works in the world 3D space. It casts rays from the corners of the window to calculate intersections points with the z=0 plane. Then a bounding box is calculated.

Note: It is possible that no such bounding box exists. This is the case if the z=0 plane is not in view.

An alternative implementation for view_bounding_box.

This implementation works in the NDC space. We are creating a plane in the world 3D space. Then we are transforming it to the NDC space. In NDC space it is easy to calculate the intersection points between an Aabb3 and a plane. The resulting Aabb2 is returned.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be significantly different

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more