Equalizer  1.2.1
fabric/segment.h
00001 
00002 /* Copyright (c) 2010-2011, Stefan Eilemann <eile@eyescale.ch> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EQFABRIC_SEGMENT_H
00019 #define EQFABRIC_SEGMENT_H
00020 
00021 #include <eq/fabric/types.h>
00022 #include <eq/fabric/visitorResult.h>  // enum
00023 #include <eq/fabric/frustum.h>        // base class
00024 #include <eq/fabric/object.h>         // base class
00025 #include <eq/fabric/swapBarrier.h>    // RefPtr member
00026 #include <eq/fabric/viewport.h>       // member
00027 
00028 namespace eq
00029 {
00030 namespace fabric
00031 {
00033     template< class C, class S, class CH >
00034     class Segment : public Object, public Frustum
00035     {
00036     public:
00038         typedef LeafVisitor< S > Visitor;
00039 
00043         const C* getCanvas() const { return _canvas; }
00044 
00046         C* getCanvas() { return _canvas; }
00047 
00049         const Viewport& getViewport() const { return _vp; }
00050 
00061         EQFABRIC_INL void setViewport( const Viewport& vp );
00062 
00072         void setChannel( CH* channel )
00073             { _channel = channel; setDirty( DIRTY_CHANNEL ); }
00074 
00076         CH* getChannel()               { return _channel; }
00077 
00079         const CH* getChannel() const   { return _channel; }
00080 
00082         EQFABRIC_INL virtual void setWall( const Wall& wall );
00083         
00085         EQFABRIC_INL virtual void setProjection( const Projection& );
00086 
00088         EQFABRIC_INL virtual void unsetFrustum();
00089 
00091         uint32_t getEyes() const { return _eyes; }
00092 
00101         EQFABRIC_INL void setEyes( const uint32_t eyes );
00102 
00111         void enableEye( const uint32_t eyes ) { _eyes |= eyes; }
00112 
00121         EQFABRIC_INL void setSwapBarrier( SwapBarrierPtr barrier );
00122 
00124         SwapBarrierConstPtr getSwapBarrier() const { return _swapBarrier; }
00125 
00127         SwapBarrierPtr getSwapBarrier() { return _swapBarrier; }
00129         
00139         EQFABRIC_INL VisitorResult accept( Visitor& visitor );
00140 
00142         EQFABRIC_INL VisitorResult accept( Visitor& visitor ) const;
00143 
00147         void notifyFrustumChanged();
00148 
00149         virtual void backup(); 
00150         virtual void restore(); 
00151 
00153         virtual uint128_t commit( const uint32_t incarnation=CO_COMMIT_NEXT );
00155 
00156     protected:
00158         EQFABRIC_INL Segment( C* canvas );
00159 
00161         EQFABRIC_INL virtual ~Segment();
00162 
00164         EQFABRIC_INL virtual void serialize( co::DataOStream& os, 
00165                                                 const uint64_t dirtyBits );
00167         EQFABRIC_INL virtual void deserialize( co::DataIStream& is, 
00168                                                   const uint64_t dirtyBits );
00169         virtual void setDirty( const uint64_t bits ); 
00170 
00172         enum DirtyBits
00173         {
00174             DIRTY_VIEWPORT   = Object::DIRTY_CUSTOM << 0,
00175             DIRTY_FRUSTUM    = Object::DIRTY_CUSTOM << 1,
00176             DIRTY_CHANNEL    = Object::DIRTY_CUSTOM << 2,
00177             DIRTY_EYES       = Object::DIRTY_CUSTOM << 3,
00178             DIRTY_SEGMENT_BITS = DIRTY_VIEWPORT | DIRTY_FRUSTUM |
00179                                  DIRTY_CHANNEL | DIRTY_EYES | DIRTY_OBJECT_BITS
00180         };
00181 
00183         virtual uint64_t getRedistributableBits() const
00184             { return DIRTY_SEGMENT_BITS; }
00185 
00186     private:
00188         C* const _canvas;
00189 
00191         Viewport _vp;
00192 
00194         CH* _channel;
00195 
00196         uint32_t _eyes;
00197 
00198         SwapBarrierPtr _swapBarrier; 
00199 
00200         struct Private;
00201         Private* _private; // placeholder for binary-compatible changes
00202     };
00203 
00204     template< class C, class S, class CH >
00205     std::ostream& operator << ( std::ostream&, const Segment< C, S, CH >& );
00206 }
00207 }
00208 #endif // EQFABRIC_SEGMENT_H
Generated on Fri Jun 8 2012 15:44:32 for Equalizer 1.2.1 by  doxygen 1.8.0