/* 
 * light.h - this file includes declarations and defines for light sources.
 *
 *  $Id: light.h,v 1.9 1998/05/26 04:15:26 johns Exp $
 */

typedef struct {
  unsigned int id;                      /* Unique Object serial number    */
  void * nextobj;                       /* pointer to next object in list */
  object_methods * methods;             /* this object's methods          */
  texture * tex;                        /* object texture                 */
  vector ctr;
  flt rad;
  flt (* attenuationfunc)(void *, flt);
  flt Kc;
  flt Kl; 
  flt Kq;
  flt (* spotfunc)(void *, vector *);
  vector spotdir;
  flt fallstart;
  flt fallend;
} point_light; 

point_light * newlight(void *, vector, flt);
point_light * newspotlight(void * tex, vector ctr, flt rad, vector dir,
                           flt fallstart, flt fallend);

void light_set_attenuation(point_light * li, flt Kc, flt Kl, flt Kq);


#ifdef LIGHT_PRIVATE
static int light_bbox(void * obj, vector * min, vector * max);
static void light_intersect(point_light *, ray *);
static void light_normal(point_light *, vector *, ray *, vector *);
static flt light_no_attenuation(void * vli, flt Llen);
static flt light_linear_attenuation(void * vli, flt Llen);
static flt light_quadratic_attenuation(void * vli, flt Llen);
static flt light_complex_attenuation(void * vli, flt Llen);
static flt light_no_falloff(void * vli, vector * L);
static flt light_spotlight_falloff(void * vli, vector * L);
#endif

