VAPOR3 3.9.4
ParticleRenderer.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 2018 *
4// University Corporation for Atmospheric Research *
5// All Rights Reserved *
6// *
7//************************************************************************/
8//
9// File: ParticleRenderer.cpp
10//
11// Author: Stas Jaroszynski
12// National Center for Atmospheric Research
13// PO 3000, Boulder, Colorado
14//
15// Date: March 2018
16//
17// Description:
18// Definition of ParticleRenderer
19//
20#ifndef ParticleRENDERER_H
21#define ParticleRENDERER_H
22
23#include <glm/glm.hpp>
24#include <vapor/glutil.h>
25#include "vapor/VAssert.h"
26
27#include <vapor/Renderer.h>
29#include <vapor/ShaderProgram.h>
30#include <vapor/Texture.h>
31
32namespace VAPoR {
33
34class DataMgr;
35
42public:
43 ParticleRenderer(const ParamsMgr *pm, string winName, string dataSetName, string instName, DataMgr *dataMgr);
44
46
47 static string GetClassType() { return ("Particle"); }
48
50 virtual int _initializeGL();
52 virtual int _paintGL(bool fast);
53
54private:
55 struct {
56 size_t ts;
57 int rLevel;
58 int cLevel;
59 std::vector<float> tf_lut;
60 std::vector<double> tf_minMax;
62 float radius;
64 size_t stride;
65 string varName;
67 std::vector<std::string> fieldVars;
68 } _cacheParams;
69
70 struct Vertex {
71 glm::vec3 point;
72 float value;
73 };
74
75 size_t _particlesCount;
76
77 unsigned int _VAO = 0;
78 unsigned int _VBO = 0;
79
80 GLuint _colorMapTexId = 0;
81 GLuint _vertexArrayId = 0;
82 GLuint _vertexBufferId = 0;
83 const GLint _colorMapTexOffset;
84 float _colorMapRange[3];
85 std::vector<float> _colorMap;
86
87 void _clearCache() {}
88
89 bool _particleBaseSizeIsDirty() const;
90 bool _particleCacheIsDirty() const;
91 bool _colormapCacheIsDirty() const;
92 void _resetParticleCache();
93 void _resetColormapCache();
94 int _generateParticlesLegacy(Grid*& grid, std::vector<Grid*>& vecGrids);
95 int _getGrids(Grid*& grid, std::vector<Grid*>& vecGrids) const;
96 template<typename T> void UploadDataBuffer(vector<T> buffer);
97 void _generateTextureData(const Grid* grid, const std::vector<Grid*>& vecGrids);
98 void _computeBaseRadius();
99 void _renderParticlesLegacy(const Grid* grid, const std::vector<Grid*>& vecGrids) const;
100 int _renderParticlesHelper();
101 void _prepareColormap();
102 glm::vec3 _getScales();
103};
104
105}; // namespace VAPoR
106
107#endif // ParticleRENDERER_H
A cache based data reader.
Definition: DataMgr.h:110
A singleton class for managing Params instances.
Definition: ParamsMgr.h:53
Class that draws the Particles (Particles) as specified by IsolineParams.
VAPoR::CoordType boxMax
ParticleRenderer(const ParamsMgr *pm, string winName, string dataSetName, string instName, DataMgr *dataMgr)
std::vector< float > tf_lut
std::vector< double > tf_minMax
virtual int _paintGL(bool fast)
All OpenGL rendering is performed in the pure virtual paintGL method.
std::vector< std::string > fieldVars
virtual int _initializeGL()
static string GetClassType()
A class that performs rendering in a Visualizer.
Definition: Renderer.h:121
#define RENDER_API
Definition: common.h:78
std::array< double, 3 > CoordType
Type for specifying floating point coordinates.
Definition: Grid.h:23