/************************************************* * IGL.h * * Header for IGPM graphics library * * by V. Reichelt, IGPM RWTH Aachen * * version 0.92, June 2000 * * adapted to GLUT by T. Paehler * * version 2.0b July 2002 * * further information: * * http://www.paehler.org/tim/projekte/igl/ * *************************************************/ #ifndef _IGL_H // IGL.h nicht doppelt benutzen #define _IGL_H #include #include // ===== Farben ===== #define IGL_White 1,1,1 #define IGL_Grey 0.5,0.5,0.5 #define IGL_Black 0,0,0 #define IGL_Red 1,0,0 #define IGL_Yellow 1,1,0 #define IGL_Magenta 1,0,1 #define IGL_Light_Red 1,0.5,0.5 #define IGL_Green 0,1,0 #define IGL_Light_Green 0.5,1,0.5 #define IGL_Blue 0,0,1 #define IGL_Light_Blue 0.5,0.5,1 #define IGL_Yellow 1,1,0 #define IGL_Dflt_Back 0.7,0.7,0.7 namespace IGL { // ===== Default-Werte und Konstanten ===== static const int DfltWidth=400, DfltHeight=300; enum DrawMode { Buffer, Immediate, Redraw }; enum Marker { Circ, Crss, Plus, Sqr, Rhmb, Sqr_Fl, Rhmb_Fl, Tri_Up, Tri_Dn, Tri_Lt, Tri_Rt, Tri_Up_Fl, Tri_Dn_Fl, Tri_Lt_Fl, Tri_Rt_Fl }; // ===== Typdeklarationen ===== typedef unsigned int uint; // ===== Forward-Deklarationen ===== class IGLWin; class IGLPixmap; class BaseWin; class IGLoop; void NormalVec ( const float PRef[3], const float P1[3], const float P2[3], float Nrml[3] ); }; // **************************************************************************** // * Schnittstelle zur Fenster-Klasse * // **************************************************************************** // Diese Klasse bildet die Benutzerschnittstelle zur eigentlichen // Fenster-Klasse "BaseWin", die hinter dem Zeiger "PWin" versteckt ist. class IGL::IGLWin { private: BaseWin *PWin; // Hier ist das eigentliche Fenster versteckt static int winCount; // zaehlt die erzeugten Fenster static IGLoop *IGLMain; // die Event-Loop, in ihr laeuft glutMainLoop() public: // Konstruktor (mit Default-Breite, Hoehe) und Destruktor IGLWin ( uint W=DfltWidth, uint H=DfltHeight ); ~IGLWin (); // Events etc. static void LockLoop ( bool Flag ); // Event-Loop komplett sperren void LockWindow ( bool Flag ); // Events sperren void DrawWindow (); // Expose-Event erzeugen // Aktuelle Parameter auslesen uint GetWidth (); // Fensterbreite uint GetHeight (); // und -hoehe bool IsOpen (); // Fenster manipulieren void OpenWindow (); // Fenster oeffnen, void CloseWindow (); // schliessen, void ClearWindow (); // sauber wischen, void ResizeWindow ( uint W, uint H ); // Groesse aendern // Globale Eigenschaften void SetName ( const char Name[] ); // Name void SetBackColor ( float R, float G, float B ); // Hintergrundfarbe void SetDrawingMode ( DrawMode Mode ); // gepuffert etc.? void SetWireMode ( bool Mode ); // Nur Drahtgitter? // Lokale Parameter setzen void SetAxis ( float XMin, float XMax, float YMin, float YMax, float ZMin=-1.0, float ZMax=1.0); // Bildausschnitt void SetColor ( float R, float G, float B ); void SetPointSize ( float Size ); void SetMarkSize ( float Size ); void SetLineWidth ( float Width ); // Zeichnen void Mark2D ( float X1, float Y1, int Mode=0 ); void Point2D ( float X1, float Y1 ); void Point3D ( float X1, float Y1, float Z1 ); void Line2D ( float X1, float Y1, float X2, float Y2 ); void Line3D ( float X1, float Y1, float Z1, float X2, float Y2, float Z2 ); void Tri2D ( float X1, float Y1, float X2, float Y2, float X3, float Y3 ); void Tri3D ( float X1, float Y1, float Z1, float X2, float Y2, float Z2, float X3, float Y3, float Z3 ); void TriNorm3D ( float X1, float Y1, float Z1, float X1n, float Y1n, float Z1n, float X2, float Y2, float Z2, float X2n, float Y2n, float Z2n, float X3, float Y3, float Z3 , float X3n, float Y3n, float Z3n ); void Rect2D ( float LUx, float LUy, float ROx, float ROy ); void Quad3D ( float X1, float Y1, float Z1, float X2, float Y2, float Z2, float X3, float Y3, float Z3, float X4, float Y4, float Z4 ); void QuadNorm3D ( float X1, float Y1, float Z1, float X1n, float Y1n, float Z1n, float X2, float Y2, float Z2, float X2n, float Y2n, float Z2n, float X3, float Y3, float Z3, float X3n, float Y3n, float Z3n, float X4, float Y4, float Z4 , float X4n, float Y4n, float Z4n ); // Pixmaps laden und schreiben void LoadImage ( const IGLPixmap &Pix ); IGLPixmap DumpImage ( uint W=0, uint H=0, bool Clr=true, bool Scrn=true ); }; // **************************************************************************** // * Pixmap-Klasse * // **************************************************************************** // Klasse zum Ablegen eines Bildes, das aus Pixeln besteht class IGL::IGLPixmap { private: bool IsColor; uint Width, Height; public: GLubyte *Data; IGLPixmap ( uint W=0, uint H=0, bool Clr=true ); IGLPixmap ( const IGLPixmap& ); ~IGLPixmap () { if (Data) delete[] Data; } }; #endif