home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / msdos / utils / graphtal.lzh / Graphtal.Amiga / FlatDevice.h < prev    next >
C/C++ Source or Header  |  1992-11-17  |  2KB  |  71 lines

  1. /*
  2.  * FlatDevice.h - class definition for zBuffer device driver.
  3.  *
  4.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  5.  *                     University of Berne, Switzerland
  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 FlatDevice_H
  20. # define FlatDevice_H
  21.  
  22. #include "DeviceDriver.h"
  23. #include "BaseWindow.h"
  24. #include "ViewTransform.h"
  25. #include "Z_Buffer.h"
  26.  
  27. /*___________________________________________________________ FlatDevice
  28.  *
  29.  * Z-buffer device driver. Uses class Z_Buffer to generate a image
  30.  * in ppm-format (portable pixmap).
  31.  */
  32.  
  33. class PolyWithColorList;
  34.  
  35. class FlatDevice : public DeviceDriver 
  36. {
  37. public:
  38.   FlatDevice(Options*);
  39.   ~FlatDevice();
  40.  
  41.   void begin();
  42.   void end(const BoundingBox&);
  43.   void cylinder(const Vector&, const Vector&, real);
  44.   void cone(const Vector&, real, const Vector&, real);
  45.   void polygon(Polygon*);
  46.   void sphere(const Vector&, real);
  47.   void color(const Color&);
  48.   void beginMacro(const rcString&);
  49.   void endMacro();
  50.   void executeMacro(const rcString&, const TransMatrix&);
  51.  
  52. private:
  53.   rcString currentMacroName;
  54.   PolyWithColorList* polys;  // storage for polys in macro definition
  55.  
  56.   Color currentColor;
  57.   ViewTransform* view;
  58.   Z_Buffer* zBuffer;
  59.  
  60.   int coneResolution;
  61.   int sphereResolution;
  62.   real* sintable;            // precompute sin, cos for fast cone generation
  63.   real* costable;         
  64.   Vector* top;
  65.   Vector* bottom;
  66.  
  67.   PolygonList* unitSphere;
  68. };
  69.  
  70. #endif // FlatDevice_H
  71.