Equalizer  2.1.0
Parallel Rendering Framework
view.h
1 
2 /* Copyright (c) 2008-2017, Stefan Eilemann <eile@equalizergraphics.com>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQ_VIEW_H
20 #define EQ_VIEW_H
21 
22 #include <eq/api.h>
23 #include <eq/frame.h> // enum
24 #include <eq/types.h> // member
25 #include <eq/visitorResult.h> // enum
26 
27 #include <eq/fabric/view.h> // base class
28 #include <eq/fabric/viewport.h> // member
29 
30 namespace eq
31 {
32 namespace detail
33 {
34 class View;
35 }
36 
46 class View : public fabric::View<Layout, View, Observer>
47 {
48 public:
50  EQ_API explicit View(Layout* parent);
51 
53  EQ_API virtual ~View();
54 
61  Pipe* getPipe() { return _pipe; }
66  EQ_API const Pipe* getPipe() const { return _pipe; }
68  EQ_API Config* getConfig();
69 
71  EQ_API const Config* getConfig() const;
72 
74  EQ_API ServerPtr getServer();
76 
91  EQ_API virtual bool handleEvent(EventType type, const SizeEvent& event);
92 
99  using ScreenshotFunc = std::function<void(uint32_t, const Image&)>;
100 
108  EQ_API void enableScreenshot(Frame::Buffer buffers,
109  const ScreenshotFunc& func);
110 
112  EQ_API void disableScreenshot();
113 
115  bool handleEvent(EventICommand& command);
116 
118  void sendScreenshotEvent(const Viewport& viewport,
119  const uint32_t frameNumber, const Image& image);
121 
122 protected:
132  virtual bool configInit() { return true; }
133  friend class detail::InitVisitor;
134 
136  virtual bool configExit() { return true; }
137  friend class detail::ExitVisitor;
139 
141  EQ_API virtual void deserialize(co::DataIStream& is,
142  const uint64_t dirtyBits);
143 
145  EQ_API const Frustum& getBaseFrustum() const;
146 
148  EQ_API virtual void detach();
149 
150 private:
151  detail::View* const _impl;
152 
153  bool _handleScreenshot(EventICommand& command);
154 
155  Pipe* _pipe; // for render-client views
156  friend class Pipe;
157 };
158 }
159 
160 #endif // EQ_VIEW_H
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
Definition: eq/types.h:215
A configuration is a visualization session driven by an application.
Definition: config.h:58
A Pipe represents a graphics card (GPU) on a Node.
Definition: pipe.h:50
EQ_API Config * getConfig(const int argc, char **argv)
Convenience function to retrieve a configuration.
A command specialization for config events.
Definition: eventICommand.h:41
virtual bool configExit()
Exit this view.
Definition: view.h:136
Base data transport class for views.
A holder for pixel data.
Definition: image.h:39
virtual bool configInit()
Initialize this view.
Definition: view.h:132
std::function< void(uint32_t, const Image &)> ScreenshotFunc
Callback function called during eq::Config::handleEvents() after capturing a complete screenshot...
Definition: view.h:99
The Equalizer client library.
Definition: eq/agl/types.h:23
A layout groups one or more View, logically belonging together.
Definition: layout.h:49
A View is a 2D area of a Layout.
Definition: view.h:46
Buffer
Components of the frame are to be used during readback and assembly.
Definition: fabric/frame.h:42
EQ_API const Pipe * getPipe() const
Definition: view.h:66
Pipe * getPipe()
Definition: view.h:61