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 as well as functionality in the context module.

Re-exports

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::CPUTexture;
Deprecated
pub use crate::core::CPUTextureCube;
Deprecated
pub use crate::core::CpuTexture;
pub use crate::core::CpuTexture3D;
pub use crate::core::CpuTextureCube;
pub use material::*;
pub use effect::*;
pub use light::*;
pub use geometry::*;
pub use object::*;
pub use crate::ThreeDResult;

Modules

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

A collection of geometries implementing the Geometry trait, for example a Mesh. A geometry together with a material can be rendered directly, or combined into an object (see Gm) that can be used in a render call, for example render_pass.

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 common materials implementing the Material trait. A material together with a geometry can be rendered directly, or combined into an object (see Gm) that can be used in a render call, for example render_pass.

A collection of objects (implementing the Object trait) that can be rendered directly or used in a render call, for example render_pass. Can be a combination of any geometry and material by using the Gm struct.

Structs

A bounding box that aligns with the x, y and z axes.

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

Contains the low-level OpenGL/WebGL graphics context as well as other “global” variables. Implements Deref with the low-level graphics context as target, so you can call low-level functionality directly on this struct. Use the context module to get access to low-level constants and structs.

A CPU-side version of a triangle mesh. Can be constructed manually or loaded via io or via the utility functions for generating simple triangle meshes.

Volume data consisting of voxel data inside a cube.

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!

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. All values should be given in physical pixels.

Enums

Used for debug purposes.

The geometry function used in a Cook-Torrance lighting model.

An array of indices. Supports different data types.

Lighting models which specify how the lighting is computed when rendering a material. This is a trade-off between how fast the computations are versus how physically correct they look.

The normal distribution function used in a Cook-Torrance lighting model.

An array of positions. Supports f32 and f64 data types.

Error in the renderer module.

Functions

Compare function for sorting objects based on distance from the camera. The order is opaque objects from nearest to farthest away from the camera, then transparent objects from farthest away to closest to the camera.

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 bottom left corner of the viewport and (viewport.x + viewport.width, viewport.y + viewport.height) indicate the top 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.

Type Definitions

CPUMaterialDeprecated
CPUMeshDeprecated

See CpuMesh