
//---- Raytrace Data Types ---------------------------------------------------//

typedef struct
{
  float ax, ay, az;

  float x, y, z;
}
RT_POINT;


typedef struct __RT_SPHERE
{
  float x1, y1, x2, y2;  //  Screen-space bounding box

  float ax, ay, az;
  
  float x, y, z;
  float rad;
  int col;

  float a, b, c, d;
  float r2;

  int stamp, shadow_stamp, refl_stamp, refl_shadow_stamp;

  struct __RT_SPHERE *shadow_list;
}
RT_SPHERE;



typedef struct
{
  int num;
  RT_SPHERE sphere[4];
}
RT_SUSPECTS;



typedef struct
{
  RT_SPHERE *sphere;
  RT_SPHERE *shadow_sphere;

  RT_SPHERE *refl_sphere;
  RT_SPHERE *refl_shadow_sphere;

  float t;
  float x, y, z;
  float nx, ny, nz;
  float reflx, refly, reflz;

  int col;

  int frame;
}
RT_PIXEL;



typedef struct
{
  float ox, oy, oz;
  float dx, dy, dz;

  float dx2, dy2, dz2;

	float len2, leno22, len42;
}
RT_RAY;




//---- FUNCTIONS


void rt_startup(int *buffer, int width, int height);
void rt_shutdown();

void rt_addSphere(float x, float y, float z, float rad, int col);

void rt_render(float rx, float ry);



