pub type Material<R> = Arc<dyn Fn(&Vector, &Vector, f64, f64, &mut R) -> Option<Vector> + Send + Sync + 'static>;Expand description
Shader Type
This Closure Represents a shader in the HQZ system. For a given incident ray an outcome is calculated.
Wavelength is provided instead of colour to encourage the design of physically based shaders. Colour can be calculated from the wavelength using Rustic’s spectrum module.
- It returns a wrapped vector of the direction of the bounced ray.
If the ray is absorbed then it returns
None.
§Parameters:
- direction: Vector of the direction of the inbound ray.
- normal: Computed normal to the hit surface. This can be used in
direction.reflect(normal), to get a mirror reflection. - wavelength: Wavelength of inbound ray (no way to change this for the outbound ray, sorry).
- alpha: how far along the object the inbound ray hit. clamped 0.0 to 1.0
- rng: random number generator for use during the function, (don’t spawn your own, way to slow.)
Aliased Type§
pub struct Material<R> { /* private fields */ }