Function tinyraytracer::cast_ray [−][src]
pub(crate) fn cast_ray(
ray: Ray,
scene: &[Box<dyn RayCollision>]
) -> Option<CollisionState>
This is the light ray simulation. We go over the objects in the scene and check if our light ray intersect with them. If there is an intersection, we get the point of intersection and assign the color of the object the ray intersect with. Next we use the point of intersection and the lighting source in the scene to determine how lighting should affect the color at intersection point.