Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
share/Equalizer/examples/eqPly/frameData.h
1 
2 /* Copyright (c) 2006-2013, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2011, Daniel Nachbaur <danielnachbaur@gmail.com>
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * - Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  * - Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * - Neither the name of Eyescale Software GmbH nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef EQ_PLY_FRAMEDATA_H
31 #define EQ_PLY_FRAMEDATA_H
32 
33 #include "eqPly.h"
34 
35 namespace eqPly
36 {
45 class FrameData : public co::Serializable
46 {
47 public:
48  FrameData();
49 
50  virtual ~FrameData() {}
51 
52  void reset();
53 
55  //*{
56  void setModelID( const eq::uint128_t& id );
57 
58  void setColorMode( const ColorMode color );
59  void setRenderMode( const triply::RenderMode mode );
60  void setIdle( const bool idleMode );
61 
62  void toggleOrtho();
63  void toggleStatistics();
64  void toggleHelp();
65  void toggleWireframe();
66  void toggleColorMode();
67  void adjustQuality( const float delta );
68  void togglePilotMode();
69  void toggleRenderMode();
70  void toggleCompression();
71 
72  eq::uint128_t getModelID() const { return _modelID; }
73  ColorMode getColorMode() const { return _colorMode; }
74  float getQuality() const { return _quality; }
75  bool useOrtho() const { return _ortho; }
76  bool useStatistics() const { return _statistics; }
77  bool showHelp() const { return _help; }
78  bool useWireframe() const { return _wireframe; }
79  bool usePilotMode() const { return _pilotMode; }
80  bool isIdle() const { return _idle; }
81  triply::RenderMode getRenderMode() const { return _renderMode; }
82  bool useCompression() const { return _compression; }
83  //*}
84 
86  //*{
87  void setCameraPosition( const eq::Vector3f& position );
88  void setRotation( const eq::Vector3f& rotation);
89  void setModelRotation( const eq::Vector3f& rotation );
90  void spinCamera( const float x, const float y );
91  void spinModel( const float x, const float y, const float z );
92  void moveCamera( const float x, const float y, const float z );
93 
94  const eq::Matrix4f& getCameraRotation() const
95  { return _rotation; }
96  const eq::Matrix4f& getModelRotation() const
97  { return _modelRotation; }
98  const eq::Vector3f& getCameraPosition() const
99  { return _position; }
100  //*}
101 
103  //*{
104  void setCurrentViewID( const eq::uint128_t& id );
105  eq::uint128_t getCurrentViewID() const { return _currentViewID; }
106  //*}
107 
109  //*{
110  void setMessage( const std::string& message );
111  const std::string& getMessage() const { return _message; }
112  //*}
113 
114 protected:
116  virtual void serialize( co::DataOStream& os,
117  const uint64_t dirtyBits );
119  virtual void deserialize( co::DataIStream& is,
120  const uint64_t dirtyBits );
121 
122  virtual ChangeType getChangeType() const { return DELTA; }
123 
126  {
127  DIRTY_CAMERA = co::Serializable::DIRTY_CUSTOM << 0,
128  DIRTY_FLAGS = co::Serializable::DIRTY_CUSTOM << 1,
129  DIRTY_VIEW = co::Serializable::DIRTY_CUSTOM << 2,
130  DIRTY_MESSAGE = co::Serializable::DIRTY_CUSTOM << 3
131  };
132 
133 private:
134  eq::Matrix4f _rotation;
135  eq::Matrix4f _modelRotation;
136  eq::Vector3f _position;
137 
138  eq::uint128_t _modelID;
139  triply::RenderMode _renderMode;
140  ColorMode _colorMode;
141  float _quality;
142  bool _ortho;
143  bool _statistics;
144  bool _help;
145  bool _wireframe;
146  bool _pilotMode;
147  bool _idle;
148  bool _compression;
149 
150  eq::uint128_t _currentViewID;
151  std::string _message;
152 };
153 }
154 
155 
156 #endif // EQ_PLY_FRAMEDATA_H
virtual void serialize(co::DataOStream &os, const uint64_t dirtyBits)
DirtyBits
The changed parts of the data since the last pack().
virtual void deserialize(co::DataIStream &is, const uint64_t dirtyBits)