本文整理汇总了C++中C_BaseAnimating类的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseAnimating类的具体用法?C++ C_BaseAnimating怎么用?C++ C_BaseAnimating使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C_BaseAnimating类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VectorNormalize
CRagdollExplosionEnumerator::~CRagdollExplosionEnumerator()
{
for (int i = 0; i < m_Entities.Count(); i++ )
{
C_BaseEntity *pEnt = m_Entities[i];
C_BaseAnimating *pModel = static_cast< C_BaseAnimating * >( pEnt );
Vector position = pEnt->CollisionProp()->GetCollisionOrigin();
Vector dir = position - m_vecOrigin;
float dist = VectorNormalize( dir );
float force = m_flMagnitude - ( ( m_flMagnitude / m_flRadius ) * dist );
if ( force <= 1.0f )
continue;
trace_t tr;
UTIL_TraceLine( m_vecOrigin, position, MASK_SHOT_HULL, NULL, COLLISION_GROUP_NONE, &tr );
// debugoverlay->AddLineOverlay( m_vecOrigin, position, 0,255,0, true, 18.0 );
if ( tr.fraction < 1.0f && tr.m_pEnt != pModel )
continue;
dir *= force; // scale force
// tricky, adjust tr.start so end-start->= force
tr.startpos = tr.endpos - dir;
// move expolsion center a bit down, so things fly higher
tr.startpos.z -= 32.0f;
pModel->ImpactTrace( &tr, DMG_BLAST, NULL );
}
}
示例2: SetModelName
void C_PortalGhostRenderable::PerFrameUpdate( void )
{
if( m_pGhostedRenderable )
{
SetModelName( m_pGhostedRenderable->GetModelName() );
SetModelIndex( m_pGhostedRenderable->GetModelIndex() );
SetEffects( m_pGhostedRenderable->GetEffects() | EF_NOINTERP );
m_flAnimTime = m_pGhostedRenderable->m_flAnimTime;
if( m_bSourceIsBaseAnimating )
{
C_BaseAnimating *pSource = (C_BaseAnimating *)m_pGhostedRenderable;
SetCycle( pSource->GetCycle() );
SetSequence( pSource->GetSequence() );
m_nBody = pSource->m_nBody;
m_nSkin = pSource->m_nSkin;
}
}
// Set position and angles relative to the object it's ghosting
Vector ptNewOrigin = m_matGhostTransform * m_pGhostedRenderable->GetAbsOrigin();
QAngle qNewAngles = TransformAnglesToWorldSpace( m_pGhostedRenderable->GetAbsAngles(), m_matGhostTransform.As3x4() );
SetAbsOrigin( ptNewOrigin );
SetAbsAngles( qNewAngles );
AddEffects( EF_NOINTERP );
RemoveFromInterpolationList();
g_pClientLeafSystem->RenderableChanged( RenderHandle() );
}
示例3: FX_BuildTeslaHitbox
//-----------------------------------------------------------------------------
// Purpose: Tesla effect
//-----------------------------------------------------------------------------
void FX_BuildTeslaHitbox( const CEffectData &data )
{
Vector vColor( 1, 1, 1 );
C_BaseEntity *pEntity = ClientEntityList().GetEnt( data.entindex() );
C_BaseAnimating *pAnimating = pEntity ? pEntity->GetBaseAnimating() : NULL;
if (!pAnimating)
return;
studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
if (!pStudioHdr)
return;
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet( pAnimating->GetHitboxSet() );
if ( !set )
return;
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
if ( !pAnimating->HitboxToWorldTransforms( hitboxbones ) )
return;
int nBeamCount = (int)(data.m_flMagnitude + 0.5f);
for ( int i = 0; i < nBeamCount; ++i )
{
int nStartHitBox = random->RandomInt( 1, set->numhitboxes );
int nEndHitBox = random->RandomInt( 1, set->numhitboxes );
FX_BuildTeslaHitbox( pEntity, nStartHitBox, nEndHitBox, data.m_flScale, vColor, random->RandomFloat( 0.05f, 0.2f ) );
}
}
示例4: while
void CGlowObjectManager::GlowObjectDefinition_t::DrawModel()
{
C_BaseEntity *pEntity = m_hEntity.Get();
if ( !pEntity )
return;
if ( pEntity->GetMoveParent() != NULL )
{
C_BaseAnimating *pBaseAnimating = pEntity->GetBaseAnimating();
if ( pBaseAnimating )
{
pBaseAnimating->InvalidateBoneCache();
}
}
pEntity->DrawModel( STUDIO_RENDER );
C_BaseEntity *pAttachment = pEntity->FirstMoveChild();
while ( pAttachment != NULL )
{
if ( !g_GlowObjectManager.HasGlowEffect( pAttachment ) && pAttachment->ShouldDraw() )
{
C_BaseAnimating *pBaseAnimating = pAttachment->GetBaseAnimating();
if ( pBaseAnimating )
{
pBaseAnimating->InvalidateBoneCache();
}
pAttachment->DrawModel( STUDIO_RENDER );
}
pAttachment = pAttachment->NextMovePeer();
}
}
示例5: ClientThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_NPC_Puppet::ClientThink( void )
{
if ( m_hAnimationTarget == NULL )
return;
C_BaseAnimating *pTarget = m_hAnimationTarget->GetBaseAnimating();
if ( pTarget == NULL )
return;
int nTargetSequence = pTarget->GetSequence();
const char *pSequenceName = pTarget->GetSequenceName( nTargetSequence );
int nSequence = LookupSequence( pSequenceName );
if ( nSequence >= 0 )
{
if ( nSequence != GetSequence() )
{
SetSequence( nSequence );
UpdateVisibility();
}
SetCycle( pTarget->GetCycle() );
SetPlaybackRate( pTarget->GetPlaybackRate() );
}
}
示例6: ClientEntityList
IterationRetval_t CRagdollEnumerator::EnumElement( IHandleEntity *pHandleEntity )
{
C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( pHandleEntity->GetRefEHandle() );
if ( pEnt == NULL )
return ITERATION_CONTINUE;
C_BaseAnimating *pModel = static_cast< C_BaseAnimating * >( pEnt );
// If the ragdoll was created on this tick, then the forces were already applied on the server
if ( pModel == NULL || WasRagdollCreatedOnCurrentTick( pEnt ) )
return ITERATION_CONTINUE;
IPhysicsObject *pPhysicsObject = pModel->VPhysicsGetObject();
if ( pPhysicsObject == NULL )
return ITERATION_CONTINUE;
trace_t tr;
enginetrace->ClipRayToEntity( m_rayShot, MASK_SHOT, pModel, &tr );
if ( tr.fraction < 1.0 )
{
pModel->ImpactTrace( &tr, m_iDamageType, NULL );
m_bHit = true;
//FIXME: Yes? No?
return ITERATION_STOP;
}
return ITERATION_CONTINUE;
}
示例7: EnumElement
//Actual work code
IterationRetval_t EnumElement( IHandleEntity *pHandleEntity )
{
C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( pHandleEntity->GetRefEHandle() );
if ( pEnt == NULL )
return ITERATION_CONTINUE;
C_BaseAnimating *pModel = static_cast< C_BaseAnimating * >( pEnt );
if ( pModel == NULL )
return ITERATION_CONTINUE;
trace_t tr;
enginetrace->ClipRayToEntity( m_rayShot, MASK_SHOT, pModel, &tr );
IPhysicsObject *pPhysicsObject = pModel->VPhysicsGetObject();
if ( pPhysicsObject == NULL )
return ITERATION_CONTINUE;
if ( tr.fraction < 1.0 )
{
IPhysicsObject *pReference = GetWorldPhysObject();
if ( !pReference || !pPhysicsObject )
return ITERATION_CONTINUE;
constraint_ballsocketparams_t ballsocket;
ballsocket.Defaults();
Vector Origin;
pPhysicsObject->GetPosition( &Origin, NULL );
if ( ( Origin- m_vWorld).Length () < 64 )
{
pReference->WorldToLocal( ballsocket.constraintPosition[0], m_vWorld );
pPhysicsObject->WorldToLocal( ballsocket.constraintPosition[1], Origin );
GetBreakParams( ballsocket.constraint );
ballsocket.constraint.torqueLimit = 0;
m_pConstraint = physenv->CreateBallsocketConstraint( pReference, pPhysicsObject, NULL, ballsocket );
pPhysicsObject->ApplyForceCenter( Vector(0, 0, 1 ) * 100);
return ITERATION_STOP;
}
else
return ITERATION_CONTINUE;
}
return ITERATION_CONTINUE;
}
示例8:
C_BaseAnimating *C_AI_BaseNPC::BecomeRagdollOnClient()
{
C_BaseAnimating *pRagdoll = BaseClass::BecomeRagdollOnClient();
if ( pRagdoll )
{
m_hRagdoll.Set( pRagdoll );
if ( m_bBurningDeath )
pRagdoll->ParticleProp()->Create( "burningplayer_corpse", PATTACH_ABSORIGIN_FOLLOW );
}
return pRagdoll;
}
示例9: BuildTransformations
virtual void BuildTransformations( CStudioHdr *hdr, Vector *pos, Quaternion q[], const matrix3x4_t& cameraTransform, int boneMask, CBoneBitList &boneComputed )
{
VPROF_BUDGET( "C_ServerRagdollAttached::SetupBones", VPROF_BUDGETGROUP_CLIENT_ANIMATION );
if ( !hdr )
return;
float frac = RemapVal( gpGlobals->curtime, m_parentTime, m_parentTime+ATTACH_INTERP_TIME, 0, 1 );
frac = clamp( frac, 0.f, 1.f );
// interpolate offset over some time
Vector offset = m_vecOffset * (1-frac);
C_BaseAnimating *parent = assert_cast< C_BaseAnimating* >( GetMoveParent() );
Vector worldOrigin;
worldOrigin.Init();
if ( parent )
{
Assert( parent != this );
parent->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
matrix3x4_t boneToWorld;
parent->GetCachedBoneMatrix( m_boneIndexAttached, boneToWorld );
VectorTransform( m_attachmentPointBoneSpace, boneToWorld, worldOrigin );
}
BaseClass::BuildTransformations( hdr, pos, q, cameraTransform, boneMask, boneComputed );
if ( parent )
{
int index = m_boneIndex[m_ragdollAttachedObjectIndex];
const matrix3x4_t &matrix = GetBone( index );
Vector ragOrigin;
VectorTransform( m_attachmentPointRagdollSpace, matrix, ragOrigin );
offset = worldOrigin - ragOrigin;
// fixes culling
SetAbsOrigin( worldOrigin );
m_vecOffset = offset;
}
for ( int i = 0; i < hdr->numbones(); i++ )
{
if ( !( hdr->boneFlags( i ) & boneMask ) )
continue;
Vector pos;
matrix3x4_t &matrix = GetBoneForWrite( i );
MatrixGetColumn( matrix, 3, pos );
pos += offset;
MatrixSetColumn( pos, 3, matrix );
}
}
示例10: GetModel
//-----------------------------------------------------------------------------
// Purpose:
// Output : virtual void
//-----------------------------------------------------------------------------
void C_ServerRagdoll::UpdateOnRemove()
{
C_BaseAnimating *anim = m_hUnragdoll.Get();
if ( NULL != anim &&
anim->GetModel() &&
( anim->GetModel() == GetModel() ) )
{
// Need to tell C_BaseAnimating to blend out of the ragdoll data that we received last
C_BaseAnimating::AutoAllowBoneAccess boneaccess( true, false );
anim->CreateUnragdollInfo( this );
}
// Do last to mimic destrictor order
BaseClass::UpdateOnRemove();
}
示例11: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose: Gets the complete list of values needed to render an effect from an
// effect parameter
//-----------------------------------------------------------------------------
void C_WeaponPortalgun::GetEffectParameters( EffectType_t effectID, color32 &color, float &scale, IMaterial **pMaterial, Vector &vecAttachment, bool b3rdPerson )
{
const float dt = gpGlobals->curtime;
// Get alpha
float alpha = m_Parameters[effectID].GetAlpha().Interp( dt );
// Get scale
scale = m_Parameters[effectID].GetScale().Interp( dt );
// Get material
*pMaterial = (IMaterial *) m_Parameters[effectID].GetMaterial();
// Setup the color
color.r = (int) m_Parameters[effectID].GetColor().x;
color.g = (int) m_Parameters[effectID].GetColor().y;
color.b = (int) m_Parameters[effectID].GetColor().z;
color.a = (int) alpha;
// Setup the attachment
int attachment = m_Parameters[effectID].GetAttachment();
QAngle angles;
// Format for first-person
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner != NULL )
{
C_BaseAnimating *pModel;
if ( b3rdPerson )
{
pModel = this;
}
else
{
pModel = pOwner->GetViewModel();
}
pModel->GetAttachment( attachment, vecAttachment, angles );
if ( !b3rdPerson )
{
::FormatViewModelAttachment( vecAttachment, true );
}
}
}
示例12: ClientEntityList
IterationRetval_t CRagdollEnumerator::EnumElement( IHandleEntity *pHandleEntity )
{
C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( pHandleEntity->GetRefEHandle() );
if ( pEnt == NULL )
return ITERATION_CONTINUE;
C_BaseAnimating *pModel = static_cast< C_BaseAnimating * >( pEnt );
if ( pModel == NULL )
return ITERATION_CONTINUE;
trace_t tr;
enginetrace->ClipRayToEntity( m_rayShot, MASK_SHOT, pModel, &tr );
IPhysicsObject *pPhysicsObject = pModel->VPhysicsGetObject();
if ( pPhysicsObject == NULL )
return ITERATION_CONTINUE;
if ( tr.fraction < 1.0 )
{
//Send the ragdoll the explosion force
Vector dir = m_rayShot.m_Delta;
VectorNormalize( dir );
pPhysicsObject->ApplyForceOffset( dir * m_flForce, tr.endpos );
/*
//FIXME: JDW - Can't do this until the decal references are client-side as well
int decalNumber = decalsystem->GetDecalIndexForName( GetImpactDecal( pModel, &tr, m_iDamageType ) );
if ( pModel != NULL )
{
pModel->AddDecal( m_rayShot.m_Start, tr.endpos, tr.endpos, tr.hitbox, decalNumber, true, tr );
}
*/
m_bHit = true;
//FIXME: Yes? No?
return ITERATION_STOP;
}
return ITERATION_CONTINUE;
}
示例13: BuildTransformations
//-----------------------------------------------------------------------------
// Purpose: We need to slam our position!
//-----------------------------------------------------------------------------
void C_NPC_Puppet::BuildTransformations( CStudioHdr *pStudioHdr, Vector *pos, Quaternion q[], const matrix3x4_t& cameraTransform, int boneMask, CBoneBitList &boneComputed )
{
if ( m_hAnimationTarget && m_nTargetAttachment != -1 )
{
C_BaseAnimating *pTarget = m_hAnimationTarget->GetBaseAnimating();
if ( pTarget )
{
matrix3x4_t matTarget;
pTarget->GetAttachment( m_nTargetAttachment, matTarget );
MatrixCopy( matTarget, GetBoneForWrite( 0 ) );
boneComputed.ClearAll(); // FIXME: Why is this calculated already?
boneComputed.MarkBone( 0 );
}
}
// Call the baseclass
BaseClass::BuildTransformations( pStudioHdr, pos, q, cameraTransform, boneMask, boneComputed );
}
示例14: GetMoveParent
//-----------------------------------------------------------------------------
// Purpose:
// Input : fTimeDelta -
//-----------------------------------------------------------------------------
void C_EntityParticleTrail::Update( float fTimeDelta )
{
float tempDelta = fTimeDelta;
studiohdr_t *pStudioHdr;
mstudiohitboxset_t *set;
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
C_BaseEntity *pMoveParent = GetMoveParent();
if ( !pMoveParent )
return;
C_BaseAnimating *pAnimating = pMoveParent->GetBaseAnimating();
if (!pAnimating)
goto trailNoHitboxes;
if ( !pAnimating->HitboxToWorldTransforms( hitboxbones ) )
goto trailNoHitboxes;
pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
if (!pStudioHdr)
goto trailNoHitboxes;
set = pStudioHdr->pHitboxSet( pAnimating->GetHitboxSet() );
if ( !set )
goto trailNoHitboxes;
//Add new particles
while ( m_teParticleSpawn.NextEvent( tempDelta ) )
{
int nHitbox = random->RandomInt( 0, set->numhitboxes - 1 );
mstudiobbox_t *pBox = set->pHitbox(nHitbox);
AddParticle( tempDelta, pBox->bbmin, pBox->bbmax, *hitboxbones[pBox->bone] );
}
return;
trailNoHitboxes:
while ( m_teParticleSpawn.NextEvent( tempDelta ) )
{
AddParticle( tempDelta, pMoveParent->CollisionProp()->OBBMins(), pMoveParent->CollisionProp()->OBBMaxs(), pMoveParent->EntityToWorldTransform() );
}
}
示例15: OnBind
virtual void OnBind( C_BaseEntity *pC_BaseEntity )
{
C_BaseAnimating *pBaseAnimating = pC_BaseEntity ? pC_BaseEntity->GetBaseAnimating() : NULL;
if ( pBaseAnimating )
{
float fCycle = pBaseAnimating->GetCycle();
float f = RemapValClamped( fCycle, m_fStart, m_fEnd, 0.0f, 1.0f );
if ( m_bEaseIn && m_bEaseOut )
{
f = SimpleSpline( f );
}
else if ( m_bEaseIn )
{
f = sin( M_PI * f * 0.5f );
}
else if ( m_bEaseOut )
{
f = 1.0f - sin( M_PI * f * 0.5f + 0.5f * M_PI );
}
MaterialVarType_t resultType;
int vecSize;
ComputeResultType( resultType, vecSize );
switch( resultType )
{
case MATERIAL_VAR_TYPE_VECTOR:
{
Vector4D vec( f, f, f, f );
m_pResult->SetVecValue( vec.Base(), vecSize );
}
break;
case MATERIAL_VAR_TYPE_FLOAT:
case MATERIAL_VAR_TYPE_INT:
default:
m_pResult->SetFloatValue( f );
break;
}
}
}