本文整理汇总了C++中CSmartPtr::GetObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPtr::GetObject方法的具体用法?C++ CSmartPtr::GetObject怎么用?C++ CSmartPtr::GetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPtr
的用法示例。
在下文中一共展示了CSmartPtr::GetObject方法的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();
}
示例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 );
}
}