#include "exec/types.h"
#include "exec/libraries.h"
#include "graphics/rastport.h"
#include "graphics/clip.h"

#define   LINIE_MATT      1
#define   LINIE_STRAHLEND 2
#define   LINIE           3

#define FLAECHE_MATT      4
#define FLAECHE_STRAHLEND 8
#define FLAECHE           12

struct Punkt      {short  x,y,z,Ged_z,x_Bild,y_Bild;};
struct Normale    {short  x,y,z;};
struct Verbindung {struct Punkt *Pkt;short Modus;};
struct Flaeche    {struct Normale Nor,GedNor,Mit,GedMit;struct Verbindung *Ver;short FarbeVorne,IntenVorne,FarbeHinten,IntenHinten,FarbeLinie,Modus;};

struct Amigo3DBase

  {struct Library           Library;         /* Library Struktur für Exec */ 
   struct Window           *Window;
   struct Screen           *FarAngScreen;    /* Screen für den die Farben angepasst sind */
   struct Punkt            *AnfPkt, *EndPkt;
   struct Verbindung       *AnfVer, *EndVer;
   struct Flaeche          *AnfFla, *EndFla,
                          **ASrFla,**ESrFla;
   short                    AnzPkt,AktFarVor,AktIntVor,AktFarHin,AktIntHin,AktFarLin,AktMod;
   short                    xp,yp,zp;
   long                     dxx ,dxy ,dxz ,dyx ,dyy ,dyz ,dzx ,dzy ,dzz ; /* Drehmatrix für Objekte */
   long                     dxx_,dxy_,dxz_,dyx_,dyy_,dyz_,dzx_,dzy_,dzz_; /* Drehmatrix für Ausgabe */
   long                     xs,ys,zs;                                     /* Summe des Eckpunkt einer Fläche für Mittelpunkt */
   short                    RP2Used;                                      /* DBEin() ? */
   struct RastPort          RP2;                                          /* Ausgabe RP */
   struct BitMap            BM2;
   struct Layer             LA2;
   struct ClipRect          CR2;
   };


#define HolePosition(xp,yp,zp) {xp=Amigo3DBase->xp;yp=Amigo3DBase->yp;zp=Amigo3DBase->zp;}
#define SetzePosition(xp,yp,zp) {Amigo3DBase->xp=xp;Amigo3DBase->yp=yp;Amigo3DBase->zp=zp;}

extern void Fenster    (struct Window *);
extern void Anfang     (short x,short y,short z);
extern void Verbinde   (short x,short y,short z);
extern void ZeichneBild(short z);
extern void DreheX     (short w);
extern void DreheY     (short w);
extern void DreheZ     (short w);
extern void Modus      (short modus);
extern void Farbe      (short farbe,short inten);
extern void FarbeVorne (short farbe,short inten);
extern void FarbeHinten(short farbe,short inten);
extern void FarbeLinie (short farbe,short inten);
extern void FarbenAnpassen(void);
extern long DBEin      (void);
extern void DBAus      (void);
extern void DreheZurueck(void);
extern void GeheZurueck(void);
extern void Gehe       (short x,short y,short z);

#pragma libcall Amigo3DBase Fenster     1E 801
#pragma libcall Amigo3DBase Anfang      24 21003
#pragma libcall Amigo3DBase Verbinde    2A 21003
#pragma libcall Amigo3DBase ZeichneBild 30 001
#pragma libcall Amigo3DBase DreheX      36 001
#pragma libcall Amigo3DBase DreheY      3C 001
#pragma libcall Amigo3DBase DreheZ      42 001
#pragma libcall Amigo3DBase Modus       48 001
#pragma libcall Amigo3DBase Farbe       4E 1002
#pragma libcall Amigo3DBase FarbeVorne  54 1002
#pragma libcall Amigo3DBase FarbeHinten 5A 1002
#pragma libcall Amigo3DBase FarbeLinie  60 1002
#pragma libcall Amigo3DBase FarbenAnpassen 66 00
#pragma libcall Amigo3DBase DBEin       6C 00
#pragma libcall Amigo3DBase DBAus       72 00
#pragma libcall Amigo3DBase DreheZurueck 78 00
#pragma libcall Amigo3DBase GeheZurueck 7E 00
#pragma libcall Amigo3DBase Gehe        84 21003
