viewport.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "viewport.h"
00019
00020 #include <eq/client/pixelViewport.h>
00021
00022 EQ_EXPORT const eq::Viewport eq::Viewport::FULL;
00023
00024 namespace eq
00025 {
00026 void Viewport::applyView( const Viewport& segmentVP, const Viewport& viewVP,
00027 const PixelViewport& pvp, const Vector4i& overdraw )
00028 {
00029
00030 Viewport contribution( segmentVP );
00031 contribution.intersect( viewVP );
00032 contribution.transform( viewVP );
00033
00034
00035 EQASSERT( pvp.hasArea( ));
00036
00037 const float xDelta(( static_cast< float >( overdraw.x() + pvp.w ) /
00038 static_cast< float >( pvp.w ) - 1.0f ) *
00039 contribution.w );
00040 contribution.x -= xDelta;
00041 contribution.w += (( static_cast< float >( overdraw.z() + pvp.w ) /
00042 static_cast< float >( pvp.w ) - 1.0f ) *
00043 contribution.w );
00044 contribution.w += xDelta;
00045
00046 const float yDelta(( static_cast< float >( overdraw.y() + pvp.h ) /
00047 static_cast< float >( pvp.h ) - 1.0f ) *
00048 contribution.h );
00049 contribution.y -= yDelta;
00050 contribution.h += (( static_cast< float >( overdraw.w() + pvp.h ) /
00051 static_cast< float >( pvp.h ) - 1.0f ) *
00052 contribution.h );
00053 contribution.h += yDelta;
00054
00055 x = contribution.x + x * contribution.w;
00056 y = contribution.y + y * contribution.h;
00057 w *= contribution.w;
00058 h *= contribution.h;
00059 }
00060
00061
00062 }