Equalizer  1.6.1
view.cpp
1 
2 /* Copyright (c) 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2010, Cedric Stalder <cedric.stalder@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 #include "view.h"
31 #include "config.h"
32 
33 namespace eqPly
34 {
35 
36 #pragma warning( push )
37 #pragma warning( disable : 4355 )
38 
39 View::View( eq::Layout* parent )
40  : eq::View( parent )
41  , _proxy( this )
42  , _idleSteps( 0 )
43 {
44  setUserData( &_proxy );
45 }
46 
47 #pragma warning( pop )
48 
49 View::~View()
50 {
51  setUserData( 0 );
52  _modelID = 0;
53  _idleSteps = 0;
54 }
55 
56 void View::Proxy::serialize( co::DataOStream& os, const uint64_t dirtyBits )
57 {
58  if( dirtyBits & DIRTY_MODEL )
59  os << _view->_modelID;
60  if( dirtyBits & DIRTY_IDLE )
61  os << _view->_idleSteps;
62 }
63 
64 void View::Proxy::deserialize( co::DataIStream& is, const uint64_t dirtyBits )
65 {
66  if( dirtyBits & DIRTY_MODEL )
67  is >> _view->_modelID;
68  if( dirtyBits & DIRTY_IDLE )
69  {
70  is >> _view->_idleSteps;
71  if( isMaster( ))
72  setDirty( DIRTY_IDLE ); // redistribute slave settings
73  }
74 }
75 
76 void View::setModelID( const lunchbox::uint128_t& id )
77 {
78  if( _modelID == id )
79  return;
80 
81  _modelID = id;
82  _proxy.setDirty( Proxy::DIRTY_MODEL );
83 }
84 
85 void View::setIdleSteps( const int32_t steps )
86 {
87  if( _idleSteps == steps )
88  return;
89 
90  _idleSteps = steps;
91  _proxy.setDirty( Proxy::DIRTY_IDLE );
92 }
93 
94 void View::toggleEqualizer()
95 {
96  if( getEqualizers() & eq::fabric::LOAD_EQUALIZER )
97  useEqualizer( eq::fabric::EQUALIZER_ALL & ~eq::fabric::LOAD_EQUALIZER );
98  else
99  useEqualizer( eq::fabric::EQUALIZER_ALL & ~eq::fabric::TILE_EQUALIZER );
100 }
101 
102 }
A layout groups one or more View, logically belonging together.
Definition: client/layout.h:44