emartinez-dev / miniRT

This project is an introduction to the beautiful world of Raytracing. Once completed you will be able to render simple Computer-Generated-Images and you will never be afraid of implementing mathematical formulas again.
The Unlicense
2 stars 0 forks source link

Simplify the development code #26

Closed emartinez-dev closed 11 months ago

emartinez-dev commented 11 months ago

I think now it's easier to both reading it and adding more functionalities, but I want you to read the changes to see if you can improve it further or if anything is not clear @Juan-aga. Main changes are:

  1. render: there are a lot of thing going on in this function, calls raycast in order to render
  2. raycast: calls hit_objects in order to know which object the ray hits
  3. hit_objects: calculates object / ray intersection
  4. ray_color: calculates the color, lighting and shading of a ray
  5. ray_at: utility function to calculate the depth of a ray hit, a very concret thing