Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Grid.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19  #ifndef OMNI_VISUAL_GRID_H_
20  #define OMNI_VISUAL_GRID_H_
21 
22 #include <memory>
23 #include <QSize>
24 #include <QVector2D>
25 #include <omni/visual/Interface.h>
27 #include <omni/visual/Plane.h>
29 
30 class QOpenGLShaderProgram;
31 
32 namespace omni {
33  namespace visual {
34  /**@brief A cartesian grid with lining adapted to distance
35  **/
36  class Grid : public visual::Interface {
37  public:
38  Grid(CameraInterface const*);
39  ~Grid();
40 
41  /// Draw grid
42  void draw() const;
43 
44  /// Draw grid with alpha value
45  void draw(float _alpha) const;
46 
47  /// Update grid mesh
48  void update();
49 
50  /**@brief Resolution
51  **/
52  void setResolution(QSize _resolution);
53 
54  /// Return resolution
55  QSize const& resolution() const;
56 
57  QVector2D const& size() const;
58 
59  /// Set size of grid
60  void setSize(QVector2D const& _size);
61 
62  void setCamera(CameraInterface const*);
63  CameraInterface const* camera() const;
64 
65  private:
66  QSize resolution_;
67  CameraInterface const* camera_ = nullptr;
69  QVector2D size_;
71  };
72  }
73 }
74 
75 #endif /* OMNI_VISUAL_GRID_H_ */
A generic camera interface.
Definition: CameraInterface.h:29
Plane plane_
Definition: Grid.h:68
A plane with n x m grid points Vertex data is not stored on host, it is copied to GPU directly...
Definition: Plane.h:33
void update()
Update grid mesh.
Definition: Grid.cpp:61
Grid(CameraInterface const *)
Definition: Grid.cpp:28
CameraInterface const * camera_
Definition: Grid.h:67
Basic visual interface.
Definition: Interface.h:28
static ContextBoundPtr< QOpenGLShaderProgram > shader_
Definition: Grid.h:70
void setCamera(CameraInterface const *)
Definition: Grid.cpp:85
QVector2D size_
Definition: Grid.h:69
void draw() const
Draw grid.
Definition: Grid.cpp:37
QVector2D const & size() const
Definition: Grid.cpp:77
A cartesian grid with lining adapted to distance.
Definition: Grid.h:36
void setSize(QVector2D const &_size)
Set size of grid.
Definition: Grid.cpp:81
CameraInterface const * camera() const
Definition: Grid.cpp:89
QSize resolution_
Definition: Grid.h:66
~Grid()
Definition: Grid.cpp:35
QSize const & resolution() const
Return resolution.
Definition: Grid.cpp:69
void setResolution(QSize _resolution)
Resolution.
Definition: Grid.cpp:73