Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Session.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_SESSION_H_
21 #define OMNI_SESSION_H_
22 
23 #include <omni/proj/TuningList.h>
24 #include <omni/input/List.h>
25 #include <omni/canvas/Interface.h>
26 #include <omni/proj/ScreenSetup.h>
28 #include <omni/BlendSettings.h>
29 #include <omni/visual/Scene.h>
30 
31 namespace omni {
32  class TuningList;
33 
34  namespace visual {
35  class Session;
36  }
37 
38  /**@brief A session consists of a canvas, a mapping, a list of tunings and one
39  or several inputs
40  */
41  class Session {
42  public:
44 
45  /// General mode of the User Interface
46  enum class Mode
47  {
48  SCREENSETUP, // Mode for setup screens
49  ARRANGE, // Mode for setting up projectors and canvas
50  WARP, // Mode for adjusting warp grid
51  BLEND, // Mode for editing the blend mask
52  COLORCORRECTION, // Mode for color correction for each projector
53  EXPORT, // Export mode
54  LIVE, // Live mode. Output is locked for faster display
55  NUM_MODES
56  };
57 
58 
59  /// Default constructor
60  Session();
61  ~Session();
62 
63  /// Returns reference to projector tunings
65 
66  /// Returns const reference to projector tunings
67  proj::TuningList const& tunings() const;
68 
69  /// Makes new mapping with given type Id
70  Mapping * setMapping(Id const& _typeId);
71 
72  /// Returns pointer to mapping
73  Mapping * mapping();
74 
75  /// Returns pointer to mapping (const version)
76  Mapping const * mapping() const;
77 
78  /// Returns reference to list of inputs
79  InputList & inputs();
80 
81  /// Returns const reference to list of inputs
82  InputList const & inputs() const;
83 
84  /// Makes new canvas with given type id and returns pointer if successful
85  Canvas * setCanvas(Id const& _typeId);
86 
87  /// Return pointer to canvas
88  Canvas * canvas();
89 
90  /// Return pointer to canvas (const version)
91  Canvas const * canvas() const;
92 
93  /// Return reference to current screen setup
94  ScreenSetup & screenSetup();
95 
96  /// Return const reference to current screen setup
97  ScreenSetup const & screenSetup() const;
98 
99  /// Return reference to export settings
100  Scene & scene();
101 
102  /// Return reference to export settings
103  Scene const & scene() const;
104 
105  /// Return reference to blend settings
107 
108  /// Return reference to blend settings
109  BlendSettings const & blendSettings() const;
110 
111  /// Return reference to export settings
112  ExportSettings & exportSettings();
113 
114  /// Return reference to export settings
115  ExportSettings const& exportSettings() const;
116 
117 
118  /// Return current mode
119  Mode mode() const;
120 
121  /// Set mode of this session
122  void setMode(Mode);
123 
124  /// A session has an output when there is an input, a canvas and a mapping
125  bool hasOutput() const;
126 
127  /// Export calibration data of session to a file
128  void renderToFile(QString const& _filename);
129 
130  /// Save session to file
131  void save(QString const& _filename) const;
132 
133  /// Load session to file
134  void load(QString const& _filename);
135 
136  /// Deserialize from stream
137  void fromStream(QDataStream&);
138 
139  /// Serialize to stream
140  void toStream(QDataStream&) const;
141 
142  /// Test for equality. ScreenSetup is ignored
143  friend bool operator==(Session const&,
144  Session const&);
145 
146  /// Make visualizer if it is not instantiated yet
148 
150  visualizer_type const* visualizer() const;
151 
152 
153  private:
154  /// List with all projector tunings
156 
157  /// Owning pointer for mapping
158  std::unique_ptr<Mapping> mapping_;
159 
160  /// List with all inputs (e.g. images, videos etc)
162 
163  /// Owning pointer for canvas
164  std::unique_ptr<Canvas> canvas_;
165 
166  /// Current screen setup
167  ScreenSetup screenSetup_;
168 
169  /// Current session mode
171 
174  ExportSettings exportSettings_;
175 
176  std::unique_ptr<visualizer_type> viz_;
177  };
178 }
179 
181 
182 OMNI_DECL_ENUM_STREAM_OPERATORS(omni::Session::Mode)
183 
184 #endif /* OMNI_SESSION_H_ */
BlendSettings blendSettings_
Definition: Session.h:173
#define OMNI_DECL_ENUM_STREAM_OPERATORS(ENUM)
Definition: Interface.h:65
A session consists of a canvas, a mapping, a list of tunings and one or several inputs.
Definition: Session.h:41
~Session()
Definition: Session.cpp:51
ExportSettings & exportSettings()
Return reference to export settings.
Definition: Session.cpp:152
Id type for classes An Id must only contain alpha numerical characters and must begin with a letter...
Definition: Id.h:34
Canvas * canvas()
Return pointer to canvas.
Definition: Session.cpp:104
Mode mode_
Current session mode.
Definition: Session.h:170
proj::TuningList tunings_
List with all projector tunings.
Definition: Session.h:155
void toStream(QDataStream &) const
Serialize to stream.
Definition: Session.cpp:188
Tuning List contains a list of tunings Tuning List is serializable via QDataStream.
Definition: TuningList.h:35
std::unique_ptr< visualizer_type > viz_
Definition: Session.h:176
ExportSettings exportSettings_
Definition: Session.h:174
omni::visual::Session visualizer_type
Definition: Session.h:43
friend bool operator==(Session const &, Session const &)
Test for equality. ScreenSetup is ignored.
Definition: Session.cpp:239
BlendSettings & blendSettings()
Return reference to blend settings.
Definition: Session.cpp:125
Input List contains a list of inputs, accessible over an QString id Input List is the root input of ...
Definition: List.h:40
Abstract interface for a canvas A canvas represents the surface on which the projection is performed...
Definition: Interface.h:46
void load(QString const &_filename)
Load session to file.
Definition: Session.cpp:180
bool hasOutput() const
A session has an output when there is an input, a canvas and a mapping.
Definition: Session.cpp:160
#define OMNI_DECL_STREAM_OPERATORS(CLASS)
Definition: Interface.h:53
void fromStream(QDataStream &)
Deserialize from stream.
Definition: Session.cpp:202
A class that holds settings and elements for session 3d visualization Belongs to a session...
Definition: Scene.h:63
std::unique_ptr< Canvas > canvas_
Owning pointer for canvas.
Definition: Session.h:164
InputList inputs_
List with all inputs (e.g. images, videos etc)
Definition: Session.h:161
void setMode(Mode)
Set mode of this session.
Definition: Session.cpp:139
Base class for drawing a session.
Definition: Session.h:33
visualizer_type * visualizer()
Definition: Session.cpp:230
Common blend mask settings for the all tunings in a session.
Definition: BlendSettings.h:27
proj::TuningList & tunings()
Returns reference to projector tunings.
Definition: Session.cpp:55
Scene & scene()
Return reference to export settings.
Definition: Session.cpp:144
Session()
Default constructor.
Definition: Session.cpp:37
Mapping * mapping()
Returns pointer to mapping.
Definition: Session.cpp:74
Mode
General mode of the User Interface.
Definition: Session.h:46
InputList & inputs()
Returns reference to list of inputs.
Definition: Session.cpp:84
Mapping * setMapping(Id const &_typeId)
Makes new mapping with given type Id.
Definition: Session.cpp:65
Mode mode() const
Return current mode.
Definition: Session.cpp:134
void save(QString const &_filename) const
Save session to file.
Definition: Session.cpp:172
visual::Scene scene_
Definition: Session.h:172
void renderToFile(QString const &_filename)
Export calibration data of session to a file.
Definition: Session.cpp:166
Canvas * setCanvas(Id const &_typeId)
Makes new canvas with given type id and returns pointer if successful.
Definition: Session.cpp:94
std::unique_ptr< Mapping > mapping_
Owning pointer for mapping.
Definition: Session.h:158
ScreenSetup & screenSetup()
Return reference to current screen setup.
Definition: Session.cpp:114
Mapping interface with one or several inputs and shader Holds inputs and shader. ...
Definition: Interface.h:54
visualizer_type * makeVisualizer()
Make visualizer if it is not instantiated yet.
Definition: Session.cpp:222
ScreenSetup screenSetup_
Current screen setup.
Definition: Session.h:167