Equalizer  1.6.1
wall.h
1 
2 /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQFABRIC_WALL_H
20 #define EQFABRIC_WALL_H
21 
22 #include <eq/fabric/api.h>
23 #include <eq/fabric/types.h>
24 #include <iostream>
25 
26 namespace eq
27 {
28 namespace fabric
29 {
30  class Projection;
31 
38  class Wall
39  {
40  public:
42  EQFABRIC_API Wall();
43 
45  EQFABRIC_API Wall( const Vector3f& bottomLeft,
46  const Vector3f& bottomRight,
47  const Vector3f& topLeft );
48 
55  EQFABRIC_API void resizeHorizontal( const float ratio );
56 
63  EQFABRIC_API void resizeVertical( const float ratio );
64 
71  EQFABRIC_API void resizeLeft( const float ratio );
72 
79  EQFABRIC_API void resizeRight( const float ratio );
80 
87  EQFABRIC_API void resizeTop( const float ratio );
88 
95  EQFABRIC_API void resizeBottom( const float ratio );
96 
103  EQFABRIC_API void resizeHorizontalToAR( const float aspectRatio );
104 
115  EQFABRIC_API void moveFocus( const Vector3f& eye, const float ratio );
116 
121  EQFABRIC_API void apply( const Viewport& viewport);
122 
127  EQFABRIC_API void scale( const float ratio );
128 
133  EQFABRIC_API Wall& operator = ( const Projection& projection );
134 
139  EQFABRIC_API Wall& operator = ( const Matrix4f& xfm );
140 
142  float getWidth() const { return (bottomRight - bottomLeft).length(); }
143 
145  float getHeight() const { return (topLeft - bottomLeft).length(); }
146 
148  EQFABRIC_API bool operator == ( const Wall& rhs ) const;
149 
151  EQFABRIC_API bool operator != ( const Wall& rhs ) const;
152 
154  Vector3f getU() const { return bottomRight - bottomLeft; }
155 
157  Vector3f getV() const { return topLeft - bottomLeft; }
158 
160  Vector3f getW() const { return getU().cross( getV( )); }
161 
165 
167  enum Type
168  {
171  };
173  };
174 
175  EQFABRIC_API std::ostream& operator << ( std::ostream&, const Wall& );
176  EQFABRIC_API std::ostream& operator << ( std::ostream&, const Wall::Type& );
177 }
178 }
179 
180 namespace lunchbox
181 {
182 template<> inline void byteswap( eq::fabric::Wall::Type& value )
183 {
184  byteswap( reinterpret_cast< uint32_t& >( value ));
185 }
186 
187 template<> inline void byteswap( eq::fabric::Wall& value )
188 {
189  byteswap( value.bottomLeft );
190  byteswap( value.bottomRight );
191  byteswap( value.topLeft );
192  byteswap( value.type );
193 }
194 }
195 #endif // EQFABRIC_WALL_H
bool operator!=(const Wall &rhs) const
void resizeTop(const float ratio)
Resize the wall on the top side.
Vector3f getU() const
Definition: wall.h:154
Wall()
Construct a new wall description.
void resizeRight(const float ratio)
Resize the wall on the right side.
A wall fixed to the observer (head-mounted display)
Definition: wall.h:170
void resizeHorizontal(const float ratio)
Resize the wall horizontally.
Vector3f bottomRight
The bottom-right corner.
Definition: wall.h:163
void moveFocus(const Vector3f &eye, const float ratio)
Resize the wall by the given ratio as observed from the eye position.
void resizeLeft(const float ratio)
Resize the wall on the left side.
void scale(const float ratio)
Move each wall corner by the given ratio.
void resizeVertical(const float ratio)
Resize the wall vertically.
vmml::vector< 3, float > Vector3f
A three-component float vector.
Definition: vmmlib.h:46
float getHeight() const
Definition: wall.h:145
A wall defining a view frustum.
Definition: wall.h:38
void apply(const Viewport &viewport)
Compute the sub-frustum for a 2D area on the full wall.
void resizeBottom(const float ratio)
Resize the wall on the bottom side.
Vector3f getV() const
Definition: wall.h:157
Vector3f bottomLeft
The bottom-left corner.
Definition: wall.h:162
vmml::matrix< 4, 4, float > Matrix4f
A 4x4 float matrix.
Definition: vmmlib.h:39
Vector3f getW() const
Definition: wall.h:160
float getWidth() const
Definition: wall.h:142
A projector definition defining a view frustum.
Definition: projection.h:40
A fractional viewport with methods for manipulation.
Definition: viewport.h:36
Vector3f topLeft
The top-left corner.
Definition: wall.h:164
void resizeHorizontalToAR(const float aspectRatio)
Resize the wall horizontally to match the given aspect ratio.
bool operator==(const Wall &rhs) const
Wall & operator=(const Projection &projection)
Set the wall parameters from a projection description.
Type
The reference system type of the wall.
Definition: wall.h:167
A fixed mounted projection wall.
Definition: wall.h:169
Type type
The wall type.
Definition: wall.h:172