Line data Source code
1 :
2 : /* Copyright (c) 2009-2011, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2011, Daniel Nachbaur <danielnachbaur@gmail.com>
4 : * 2010, 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 "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 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 368 : const Channels& getChannels() const{ return _channels; }
72 :
73 : /** @name Operations */
74 : //@{
75 : /**
76 : * Trigger a view (de)activation.
77 : *
78 : * @param canvas The canvas to activate, or 0 to activate for all
79 : * canvases using this view's layout.
80 : * @param active true to activate, false to deactivate.
81 : */
82 : void trigger( const Canvas* canvas, const bool active );
83 :
84 : /**
85 : * Activate the given mode on this view.
86 : *
87 : * @param mode the new rendering mode
88 : */
89 : virtual void activateMode( const Mode mode );
90 :
91 : virtual void updateCapabilities();
92 :
93 : /** Update all segment frusta based on the current settings. */
94 : void updateFrusta();
95 :
96 : virtual void setDirty( const uint64_t bits ); //!< @internal
97 : //@}
98 :
99 : protected:
100 : /** @internal */
101 : virtual void deserialize( co::DataIStream&, const uint64_t );
102 63 : virtual void notifyAttached() { _updateChannels(); }
103 :
104 : private:
105 : /** The list of channels. */
106 : Channels _channels;
107 :
108 : struct Private;
109 : Private* _private; // placeholder for binary-compatible changes
110 :
111 : void _updateChannels() const;
112 : float _computeFocusRatio( Vector3f& eye );
113 : };
114 : }
115 : }
116 : #endif // EQSERVER_VIEW_H
|