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


C++ ListIter::index方法代码示例

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


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

示例1: while

void
UVMapView::SelectInverse()
{
    ListIter<Poly> iter = polys;
    while (++iter) {
        Poly* p = iter.value();

        if (p->material != material)
            continue;

        for (int i = 0; i < p->nverts; i++) {
            WORD  p_index = iter.index();
            DWORD value   = (p_index << 16) | i;

            bool contains = false;
            auto svi = selverts.begin();
            for (; svi != selverts.end(); ++svi) {
                if (*svi == value) {
                    contains = true;
                    break;
                }
            }

            if (contains)
                selverts.erase(svi);
            else
                selverts.push_back(value);
        }
    }
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:30,代码来源:UVMapView.cpp

示例2: p

void
UVMapView::End()
{
    active = false;

    // get the model:
    if (!nmarks || !material || !material->tex_diffuse) return;

    // if not adding to selection:
    if (select_mode == SELECT_REPLACE) {
        Clear();
    }

    Bitmap*  bmp = material->tex_diffuse;
    int      w   = bmp->Width();
    int      h   = bmp->Height();

    double   cx  = window->Width()  / 2 + x_offset;
    double   cy  = window->Height() / 2 + y_offset;


    // if only one mark:
    if (nmarks < 2) {
        // find all selected verts:
        ListIter<Poly> iter = polys;
        while (++iter) {
            Poly*       p     = iter.value();
            VertexSet*  vset  = p->vertex_set;

            for (int i = 0; i < p->nverts; i++) {
                int    n1   = p->verts[i];
                double tu1  = vset->tu[n1];
                double tv1  = vset->tv[n1];

                int x1 = (int) (cx + zoom * w * (tu1-0.5));
                int y1 = (int) (cy + zoom * h * (tv1-0.5));

                int dx = abs(marks[0].x - x1);
                int dy = abs(marks[0].y - y1);

                if (dx < 4 && dy < 4) {
                    WORD  p_index = iter.index();
                    DWORD value   = (p_index << 16) | i;

                    if (select_mode == SELECT_REMOVE) {
                        for (auto svi = selverts.begin(); svi != selverts.end(); ++svi) {
                            if (*svi == value) {
                                selverts.erase(svi);
                            }
                        }
                    }
                    else {
                        bool contains = false;
                        for (auto svi = selverts.begin(); svi != selverts.end(); ++svi) {
                            if (*svi == value) {
                                contains = true;
                            }
                        }
                        if (!contains)
                            selverts.push_back(value);
                    }
                }
            }
        }
    }

    // otherwise, build a region:
    else {
        CRgn rgn;
        rgn.CreatePolygonRgn(marks, nmarks, WINDING);

        // find all selected verts:
        ListIter<Poly> iter = polys;
        while (++iter) {
            Poly*       p     = iter.value();
            VertexSet*  vset  = p->vertex_set;

            for (int i = 0; i < p->nverts; i++) {
                int    n1   = p->verts[i];
                double tu1  = vset->tu[n1];
                double tv1  = vset->tv[n1];

                int x1 = (int) (cx + zoom * w * (tu1-0.5));
                int y1 = (int) (cy + zoom * h * (tv1-0.5));

                CPoint p(x1,y1);

                if (rgn.PtInRegion(p)) {
                    WORD  p_index = iter.index();
                    DWORD value   = (p_index << 16) | i;

                    if (select_mode == SELECT_REMOVE) {
                        for (auto svi = selverts.begin(); svi != selverts.end(); ++svi) {
                            if (*svi == value)
                                selverts.erase(svi);
                        }
                    }
                    else {
                        bool contains = false;
                        for (auto svi = selverts.begin(); svi != selverts.end(); ++svi) {
//.........这里部分代码省略.........
开发者ID:Banbury,项目名称:starshatter-open,代码行数:101,代码来源:UVMapView.cpp


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