Struct Renderer

Source
pub struct Renderer { /* private fields */ }

Implementations§

Source§

impl Renderer

Source

pub fn screen_vertex_shader(&self) -> &ScreenVertexShader

Source

pub fn register_prepare<R: Module + Prepare>(&mut self, handle: Handle<R>)

This is not ideal, but right now it is a simple way to prepare data using the command encoder of the frame.

Source

pub fn settings_mut(&mut self) -> &mut RendererSettings

Examples found in repository?
examples/bloom.rs (line 51)
29    fn new(_config: Self::Config, mut deps: Self::Dependencies) -> anyhow::Result<Self> {
30        let mut blue_cubes: Vec<Transform> = vec![];
31        let mut black_cubes: Vec<Transform> = vec![];
32
33        for x in 0..30 {
34            for y in 0..30 {
35                for z in 0..30 {
36                    let pos = vec3(
37                        x as f32 * 2.0 + 20.0 + (z as f32 * 0.1).sin() * 2.0,
38                        y as f32 * 2.0 - 30.0 + (z as f32).sin() * 2.0,
39                        z as f32 * 2.0 - 30.0 + ((x + y) % 2) as f32,
40                    );
41                    if (x + y) % 2 == 0 {
42                        blue_cubes.push(pos.into());
43                    } else {
44                        black_cubes.push(pos.into());
45                    };
46                }
47            }
48        }
49
50        // use a very high energy green to get a nice background bloom
51        deps.renderer.settings_mut().clear_color = Color::new(2.0, 8.0, 2.0);
52
53        Ok(MyState {
54            black_cubes,
55            blue_cubes,
56            camera_orthographic: false,
57            deps,
58        })
59    }
Source

pub fn register_main_pass_renderer<R: Module + MainPassRenderer>( &mut self, handle: Handle<R>, timing: Timing, )

Source

pub fn register_post_processing_effect<R: Module + PostProcessingEffect>( &mut self, handle: Handle<R>, timing: Timing, )

Source

pub fn register_tonemapping_effect<R: Module + PostProcessingEffect>( &mut self, handle: Handle<R>, )

Source

pub fn register_surface_renderer<R: Module + SdrSurfaceRenderer>( &mut self, handle: Handle<R>, timing: Timing, )

registers a renderer that renders to the sdr surface after all post processing and tonemapping has been done. good for e.g. ui with egui.

Trait Implementations§

Source§

impl Module for Renderer

Source§

type Config = RendererSettings

Some initial data that configures the module. Provided by the User when adding a module to an app.
Source§

type Dependencies = RendererDependencies

Other modules that are expected to be part of the app. Provided automatically during app setup, where the program resolves which dependencies each module has.
Source§

fn new(settings: Self::Config, deps: Self::Dependencies) -> Result<Self>

creates this module
Source§

fn intialize(handle: Handle<Self>) -> Result<()>

Is run once, after all modules have been initialized. This function is optional, it is given a handle to the module itself. other modules can be accessed if you cache the handles to them in the new() function. E.g. the LineRenderer could register its own handle (Handle) with a general Renderer module, if a Handle<Renderer> was part of the Self::Dependencies and cached in the new function. E.g. LineRenderer could have a field renderer: Handle<Renderer> that is populated in new.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more