Equalizer  1.12.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 
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:43
EQ_API void setAlphaUsage(const bool useAlpha)
Set alpha usage for newly allocated images.
virtual EQ_API ~FrameData()
Destruct this frame data.
EQ_API std::ostream & operator<<(std::ostream &os, const ConfigEvent *event)
Print the config event to the given output stream.
EQ_API const Images & getImages() const
The images of this frame data holder.
std::vector< PixelViewport > PixelViewports
A vector of eq::PixelViewport.
Definition: eq/types.h:173
EQ_API FrameData()
Construct a new frame data holder.
Buffer
Components of the frame are to be used during readback and assembly.
Definition: fabric/frame.h:39
EQ_API void flush()
Flush the frame by deleting all images.
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:161
EQ_API bool isReady() const
A holder for pixel data.
Definition: image.h:36
void useCompressor(const Frame::Buffer buffer, const uint32_t name)
Sets a compressor which will be allocated and used during transmit of the image buffer.
void addListener(Listener &listener)
Add a ready listener.
A holder for multiple images.
Definition: frameData.h:49
The Equalizer client library.
Definition: eq/agl/types.h:23
Images startReadback(const Frame &frame, util::ObjectManager &glObjects, const DrawableConfig &config, const PixelViewports &regions, const RenderContext &context)
Start reading back a set of images for this frame data.
EQ_API void resetPlugins()
Deallocate all transfer and compression plugins on all images.
void setReady()
Set the frame data ready.
EQ_API void clear()
Clear the frame by recycling the attached images.
A facility class to manage OpenGL objects across shared contexts.
Definition: objectManager.h:52
EQ_API Image * newImage(const Frame::Type type, const DrawableConfig &config)
Allocate and add a new image.
A holder for a frame data and related parameters.
Definition: frame.h:43
void deleteGLObjects(util::ObjectManager &om)
Delete data allocated by the given object manager on all images.
EQ_API void waitReady(const uint32_t timeout=LB_TIMEOUT_INDEFINITE) const
Wait for the frame data to become available.
void setQuality(const Frame::Buffer buffer, const float quality)
Set the minimum quality after download and compression.
void removeListener(Listener &listener)
Remove a frame listener.
Holds a 2D pixel viewport with methods for manipulation.
Definition: pixelViewport.h:34