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


C++ Vertices::getAttributes方法代码示例

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


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

示例1: reRender


//.........这里部分代码省略.........
  {
    // enable render options
    glEnable(GL_DEPTH_TEST);

    // clear background & zbuffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  }

  // old: precalculate ambient occlusion data (now done in endscene)
  for(list<Geometry*>::iterator i = scene.geometry.begin(); i != scene.geometry.end(); ++i)
  {
    // initialize variables
    if((*i)->type != MESH_GEOMETRY)
      continue;
    Mesh& geometry          = *(Mesh*)*i;
    Points* points          = geometry.points;
    Vertices* vertices      = geometry.vertices;
    Edges* edges            = geometry.edges;
    Primitives* primitives  = geometry.primitives;
    Map* map                = geometry.map;

    if(vertices == null)
      continue; // error - no vertices

    // retrieve attributes
    GlRasElements* locationElements = null,
                 * indexElements = null,
                 * normAreaElements = null;
    GlStream* vertexStream = null,
            * indexStream = null,
            * normAreaStream = null;

    if(points)
      locationElements = (GlRasElements*)points->getAttributes(RE_LOCATION);

    if(locationElements != null)
    {
      indexElements = (GlRasElements*)vertices->getAttributes(RE_INDEX);
      normAreaElements = (GlRasElements*)vertices->getAttributes(RE_EXT_BENT_NORMAL_AREA);
    }
    else
    {
      locationElements = (GlRasElements*)vertices->getAttributes(RE_LOCATION);
      if(locationElements == null)
        return; //error
      normAreaElements = (GlRasElements*)vertices->getAttributes(RE_EXT_BENT_NORMAL_AREA);
      indexElements = null;
    }

    vertexStream = locationElements->getStream();
    if(indexElements)
      indexStream = indexElements->getStream();
    if(normAreaElements)
      normAreaStream = normAreaElements->getStream();

    // calculate ambient occlusion
    GlStream occlusionStream;
    if(normAreaStream)
    {
      // create occlusion stream (one occlusion value per vertex)
      occlusionStream.create(vertexStream->getLength(), VEC4_FLOAT16_STREAM, null); //FLOAT16_STREAM?

      // create (& bind) occlusion kernel
      GlKernel kernel;
      kernel.build(fsCalculateDiscOcclusion1Pass, vsTexCoord1);
      kernel.bind();
开发者ID:rehno-lindeque,项目名称:osi-glrasre,代码行数:67,代码来源:api.cpp


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