/*
==================
FullscreenFX_Warp::HighQuality
==================
*/
void FullscreenFX_Warp::HighQuality()
{
	float x1, y1, x2, y2, radius, interp;
	idVec2 center;
	int STEP = 9;
	renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
	
	interp = ( idMath::Sin( ( float )( gameLocal.slow.time - startWarpTime ) / 1000 ) + 1 ) / 2.f;
	interp = 0.7 * ( 1 - interp ) + 0.3 * ( interp );
	
	// draw the warps
	center.x = renderSystem->GetVirtualWidth() / 2.0f;
	center.y = renderSystem->GetVirtualHeight() / 2.0f;
	radius = 200;
	
	for( float i = 0; i < 360; i += STEP )
	{
		// compute the values
		x1 = idMath::Sin( DEG2RAD( i ) );
		y1 = idMath::Cos( DEG2RAD( i ) );
		
		x2 = idMath::Sin( DEG2RAD( i + STEP ) );
		y2 = idMath::Cos( DEG2RAD( i + STEP ) );
		
		// add warp polygon
		WarpPolygon_t p;
		
		p.outer1.x = center.x + x1 * radius;
		p.outer1.y = center.y + y1 * radius;
		p.outer1.z = p.outer1.x / ( float )renderSystem->GetVirtualWidth();
		p.outer1.w = 1 - ( p.outer1.y / ( float )renderSystem->GetVirtualHeight() );
		
		p.outer2.x = center.x + x2 * radius;
		p.outer2.y = center.y + y2 * radius;
		p.outer2.z = p.outer2.x / ( float )renderSystem->GetVirtualWidth();
		p.outer2.w = 1 - ( p.outer2.y / ( float )renderSystem->GetVirtualHeight() );
		
		p.center.x = center.x;
		p.center.y = center.y;
		p.center.z = p.center.x / ( float )renderSystem->GetVirtualWidth();
		p.center.w = 1 - ( p.center.y / ( float )renderSystem->GetVirtualHeight() );
		
		// draw it
		DrawWarp( p, interp );
	}
}
Esempio n. 2
0
/*
==================
FullscreenFX_Warp::HighQuality
==================
*/
void FullscreenFX_Warp::HighQuality() {
	float x1, y1, x2, y2, radius, interp;
	idVec2 center;
	int STEP = 9;

	interp = ( idMath::Sin( (float)( gameLocal.slow.time - startWarpTime ) / 1000 ) + 1 ) / 2.f;
	interp = 0.7 * ( 1 - interp ) + 0.3 * ( interp );

	// draw the warps
	center.x = 320;
	center.y = 240;
	radius = 200;

	for ( float i = 0; i < 360; i += STEP ) {
		// compute the values
		x1 = idMath::Sin( DEG2RAD( i ) );
		y1 = idMath::Cos( DEG2RAD( i ) );

		x2 = idMath::Sin( DEG2RAD( i + STEP ) );
		y2 = idMath::Cos( DEG2RAD( i + STEP ) );

		// add warp polygon
		WarpPolygon_t p;

		p.outer1.x = center.x + x1 * radius;
		p.outer1.y = center.y + y1 * radius;
		p.outer1.z = p.outer1.x / 640.f;
		p.outer1.w = 1 - ( p.outer1.y / 480.f );

		p.outer2.x = center.x + x2 * radius;
		p.outer2.y = center.y + y2 * radius;
		p.outer2.z = p.outer2.x / 640.f;
		p.outer2.w = 1 - ( p.outer2.y / 480.f );

		p.center.x = center.x;
		p.center.y = center.y;
		p.center.z = p.center.x / 640.f;
		p.center.w = 1 - ( p.center.y / 480.f );

		// draw it
		DrawWarp( p, interp );
	}
}