Struct three_d::renderer::DeferredPipeline
source · [−]pub struct DeferredPipeline {
pub debug_type: DebugType,
pub lighting_model: LightingModel,
/* private fields */
}Expand description
Deferred render pipeline which can render objects (implementing the Geometry trait) with a DeferredPhysicalMaterial and lighting. Supports different types of lighting models by changing the DeferredPipeline::lighting_model field. 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. 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.
lighting_model: LightingModeluse lighting_pass where Light struct contain lighting model
Implementations
sourceimpl DeferredPipeline
impl DeferredPipeline
sourcepub fn new(context: &Context) -> ThreeDResult<Self>
pub fn new(context: &Context) -> ThreeDResult<Self>
Constructor.
sourcepub fn geometry_pass<G: Geometry>(
&mut self,
camera: &Camera,
objects: &[(G, impl Borrow<PhysicalMaterial>)]
) -> ThreeDResult<()>
👎 Deprecated: use render_pass instead
pub fn geometry_pass<G: Geometry>(
&mut self,
camera: &Camera,
objects: &[(G, impl Borrow<PhysicalMaterial>)]
) -> ThreeDResult<()>
use render_pass instead
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 render_pass<G: Geometry>(
&mut self,
camera: &Camera,
objects: &[(G, impl Borrow<DeferredPhysicalMaterial>)]
) -> ThreeDResult<()>
pub fn render_pass<G: Geometry>(
&mut self,
camera: &Camera,
objects: &[(G, impl Borrow<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 light_pass(
&mut self,
camera: &Camera,
ambient_light: Option<&AmbientLight>,
directional_lights: &[&DirectionalLight],
spot_lights: &[&SpotLight],
point_lights: &[&PointLight]
) -> ThreeDResult<()>
👎 Deprecated: use lighting_pass instead
pub fn light_pass(
&mut self,
camera: &Camera,
ambient_light: Option<&AmbientLight>,
directional_lights: &[&DirectionalLight],
spot_lights: &[&SpotLight],
point_lights: &[&PointLight]
) -> ThreeDResult<()>
use lighting_pass instead
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 lighting_pass(
&mut self,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>
pub fn lighting_pass(
&mut self,
camera: &Camera,
lights: &Lights
) -> 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.
pub fn geometry_pass_texture(&self) -> &Texture2DArray<u8>
pub fn geometry_pass_depth_texture_array(&self) -> &DepthTargetTexture2DArray
pub fn geometry_pass_depth_texture(&self) -> DepthTargetTexture2D
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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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>
impl<T> Pointable for T
impl<T> Pointable for T
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