Equalizer  1.6.1
share/Equalizer/examples/eVolve/frameData.h
1 
2 /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2007-2011, Maxim Makhinya <maxmah@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 EVOLVE_FRAMEDATA_H
31 #define EVOLVE_FRAMEDATA_H
32 
33 #include "eVolve.h"
34 
35 #include <eq/eq.h>
36 
37 namespace eVolve
38 {
39  class FrameData : public co::Serializable
40  {
41  public:
42 
43  FrameData();
44 
45  void reset();
46 
48  //*{
49  void setOrtho( const bool ortho );
50  void adjustQuality( const float delta );
51  void toggleBackground();
52  void toggleNormalsQuality();
53  void toggleColorMode();
54  void toggleOrtho();
55  void toggleHelp();
56  void toggleStatistics();
57 
58  void spinCamera( const float x, const float y );
59  void moveCamera( const float x, const float y, const float z );
60 
61  void setTranslation( const eq::Vector3f& translation );
62  void setRotation( const eq::Vector3f& rotation );
63 
64  bool showHelp() const { return _help; }
65  bool useOrtho( ) const { return _ortho; }
66  bool useStatistics() const { return _statistics; }
67 
68  const eq::Vector3f& getTranslation() const { return _translation; }
69  const eq::Matrix4f& getRotation() const { return _rotation; }
70  float getQuality() const { return _quality; }
71  ColorMode getColorMode() const { return _colorMode; }
72  BackgroundMode getBackgroundMode() const { return _bgMode; }
73  NormalsQuality getNormalsQuality() const { return _normalsQuality; }
74  //*}
75 
77  //*{
78  void setCurrentViewID( const eq::uint128_t& id );
79 
80  eq::uint128_t getCurrentViewID() const { return _currentViewID; }
81  //*}
82 
84  //*{
85  void setMessage( const std::string& message );
86  const std::string& getMessage() const { return _message; }
87  //*}
88 
89  protected:
91  virtual void serialize( co::DataOStream& os,
92  const uint64_t dirtyBits );
93 
95  virtual void deserialize( co::DataIStream& is,
96  const uint64_t dirtyBits );
97 
98 
99  virtual ChangeType getChangeType() const { return DELTA; }
100 
103  {
104  DIRTY_CAMERA = co::Serializable::DIRTY_CUSTOM << 0,
105  DIRTY_FLAGS = co::Serializable::DIRTY_CUSTOM << 1,
106  DIRTY_VIEW = co::Serializable::DIRTY_CUSTOM << 2,
107  DIRTY_MESSAGE = co::Serializable::DIRTY_CUSTOM << 3,
108  };
109 
110  private:
111 
112  eq::Matrix4f _rotation;
113  eq::Vector3f _translation;
114  bool _ortho;
115  ColorMode _colorMode;
116  BackgroundMode _bgMode;
117  NormalsQuality _normalsQuality;
118  bool _statistics;
119  bool _help;
120  float _quality;
121  eq::uint128_t _currentViewID;
122  std::string _message;
123  };
124 }
125 
126 
127 #endif // EVOLVE_FRAMEDATA_H
128 
NormalsQuality
Definition: eVolve.h:80
virtual void deserialize(co::DataIStream &is, const uint64_t dirtyBits)
virtual void serialize(co::DataOStream &os, const uint64_t dirtyBits)
ColorMode
Definition: eVolve.h:64
BackgroundMode
Definition: eVolve.h:72
DirtyBits
The changed parts of the data since the last pack().