Beispiel #1
0
/*
===================
idPlayerView::InfluenceVision
===================
*/
void idPlayerView::InfluenceVision( idUserInterface *hud, const renderView_t *view ) {

	float distance = 0.0f;
	float pct = 1.0f;
	if ( player->GetInfluenceEntity() ) {
		distance = ( player->GetInfluenceEntity()->GetPhysics()->GetOrigin() - player->GetPhysics()->GetOrigin() ).Length();
		if ( player->GetInfluenceRadius() != 0.0f && distance < player->GetInfluenceRadius() ) {
			pct = distance / player->GetInfluenceRadius();
			pct = 1.0f - idMath::ClampFloat( 0.0f, 1.0f, pct );
		}
	}
	if ( player->GetInfluenceMaterial() ) {
		SingleView( hud, view );
		renderSystem->CaptureRenderToImage( "_currentRender" );
		renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, pct );
		renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, player->GetInfluenceMaterial() );
	} else if ( player->GetInfluenceEntity() == NULL ) {
		SingleView( hud, view );
		return;
	} else {
		int offset =  25 + sinf( gameLocal.time );
		DoubleVision( hud, view, pct * offset );
	}
}
/*
===================
idPlayerView::DoubleVision
===================
*/
void idPlayerView::DoubleVision(idUserInterface *hud, const renderView_t *view, int offset)
{

	if (!g_doubleVision.GetBool()) {
		SingleView(hud, view);
		return;
	}

	float	scale = offset * g_dvAmplitude.GetFloat();

	if (scale > 0.5f) {
		scale = 0.5f;
	}

	float shift = scale * sin(sqrtf(offset) * g_dvFrequency.GetFloat());
	shift = fabs(shift);

	// if double vision, render to a texture
	renderSystem->CropRenderSize(512, 256, true);
	SingleView(hud, view);
	renderSystem->CaptureRenderToImage("_scratch");
	renderSystem->UnCrop();

	// carry red tint if in berserk mode
	idVec4 color(1, 1, 1, 1);

	if (gameLocal.time < player->inventory.powerupEndTime[ BERSERK ]) {
		color.y = 0;
		color.z = 0;
	}

	renderSystem->SetColor4(color.x, color.y, color.z, 1.0f);
	renderSystem->DrawStretchPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, shift, 1, 1, 0, dvMaterial);
	renderSystem->SetColor4(color.x, color.y, color.z, 0.5f);
	renderSystem->DrawStretchPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 1, 1-shift, 0, dvMaterial);
}
/*
===================
idPlayerView::RenderPlayerView
===================
*/
void idPlayerView::RenderPlayerView( idMenuHandler_HUD* hudManager )
{
	const renderView_t* view = player->GetRenderView();
	if( renderSystem->GetStereo3DMode() != STEREO3D_OFF )
	{
		// render both eye views each frame on the PC
		for( int eye = 1 ; eye >= -1 ; eye -= 2 )
		{
			EmitStereoEyeView( eye, hudManager );
		}
	}
	else
	{
		SingleView( view, hudManager );
	}
	ScreenFade();
}
Beispiel #4
0
/*
===================
idPlayerView::EmitStereoEyeView
===================
*/
void idPlayerView::EmitStereoEyeView( const int eye, idMenuHandler_HUD * hudManager ) {
	renderView_t * view = player->GetRenderView();
	if ( view == NULL ) {
		return;
	}

	renderView_t eyeView = *view;

	const stereoDistances_t dists = CaclulateStereoDistances(
		stereoRender_interOccularCentimeters.GetFloat(),
		renderSystem->GetPhysicalScreenWidthInCentimeters(),
		stereoRender_convergence.GetFloat(),
		view->fov_x );

	eyeView.vieworg += eye * dists.worldSeparation * eyeView.viewaxis[1];

	eyeView.viewEyeBuffer = stereoRender_swapEyes.GetBool() ? eye : -eye;
	eyeView.stereoScreenSeparation = eye * dists.screenSeparation;

	SingleView( &eyeView, hudManager );
}