Equalizer  1.6.1
frustum.h
1 
2 /* Copyright (c) 2009-2013, 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 co
26 {
27  class DataOStream;
28  class DataIStream;
29 }
30 
31 namespace eq
32 {
33 namespace fabric
34 {
36  class Frustum
37  {
38  public:
40  EQFABRIC_API Frustum();
41 
43  EQFABRIC_API virtual ~Frustum();
44 
46  enum Type
47  {
51  };
52 
54  EQFABRIC_API void setWall( const Wall& wall );
55 
57  EQFABRIC_API void setProjection( const Projection& projection );
58 
60  const Wall& getWall() const { return _data.wall; }
61 
63  const Projection& getProjection() const { return _data.projection; }
64 
66  Type getCurrentType() const { return _data.current; }
67 
69  EQFABRIC_API void unsetFrustum();
70 
71  EQFABRIC_API void serialize( co::DataOStream& os );
72  EQFABRIC_API void deserialize( co::DataIStream& is );
73 
74  EQFABRIC_API virtual void backup();
75  EQFABRIC_API virtual void restore();
76 
77  protected:
78  virtual void updateFrustum() {}
79  virtual void notifyFrustumChanged() {}
80 
81  private:
82  struct BackupData
83  {
84  BackupData() : current( TYPE_NONE ) {}
85 
87  Wall wall;
88 
90  Projection projection;
91 
93  Type current;
94  }
95  _data, _backup;
96 
97  struct Private;
98  Private* _private; // placeholder for binary-compatible changes
99  };
100  EQFABRIC_API std::ostream& operator << ( std::ostream& os, const Frustum& );
101 }
102 }
103 
104 namespace lunchbox
105 {
106 template<> inline void byteswap( eq::fabric::Frustum::Type& value )
107  { byteswap( reinterpret_cast< uint32_t& >( value )); }
108 }
109 
110 #endif // EQFABRIC_FRUSTUM_H
void setProjection(const Projection &projection)
Set the frustum using a projection description.
A wall description has been set last.
Definition: frustum.h:49
A projection description has been set last.
Definition: frustum.h:50
void unsetFrustum()
Set the last specified frustum to TYPE_NONE.
Frustum()
Construct a new frustum.
A wall defining a view frustum.
Definition: wall.h:38
const Wall & getWall() const
Definition: frustum.h:60
No frustum has been specified.
Definition: frustum.h:48
void setWall(const Wall &wall)
Set the frustum using a wall description.
Type
The type of the last specified frustum.
Definition: frustum.h:46
A projector definition defining a view frustum.
Definition: projection.h:40
A distributed object for frustum data.
Definition: frustum.h:36
Type getCurrentType() const
Definition: frustum.h:66
const Projection & getProjection() const
Definition: frustum.h:63
virtual ~Frustum()
Destruct the frustum.