VAPOR3 3.9.4
ImageRenderer.h
Go to the documentation of this file.
1#ifndef IMAGERENDERER_H
2#define IMAGERENDERER_H
3
6#include <vapor/DataMgr.h>
8#include <vapor/GeoImage.h>
9#include <vapor/Grid.h>
10#include <vapor/utils.h>
11
12namespace VAPoR {
13
15public:
16 ImageRenderer(const ParamsMgr *pm, string winName, string dataSetName, string instName, DataMgr *dataMgr);
17
18 virtual ~ImageRenderer();
19
20 static std::string GetClassType() { return ("Image"); }
21
22protected:
23 int GetMesh(DataMgr *dataMgr, GLfloat **verts, GLfloat **normals, GLsizei &nverts, GLsizei &width, GLsizei &height, GLuint **indices, GLsizei &nindices, bool &structuredMesh);
24
25 const GLvoid *GetTexture(DataMgr *dataMgr, GLsizei &width, GLsizei &height, GLint &internalFormat, GLenum &format, GLenum &type, size_t &texelSize, bool &gridAligned);
26
27private:
28 GeoImage * _geoImage;
29 unsigned char *_twoDTex;
30 string _cacheImgFileName;
31 vector<double> _cacheTimes;
32 vector<double> _pcsExtentsData;
33 double _pcsExtentsImg[4];
34 string _proj4StringImg;
35 GLsizei _texWidth;
36 GLsizei _texHeight;
37 const int _maxResamplingResolution;
38 size_t _cacheTimestep;
39 int _cacheRefLevel;
40 int _cacheLod;
41 int _cacheTMSLOD;
42 vector<double> _cacheBoxExtents;
43 size_t _cacheTimestepTex;
44 string _cacheHgtVar;
45 int _cacheGeoreferenced;
46 vector<double> _cacheBoxExtentsTex;
47 SmartBuf _sb_verts;
48 SmartBuf _sb_normals;
49 SmartBuf _sb_indices;
50 GLsizei _vertsWidth;
51 GLsizei _vertsHeight;
52 GLsizei _nindices;
53 GLsizei _nverts;
54
55 unsigned char *_getTexture(DataMgr *dataMgr);
56
57 bool _gridStateDirty() const;
58
59 void _gridStateClear();
60
61 void _gridStateSet();
62
63 bool _imageStateDirty(const vector<double> &times) const;
64
65 void _imageStateSet(const vector<double> &times);
66
67 void _imageStateClear();
68
69 bool _texStateDirty(DataMgr *dataMgr) const;
70
71 void _texStateSet(DataMgr *dataMgr);
72
73 void _texStateClear();
74
75 int _reinit(string path, vector<double> times);
76
77 unsigned char *_getImage(GeoImage *geoimage, size_t ts, string proj4StringData, vector<double> pcsExtentsDataVec, double pcsExtentsImg[4], double geoCornersImg[8], string &proj4StringImg,
78 GLsizei &width, GLsizei &height) const;
79
80 int _getMeshDisplacedGeo(DataMgr *dataMgr, Grid *hgtGrid, GLsizei width, GLsizei height, double defaultZ);
81
82 // Compute _verts for displayed, non-georeferenced image
83 //
84 int _getMeshDisplacedNoGeo(DataMgr *dataMgr, Grid *hgtGrid, GLsizei width, GLsizei height, const vector<double> &minExt, const vector<double> &maxExt, double defaultZ);
85
86 int _getMeshDisplaced(DataMgr *dataMgr, GLsizei width, GLsizei height, const vector<double> &minBox, const vector<double> &maxBox, double defaultZ);
87
88 int _getMeshPlane(const vector<double> &minBox, const vector<double> &maxBox, double defaultZ);
89
90 // Get the selected horizontal ROI in PCS data coordinates
91 //
92 vector<double> _getPCSExtentsData() const;
93
94 // Transform verts from absolute to local coordinates
95 //
96 void _transformToLocal(size_t width, size_t height, const vector<double> &scaleFac) const;
97
98 void _clearCache() { _cacheHgtVar.clear(); }
99};
100}; // namespace VAPoR
101
102#endif // TWODRENDERER_H
A cache based data reader.
Definition: DataMgr.h:110
An abstract class for managing geo-referenced images.
Definition: GeoImage.h:20
Abstract base class for a 2D or 3D structured or unstructured grid.
Definition: Grid.h:56
ImageRenderer(const ParamsMgr *pm, string winName, string dataSetName, string instName, DataMgr *dataMgr)
static std::string GetClassType()
Definition: ImageRenderer.h:20
virtual ~ImageRenderer()
const GLvoid * GetTexture(DataMgr *dataMgr, GLsizei &width, GLsizei &height, GLint &internalFormat, GLenum &format, GLenum &type, size_t &texelSize, bool &gridAligned)
int GetMesh(DataMgr *dataMgr, GLfloat **verts, GLfloat **normals, GLsizei &nverts, GLsizei &width, GLsizei &height, GLuint **indices, GLsizei &nindices, bool &structuredMesh)
A singleton class for managing Params instances.
Definition: ParamsMgr.h:53
#define RENDER_API
Definition: common.h:78