home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics 16,000
/
graphics-16000.iso
/
msdos
/
utils
/
graphtal.lzh
/
Graphtal.Amiga
/
DeviceDriver.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-20
|
3KB
|
98 lines
/*
* DeviceDriver.h - abstract class definition for device drivers.
*
* Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
* University of Berne, Switzerland
* All rights reserved.
*
* This software may be freely copied, modified, and redistributed
* provided that this copyright notice is preserved on all copies.
*
* You may not distribute this software, in whole or in part, as part of
* any commercial product without the express consent of the authors.
*
* There is no warranty or other guarantee of fitness of this software
* for any purpose. It is provided solely "as is".
*
*/
#ifndef DeviceDriver_H
# define DeviceDriver_H
#include "list.h"
#include "table.h"
#include "Vector.h"
#include "TransMatrix.h"
#include "BoundingBox.h"
#include "Color.h"
#include "Options.h"
/*___________________________________________________________ DeviceDriver
*
* Abstract base class for any device driver. The following function
* must be supplied by a new driver:
*
* - void begin() : called before any other graphic commands to
* set up whatever you need.
* - void end() : end of interpretation (close the file, ...)
* - void cylinder(..), cone(..), sphere(..), polygon(..)
* : geometric primitives to be supported.
* - void color(Color)
* : set a new color (better you check if the new
* color is different from the old one!)
* - void beginMacro(..), endMacro(..), executeMacro(..)
* : member functions for macro support. Within a
* macro definition you have to store the geometric
* primitives for later use (see WireDevice), or just
* ignore them (see LineDevice).
* - void libraryObject(..)
* : include a predefined object at the current position
* (it's done in the RayshadeDevice, but for others we
* would need a general object format).
*/
class Polygon;
typedef void* anyPtr;
declareTable(StringTable, rcString, anyPtr);
class DeviceDriver
{
public:
DeviceDriver();
virtual ~DeviceDriver();
virtual void begin()=0;
virtual void end(const BoundingBox&)=0;
virtual void cylinder(const Vector&, const Vector&, real)=0;
virtual void cone(const Vector&, real, const Vector&, real)=0;
virtual void sphere(const Vector&, real)=0;
virtual void polygon(Polygon*)=0;
virtual void color(const Color&);
virtual void texture(const rcString&);
virtual void beginMacro(const rcString&);
virtual void endMacro();
virtual void executeMacro(const rcString&, const TransMatrix&);
virtual void libraryObject(const rcString&, const TransMatrix&);
virtual int addMacroName(const rcString&);
virtual void addLibraryObjectName(const rcString&);
void setName(const rcString&);
protected:
DeviceDriver(Options*);
protected:
rcString LSystemName;
Options* theOptions;
long primitives;
int definingMacro;
StringTable macroNames;
StringTable libraryNames;
};
#endif // DeviceDriver_H