pub struct Renderer {
    pub gl: GL,
    pub program: Shader,
    pub camera: Camera,
    pub components: BTreeMap<&'static str, Box<dyn Component>>,
    /* private fields */
}
Expand description

The Renderer is responsible for drawing on the screen. It handles the Camera and Shaders.

Fields

gl: GLprogram: Shader

The Shader used by the Renderer.

camera: Camera

The Camera used by the Renderer.

components: BTreeMap<&'static str, Box<dyn Component>>

Components that can be added to the Renderer.

Implementations

Create a new Renderer with a given Camera.

Create a new Renderer with a given Camera and Shader.

Set the Camera that the Renderer will use.

Set the Shader that the Renderer will use.

Handle screen resizes.

Initialise the uniforms for the current Shader.

Add a Texture to the Renderer.

The renderer stores Textures that can be retreived later, via a string slice.

Use the requested Texture.

Sets the currently bound Texture to the one that matches the key. If no such texture is found, a default MAGENTA one is found.

Get the requested Texture, or MAGENTA if none is found.

Clear the batch queue and start a new batch.

Add a Quad to the batching queue.

Begin a new layer.

A new mesh is added to the batches and subsequent calls are made on this layer.

Remove the last layer.

Draw the current layer.

Draw all batched geometry.

Clear the screen with a given Color.

Add a Component to the Renderer.

(Re)Initialize the Components of the Renderer.

Update the Components of the Renderer.

Get a Components using a key, and ty to cast it to a given type.

Get a mutable Components using a key, and ty to cast it to a given type.

Draw the Components of the Renderer.

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.