Equalizer
1.2.1
|
00001 00002 /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 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/client/api.h> 00023 #include <eq/client/eye.h> // enum Eye 00024 #include <eq/client/types.h> 00025 #include <eq/client/zoomFilter.h> // member 00026 00027 #include <eq/fabric/zoom.h> // member 00028 #include <co/object.h> 00029 #include <co/objectVersion.h> 00030 #include <co/types.h> 00031 #include <co/base/bitOperation.h> // function getIndexOfLastBit 00032 #include <co/base/monitor.h> 00033 00034 namespace eq 00035 { 00036 namespace server 00037 { 00038 class Frame; 00039 } 00050 class Frame : public co::Object 00051 { 00052 public: 00058 enum Buffer 00059 { 00060 BUFFER_NONE = EQ_BIT_NONE, 00061 BUFFER_UNDEFINED = EQ_BIT1, 00062 BUFFER_COLOR = EQ_BIT5, 00063 BUFFER_DEPTH = EQ_BIT9, 00064 BUFFER_ALL = EQ_BIT_ALL_32 00065 }; 00066 00068 enum Type 00069 { 00070 TYPE_MEMORY, 00071 TYPE_TEXTURE 00072 }; 00073 00075 EQ_API Frame(); 00076 00078 EQ_API virtual ~Frame(); 00079 00083 EQ_API const std::string& getName() const; 00084 00086 const Vector2i& getOffset() const { return _data.offset; } 00087 00096 void setOffset( const Vector2i& offset ) { _data.offset = offset;} 00097 00102 EQ_API const Range& getRange() const; 00103 00108 EQ_API const Pixel& getPixel() const; 00109 00114 EQ_API const SubPixel& getSubPixel() const; 00115 00120 EQ_API uint32_t getPeriod() const; 00121 00126 EQ_API uint32_t getPhase() const; 00127 00136 void setZoom( const Zoom& zoom ) { _data.zoom = zoom; } 00137 00139 const Zoom& getZoom() const { return _data.zoom; } 00140 00145 void setZoomFilter( const ZoomFilter zoomFilter ) 00146 { _zoomFilter = zoomFilter; } 00147 00152 ZoomFilter getZoomFilter() const { return _zoomFilter; } 00153 00155 EQ_API const Images& getImages() const; 00156 00158 void setData( FrameData* data ) { _frameData = data; } 00159 00161 FrameData* getData() { return _frameData; } 00162 00164 const FrameData* getData() const { return _frameData; } 00165 00167 EQ_API uint32_t getBuffers() const; 00168 00175 EQ_API void disableBuffer( const Buffer buffer ); 00176 00178 EQ_API void setAlphaUsage( const bool useAlpha ); 00179 00181 EQ_API void setQuality( const Frame::Buffer buffer, 00182 const float quality ); 00183 00185 EQ_API void useCompressor( const Frame::Buffer buffer, 00186 const uint32_t name ); 00187 00189 const co::ObjectVersion& getDataVersion( const Eye eye ) const 00190 { return _data.frameData[co::base::getIndexOfLastBit( eye ) ]; } 00192 00196 EQ_API void clear(); 00197 00199 void flush(); 00200 00210 EQ_API void readback( util::ObjectManager< const void* >* glObjects, 00211 const DrawableConfig& config ); 00212 00220 void setReady(); 00221 00228 EQ_API bool isReady() const; 00229 00231 EQ_API void waitReady( const uint32_t timeout = 00232 EQ_TIMEOUT_INDEFINITE ) const; 00233 00240 void addListener( co::base::Monitor<uint32_t>& listener ); 00241 00248 void removeListener( co::base::Monitor<uint32_t>& listener ); 00250 00252 const std::vector< uint128_t >& getInputNodes( const Eye eye ) const 00253 { return _data.toNodes[co::base::getIndexOfLastBit(eye)].inputNodes; } 00254 00256 const std::vector< uint128_t >& getInputNetNodes(const Eye eye) const 00257 { return _data.toNodes[co::base::getIndexOfLastBit(eye)].inputNetNodes; } 00258 00259 protected: 00260 virtual ChangeType getChangeType() const { return INSTANCE; } 00261 virtual void getInstanceData( co::DataOStream& os ); 00262 virtual void applyInstanceData( co::DataIStream& is ); 00263 00264 private: 00265 std::string _name; 00266 FrameData* _frameData; 00267 00268 ZoomFilter _zoomFilter; // texture filter 00269 00271 friend class eq::server::Frame; 00272 00273 struct Data 00274 { 00275 struct ToNode 00276 { 00277 std::vector< uint128_t > inputNodes; 00278 std::vector< uint128_t > inputNetNodes; 00279 }; 00280 00281 Data() : offset( Vector2i::ZERO ) {} 00282 00283 Vector2i offset; 00284 Zoom zoom; 00285 co::ObjectVersion frameData[ NUM_EYES ]; 00286 ToNode toNodes[ NUM_EYES ]; 00287 00288 EQ_API void serialize( co::DataOStream& os ) const; 00289 EQ_API void deserialize( co::DataIStream& is ); 00290 } 00291 _data; 00292 00293 struct Private; 00294 Private* _private; // placeholder for binary-compatible changes 00295 }; 00296 00298 EQ_API std::ostream& operator << ( std::ostream&, const Frame::Type ); 00300 EQ_API std::ostream& operator << ( std::ostream&, const Frame::Buffer ); 00301 }; 00302 #endif // EQ_FRAME_H