VAPOR3 3.9.4
SliceRenderer.h
Go to the documentation of this file.
1#ifndef SLICERENDERER_H
2#define SLICERENDERER_H
3
4#include <vapor/glutil.h>
5
6#include <glm/glm.hpp>
7#include <vapor/DataMgr.h>
8#include <vapor/utils.h>
9#include <vapor/Renderer.h>
10
11//#define DEBUG 1
12
13namespace VAPoR {
14
15
17public:
18 SliceRenderer(const ParamsMgr *pm, string winName, string dataSetName, string instName, DataMgr *dataMgr);
19
20 static string GetClassType() { return ("Slice"); }
21
22 virtual ~SliceRenderer();
23
24protected:
25 virtual int _initializeGL();
26 virtual int _paintGL(bool fast);
27
28private:
29 struct {
30 string varName;
32 size_t ts;
37 double xRotation;
38 double yRotation;
39 double zRotation;
40 double xOrigin;
41 double yOrigin;
42 double zOrigin;
43 std::vector<float> tf_lut;
44 std::vector<double> tf_minMax;
47 std::vector<double> sampleLocation;
48 std::vector<double> sliceRotation;
49 std::vector<double> sliceNormal;
52 } _cacheParams;
53
54 void _initVAO();
55 void _initTexCoordVBO();
56 void _initVertexVBO();
57
58 bool _isColormapCacheDirty() const;
59 bool _isDataCacheDirty() const;
60 bool _isBoxCacheDirty() const;
61 void _getExtents(VAPoR::CoordType &min, VAPoR::CoordType &max) const;
62 void _resetColormapCache();
63 void _resetCache();
64 void _createDataTexture(std::unique_ptr<float> &dataValues);
65 int _regenerateSlice();
66 int _getGrid3D(Grid *&grid) const;
67#ifdef DEBUG
68 void _drawDebugPolygons();
69#endif
70
71 void _configureShader();
72 void _resetState();
73 void _initializeState();
74
75 bool _initialized;
76 size_t _textureSideSize;
77
78 GLuint _colorMapTextureID;
79 GLuint _dataValueTextureID;
80
81 std::vector<double> _windingOrder;
82 std::vector<double> _rectangle3D;
83
84 GLuint _VAO;
85 GLuint _vertexVBO;
86 GLuint _texCoordVBO;
87
88 int _colorMapSize;
89
90 void _clearCache() { _cacheParams.varName.clear(); }
91};
92
93}; // namespace VAPoR
94
95#endif
A cache based data reader.
Definition: DataMgr.h:110
Abstract base class for a 2D or 3D structured or unstructured grid.
Definition: Grid.h:56
A singleton class for managing Params instances.
Definition: ParamsMgr.h:53
A class that performs rendering in a Visualizer.
Definition: Renderer.h:121
SliceRenderer(const ParamsMgr *pm, string winName, string dataSetName, string instName, DataMgr *dataMgr)
virtual ~SliceRenderer()
VAPoR::CoordType boxMax
Definition: SliceRenderer.h:45
std::vector< double > sliceNormal
Definition: SliceRenderer.h:49
VAPoR::CoordType domainMax
Definition: SliceRenderer.h:46
virtual int _paintGL(bool fast)
All OpenGL rendering is performed in the pure virtual paintGL method.
std::vector< double > sampleLocation
Definition: SliceRenderer.h:47
std::vector< double > sliceRotation
Definition: SliceRenderer.h:48
static string GetClassType()
Definition: SliceRenderer.h:20
std::vector< float > tf_lut
Definition: SliceRenderer.h:43
virtual int _initializeGL()
std::vector< double > tf_minMax
Definition: SliceRenderer.h:44
#define RENDER_API
Definition: common.h:78
std::array< double, 3 > CoordType
Type for specifying floating point coordinates.
Definition: Grid.h:23