Equalizer  1.10.1
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 {
36  class Wall
37  {
38  public:
40  EQFABRIC_API Wall();
41 
43  EQFABRIC_API Wall( const Vector3f& bottomLeft,
44  const Vector3f& bottomRight,
45  const Vector3f& topLeft );
46 
53  EQFABRIC_API void resizeHorizontal( const float ratio );
54 
61  EQFABRIC_API void resizeVertical( const float ratio );
62 
69  EQFABRIC_API void resizeLeft( const float ratio );
70 
77  EQFABRIC_API void resizeRight( const float ratio );
78 
85  EQFABRIC_API void resizeTop( const float ratio );
86 
93  EQFABRIC_API void resizeBottom( const float ratio );
94 
101  EQFABRIC_API void resizeHorizontalToAR( const float aspectRatio );
102 
113  EQFABRIC_API void moveFocus( const Vector3f& eye, const float ratio );
114 
119  EQFABRIC_API void apply( const Viewport& viewport);
120 
125  EQFABRIC_API void scale( const float ratio );
126 
131  EQFABRIC_API Wall& operator = ( const Projection& projection );
132 
137  EQFABRIC_API Wall& operator = ( const Matrix4f& xfm );
138 
140  float getWidth() const { return (bottomRight - bottomLeft).length(); }
141 
143  float getHeight() const { return (topLeft - bottomLeft).length(); }
144 
146  EQFABRIC_API bool operator == ( const Wall& rhs ) const;
147 
149  EQFABRIC_API bool operator != ( const Wall& rhs ) const;
150 
152  Vector3f getU() const { return bottomRight - bottomLeft; }
153 
155  Vector3f getV() const { return topLeft - bottomLeft; }
156 
158  Vector3f getW() const { return getU().cross( getV( )); }
159 
160  Vector3f bottomLeft;
161  Vector3f bottomRight;
162  Vector3f topLeft;
163 
165  enum Type
166  {
169  };
171  };
172 
173  EQFABRIC_API std::ostream& operator << ( std::ostream&, const Wall& );
174  EQFABRIC_API std::ostream& operator << ( std::ostream&, const Wall::Type& );
175 }
176 }
177 
178 namespace lunchbox
179 {
180 template<> inline void byteswap( eq::fabric::Wall::Type& value )
181 {
182  byteswap( reinterpret_cast< uint32_t& >( value ));
183 }
184 
185 template<> inline void byteswap( eq::fabric::Wall& value )
186 {
187  byteswap( value.bottomLeft );
188  byteswap( value.bottomRight );
189  byteswap( value.topLeft );
190  byteswap( value.type );
191 }
192 }
193 #endif // EQFABRIC_WALL_H
Vector3f bottomRight
The bottom-right corner.
Definition: wall.h:161
EQFABRIC_API void resizeRight(const float ratio)
Resize the wall on the right side.
EQFABRIC_API bool operator!=(const Wall &rhs) const
EQFABRIC_API Wall & operator=(const Projection &projection)
Set the wall parameters from a projection description.
Defines export visibility macros for library EqualizerFabric.
A fractional viewport with methods for manipulation.
Definition: viewport.h:34
EQFABRIC_API void resizeVertical(const float ratio)
Resize the wall vertically.
float getHeight() const
Definition: wall.h:143
float getWidth() const
Definition: wall.h:140
A wall defining a view frustum.
Definition: wall.h:36
Vector3f getV() const
Definition: wall.h:155
A wall fixed to the observer (head-mounted display)
Definition: wall.h:168
EQFABRIC_API void resizeBottom(const float ratio)
Resize the wall on the bottom side.
Vector3f bottomLeft
The bottom-left corner.
Definition: wall.h:160
EQFABRIC_API void resizeHorizontalToAR(const float aspectRatio)
Resize the wall horizontally to match the given aspect ratio.
EQFABRIC_API void resizeHorizontal(const float ratio)
Resize the wall horizontally.
A projector definition defining a view frustum.
Definition: projection.h:38
EQFABRIC_API bool operator==(const Wall &rhs) const
A fixed mounted projection wall.
Definition: wall.h:167
EQFABRIC_API void resizeTop(const float ratio)
Resize the wall on the top side.
Vector3f topLeft
The top-left corner.
Definition: wall.h:162
EQFABRIC_API void scale(const float ratio)
Move each wall corner by the given ratio.
EQFABRIC_API void resizeLeft(const float ratio)
Resize the wall on the left side.
Type
The reference system type of the wall.
Definition: wall.h:165
EQFABRIC_API void moveFocus(const Vector3f &eye, const float ratio)
Resize the wall by the given ratio as observed from the eye position.
Type type
The wall type.
Definition: wall.h:170
EQFABRIC_API Wall()
Construct a new wall description.
Vector3f getU() const
Definition: wall.h:152
Vector3f getW() const
Definition: wall.h:158
EQFABRIC_API void apply(const Viewport &viewport)
Compute the sub-frustum for a 2D area on the full wall.