Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TestImage.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 
20 #ifndef OMNI_INPUT_TESTIMAGE_H_
21 #define OMNI_INPUT_TESTIMAGE_H_
22 
23 #include <QOpenGLShaderProgram>
24 #include <QOpenGLFramebufferObject>
25 #include <omni/input/Framebuffer.h>
27 
28 namespace omni {
29  namespace input {
30  /**@brief Abstract class for test images that are generated with a shader
31  **/
32  class TestImage :
33  public Framebuffer {
34  public:
35  TestImage(Interface const *_parent = nullptr);
36  virtual ~TestImage() {}
37 
38  /// Update framebuffer image
39  virtual void update();
40 
41  virtual void destroy();
42 
43  /// Return ruler position
44  QPointF rulerPos() const;
45 
46  /// Set ruler position
47  void setRulerPos(QPointF const&);
48 
49  /// Serialize to stream
50  virtual void toPropertyMap(PropertyMap&) const;
51 
52  /// Deserialize from stream
53  virtual void fromPropertyMap(PropertyMap const&);
54 
55  inline virtual categoryset_type categories() const {
56  return categoryset_type({"Test images"});
57  }
58 
59  protected:
60  /**@brief Virtual method to handle additional shader uniforms in derived classes
61  **/
62  virtual void shaderUniformHandler();
63 
64  ContextBoundPtr<QOpenGLShaderProgram> shader_;
65 
66  private:
67  /// String representing the fragment shader source
68  virtual QString fragmentShaderSource() const = 0;
69 
70  /// String representing the vertex shader source
71  virtual QString vertexShaderSource() const = 0;
72 
73  QPointF rulerPos_;
74  };
75  }
76 }
77 
78 #endif /* OMNI_INPUT_TESTIMAGE_H_ */
QPointF rulerPos() const
Return ruler position.
Definition: TestImage.cpp:49
virtual ~TestImage()
Definition: TestImage.h:36
virtual void shaderUniformHandler()
Virtual method to handle additional shader uniforms in derived classes.
Definition: TestImage.cpp:54
QPointF rulerPos_
Definition: TestImage.h:73
ContextBoundPtr< QOpenGLShaderProgram > shader_
Definition: TestImage.h:64
std::set< QString > categoryset_type
Definition: Interface.h:64
virtual void fromPropertyMap(PropertyMap const &)
Deserialize from stream.
Definition: TestImage.cpp:100
void setRulerPos(QPointF const &)
Set ruler position.
Definition: TestImage.cpp:44
virtual QString vertexShaderSource() const =0
String representing the vertex shader source.
TestImage(Interface const *_parent=nullptr)
Definition: TestImage.cpp:32
virtual QString fragmentShaderSource() const =0
String representing the fragment shader source.
Input object that is renderer to a framebuffer.
Definition: Framebuffer.h:30
Generic input interface.
Definition: Interface.h:53
virtual void toPropertyMap(PropertyMap &) const
Serialize to stream.
Definition: TestImage.cpp:94
virtual void destroy()
Definition: TestImage.cpp:38
virtual void update()
Update framebuffer image.
Definition: TestImage.cpp:59
virtual categoryset_type categories() const
Input can have a fixed set of categories.
Definition: TestImage.h:55
Abstract class for test images that are generated with a shader.
Definition: TestImage.h:32