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


C++ C_BaseAnimating::AddEffects方法代码示例

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


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

示例1: SetupModel

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CModelPanel::SetupModel( void )
{
	if ( !m_pModelInfo )
		return; 

	MDLCACHE_CRITICAL_SECTION();

	// remove any current models we're using
	DeleteModelData();

	const char *pszModelName = GetModelName();
	if ( !pszModelName || !pszModelName[0] )
		return;

	// create the new model
	CModelPanelModel *pEnt = new CModelPanelModel;

	if ( !pEnt )
		return;

	if ( pEnt->InitializeAsClientEntity( pszModelName, false ) == false )
	{
		// we failed to initialize this entity so just return gracefully
		pEnt->Remove();
		return;
	}
	
	// setup the handle
	m_hModel = pEnt;

	pEnt->DontRecordInTools();
	pEnt->AddEffects( EF_NODRAW ); // don't let the renderer draw the model normally

	if ( m_pModelInfo->m_nSkin >= 0 )
	{
		pEnt->SetSkin( m_pModelInfo->m_nSkin );
	}

	// do we have any animation information?
	if ( m_pModelInfo->m_Animations.Count() > 0 && m_pModelInfo->m_Animations.IsValidIndex( m_iDefaultAnimation ) )
	{
		CModelPanelModelAnimation *pAnim = m_pModelInfo->m_Animations[ m_iDefaultAnimation ];
		int sequence = ACT_INVALID;
		if ( pAnim->m_pszActivity && pAnim->m_pszActivity[0] )
		{
			Activity activity = (Activity)ActivityList_IndexForName( pAnim->m_pszActivity );
			sequence = pEnt->SelectWeightedSequence( activity );
		}
		else if ( pAnim->m_pszSequence && pAnim->m_pszSequence[0] )
		{
			sequence = pEnt->LookupSequence( pAnim->m_pszSequence );
		}
		if ( sequence != ACT_INVALID )
		{
			pEnt->ResetSequence( sequence );
			pEnt->SetCycle( 0 );

			if ( pAnim->m_pPoseParameters )
			{
				for ( KeyValues *pData = pAnim->m_pPoseParameters->GetFirstSubKey(); pData != NULL; pData = pData->GetNextKey() )
				{
					const char *pName = pData->GetName();
					float flValue = pData->GetFloat();
		
					pEnt->SetPoseParameter( pName, flValue );
				}
			}

			pEnt->m_flAnimTime = gpGlobals->curtime;
		}
	}

	// setup any attached models
	for ( int i = 0 ; i < m_pModelInfo->m_AttachedModelsInfo.Count() ; i++ )
	{
		CModelPanelAttachedModelInfo *pInfo = m_pModelInfo->m_AttachedModelsInfo[i];
		C_BaseAnimating *pTemp = new C_BaseAnimating;

		if ( pTemp )
		{
			if ( pTemp->InitializeAsClientEntity( pInfo->m_pszModelName, false ) == false )
			{	
				// we failed to initialize this model so just skip it
				pTemp->Remove();
				continue;
			}

			pTemp->DontRecordInTools();
			pTemp->AddEffects( EF_NODRAW ); // don't let the renderer draw the model normally
			pTemp->FollowEntity( m_hModel.Get() ); // attach to parent model

			if ( pInfo->m_nSkin >= 0 )
			{
				pTemp->SetSkin( pInfo->m_nSkin );
			}

			pTemp->m_flAnimTime = gpGlobals->curtime;
//.........这里部分代码省略.........
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:101,代码来源:basemodelpanel.cpp


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