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


C++ TriangleMesh::vertices方法代码示例

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


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

示例1: draw_obj

void ClickSoundViewer::draw_obj()
{
    const vector<Point3d>&  vtx = mesh_.vertices();
    const vector<Tuple3ui>& tgl = mesh_.surface_indices();
    const vector<Vector3d>& nml = mesh_.normals();

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);

    glVertexPointer(3, GL_DOUBLE, 0, (const GLvoid*)(vtx.data()));
    glNormalPointer(GL_DOUBLE, 0, (const GLvoid*)(nml.data()));
    glDrawElements(GL_TRIANGLES, tgl.size()*3, GL_UNSIGNED_INT, (const GLvoid*)(tgl.data()));
}
开发者ID:cxzheng,项目名称:ModalSound,代码行数:13,代码来源:ClickSoundSynth.cpp

示例2: drawWithNames

void ClickSoundViewer::drawWithNames()
{
    glEnableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);

    glVertexPointer(3, GL_DOUBLE, 0, (const GLvoid*)(mesh_.vertices().data()));
    const vector< Tuple3ui >& tgl = mesh_.triangles();
    for(size_t i = 0;i < tgl.size();++ i)
    {
        glPushName(i);
        glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, (const GLvoid*)&tgl[i]); 
        glPopName();
    }
}
开发者ID:cxzheng,项目名称:ModalSound,代码行数:14,代码来源:ClickSoundSynth.cpp

示例3: draw_triangle_normal

void ClickSoundViewer::draw_triangle_normal()
{
    const int tid = selTriId_;
    const vector<Point3d>&  vtx = mesh_.vertices();
    const vector<Tuple3ui>& tgl = mesh_.surface_indices();

    const Point3d ctr  = (vtx[tgl[tid].x] + vtx[tgl[tid].y] + vtx[tgl[tid].z])*(1./3.);
    Vector3d nml = Triangle<double>::weighted_normal( vtx[tgl[tid].x], vtx[tgl[tid].y], vtx[tgl[tid].z] );
    double area = nml.normalize2();
    const double len = 0.05;     ///// HARD coded value here!!!
    const Point3d end  = ctr + nml * len;

    glColor3f(1.f, 0.f, 0.f);
    drawArrow( qglviewer::Vec(end.x, end.y, end.z), 
               qglviewer::Vec(ctr.x, ctr.y, ctr.z),
               sqrt(area)*0.8 );
}
开发者ID:cxzheng,项目名称:ModalSound,代码行数:17,代码来源:ClickSoundSynth.cpp

示例4: postSelection

void ClickSoundViewer::postSelection(const QPoint&)
{
    selTriId_ = selectedName();
    //cout << "selected triangle ID:  " << selTriId_ << endl;

    //// Now synthesize sound and play
    {
        qglviewer::Vec cam = camera()->position();
        const Point3d camPos( cam.x, cam.y, cam.z );

        const vector<Point3d>&  vtx = mesh_.vertices();
        const vector<Tuple3ui>& tgl = mesh_.surface_indices();
        Vector3d nml = Triangle<double>::normal( 
                vtx[tgl[selTriId_].x], 
                vtx[tgl[selTriId_].y], 
                vtx[tgl[selTriId_].z] );
        nml.normalize();
        audio_->play( mesh_.triangle_ids(selTriId_), nml, camPos );
    }
    
    if ( selTriId_ >= 0 ) update();
}
开发者ID:cxzheng,项目名称:ModalSound,代码行数:22,代码来源:ClickSoundSynth.cpp


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