Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
share/Equalizer/examples/eqPly/config.h
1 
2 /* Copyright (c) 2006-2014, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2011-2012, Daniel Nachbaur <danielnachbaur@gmail.com>
4  * 2010, Cedric Stalder <cedric.stalder@gmail.com>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * - Redistributions of source code must retain the above copyright notice, this
10  * list of conditions and the following disclaimer.
11  * - Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  * - Neither the name of Eyescale Software GmbH nor the names of its
15  * contributors may be used to endorse or promote products derived from this
16  * software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef EQ_PLY_CONFIG_H
32 #define EQ_PLY_CONFIG_H
33 
34 // members
35 #include "localInitData.h"
36 #include "frameData.h"
37 #include "cameraAnimation.h"
38 
39 #include <eq/eq.h>
40 #include <eq/admin/base.h>
41 
42 namespace eqPly
43 {
51 class Config : public eq::Config
52 {
53 public:
54  Config( eq::ServerPtr parent );
55 
57  virtual bool init();
59  virtual bool exit();
60 
62  virtual uint32_t startFrame();
63 
64  void setInitData( const LocalInitData& data ) { _initData = data; }
65  const InitData& getInitData() const { return _initData; }
66 
68  bool loadInitData( const eq::uint128_t& initDataID );
69 
71  const Model* getModel( const eq::uint128_t& id );
72 
74  virtual bool handleEvent( const eq::ConfigEvent* event );
75  virtual bool handleEvent( eq::EventICommand command );
76 
78  bool isIdleAA();
79 
81  bool needRedraw();
82 
84  uint32_t getAnimationFrame();
85 
86 protected:
87  virtual ~Config();
88 
90  virtual co::uint128_t sync(
91  const co::uint128_t& version = co::VERSION_HEAD );
92 
93 private:
94  int _spinX, _spinY;
95  int _advance;
96  eq::Canvas* _currentCanvas;
97 
98  LocalInitData _initData;
99  FrameData _frameData;
100 
101  Models _models;
102  ModelDists _modelDist;
103  lunchbox::Lock _modelLock;
104 
105  CameraAnimation _animation;
106 
107  uint64_t _messageTime;
108 
109  bool _redraw;
110  bool _useIdleAA;
111 
112  int32_t _numFramesAA;
113 
114  eq::admin::ServerPtr _admin;
115 
116  void _loadModels();
117  void _registerModels();
118  void _loadPath();
119  void _deregisterData();
120 
121  bool _needNewFrame();
122  bool _handleKeyEvent( const eq::KeyEvent& event );
123 
124  void _switchCanvas();
125  void _switchView();
126  void _switchViewMode();
127  void _switchModel();
128  void _freezeLoadBalancing( const bool onOff );
129  void _adjustEyeBase( const float delta );
130  void _adjustTileSize( const int delta );
131  void _adjustResistance( const int delta );
132  void _adjustModelScale( const float factor );
133  void _switchLayout( int32_t increment );
134  void _toggleEqualizer();
135 
136  void _setHeadMatrix( const eq::Matrix4f& matrix );
137  const eq::Matrix4f& _getHeadMatrix() const;
138  void _changeFocusDistance( const float delta );
139  void _setFocusMode( const eq::FocusMode mode );
140 
142  eq::admin::ServerPtr _getAdminServer();
143  void _closeAdminServer();
144 
145  View* _getCurrentView();
146  const View* _getCurrentView() const;
147 
148  void _setMessage( const std::string& message );
149  void _updateData();
150 };
151 }
152 
153 #endif // EQ_PLY_CONFIG_H
A configuration is a visualization session driven by an application.
A canvas represents a logical 2D projection surface.
Definition: client/canvas.h:50
uint32_t getAnimationFrame()
virtual bool handleEvent(const eq::ConfigEvent *event)
Loads sequence of camera positions and interpolates them on a per-frame basis.
virtual uint32_t startFrame()
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
A command specialization for config events.
Definition: eventICommand.h:38
virtual bool init()
virtual bool exit()
bool loadInitData(const eq::uint128_t &initDataID)
Map per-config data to the local node process.
virtual ~Config()
Destruct a config.
Manages the argument parsing and non-distributed part of the initialization data. ...
const Model * getModel(const eq::uint128_t &id)
The configuration, run be the EqPly application.
virtual co::uint128_t sync(const co::uint128_t &version=co::VERSION_HEAD)
Synchronize config and admin copy.