本文整理汇总了C++中CSmartPtr::SetControlPointOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPtr::SetControlPointOrientation方法的具体用法?C++ CSmartPtr::SetControlPointOrientation怎么用?C++ CSmartPtr::SetControlPointOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPtr
的用法示例。
在下文中一共展示了CSmartPtr::SetControlPointOrientation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParticleEffectCallback
//======================================================================================================================
// PARTICLE SYSTEM DISPATCH EFFECT
//======================================================================================================================
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ParticleEffectCallback( const CEffectData &data )
{
if ( SuppressingParticleEffects() )
return; // this needs to be before using data.m_nHitBox, since that may be a serialized value that's past the end of the current particle system string table
const char *pszName = GetParticleSystemNameFromIndex( data.m_nHitBox );
if ( data.m_fFlags & PARTICLE_DISPATCH_FROM_ENTITY )
{
if ( data.m_hEntity.Get() )
{
C_BaseEntity *pEnt = C_BaseEntity::Instance( data.m_hEntity );
if ( pEnt && !pEnt->IsDormant() )
{
if ( data.m_fFlags & PARTICLE_DISPATCH_RESET_PARTICLES )
{
pEnt->ParticleProp()->StopEmission();
}
CSmartPtr<CNewParticleEffect> pEffect = pEnt->ParticleProp()->Create( pszName, (ParticleAttachment_t)data.m_nDamageType, data.m_nAttachmentIndex );
AssertMsg2( pEffect.IsValid() && pEffect->IsValid(), "%s could not create particle effect %s",
C_BaseEntity::Instance( data.m_hEntity )->GetDebugName(), pszName );
if ( pEffect.IsValid() && pEffect->IsValid() )
{
if ( (ParticleAttachment_t)data.m_nDamageType == PATTACH_CUSTOMORIGIN )
{
pEffect->SetSortOrigin( data.m_vOrigin );
pEffect->SetControlPoint( 0, data.m_vOrigin );
pEffect->SetControlPoint( 1, data.m_vStart );
Vector vecForward, vecRight, vecUp;
AngleVectors( data.m_vAngles, &vecForward, &vecRight, &vecUp );
pEffect->SetControlPointOrientation( 0, vecForward, vecRight, vecUp );
}
}
}
}
}
else
{
CSmartPtr<CNewParticleEffect> pEffect = CNewParticleEffect::Create( NULL, pszName );
if ( pEffect->IsValid() )
{
pEffect->SetSortOrigin( data.m_vOrigin );
pEffect->SetControlPoint( 0, data.m_vOrigin );
pEffect->SetControlPoint( 1, data.m_vStart );
Vector vecForward, vecRight, vecUp;
AngleVectors( data.m_vAngles, &vecForward, &vecRight, &vecUp );
pEffect->SetControlPointOrientation( 0, vecForward, vecRight, vecUp );
}
}
}
示例2: 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();
}