[−][src]Function libraymarcher::cast_ray
pub fn cast_ray<C: Color, O: SceneObject<C>>(
object: &O,
point: Vec3,
dir: Vec3,
backplanes: Vec3,
t: f64
) -> Option<RayResult>
Performs the raymarching algorithm on a scene.
Arguments
object
: the object/scene to calculate ray intersection withpoint
: the origin point of this raydirection
: direction vector of this ray. This does not need to be normalized.backplanes
: if the ray ever reaches outside of the cube bounded by +/- backplanes, it will be assumed to be a miss. This is a sort of culling mechanism.t
: the 4th dimension (or other varied value) to pass to the object for animation purposes.
Returns
Some(result)
if the ray hit an object in the scene
None
if the ray did not hit anything or hit one of the backplanes