server/frame.h

00001 
00002 /* Copyright (c) 2006-2009, Stefan Eilemann <eile@equalizergraphics.com> 
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 EQSERVER_FRAME_H
00019 #define EQSERVER_FRAME_H
00020 
00021 #include "compound.h"
00022 
00023 #include <eq/client/frame.h>
00024 #include <eq/client/packets.h>
00025 
00026 namespace eq
00027 {
00028 namespace server
00029 {
00030     class Compound;
00031     class FrameData;
00032     class Node;
00033 
00037     class Frame : public net::Object
00038     {
00039     public:
00043         EQSERVER_EXPORT Frame();
00044         Frame( const Frame& from );
00045 
00050         Compound* getCompound() const { return _compound; }
00051         Channel* getChannel() const 
00052             { return _compound ? _compound->getChannel() :0; }
00053         Node* getNode() const { return _compound ? _compound->getNode() :0; }
00054 
00055         void setName( const std::string& name ) { _name = name; }
00056         const std::string& getName() const      { return _name; }
00057 
00058         FrameData* getMasterData() const { return _masterFrameData; }
00059         bool       hasData( const eq::Eye eye ) const
00060             { return ( _frameData[eye] != 0 ); }
00061 
00068         void setViewport( const eq::Viewport& vp ) { _vp = vp; }
00069         
00071         const eq::Viewport& getViewport() const { return _vp; }
00072 
00082         void setZoom( const eq::Zoom& zoom ) { _data.zoom = zoom; }
00083         
00085         const eq::Zoom& getZoom() const { return _data.zoom; }
00086 
00092         void setBuffers( const uint32_t buffers ) { _buffers = buffers; }
00093 
00095         eq::Frame::Type getType() const { return _type; }
00096 
00102         void setType( const eq::Frame::Type type ) { _type = type; }
00103 
00105         uint32_t getBuffers() const { return _buffers; }
00107 
00113         void commitData();
00114 
00116         EQSERVER_EXPORT virtual uint32_t commit();
00117 
00127         void cycleData( const uint32_t frameNumber, const uint32_t eyes );
00128 
00135         void addInputFrame( Frame* frame, const uint32_t eyes );
00137         const FrameVector& getInputFrames( const eq::Eye eye ) const
00138             { return _inputFrames[eye]; }
00139 
00141         void unsetData();
00142 
00144         void flush();
00146 
00162         void setInheritOffset( const Vector2i& offset )
00163             { _inherit.offset = offset; }
00164         
00166         const Vector2i& getOffset() const { return _data.offset; }
00167 
00171         void setOffset( const Vector2i& offset )
00172            { _data.offset = offset; }
00173         
00175         void setInheritZoom( const eq::Zoom& zoom )
00176             { _inherit.zoom = zoom; }
00177 
00179         const eq::Zoom& getInheritZoom() const { return _inherit.zoom; }
00181         
00182     protected:
00183         EQSERVER_EXPORT virtual ~Frame();
00184         EQSERVER_EXPORT virtual ChangeType getChangeType() const { return INSTANCE; }
00185         EQSERVER_EXPORT virtual void getInstanceData( net::DataOStream& os );
00186         EQSERVER_EXPORT virtual void applyInstanceData( net::DataIStream& is );
00187 
00188     private:
00190         Compound* _compound;
00191         friend class Compound;
00192 
00194         std::string _name;
00195 
00197         eq::Frame::Data _data;
00198         eq::Viewport    _vp;
00199         uint32_t        _buffers;
00200         eq::Frame::Type _type;
00201 
00203         eq::Frame::Data _inherit;
00204 
00206         std::deque<FrameData*> _datas;
00207         
00209         FrameData* _masterFrameData;
00210         FrameData* _frameData[eq::EYE_ALL];
00211 
00213         FrameVector _inputFrames[eq::EYE_ALL];
00214     };
00215 
00216     std::ostream& operator << ( std::ostream& os, const Frame* frame );
00217 }
00218 }
00219 #endif // EQSERVER_FRAME_H
Generated on Mon Aug 10 18:58:32 2009 for Equalizer 0.9 by  doxygen 1.5.8