Equalizer  2.0.0
Parallel Rendering Framework
frameData.h
1 
2 /* Copyright (c) 2006-2016, Stefan Eilemann <eile@equalizergraphics.com>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  * Enrique <egparedes@ifi.uzh.ch>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQ_FRAMEDATA_H
21 #define EQ_FRAMEDATA_H
22 
23 #include <eq/frame.h> // enum Frame::Buffer
24 #include <eq/types.h>
25 #include <eq/fabric/frameData.h> // base class
26 #include <co/object.h> // base class
27 #include <lunchbox/monitor.h> // member
28 #include <lunchbox/spinLock.h> // member
29 
30 namespace eq
31 {
32 namespace detail { class FrameData; }
33 
49 class FrameData : public fabric::FrameData, public co::Object,
50  public lunchbox::Referenced
51 {
52 public:
53  void assembleFrame( Frame* frame, Channel* channel );
54  struct ImageHeader
55  {
56  uint32_t internalFormat;
57  uint32_t externalFormat;
58  uint32_t pixelSize;
60  uint32_t compressorName;
61  uint32_t compressorFlags;
62  uint32_t nChunks;
63  float quality;
64  };
65 
67  EQ_API FrameData();
68 
70  EQ_API virtual ~FrameData();
71 
75  EQ_API const Images& getImages() const;
76 
84  EQ_API void setAlphaUsage( const bool useAlpha );
85 
95  void setQuality( const Frame::Buffer buffer, const float quality );
96 
107  void useCompressor( const Frame::Buffer buffer, const uint32_t name );
109 
122  EQ_API Image* newImage( const Frame::Type type,
123  const DrawableConfig& config );
124 
126  EQ_API void clear();
127 
129  EQ_API void flush();
130 
132  void deleteGLObjects( util::ObjectManager& om );
133 
135  EQ_API void resetPlugins();
136 
151  Images startReadback( const Frame& frame,
152  util::ObjectManager& glObjects,
153  const DrawableConfig& config,
154  const PixelViewports& regions,
155  const RenderContext& context );
156 
164  void setReady();
165 
167  EQ_API bool isReady() const;
168 
170  EQ_API void waitReady( const uint32_t timeout = LB_TIMEOUT_INDEFINITE )
171  const;
172 
174  void setVersion( const uint64_t version );
175 
176  typedef lunchbox::Monitor< uint32_t > Listener;
177 
187  void addListener( Listener& listener );
188 
195  void removeListener( Listener& listener );
197 
199  bool addImage( const co::ObjectVersion& frameDataVersion,
200  const PixelViewport& pvp, const Zoom& zoom,
201  const RenderContext& context, const uint32_t buffers,
202  const bool useAlpha, uint8_t* data );
203  void setReady( const co::ObjectVersion& frameData,
204  const fabric::FrameData& data );
205 
206 protected:
207  virtual ChangeType getChangeType() const { return INSTANCE; }
208  virtual void getInstanceData( co::DataOStream& os );
209  virtual void applyInstanceData( co::DataIStream& is );
210 
211 private:
212  detail::FrameData* const _impl;
213 
215  Image* _allocImage( const Frame::Type type,
216  const DrawableConfig& config,
217  const bool setQuality );
218 
220  void _applyVersion( const uint128_t& version );
221 
223  void _setReady( const uint64_t version );
224 
225  LB_TS_VAR( _commandThread );
226 };
227 
229 EQ_API std::ostream& operator << ( std::ostream&, const FrameData& );
230 }
231 
232 #endif // EQ_FRAMEDATA_H
lunchbox::Monitor< uint32_t > Listener
Ready listener.
Definition: frameData.h:176
A channel represents a two-dimensional viewport within a Window.
Definition: channel.h:42
EQ_API std::ostream & operator<<(std::ostream &os, const EventICommand &command)
Print the event command to the given output stream.
std::vector< PixelViewport > PixelViewports
A vector of eq::PixelViewport.
Definition: eq/types.h:175
Buffer
Components of the frame are to be used during readback and assembly.
Definition: fabric/frame.h:39
Type
The storage type for pixel data.
Definition: fabric/frame.h:49
std::vector< Image * > Images
A vector of pointers to eq::Image.
Definition: eq/types.h:163
A holder for pixel data.
Definition: image.h:36
A holder for multiple images.
Definition: frameData.h:49
The Equalizer client library.
Definition: eq/agl/types.h:23
A facility class to manage OpenGL objects across shared contexts.
Definition: objectManager.h:53
A holder for a frame data and related parameters.
Definition: frame.h:43
Holds a 2D pixel viewport with methods for manipulation.
Definition: pixelViewport.h:34