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


C++ CGUIShaderDX::GetProjection方法代码示例

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


在下文中一共展示了CGUIShaderDX::GetProjection方法的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();
}
开发者ID:DaHenchmen,项目名称:DHMC,代码行数:47,代码来源:OverlayRendererDX.cpp


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