The process

The goal

The raycasting process’ main goal is to figure out wether or not a ray is colliding with any of the meshes contained in a given world. This process can be launched form the file render.

Steps

The process is divided in several steps.

  1. Meshes step
  2. Bbox tree step
  3. Triangle step
  4. Sphere step
  5. Physic light effects

The meshes step

For every mesh in the world, the file mesh_renderer is in charge of computing the intersection between a given mesh and the ray.

The boundary boxes’ tree step

From the root bbox of a given mesh, the bbox_renderer will recursively be called on all of its children as long as the given ray collides with the boundary box.

<aside> 💡 See bbox for any further explaination about the “children” of a boundary box and the meaning of “tree”.

</aside>

The triangles step

For every mesh in the world, the file triangle_renderer is in charge of computing the intersection between a given mesh and the ray.

The sphere step

This step loops through every sphere of the world and try finding the intersection point between the sphere and the provided ray

Physic light effects