Equalizer 1.0

frame.h

00001 
00002 /* Copyright (c) 2006-2010, 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 EQ_FRAME_H
00020 #define EQ_FRAME_H
00021 
00022 #include <eq/eye.h>    // enum Eye
00023 
00024 #include <eq/api.h>
00025 #include <eq/types.h>
00026 #include <eq/zoomFilter.h>   // member
00027 
00028 #include <eq/fabric/zoom.h>   // member
00029 #include <co/object.h>
00030 #include <co/objectVersion.h>
00031 #include <co/types.h>
00032 #include <co/base/bitOperation.h> // function getIndexOfLastBit
00033 #include <co/base/monitor.h>
00034 
00035 namespace eq
00036 {
00037 namespace util
00038 {
00039     template< typename T > class ObjectManager;
00040 }
00041 namespace server
00042 {
00043     class Frame;
00044 }
00045     class FrameData;
00046     class Image;
00047     class Pipe;
00048 
00059     class Frame : public co::Object
00060     {
00061     public:
00067         enum Buffer
00068         {
00069             BUFFER_NONE      = EQ_BIT_NONE,
00070             BUFFER_UNDEFINED = EQ_BIT1,  
00071             BUFFER_COLOR     = EQ_BIT5,  
00072             BUFFER_DEPTH     = EQ_BIT9,  
00073             BUFFER_ALL       = EQ_BIT_ALL
00074         };
00075 
00077         enum Type
00078         {
00079             TYPE_MEMORY,    
00080             TYPE_TEXTURE    
00081         };
00082 
00084         EQ_API Frame();
00085 
00087         EQ_API virtual ~Frame();
00088 
00092         EQ_API const std::string& getName() const;
00093 
00095         const Vector2i& getOffset() const { return _data.offset; }
00096 
00105         void setOffset( const Vector2i& offset ) { _data.offset = offset;}
00106 
00111         EQ_API const Range& getRange() const;
00112 
00117         EQ_API const Pixel& getPixel() const;
00118 
00123         EQ_API const SubPixel& getSubPixel() const;
00124 
00129         EQ_API uint32_t getPeriod() const;
00130 
00135         EQ_API uint32_t getPhase() const;
00136 
00145         void setZoom( const Zoom& zoom ) { _data.zoom = zoom; }
00146 
00148         const Zoom& getZoom() const { return _data.zoom; }
00149 
00154         void setZoomFilter( const ZoomFilter zoomFilter )
00155             { _zoomFilter = zoomFilter; }
00156 
00161         ZoomFilter getZoomFilter() const { return _zoomFilter; }
00162 
00164         EQ_API const Images& getImages() const;
00165 
00167         void setData( FrameData* data ) { _frameData = data; }
00168 
00170         FrameData* getData() { return _frameData; }
00171 
00173         const FrameData* getData() const { return _frameData; }
00174 
00176         EQ_API uint32_t getBuffers() const;
00177 
00184         EQ_API void disableBuffer( const Buffer buffer );
00185 
00187         EQ_API void setAlphaUsage( const bool useAlpha );
00188 
00190         EQ_API void setQuality( const Frame::Buffer buffer,
00191                                    const float quality );
00192 
00194         const co::ObjectVersion& getDataVersion( const Eye eye ) const
00195             { return _data.frameData[co::base::getIndexOfLastBit( eye ) ]; }
00197 
00201         EQ_API void clear();
00202 
00204         void flush();
00205 
00215         EQ_API void readback( util::ObjectManager< const void* >* glObjects,
00216                                  const DrawableConfig& config );
00217 
00225         void setReady();
00226 
00233         EQ_API bool isReady() const;
00234 
00236         EQ_API void waitReady() const;
00237 
00244         void addListener( co::base::Monitor<uint32_t>& listener );
00245 
00252         void removeListener( co::base::Monitor<uint32_t>& listener );
00254 
00255     protected:
00256         virtual ChangeType getChangeType() const { return INSTANCE; }
00257         virtual void getInstanceData( co::DataOStream& os );
00258         virtual void applyInstanceData( co::DataIStream& is );
00259 
00260     private:
00261         std::string _name;
00262         FrameData*  _frameData;
00263 
00264         ZoomFilter _zoomFilter; // texture filter
00265 
00267         friend class eq::server::Frame;
00268         struct Data
00269         {
00270             Data() : offset( Vector2i::ZERO ) {}
00271 
00272             Vector2i offset;
00273             Zoom zoom;
00274             co::ObjectVersion frameData[ NUM_EYES ];
00275         }
00276         _data;
00277 
00278         struct Private;
00279         Private* _private; // placeholder for binary-compatible changes
00280     };
00281 
00283     EQ_API std::ostream& operator << ( std::ostream&, const Frame::Type );
00285     EQ_API std::ostream& operator << ( std::ostream&, const Frame::Buffer );
00286 };
00287 #endif // EQ_FRAME_H
Generated on Sun May 8 2011 19:11:05 for Equalizer 1.0 by  doxygen 1.7.3