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


C++ CSmartPtr::SetControlPoint方法代码示例

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


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

示例1: ReplaceWith

//-----------------------------------------------------------------------------
// Bounding box
//-----------------------------------------------------------------------------
CNewParticleEffect* CNewParticleEffect::ReplaceWith( const char *pParticleSystemName )
{
	StopEmission( false, true, true );
	if ( !pParticleSystemName || !pParticleSystemName[0] )
		return NULL;

	CSmartPtr< CNewParticleEffect > pNewEffect = CNewParticleEffect::Create( GetOwner(), pParticleSystemName, pParticleSystemName );
	if ( !pNewEffect->IsValid() )
		return pNewEffect.GetObject();

	// Copy over the control point data
	for ( int i = 0; i < MAX_PARTICLE_CONTROL_POINTS; ++i )
	{
		if ( !ReadsControlPoint( i ) )
			continue;

		Vector vecForward, vecRight, vecUp;
		pNewEffect->SetControlPoint( i, GetControlPointAtCurrentTime( i ) );
		GetControlPointOrientationAtCurrentTime( i, &vecForward, &vecRight, &vecUp );
		pNewEffect->SetControlPointOrientation( i, vecForward, vecRight, vecUp );
		pNewEffect->SetControlPointParent( i, GetControlPointParent( i ) );
	}

	if ( !m_hOwner )
		return pNewEffect.GetObject();

	m_hOwner->ParticleProp()->ReplaceParticleEffect( this, pNewEffect.GetObject() );
	return pNewEffect.GetObject();
}
开发者ID:KyleGospo,项目名称:City-17-Episode-One-Source-2013,代码行数:32,代码来源:particles_new.cpp

示例2: PerformNewCustomEffects

static void PerformNewCustomEffects( const Vector &vecOrigin, trace_t &tr, const Vector &shotDir, int iMaterial, int iScale, int nFlags )
{
    bool bNoFlecks = !r_drawflecks.GetBool();
    if ( !bNoFlecks )
    {
        bNoFlecks = ( ( nFlags & FLAGS_CUSTIOM_EFFECTS_NOFLECKS ) != 0  );
    }

    // Compute the impact effect name
    const ImpactEffect_t &effect = s_pImpactEffect[ iMaterial - 'A' ];
    const char *pImpactName = effect.m_pName;
    if ( bNoFlecks && effect.m_pNameNoFlecks )
    {
        pImpactName = effect.m_pNameNoFlecks;
    }
    if ( !pImpactName )
        return;

    CSmartPtr<CNewParticleEffect> pEffect = CNewParticleEffect::Create( NULL, pImpactName );
    if ( !pEffect->IsValid() )
        return;

    Vector	vecReflect;
    float	flDot = DotProduct( shotDir, tr.plane.normal );
    VectorMA( shotDir, -2.0f * flDot, tr.plane.normal, vecReflect );

    Vector vecShotBackward;
    VectorMultiply( shotDir, -1.0f, vecShotBackward );

    Vector vecImpactPoint = ( tr.fraction != 1.0f ) ? tr.endpos : vecOrigin;
    // Other games round m_vOrigin to nearest integer, so I guess we can afford skipping this check.
#ifdef HL2_CLIENT_DLL
    Assert( VectorsAreEqual( vecOrigin, tr.endpos, 1e-1 ) );
#endif
    SetImpactControlPoint( pEffect.GetObject(), 0, vecImpactPoint, tr.plane.normal, tr.m_pEnt );
    SetImpactControlPoint( pEffect.GetObject(), 1, vecImpactPoint, vecReflect,		tr.m_pEnt );
    SetImpactControlPoint( pEffect.GetObject(), 2, vecImpactPoint, vecShotBackward,	tr.m_pEnt );
    pEffect->SetControlPoint( 3, Vector( iScale, iScale, iScale ) );
    if ( pEffect->m_pDef->ReadsControlPoint( 4 ) )
    {
        Vector vecColor;
        GetColorForSurface( &tr, &vecColor );
        pEffect->SetControlPoint( 4, vecColor );
    }
}
开发者ID:tryzombie501,项目名称:TF2HLCoop,代码行数:45,代码来源:fx_impact.cpp


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