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


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

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


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

示例1: OnBind

void CGaussianNoiseProxy::OnBind( void *pC_BaseEntity )
{
	float flMean = m_Mean.GetFloat();
	float flStdDev = m_StdDev.GetFloat();
	float flVal = randomgaussian->RandomFloat( flMean, flStdDev );
	float flMaxVal = m_flMaxVal.GetFloat();
	float flMinVal = m_flMinVal.GetFloat();

	if (flMinVal > flMaxVal)
	{
		float flTemp = flMinVal;
		flMinVal = flMaxVal;
		flMaxVal = flTemp;
	}

	// clamp
	if (flVal < flMinVal)
		flVal = flMinVal;
	else if ( flVal > flMaxVal )
		flVal = flMaxVal;

	SetFloatResult( flVal );

	if ( ToolsEnabled() )
	{
		ToolFramework_RecordMaterialParams( GetMaterial() );
	}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:28,代码来源:mathproxy.cpp

示例2: OnBind

void CClampProxy::OnBind( void *pC_BaseEntity )
{
	Assert( m_pSrc1 && m_pResult );

	MaterialVarType_t resultType;
	int vecSize;
	ComputeResultType( resultType, vecSize );

	float flMin = m_Min.GetFloat();
	float flMax = m_Max.GetFloat();

	if (flMin > flMax)
	{
		float flTemp = flMin;
		flMin = flMax;
		flMax = flTemp;
	}

	switch( resultType )
	{
	case MATERIAL_VAR_TYPE_VECTOR:
		{
			Vector a;
			m_pSrc1->GetVecValue( a.Base(), vecSize );
			for (int i = 0; i < vecSize; ++i)
			{
				if (a[i] < flMin)
					a[i] = flMin;
				else if (a[i] > flMax)
					a[i] = flMax;
			}
			m_pResult->SetVecValue( a.Base(), vecSize );
		}
		break;

	case MATERIAL_VAR_TYPE_FLOAT:
		{
			float src = m_pSrc1->GetFloatValue();
			if (src < flMin)
				src = flMin;
			else if (src > flMax)
				src = flMax;
			SetFloatResult( src );
		}
		break;

	case MATERIAL_VAR_TYPE_INT:
		{
			int src = m_pSrc1->GetIntValue();
			if (src < flMin)
				src = flMin;
			else if (src > flMax)
				src = flMax;
			m_pResult->SetIntValue( src );
		}
		break;
	}
}
开发者ID:Randdalf,项目名称:bliink,代码行数:58,代码来源:mathproxy.cpp

示例3: OnBind

void CTextureScrollMaterialProxy::OnBind( void *pC_BaseEntity )
{
	if( !m_pTextureScrollVar )
	{
		return;
	}

	float rate, angle, scale;

	// set default values if these variables don't exist.
	rate		= m_TextureScrollRate.GetFloat();
	angle		= m_TextureScrollAngle.GetFloat();
	scale		= m_TextureScale.GetFloat();

	float sOffset, tOffset;
	
	sOffset = gpGlobals->curtime * cos( angle * ( M_PI / 180.0f ) ) * rate;
	tOffset = gpGlobals->curtime * sin( angle * ( M_PI / 180.0f ) ) * rate;

	// make sure that we are positive
	if( sOffset < 0.0f )
	{
		sOffset += 1.0f + -( int )sOffset;
	}
	if( tOffset < 0.0f )
	{
		tOffset += 1.0f + -( int )tOffset;
	}
			    
	// make sure that we are in a [0,1] range
	sOffset = sOffset - ( int )sOffset;
	tOffset = tOffset - ( int )tOffset;
	
	if (m_pTextureScrollVar->GetType() == MATERIAL_VAR_TYPE_MATRIX)
	{
		VMatrix mat( scale, 0.0f, 0.0f, sOffset,
			0.0f, scale, 0.0f, tOffset,
			0.0f, 0.0f, 1.0f, 0.0f,
			0.0f, 0.0f, 0.0f, 1.0f );
		m_pTextureScrollVar->SetMatrixValue( mat );
	}
	else
	{
		m_pTextureScrollVar->SetVecValue( sOffset, tOffset, 0.0f );
	}

	if ( ToolsEnabled() )
	{
		ToolFramework_RecordMaterialParams( GetMaterial() );
	}
}
开发者ID:1n73rf4c3,项目名称:source-sdk-2013,代码行数:51,代码来源:texturescrollmaterialproxy.cpp

示例4: OnBind

void CPlayerHealthProxy::OnBind( void *pArg )
{
	// NOTE: Player health max is not available on the server...
	C_BaseEntity *pEntity = BindArgToEntity( pArg );
	C_BaseTFPlayer* pPlayer = dynamic_cast<C_BaseTFPlayer*>(pEntity);
	if (!pPlayer)
		return;

	Assert( m_pResult );
	SetFloatResult( pPlayer->HealthFraction() * m_Factor.GetFloat() );

	/*
	// Should we draw their health?
	// If he's not on our team we can't see it unless we're a command with "targetinginfo".
	if ( GetLocalTeam() != GetTeam() && !(local->HasNamedTechnology("targetinginfo") && IsLocalPlayerClass(TFCLASS_COMMANDO) ))
		return drawn;
	// Don't draw health bars above myself
	if ( local == this )
		return drawn;
	// Don't draw health bars over dead/dying player
	if ( GetHealth() <= 0 )
		return drawn;

	return drawn;
	*/
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:26,代码来源:ProxyTFPlayer.cpp

示例5: OnBind

void CPupilProxy::OnBind( C_BaseEntity *pBaseEntity )
{
	if (!pBaseEntity || !m_pAnimatedTextureVar )
		return;

	if( m_pAnimatedTextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
		return;

	ITexture *pTexture = m_pAnimatedTextureVar->GetTextureValue();
	int nFrameCount = pTexture->GetNumAnimationFrames();

	// Compute the lighting at the eye position of the entity; use it to dialate the pupil
	Vector forward;
	pBaseEntity->GetVectors( &forward, NULL, NULL );

	Vector eyePt = pBaseEntity->EyePosition();
	Vector color;
	engine->ComputeLighting( eyePt, &forward, false, color );

	// Compute the intensity...
	float flIntensity = ( 0.299f * color[0] + 0.587f * color[1] + 0.114f * color[2] ) * 0.5;
	flIntensity = clamp( flIntensity, 0, 1 );
	float flLastIntensity = m_pLightingVar->GetFloatValue( );
	if ( flIntensity > flLastIntensity )
	{
		float flMaxChange = m_flPupilCloseRate.GetFloat() * gpGlobals->frametime;
		if ( flIntensity > (flMaxChange + flLastIntensity) )
		{
			flIntensity = flLastIntensity + flMaxChange;
		}
	}
	else
	{
		float flMaxChange = m_flPupilOpenRate.GetFloat() * gpGlobals->frametime;
		if ( flIntensity < (flLastIntensity - flMaxChange) )
		{
			flIntensity = flLastIntensity - flMaxChange;
		}
	}

	int nFrame = nFrameCount * flIntensity;
	nFrame = clamp( nFrame, 0, nFrameCount - 1 );

	m_pAnimatedTextureFrameNumVar->SetIntValue( nFrame );
	m_pLightingVar->SetFloatValue( flIntensity );
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:46,代码来源:proxypupil.cpp

示例6: OnBind

void CProxyHealth::OnBind( void *pC_BaseEntity )
{
    if (!pC_BaseEntity)
        return;

    C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );

    Assert( m_pResult );
    SetFloatResult( pEntity->HealthFraction() * m_Factor.GetFloat() );
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:10,代码来源:ProxyHealth.cpp

示例7: OnBind

void CPlayerFortsTimerProxy::OnBind( void *pC_BaseEntity )
{
	if(HL2MPRules()->GetGameType() != GAME_FORTS)
		return;

	float flPhaseLimit = HL2MPRules()->GetLastFortsPhaseTime();
	flPhaseLimit += HL2MPRules()->IsFortsBuildPhase() ? mp_forts_buildtime.GetFloat() * 60 : mp_forts_fighttime.GetFloat() * 60;

	// Produit en croix
	//  ?  | curtime
	// 360 | phaselimit

	SetFloatResult( ceil( gpGlobals->curtime * m_RangeMax.GetFloat() / flPhaseLimit ));
}
开发者ID:SCell555,项目名称:bisonours-party,代码行数:14,代码来源:proxyplayer.cpp

示例8: OnBind

void CObjectPowerProxy::OnBind( void *pRenderable )
{
	// Find the view angle between the player and this entity....
	IClientRenderable *pRend = (IClientRenderable *)pRenderable;
	C_BaseEntity *pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
	C_BaseObject *pObject = dynamic_cast<C_BaseObject*>(pEntity);
	if (!pObject)
		return;

	SetFloatResult(  m_Factor.GetFloat() );

	if ( ToolsEnabled() )
	{
		ToolFramework_RecordMaterialParams( GetMaterial() );
	}
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:16,代码来源:c_baseobject.cpp

示例9: OnBind

void CEntityRandomProxy::OnBind( void *pC_BaseEntity )
{
	// Find the view angle between the player and this entity....
	if (!pC_BaseEntity)
		return;

	// Find the view angle between the player and this entity....
	C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );

	Assert( m_pResult );
	m_pResult->SetFloatValue( pEntity->ProxyRandomValue() * m_Factor.GetFloat() );

	if ( ToolsEnabled() )
	{
		ToolFramework_RecordMaterialParams( GetMaterial() );
	}
}
开发者ID:Entropy-Soldier,项目名称:ges-legacy-code,代码行数:17,代码来源:proxyplayer.cpp

示例10: OnBind

void CMatrixRotateProxy::OnBind( void *pC_BaseEntity )
{
    VMatrix mat;
    Vector axis( 0, 0, 1 );
    if (m_pAxisVar)
    {
        m_pAxisVar->GetVecValue( axis.Base(), 3 );
        if (VectorNormalize( axis ) < 1e-3)
        {
            axis.Init( 0, 0, 1 );
        }
    }

    MatrixBuildRotationAboutAxis( mat, axis, m_Angle.GetFloat() );
    m_pResult->SetMatrixValue( mat );

    if ( ToolsEnabled() )
    {
        ToolFramework_RecordMaterialParams( GetMaterial() );
    }
}
开发者ID:GOGIBERRY,项目名称:source-sdk-2013,代码行数:21,代码来源:matrixproxy.cpp


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