当前位置: 首页>>代码示例>>C++>>正文


C++ idCVar::GetFloat方法代码示例

本文整理汇总了C++中idCVar::GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ idCVar::GetFloat方法的具体用法?C++ idCVar::GetFloat怎么用?C++ idCVar::GetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idCVar的用法示例。


在下文中一共展示了idCVar::GetFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ComputeEntityAimAssistScore

/*
========================
idAimAssist::ComputeEntityAimAssistScore
========================
*/
float idAimAssist::ComputeEntityAimAssistScore( const idVec3& targetPos, const idVec3& cameraPos, const idMat3& cameraAxis ) {

	float score = 0.0f;
		
	idVec3 dirToTarget = targetPos - cameraPos;	
	float distanceToTarget = dirToTarget.Length();

	// Compute a score in the range of 0..1 for how much are looking towards the target.
	idVec3 forward = cameraAxis[0];
	forward.Normalize();	
	dirToTarget.Normalize();
	float ViewDirDotTargetDir = idMath::ClampFloat( 0.0f, 1.0f, forward * dirToTarget ); // compute the dot and clamp to account for floating point error

	// the more we look at the target the higher our score
	score = ViewDirDotTargetDir;

	// weigh the score from the view angle higher than the distance score
	static float aimWeight = 0.8f;
	score *= aimWeight;
	// Add a score of 0..1 for how close the target is to the player
	if ( distanceToTarget < aa_targetMaxDistance.GetFloat() ) {
		float distanceScore = 1.0f - ( distanceToTarget / aa_targetMaxDistance.GetFloat() );
		float distanceWeight = 1.0f - aimWeight;
		score += ( distanceScore * distanceWeight );
	}

	return score * 1000.0f;
}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:33,代码来源:AimAssist.cpp

示例2:

/*
========================
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsDataChanged
========================
*/
bool idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsDataChanged() const
{
	if( originalFramerate != com_engineHz.GetInteger() )
	{
		return true;
	}
	if( originalAntialias != r_multiSamples.GetInteger() )
	{
		return true;
	}
	if( originalMotionBlur != r_motionBlur.GetInteger() )
	{
		return true;
	}
	if( originalVsync != r_swapInterval.GetInteger() )
	{
		return true;
	}
	if( originalBrightness != r_lightScale.GetFloat() )
	{
		return true;
	}
	if( originalVolume != s_volume_dB.GetFloat() )
	{
		return true;
	}
	// RB begin
	if( originalShadowMapping != r_useShadowMapping.GetInteger() )
	{
		return true;
	}
	// RB end
	return false;
}
开发者ID:baldvin,项目名称:RBDOOM-3-BFG,代码行数:39,代码来源:MenuScreen_Shell_SystemOptions.cpp

示例3: UpdateDisplayFraction

/*
==============
UpdateDisplayFraction

Scrolls the console up or down based on conspeed
==============
*/
void idConsoleLocal::UpdateDisplayFraction()
{
	if( con_speed.GetFloat() <= 0.1f )
	{
		fracTime = Sys_Milliseconds();
		displayFrac = finalFrac;
		return;
	}
	
	// scroll towards the destination height
	if( finalFrac < displayFrac )
	{
		displayFrac -= con_speed.GetFloat() * ( Sys_Milliseconds() - fracTime ) * 0.001f;
		if( finalFrac > displayFrac )
		{
			displayFrac = finalFrac;
		}
		fracTime = Sys_Milliseconds();
	}
	else if( finalFrac > displayFrac )
	{
		displayFrac += con_speed.GetFloat() * ( Sys_Milliseconds() - fracTime ) * 0.001f;
		if( finalFrac < displayFrac )
		{
			displayFrac = finalFrac;
		}
		fracTime = Sys_Milliseconds();
	}
}
开发者ID:bsmr-c-cpp,项目名称:RBDOOM-3-BFG,代码行数:36,代码来源:Console.cpp

示例4: UpdateFriction

/*
========================
idAimAssist::UpdateFriction
========================
*/
void idAimAssist::UpdateFriction( idEntity* pTarget, const idVec3& targetPos ) {

	if ( !aa_targetFrictionEnable.GetBool() ) {
		return;
	}

	if ( pTarget == NULL ) {
		return;
	}
	
	idVec3 cameraPos;
	idMat3 cameraAxis;
	player->GetViewPos(cameraPos, cameraAxis);
	idVec3 dirToTarget = targetPos - cameraPos;
	float  distanceToTarget = dirToTarget.Length();
	idVec3 forward = cameraAxis[0];
	forward.Normalize();
	dirToTarget.Normalize();
	float ViewDirDotTargetDir = idMath::ClampFloat( 0.0f, 1.0f, forward * dirToTarget ); // compute the dot and clamp to account for floating point error
	float aimLength = ViewDirDotTargetDir * distanceToTarget;
	idVec3 aimPoint = cameraPos + ( forward * aimLength );
	float delta = idMath::Sqrt( Square( distanceToTarget ) - Square( aimLength ) );

	const float radius = ComputeFrictionRadius( distanceToTarget );
	if ( delta < radius ) {
		float alpha = 1.0f - ( delta / radius );
		frictionScalar = Lerp( aa_targetFrictionMultiplierMin.GetFloat(), aa_targetFrictionMultiplierMax.GetFloat(), alpha );
	}
}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:34,代码来源:AimAssist.cpp

示例5: CurrentShakeAmplitude

/*
========================
idSoundWorldLocal::CurrentShakeAmplitude
========================
*/
float idSoundWorldLocal::CurrentShakeAmplitude()
{
	if( s_constantAmplitude.GetFloat() >= 0.0f )
	{
		return s_constantAmplitude.GetFloat();
	}
	return shakeAmp;
}
开发者ID:hexameron,项目名称:RBDOOM-3-BFG,代码行数:13,代码来源:snd_world.cpp

示例6: CaclulateStereoDistances

float	GetScreenSeparationForGuis() {
	const stereoDistances_t dists = CaclulateStereoDistances(
		stereoRender_interOccularCentimeters.GetFloat(),
		renderSystem->GetPhysicalScreenWidthInCentimeters(),
		stereoRender_convergence.GetFloat(),
		80.0f /* fov */ );

	return dists.screenSeparation;
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:9,代码来源:PlayerView.cpp

示例7: AdjustForCushionChannels

/*
========================
AdjustForCushionChannels

In the very common case of having more sounds that would contribute to the
mix than there are available hardware voices, it can be an audible discontinuity
when a channel initially gets a voice or loses a voice.
To avoid this, make sure that the last few hardware voices are mixed with a volume
of zero, so they won't make a difference as they come and go.
It isn't obvious what the exact best volume ramping method should be, just that
it smoothly change frame to frame.
========================
*/
static float AdjustForCushionChannels( const idStaticList< idActiveChannel, MAX_HARDWARE_VOICES >& activeEmitterChannels,
									   const int uncushionedChannels, const float currentCushionDB, const float driftRate )
{

	float	targetCushionDB;
	if( activeEmitterChannels.Num() <= uncushionedChannels )
	{
		// we should be able to hear all of them
		targetCushionDB = DB_SILENCE;
	}
	else
	{
		// we should be able to hear all of them
		targetCushionDB = activeEmitterChannels[uncushionedChannels].channel->volumeDB;
		if( targetCushionDB < DB_SILENCE )
		{
			targetCushionDB = DB_SILENCE;
		}
		else if( targetCushionDB > s_cushionFadeLimit.GetFloat() )
		{
			targetCushionDB = s_cushionFadeLimit.GetFloat();
		}
	}
	
	// linearly drift the currentTargetCushionDB towards targetCushionDB
	float	driftedDB = currentCushionDB;
	if( driftedDB < targetCushionDB )
	{
		driftedDB += driftRate;
		if( driftedDB > targetCushionDB )
		{
			driftedDB = targetCushionDB;
		}
	}
	else
	{
		driftedDB -= driftRate;
		if( driftedDB < targetCushionDB )
		{
			driftedDB = targetCushionDB;
		}
	}
	
	// ramp the lower sound volumes down
	for( int i = 0; i < activeEmitterChannels.Num(); i++ )
	{
		idSoundChannel* chan = activeEmitterChannels[i].channel;
		chan->volumeDB = MapVolumeFromFadeDB( chan->volumeDB, driftedDB );
	}
	
	return driftedDB;
}
开发者ID:hexameron,项目名称:RBDOOM-3-BFG,代码行数:65,代码来源:snd_world.cpp

示例8: switch

/*
========================
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField
========================
*/
void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField( const int fieldIndex, const int adjustAmount ) {
    switch ( fieldIndex ) {
    case SYSTEM_FIELD_FRAMERATE: {
        //Carl: Oculus Rift DK1 can be hacked to use refresh rates from 60Hz to 83Hz (71Hz max undistorted). CV1 will probably support 90Hz.
        //Carl: Doom 3 BFG also originally supported 120Hz. So list everything from 60 to 83, with 90 and 120 last.
        static const int numValues = 26;
        static const int values[numValues] = { 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 90, 120 };
        com_engineHz.SetInteger( AdjustOption( com_engineHz.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_VSYNC: {
        static const int numValues = 3;
        static const int values[numValues] = { 0, 1, 2 };
        r_swapInterval.SetInteger( AdjustOption( r_swapInterval.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_ANTIALIASING: {
        static const int numValues = 5;
        static const int values[numValues] = { 0, 2, 4, 8, 16 };
        r_multiSamples.SetInteger( AdjustOption( r_multiSamples.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_MOTIONBLUR: {
        static const int numValues = 5;
        static const int values[numValues] = { 0, 2, 3, 4, 5 };
        r_motionBlur.SetInteger( AdjustOption( r_motionBlur.GetInteger(), values, numValues, adjustAmount ) );
        break;
    }
    case SYSTEM_FIELD_LODBIAS: {
        const float percent = LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f );
        const float adjusted = percent + (float)adjustAmount * 5.0f;
        const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
        r_lodBias.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, -1.0f, 1.0f ) );
        break;
    }
    case SYSTEM_FIELD_BRIGHTNESS: {
        const float percent = LinearAdjust( r_lightScale.GetFloat(), 2.0f, 4.0f, 0.0f, 100.0f );
        const float adjusted = percent + (float)adjustAmount;
        const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
        r_lightScale.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, 2.0f, 4.0f ) );
        break;
    }
    case SYSTEM_FIELD_VOLUME: {
        const float percent = 100.0f * Square( 1.0f - ( s_volume_dB.GetFloat() / DB_SILENCE ) );
        const float adjusted = percent + (float)adjustAmount;
        const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
        s_volume_dB.SetFloat( DB_SILENCE - ( idMath::Sqrt( clamped / 100.0f ) * DB_SILENCE ) );
        break;
    }
    }
    cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
}
开发者ID:KozGit,项目名称:DOOM3-BFG-RIFT,代码行数:57,代码来源:MenuScreen_Shell_SystemOptions.cpp

示例9:

/*
========================
idMenuScreen_Shell_Gamepad::idMenuDataSource_AudioSettings::LoadData
========================
*/
void idMenuScreen_Shell_Gamepad::idMenuDataSource_GamepadSettings::LoadData() {	
	idPlayerProfile * profile = session->GetProfileFromMasterLocalUser();

	fields[ GAMEPAD_FIELD_INVERT ].SetBool( in_invertLook.GetBool() );
	fields[ GAMEPAD_FIELD_LEFTY ].SetBool( profile ? profile->GetLeftyFlip() : false );
	fields[ GAMEPAD_FIELD_VIBRATE ].SetBool( in_joystickRumble.GetBool() );
	fields[ GAMEPAD_FIELD_HOR_SENS ].SetFloat( 100.0f * ( ( joy_yawSpeed.GetFloat() - 0.0f ) / 400.0f ) );	
	fields[ GAMEPAD_FIELD_VERT_SENS ].SetFloat( 100.0f * ( ( joy_pitchSpeed.GetFloat() - 0.0f ) / 260.0f ) );
	fields[ GAMEPAD_FIELD_ACCELERATION ].SetBool( joy_gammaLook.GetBool() );
	fields[ GAMEPAD_FIELD_THRESHOLD ].SetBool( joy_mergedThreshold.GetBool() );

	originalFields = fields;
}
开发者ID:RobertBeckebans,项目名称:DOOM3-BFG-RIFT,代码行数:18,代码来源:MenuScreen_Shell_Gamepad.cpp

示例10: GetCurrentResolutionScale

/*
========================
idResolutionScale::GetCurrentResolutionScale
========================
*/
void idResolutionScale::GetCurrentResolutionScale( float& x, float& y )
{
	assert( currentResolution >= MINIMUM_RESOLUTION_SCALE );
	assert( currentResolution <= MAXIMUM_RESOLUTION_SCALE );
	
	x = MAXIMUM_RESOLUTION_SCALE;
	y = MAXIMUM_RESOLUTION_SCALE;

	// foresthale 2014-05-28: don't allow resolution scaling with editors, we don't really care about framerate and we don't refresh constantly anyway
	if (com_editors)
		return;

	switch( rs_enable.GetInteger() )
	{
		case 0:
			return;
		case 1:
			x = currentResolution;
			break;
		case 2:
			y = currentResolution;
			break;
		case 3:
		{
			const float middle = ( MINIMUM_RESOLUTION_SCALE + MAXIMUM_RESOLUTION_SCALE ) * 0.5f;
			if( currentResolution >= middle )
			{
				// First scale horizontally from max to min
				x = MINIMUM_RESOLUTION_SCALE + ( currentResolution - middle ) * 2.0f;
			}
			else
			{
				// Then scale vertically from max to min
				x = MINIMUM_RESOLUTION_SCALE;
				y = MINIMUM_RESOLUTION_SCALE + ( currentResolution - MINIMUM_RESOLUTION_SCALE ) * 2.0f;
			}
			break;
		}
	}
	float forceFrac = rs_forceFractionX.GetFloat();
	if( forceFrac > 0.0f && forceFrac <= MAXIMUM_RESOLUTION_SCALE )
	{
		x = forceFrac;
	}
	forceFrac = rs_forceFractionY.GetFloat();
	if( forceFrac > 0.0f && forceFrac <= MAXIMUM_RESOLUTION_SCALE )
	{
		y = forceFrac;
	}
}
开发者ID:BielBdeLuna,项目名称:StormEngine2,代码行数:55,代码来源:ResolutionScale.cpp

示例11:

/*
========================
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::LoadData
========================
*/
void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::LoadData() {
    originalFramerate = com_engineHz.GetInteger();
    originalAntialias = r_multiSamples.GetInteger();
    originalMotionBlur = r_motionBlur.GetInteger();
    originalVsync = r_swapInterval.GetInteger();
    originalBrightness = r_lightScale.GetFloat();
    originalVolume = s_volume_dB.GetFloat();

    const int fullscreen = r_fullscreen.GetInteger();
    if ( fullscreen > 0 ) {
        R_GetModeListForDisplay( fullscreen - 1, modeList );
    } else {
        modeList.Clear();
    }
}
开发者ID:KozGit,项目名称:DOOM3-BFG-RIFT,代码行数:20,代码来源:MenuScreen_Shell_SystemOptions.cpp

示例12: UpdateStamina

/*
========================
idMenuScreen_HUD::UpdateStamina
========================
*/
void idMenuScreen_HUD::UpdateStamina( idPlayer* player )
{

	if( !stamina || !player )
	{
		return;
	}
	
	idSWFSpriteInstance* stamSprite = stamina->GetSprite();
	if( stamSprite != NULL )
	{
	
		if( common->IsMultiplayer() )
		{
			stamSprite->SetVisible( false );
		}
		else
		{
			float max_stamina = pm_stamina.GetFloat();
			if( !max_stamina )
			{
				stamSprite->SetVisible( false );
			}
			else
			{
				stamSprite->SetVisible( true );
				float staminaPercent = idMath::Ftoi( 100.0f * player->stamina / max_stamina );
				stamSprite->StopFrame( staminaPercent + 1 );
			}
		}
	}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:37,代码来源:MenuScreen_HUD.cpp

示例13: UpdateButtons

/*
=============================
idGameBearShootWindow::UpdateButtons
=============================
*/
void idGameBearShootWindow::UpdateButtons() {

	if ( onFire ) {
		idVec2 vec;

		gui->HandleNamedEvent( "DisableFireButton" );
		common->SW()->PlayShaderDirectly( "arcade_sargeshoot" );

		bear->SetVisible( true );
		bearScale = 1.f;
		bear->SetSize( BEAR_SIZE, BEAR_SIZE );

		vec.x = idMath::Cos( DEG2RAD(turretAngle) );
		vec.x += ( 1 - vec.x ) * 0.18f;
		vec.y = -idMath::Sin( DEG2RAD(turretAngle) );

		turretForce = bearTurretForce.GetFloat();

		bear->position.x = 80 + ( 96 * vec.x );
		bear->position.y = 334 + ( 96 * vec.y );
		bear->velocity.x = vec.x * turretForce;
		bear->velocity.y = vec.y * turretForce;

		gunblast->position.x = 55 + ( 96 * vec.x );
		gunblast->position.y = 310 + ( 100 * vec.y );
		gunblast->SetVisible( true );
		gunblast->entColor.w = 1.f;
		gunblast->rotation = turretAngle;
		gunblast->fadeOut = true;

		bearHitTarget = false;

		onFire = false;
	}
}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:40,代码来源:GameBearShootWindow.cpp

示例14: IN_MotionSensor_Read

void IN_MotionSensor_Read(float &roll, float &pitch, float &yaw)
{
		if (SFusion.IsAttachedToSensor()) {
            float predictionDelta = in_sensorPrediction.GetFloat() * (1.0f / 1000.0f);
            if (SFusion.GetPredictionDelta() != predictionDelta)
            {
                SFusion.SetPrediction(predictionDelta);
            }
			Quatf hmdOrient = SFusion.GetPredictedOrientation();
			float y = 0.0f, p = 0.0f, r = 0.0f;
			hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&y, &p, &r);
			roll =   -RADIANS_TO_DEGREES(r); // ???
			pitch =  -RADIANS_TO_DEGREES(p); // should be degrees down
			yaw =     RADIANS_TO_DEGREES(y); // should be degrees left
		} else if (hasVR920Tracker && IWRGetTracking) {
			LONG y=0, p=0, r=0;
			if (IWRGetTracking(&y, &p, &r)==ERROR_SUCCESS) {
				yaw = y * 180.0f/32767.0f;
				pitch = p * -180.0f/32767.0f;
				roll = r * 180.0f/32767.0f;
			}
		} else {
			roll  = angles[ROLL];
			pitch = angles[PITCH];
			yaw   = angles[YAW];
		}
}
开发者ID:JunDeWinter,项目名称:DOOM-3-BFG-VR,代码行数:27,代码来源:in_motion_sensor.cpp

示例15: M_DrawOptions

void M_DrawOptions(void)
{
	V_DrawPatchDirect (108,15,0,(patch_t*)W_CacheLumpName("M_OPTTTL",PU_CACHE_SHARED));

	//V_DrawPatchDirect (::g->OptionsDef.x + 175,::g->OptionsDef.y+LINEHEIGHT*detail,0,
	//	(patch_t*)W_CacheLumpName(detailNames[::g->detailLevel],PU_CACHE_SHARED));

	int fullscreenOnOff = r_fullscreen.GetInteger() >= 1 ? 1 : 0;

	V_DrawPatchDirect (::g->OptionsDef.x + 150,::g->OptionsDef.y+LINEHEIGHT*endgame,0,
		(patch_t*)W_CacheLumpName(msgNames[fullscreenOnOff],PU_CACHE_SHARED));

	V_DrawPatchDirect (::g->OptionsDef.x + 120,::g->OptionsDef.y+LINEHEIGHT*scrnsize,0,
		(patch_t*)W_CacheLumpName(msgNames[in_useJoystick.GetInteger()],PU_CACHE_SHARED));

	V_DrawPatchDirect (::g->OptionsDef.x + 120,::g->OptionsDef.y+LINEHEIGHT*messages,0,
		(patch_t*)W_CacheLumpName(msgNames[m_show_messages.GetInteger()],PU_CACHE_SHARED));

	extern idCVar in_mouseSpeed;
	const int roundedMouseSpeed = M_GetMouseSpeedForMenu( in_mouseSpeed.GetFloat() );

	M_DrawThermo( ::g->OptionsDef.x, ::g->OptionsDef.y + LINEHEIGHT * ( mousesens + 1 ), 16, roundedMouseSpeed );

	//M_DrawThermo(::g->OptionsDef.x,::g->OptionsDef.y+LINEHEIGHT*(scrnsize+1),
	//	9,::g->screenSize);
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:26,代码来源:m_menu.cpp


注:本文中的idCVar::GetFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。