Renderer.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.6 $
00022 // $Date: 2003/05/15 21:42:43 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/renderer/Renderer.h,v $
00024                                                                         
00025                                                                         
00026 // File: ~/renderer/Renderer.h
00027 //
00028 // Written: fmk 
00029 // Created: 10/98
00030 // Revision: A
00031 //
00032 // Description: This file contains the class definition for Renderer.
00033 // Renderer is an abstract base class. An Renderer object is used
00034 // to process 3d graphics.
00035 //
00036 // What: "@(#) Renderer.h, revA"
00037 
00038 #ifndef Renderer_h
00039 #define Renderer_h
00040 
00041 #include <OPS_Globals.h>
00042 
00043 class Vector;
00044 class Matrix;
00045 class ColorMap;
00046 
00047 class Renderer
00048 {
00049   public:
00050     Renderer(ColorMap &theMap);    
00051     Renderer(const char *title, ColorMap &theMap);    
00052     virtual ~Renderer();
00053 
00054     // method to set the color map
00055     void setColorMap(ColorMap &theMap);
00056 
00057     // method to clear the current image
00058     virtual int clearImage(void) =0;    
00059     virtual int saveImage(const char *imageName);
00060     int saveImage(const char *title, const char *imageName);
00061 
00062     // methods to be invoked when image processing is to start or is finished
00063     virtual int startImage(void) =0;    
00064     virtual int doneImage(void) =0;
00065 
00066     // methods invoked by the objects to display themselves    
00067     virtual int drawPoint(const Vector &, float V1, int width = 1) =0;
00068     virtual int drawPoint(const Vector &, const Vector &rgb1, int width = 1) =0;
00069 
00070     virtual int drawLine(const Vector &, const Vector &, 
00071                          float V1, float V2, int width = 1, int style = 1) =0;
00072 
00073     virtual int drawLine(const Vector &end1, const Vector &end2, 
00074                          const Vector &rgb1, const Vector &rgb2,
00075                          int width = 1, int style = 1) =0;
00076     
00077     virtual int drawPolygon(const Matrix &points, const Vector &values) =0;
00078     virtual int drawPolygon(const Matrix &points, const Matrix &rgbValues) =0;
00079 
00080     virtual int drawVector(const Vector &position, const Vector &value, double factor);
00081     
00082     virtual int drawText(const Vector &posGlobal, char *string, int length, 
00083                           char horizontalJustify = 'l', char verticalJustify = 'b') =0;    
00084 
00085     // 
00086     // the following are for setting up the vieing system
00087     //
00088 
00089     // the following are in world coordinates & define view coord system
00090     virtual int setVRP(float x, float y, float z) =0; // point on view plane    
00091     virtual int setVPN(float x, float y, float z) =0; // view plane normal
00092     virtual int setVUP(float x, float y, float z) =0; // view-up vector
00093         
00094     // the following are in view coordinates    
00095     virtual int setViewWindow(float, float, float, float) =0; // view bounds
00096                                // umin, umax, vmin, vmax
00097 
00098     virtual int setPlaneDist(float, float) =0; // location of
00099                                // near and far clipping planes from view plane
00100 
00101     virtual int setProjectionMode(const char *mode) =0; //parallel or perspective
00102     virtual int setFillMode(const char *mode) =0;    // wire or fill
00103     
00104     virtual int setPRP(float u, float v, float n) =0; // eye location if 
00105                                // perspective, dirn to +ViewPlane if parallel
00106 
00107     // the following are in normalized coordinates
00108     virtual int setPortWindow(float, float, float, float) =0; // view port
00109                               // left, right, bottom, top [-1,1,-1,1]
00110 
00111 
00112   protected:
00113     ColorMap *theMap;
00114     
00115   private:
00116     static int numRenderers;
00117     static char **theTitles;
00118     static Renderer **theRenderers;
00119 };
00120 
00121 
00122 #endif
00123 

Generated on Mon Oct 23 15:05:27 2006 for OpenSees by doxygen 1.5.0