Circular path prim meshes are now joined where the path ends meet if they match. This may have a minor improvement in memory and speed performance, but it's mainly for viewer applications and it also syncs the c# version of PrimMesher with my python sandbox version.

0.6.0-stable
Dahlia Trimble 2008-09-13 10:22:17 +00:00
parent 39902fef77
commit 8a8b01d1b8
2 changed files with 89 additions and 66 deletions

View File

@ -1909,8 +1909,8 @@ namespace OpenSim.Region.Physics.Meshing
PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides);
//PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, 0.0f, 4);
Profile testProfile = new Profile(sides, profileBegin, profileEnd, profileHollow, hollowSides);
testProfile.DumpRaw(baseDir, primName, "Profile");
//Profile testProfile = new Profile(sides, profileBegin, profileEnd, profileHollow, hollowSides, true);
//testProfile.DumpRaw(baseDir, primName, "Profile");
primMesh.topShearX = pathShearX;
primMesh.topShearY = pathShearY;

View File

@ -336,7 +336,7 @@ angles24 = [
this.faces = new List<Face>();
}
public Profile(int sides, float profileStart, float profileEnd, float hollow, int hollowSides)
public Profile(int sides, float profileStart, float profileEnd, float hollow, int hollowSides, bool createFaces)
{
this.coords = new List<Coord>();
this.faces = new List<Face>();
@ -422,7 +422,7 @@ angles24 = [
hollowCoords.Add(newVert);
}
}
else if (angle.angle > 0.0001f)
else if (createFaces && angle.angle > 0.0001f)
{
Face newFace = new Face();
newFace.v1 = 0;
@ -437,6 +437,8 @@ angles24 = [
{
hollowCoords.Reverse();
if (createFaces)
{
int numOuterVerts = this.coords.Count;
int numHollowVerts = hollowCoords.Count;
int numTotalVerts = numOuterVerts + numHollowVerts;
@ -511,16 +513,23 @@ angles24 = [
}
}
}
}
this.coords.AddRange(hollowCoords);
}
}
public Profile Clone()
{
return this.Clone(true);
}
public Profile Clone(bool needFaces)
{
Profile clone = new Profile();
clone.coords.AddRange(this.coords);
if (needFaces)
clone.faces.AddRange(this.faces);
return clone;
@ -781,7 +790,7 @@ angles24 = [
hollow *= 0.707f;
}
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides);
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, true);
if (initialProfileRot != 0.0f)
profile.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), initialProfileRot));
@ -948,7 +957,17 @@ angles24 = [
}
}
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides);
bool needEndFaces = false;
if (this.pathCutBegin != 0.0 || this.pathCutEnd != 1.0)
needEndFaces = true;
else if (this.taperX != 0.0 || this.taperY != 0.0)
needEndFaces = true;
else if (this.skew != 0.0)
needEndFaces = true;
else if (twistTotal != 0.0)
needEndFaces = true;
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, needEndFaces);
if (initialProfileRot != 0.0f)
profile.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), initialProfileRot));
@ -956,7 +975,11 @@ angles24 = [
bool done = false;
while (!done) // loop through the length of the path and add the layers
{
Profile newLayer = profile.Clone();
bool isEndLayer = false;
if (angle == startAngle || angle >= endAngle)
isEndLayer = true;
Profile newLayer = profile.Clone(isEndLayer && needEndFaces);
float xProfileScale = (1.0f - Math.Abs(this.skew)) * this.holeSizeX;
float yProfileScale = this.holeSizeY;
@ -1012,7 +1035,7 @@ angles24 = [
this.coords.AddRange(newLayer.coords);
if (angle <= startAngle || angle >= endAngle)
if (isEndLayer)
this.faces.AddRange(newLayer.faces);
// fill faces between layers