correct some references which could produce erroneous prim face numbers
parent
1d14cf8c3f
commit
41a98b902b
|
@ -827,15 +827,16 @@ namespace PrimMesher
|
||||||
|
|
||||||
if (createFaces)
|
if (createFaces)
|
||||||
{
|
{
|
||||||
int numOuterVerts = this.coords.Count;
|
//int numOuterVerts = this.coords.Count;
|
||||||
int numHollowVerts = hollowCoords.Count;
|
//numOuterVerts = this.coords.Count;
|
||||||
int numTotalVerts = numOuterVerts + numHollowVerts;
|
//int numHollowVerts = hollowCoords.Count;
|
||||||
|
int numTotalVerts = this.numOuterVerts + this.numHollowVerts;
|
||||||
|
|
||||||
if (numOuterVerts == numHollowVerts)
|
if (this.numOuterVerts == this.numHollowVerts)
|
||||||
{
|
{
|
||||||
Face newFace = new Face();
|
Face newFace = new Face();
|
||||||
|
|
||||||
for (int coordIndex = 0; coordIndex < numOuterVerts - 1; coordIndex++)
|
for (int coordIndex = 0; coordIndex < this.numOuterVerts - 1; coordIndex++)
|
||||||
{
|
{
|
||||||
newFace.v1 = coordIndex;
|
newFace.v1 = coordIndex;
|
||||||
newFace.v2 = coordIndex + 1;
|
newFace.v2 = coordIndex + 1;
|
||||||
|
@ -850,12 +851,12 @@ namespace PrimMesher
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (numOuterVerts < numHollowVerts)
|
if (this.numOuterVerts < this.numHollowVerts)
|
||||||
{
|
{
|
||||||
Face newFace = new Face();
|
Face newFace = new Face();
|
||||||
int j = 0; // j is the index for outer vertices
|
int j = 0; // j is the index for outer vertices
|
||||||
int maxJ = numOuterVerts - 1;
|
int maxJ = this.numOuterVerts - 1;
|
||||||
for (int i = 0; i < numHollowVerts; i++) // i is the index for inner vertices
|
for (int i = 0; i < this.numHollowVerts; i++) // i is the index for inner vertices
|
||||||
{
|
{
|
||||||
if (j < maxJ)
|
if (j < maxJ)
|
||||||
if (angles.angles[j + 1].angle - hollowAngles.angles[i].angle < hollowAngles.angles[i].angle - angles.angles[j].angle + 0.000001f)
|
if (angles.angles[j + 1].angle - hollowAngles.angles[i].angle < hollowAngles.angles[i].angle - angles.angles[j].angle + 0.000001f)
|
||||||
|
@ -879,8 +880,8 @@ namespace PrimMesher
|
||||||
{
|
{
|
||||||
Face newFace = new Face();
|
Face newFace = new Face();
|
||||||
int j = 0; // j is the index for inner vertices
|
int j = 0; // j is the index for inner vertices
|
||||||
int maxJ = numHollowVerts - 1;
|
int maxJ = this.numHollowVerts - 1;
|
||||||
for (int i = 0; i < numOuterVerts; i++)
|
for (int i = 0; i < this.numOuterVerts; i++)
|
||||||
{
|
{
|
||||||
if (j < maxJ)
|
if (j < maxJ)
|
||||||
if (hollowAngles.angles[j + 1].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[j].angle + 0.000001f)
|
if (hollowAngles.angles[j + 1].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[j].angle + 0.000001f)
|
||||||
|
@ -981,7 +982,7 @@ namespace PrimMesher
|
||||||
int startVert = hasProfileCut && !hasHollow ? 1 : 0;
|
int startVert = hasProfileCut && !hasHollow ? 1 : 0;
|
||||||
if (startVert > 0)
|
if (startVert > 0)
|
||||||
this.faceNumbers.Add(-1);
|
this.faceNumbers.Add(-1);
|
||||||
for (int i = 0; i < numOuterVerts - 1; i++)
|
for (int i = 0; i < this.numOuterVerts - 1; i++)
|
||||||
this.faceNumbers.Add(sides < 5 ? faceNum++ : faceNum);
|
this.faceNumbers.Add(sides < 5 ? faceNum++ : faceNum);
|
||||||
|
|
||||||
//if (!hasHollow && !hasProfileCut)
|
//if (!hasHollow && !hasProfileCut)
|
||||||
|
@ -994,7 +995,7 @@ namespace PrimMesher
|
||||||
|
|
||||||
if (hasHollow)
|
if (hasHollow)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numHollowVerts; i++)
|
for (int i = 0; i < this.numHollowVerts; i++)
|
||||||
this.faceNumbers.Add(faceNum);
|
this.faceNumbers.Add(faceNum);
|
||||||
|
|
||||||
faceNum++;
|
faceNum++;
|
||||||
|
@ -1348,7 +1349,6 @@ namespace PrimMesher
|
||||||
float stepSize = twoPi / this.stepsPerRevolution;
|
float stepSize = twoPi / this.stepsPerRevolution;
|
||||||
|
|
||||||
int step = (int)(startAngle / stepSize);
|
int step = (int)(startAngle / stepSize);
|
||||||
// int firstStep = step;
|
|
||||||
float angle = startAngle;
|
float angle = startAngle;
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
@ -1738,7 +1738,6 @@ namespace PrimMesher
|
||||||
// append this layer
|
// append this layer
|
||||||
|
|
||||||
int coordsLen = this.coords.Count;
|
int coordsLen = this.coords.Count;
|
||||||
// int lastCoordsLen = coordsLen;
|
|
||||||
newLayer.AddValue2FaceVertexIndices(coordsLen);
|
newLayer.AddValue2FaceVertexIndices(coordsLen);
|
||||||
|
|
||||||
this.coords.AddRange(newLayer.coords);
|
this.coords.AddRange(newLayer.coords);
|
||||||
|
|
Loading…
Reference in New Issue