Negrini085 / PhotoNim

PhotoNim: a CPU raytracer with BVH optimization based on kmeans clustering
https://negrini085.github.io/PhotoNim/
GNU General Public License v3.0
4 stars 1 forks source link

Polygons and polygonal meshes. #43

Open lorenzoliuzzo opened 5 months ago

lorenzoliuzzo commented 5 months ago

Add a new Shape that represents a regular polygon and use it in meshes that use more complex shapes than triangles. To do so, it will be necessary to implement an OBJ parser that reads a seq[Point3D] representing the nodes of the mesh and a seq[seq[int]] representing the sequence of shape indexes.
When we will check if a ray intersects the polygon we will break it in many triangles and iterate over them to find the hitted one.