本文整理汇总了C++中CBaseEntity::GetRenderOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::GetRenderOrigin方法的具体用法?C++ CBaseEntity::GetRenderOrigin怎么用?C++ CBaseEntity::GetRenderOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::GetRenderOrigin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRenderBounds
void GetRenderBounds( Vector& mins, Vector& maxs )
{
BaseClass::GetRenderBounds( mins, maxs );
// add to the bounds, don't clear them.
// ClearBounds( mins, maxs );
AddPointToBounds( vec3_origin, mins, maxs );
AddPointToBounds( m_targetPosition, mins, maxs );
AddPointToBounds( m_worldPosition, mins, maxs );
CBaseEntity *pEntity = GetBeamEntity();
if ( pEntity )
{
mins -= pEntity->GetRenderOrigin();
maxs -= pEntity->GetRenderOrigin();
}
}
示例2: UpdateCallout
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFFreezePanel::UpdateCallout( void )
{
CTFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( !pPlayer )
return;
// Abort early if we have no gibs or ragdoll
CUtlVector<EHANDLE> *pGibList = pPlayer->GetSpawnedGibs();
IRagdoll *pRagdoll = pPlayer->GetRepresentativeRagdoll();
if ( (!pGibList || pGibList->Count() == 0) && !pRagdoll )
return;
if ( m_pFreezePanelBG == NULL )
return;
// Precalc the vectors of the freezepanel & statpanel
int iX, iY;
m_pFreezePanelBG->GetPos( iX, iY );
Vector vecFreezeTL( iX, iY, 0 );
Vector vecFreezeBR( iX + m_pFreezePanelBG->GetWide(), iY + m_pFreezePanelBG->GetTall(), 1 );
CUtlVector<Vector> vecCalloutsTL;
CUtlVector<Vector> vecCalloutsBR;
Vector vecStatTL(0,0,0);
Vector vecStatBR(0,0,1);
CTFStatPanel *pStatPanel = GET_HUDELEMENT( CTFStatPanel );
if ( pStatPanel && pStatPanel->IsVisible() )
{
pStatPanel->GetPos( iX, iY );
vecStatTL.x = iX;
vecStatTL.y = iY;
vecStatBR.x = vecStatTL.x + pStatPanel->GetWide();
vecStatBR.y = vecStatTL.y + pStatPanel->GetTall();
}
Vector vMins, vMaxs;
// Check gibs
if ( pGibList && pGibList->Count() )
{
int iCount = 0;
for ( int i = 0; i < pGibList->Count(); i++ )
{
CBaseEntity *pGib = pGibList->Element(i);
if ( pGib )
{
Vector origin = pGib->GetRenderOrigin();
IPhysicsObject *pPhysicsObject = pGib->VPhysicsGetObject();
if( pPhysicsObject )
{
Vector vecMassCenter = pPhysicsObject->GetMassCenterLocalSpace();
pGib->CollisionProp()->CollisionToWorldSpace( vecMassCenter, &origin );
}
pGib->GetRenderBounds( vMins, vMaxs );
// Try and add the callout
CTFFreezePanelCallout *pCallout = TestAndAddCallout( origin, vMins, vMaxs, &vecCalloutsTL, &vecCalloutsBR,
vecFreezeTL, vecFreezeBR, vecStatTL, vecStatBR, &iX, &iY );
if ( pCallout )
{
pCallout->UpdateForGib( i, iCount );
iCount++;
}
}
}
}
else if ( pRagdoll )
{
Vector origin = pRagdoll->GetRagdollOrigin();
pRagdoll->GetRagdollBounds( vMins, vMaxs );
// Try and add the callout
CTFFreezePanelCallout *pCallout = TestAndAddCallout( origin, vMins, vMaxs, &vecCalloutsTL, &vecCalloutsBR,
vecFreezeTL, vecFreezeBR, vecStatTL, vecStatBR, &iX, &iY );
if ( pCallout )
{
pCallout->UpdateForRagdoll();
}
// even if the callout failed, check that our ragdoll is onscreen and our killer is taunting us (for an achievement)
if ( GetVectorInScreenSpace( origin, iX, iY ) )
{
C_TFPlayer *pKiller = ToTFPlayer( UTIL_PlayerByIndex( GetSpectatorTarget() ) );
if ( pKiller && pKiller->m_Shared.InCond( TF_COND_TAUNTING ) )
{
// tell the server our ragdoll just got taunted during our freezecam
char cmd[256];
int iPlayerID = pPlayer->GetUserID();
unsigned short mask = UTIL_GetAchievementEventMask();
Q_snprintf( cmd, sizeof( cmd ), "freezecam_taunt %d %d", GetSpectatorTarget() ^ mask, ( iPlayerID ^ GetSpectatorTarget() ) ^ mask );
engine->ClientCmd_Unrestricted( cmd );
}
}
}
}
示例3: GetRandomPointsOnControllingObjectHitBox
//.........这里部分代码省略.........
ray.Init( vecTryWorldPosition, vecTryWorldPosition );
enginetrace->ClipRayToEntity( ray, MASK_ALL, pMoveParent, &tr );
if ( tr.startsolid )
flPointGoodness += 1000.; // got a point inside!
}
if ( flPointGoodness > flBestPointGoodness )
{
u = flTryU;
v = flTryV;
w = flTryW;
vecWorldPosition = vecTryWorldPosition;
nHitbox = nTryHitbox;
flBestPointGoodness = flPointGoodness;
}
} while ( nTryCnt-- );
*( pPntsOut++ ) = vecWorldPosition;
if ( pHitBoxRelativeCoordOut )
( pHitBoxRelativeCoordOut++ )->Init( u, v, w );
if ( pHitBoxIndexOut )
*( pHitBoxIndexOut++ ) = nHitbox;
}
}
}
}
}
if ( pMoveParent->IsBrushModel() )
{
Vector vecMin;
Vector vecMax;
matrix3x4_t matOrientation;
Vector VecOrigin;
pMoveParent->GetRenderBounds( vecMin, vecMax );
VecOrigin = pMoveParent->GetRenderOrigin();
matOrientation = pMoveParent->EntityToWorldTransform();
Vector vecWorldPosition;
float u = 0, v = 0, w = 0;
int nHitbox = 0;
int nNumIters = nNumTrysToGetAPointInsideTheModel;
if (! vecDirectionalBias.IsZero( 0.0001 ) )
nNumIters = max( nNumIters, 5 );
for( int i=0 ; i < nNumPtsOut; i++)
{
int nTryCnt = nNumIters;
float flBestPointGoodness = -1.0e20;
do
{
float flTryU = pParticles->RandomFloat( flRandMin, flRandMax );
float flTryV = pParticles->RandomFloat( flRandMin, flRandMax );
float flTryW = pParticles->RandomFloat( flRandMin, flRandMax );
Vector vecLocalPosition;
vecLocalPosition.x = GetSurfaceCoord( flTryU, vecMin.x, vecMax.x );
vecLocalPosition.y = GetSurfaceCoord( flTryV, vecMin.y, vecMax.y );
vecLocalPosition.z = GetSurfaceCoord( flTryW, vecMin.z, vecMax.z );
Vector vecTryWorldPosition;
VectorTransform( vecLocalPosition, matOrientation, vecTryWorldPosition );
float flPointGoodness = pParticles->RandomFloat( 0, 72 )
+ DotProduct( vecTryWorldPosition - vecBasePos,
vecDirectionalBias );