Equalizer  1.12.0
Parallel Rendering Framework
frustum.h
1 
2 /* Copyright (c) 2009-2014, 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/projection.h> // member
22 #include <eq/fabric/wall.h> // member
23 #include <eq/fabric/api.h> // decl
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; }
55 
57  const Projection& getProjection() const { return _data.projection; }
58 
60  Type getCurrentType() const { return _data.current; }
61 
63  EQFABRIC_API void unsetFrustum();
64 
65  EQFABRIC_API void serialize( co::DataOStream& os );
66  EQFABRIC_API void deserialize( co::DataIStream& is );
67 
68  EQFABRIC_API virtual void backup();
69  EQFABRIC_API virtual void restore();
70 
71 protected:
72  virtual void updateFrustum() {}
73  virtual void notifyFrustumChanged() {}
74 
75 private:
76  struct BackupData
77  {
78  BackupData() : current( TYPE_NONE ) {}
79 
81  Wall wall;
82 
84  Projection projection;
85 
87  Type current;
88  }
89  _data, _backup;
90 };
91 EQFABRIC_API std::ostream& operator << ( std::ostream& os, const Frustum& );
92 }
93 }
94 
95 namespace lunchbox
96 {
97 template<> inline void byteswap( eq::fabric::Frustum::Type& value )
98  { byteswap( reinterpret_cast< uint32_t& >( value )); }
99 }
100 
101 #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:57
Type
The type of the last specified frustum.
Definition: frustum.h:40
Type getCurrentType() const
Definition: frustum.h:60
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
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