Struct three_d::renderer::DeferredPipeline
source · [−]pub struct DeferredPipeline {
pub debug_type: DebugType,
/* private fields */
}Expand description
Deferred render pipeline which can render objects (implementing the Geometry trait) with a DeferredPhysicalMaterial and lighting. Deferred rendering draws the geometry information into a buffer in the DeferredPipeline::render_pass and use that information in the DeferredPipeline::lighting_pass. This means that the lighting is only calculated once per pixel since the depth testing is happening in the render pass. For now only supports a cook-torrance LightingModel. Note: Deferred rendering does not support blending and therefore does not support transparency!
Fields
debug_type: DebugTypeSet this to visualize the positions, normals etc. for debug purposes.
Implementations
sourceimpl DeferredPipeline
impl DeferredPipeline
sourcepub fn new(context: &Context) -> ThreeDResult<Self>
pub fn new(context: &Context) -> ThreeDResult<Self>
Constructor.
sourcepub fn render_pass(
&mut self,
camera: &Camera,
objects: &[(impl Geometry, &DeferredPhysicalMaterial)]
) -> ThreeDResult<()>
pub fn render_pass(
&mut self,
camera: &Camera,
objects: &[(impl Geometry, &DeferredPhysicalMaterial)]
) -> ThreeDResult<()>
Render the given geometry and material parameters to a buffer. This function must not be called in a render target render function and needs to be followed by a call to DeferredPipeline::lighting_pass.
sourcepub fn lighting_pass(
&mut self,
camera: &Camera,
lights: &[&dyn Light]
) -> ThreeDResult<()>
pub fn lighting_pass(
&mut self,
camera: &Camera,
lights: &[&dyn Light]
) -> ThreeDResult<()>
Uses the geometry and surface material parameters written in the last DeferredPipeline::render_pass call and all of the given lights to render the objects. Must be called in a render target render function, for example in the callback function of Screen::write.
sourcepub fn geometry_pass_texture(&self) -> &Texture2DArray
pub fn geometry_pass_texture(&self) -> &Texture2DArray
Returns the geometry pass texture
sourcepub fn geometry_pass_depth_texture_array(&self) -> &DepthTargetTexture2DArray
pub fn geometry_pass_depth_texture_array(&self) -> &DepthTargetTexture2DArray
Returns the geometry pass depth texture
sourcepub fn geometry_pass_depth_texture(&self) -> DepthTargetTexture2D
pub fn geometry_pass_depth_texture(&self) -> DepthTargetTexture2D
Returns the geometry pass depth texture
Auto Trait Implementations
impl !RefUnwindSafe for DeferredPipeline
impl !Send for DeferredPipeline
impl !Sync for DeferredPipeline
impl Unpin for DeferredPipeline
impl !UnwindSafe for DeferredPipeline
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more