Equalizer
1.2.1
|
00001 00002 /* Copyright (c) 2008-2012, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 2010, Cedric Stalder <cedric.stalder@gmail.com> 00004 * 00005 * This library is free software; you can redistribute it and/or modify it under 00006 * the terms of the GNU Lesser General Public License version 2.1 as published 00007 * by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00012 * details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this library; if not, write to the Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00017 */ 00018 00019 #ifndef EQFABRIC_VIEW_H 00020 #define EQFABRIC_VIEW_H 00021 00022 #include <eq/fabric/api.h> 00023 #include <eq/fabric/frustum.h> // base class 00024 #include <eq/fabric/object.h> // base class 00025 #include <eq/fabric/types.h> 00026 #include <eq/fabric/viewport.h> // member 00027 #include <eq/fabric/visitorResult.h> // enum 00028 00029 namespace eq 00030 { 00031 namespace fabric 00032 { 00034 template< class L, class V, class O > 00035 class View : public Object, public Frustum 00036 { 00037 public: 00039 enum Mode 00040 { 00041 MODE_MONO = 1, 00042 MODE_STEREO 00043 }; 00044 00048 EQFABRIC_INL const Viewport& getViewport() const; 00049 00054 L* getLayout() { return _layout; } 00055 00060 const L* getLayout() const { return _layout; } 00061 00063 EQFABRIC_INL void setObserver( O* observer ); 00064 00069 O* getObserver() { return _observer; } 00070 00072 const O* getObserver() const { return _observer; } 00073 00075 EQFABRIC_INL virtual void setWall( const Wall& wall ); 00076 00078 EQFABRIC_INL virtual void setProjection( const Projection& ); 00079 00081 EQFABRIC_INL virtual void unsetFrustum(); 00082 00084 EQFABRIC_INL void setOverdraw( const Vector2i& pixels ); 00085 00087 const Vector2i& getOverdraw() const { return _data.overdraw; } 00088 00090 EQFABRIC_INL void useEqualizer( uint32_t equalizerMask ); 00091 00093 uint32_t getEqualizers() const { return _data.equalizers; } 00094 00096 EQFABRIC_INL void setTileSize( const Vector2i& size ); 00097 00099 const Vector2i& getTileSize() const { return _data.tileSize; } 00100 00102 EQFABRIC_INL void setViewport( const Viewport& viewport ); 00103 00105 Mode getMode() const { return _data.mode; } 00106 00113 EQFABRIC_INL virtual void changeMode( const Mode mode ); 00114 00121 virtual void activateMode( const Mode mode ){ _data.mode = mode; } 00122 00124 EQFABRIC_INL bool isActive() const; 00126 00136 EQFABRIC_INL VisitorResult accept( LeafVisitor< V >& visitor ); 00137 00139 EQFABRIC_INL VisitorResult accept( LeafVisitor< V >& visitor ) const; 00140 00141 virtual EQFABRIC_INL void backup(); 00142 virtual EQFABRIC_INL void restore(); 00143 00153 EQFABRIC_INL void setMinimumCapabilities( const uint64_t bitmask ); 00154 00156 EQFABRIC_INL uint64_t getMinimumCapabilities() const; 00157 00175 EQFABRIC_INL void setMaximumCapabilities(const uint64_t bitmask); 00176 00181 EQFABRIC_INL uint64_t getMaximumCapabilities() const; 00182 00188 EQFABRIC_INL uint64_t getCapabilities() const; 00190 00191 void setCapabilities( const uint64_t bitmask ); 00192 virtual void updateCapabilities() {} 00193 00195 enum DirtyBits 00196 { 00197 DIRTY_VIEWPORT = Object::DIRTY_CUSTOM << 0, 00198 DIRTY_OBSERVER = Object::DIRTY_CUSTOM << 1, 00199 DIRTY_OVERDRAW = Object::DIRTY_CUSTOM << 2, 00200 DIRTY_FRUSTUM = Object::DIRTY_CUSTOM << 3, 00201 DIRTY_MODE = Object::DIRTY_CUSTOM << 4, 00202 DIRTY_MINCAPS = Object::DIRTY_CUSTOM << 5, 00203 DIRTY_MAXCAPS = Object::DIRTY_CUSTOM << 6, 00204 DIRTY_CAPABILITIES = Object::DIRTY_CUSTOM << 7, 00205 DIRTY_TILESIZE = Object::DIRTY_CUSTOM << 8, 00206 DIRTY_EQUALIZERS = Object::DIRTY_CUSTOM << 9, 00207 DIRTY_VIEW_BITS = 00208 DIRTY_VIEWPORT | DIRTY_OBSERVER | DIRTY_OVERDRAW | 00209 DIRTY_FRUSTUM | DIRTY_MODE | DIRTY_MINCAPS | DIRTY_MAXCAPS | 00210 DIRTY_CAPABILITIES | DIRTY_OBJECT_BITS | DIRTY_TILESIZE | 00211 DIRTY_EQUALIZERS 00212 }; 00213 00214 protected: 00216 EQFABRIC_INL View( L* layout ); 00217 00219 EQFABRIC_INL virtual ~View(); 00220 00226 virtual bool hasMasterUserData() { return getLayout() != 0; } 00227 00233 EQFABRIC_INL virtual uint32_t getUserDataLatency() const; 00234 00236 EQFABRIC_INL virtual void serialize( co::DataOStream& os, 00237 const uint64_t dirtyBits ); 00238 00240 EQFABRIC_INL virtual void deserialize( co::DataIStream& is, 00241 const uint64_t dirtyBits ); 00242 00244 EQFABRIC_INL virtual void setDirty( const uint64_t bits ); 00245 00247 virtual uint64_t getRedistributableBits() const 00248 { return DIRTY_VIEW_BITS; } 00249 00250 private: 00252 L* const _layout; 00253 00255 O* _observer; 00256 00257 struct BackupData 00258 { 00259 BackupData(); 00260 00262 Viewport viewport; 00263 00265 Vector2i overdraw; 00266 00267 Vector2i tileSize; 00268 00269 uint64_t minimumCapabilities; 00270 uint64_t maximumCapabilities; 00271 uint64_t capabilities; 00272 00273 Mode mode; 00274 uint32_t equalizers; 00275 } 00276 _data, _backup; 00277 00278 struct Private; 00279 Private* _private; // placeholder for binary-compatible changes 00280 }; 00281 00282 template< class L, class V, class O > 00283 EQFABRIC_INL std::ostream& operator << ( std::ostream& os, 00284 const View< L, V, O >& view ); 00285 } 00286 } 00287 #endif // EQFABRIC_VIEW_H