VAPoR  0.1
renderer.h
Go to the documentation of this file.
1 //************************************************************************
2 // *
3 // Copyright (C) 2004 *
4 // University Corporation for Atmospheric Research *
5 // All Rights Reserved *
6 // *
7 //************************************************************************///
8 // File: renderer.h
9 //
10 // Author: Alan Norton
11 // National Center for Atmospheric Research
12 // PO 3000, Boulder, Colorado
13 //
14 // Date: September 2004
15 //
16 // Description: Defines the Renderer class.
17 // A pure virtual class that is implemented for each renderer.
18 // Methods are called by the glwindow class as needed.
19 //
20 
21 #ifndef RENDERER_H
22 #define RENDERER_H
23 #include <qobject.h>
24 #include <qimage.h>
25 #include <vapor/MyBase.h>
26 #include <vapor/common.h>
27 #include "params.h"
28 #include "glwindow.h"
29 #include <qgl.h>
30 using namespace VetsUtil;
31 
32 namespace VAPoR {
33 class DataMgr;
34 class Metadata;
35 
45 class RENDER_API Renderer: public QObject, public MyBase
46 {
47  Q_OBJECT
48 
49 
50 public:
54  //
55  Renderer(GLWindow* vw, RenderParams* rp, string name);
56  virtual ~Renderer();
61  virtual void initializeGL() = 0;
62 
64  virtual void paintGL() = 0;
65 
69  virtual void setRenderParams(RenderParams* rp) {currentRenderParams = rp;}
70 
73  RenderParams* getRenderParams(){return currentRenderParams;}
74 
77  bool isInitialized() {return initialized;}
78 
82  void setBypass(int timestep) {if(currentRenderParams)currentRenderParams->setBypass(timestep);}
83 
88  void setPartialBypass(int timestep) {if(currentRenderParams)currentRenderParams->setPartialBypass(timestep);}
89 
94  void setAllBypass(bool val){if (currentRenderParams) currentRenderParams->setAllBypass(val);}
95 
99  bool doBypass(int timestep) {return (currentRenderParams && currentRenderParams->doBypass(timestep));}
100 
105  bool doAlwaysBypass(int timestep) {
106  return (currentRenderParams && currentRenderParams->doAlwaysBypass(timestep));}
107 
111  virtual void setAllDataDirty() = 0;
112 
113 #ifndef DOXYGEN_SKIP_THIS
114  const string& getMyName() const {return(_myName);};
115  //Obsolete methods:
116  virtual bool clutIsDirty() {return clutDirtyBit;}
117  virtual void setClutDirty(){clutDirtyBit = true;}
118  virtual void clearClutDirty(){clutDirtyBit = false;}
119  void renderColorscale(bool rebuild, int colorbarIndex);
120 
121  GLWindow* myGLWindow;
122 
123 
124 signals:
125 
126  void statusMessage(const QString&);
127 
128 protected:
129  void enableClippingPlanes(const double extents[6]);
130  void enableFullClippingPlanes();
131  void enableRegionClippingPlanes();
132  void enable2DClippingPlanes();
133  void disableFullClippingPlanes();
134  void disableRegionClippingPlanes();
135  RenderParams* currentRenderParams;
136  void buildColorscaleImage(int colortableIndex);
137 
138 
139 
140 
141  //Dimensions of colormap image:
142  int imgWidth, imgHeight;
143  QImage glColorbarImage;
144 
145  float regionFrameColor[3];
146  float subregionFrameColor[3];
147  int savedNumXForms;
148  bool initialized;
149  GLuint _colorbarTexid;
150 
151 private:
152  bool clutDirtyBit;
153  string _myName;
154 #endif //DOXYGEN_SKIP_THIS
155 };
156 };
157 
158 #endif // RENDERER_H
RenderParams * getRenderParams()
Definition: renderer.h:73
A class for performing OpenGL rendering in a VAPOR Visualizer.
Definition: glwindow.h:77
A Params subclass for managing parameters used by Renderers.
Definition: params.h:569
void setAllBypass(bool val)
Definition: renderer.h:94
bool doBypass(int timestep)
Definition: renderer.h:99
bool isInitialized()
Definition: renderer.h:77
bool doAlwaysBypass(int timestep)
Definition: renderer.h:105
Definition: Base64.h:6
void setPartialBypass(int timestep)
Definition: renderer.h:88
#define RENDER_API
Definition: common.h:64
VetsUtil base class.
Definition: MyBase.h:68
virtual void setRenderParams(RenderParams *rp)
Definition: renderer.h:69
void setBypass(int timestep)
Definition: renderer.h:82
A class that performs rendering in the GLWindow.
Definition: renderer.h:45