Line data Source code
1 :
2 : /* Copyright (c) 2009-2015, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Daniel Nachbaur <danielnachbaur@gmail.com>
4 : * Cedric Stalder <cedric.stalder@gmail.com>
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 EQSERVER_VIEW_H
21 : #define EQSERVER_VIEW_H
22 :
23 : #include "types.h"
24 : #include <eq/server/api.h>
25 :
26 : #include <eq/fabric/view.h> // base class
27 : #include <eq/fabric/viewport.h> // member
28 :
29 : namespace eq
30 : {
31 : namespace server
32 : {
33 : class View : public fabric::View<Layout, View, Observer>
34 : {
35 : public:
36 : EQSERVER_API explicit View(Layout* parent);
37 :
38 : virtual ~View();
39 :
40 : /** @name Data Access. */
41 : //@{
42 : /** @return the config of this view. */
43 : Config* getConfig();
44 :
45 : /** @return the config of this view. */
46 : const Config* getConfig() const;
47 :
48 : /** @return the Server of this view. */
49 : ServerPtr getServer();
50 :
51 : /** @return the index path to this view. */
52 : ViewPath getPath() const;
53 :
54 : /**
55 : * Adds a new destination channel to this view.
56 : *
57 : * @param channel the channel.
58 : */
59 : void addChannel(Channel* channel);
60 :
61 : /**
62 : * Removes a destination channel from this view.
63 : *
64 : * @param channel the channel
65 : * @return <code>true</code> if the channel was removed,
66 : * <code>false</code> otherwise.
67 : */
68 : bool removeChannel(Channel* channel);
69 :
70 : /** @return the vector of destination channels. */
71 118 : const Channels& getChannels() const { return _channels; }
72 : /** @name Operations */
73 : //@{
74 : /** Initialize the view parameters. */
75 : void init();
76 :
77 : /**
78 : * Trigger a view (de)activation.
79 : *
80 : * @param canvas The canvas to activate, or 0 to activate for all
81 : * canvases using this view's layout.
82 : * @param active true to activate, false to deactivate.
83 : */
84 : void trigger(const Canvas* canvas, const bool active);
85 :
86 : /**
87 : * Activate the given mode on this view.
88 : *
89 : * @param mode the new rendering mode
90 : */
91 : void activateMode(const Mode mode) override;
92 :
93 : void updateCapabilities() override;
94 :
95 : /** Update all segment frusta based on the current settings. */
96 : void updateFrusta();
97 :
98 5000 : void setSAttribute(const SAttribute attr, const std::string& value)
99 : {
100 5000 : fabric::View<Layout, View, Observer>::setSAttribute(attr, value);
101 5000 : }
102 :
103 : void setDirty(const uint64_t bits) override; //!< @internal
104 : //@}
105 :
106 : protected:
107 : /** @internal */
108 : void deserialize(co::DataIStream&, const uint64_t) override;
109 14 : void notifyAttached() override { _updateChannels(); }
110 : private:
111 : /** The list of channels. */
112 : Channels _channels;
113 :
114 : struct Private;
115 : Private* _private; // placeholder for binary-compatible changes
116 :
117 : void _updateChannels() const;
118 : float _computeFocusRatio(Vector3f& eye);
119 : };
120 : }
121 : }
122 : #endif // EQSERVER_VIEW_H
|