本文整理汇总了C++中CameraController::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ CameraController::Update方法的具体用法?C++ CameraController::Update怎么用?C++ CameraController::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CameraController
的用法示例。
在下文中一共展示了CameraController::Update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void ModelViewer::Update( float deltaT )
{
ScopedTimer _prof(L"Update State");
m_pCameraController->Update(deltaT);
m_ViewProjMatrix = m_Camera.GetViewProjMatrix();
float costheta = cosf(m_SunOrientation);
float sintheta = sinf(m_SunOrientation);
float cosphi = cosf(m_SunInclination * 3.14159f * 0.5f);
float sinphi = sinf(m_SunInclination * 3.14159f * 0.5f);
m_SunDirection = Normalize(Vector3( costheta * cosphi, sinphi, sintheta * cosphi ));
if (MotionBlur::TemporalAA)
{
// 2x super sampling with no feedback
float SampleOffsets[2][2] =
{
{ -0.25f, -0.25f },
{ 0.25f, 0.25f },
};
const float* Offset = SampleOffsets[Graphics::GetFrameCount() % 2];
m_MainViewport.TopLeftX = Offset[0];
m_MainViewport.TopLeftY = Offset[1];
}
else
{
m_MainViewport.TopLeftX = 0.0f;
m_MainViewport.TopLeftY = 0.0f;
}
m_MainViewport.Width = (float)g_SceneColorBuffer.GetWidth();
m_MainViewport.Height = (float)g_SceneColorBuffer.GetHeight();
m_MainViewport.MinDepth = 0.0f;
m_MainViewport.MaxDepth = 1.0f;
m_MainScissor.left = 0;
m_MainScissor.top = 0;
m_MainScissor.right = (LONG)g_SceneColorBuffer.GetWidth();
m_MainScissor.bottom = (LONG)g_SceneColorBuffer.GetHeight();
}
示例2: Update
void ModelViewer::Update( float deltaT )
{
ScopedTimer _prof(L"Update State");
if (GameInput::IsFirstPressed(GameInput::kLShoulder))
DebugZoom.Decrement();
else if (GameInput::IsFirstPressed(GameInput::kRShoulder))
DebugZoom.Increment();
m_pCameraController->Update(deltaT);
m_ViewProjMatrix = m_Camera.GetViewProjMatrix();
float costheta = cosf(m_SunOrientation);
float sintheta = sinf(m_SunOrientation);
float cosphi = cosf(m_SunInclination * 3.14159f * 0.5f);
float sinphi = sinf(m_SunInclination * 3.14159f * 0.5f);
m_SunDirection = Normalize(Vector3( costheta * cosphi, sinphi, sintheta * cosphi ));
// We use viewport offsets to jitter our color samples from frame to frame (with TAA.)
// D3D has a design quirk with fractional offsets such that the implicit scissor
// region of a viewport is floor(TopLeftXY) and floor(TopLeftXY + WidthHeight), so
// having a negative fractional top left, e.g. (-0.25, -0.25) would also shift the
// BottomRight corner up by a whole integer. One solution is to pad your viewport
// dimensions with an extra pixel. My solution is to only use positive fractional offsets,
// but that means that the average sample position is +0.5, which I use when I disable
// temporal AA.
if (TemporalAA::Enable)
{
uint64_t FrameIndex = Graphics::GetFrameCount();
#if 1
// 2x super sampling with no feedback
float SampleOffsets[2][2] =
{
{ 0.25f, 0.25f },
{ 0.75f, 0.75f },
};
const float* Offset = SampleOffsets[FrameIndex & 1];
#else
// 4x super sampling via controlled feedback
float SampleOffsets[4][2] =
{
{ 0.125f, 0.625f },
{ 0.375f, 0.125f },
{ 0.875f, 0.375f },
{ 0.625f, 0.875f }
};
const float* Offset = SampleOffsets[FrameIndex & 3];
#endif
m_MainViewport.TopLeftX = Offset[0];
m_MainViewport.TopLeftY = Offset[1];
}
else
{
m_MainViewport.TopLeftX = 0.5f;
m_MainViewport.TopLeftY = 0.5f;
}
m_MainViewport.Width = (float)g_SceneColorBuffer.GetWidth();
m_MainViewport.Height = (float)g_SceneColorBuffer.GetHeight();
m_MainViewport.MinDepth = 0.0f;
m_MainViewport.MaxDepth = 1.0f;
m_MainScissor.left = 0;
m_MainScissor.top = 0;
m_MainScissor.right = (LONG)g_SceneColorBuffer.GetWidth();
m_MainScissor.bottom = (LONG)g_SceneColorBuffer.GetHeight();
}