pub struct Camera {
    pub transform: Transform,
    /* private fields */
}
Expand description

A Camera represents a Virtual Camera, that has a view and Orthographic projection matrices

Fields

transform: Transform

Transform for the Camera

Implementations

Create a new Camera with default values.

Create a new Camera with an initial position.

Create a new Camera with an initial transform.

Create a new Camera with an initial width and height.

Set the width and height of the camera plane, and update the Projection Matrix to match.

Return the Projection Matrix of the Camera as a slice of f32 so it can be used by WebGL.

Return the calculated and combined view-projection matrix as a Mat4.

Get a position in screen co-ordinates to a range within the world.

This works by first converting it into a -1.0 to 1.0 range, and then multiplying its components by the FIXED_WIDTH and FIXED_HEIGHT.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

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

Returns the argument unchanged.

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 inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

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.