Equalizer 1.0
|
00001 00002 /* Copyright (c) 2008-2011, Stefan Eilemann <eile@equalizergraphics.com> 00003 * Copyright (c) 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 00051 L* getLayout() { return _layout; } 00052 00054 const L* getLayout() const { return _layout; } 00055 00057 EQFABRIC_INL void setObserver( O* observer ); 00058 00063 O* getObserver() { return _observer; } 00064 00066 const O* getObserver() const { return _observer; } 00067 00069 EQFABRIC_INL virtual void setWall( const Wall& wall ); 00070 00072 EQFABRIC_INL virtual void setProjection( const Projection& ); 00073 00075 EQFABRIC_INL virtual void unsetFrustum(); 00076 00078 EQFABRIC_INL void setOverdraw( const Vector2i& pixels ); 00079 00081 const Vector2i& getOverdraw() const { return _overdraw; } 00082 00084 EQFABRIC_INL void setViewport( const Viewport& viewport ); 00085 00087 Mode getMode( ) const { return _mode; } 00088 00095 EQFABRIC_INL virtual void changeMode( const Mode mode ); 00096 00103 virtual void activateMode( const Mode mode ){ _mode = mode; } 00105 00115 EQFABRIC_INL VisitorResult accept( LeafVisitor< V >& visitor ); 00116 00118 EQFABRIC_INL VisitorResult accept( LeafVisitor< V >& visitor ) const; 00119 00120 virtual EQFABRIC_INL void backup(); 00121 virtual EQFABRIC_INL void restore(); 00122 00123 00133 EQFABRIC_INL void setMinimumCapabilities( const uint64_t bitmask ); 00134 00136 EQFABRIC_INL uint64_t getMinimumCapabilities() const; 00138 00156 EQFABRIC_INL void setMaximumCapabilities(const uint64_t bitmask); 00157 00162 EQFABRIC_INL uint64_t getMaximumCapabilities() const; 00164 00170 EQFABRIC_INL uint64_t getCapabilities() const; 00172 00173 void setCapabilities( const uint64_t bitmask ); 00174 virtual void updateCapabilities() {}; 00175 00177 enum DirtyBits 00178 { 00179 DIRTY_VIEWPORT = Object::DIRTY_CUSTOM << 0, 00180 DIRTY_OBSERVER = Object::DIRTY_CUSTOM << 1, 00181 DIRTY_OVERDRAW = Object::DIRTY_CUSTOM << 2, 00182 DIRTY_FRUSTUM = Object::DIRTY_CUSTOM << 3, 00183 DIRTY_MODE = Object::DIRTY_CUSTOM << 4, 00184 DIRTY_MINCAPS = Object::DIRTY_CUSTOM << 5, 00185 DIRTY_MAXCAPS = Object::DIRTY_CUSTOM << 6, 00186 DIRTY_CAPABILITIES = Object::DIRTY_CUSTOM << 7, 00187 DIRTY_VIEW_BITS = 00188 DIRTY_VIEWPORT | DIRTY_OBSERVER | DIRTY_OVERDRAW | 00189 DIRTY_FRUSTUM | DIRTY_MODE | DIRTY_MINCAPS | DIRTY_MAXCAPS | 00190 DIRTY_CAPABILITIES | DIRTY_OBJECT_BITS 00191 }; 00192 00193 protected: 00195 EQFABRIC_INL View( L* layout ); 00196 00198 EQFABRIC_INL virtual ~View(); 00199 00205 virtual bool hasMasterUserData() { return getLayout() != 0; } 00206 00212 EQFABRIC_INL virtual uint32_t getUserDataLatency() const; 00213 00215 EQFABRIC_INL virtual void serialize( co::DataOStream& os, 00216 const uint64_t dirtyBits ); 00217 00219 EQFABRIC_INL virtual void deserialize( co::DataIStream& is, 00220 const uint64_t dirtyBits ); 00221 00223 EQFABRIC_INL virtual void setDirty( const uint64_t bits ); 00224 00226 virtual uint64_t getRedistributableBits() const 00227 { return DIRTY_VIEW_BITS; } 00228 00229 private: 00231 L* const _layout; 00232 00234 O* _observer; 00235 00237 Viewport _viewport; 00238 00240 Vector2i _overdraw; 00241 00242 Mode _mode; 00243 00244 uint64_t _minimumCapabilities; 00245 uint64_t _maximumCapabilities; 00246 uint64_t _capabilities; 00247 00248 struct Private; 00249 Private* _private; // placeholder for binary-compatible changes 00250 }; 00251 00252 template< class L, class V, class O > 00253 EQFABRIC_INL std::ostream& operator << ( std::ostream& os, 00254 const View< L, V, O >& view ); 00255 } 00256 } 00257 #endif // EQFABRIC_VIEW_H