18 #ifndef EQFABRIC_VIEWPORT_H
19 #define EQFABRIC_VIEWPORT_H
22 #include <eq/fabric/types.h>
23 #include <eq/fabric/vmmlib.h>
24 #include <lunchbox/debug.h>
31 std::ostream& operator << ( std::ostream& os,
const Viewport& vp );
44 const float w_,
const float h_ )
45 :
x( x_ ),
y( y_ ),
w( w_ ),
h( h_ ) {}
49 :
x( from[0] ),
y( from[1] ),
w( from[2] ),
h( from[3] ) {}
58 LBASSERTINFO(
isValid(), *
this);
59 LBASSERTINFO( rhs.
isValid(), rhs );
71 x = (
x - rhs.
x ) / rhs.
w;
72 y = (
y - rhs.
y ) / rhs.
h;
81 return (
x==rhs.
x &&
y==rhs.
y &&
w==rhs.
w &&
h==rhs.
h);
90 return (
x!=rhs.
x ||
y!=rhs.
y ||
w!=rhs.
w ||
h!=rhs.
h);
99 {
return (
x>=0.0f &&
y>=0.0f &&
w>=0.0f &&
h>=0.0f ); }
138 const float sEx =
static_cast< float >(
x +
w );
139 const float sEy =
static_cast< float >(
y +
h );
140 const float dEx =
static_cast< float >( rhs.
x + rhs.
w );
141 const float dEy =
static_cast< float >( rhs.
y + rhs.
h );
143 x = LB_MAX(
x, rhs.
x );
144 y = LB_MAX(
y, rhs.
y );
145 w = LB_MIN( sEx, dEx ) -
x;
146 h = LB_MIN( sEy, dEy ) -
y;
154 x = LB_MIN( x, rhs.
x );
155 y = LB_MIN(
y, rhs.
y );
177 const Vector4i& overdraw );
187 inline std::ostream& operator << ( std::ostream& os,
const Viewport& vp )
189 os <<
"[ " << vp.
x <<
" " << vp.
y <<
" " << vp.
w <<
" " << vp.
h <<
" ]";
205 #endif // EQFABRIC_VIEWPORT_H
Defines export visibility macros for library EqualizerFabric.
A fractional viewport with methods for manipulation.
bool operator!=(const Viewport &rhs) const
Viewport getCoverage(const Viewport &with) const
Compute the coverage of another viewport on this viewport.
Viewport(const Vector4f &from)
Construct a fractional viewport from a Vector4f.
void intersect(const Viewport &rhs)
Create the intersection of the two viewports.
Viewport()
Construct a full fractional viewport.
void transform(const Viewport &rhs)
Transform this viewport into the rhs viewport space.
void invalidate()
Make the viewport invalid.
bool operator==(const Viewport &rhs) const
Viewport(const float x_, const float y_, const float w_, const float h_)
Construct a fractional viewport with default values.
The Equalizer client library.
static EQFABRIC_API const Viewport FULL
A full viewport.
EQFABRIC_API void applyView(const Viewport &segmentVP, const Viewport &viewVP, const PixelViewport &pvp, const Vector4i &overdraw)
Apply the view coverage to this viewport.
void apply(const Viewport &rhs)
Apply (accumulate) another viewport.
Holds a 2D pixel viewport with methods for manipulation.
void unite(const Viewport &rhs)
Create the union of the two viewports.