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

  1. /*
  2.  * WireDevice.h - class definition wire frame 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 WireDevice_H
  19. # define WireDevice_H
  20.  
  21. #include "DeviceDriver.h"
  22. #include "BaseWindow.h"
  23. #include "ViewTransform.h"
  24.  
  25. /*___________________________________________________________ WireDevice
  26.  *
  27.  * Wire frame device driver. Supports macro definitions. 
  28.  */
  29.  
  30. class WireDevice : public DeviceDriver 
  31. {
  32. public:
  33.   WireDevice(BaseWindow*, Options*);
  34.   ~WireDevice();
  35.  
  36.   void begin();
  37.   void end(const BoundingBox&);
  38.   void cylinder(const Vector&, const Vector&, real);
  39.   void cone(const Vector&, real, const Vector&, real);
  40.   void polygon(Polygon*);
  41.   void sphere(const Vector&, real);
  42.   void beginMacro(const rcString&);
  43.   void endMacro();
  44.   void executeMacro(const rcString&, const TransMatrix&);
  45.  
  46. private:
  47.   rcString currentMacroName;
  48.   PolygonList* polys; // Collection of polygons from current macro 
  49.                       // definition.
  50.  
  51.   BaseWindow* w; 
  52.  
  53.   int coneResolution;
  54.   int sphereResolution;
  55.   real* sintable; // Precomputed sin, cos value for fast cone and
  56.   real* costable; //  cylinder generation.
  57.   Vector* top;
  58.   Vector* bottom;
  59.     
  60.   PolygonList* unitSphere; // Tesselation of a unit sphere. 
  61.                            // Origin (0,0,0), radius (1)
  62. };
  63.  
  64. #endif // WireDevice_H
  65.