本文整理汇总了C++中CGUIShaderDX::SetProjection方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIShaderDX::SetProjection方法的具体用法?C++ CGUIShaderDX::SetProjection怎么用?C++ CGUIShaderDX::SetProjection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIShaderDX
的用法示例。
在下文中一共展示了CGUIShaderDX::SetProjection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void COverlayQuadsDX::Render(SRenderState &state)
{
if (m_count == 0)
return;
ID3D11DeviceContext* pContext = g_Windowing.Get3D11Context();
CGUIShaderDX* pGUIShader = g_Windowing.GetGUIShader();
XMMATRIX world = pGUIShader->GetWorld();
XMMATRIX view = pGUIShader->GetView();
XMMATRIX proj = pGUIShader->GetProjection();
if (g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_SPLIT_HORIZONTAL
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_SPLIT_VERTICAL)
{
CRect rect;
g_Windowing.GetViewPort(rect);
g_Windowing.SetCameraPosition(CPoint(rect.Width()*0.5f, rect.Height()*0.5f), rect.Width(), 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;
ID3D11Buffer* vertexBuffer = m_vertex.Get();
// 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);
g_Windowing.SetAlphaBlendEnable(true);
pGUIShader->Begin(SHADER_METHOD_RENDER_FONT);
ID3D11ShaderResourceView* views[] = { m_texture.GetShaderResource() };
pGUIShader->SetShaderViews(1, views);
pGUIShader->Draw(m_count * 6, 0);
// restoring transformation
pGUIShader->SetWorld(world);
pGUIShader->SetView(view);
pGUIShader->SetProjection(proj);
pGUIShader->RestoreBuffers();
}