Example #1
0
bool Warp::handleResize( WarpList &warps, const ivec2 &size )
{
	for( WarpIter itr = warps.begin(); itr != warps.end(); ++itr )
		( *itr )->resize( size );

	return false;
}
Example #2
0
void Warp::selectClosestControlPoint( const WarpList &warps, const ivec2 &position )
{
	WarpRef  warp;
	unsigned i, index;
	float    d, distance = 10.0e6f;

	// find warp and distance to closest control point
	for( WarpConstReverseIter itr = warps.rbegin(); itr != warps.rend(); ++itr ) {
		i = ( *itr )->findControlPoint( position, &d );

		if( d < distance ) {
			distance = d;
			index = i;
			warp = *itr;
		}
	}

	// select the closest control point and deselect all others
	for( WarpConstIter itr = warps.begin(); itr != warps.end(); ++itr ) {
		if( *itr == warp )
			( *itr )->selectControlPoint( index );
		else
			( *itr )->deselectControlPoint();
	}
}
Example #3
0
void Warp::setSize( const WarpList &warps, int w, int h )
{
	for( WarpConstIter itr = warps.begin(); itr != warps.end(); ++itr )
		( *itr )->setSize( w, h );
}
Example #4
0
void Copy_Warps (WarpList& rNew, const WarpList& old)
{
    rNew.reserve(old.size());
    for (WarpList::const_iterator i = old.begin(); i != old.end(); i ++)
        rNew.push_back((*i)->Clone());
}
Example #5
0
void Destroy_Warps (WarpList& warps)
{
    for (WarpList::iterator iWarp = warps.begin(); iWarp != warps.end(); iWarp ++)
        delete *iWarp;
    warps.clear();
}