Struct Pass

Source
pub struct Pass {
    pub pass_id: Option<usize>,
}
Expand description

A rendering context e.g. for doing 3d rendering.

Useful if you need:

  • A different set of top-level uniforms (see [PassUniforms]).
  • To render into a Texture, which you can then manipulate to your liking.

Passes are nested, with each [CxWindow] having a [CxWindow::main_pass_id] that renders directly to the screen.

Fields§

§pass_id: Option<usize>

Implementations§

Source§

impl Pass

Source

pub fn begin_pass(&mut self, cx: &mut Cx, background_color: Vec4)

This starts a Pass.

This will automatically add color and depth Textures, since most of the time that is what you’d want. If not, then please use Pass::begin_pass_without_textures.

Note that if you don’t call this at all during a draw cycle, then the Pass will stick around and you can still e.g. change its camera using Pass::set_matrix_mode, which will cause a repaint. Similarly you can still write to shaders within this Pass using Area::get_slice_mut, which will also cause a repaint.

TODO(JP): Decide whether this is a bug or a feature. At the very least there currently no way to clean up a Pass, so that is definitely a bug. We might want to make that the default behavior, and have an explicit method to keep a cached Pass around?

Source

pub fn begin_pass_without_textures(&mut self, cx: &mut Cx)

Same as Pass::begin_pass, but doesn’t add Textures automatically.

Source

pub fn override_dpi_factor(&mut self, cx: &mut Cx, dpi_factor: f32)

Source

pub fn set_size(&mut self, cx: &mut Cx, pass_size: Vec2)

Source

pub fn add_color_texture( &mut self, cx: &mut Cx, texture_handle: TextureHandle, clear_color: ClearColor, )

Source

pub fn set_depth_texture( &mut self, cx: &mut Cx, texture_handle: TextureHandle, clear_depth: ClearDepth, )

Source

pub fn set_matrix_mode(&mut self, cx: &mut Cx, pmm: PassMatrixMode)

Source

pub fn end_pass(&mut self, cx: &mut Cx)

Trait Implementations§

Source§

impl Clone for Pass

Source§

fn clone(&self) -> Pass

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Pass

Source§

fn default() -> Pass

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

Auto Trait Implementations§

§

impl Freeze for Pass

§

impl RefUnwindSafe for Pass

§

impl Send for Pass

§

impl Sync for Pass

§

impl Unpin for Pass

§

impl UnwindSafe for Pass

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,