Line data Source code
1 :
2 : /* Copyright (c) 2008-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2011, 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/client/api.h>
23 : #include <eq/client/types.h> // member
24 : #include <eq/client/visitorResult.h> // enum
25 :
26 : #include <eq/fabric/view.h> // base class
27 : #include <eq/fabric/viewport.h> // member
28 :
29 : namespace eq
30 : {
31 : namespace detail { class View; }
32 :
33 : /**
34 : * A View is a 2D area of a Layout. It is a view of the application's data
35 : * on a model, in the sense used by the MVC pattern. It can be a scene,
36 : * viewing mode, viewing position, or any other representation of the
37 : * application's data.
38 : *
39 : * @warning Never commit a View. Equalizer does take care of this to
40 : * correctly associate view version with rendering frames.
41 : * @sa fabric::View
42 : */
43 : class View : public fabric::View< Layout, View, Observer >
44 : {
45 : public:
46 : /** Construct a new view. @version 1.0 */
47 : EQ_API View( Layout* parent );
48 :
49 : /** Destruct this view. @version 1.0 */
50 : EQ_API virtual ~View();
51 :
52 : /** @name Data Access. */
53 : //@{
54 : /**
55 : * @return the parent pipe of this view, 0 for non-render client views.
56 : * @version 1.1.2
57 : */
58 16 : Pipe* getPipe() { return _pipe; }
59 :
60 : /**
61 : * @return the parent pipe of this view, 0 for non-render client views.
62 : * @version 1.1.2
63 : */
64 : EQ_API const Pipe* getPipe() const { return _pipe; }
65 :
66 : /** @return the config of this view. @version 1.0 */
67 : EQ_API Config* getConfig();
68 :
69 : /** @return the config of this view. @version 1.0 */
70 : EQ_API const Config* getConfig() const;
71 :
72 : /** @return the Server of this view. @version 1.0 */
73 : EQ_API ServerPtr getServer();
74 : //@}
75 :
76 : /** @name Operations */
77 : //@{
78 : /**
79 : * Handle a received (view) event.
80 : *
81 : * The task of this method is to update the view as necessary. It is
82 : * called by Config::handleEvent on the application main thread for all
83 : * view events. Thread safe.
84 : *
85 : * @param event the received view event.
86 : * @return true when the event was handled, false if not.
87 : * @version 1.0
88 : */
89 : EQ_API virtual bool handleEvent( const Event& event );
90 : //@}
91 :
92 : protected:
93 : /** @internal */
94 : EQ_API virtual void deserialize( co::DataIStream& is,
95 : const uint64_t dirtyBits );
96 :
97 : /** @return the initial frustum value of this view. */
98 : EQ_API const Frustum& getBaseFrustum() const;
99 :
100 : /** @internal trigger deletion for render-client views. */
101 : EQ_API virtual void detach();
102 :
103 : private:
104 : detail::View* const _impl;
105 :
106 : Pipe* _pipe; // for render-client views
107 : friend class Pipe;
108 : };
109 : }
110 :
111 : #endif //EQ_VIEW_H
|