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

  1. /*
  2.  * RayshadeDevice.h - class definition for rayshade 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 RayshadeDevice_H
  19. # define RayshadeDevice_H
  20.  
  21. #include <iostream.h>
  22. #include <fstream.h>
  23. #include "DeviceDriver.h"
  24.  
  25. /*___________________________________________________________ RayshadeDevice
  26.  *
  27.  * Rayshade device driver generates rayshade definition files. Each
  28.  * rayshade definition consists of two files: 
  29.  *  - name.ray:     viewing parameter, macro definition, includes
  30.  *  - name.ray.def: geometric primitives
  31.  *
  32.  * For each macro definition RayshadeDevice generates a file with
  33.  * the primitives of the macro.
  34.  */
  35.  
  36. class RayshadeDevice : public DeviceDriver 
  37. {
  38. public:
  39.   RayshadeDevice(Options*);
  40.   ~RayshadeDevice();
  41.  
  42.   void begin();
  43.   void end(const BoundingBox&);
  44.   void cylinder(const Vector&, const Vector&, real);
  45.   void cone(const Vector&, real, const Vector&, real);
  46.   void polygon(Polygon*);
  47.   void sphere(const Vector&, real);
  48.   void color(const Color&);
  49.   void texture(const rcString&);
  50.   void beginMacro(const rcString&);
  51.   void endMacro();
  52.   void executeMacro(const rcString&, const TransMatrix&);
  53.   void libraryObject(const rcString&, const TransMatrix&);
  54.  
  55. private:
  56.   ofstream* defFile;  // stream for name.ray.def
  57.   ofstream  rayFile;  // stream for name.ray
  58.   rcString  currentColor;
  59.   int applyTexture;
  60.   rcString  currentTexture;
  61.  
  62.   /*
  63.    * Temporary variables for macro execution.
  64.    */
  65.   ofstream* saveDefFile;
  66.   long savePrimitives;
  67.   rcString currentMacroName;
  68.  
  69. private:
  70.   void object(const rcString&, const TransMatrix&);
  71. };
  72.  
  73. #endif // RayshadeDevice_H
  74.  
  75.