openPSTD  2.0
Open source simulation for sound propagation in urban environments
GridLayer.h
1 // This file is part of openPSTD. //
3 // //
4 // openPSTD is free software: you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation, either version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // openPSTD is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with openPSTD. If not, see <http://www.gnu.org/licenses/>. //
16 // //
18 
20 //
21 // Date:
22 //
23 //
24 // Authors:
25 //
26 //
27 // Purpose:
28 //
29 //
31 
32 //
33 // Created by michiel on 26-8-2015.
34 //
35 
36 #ifndef OPENPSTD_GRIDLAYER_H
37 #define OPENPSTD_GRIDLAYER_H
38 
39 #include "Viewer2D.h"
40 
41 namespace OpenPSTD
42 {
43  namespace GUI
44  {
45  class GridLayer : public Layer
46  {
47  private:
48  std::unique_ptr<QOpenGLShaderProgram> program;
49 
50  void UpdateLines();
51 
52  std::unique_ptr<std::vector<float>> positions;
53  unsigned int positionsBuffer;
54  int lines;
55  float gridSpacing;
56  QMatrix4x4 viewMatrix;
57 
58  public:
59  GridLayer();
60 
61  virtual void InitializeGL(QObject *context, std::unique_ptr<QOpenGLFunctions, void (*)(void *)> const &f);
62 
63  virtual void PaintGL(QObject *context, std::unique_ptr<QOpenGLFunctions, void (*)(void *)> const &f);
64 
65  virtual void UpdateScene(std::shared_ptr<Model> const &m,
66  std::unique_ptr<QOpenGLFunctions, void (*)(void *)> const &f);
67 
68  virtual MinMaxValue GetMinMax();
69 
70  float CalcIdealSpacing();
71  };
72 
73  }
74 }
75 #endif //OPENPSTD_GRIDLAYER_H
This is the general namespace of the OpenPSTD application.
Definition: Boundary.cpp:33
Definition: Viewer2D.h:115
Definition: Viewer2D.h:57
Definition: GridLayer.h:45