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.
Pass
es are nested, with each [CxWindow
] having a [CxWindow::main_pass_id
]
that renders directly to the screen.
Fields
pass_id: Option<usize>
Implementations
This starts a Pass
.
This will automatically add color and depth Texture
s, 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?
Same as Pass::begin_pass
, but doesn’t add Texture
s automatically.
pub fn add_color_texture(
&mut self,
cx: &mut Cx,
texture_handle: TextureHandle,
clear_color: ClearColor
)
pub fn set_depth_texture(
&mut self,
cx: &mut Cx,
texture_handle: TextureHandle,
clear_depth: ClearDepth
)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Pass
impl UnwindSafe for Pass
Blanket Implementations
Mutably borrows from an owned value. Read more