home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / graphtal / basewndw.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-20  |  2.1 KB  |  74 lines

  1. /*
  2.  * BaseWindow.h  - class definition of abstract base class 
  3.  *                 for window support.
  4.  *
  5.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  6.  * All rights reserved.
  7.  *
  8.  * This software may be freely copied, modified, and redistributed
  9.  * provided that this copyright notice is preserved on all copies.
  10.  *
  11.  * You may not distribute this software, in whole or in part, as part of
  12.  * any commercial product without the express consent of the authors.
  13.  *
  14.  * There is no warranty or other guarantee of fitness of this software
  15.  * for any purpose.  It is provided solely "as is".
  16.  *
  17.  */
  18.  
  19. #ifndef BaseWindow_H
  20. # define BaseWindow_H
  21.  
  22. #include "Vector.h"
  23. #include "ViewTransform.h"
  24. #include "Polygon.h"
  25.  
  26. //___________________________________________________________ BaseWindow
  27.  
  28. class LineList;
  29.  
  30. class BaseWindow
  31. {
  32. public:
  33.   BaseWindow();
  34.   virtual ~BaseWindow();
  35.  
  36.   virtual void open(int resX, int resY, const rcString& windowName)=0;
  37.   virtual void close()=0;
  38.   virtual void clear()=0;
  39.   virtual char waitForKey()=0;
  40.   virtual void writeText(const rcString&, int, int)=0;
  41.   virtual void line(const Vector&, const Vector&); // draw line
  42.   virtual void polygon(Polygon*);                  // draw polygon
  43.   virtual void flush();                            // flush buffer
  44.  
  45.   virtual void disableBuffering();
  46.   virtual void enableBuffering();
  47.  
  48.   virtual void setView(const Vector& eye, const Vector& lookat, 
  49.                const Vector& up, real fov);
  50.   virtual void setView(const BoundingBox& bbox, 
  51.                const Vector& up, real fov);
  52.  
  53. protected:
  54.   ViewTransform* view; // view to apply
  55.   int resX, resY;      // window resolution
  56.   rcString name;       // name of the window
  57.   int windowIsOpen;    // is the window already open?
  58.  
  59. protected:
  60.   // drawLine is used by member functions line and poly to
  61.   // actually draw a line on the screen.
  62.   virtual void drawLine(int, int, int, int)=0;
  63.  
  64. private:
  65.   int buffering;       // buffering enabled?
  66.   LineList*    lines;  // buffered lines
  67.   PolygonList* polys;  // buffered polys
  68.  
  69. private:
  70.   void clearBuffer(); 
  71. };
  72.  
  73. #endif // BaseWindow_H
  74.