Those helper functions are used by `Scene` to render the scene, but
they have no use being in the same file. Instead make it a crate-public
module of `render`.
The refraction information was incorrect in the previous implementation.
We never updated the medium information when going out of a transparent
material. It is now handled using a small structure holding both the old
index, and new_index.
We can now handle any number of successive medium changes, with the
associated change of indices correctly.
This implementation assumes that any ray going into an object is going
to come out in the same medium that it was originally travelling in
before entering said object. This is an acceptable approximation to me.
The reflection will be calculated even if it ends up not contributing to
the final color of an object. This allows for a more systematic use of
coefficients without applying them twice, like it was done for the
refraction transparency handling...
The refractions are now implemented using the Fresnel equations to take
into account the amount of light that is reflected off of transparent
surfaces.
For example, this leads to a small amount of discoloring at the edges of
the ball in the example scene. Indeed, this ball has a refractive index
higher than diamond (!), so its edges reflect light much more than when
looking at it dead-center.
This necessitated to rework how light properties for a material were
given. A material can have either reflectivity or transparency. This
changes the parsing of materials, using a `LightProperty` structure at
its core.
This is does not implement the true Fresnel equations to take into
account the amount of reflection that an incident goes through when
encountering a transparent object.