- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
// check that all selected vertices are one 3d vertex.
bool UsedIndex = 0;
bool IndexIsRegistered = false;
for (int t = 0; t < Indices.count(); t++)
{
zUVVertex Vertex = OldVerts->at(t);
if (!IndexIsRegistered)
{
IndexIsRegistered = true;
UsedIndex = Vertex.BaseVertexIndex;
}
else if (UsedIndex != OldVerts->at(t).BaseVertexIndex)
{
// quit on fail
return;
}
}
NewList = new QList<zUVVertex>();
zUVVertex NewVertex;
bool VertexIsInitialized = false;
bool CapIsHoled = false;
for (quint32 t = 0; t < OldVerts->count(); t++)
{
bool Taked = false;
for (quint32 j = 0; j < Indices.count(); j++)
{
if (OldVerts->at(t).index == Indices.at(j))
{
if (!VertexIsInitialized)
{
VertexIsInitialized = true;
NewVertex = OldVerts->at(t);
}
Taked = true;
NewVertex.IndicesBeforeWeld << t;
break;
}
}
if (!Taked)
{
(*NewList) << OldVerts->at(t);
}
else
{
zUVVertex Stub;
if (!CapIsHoled)
{
Stub = NewVertex;
}
else
{
Stub.Index = 0x7FFFFFFF;
}
(*NewList) << Stub;
}
}
(*NewList) << NewVertex;
Taked = false;
QList<zUVFace> *TempFacesList = new QList<zUVFace>();
for (int t = 0; t < Faces->count(); t++)
{
zUVFace Face = Faces->at(t);
zUVFace NewFace;
for (int j = 0; j < Face.VertsIndices; j++)
{
quint32 Index0 = Face.VertsIndices.at(j);
zUVVertex TestVertex = NewList->at(Index0);
if (TestVertex.Index == 0x7FFFFFFF)
{
// need to replace
NewFace = Faces->at(t);
NewFace.VertsIndices.operator [](j) = NewList->count() - 1;
Taked = true;
}
}
if (Taked)
{
(*TempFacesList) << NewFace;
}
}