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


C++ DeviceManager::GetDevice方法代码示例

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


在下文中一共展示了DeviceManager::GetDevice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: make_argument_exception

RasterizerState::RasterizerState (const DeviceManager& manager, const RasterizerDesc& in_desc)
  : DeviceObject (manager)
  , desc (in_desc)
{
  try
  {
      //преобразование дескриптора

    D3D11_RASTERIZER_DESC dx_desc;

    memset (&dx_desc, 0, sizeof (dx_desc));

    dx_desc.FrontCounterClockwise = desc.front_counter_clockwise;
    dx_desc.DepthBias             = desc.depth_bias;
    dx_desc.DepthBiasClamp        = 0.0f;
    dx_desc.DepthClipEnable       = TRUE;
    dx_desc.SlopeScaledDepthBias  = 0.0f;
    dx_desc.MultisampleEnable     = desc.multisample_enable;
    dx_desc.ScissorEnable         = desc.scissor_enable;
    dx_desc.AntialiasedLineEnable = desc.antialiased_line_enable;

    switch (desc.fill_mode)
    {
      case FillMode_Wireframe:
        dx_desc.FillMode = D3D11_FILL_WIREFRAME;
        break;
      case FillMode_Solid:
        dx_desc.FillMode = D3D11_FILL_SOLID;
        break;
      default:
        throw xtl::make_argument_exception ("", "desc.fill_mode", desc.fill_mode);
    }

    switch (desc.cull_mode)
    {
      case CullMode_None:
        dx_desc.CullMode = D3D11_CULL_NONE;
        break;
      case CullMode_Front:
        dx_desc.CullMode = D3D11_CULL_FRONT;
        break;
      case CullMode_Back:
        dx_desc.CullMode = D3D11_CULL_BACK;
        break;
      default:
        throw xtl::make_argument_exception ("", "desc.cull_mode", desc.cull_mode);
    }

      //создание состояния

    ID3D11RasterizerState* dx_state = 0;

    check_errors ("ID3D11Device::CreateRasterizerState", manager.GetDevice ().CreateRasterizerState (&dx_desc, &dx_state));

    if (!dx_state)
      throw xtl::format_operation_exception ("", "ID3D11Device::CreateRasterizerState failed");

    state = DxRasterizerStatePtr (dx_state, false);
  }
  catch (xtl::exception& e)
  {
    e.touch ("render::low_level::dx11::RasterizerState::RasterizerState");
    throw;
  }
}
开发者ID:untgames,项目名称:funner,代码行数:65,代码来源:dx11_output_rasterizer_state.cpp


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