lib/client/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 EQ_FRAME_H
00019 #define EQ_FRAME_H
00020 
00021 #include <eq/client/eye.h>    // enum Eye
00022 #include <eq/client/window.h> // nested ObjectManager type
00023 #include <eq/client/types.h>  // member
00024 #include <eq/client/zoom.h>   // member
00025 
00026 #include <eq/base/monitor.h>
00027 #include <eq/net/object.h>
00028 
00029 namespace eq
00030 {
00031 
00032 namespace server
00033 {
00034     class Frame;
00035 }
00036 
00037     class FrameData;
00038     class Image;
00039     class Pipe;
00040     class Pixel;
00041     class Range;
00042 
00046     class Frame : public net::Object
00047     {
00048     public:
00053         enum Buffer
00054         {
00055             BUFFER_NONE      = EQ_BIT_NONE,
00056             BUFFER_UNDEFINED = EQ_BIT1,  
00057             BUFFER_COLOR     = EQ_BIT5,  
00058             BUFFER_DEPTH     = EQ_BIT9,  
00059             BUFFER_ALL       = EQ_BIT_ALL
00060         };
00061 
00063         enum Type
00064         {
00065             TYPE_MEMORY,    
00066             TYPE_TEXTURE    
00067         };
00068 
00072         EQ_EXPORT Frame();
00073         EQ_EXPORT virtual ~Frame();
00074 
00079         EQ_EXPORT const std::string& getName() const;
00080 
00081         const Vector2i& getOffset() const { return _data.offset; }
00082         void setOffset( const Vector2i& offset ) { _data.offset = offset;}
00083 
00085         EQ_EXPORT const Range& getRange() const;
00086         EQ_EXPORT void         setRange( const Range& range );
00087 
00089         EQ_EXPORT const Pixel& getPixel() const;
00090 
00092         const Zoom& getZoom() const { return _data.zoom; }
00093 
00096         void setZoom( const Zoom& zoom ) { _data.zoom = zoom; }
00097 
00099         EQ_EXPORT const ImageVector& getImages() const;
00100 
00102         void setData( FrameData* data ) { _frameData = data; }
00103         FrameData* getData() { return _frameData; }
00104 
00106         EQ_EXPORT void setPixelViewport( const PixelViewport& pvp );
00107 
00108         const net::ObjectVersion& getDataVersion( const Eye eye ) const
00109             { return _data.frameData[ eye ]; }
00111 
00116 
00118         EQ_EXPORT void clear();
00119 
00121         void flush();
00122 
00130         EQ_EXPORT void startReadback( Window::ObjectManager* glObjects );
00131         
00133         EQ_EXPORT void syncReadback();
00134 
00144         void transmit( net::NodePtr toNode, const uint32_t frameNumber );
00145 
00152         void setReady();
00153 
00162         EQ_EXPORT bool isReady() const;
00163 
00165         EQ_EXPORT void waitReady() const;
00166 
00172         void addListener( base::Monitor<uint32_t>& listener );
00173 
00179         void removeListener( base::Monitor<uint32_t>& listener );
00181 
00183         EQ_EXPORT uint32_t getBuffers() const;
00184 
00190         EQ_EXPORT void disableBuffer( const Buffer buffer );
00191 
00193         EQ_EXPORT void setColorType( const GLuint colorType );
00194 
00196         EQ_EXPORT void setAlphaUsage( const bool useAlpha );
00197 
00199         void useSendToken( const bool use );
00200 
00201     protected:
00202         virtual ChangeType getChangeType() const { return INSTANCE; }
00203         virtual void getInstanceData( net::DataOStream& os );
00204         virtual void applyInstanceData( net::DataIStream& is );
00205 
00206     private:
00207         std::string _name;
00208         FrameData*  _frameData;
00209 
00211         friend class eq::server::Frame;
00212         struct Data
00213         {
00214             Data() : offset( Vector2i::ZERO ), zoom( 0.f, 0.f ) {}
00215 
00216             Vector2i     offset;
00217             Zoom               zoom;
00218             net::ObjectVersion frameData[EYE_ALL];
00219         }
00220         _data;
00221 
00222         union // placeholder for binary-compatible changes
00223         {
00224             char dummy[64];
00225         };
00226     };
00227 
00228     EQ_EXPORT std::ostream& operator << ( std::ostream&, const Frame::Type );
00229     EQ_EXPORT std::ostream& operator << ( std::ostream&, const Frame::Buffer );
00230 };
00231 #endif // EQ_FRAME_H
Generated on Mon Aug 10 18:58:32 2009 for Equalizer 0.9 by  doxygen 1.5.8