#pragma once
#include "Vector.h"
#include <vector>


namespace Aftr
{
   class WO;

   //See AftrUtil_collision_test.cpp (inside engine/src/aftr/gtest/ ) for simple examples on how to walk across
   //triangles that are fed to OpenGL.

   //These are orgranized from top to bottom -- the functions declared *at the top* are *easier* to use from a high level.
   //As you go down, the functions become specialized to specific cases

   //The "head" of a vector is at the even slots and the "tail" of a ray is 
   //stored in the std::vector<...>'s odd slots. That is, if std::vector<Vector> rays is passed in,
   //rays[0] is the head of ray0 and rays[1] is the tail of ray0. 
   //rays[2] is the head of ray1 and rays[3] is the tail of ray1.
   //The in passed rays std::vector *must* have an even size() or the call is invalid.
   //A ray travels from tail to head. So given multiple collisions between a ray and some triangles, the point
   //nearest to the ray's tail will be returned.
   std::vector< std::optional<Vector> >
   collide_finite_ray_against_wo( std::vector< Vector > const& rays_head_tail_pairs_world_space, WO const* wo );

   std::vector< std::optional<Vector> >
   collide_finite_ray_against_wo( std::vector< Vector > const& rays_head_tail_pairs_local_space, Model const* m );

   std::vector< std::optional<Vector> >
   collide_finite_ray_against_triangles( std::vector< Vector > const& rays_head_tail_pairs, std::random_access_iterator auto cbegin, std::random_access_iterator auto cend );

   std::vector< std::optional<Vector> >
   collide_finite_ray_against_wo( WO const* wo, std::forward_iterator auto begin, std::forward_iterator auto end );
}