Eliminate some unnecessary polygons
parent
ab87a987f5
commit
09c8713801
|
@ -879,6 +879,10 @@ namespace PrimMesher
|
||||||
else if (this.sides == 24 && this.hollowSides == 4)
|
else if (this.sides == 24 && this.hollowSides == 4)
|
||||||
hollow *= 1.414f;
|
hollow *= 1.414f;
|
||||||
|
|
||||||
|
bool hasProfileCut = false;
|
||||||
|
if (profileStart < 0.0 || profileEnd < 1.0)
|
||||||
|
hasProfileCut = true;
|
||||||
|
|
||||||
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, true);
|
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, true);
|
||||||
|
|
||||||
if (initialProfileRot != 0.0f)
|
if (initialProfileRot != 0.0f)
|
||||||
|
@ -927,9 +931,16 @@ namespace PrimMesher
|
||||||
|
|
||||||
int numVerts = newLayer.coords.Count;
|
int numVerts = newLayer.coords.Count;
|
||||||
Face newFace = new Face();
|
Face newFace = new Face();
|
||||||
|
|
||||||
if (step > 0)
|
if (step > 0)
|
||||||
{
|
{
|
||||||
for (int i = coordsLen; i < this.coords.Count - 1; i++)
|
int startVert = coordsLen + 1;
|
||||||
|
int endVert = this.coords.Count - 1;
|
||||||
|
|
||||||
|
if (hasProfileCut || hollow > 0.0f)
|
||||||
|
startVert--;
|
||||||
|
|
||||||
|
for (int i = startVert; i < endVert; i++)
|
||||||
{
|
{
|
||||||
newFace.v1 = i;
|
newFace.v1 = i;
|
||||||
newFace.v2 = i - numVerts;
|
newFace.v2 = i - numVerts;
|
||||||
|
@ -941,15 +952,19 @@ namespace PrimMesher
|
||||||
this.faces.Add(newFace);
|
this.faces.Add(newFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
newFace.v1 = coordsLen - 1;
|
if (hasProfileCut)
|
||||||
newFace.v2 = coordsLen - numVerts;
|
{
|
||||||
newFace.v3 = coordsLen;
|
newFace.v1 = coordsLen - 1;
|
||||||
this.faces.Add(newFace);
|
newFace.v2 = coordsLen - numVerts;
|
||||||
|
newFace.v3 = coordsLen;
|
||||||
|
this.faces.Add(newFace);
|
||||||
|
|
||||||
|
newFace.v1 = coordsLen + numVerts - 1;
|
||||||
|
newFace.v2 = coordsLen - 1;
|
||||||
|
newFace.v3 = coordsLen;
|
||||||
|
this.faces.Add(newFace);
|
||||||
|
}
|
||||||
|
|
||||||
newFace.v1 = coordsLen + numVerts - 1;
|
|
||||||
newFace.v2 = coordsLen - 1;
|
|
||||||
newFace.v3 = coordsLen;
|
|
||||||
this.faces.Add(newFace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// calc the step for the next iteration of the loop
|
// calc the step for the next iteration of the loop
|
||||||
|
@ -1173,7 +1188,7 @@ namespace PrimMesher
|
||||||
|
|
||||||
public Coord SurfaceNormal(int faceIndex)
|
public Coord SurfaceNormal(int faceIndex)
|
||||||
{
|
{
|
||||||
//int numFaces = faces.Count;
|
int numFaces = faces.Count;
|
||||||
if (faceIndex < 0 || faceIndex >= faces.Count)
|
if (faceIndex < 0 || faceIndex >= faces.Count)
|
||||||
return new Coord(0.0f, 0.0f, 0.0f);
|
return new Coord(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue