Equalizer  2.1.0
Parallel Rendering Framework
frameData.h
1 
2 /* Copyright (c) 2006-2017, 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 <co/object.h> // base class
24 #include <eq/fabric/frameData.h> // base class
25 #include <eq/frame.h> // enum Frame::Buffer
26 #include <eq/types.h>
27 #include <lunchbox/monitor.h> // member
28 #include <lunchbox/spinLock.h> // member
29 
30 namespace eq
31 {
32 namespace detail
33 {
34 class FrameData;
35 }
36 
53  public co::Object,
54  public lunchbox::Referenced
55 {
56 public:
57  void assembleFrame(Frame* frame, Channel* channel);
58  struct ImageHeader
59  {
60  uint32_t internalFormat;
61  uint32_t externalFormat;
62  uint32_t pixelSize;
64  uint32_t compressorName;
65  uint32_t compressorFlags;
66  uint32_t nChunks;
67  float quality;
68  };
69 
71  EQ_API FrameData();
72 
74  EQ_API virtual ~FrameData();
75 
79  EQ_API const Images& getImages() const;
80 
88  EQ_API void setAlphaUsage(const bool useAlpha);
89 
99  void setQuality(const Frame::Buffer buffer, const float quality);
100 
111  void useCompressor(const Frame::Buffer buffer, const uint32_t name);
113 
126  EQ_API Image* newImage(const Frame::Type type,
127  const DrawableConfig& config);
128 
130  EQ_API void clear();
131 
133  EQ_API void flush();
134 
136  void deleteGLObjects(util::ObjectManager& om);
137 
139  EQ_API void resetPlugins();
140 
155  Images startReadback(const Frame& frame, util::ObjectManager& glObjects,
156  const DrawableConfig& config,
157  const PixelViewports& regions,
158  const RenderContext& context);
159 
167  void setReady();
168 
170  EQ_API bool isReady() const;
171 
173  EQ_API void waitReady(const uint32_t timeout = LB_TIMEOUT_INDEFINITE) const;
174 
176  void setVersion(const uint64_t version);
177 
178  typedef lunchbox::Monitor<uint32_t> Listener;
179 
189  void addListener(Listener& listener);
190 
197  void removeListener(Listener& listener);
199 
201  bool addImage(const co::ObjectVersion& frameDataVersion,
202  const PixelViewport& pvp, const Zoom& zoom,
203  const RenderContext& context, const Frame::Buffer buffers,
204  const bool useAlpha, uint8_t* data);
205  void setReady(const co::ObjectVersion& frameData,
206  const fabric::FrameData& data);
207 
208 protected:
209  virtual ChangeType getChangeType() const { return INSTANCE; }
210  virtual void getInstanceData(co::DataOStream& os);
211  virtual void applyInstanceData(co::DataIStream& is);
212 
213 private:
214  detail::FrameData* const _impl;
215 
217  Image* _allocImage(const Frame::Type type, const DrawableConfig& config,
218  const bool setQuality);
219 
221  void _applyVersion(const uint128_t& version);
222 
224  void _setReady(const uint64_t version);
225 
226  LB_TS_VAR(_commandThread);
227 };
228 
230 EQ_API std::ostream& operator<<(std::ostream&, const FrameData&);
231 }
232 
233 #endif // EQ_FRAMEDATA_H
std::vector< PixelViewport > PixelViewports
A vector of eq::PixelViewport.
Definition: eq/types.h:175
A channel represents a two-dimensional viewport within a Window.
Definition: channel.h:46
EQ_API std::ostream & operator<<(std::ostream &os, const EventICommand &command)
Print the event command to the given output stream.
Type
The storage type for pixel data.
Definition: fabric/frame.h:52
A holder for pixel data.
Definition: image.h:39
lunchbox::Monitor< uint32_t > Listener
Ready listener.
Definition: frameData.h:178
A holder for multiple images.
Definition: frameData.h:52
The Equalizer client library.
Definition: eq/agl/types.h:23
Buffer
Components of the frame are to be used during readback and assembly.
Definition: fabric/frame.h:42
std::vector< Image * > Images
A vector of pointers to eq::Image.
Definition: eq/types.h:163
A facility class to manage OpenGL objects across shared contexts.
Definition: objectManager.h:56
A holder for a frame data and related parameters.
Definition: frame.h:46
Holds a 2D pixel viewport with methods for manipulation.
Definition: pixelViewport.h:34