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


C++ TLeafList::size方法代码示例

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


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

示例1: return

boost::shared_ptr<TriMesh>
GeometryServer::GetMesh(const string& name, const::ParameterList& parameter)
{
    // try a direct match
    string meshName = name;
    TMeshMap::const_iterator meshIter = mMeshMap.find(meshName);

    if (meshIter != mMeshMap.end())
    {
        return (*meshIter).second;
    }

    TLeafList importer;
    ListChildrenSupportingClass<MeshImporter>(importer);

    if (importer.size() == 0)
    {
        GetLog()->Error()
            << "(GeometryServer) Warning: no MeshImporter registered\n";

        return boost::shared_ptr<TriMesh>();
    }

    // try to mangle the name
    for (
         TLeafList::iterator iter = importer.begin();
         iter != importer.end();
         ++iter
         )
    {
        boost::shared_ptr<MeshImporter> importer =
            static_pointer_cast<MeshImporter>(*iter);

        string str = importer->MangleName(name, parameter);

        if (str != meshName)
        {
            meshName = str;
            meshIter = mMeshMap.find(meshName);
            if (meshIter != mMeshMap.end())
            {
                return (*meshIter).second;
            }
        }
    }

    // try to import the mesh
    for (
         TLeafList::iterator iter = importer.begin();
         iter != importer.end();
         ++iter
         )
    {
        boost::shared_ptr<MeshImporter> importer =
            static_pointer_cast<MeshImporter>(*iter);

        boost::shared_ptr<TriMesh> mesh = importer->ImportMesh(name,parameter);

        if (mesh.get() == 0)
        {
            continue;
        }

        string meshName = mesh->GetName();
        if (meshName.empty())
        {
            meshName = name;
            mesh->SetName(name);
        }

        GetLog()->Debug() << "(GeometryServer) imported mesh '" << meshName
                           << " with '" << importer->GetName() << "'\n";

        if (mesh.get() == 0 || mesh->GetVertexCount() == 0)
        {
            continue;
        }

        RegisterMesh(mesh);

        return mesh;
    }

    GetLog()->Error() << "(GeometryServer) ERROR: cannot import mesh '"
                      << name << "'\n";

    return boost::shared_ptr<TriMesh>();
}
开发者ID:unfabio,项目名称:furosimspark,代码行数:88,代码来源:geometryserver.cpp

示例2: glGetError

void
RenderServer::Render(bool clean)
{
    int err = glGetError();
    if (err) GetLog()->Error() << "OpenGLError before picking preparation: " << err << std::endl;

    PreparePicking();

    err = glGetError();
    if (err) GetLog()->Error() << "OpenGLError after picking preparation: " << err << std::endl;

    if (! GetActiveScene())
    {
        return;
    }

    // if no camera is selected yet, select the first one
    if (mCamera.get() == 0)
      mCamera = static_pointer_cast<Camera>(mActiveScene->GetChildOfClass("Camera", true));
    
    if (mCamera.get() == 0)
    {
        GetLog()->Error()
            << "(RenderServer) ERROR: found no camera node in the active scene\n";
        return;
  }
     err = glGetError();
    if (err) GetLog()->Error() << "OpenGLError before binding camera: " << err << std::endl;

    // set the view transformation
    BindCamera(mCamera);

    err = glGetError();
    if (err) GetLog()->Error() << "OpenGLError after binding camera: " << err << std::endl;

    glClearColor(
      mAmbientColor.r(),
      mAmbientColor.g(),
      mAmbientColor.b(),
      mAmbientColor.a()
      );

  if (clean)
  {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  }
  else
  {
    glClear(GL_DEPTH_BUFFER_BIT);
  }
    glColor3f(1, 1, 1);
    

    // actual rendering

    // ambient pass
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    glAlphaFunc(GL_GREATER, 0.1);
    glEnable(GL_ALPHA_TEST);
    
    TLeafList lights;
    mActiveScene->ListChildrenSupportingClass<Light>(lights,true);

    if (lights.size() == 0)
    {
        // no lights in the scene, disable lighting
        glDisable(GL_LIGHTING);
    }
    else
    {
        glEnable(GL_LIGHTING);
        glShadeModel (GL_SMOOTH);

        // prepare all lights
        for (
             TLeafList::iterator iter = lights.begin();
             iter != lights.end();
             ++iter
             )
        {
            (static_pointer_cast<Light>(*iter))->Prepare();
        }
    }

    err = glGetError();
    if (err) GetLog()->Error() << "OpenGLError before render pass 0: " << err << std::endl;
    // standard rendering
    RenderScene(mActiveScene, 0);
    
    err = glGetError();
    if (err) GetLog()->Error() << "OpenGLError after render pass 0: " << err << std::endl;

    RenderScene(mActiveScene, 1);

    err = glGetError();
    if (err) GetLog()->Error() << "OpenGLError after render pass 1: " << err << std::endl;
//.........这里部分代码省略.........
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:101,代码来源:renderserver.cpp


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