本文整理汇总了C++中VPROF_BUDGET函数的典型用法代码示例。如果您正苦于以下问题:C++ VPROF_BUDGET函数的具体用法?C++ VPROF_BUDGET怎么用?C++ VPROF_BUDGET使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VPROF_BUDGET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImpactHelicopterCallback
//-----------------------------------------------------------------------------
// Purpose: Handle weapon impacts from the helicopter shooting (cheaper versions)
//-----------------------------------------------------------------------------
void ImpactHelicopterCallback( const CEffectData &data )
{
VPROF_BUDGET( "ImpactHelicopterCallback", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
trace_t tr;
Vector vecOrigin, vecStart, vecShotDir;
int iMaterial, iDamageType, iHitbox;
short nSurfaceProp;
C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox );
if ( !pEntity )
{
// This happens for impacts that occur on an object that's then destroyed.
// Clear out the fraction so it uses the server's data
tr.fraction = 1.0;
PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp );
return;
}
// If we hit, perform our custom effects and play the sound. Don't create decals
if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr, IMPACT_NODECAL | IMPACT_REPORT_RAGDOLL_IMPACTS ) )
{
FX_AirboatGunImpact( vecOrigin, tr.plane.normal, IsXbox() ? 1 : 2 );
// Only do metal + computer custom effects
if ( (iMaterial == CHAR_TEX_METAL) || (iMaterial == CHAR_TEX_COMPUTER) )
{
PerformCustomEffects( vecOrigin, tr, vecShotDir, iMaterial, 1.0, FLAGS_CUSTIOM_EFFECTS_NOFLECKS );
}
}
PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp );
}
示例2: ImpactAirboatGunCallback
//-----------------------------------------------------------------------------
// Purpose: Handle weapon impacts from the airboat gun shooting (cheaper versions)
//-----------------------------------------------------------------------------
void ImpactAirboatGunCallback( const CEffectData &data )
{
VPROF_BUDGET( "ImpactAirboatGunCallback", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
trace_t tr;
Vector vecOrigin, vecStart, vecShotDir;
int iMaterial, iDamageType, iHitbox;
short nSurfaceProp;
C_BaseEntity *pEntity = ParseImpactData( data, &vecOrigin, &vecStart, &vecShotDir, nSurfaceProp, iMaterial, iDamageType, iHitbox );
if ( !pEntity )
{
// This happens for impacts that occur on an object that's then destroyed.
// Clear out the fraction so it uses the server's data
tr.fraction = 1.0;
PlayImpactSound( pEntity, tr, vecOrigin, nSurfaceProp );
return;
}
#if !defined( _XBOX )
// If we hit, perform our custom effects and play the sound. Don't create decals
if ( Impact( vecOrigin, vecStart, iMaterial, iDamageType, iHitbox, pEntity, tr, IMPACT_NODECAL | IMPACT_REPORT_RAGDOLL_IMPACTS ) )
{
FX_AirboatGunImpact( vecOrigin, tr.plane.normal, 2 );
}
#else
FX_AirboatGunImpact( vecOrigin, tr.plane.normal, 1 );
#endif
}
示例3: VPROF_BUDGET
//===============================================================================
// Actualiza la ubicación de la luz
//===============================================================================
void CBaseFlashlightEffect::Update( const Vector &vecPos, const Vector &vecForward, const Vector &vecRight, const Vector &vecUp )
{
VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
// No esta encendida
if ( !IsOn() )
return;
FlashlightState_t state;
if ( UpdateDefaultFlashlightState( state, vecPos, vecForward, vecRight, vecUp ) == false )
return;
UpdateLightProjection( state );
#ifndef NO_TOOLFRAMEWORK
if ( clienttools->IsInRecordingMode() )
{
KeyValues *msg = new KeyValues( "FlashlightState" );
msg->SetFloat( "time", gpGlobals->curtime );
msg->SetInt( "entindex", m_iEntIndex );
msg->SetInt( "flashlightHandle", m_nFlashlightHandle );
msg->SetPtr( "flashlightState", &state );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
#endif
}
示例4: FX_MetalScrape
void FX_MetalScrape(Vector &position, Vector &normal)
{
VPROF_BUDGET("FX_MetalScrape", VPROF_BUDGETGROUP_PARTICLE_RENDERING);
Vector offset = position + (normal * 1.0f);
CSmartPtr<CTrailParticles> sparkEmitter = CTrailParticles::Create("FX_MetalScrape 1");
if (!sparkEmitter)
return;
sparkEmitter->SetSortOrigin(offset);
//Setup our collision information
sparkEmitter->Setup(offset,
&normal,
METAL_SCRAPE_SPREAD,
METAL_SCRAPE_MINSPEED,
METAL_SCRAPE_MAXSPEED,
METAL_SCRAPE_GRAVITY,
METAL_SCRAPE_DAMPEN,
bitsPARTICLE_TRAIL_VELOCITY_DAMPEN);
int numSparks = random->RandomInt(4, 8);
if (g_Material_Spark == NULL)
{
g_Material_Spark = sparkEmitter->GetPMaterial("effects/spark");
}
Vector dir;
TrailParticle *pParticle;
float length = 0.06f;
//Dump out sparks
for (int i = 0; i < numSparks; i++)
{
pParticle = (TrailParticle *) sparkEmitter->AddParticle(sizeof(TrailParticle), g_Material_Spark, offset);
if (pParticle == NULL)
return;
pParticle->m_flLifetime = 0.0f;
float spreadOfs = random->RandomFloat(0.0f, 2.0f);
dir[0] = normal[0] + random->RandomFloat(-(METAL_SCRAPE_SPREAD*spreadOfs), (METAL_SCRAPE_SPREAD*spreadOfs));
dir[1] = normal[1] + random->RandomFloat(-(METAL_SCRAPE_SPREAD*spreadOfs), (METAL_SCRAPE_SPREAD*spreadOfs));
dir[2] = normal[2] + random->RandomFloat(-(METAL_SCRAPE_SPREAD*spreadOfs), (METAL_SCRAPE_SPREAD*spreadOfs));
pParticle->m_flWidth = random->RandomFloat(2.0f, 5.0f);
pParticle->m_flLength = random->RandomFloat(length*0.25f, length);
pParticle->m_flDieTime = random->RandomFloat(2.0f, 2.0f);
pParticle->m_vecVelocity = dir * random->RandomFloat((METAL_SCRAPE_MINSPEED*(2.0f - spreadOfs)), (METAL_SCRAPE_MAXSPEED*(2.0f - spreadOfs)));
Color32Init(pParticle->m_color, 255, 255, 255, 255);
}
}
示例5: VPROF_BUDGET
ActionResult<CTFBot> CTFBotPayloadGuard::OnResume(CTFBot *actor, Action<CTFBot> *action)
{
VPROF_BUDGET("CTFBotPayloadGuard::OnResume", "NextBot");
// Invalidate CT @ 0x4828
// Invalidate CT @ 0x4810
return ActionResult<CTFBot>::Continue();
}
示例6: VPROF_BUDGET
ActionResult<CTFBot> CTFBotCapturePoint::OnStart(CTFBot *actor, Action<CTFBot> *action)
{
VPROF_BUDGET("CTFBotCapturePoint::OnStart", "NextBot");
this->m_PathFollower.SetMinLookAheadDistance(actor->GetDesiredPathLookAheadRange());
this->m_PathFollower.Invalidate();
return ActionResult<CTFBot>::Continue();
}
示例7: VPROF_BUDGET
int CParticleEffectBinding::DrawModel( int flags )
{
VPROF_BUDGET( "CParticleEffectBinding::DrawModel", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
#ifndef PARTICLEPROTOTYPE_APP
if ( !r_DrawParticles.GetInt() )
return 0;
#endif
Assert( flags != 0 );
// If we're in commander mode and it's trying to draw the effect,
// exit out. If the effect has FLAGS_ALWAYSSIMULATE set, then it'll come back
// in here and simulate at the end of the frame.
if( !g_pClientMode->ShouldDrawParticles() )
return 0;
SetDrawn( true );
// Don't do anything if there are no particles.
if( !m_nActiveParticles )
return 1;
// Reset the transformation matrix to identity.
VMatrix mTempModel, mTempView;
RenderStart( mTempModel, mTempView );
// Setup to redo our bbox?
bool bBucketSort = random->RandomInt( 0, BUCKET_SORT_EVERY_N ) == 0;
// Set frametime to zero if we've already rendered this frame.
float flFrameTime = 0;
if ( m_FrameCode != m_pParticleMgr->m_FrameCode )
{
m_FrameCode = m_pParticleMgr->m_FrameCode;
flFrameTime = Helper_GetFrameTime();
}
// For each material, render...
// This does an incremental bubble sort. It only does one pass every frame, and it will shuffle
// unsorted particles one step towards where they should be.
bool bWireframe = false;
FOR_EACH_LL( m_Materials, iMaterial )
{
CEffectMaterial *pMaterial = m_Materials[iMaterial];
if ( pMaterial->m_pGroup->m_pPageMaterial && pMaterial->m_pGroup->m_pPageMaterial->NeedsPowerOfTwoFrameBufferTexture() )
{
UpdateRefractTexture();
}
DrawMaterialParticles(
bBucketSort,
pMaterial,
flFrameTime,
bWireframe );
}
示例8: VPROF_BUDGET
void ChasePath::RefreshPath(INextBot *nextbot, CBaseEntity *ent, const IPathCost& cost_func, Vector *vec)
{
VPROF_BUDGET("ChasePath::RefreshPath", "NextBot");
if (this->IsValid() && nextbot->GetLocomotionInterface()->IsUsingLadder()) {
if (nextbot->IsDebugging(DEBUG_PATH)) {
DevMsg("%3.2f: bot(#%d) ChasePath::RefreshPath failed. Bot is on a ladder.\n",
gpGlobals->curtime, ENTINDEX(nextbot->GetEntity()));
}
this->m_ctTimer2.Start(1.0f);
return;
}
if (ent == nullptr) {
if (nextbot->IsDebugging(DEBUG_PATH)) {
/* misspelling is in original */
DevMsg("%3.2f: bot(#%d) CasePath::RefreshPath failed. No subject.\n",
gpGlobals->curtime, ENTINDEX(nextbot->GetEntity()));
}
}
if (this->m_ctTimer1.IsElapsed()) {
CBaseEntity *subject = this->m_hChaseSubject();
if (subject == nullptr || subject != ent) {
if (nextbot->IsDebugging(DEBUG_PATH)) {
DevMsg("%3.2f: bot(#%d) ChasePath::RefreshPath subject changed (from %p to %p).\n",
gpGlobals->curtime, ENTINDEX(nextbot->GetEntity()),
this->m_hChaseSubject(), ent);
}
this->Invalidate();
this->m_ctTimer1.Invalidate();
}
if (!this->IsValid() || this->m_ctTimer2.IsElapsed()) {
if (this->IsValid() && this->m_ctTimer3.HasStarted() &&
this->m_ctTimer3.IsElapsed()) {
this->Invalidate();
}
if (!this->IsValid() || this->IsRepathNeeded(nextbot, ent)) {
// TODO
// eventually: this->Compute(...)
}
// TODO
}
// TODO
}
}
示例9: FX_Dust
//-----------------------------------------------------------------------------
// Spew out dust!
//-----------------------------------------------------------------------------
void FX_Dust( const Vector &vecOrigin, const Vector &vecDirection, float flSize, float flSpeed )
{
VPROF_BUDGET( "FX_Dust", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
int numPuffs = (flSize*0.5f);
if ( numPuffs < 1 )
numPuffs = 1;
if ( numPuffs > 32 )
numPuffs = 32;
float speed = flSpeed * 0.1f;
if ( speed < 0 )
speed = 1.0f;
if (speed > 48.0f )
speed = 48.0f;
//FIXME: Better sampling area
Vector offset = vecOrigin + ( vecDirection * flSize );
//Find area ambient light color and use it to tint smoke
Vector worldLight = WorldGetLightForPoint( offset, true );
// Throw puffs
SimpleParticle particle;
for ( int i = 0; i < numPuffs; i++ )
{
offset.Random( -(flSize*0.25f), flSize*0.25f );
offset += vecOrigin + ( vecDirection * flSize );
particle.m_Pos = offset;
particle.m_flLifetime = 0.0f;
particle.m_flDieTime = random->RandomFloat( 0.4f, 1.0f );
particle.m_vecVelocity = vecDirection * random->RandomFloat( speed*0.5f, speed ) * i;
particle.m_vecVelocity[2] = 0.0f;
int color = random->RandomInt( 48, 64 );
particle.m_uchColor[0] = (color+16) + ( worldLight[0] * (float) color );
particle.m_uchColor[1] = (color+8) + ( worldLight[1] * (float) color );
particle.m_uchColor[2] = color + ( worldLight[2] * (float) color );
particle.m_uchStartAlpha= random->RandomInt( 64, 128 );
particle.m_uchEndAlpha = 0;
particle.m_uchStartSize = random->RandomInt( 2, 8 );
particle.m_uchEndSize = random->RandomInt( 24, 48 );
particle.m_flRoll = random->RandomInt( 0, 360 );
particle.m_flRollDelta = random->RandomFloat( -0.5f, 0.5f );
AddSimpleParticle( &particle, g_Mat_DustPuff[random->RandomInt(0,1)] );
}
}
示例10: VPROF_BUDGET
void IVision::Update()
{
VPROF_BUDGET("IVision::Update", "NextBotExpensive");
if (nb_blind.GetBool()) {
this->m_KnownEntities.RemoveAll();
} else {
this->UpdateKnownEntities();
this->m_flLastUpdate = gpGlobals->curtime;
}
}
示例11: VPROF_BUDGET
//-----------------------------------------------------------------------------
// Purpose: Do the headlight
//-----------------------------------------------------------------------------
void CFlashlightEffect::UpdateLight( int nEntIdx, const Vector &vecPos, const Vector &vecForward, const Vector &vecRight,
const Vector &vecUp, float flFov, float flFarZ, float flLinearAtten, bool castsShadows, const char* pTextureName )
{
VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
m_nEntIndex = nEntIdx;
m_flFov = flFov;
m_flFarZ = flFarZ;
m_flLinearAtten = flLinearAtten;
if ( m_bCastsShadows != castsShadows )
{
// requires recreation of the flashlight
LightOff();
}
m_bCastsShadows = castsShadows;
UpdateFlashlightTexture( pTextureName );
FlashlightState_t state;
if ( UpdateDefaultFlashlightState( state, vecPos, vecForward, vecRight, vecUp, castsShadows ) == false )
{
return;
}
if( m_FlashlightHandle == CLIENTSHADOW_INVALID_HANDLE )
{
m_FlashlightHandle = g_pClientShadowMgr->CreateFlashlight( state );
}
else
{
if( !r_flashlightlockposition.GetBool() )
{
g_pClientShadowMgr->UpdateFlashlightState( m_FlashlightHandle, state );
}
}
g_pClientShadowMgr->UpdateProjectedTexture( m_FlashlightHandle, true );
#ifndef NO_TOOLFRAMEWORK
if ( clienttools->IsInRecordingMode() )
{
KeyValues *msg = new KeyValues( "FlashlightState" );
msg->SetFloat( "time", gpGlobals->curtime );
msg->SetInt( "entindex", m_nEntIndex );
msg->SetInt( "flashlightHandle", m_FlashlightHandle );
msg->SetPtr( "flashlightState", &state );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
#endif
}
示例12: RestoreEntityTo
static void RestoreEntityTo( CBaseEntity *pEntity, const Vector &vWantedPos )
{
int nMask = pEntity->IsPlayer() ? MASK_PLAYERSOLID : MASK_NPCSOLID;
int nCollisionGroup = pEntity->IsPlayer() ? COLLISION_GROUP_PLAYER_MOVEMENT : COLLISION_GROUP_NPC;
// Try to move to the wanted position from our current position.
trace_t tr;
VPROF_BUDGET( "RestorePlayerTo", "CTFLagCompensationManager" );
UTIL_TraceEntity( pEntity, vWantedPos, vWantedPos, nMask, pEntity, nCollisionGroup, &tr );
if ( tr.startsolid || tr.allsolid )
{
if ( sv_unlag_debug.GetBool() )
{
CBasePlayer *pPlayer = ToBasePlayer( pEntity );
if ( pPlayer )
{
DevMsg( "RestorePlayerTo() could not restore player position for client \"%s\" ( %.1f %.1f %.1f )\n",
pPlayer->GetPlayerName(), vWantedPos.x, vWantedPos.y, vWantedPos.z );
}
else
{
DevMsg( "RestoreEntityTo() could not restore entity position for %s ( %.1f %.1f %.1f )\n",
pEntity->GetClassname(), vWantedPos.x, vWantedPos.y, vWantedPos.z );
}
}
UTIL_TraceEntity( pEntity, pEntity->GetLocalOrigin(), vWantedPos, nMask, pEntity, nCollisionGroup, &tr );
if ( tr.startsolid || tr.allsolid )
{
// In this case, the guy got stuck back wherever we lag compensated him to. Nasty.
if ( sv_unlag_debug.GetBool() )
DevMsg( " restore failed entirely\n" );
}
else
{
// We can get to a valid place, but not all the way back to where we were.
Vector vPos;
VectorLerp( pEntity->GetLocalOrigin(), vWantedPos, tr.fraction * g_flFractionScale, vPos );
UTIL_SetOrigin( pEntity, vPos, true );
if ( sv_unlag_debug.GetBool() )
DevMsg( " restore got most of the way\n" );
}
}
else
{
// Cool, the player can go back to whence he came.
UTIL_SetOrigin( pEntity, tr.endpos, true );
}
}
示例13: 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 );
}
}
示例14: FX_Smoke
//-----------------------------------------------------------------------------
// Purpose: Smoke puffs
//-----------------------------------------------------------------------------
void FX_Smoke( const Vector &origin, const QAngle &angles, float scale, int numParticles, unsigned char *pColor, int iAlpha )
{
VPROF_BUDGET( "FX_Smoke", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
Vector vecVelocity;
Vector vecForward;
// Smoke
for ( int i = 0; i < numParticles; i++ )
{
// Velocity
AngleVectors( angles, &vecForward );
vecVelocity.Random( -0.5f, 0.5f );
vecVelocity += vecForward;
VectorNormalize( vecVelocity );
vecVelocity *= random->RandomFloat( 16.0f, 32.0f );
vecVelocity[2] += random->RandomFloat( 4.0f, 16.0f );
// Color
unsigned char particlecolor[3];
if ( !pColor )
{
int color = random->RandomInt( 64, 164 );
particlecolor[0] = color;
particlecolor[1] = color;
particlecolor[2] = color;
}
else
{
particlecolor[0] = pColor[0];
particlecolor[1] = pColor[1];
particlecolor[2] = pColor[2];
}
// Alpha
int alpha = iAlpha;
if ( alpha == -1 )
{
alpha = random->RandomInt( 10, 25 );
}
// Scale
int iSize = random->RandomInt( 4, 8 ) * scale;
// Roll
float flRoll = random->RandomInt( 0, 360 );
float flRollDelta = random->RandomFloat( -4.0f, 4.0f );
//pParticle->m_uchEndSize = pParticle->m_uchStartSize*2;
FX_Smoke( origin, vecVelocity, iSize, 1, random->RandomFloat( 0.5f, 1.0f ), particlecolor, alpha, "particle/particle_smokegrenade", flRoll, flRollDelta );
}
}
示例15: VPROF_BUDGET
void CAI_RadialLinkController::ModifyNodeLinks( bool bMakeStale )
{
int nNodes = g_pBigAINet->NumNodes();
CAI_Node **ppNodes = g_pBigAINet->AccessNodes();
VPROF_BUDGET("ModifyLinks", "ModifyLinks");
const float MinDistCareSq = Square( ai_radial_max_link_dist.GetFloat() + 0.1 );
for ( int i = 0; i < nNodes; i++ )
{
CAI_Node *pNode = ppNodes[i];
const Vector &nodeOrigin = pNode->GetOrigin();
if ( m_vecAtRestOrigin.DistToSqr(nodeOrigin) < MinDistCareSq )
{
int nLinks = pNode->NumLinks();
for ( int j = 0; j < nLinks; j++ )
{
CAI_Link *pLink = pNode->GetLinkByIndex( j );
int iLinkDest = pLink->DestNodeID( i );
if ( iLinkDest > i )
{
bool bQualify = true;
if( ( (pLink->m_iAcceptedMoveTypes[HULL_HUMAN]||pLink->m_iAcceptedMoveTypes[HULL_WIDE_HUMAN]) & bits_CAP_MOVE_GROUND) == 0 )
{
// Micro-optimization: Ignore any connection that's not a walking connection for humans.(sjb)
bQualify = false;
}
const Vector &originOther = ppNodes[iLinkDest]->GetOrigin();
if ( bQualify && m_vecAtRestOrigin.DistToSqr(originOther) < MinDistCareSq )
{
if ( IsRayIntersectingSphere(nodeOrigin, originOther - nodeOrigin, m_vecAtRestOrigin, m_flRadius) )
{
if( bMakeStale )
{
pLink->m_LinkInfo |= bits_LINK_STALE_SUGGESTED;
pLink->m_timeStaleExpires = FLT_MAX;
}
else
{
pLink->m_LinkInfo &= ~bits_LINK_STALE_SUGGESTED;
}
}
}
}
}
}
}
}