本文整理汇总了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);
}
}
}
示例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) {
//.........这里部分代码省略.........