Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tuning.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_VISUAL_TUNING_H_
21 #define OMNI_VISUAL_TUNING_H_
22 
23 #include <QRectF>
24 #include <QOpenGLShaderProgram>
25 #include <QOpenGLFramebufferObject>
26 #include <QOpenGLTexture>
27 
28 #include <omni/proj/Tuning.h>
29 #include <omni/visual/WarpGrid.h>
30 #include <omni/visual/Texture32F.h>
31 #include <omni/proj/Calibration.h>
32 
33 namespace omni
34 {
35  namespace visual
36  {
37  class Session;
38 
39  /// Tuning visualizer
40  class Tuning
41  {
42  public:
44  ~Tuning();
45 
46  omni::proj::Tuning const& tuning() const;
47 
48  /// Update shaders, warp grid and blend texture
49  void update();
50 
51  /// Updates blend texture after it has changed by blend brush
52  void updateBlendTexture();
53 
54  /// Update warp grid mesh
55  void updateWarpGrid();
56 
57  /// Set portion of blend mask which is to be updated
58  void setBlendTextureUpdateRect(QRect const&);
59 
60  /// Draw Test card image for screen setup
61  void drawTestCard(int _id, bool _grayscale = false);
62 
63  /**@brief Draws warp grid with lines and handles
64  @param _rect Screen Rectangle of input
65  **/
66  void drawWarpGrid() const;
67 
68  /// Draw warp grip without lines and handles
69  void drawWarpPatch() const;
70 
71  /// Draws Blendmask with warp grid and brush stroke layer
72  void drawOutput(
73  float _inputOpacity = 0.0,
74  QColor const& _color = Qt::white,
75  float _blendMaskOpacity = 1.0,
76  bool _grayscale = true) const;
77 
78  /// Draw cursor for blend brush
79  void drawCursor(QPointF const& _pos);
80 
81  bool initialized() const;
82 
83  /// Update warp buffer which contains image of projector perspective
84  void updateWarpBuffer(visual::Session const* _vizSession);
85 
87 
88  void drawCalibratedInput(bool _flipped = false);
89 
90  private:
91 
92  /**@brief Calculates rectangle of this tuning
93  **/
94  QRectF tuningRect() const;
95 
96  /// Return QVector4D of channel correction parameters
97  QVector4D channelCorrectionAsVec(Channel) const;
98 
100 
104 
106 
107  /// Frame buffer which holds a texture with current view image
109 
111 
113 
119  };
120  }
121 }
122 
123 #endif /* OMNI_VISUAL_TUNING_H_ */
void setBlendTextureUpdateRect(QRect const &)
Set portion of blend mask which is to be updated.
Definition: Tuning.cpp:130
QRect blendTextureUpdateRect_
Definition: Tuning.h:112
void drawWarpPatch() const
Draw warp grip without lines and handles.
Definition: Tuning.cpp:72
void updateWarpBuffer(visual::Session const *_vizSession)
Update warp buffer which contains image of projector perspective.
Definition: Tuning.cpp:351
void drawCursor(QPointF const &_pos)
Draw cursor for blend brush.
Definition: Tuning.cpp:216
void drawCalibratedInput(bool _flipped=false)
Definition: Tuning.cpp:411
static ContextBoundPtr< QOpenGLShaderProgram > calibrationShader_
Definition: Tuning.h:114
Channel
Definition: Channel.h:24
bool initialized() const
Definition: Tuning.cpp:235
A projector tuning holds adjustment and distorsion data for a single projector and screen A tuning c...
Definition: Tuning.h:52
void update()
Update shaders, warp grid and blend texture.
Definition: Tuning.cpp:77
void drawTestCard(int _id, bool _grayscale=false)
Draw Test card image for screen setup.
Definition: Tuning.cpp:50
void generateCalibrationData()
Definition: Tuning.cpp:391
~Tuning()
Definition: Tuning.cpp:43
omni::proj::Tuning & tuning_
Definition: Tuning.h:99
static ContextBoundPtr< QOpenGLShaderProgram > blendBrushCursorShader_
Definition: Tuning.h:118
omni::proj::Tuning const & tuning() const
Definition: Tuning.cpp:45
ContextBoundPtr< QOpenGLFramebufferObject > warpGridBuffer_
Frame buffer which holds a texture with current view image.
Definition: Tuning.h:108
Calibration generated from a tuning Calibration has output mode with either UVW or TEXCOORDS...
Definition: Calibration.h:39
proj::Calibration calibration_
Definition: Tuning.h:105
QVector4D channelCorrectionAsVec(Channel) const
Return QVector4D of channel correction parameters.
Definition: Tuning.cpp:397
void updateBlendTexture()
Updates blend texture after it has changed by blend brush.
Definition: Tuning.cpp:142
QRectF tuningRect() const
Calculates rectangle of this tuning.
Definition: Tuning.cpp:461
ContextBoundPtr< QOpenGLFramebufferObject > testCardFrameBuffer_
Definition: Tuning.h:110
Base class for drawing a session.
Definition: Session.h:33
void drawOutput(float _inputOpacity=0.0, QColor const &_color=Qt::white, float _blendMaskOpacity=1.0, bool _grayscale=true) const
Draws Blendmask with warp grid and brush stroke layer.
Definition: Tuning.cpp:240
ContextBoundPtr< QOpenGLTexture > blendTex_
Definition: Tuning.h:102
static ContextBoundPtr< QOpenGLShaderProgram > blendBrushShader_
Definition: Tuning.h:117
static ContextBoundPtr< QOpenGLShaderProgram > testCardShader_
Definition: Tuning.h:115
ContextBoundPtr< visual::WarpGrid > warpGrid_
Definition: Tuning.h:101
void drawWarpGrid() const
Draws warp grid with lines and handles.
Definition: Tuning.cpp:65
ContextBoundPtr< Framebuffer32F > calibrationFramebuffer_
Definition: Tuning.h:103
Tuning(omni::proj::Tuning &)
Definition: Tuning.cpp:39
void updateWarpGrid()
Update warp grid mesh.
Definition: Tuning.cpp:342
Tuning visualizer.
Definition: Tuning.h:40
static ContextBoundPtr< QOpenGLShaderProgram > blendShader_
Definition: Tuning.h:116
A pointer template which is free'd together with its context Holds an internal object which is respo...
Definition: ContextBoundPtr.h:32