Equalizer 1.0

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/viewport.h>       // member
00026 
00027 namespace eq
00028 {
00029 namespace fabric
00030 {
00032     template< class C, class S, class CH >
00033     class Segment : public Object, public Frustum
00034     {
00035     public:
00037         typedef LeafVisitor< S > Visitor;
00038 
00042         const C* getCanvas() const { return _canvas; }
00043 
00045         C* getCanvas() { return _canvas; }
00046 
00048         const Viewport& getViewport() const { return _vp; }
00049 
00060         EQFABRIC_INL void setViewport( const Viewport& vp );
00061 
00071         void setChannel( CH* channel )
00072             { _channel = channel; setDirty( DIRTY_CHANNEL ); }
00073 
00075         CH* getChannel()               { return _channel; }
00076 
00078         const CH* getChannel() const   { return _channel; }
00079 
00081         EQFABRIC_INL virtual void setWall( const Wall& wall );
00082         
00084         EQFABRIC_INL virtual void setProjection( const Projection& );
00085 
00087         EQFABRIC_INL virtual void unsetFrustum();
00088 
00090         uint32_t getEyes() const { return _eyes; }
00091 
00100         EQFABRIC_INL void setEyes( const uint32_t eyes );
00101 
00110         void enableEye( const uint32_t eyes ) { _eyes |= eyes; }
00112         
00122         EQFABRIC_INL VisitorResult accept( Visitor& visitor );
00123 
00125         EQFABRIC_INL VisitorResult accept( Visitor& visitor ) const;
00126 
00130         void notifyFrustumChanged();
00131 
00132         virtual void backup(); 
00133         virtual void restore(); 
00134 
00135 
00136     protected:
00138         EQFABRIC_INL Segment( C* canvas );
00139 
00141         EQFABRIC_INL virtual ~Segment();
00142 
00144         EQFABRIC_INL virtual void serialize( co::DataOStream& os, 
00145                                                 const uint64_t dirtyBits );
00147         EQFABRIC_INL virtual void deserialize( co::DataIStream& is, 
00148                                                   const uint64_t dirtyBits );
00149         virtual void setDirty( const uint64_t bits ); 
00150 
00152         enum DirtyBits
00153         {
00154             DIRTY_VIEWPORT   = Object::DIRTY_CUSTOM << 0,
00155             DIRTY_FRUSTUM    = Object::DIRTY_CUSTOM << 1,
00156             DIRTY_CHANNEL    = Object::DIRTY_CUSTOM << 2,
00157             DIRTY_EYES       = Object::DIRTY_CUSTOM << 3,
00158             DIRTY_SEGMENT_BITS = DIRTY_VIEWPORT | DIRTY_FRUSTUM |
00159                                  DIRTY_CHANNEL | DIRTY_EYES | DIRTY_OBJECT_BITS
00160         };
00161 
00163         virtual uint64_t getRedistributableBits() const
00164             { return DIRTY_SEGMENT_BITS; }
00165 
00166     private:
00168         C* const _canvas;
00169 
00171         Viewport _vp;
00172 
00174         CH* _channel;
00175 
00176         uint32_t _eyes;
00177 
00178         struct Private;
00179         Private* _private; // placeholder for binary-compatible changes
00180 
00181         virtual uint32_t commitNB( const uint32_t incarnation ); 
00182     };
00183 
00184     template< class C, class S, class CH >
00185     std::ostream& operator << ( std::ostream&, const Segment< C, S, CH >& );
00186 }
00187 }
00188 #endif // EQFABRIC_SEGMENT_H
Generated on Sun May 8 2011 19:11:07 for Equalizer 1.0 by  doxygen 1.7.3