home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / graphtal / flatdevc.h < prev    next >
C/C++ Source or Header  |  1992-10-23  |  2KB  |  70 lines

  1. /*
  2.  * FlatDevice.h - class definition for zBuffer device driver.
  3.  *
  4.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  */
  17.  
  18. #ifndef FlatDevice_H
  19. # define FlatDevice_H
  20.  
  21. #include "DeviceDriver.h"
  22. #include "BaseWindow.h"
  23. #include "ViewTransform.h"
  24. #include "Z_Buffer.h"
  25.  
  26. /*___________________________________________________________ FlatDevice
  27.  *
  28.  * Z-buffer device driver. Uses class Z_Buffer to generate a image
  29.  * in ppm-format (portable pixmap).
  30.  */
  31.  
  32. class PolyWithColorList;
  33.  
  34. class FlatDevice : public DeviceDriver 
  35. {
  36. public:
  37.   FlatDevice(Options*);
  38.   ~FlatDevice();
  39.  
  40.   void begin();
  41.   void end(const BoundingBox&);
  42.   void cylinder(const Vector&, const Vector&, real);
  43.   void cone(const Vector&, real, const Vector&, real);
  44.   void polygon(Polygon*);
  45.   void sphere(const Vector&, real);
  46.   void color(const Color&);
  47.   void beginMacro(const rcString&);
  48.   void endMacro();
  49.   void executeMacro(const rcString&, const TransMatrix&);
  50.  
  51. private:
  52.   rcString currentMacroName;
  53.   PolyWithColorList* polys;  // storage for polys in macro definition
  54.  
  55.   Color currentColor;
  56.   ViewTransform* view;
  57.   Z_Buffer* zBuffer;
  58.  
  59.   int coneResolution;
  60.   int sphereResolution;
  61.   real* sintable;            // precompute sin, cos for fast cone generation
  62.   real* costable;         
  63.   Vector* top;
  64.   Vector* bottom;
  65.  
  66.   PolygonList* unitSphere;
  67. };
  68.  
  69. #endif // FlatDevice_H
  70.