Equalizer  2.1.0
Parallel Rendering Framework
frustum.h
1 
2 /* Copyright (c) 2009-2017, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_FRUSTUM_H
19 #define EQFABRIC_FRUSTUM_H
20 
21 #include <eq/fabric/api.h> // decl
22 #include <eq/fabric/projection.h> // member
23 #include <eq/fabric/wall.h> // member
24 
25 namespace eq
26 {
27 namespace fabric
28 {
30 class Frustum
31 {
32 public:
34  EQFABRIC_API Frustum();
35 
37  EQFABRIC_API virtual ~Frustum();
38 
40  enum Type
41  {
45  };
46 
48  EQFABRIC_API void setWall(const Wall& wall);
49 
51  EQFABRIC_API void setProjection(const Projection& projection);
52 
54  const Wall& getWall() const { return _data.wall; }
56  const Projection& getProjection() const { return _data.projection; }
58  Type getCurrentType() const { return _data.current; }
60  EQFABRIC_API void unsetFrustum();
61 
62  EQFABRIC_API void serialize(co::DataOStream& os);
63  EQFABRIC_API void deserialize(co::DataIStream& is);
64 
65  EQFABRIC_API virtual void backup();
66  EQFABRIC_API virtual void restore();
67 
68 protected:
69  virtual void updateFrustum() {}
70  virtual void notifyFrustumChanged() {}
71 private:
72  struct BackupData
73  {
74  BackupData()
75  : current(TYPE_NONE)
76  {
77  }
78 
80  Wall wall;
81 
83  Projection projection;
84 
86  Type current;
87  } _data, _backup;
88 };
89 EQFABRIC_API std::ostream& operator<<(std::ostream& os, const Frustum&);
90 }
91 }
92 
93 #endif // EQFABRIC_FRUSTUM_H
EQFABRIC_API Frustum()
Construct a new frustum.
Defines export visibility macros for library EqualizerFabric.
EQFABRIC_API void unsetFrustum()
Set the last specified frustum to TYPE_NONE.
A wall defining a view frustum.
Definition: wall.h:37
const Projection & getProjection() const
Definition: frustum.h:56
Type
The type of the last specified frustum.
Definition: frustum.h:40
Type getCurrentType() const
Definition: frustum.h:58
No frustum has been specified.
Definition: frustum.h:42
A projector definition defining a view frustum.
Definition: projection.h:38
const Wall & getWall() const
Definition: frustum.h:54
A projection description has been set last.
Definition: frustum.h:44
The Equalizer client library.
Definition: eq/agl/types.h:23
std::ostream & operator<<(std::ostream &os, const AxisEvent &event)
Print the axis event to the given output stream.
Definition: axisEvent.h:49
EQFABRIC_API void setWall(const Wall &wall)
Set the frustum using a wall description.
EQFABRIC_API void setProjection(const Projection &projection)
Set the frustum using a projection description.
A wall description has been set last.
Definition: frustum.h:43
virtual EQFABRIC_API ~Frustum()
Destruct the frustum.
A distributed object for frustum data.
Definition: frustum.h:30