38 : eq::Config( parent )
51 _frameData.setOrtho( _initData.getOrtho( ));
52 _initData.setFrameDataID( _frameData.getID( ));
66 if( canvases.empty( ))
69 _currentCanvas = canvases.front();
71 _setMessage(
"Welcome to eVolve\nPress F1 for help" );
78 LBASSERT( !_initData.isAttached( ));
90 void Config::_deregisterData()
95 _initData.setFrameDataID( co::uint128_t( ));
102 _frameData.spinCamera( -0.001f * _spinX, -0.001f * _spinY );
103 const eq::uint128_t& version = _frameData.commit();
110 void Config::_resetMessage()
113 if( _messageTime > 0 &&
getTime() - _messageTime > 2000 )
116 _frameData.setMessage(
"" );
122 switch( event->
data.type )
124 case eq::Event::KEY_PRESS:
125 if( _handleKeyEvent( event->
data.keyPress ))
129 case eq::Event::CHANNEL_POINTER_BUTTON_PRESS:
131 const eq::uint128_t& viewID =
event->data.context.view.identifier;
132 _frameData.setCurrentViewID( viewID );
139 const eq::View* view = find< eq::View >( viewID );
142 for( eq::Canvases::const_iterator i = canvases.begin();
143 i != canvases.end(); ++i )
148 if( canvasLayout == layout )
150 _currentCanvas = canvas;
157 case eq::Event::CHANNEL_POINTER_BUTTON_RELEASE:
158 if( event->
data.pointerButtonRelease.buttons == eq::PTR_BUTTON_NONE
159 && event->
data.pointerButtonRelease.button == eq::PTR_BUTTON1 )
161 _spinY =
event->data.pointerButtonRelease.dx;
162 _spinX =
event->data.pointerButtonRelease.dy;
166 case eq::Event::CHANNEL_POINTER_MOTION:
167 if( event->
data.pointerMotion.buttons == eq::PTR_BUTTON1 )
172 _frameData.spinCamera( -0.005f * event->
data.pointerMotion.dy,
173 -0.005f * event->
data.pointerMotion.dx);
176 if( event->
data.pointerMotion.buttons == eq::PTR_BUTTON2 ||
177 event->
data.pointerMotion.buttons == ( eq::PTR_BUTTON1 |
180 _frameData.moveCamera( .0, .0,
181 .005f*event->
data.pointerMotion.dy );
184 if( event->
data.pointerMotion.buttons == eq::PTR_BUTTON3 )
186 _frameData.moveCamera( .0005f * event->
data.pointerMotion.dx,
187 -.0005f * event->
data.pointerMotion.dy,
199 bool Config::_handleKeyEvent(
const eq::KeyEvent& event )
205 _frameData.toggleBackground();
210 _frameData.toggleColorMode();
216 _frameData.toggleHelp();
229 _frameData.toggleNormalsQuality();
234 _frameData.toggleOrtho();
239 _frameData.toggleStatistics();
250 _frameData.adjustQuality( -.1f );
254 _frameData.adjustQuality( .1f );
261 if( canvases.empty( ))
264 _frameData.setCurrentViewID( co::uint128_t( ));
266 if( !_currentCanvas )
268 _currentCanvas = canvases.front();
272 eq::Canvases::const_iterator i = std::find( canvases.begin(),
275 LBASSERT( i != canvases.end( ));
278 if( i == canvases.end( ))
279 _currentCanvas = canvases.front();
289 if( !_currentCanvas && !canvases.empty( ))
290 _currentCanvas = canvases.front();
292 if( !_currentCanvas )
300 find< eq::View >( _frameData.getCurrentViewID( ));
303 LBASSERT( !views.empty( ))
307 _frameData.setCurrentViewID( views.front()->getID( ));
311 eq::Views::const_iterator i = std::find( views.begin(),
314 LBASSERT( i != views.end( ));
317 if( i == views.end( ))
318 _frameData.setCurrentViewID( co::uint128_t( ));
320 _frameData.setCurrentViewID( (*i)->getID( ));
330 void Config::_setMessage(
const std::string& message )
332 _frameData.setMessage( message );
336 void Config::_switchLayout( int32_t increment )
338 if( !_currentCanvas )
341 _frameData.setCurrentViewID( co::uint128_t( ));
345 LBASSERT( !layouts.empty( ));
347 index = ( index % layouts.size( ));
348 _currentCanvas->
useLayout( uint32_t( index ));
351 std::ostringstream stream;
355 const std::string& name = layout->
getName();
365 _setMessage( stream.str( ));
virtual EQ_API bool init(const uint128_t &initID)
Initialize this configuration.
A canvas represents a logical 2D projection surface.
virtual EQ_API bool exit()
Exit this configuration.
virtual bool handleEvent(const eq::ConfigEvent *event)
uint32_t getActiveLayoutIndex() const
virtual uint32_t startFrame()
const Layouts & getLayouts() const
virtual EQ_API uint32_t startFrame(const uint128_t &frameID)
Request a new frame of rendering.
EQ_API int64_t getTime() const
Get the current time in milliseconds.
std::vector< Layout * > Layouts
A vector of pointers to eq::Layout.
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
EQFABRIC_API const std::string & getName() const
virtual EQFABRIC_INL bool useLayout(const uint32_t index)
Activate the given layout on this canvas.
EQFABRIC_INL const L * getActiveLayout() const
std::vector< View * > Views
A vector of pointers to eq::View.
bool loadInitData(const eq::uint128_t &initDataID)
Map per-config data to the local node process.
const Canvases & getCanvases() const
std::vector< Canvas * > Canvases
A vector of pointers to eq::Canvas.
A layout groups one or more View, logically belonging together.
A View is a 2D area of a Layout.
EQ_API ClientPtr getClient()
virtual EQ_API bool registerObject(co::Object *object)
Register a distributed object.
EQ_API co::NodePtr getApplicationNode()
virtual ~Config()
Destruct a config.
virtual EQ_API bool handleEvent(const ConfigEvent *event)
Handle one (old) config event.
virtual EQ_API void deregisterObject(co::Object *object)
Deregister a distributed object.
uint32_t getLatency() const
const Views & getViews() const
Get the list of views.