/* Adapted to write Targa 24 .TGA files (24 bits/pixel) */
/* based on filename being .TGA or not, Aaron A. Collins */

#include "qrt.h"
#include "pattern.h"


#ifdef IBM_OR_CLONE

extern unsigned _stklen = 50000U;	/* Turbo-C specific */

#endif


/**********************************************************

   Contains actual instantiations of some variables, such
   as the world, and the object data structure array.

 **********************************************************/


WORLD THEWORLD;      /* THE WORLD in the mind of a computer */
DEF     def;         /* defaults */
int     linenumber;  /* line counter */
int	targa;       /* Are-we-writing-a-Targa-file? flag */


/**********************************************************

   Table of pointers to functions for objects. There are
   six functions per object (see qrt.h)

 **********************************************************/

OBJ_DATA ObjData[] = {
  { Erri,			/* nothing       */
    Err,
    Err,
    Err,
    PreCompNull,
    Err,
    Err },

  { Erri,			/* LINE          */
    Err,
    Err,
    Err,
    PreCompNull,
    Err,
    Err },

  { LineSphere,			/* SPHERE        */
    SphereNorm,
    BboxSphere,
    Sphere_Pos,
    PreCompSphere,
    Standard_Offset,
    Resize_Sphere },

  { LineParallelogram,		/* PARALLELOGRAM */
    PlaneNorm,
    BboxParallelogram,
    Plane_Pos,
    PreCompPlane,
    Standard_Offset,
    Resize_Plane },

  { LineTriangle,		/* TRIANGLE      */
    PlaneNorm,
    BboxTriangle,
    Plane_Pos,
    PreCompPlane,
    Standard_Offset,
    Resize_Plane },

  { LineSphere,			/* LAMP          */
    SphereNorm,
    BboxSphere,
    Err,
    PreCompNull,
    Err,
    Err },

  { Erri,			/* OBSERVER      */
    Err,
    Err,
    Err,
    PreCompNull,
    Err,
    Err },

  { Erri,			/* GROUND        */
    Err,
    Err,
    Err,
    PreCompNull,
    Err,
    Err },

  { Erri,			/* SKY           */
    Err,
    Err,
    Err,
    PreCompNull,
    Err,
    Err },

  { LineBbox,			/* BBOX          */
    Err,
    BboxBbox,
    Err,
    PreCompNull,
    Offset_Bbox,
    Resize_Bbox },

  { LineRing,			/* RING          */
    PlaneNorm,
    BboxRing,
    Plane_Pos,
    PreCompPlane,
    Standard_Offset,
    Resize_Plane },

  { LineQuadratic,		/* QUADRATIC     */
    QuadraticNorm,
    BboxQuadratic,
    Quadratic_Pos,
    PreCompQuadratic,
    Standard_Offset,
    Resize_Quadratic }
};


/**********************************************************

   Table of pointers to functions for patterns.
   (see pattern.h)

 **********************************************************/

int Rect_Hit(), Circle_Hit(), Poly_Hit();

PATT_DATA PattData[] = {
  { Erri            },
  { Rect_Hit        },
  { Circle_Hit      },
  { Poly_Hit        }
};


