本文整理汇总了C++中Mat4x4::CreateRollPitchYaw方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4x4::CreateRollPitchYaw方法的具体用法?C++ Mat4x4::CreateRollPitchYaw怎么用?C++ Mat4x4::CreateRollPitchYaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4x4
的用法示例。
在下文中一共展示了Mat4x4::CreateRollPitchYaw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VGenerateVelocityMap
///////////////////////////////////////////////
//Motion Blur
///////////////////////////////////////////////
AVOID DeferredRenderer::VGenerateVelocityMap(CameraPtr pCamera, Renderer* pRenderer, const Mat4x4 & viewproj)
{
//set screen-aligned quad
m_pVertices->Set(0, 0);
//set shaders
m_pVelocityMapShaders->VBind();
//set shader resources
m_gbuffer.BindPositionTex(0, ST_Pixel);
//set render target
m_pVelocityRTV->Set();
//set constant buffers
//bind matrix constant buffer to the pipeline
Mat4x4 trans;
//trans.CreateTranslation(pCamera->GetLookAt() + 10000 * pCamera->GetDir());
trans.CreateTranslation(pCamera->GetPosition() + 500* pCamera->GetDir());
Mat4x4 rot;
rot = rot.CreateRollPitchYaw(pCamera->GetRoll(), pCamera->GetPitch(), pCamera->GetYaw());
Mat4x4 WVP = rot * trans * pCamera->GetView() * CreateOrthoProjectionLH(SCREEN_WIDTH, SCREEN_HEIGHT, 1.0f, 1000.0f);
WVP.Transpose();
m_pMatrixBuffer->UpdateSubresource(0, NULL, &WVP, 0, 0);
m_pMatrixBuffer->Set(0, ST_Vertex);
//set previous frame view-projection transform
Mat4x4 currViewProj = viewproj;
Mat4x4 prevViewProj = pCamera->GetPrevView() * pCamera->GetPrevProjection();
//prevViewProj = pCamera->GetView() * pCamera->GetProjection();
//prevViewProj = pCamera->GetProjection();
currViewProj.Transpose();
prevViewProj.Transpose();
//m_pcbPrevViewProj->UpdateSubresource(0, NULL, &prevViewProj, 0, 0);
//m_pcbPrevViewProj->Set(0, ST_Pixel);
struct TwoMatrices
{
Mat4x4 prevViewProj;
Mat4x4 currViewProj;
};
TwoMatrices temp;
temp.prevViewProj =prevViewProj;
temp.currViewProj = currViewProj;
m_pcbWorldPlusWVP->UpdateSubresource(0, nullptr, &temp, 0, 0);
m_pcbWorldPlusWVP->Set(0, ST_Pixel);
//Finally render velocity map
Draw(6, 0);
//unbind views
UnbindShaderResourceViews(0, 1, ST_Pixel);
UnbindRenderTargetViews(1);
}
示例2: CalculateAmbientOcclusion
///////////////////////////////////////////////
//Ambient occlusion
///////////////////////////////////////////////
AVOID DeferredRenderer::CalculateAmbientOcclusion(CameraPtr pCamera)
{
m_pSSAOShaders->VBind();
m_pVertices->Set(0, 0);
//bind matrix constant buffer to the pipeline
Mat4x4 trans;
trans.CreateTranslation(pCamera->GetLookAt());
Mat4x4 rot;
rot = rot.CreateRollPitchYaw(pCamera->GetRoll(), pCamera->GetPitch(), pCamera->GetYaw());
Mat4x4 WVP = rot * trans * pCamera->GetView() * CreateOrthoProjectionLH(SCREEN_WIDTH, SCREEN_HEIGHT, 0.1f, 1000.0f);
WVP.Transpose();
m_pMatrixBuffer->UpdateSubresource(0, NULL, &WVP, 0, 0);
m_pMatrixBuffer->Set(0, ST_Vertex);
//camera params
Vec cameraParams = Vector(pCamera->GetFrustum().GetNearWidth(), pCamera->GetFrustum().GetNearHeight(), 0.0f, 0.0f);
m_pcbFrustumSize->UpdateSubresource(0, NULL, &cameraParams, 0, 0);
m_pcbFrustumSize->Set(0, ST_Pixel);
//depth buffer params
Vec depthBufferParams = Vector(1.0f / SCREEN_WIDTH, 1.0f / SCREEN_HEIGHT, 0.0f, 0.0f);
m_pcbDepthBuffer->UpdateSubresource(0, NULL, &depthBufferParams, 0, 0);
m_pcbDepthBuffer->Set(1, ST_Pixel);
//camera view matrix
Mat4x4 View = pCamera->GetView();
View.Transpose();
m_pcbView->UpdateSubresource(0, NULL, &View, 0, 0);
m_pcbView->Set(2, ST_Pixel);
//send SSAO params
//Vec ssaoParams = Vector(20.0f, 2.0f, 5.0f, 2.0f);
//m_pcbSSAOParams->UpdateSubresource(0, NULL, &ssaoParams, 0, 0);
//m_pcbSSAOParams->Set(2, ST_Pixel);
m_pDepthDisableStencilDisable->Set(0);
//m_pDepthSRV->Set(0, ST_Pixel);
m_gbuffer.m_SRVList.SetView(2, 0, ST_Pixel);
m_gbuffer.m_SRVList.SetView(5, 1, ST_Pixel);
m_pSSAORTV->Set();
//set sampler states
//AnisotropySampler16()->Set(0, ST_Pixel);
PointClampSampler()->Set(0, ST_Pixel);
D3D11DeviceContext()->Draw(6, 0);
//Unbind render target view
UnbindRenderTargetViews(1);
//m_pSSAOSRV->Set(5, ST_Pixel);
UnbindShaderResourceViews(0, 2, ST_Pixel);
GetRenderTargetView()->Set();
}
示例3: GetLookAt
Vec Camera::GetLookAt() const
{
Mat4x4 rot;
rot = rot.CreateRollPitchYaw(m_roll, m_pitch, m_yaw);
Vec lookAt;
lookAt = m_pos + m_dir * rot;
return lookAt;
}
示例4: PrepareForLightPass
AVOID DeferredRenderer::PrepareForLightPass(CameraPtr pCamera)
{
//set vertex buffer with positions
m_pVertices->Set(0, 0);
//set vertex buffer with texture data
m_pTexCoords->Set(1, 0);
//bind matrix constant buffer to the pipeline
Mat4x4 trans;
//trans.CreateTranslation(pCamera->GetLookAt() + 10000 * pCamera->GetDir());
trans.CreateTranslation(pCamera->GetPosition() + 500* pCamera->GetDir());
Mat4x4 rot;
rot = rot.CreateRollPitchYaw(pCamera->GetRoll(), pCamera->GetPitch(), pCamera->GetYaw());
Mat4x4 WVP = rot * trans * pCamera->GetView() * CreateOrthoProjectionLH(SCREEN_WIDTH, SCREEN_HEIGHT, 1.0f, 1000.0f);
WVP.Transpose();
m_pMatrixBuffer->UpdateSubresource(0, NULL, &WVP, 0, 0);
m_pMatrixBuffer->Set(0, ST_Vertex);
struct CameraBuffer
{
Mat4x4 inverseViewProjection;
Vec pos;
};
CameraBuffer cameraBuffer;
Mat4x4 inverseViewProjection = pCamera->GetViewProjection();
inverseViewProjection.Inverse();
cameraBuffer.pos = pCamera->GetPosition();
cameraBuffer.inverseViewProjection = inverseViewProjection;
cameraBuffer.inverseViewProjection.Transpose();
m_pcbCameraPos->UpdateSubresource(0, nullptr, &pCamera->GetPosition(), 0, 0);
//m_pcbCameraPos->UpdateSubresource(0, NULL, &cameraBuffer, 0, 0);
m_pcbCameraPos->Set(0, ST_Pixel);
//pCamera->SetViewport();
SetGlobalViewport();
//set shader resources
m_pSSAOBlurredSRV->Set(6, ST_Pixel);
m_pDepthSRV->Set(8, ST_Pixel);
//set blending functionality
//this->BlendLightPass()->Set(nullptr);
}
示例5: UpdateTransforms
AVOID Camera::UpdateTransforms()
{
//m_roll = m_pitch = m_yaw = 0;
//m_yaw = 0.05f;
Mat4x4 rot;
rot = rot.CreateRollPitchYaw(m_roll, m_pitch, m_yaw);
//calculate point camera is focusing
m_dir = m_initialDir * rot;
m_dir = Normalize(m_dir);
m_lookAt = m_pos + m_dir;
//before calculating new view and proj matrices, update
//previous values
m_prevView = m_view;
m_prevProjection = m_projection;
//calculate view and projection matrices
m_view = CreateViewMatrixLH(m_pos, m_dir, m_up);
m_projection = CreatePerspectiveProjectionLH( m_frustum.GetFOV(), m_frustum.GetAspectRatio(),
m_frustum.GetNearZ(), m_frustum.GetFarZ() );
}