本文整理汇总了C++中CGUIShaderDX::SetWVP方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIShaderDX::SetWVP方法的具体用法?C++ CGUIShaderDX::SetWVP怎么用?C++ CGUIShaderDX::SetWVP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIShaderDX
的用法示例。
在下文中一共展示了CGUIShaderDX::SetWVP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void COverlayQuadsDX::Render(SRenderState &state)
{
if (m_count == 0)
return;
ID3D11Buffer* vertexBuffer = m_vertex.Get();
if (vertexBuffer == nullptr)
return;
ID3D11DeviceContext* pContext = DX::DeviceResources::Get()->GetD3DContext();
CGUIShaderDX* pGUIShader = DX::Windowing()->GetGUIShader();
XMMATRIX world, view, proj;
pGUIShader->GetWVP(world, view, proj);
if (CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_SPLIT_HORIZONTAL
|| CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_SPLIT_VERTICAL)
{
CRect rect;
DX::Windowing()->GetViewPort(rect);
DX::Windowing()->SetCameraPosition(CPoint(rect.Width() * 0.5f, rect.Height() * 0.5f),
static_cast<int>(rect.Width()),
static_cast<int>(rect.Height()));
}
XMMATRIX trans = XMMatrixTranslation(state.x, state.y, 0.0f);
XMMATRIX scale = XMMatrixScaling(state.width, state.height, 1.0f);
pGUIShader->SetWorld(XMMatrixMultiply(XMMatrixMultiply(world, scale), trans));
const unsigned stride = sizeof(Vertex);
const unsigned offset = 0;
// Set the vertex buffer to active in the input assembler so it can be rendered.
pContext->IASetVertexBuffers(0, 1, &vertexBuffer, &stride, &offset);
// Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
DX::Windowing()->SetAlphaBlendEnable(true);
pGUIShader->Begin(SHADER_METHOD_RENDER_FONT);
pGUIShader->SetShaderViews(1, m_texture.GetAddressOfSRV());
pGUIShader->Draw(m_count * 6, 0);
// restoring transformation
pGUIShader->SetWVP(world, view, proj);
pGUIShader->RestoreBuffers();
}