当前位置: 首页>>代码示例>>C++>>正文


C++ IView::SetFrameAdditiveCameraAngles方法代码示例

本文整理汇总了C++中IView::SetFrameAdditiveCameraAngles方法的典型用法代码示例。如果您正苦于以下问题:C++ IView::SetFrameAdditiveCameraAngles方法的具体用法?C++ IView::SetFrameAdditiveCameraAngles怎么用?C++ IView::SetFrameAdditiveCameraAngles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IView的用法示例。


在下文中一共展示了IView::SetFrameAdditiveCameraAngles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateAdditiveCameraInput

void CCinematicInput::UpdateAdditiveCameraInput( IScriptSystem* pScriptSystem, float frameTime )
{
	CCinematicInput::SUpdateContext updateCtx;

	pScriptSystem->GetGlobalValue("Cinematic_CameraLookUp", updateCtx.m_lookUpLimit);
	pScriptSystem->GetGlobalValue("Cinematic_CameraLookDown", updateCtx.m_lookDownLimit);
	pScriptSystem->GetGlobalValue("Cinematic_CameraLookLeft", updateCtx.m_lookLeftLimit);
	pScriptSystem->GetGlobalValue("Cinematic_CameraLookRight", updateCtx.m_lookRightLimit);
	float recenterCamera = 0.0f;
	pScriptSystem->GetGlobalValue("Cinematic_CameraDoNotCenter", recenterCamera);

	updateCtx.m_lookUpLimit = DEG2RAD(updateCtx.m_lookUpLimit);
	updateCtx.m_lookDownLimit = DEG2RAD(updateCtx.m_lookDownLimit);
	updateCtx.m_lookLeftLimit = DEG2RAD(updateCtx.m_lookLeftLimit);
	updateCtx.m_lookRightLimit = DEG2RAD(updateCtx.m_lookRightLimit);
	updateCtx.m_recenter = (recenterCamera < 0.01f);

	updateCtx.m_frameTime = frameTime;

	CActor* pClientActor = static_cast<CActor*>(g_pGame->GetIGameFramework()->GetClientActor());
	if (pClientActor)
	{
		CRY_ASSERT(pClientActor->GetActorClass() == CPlayer::GetActorClassType());
		CPlayer* pClientPlayer = static_cast<CPlayer*>(pClientActor);

		IPlayerInput* pIPlayerInput = pClientPlayer->GetPlayerInput();
		if(pIPlayerInput && pIPlayerInput->GetType() == IPlayerInput::PLAYER_INPUT)
		{
			CPlayerInput * pPlayerInput = static_cast<CPlayerInput*>(pIPlayerInput);

			Ang3 frameAccumulatedAngles(0.0f, 0.0f, 0.0f);

#if CINEMATIC_INPUT_PC_MOUSE
			const bool isAimingWithMouse = pPlayerInput->IsAimingWithMouse();

			RefreshInputMethod(isAimingWithMouse);

			if (isAimingWithMouse)
			{
				frameAccumulatedAngles = UpdateAdditiveCameraInputWithMouse(updateCtx, pPlayerInput->GetRawMouseInput());
			}
			else
			{
				frameAccumulatedAngles = UpdateAdditiveCameraInputWithController(updateCtx, pPlayerInput->GetRawControllerInput());
			}
#else
			frameAccumulatedAngles = UpdateAdditiveCameraInputWithController(updateCtx, pPlayerInput->GetRawControllerInput());
#endif

			IView* pActiveView = g_pGame->GetIGameFramework()->GetIViewSystem()->GetActiveView();
			if (pActiveView)
			{
				pActiveView->SetFrameAdditiveCameraAngles(frameAccumulatedAngles);
			}
		}
	}
}
开发者ID:danielasun,项目名称:dbho-GameSDK,代码行数:57,代码来源:CinematicInput.cpp

示例2: UpdateAdditiveCameraInput

void CCinematicInput::UpdateAdditiveCameraInput(IScriptSystem *pScriptSystem, float frameTime)
{
	float lookUpLimit = 0.0f, lookDownLimit = 0.0f;
	float lookLeftLimit = 0.0f, lookRightLimit = 0.0f;

	pScriptSystem->GetGlobalValue("Cinematic_CameraLookUp", lookUpLimit);
	pScriptSystem->GetGlobalValue("Cinematic_CameraLookDown", lookDownLimit);
	pScriptSystem->GetGlobalValue("Cinematic_CameraLookLeft", lookLeftLimit);
	pScriptSystem->GetGlobalValue("Cinematic_CameraLookRight", lookRightLimit);

	lookUpLimit = DEG2RAD(lookUpLimit);
	lookDownLimit = DEG2RAD(lookDownLimit);
	lookLeftLimit = DEG2RAD(lookLeftLimit);
	lookRightLimit = DEG2RAD(lookRightLimit);

	CActor *pClientActor = static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor());

	if(pClientActor)
	{
		CRY_ASSERT(pClientActor->GetActorClass() == CPlayer::GetActorClassType());
		CPlayer *pClientPlayer = static_cast<CPlayer *>(pClientActor);

		IPlayerInput *pIPlayerInput = pClientPlayer->GetPlayerInput();

		if(pIPlayerInput && pIPlayerInput->GetType() == IPlayerInput::PLAYER_INPUT)
		{
			CPlayerInput *pPlayerInput = static_cast<CPlayerInput *>(pIPlayerInput);

			Ang3 rawMouseInput = pPlayerInput->GetRawMouseInput() * 0.25f;
			rawMouseInput.z = - rawMouseInput.z;
			rawMouseInput.x *= (g_pGameCVars->cl_invertMouse == 0) ? 1.0f : -1.0f;

			Ang3 rawControllerInput = pPlayerInput->GetRawControllerInput() + rawMouseInput;
			//Yaw angle (Z axis)
			rawControllerInput.z = -clamp((float)__fsel(rawControllerInput.z, rawControllerInput.z * lookRightLimit, rawControllerInput.z * lookLeftLimit), -lookLeftLimit, lookRightLimit);
			//Pitch angle (X axis)
			rawControllerInput.x *= (g_pGameCVars->cl_invertController == 0) ? 1.0f : -1.0f;
			rawControllerInput.x = clamp((float)__fsel(rawControllerInput.x, rawControllerInput.x * lookUpLimit, rawControllerInput.x * lookDownLimit), -lookDownLimit, lookUpLimit);
			//No roll allowed
			rawControllerInput.y = 0.0f;

			Interpolate(m_currentRawInputAngles, rawControllerInput, 2.5f, frameTime);

			IView *pActiveView = g_pGame->GetIGameFramework()->GetIViewSystem()->GetActiveView();

			if(pActiveView)
			{
				pActiveView->SetFrameAdditiveCameraAngles(m_currentRawInputAngles);
			}
		}
	}
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:52,代码来源:CinematicInput.cpp


注:本文中的IView::SetFrameAdditiveCameraAngles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。