當前位置: 首頁>>代碼示例>>C++>>正文


C++ FUNCTION_PROFILER函數代碼示例

本文整理匯總了C++中FUNCTION_PROFILER函數的典型用法代碼示例。如果您正苦於以下問題:C++ FUNCTION_PROFILER函數的具體用法?C++ FUNCTION_PROFILER怎麽用?C++ FUNCTION_PROFILER使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FUNCTION_PROFILER函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: FUNCTION_PROFILER

void CPlayerStateSwim_WaterTestProxy::RayTestBottomLevel( const CPlayer& player, const Vec3& referencePosition, float maxRelevantDepth )
{
	FUNCTION_PROFILER(gEnv->pSystem, PROFILE_GAME);

	const float terrainWorldZ = gEnv->p3DEngine->GetTerrainElevation(referencePosition.x, referencePosition.y);

	int rayFlags = geom_colltype_player<<rwi_colltype_bit | rwi_stop_at_pierceable;
	int entityFlags = ent_terrain|ent_static|ent_sleeping_rigid|ent_rigid;
	const float padding = 0.2f;
	// NOTE: Terrain is above m_referencePos, so m_referencePos is probably inside a voxel or something.
	const float fPosWorldDiff = referencePosition.z - terrainWorldZ;
	float rayLength = (float)__fsel(fPosWorldDiff, min(maxRelevantDepth, fPosWorldDiff), maxRelevantDepth) + (padding * 2.0f);

	//We should not have entered this function if still waiting for the last result
	CRY_ASSERT(m_bottomLevelRayID == 0); 

	m_bottomLevelRayID = g_pGame->GetRayCaster().Queue(
		player.IsClient() ? RayCastRequest::HighPriority : RayCastRequest::MediumPriority,
		RayCastRequest(referencePosition + Vec3(0,0,padding), Vec3(0,0,-rayLength),
		entityFlags,
		rayFlags,
		0,
		0),
		functor(*this, &CPlayerStateSwim_WaterTestProxy::OnRayCastBottomLevelDataReceived));
}
開發者ID:aronarts,項目名稱:FireNET,代碼行數:25,代碼來源:PlayerStateSwim_WaterTestProxy.cpp

示例2: FUNCTION_PROFILER

/*static*/ void CHUDEventDispatcher::CallEvent( const SHUDEvent& event )
{
#if !defined(DEDICATED_SERVER)
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);
	CRY_ASSERT_MESSAGE(s_safe, "HUD: Can't send HUDEvent whilst initialising the HUD! i.e. from CHUDObject() or CHUDObject::Init()!" );
	if( s_safe )
	{
		s_stlSafe = false;
		THUDEventListeners& listeners = s_eventVec[event.eventType];
		THUDEventListeners::const_iterator it = listeners.begin();
		THUDEventListeners::const_iterator end = listeners.end();
		for(; it!=end; ++it)
		{
			IHUDEventListener* listener = *it;
			SOFTCODE_RETRY(listener, listener->OnHUDEvent(event));
		}
		s_stlSafe = true;
	}
	else
	{
		// HUD Event Sending is now unsafe and should not be done!
		// If you want to send HUD Events on initialization then use OnHUDLoadDone.
		return;
	}
#endif
}
開發者ID:PiratesAhoy,項目名稱:HeartsOfOak-Core,代碼行數:26,代碼來源:HUDEventDispatcher.cpp

示例3: FUNCTION_PROFILER

//------------------------------------------------------------------------
void CGameRules::ClientHit(const HitInfo &hitInfo)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
	IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(hitInfo.targetId);
	
	if(pActor == pClientActor)
		if (gEnv->pInput) gEnv->pInput->ForceFeedbackEvent( SFFOutputEvent(eDI_XI, eFF_Rumble_Basic, 0.5f * hitInfo.damage * 0.01f, hitInfo.damage * 0.02f, 0.0f));

	CreateScriptHitInfo(m_scriptHitInfo, hitInfo);
	CallScript(m_clientStateScript, "OnHit", m_scriptHitInfo);

	bool backface = hitInfo.dir.Dot(hitInfo.normal)>0;
	if (!hitInfo.remote && hitInfo.targetId && !backface)
	{
		if (!gEnv->bServer)
		{
			GetGameObject()->InvokeRMI(SvRequestHit(), hitInfo, eRMI_ToServer);
		}
		else
		{
			ServerHit(hitInfo);
		}

		if(gEnv->IsClient())
			ProcessLocalHit(hitInfo);
	}
}
開發者ID:jjiezheng,項目名稱:oohh,代碼行數:30,代碼來源:GameRulesClientServer.cpp

示例4: FUNCTION_PROFILER

//------------------------------------------------------------------------
void CVehicleDamagesGroup::Update(float frameTime)
{
  FUNCTION_PROFILER( gEnv->pSystem, PROFILE_ACTION );
  
	TDelayedDamagesSubGroupList::iterator ite = m_delayedSubGroups.begin();
	TDelayedDamagesSubGroupList::iterator next;
  for (; ite != m_delayedSubGroups.end(); ite = next)
	{
		next = ite; ++next;

		SDelayedDamagesSubGroupInfo& delayedInfo = *ite;
		delayedInfo.delay -= frameTime;

		if (delayedInfo.delay <= 0.0f)
		{
			TDamagesSubGroupId id = delayedInfo.subGroupId;
			SDamagesSubGroup* pSubGroup = &m_damageSubGroups[id];
			delayedInfo.behaviorParams.randomness = pSubGroup->m_randomness;
			TVehicleDamageBehaviorVector& damageBehaviors =  pSubGroup->m_damageBehaviors;

			for (TVehicleDamageBehaviorVector::iterator behaviorIte = damageBehaviors.begin(); behaviorIte != damageBehaviors.end(); ++behaviorIte)
			{
				IVehicleDamageBehavior* pBehavior = *behaviorIte;
				pBehavior->OnDamageEvent(eVDBE_ComponentDestroyed, delayedInfo.behaviorParams);
			}

      m_delayedSubGroups.erase(ite);
		}        
	}

  if (!m_delayedSubGroups.empty())
    m_pVehicle->NeedsUpdate();
}
開發者ID:aronarts,項目名稱:FireNET,代碼行數:34,代碼來源:VehicleDamagesGroup.cpp

示例5: FUNCTION_PROFILER

void CGameQueryListener::GetCurrentServers(char*** pastrServers, int &o_amount)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_NETWORK);
	if(m_servers.size() == 0)
	{
		o_amount = 0;
		return;
	}
	o_amount = m_servers.size();

	if(o_amount > m_iServers)// || o_amount < 0.1f*m_iServers)
	{
		for(int iServer=0; iServer<m_iServers; iServer++)
		{
			delete [] m_astrServers[iServer];
		}
		m_iServers = std::max(o_amount, int(120));
		for(int iServer=0; iServer<m_iServers; iServer++)
		{
			m_astrServers[iServer] = new char[256];
		}
	}

	//servers = new char*[m_servers.size()];
	*pastrServers = m_astrServers;

	std::vector<SGameServer>::iterator it = m_servers.begin();
	for(int s = 0; it != m_servers.end(); ++it, ++s)		//copy server address to return-vector
	{
		strcpy(m_astrServers[s],(*it).m_target.c_str());
	}
}
開發者ID:NightOwlsEntertainment,項目名稱:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代碼行數:32,代碼來源:GameQueryListener.cpp

示例6: FUNCTION_PROFILER

//------------------------------------------------------------------------
void CProjectile::Update(SEntityUpdateContext &ctx, int updateSlot)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	if (updateSlot!=0)
		return;

	float color[4] = {1,1,1,1};
	bool bDebug = g_pGameCVars->i_debug_projectiles > 0;

	if(bDebug)
		gEnv->pRenderer->Draw2dLabel(50,15,2.0f,color,false,"Projectile: %s",GetEntity()->GetClass()->GetName());

	Vec3 pos = GetEntity()->GetWorldPos();

	ScaledEffect(m_pAmmoParams->pScaledEffect);

	// update whiz
	if(m_pAmmoParams->pWhiz)
	{
		if (m_whizSoundId == INVALID_SOUNDID)
		{
			IActor *pActor = g_pGame->GetIGameFramework()->GetClientActor();
			if (pActor && (m_ownerId != pActor->GetEntityId()))
			{
				float probability = 0.85f;

				if (Random()<=probability)
				{
					Lineseg line(m_last, pos);
					Vec3 player = pActor->GetEntity()->GetWorldPos();

					float t;
					float distanceSq=Distance::Point_LinesegSq(player, line, t);

					if (distanceSq < 4.7f*4.7f && (t>=0.0f && t<=1.0f))
					{
						if (distanceSq >= 0.65*0.65)
						{
							Sphere s;
							s.center = player;
							s.radius = 4.7f;

							Vec3 entry,exit;
							int intersect=Intersect::Lineseg_Sphere(line, s, entry,exit);
							if (intersect==0x1 || intersect==0x3) // one entry or one entry and one exit
								WhizSound(true, entry, (pos-m_last).GetNormalized());
						}
					}
				}
			}
		}
	}

	if (m_trailSoundId==INVALID_SOUNDID)
		TrailSound(true);

	m_totalLifetime += ctx.fFrameTime;
	m_last = pos;
}
開發者ID:mrwonko,項目名稱:CrysisVR,代碼行數:61,代碼來源:Projectile.cpp

示例7: FUNCTION_PROFILER

void CG15LCD::Update(float frameTime)
{
	FUNCTION_PROFILER(GetISystem(),PROFILE_GAME);
	if (g_pGameCVars->cl_g15lcdEnable == 0)
		return;

	m_tick -= frameTime;
	if (m_tick < 0)
	{
		if (g_pGameCVars->cl_g15lcdTick > 0)
			m_tick = g_pGameCVars->cl_g15lcdTick/1000.0f;
		else
			m_tick = 0;

		if (IsConnected() && m_currentPage != -1)
		{
			if(m_currentPage > 1 && !g_pGame->GetIGameFramework()->IsGameStarted())
				m_currentPage = 0;
			else if(m_currentPage == 0 && g_pGame->GetIGameFramework()->IsGameStarted())
				m_currentPage = 2;

			if (m_pages[m_currentPage]->PreUpdate())
			{
				m_pages[m_currentPage]->Update(frameTime);
				m_pImpl->ShowPage(m_currentPage);
			}
		}
		m_pImpl->Update();
	}
}
開發者ID:MrHankey,項目名稱:destructionderby,代碼行數:30,代碼來源:LCDWrapper.cpp

示例8: FUNCTION_PROFILER

//------------------------------------------------------------------------
void CItem::InitGeometry()
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	//skip loading the first person geometry for now, it may never be used
	m_sharedparams->LoadGeometryForItem(this, eIGS_FirstPerson);
}
開發者ID:Xydrel,項目名稱:Infected,代碼行數:8,代碼來源:ItemParams.cpp

示例9: FUNCTION_PROFILER

void CTagBullet::HandleEvent(const SGameObjectEvent &event)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	CProjectile::HandleEvent(event);

	if (event.event == eGFE_OnCollision)
	{
		if (m_destroying)
			return;

		EventPhysCollision *pCollision = reinterpret_cast<EventPhysCollision *>(event.ptr);
		if (!pCollision)
			return;

		IEntity *pTarget = pCollision->iForeignData[1]==PHYS_FOREIGN_ID_ENTITY ? (IEntity*)pCollision->pForeignData[1]:0;
		if (pTarget)
		{
			EntityId targetId = pTarget->GetId();

			CHUD *pHUD = g_pGame->GetHUD();
			pHUD->AddToRadar(targetId);

			SimpleHitInfo info(m_ownerId, targetId, m_weaponId, 0); // 0=tag,1=tac
			info.remote=IsRemote();

			g_pGame->GetGameRules()->ClientSimpleHit(info);
		}

		Destroy();
	}
}
開發者ID:wang1986one,項目名稱:remod,代碼行數:32,代碼來源:TagBullet.cpp

示例10: FUNCTION_PROFILER

bool CVisibleObjectsHelper::CheckObjectViewDist(const Agent& agent, const SVisibleObject &visibleObject) const
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	assert(agent.IsValid());

	bool bInViewDist = true;

	IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
	assert(pEntitySystem);

	IEntity *pAIEntity = pEntitySystem->GetEntity(agent.GetEntityID());
	IEntity *pObjectEntity = pEntitySystem->GetEntity(visibleObject.entityId);

	IComponentRender *pObjectRenderProxy = (pAIEntity != NULL && pObjectEntity ? static_cast<IComponentRender *>(pObjectEntity->GetComponent<IComponentRender>().get()) : NULL);
	if (pObjectRenderProxy != NULL)
	{
		IRenderNode *pObjectRenderNode = pObjectRenderProxy->GetRenderNode();
		if (pObjectRenderNode != NULL)
		{
			const float fDistanceSq = pAIEntity->GetWorldPos().GetSquaredDistance(pObjectEntity->GetWorldPos());
			const float fMaxViewDistSq = sqr(pObjectRenderNode->GetMaxViewDist());
			
			bInViewDist = (fDistanceSq <= fMaxViewDistSq);
		}
	}

	return bInViewDist;
}
開發者ID:danielasun,項目名稱:dbho-GameSDK,代碼行數:29,代碼來源:VisibleObjectsHelper.cpp

示例11: FUNCTION_PROFILER

void CMFXForceFeedbackEffect::Execute(SMFXRunTimeEffectParams& params)
{
	FUNCTION_PROFILER(gEnv->pSystem, PROFILE_ACTION);

	if (params.playflags & MFX_PLAY_FORCEFEEDBACK)
	{
		float distanceToPlayerSqr = FLT_MAX;
		IActor *pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
		if (pClientActor)
		{
			distanceToPlayerSqr = (pClientActor->GetEntity()->GetWorldPos() - params.pos).GetLengthSquared();
		}

		const float testDistanceSqr = clamp_tpl(distanceToPlayerSqr, m_forceFeedbackParams.intensityFallOffMinDistanceSqr, m_forceFeedbackParams.intensityFallOffMaxDistanceSqr);
		const float minMaxDiffSqr = m_forceFeedbackParams.intensityFallOffMaxDistanceSqr - m_forceFeedbackParams.intensityFallOffMinDistanceSqr;
		
		float effectIntensity = (float)__fsel(-minMaxDiffSqr, 0.0f, 1.0f - (testDistanceSqr - m_forceFeedbackParams.intensityFallOffMinDistanceSqr) / (minMaxDiffSqr + FLT_EPSILON));
		effectIntensity *= effectIntensity;
		if (effectIntensity > 0.01f)
		{
			IForceFeedbackSystem* pForceFeedback = CCryAction::GetCryAction()->GetIForceFeedbackSystem();
			assert(pForceFeedback);
			ForceFeedbackFxId fxId = pForceFeedback->GetEffectIdByName(m_forceFeedbackParams.forceFeedbackEventName.c_str());
			pForceFeedback->PlayForceFeedbackEffect(fxId, SForceFeedbackRuntimeParams(effectIntensity, 0.0f));
		}
	}

}
開發者ID:aronarts,項目名稱:FireNET,代碼行數:28,代碼來源:MFXForceFeedbackFX.cpp

示例12: FUNCTION_PROFILER

bool CEntityPoolSignature::CalculateFromEntity(CEntity *pEntity)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_ENTITY);
	LOADING_TIME_PROFILE_SECTION(GetISystem());

	assert(pEntity);

	if (!m_bGenerated && pEntity)
	{
		m_bGenerated = true;

		ISerialize *pWriter = m_pSignatureSerializer->GetWriter(m_Signature);
		TSerialize signatureWriter(pWriter);

		m_bGenerated &= pEntity->GetSignature(signatureWriter);

		if (!m_bGenerated)
		{
			m_Signature->removeAllChilds();
			m_Signature->removeAllAttributes();
		}
	}

	return m_bGenerated;
}
開發者ID:aronarts,項目名稱:FireNET,代碼行數:25,代碼來源:EntityPoolSignature.cpp

示例13: FUNCTION_PROFILER

bool CMPTutorial::CheckVehicles(const CPlayer* pPlayer)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	bool showPrompt = false;
	if(!pPlayer)
		return showPrompt;

	IVehicle* pVehicle = pPlayer->GetLinkedVehicle();

	if(m_wasInVehicle && !pVehicle)
	{
		// got out of vehicle. Move HUD box back to normal place.
		SAFE_HUD_FUNC(SetTutorialTextPosition(2));
		m_wasInVehicle = false;
		return showPrompt;
	}
 
 	if(pVehicle && !m_wasInVehicle)
 	{
		// just got in. Move HUD box up so it doesn't overlap vehicle hud.
		SAFE_HUD_FUNC(SetTutorialTextPosition(1));

		m_wasInVehicle = true;

		// generic 'boarding a vehicle' message
		TriggerEvent(eTE_BoardVehicle);
	}

	return showPrompt;
}
開發者ID:RenEvo,項目名稱:dead6,代碼行數:31,代碼來源:MPTutorial.cpp

示例14: FUNCTION_PROFILER

//------------------------------------------------------------------------
void CRapid::UpdateFiring(CActor* pOwnerActor, bool ownerIsClient, bool ownerIsPlayer, float frameTime)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_AI);

	if (m_speed >= 0.00001f)
	{			
		const uint32 decelAndRapid = eRapidFlag_decelerating|eRapidFlag_rapidFiring;

		if ((m_speed >= m_fireParams->rapidparams.min_speed) && !(m_rapidFlags & decelAndRapid))
		{
			m_rapidFlags |= eRapidFlag_rapidFiring;

			uint32 flags = CItem::eIPAF_Default;
			float speedOverride = -1.0f;
			PlayRapidFire(speedOverride, (flags & CItem::eIPAF_ConcentratedFire) != 0);		
		}
		else if ((m_speed < m_fireParams->rapidparams.min_speed) && ((m_rapidFlags & decelAndRapid) ==  decelAndRapid))
		{
			m_rapidFlags &= ~eRapidFlag_rapidFiring;
		}
	}

	if(ownerIsClient && gEnv->bMultiplayer)
	{
		CRY_ASSERT(pOwnerActor);

		const CTimeValue currentTime = gEnv->pTimer->GetFrameStartTime();
		const float startFiringSeconds = m_startFiringTime.GetSeconds();
		const float secondsFiring = gEnv->pTimer->GetAsyncTime().GetSeconds() - startFiringSeconds;
		if(startFiringSeconds != 0.0f && secondsFiring > 3.0f)
		{
			NET_BATTLECHATTER(BC_Battlecry, static_cast<CPlayer*>(pOwnerActor));
		}
	}
}
開發者ID:Kufusonic,項目名稱:Work-in-Progress-Sonic-Fangame,代碼行數:36,代碼來源:Rapid.cpp

示例15: FUNCTION_PROFILER

//------------------------------------------------------------------------
void CGameRules::ClientHit(const HitInfo &hitInfo)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
	IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(hitInfo.targetId);
	
	if(pActor == pClientActor)
		if (gEnv->pInput) gEnv->pInput->ForceFeedbackEvent( SFFOutputEvent(eDI_XI, eFF_Rumble_Basic, 0.5f * hitInfo.damage * 0.01f, hitInfo.damage * 0.02f, 0.0f));

	//m_pScript->CallMethod( "OnHit", gEnv->pMonoScriptSystem->GetConverter()->ToManagedType(eCMT_HitInfo, &const_cast<HitInfo &>(hitInfo)));

	bool backface = hitInfo.dir.Dot(hitInfo.normal)>0;
	if (!hitInfo.remote && hitInfo.targetId && !backface)
	{
		if (!gEnv->bServer)
		{
			GetGameObject()->InvokeRMI(SvRequestHit(), hitInfo, eRMI_ToServer);
		}
		else
		{
			ServerHit(hitInfo);
		}

		if(gEnv->IsClient())
			ProcessLocalHit(hitInfo);
	}
}
開發者ID:nhnam,項目名稱:Seasons,代碼行數:29,代碼來源:GameRulesClientServer.cpp


注:本文中的FUNCTION_PROFILER函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。