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 <eq/server/api.h>
24 : #include "types.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 4 : const Channels& getChannels() const { return _channels; }
72 :
73 : /** @name Operations */
74 : //@{
75 : /** Initialize the view parameters. */
76 : void init();
77 :
78 : /**
79 : * Trigger a view (de)activation.
80 : *
81 : * @param canvas The canvas to activate, or 0 to activate for all
82 : * canvases using this view's layout.
83 : * @param active true to activate, false to deactivate.
84 : */
85 : void trigger( const Canvas* canvas, const bool active );
86 :
87 : /**
88 : * Activate the given mode on this view.
89 : *
90 : * @param mode the new rendering mode
91 : */
92 : void activateMode( const Mode mode ) override;
93 :
94 : void updateCapabilities() override;
95 :
96 : /** Update all segment frusta based on the current settings. */
97 : void updateFrusta();
98 :
99 5058 : void setSAttribute( const SAttribute attr, const std::string& value )
100 5058 : { fabric::View< Layout, View, Observer >::setSAttribute( attr, value ); }
101 :
102 : void setDirty( const uint64_t bits ) override; //!< @internal
103 : //@}
104 :
105 : protected:
106 : /** @internal */
107 : void deserialize( co::DataIStream&, const uint64_t ) override;
108 4 : void notifyAttached() override { _updateChannels(); }
109 :
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
|