Equalizer  2.1.0
Parallel Rendering Framework
viewData.h
1 
2 /* Copyright (c) 2011-2017, Stefan Eilemann <eile@eyescale.ch>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQSEQUEL_VIEWDATA_H
20 #define EQSEQUEL_VIEWDATA_H
21 
22 #include <co/serializable.h> // base class
23 #include <eq/fabric/vmmlib.h>
24 #include <seq/api.h>
25 #include <seq/types.h>
26 
27 namespace seq
28 {
30 class ViewData : public co::Serializable
31 {
32 public:
34  SEQ_API explicit ViewData(View& view);
35 
37  SEQ_API virtual ~ViewData();
38 
49  SEQ_API virtual bool handleEvent(eq::EventType type, const SizeEvent&);
50  SEQ_API virtual bool handleEvent(eq::EventType type, const PointerEvent&);
51  SEQ_API virtual bool handleEvent(eq::EventType type, const KeyEvent&);
52  SEQ_API virtual bool handleEvent(const AxisEvent&);
53  SEQ_API virtual bool handleEvent(const ButtonEvent&);
54 
56  SEQ_API void spinModel(const float x, const float y, const float z);
57 
59  SEQ_API void moveModel(const float x, const float y, const float z);
60 
71  SEQ_API void showStatistics(const bool on);
72 
82  SEQ_API void setOrtho(const bool on);
83 
93  SEQ_API virtual bool update();
95 
99  SEQ_API void setModelMatrix(const Matrix4f& matrix);
100 
102  const Matrix4f& getModelMatrix() const { return _modelMatrix; }
104  bool getStatistics() const { return _statistics; }
106 
108  bool useOrtho() const { return _ortho; }
110 
111 protected:
112  SEQ_API void serialize(co::DataOStream& os,
113  const uint64_t dirtyBits) override;
114  SEQ_API void deserialize(co::DataIStream& is,
115  const uint64_t dirtyBits) override;
116 
119  {
120  DIRTY_MODELMATRIX = co::Serializable::DIRTY_CUSTOM << 0, // 1
121  DIRTY_STATISTICS = co::Serializable::DIRTY_CUSTOM << 1, // 2
122  DIRTY_ORTHO = co::Serializable::DIRTY_CUSTOM << 2, // 4
123  DIRTY_CUSTOM = co::Serializable::DIRTY_CUSTOM << 3 // 8
124  };
125 
126 private:
127  View& _view;
128  Matrix4f _modelMatrix;
129  int32_t _spinX, _spinY;
130  int32_t _advance;
131  bool _statistics;
132  bool _ortho;
133 };
134 }
135 #endif // EQSEQUEL_VIEWDATA_H
SEQ_API void showStatistics(const bool on)
Enable or disable statistics rendering.
Defines export visibility macros for library Sequel.
virtual SEQ_API bool handleEvent(eq::EventType type, const SizeEvent &)
Handle the given event command.
SEQ_API ViewData(View &view)
Construct a new view data.
virtual SEQ_API bool update()
Update the view data.
bool getStatistics() const
Definition: viewData.h:104
Stores per-view data.
Definition: viewData.h:30
bool useOrtho() const
Definition: viewData.h:108
DirtyBits
The changed parts of the object since the last serialize().
Definition: viewData.h:118
SEQ_API void moveModel(const float x, const float y, const float z)
Move the model matrix by the given increments.
SEQ_API void setOrtho(const bool on)
Enable or disable orthographic rendering.
A View is a 2D area of a Layout.
Definition: view.h:46
virtual SEQ_API ~ViewData()
Destruct this view data.
const Matrix4f & getModelMatrix() const
Definition: viewData.h:102
SEQ_API void spinModel(const float x, const float y, const float z)
Rotate the model matrix by the given increments.
Sequel - A simple interface to the Equalizer parallel rendering framework.
Definition: application.h:26
SEQ_API void setModelMatrix(const Matrix4f &matrix)
Set the current model matrix (global camera).