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


C++ GraphicsEngine::ApplyModelViewMatrix方法代码示例

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


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

示例1: Draw

void OverlaySpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
  nux::Geometry const& geo = GetGeometry();
  nux::TexCoordXForm texxform;

  GfxContext.PushClippingRectangle(geo);

  nux::GetPainter().PaintBackground(GfxContext, geo);

  texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
  texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
  texxform.min_filter = nux::TEXFILTER_LINEAR;
  texxform.mag_filter = nux::TEXFILTER_LINEAR;

  unsigned int current_alpha_blend;
  unsigned int current_src_blend_factor;
  unsigned int current_dest_blend_factor;
  GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
  GfxContext.GetRenderStates().SetBlend(true,  GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

  nux::Geometry spin_geo(geo.x + ((geo.width - spin_->GetWidth()) / 2),
                         geo.y + ((geo.height - spin_->GetHeight()) / 2),
                         spin_->GetWidth(),
                         spin_->GetHeight());
  // Geometry (== Rect) uses integers which were rounded above,
  // hence an extra 0.5 offset for odd sizes is needed
  // because pure floating point is not being used.
  int spin_offset_w = !(geo.width % 2) ? 0 : 1;
  int spin_offset_h = !(geo.height % 2) ? 0 : 1;

  nux::Matrix4 matrix_texture;
  matrix_texture = nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
                                          -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
  matrix_texture = rotate_ * matrix_texture;
  matrix_texture = nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f,
                                             spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;

  GfxContext.SetModelViewMatrix(GfxContext.GetModelViewMatrix() * matrix_texture);

  GfxContext.QRP_1Tex(spin_geo.x,
                      spin_geo.y,
                      spin_geo.width,
                      spin_geo.height,
                      spin_->GetDeviceTexture(),
                      texxform,
                      nux::color::White);

  // revert to model view matrix stack
  GfxContext.ApplyModelViewMatrix();

  GfxContext.PopClippingRectangle();

  GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);

  if (!frame_timeout_)
  {
    frame_timeout_.reset(new glib::Timeout(22, sigc::mem_fun(this, &OverlaySpinner::OnFrameTimeout)));
  }
}
开发者ID:jonjahren,项目名称:unity,代码行数:59,代码来源:PaymentPreview.cpp


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