Module three_d::renderer[][src]

Expand description

High-level features for easy rendering of different types of objects with different types of shading. Can be combined seamlessly with the mid-level features in the core module and also with calls in the context module as long as the graphics state is reset.


pub use crate::core::math::*;
pub use crate::core::render_states::*;
pub use crate::core::render_target::*;
pub use crate::core::texture::*;
pub use crate::core::Context;
pub use material::*;
pub use effect::*;
pub use light::*;
pub use object::*;
pub use crate::ThreeDResult;


Effects applied to each pixel, for example fog or anti-aliasing.

A collection of light types. Currently implemented light types are ambient light, directional light, spot light and point light. Directional and spot lights can cast shadows.

A collection of objects that can be rendered, for example a mesh.


Used in a render call to define how to view the 3D world.

Deferred render pipeline which can render objects (implementing the Geometry trait) with materials (implementing the DeferredMaterial trait) 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::geometry_pass and use that information in the DeferredPipeline::light_pass. This means that the lighting is only calculated once per pixel since the depth testing is happening in the geometry pass. Note: Deferred rendering does not support blending and therefore does not support transparency!

Forward render pipeline which can render objects (implementing the Object trait). Forward rendering directly draws to the given render target (for example the screen) and is therefore the same as calling Object::render directly.

Defines the part of the screen/render target that is rendered to.


Used for debug purposes.

Error in the renderer module.


Finds the closest intersection between a ray from the given camera in the given pixel coordinate and the given geometries. The pixel coordinate must be in physical pixels, where (viewport.x, viewport.y) indicate the top left corner of the viewport and (viewport.x + viewport.width, viewport.y + viewport.height) indicate the bottom right corner. Returns None if no geometry was hit between the near (z_near) and far (z_far) plane for this camera.

Finds the closest intersection between a ray starting at the given position in the given direction and the given geometries. Returns None if no geometry was hit before the given maximum depth.

Render the objects. Also avoids rendering objects outside the camera frustum and render the objects in the order given by cmp_render_order. Must be called in a render target render function, for example in the callback function of Screen::write.