aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorJeff Ames2008-08-28 14:41:54 +0000
committerJeff Ames2008-08-28 14:41:54 +0000
commit3bf88587277b83c0b6f058fabba7d46a3b5a6a00 (patch)
treeed4ad9dc27e649a6f52661665fb681984251f480 /OpenSim/Region/Physics
parentThannk you, Ralphos, for a patch the corrects an improper cast in (diff)
downloadopensim-SC_OLD-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.zip
opensim-SC_OLD-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.tar.gz
opensim-SC_OLD-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.tar.bz2
opensim-SC_OLD-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.tar.xz
Update svn properties, formatting cleanup.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs7
-rw-r--r--OpenSim/Region/Physics/Meshing/PrimMesher.cs97
3 files changed, 52 insertions, 54 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index 394dcf3..4630d98 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -231,7 +231,7 @@ namespace OpenSim.Region.Physics.Meshing
231 { 231 {
232 int[] result = getIndexListAsInt(); 232 int[] result = getIndexListAsInt();
233 pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); 233 pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
234 234
235 return result; 235 return result;
236 } 236 }
237 237
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index a66a1b1..7cf8b76 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -1890,9 +1890,9 @@ namespace OpenSim.Region.Physics.Meshing
1890 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) 1890 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
1891 { // half circle, prim is a sphere 1891 { // half circle, prim is a sphere
1892 sides = 24; 1892 sides = 24;
1893 1893
1894 profileBegin = 0.5f * profileBegin + 0.5f; 1894 profileBegin = 0.5f * profileBegin + 0.5f;
1895 profileEnd = 0.5f * profileEnd + 0.5f; 1895 profileEnd = 0.5f * profileEnd + 0.5f;
1896 1896
1897 //profileHollow = 0.0f; // debugging only 1897 //profileHollow = 0.0f; // debugging only
1898 } 1898 }
@@ -1904,7 +1904,6 @@ namespace OpenSim.Region.Physics.Meshing
1904 hollowSides = 4; 1904 hollowSides = 4;
1905 else if (primShape.HollowShape == HollowShape.Triangle) 1905 else if (primShape.HollowShape == HollowShape.Triangle)
1906 hollowSides = 3; 1906 hollowSides = 3;
1907
1908 1907
1909 PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides); 1908 PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides);
1910 //PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, 0.0f, 4); 1909 //PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, 0.0f, 4);
diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
index 53cc443..58bb82e 100644
--- a/OpenSim/Region/Physics/Meshing/PrimMesher.cs
+++ b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
@@ -99,8 +99,8 @@ namespace OpenSim.Region.Physics.Meshing
99 internal List<Angle> angles; 99 internal List<Angle> angles;
100 100
101 // this class should have a table of most commonly computed values 101 // this class should have a table of most commonly computed values
102 // instead of all the trig function calls 102 // instead of all the trig function calls
103 // most common would be for sides = 3, 4, or 24 103 // most common would be for sides = 3, 4, or 24
104 internal void makeAngles( int sides, float startAngle, float stopAngle ) 104 internal void makeAngles( int sides, float startAngle, float stopAngle )
105 { 105 {
106 angles = new List<Angle>(); 106 angles = new List<Angle>();
@@ -134,7 +134,7 @@ namespace OpenSim.Region.Physics.Meshing
134 newAngle.Y = (float) System.Math.Sin(angle); 134 newAngle.Y = (float) System.Math.Sin(angle);
135 angles.Add(newAngle); 135 angles.Add(newAngle);
136 step += 1; 136 step += 1;
137 angle = stepSize * step; 137 angle = stepSize * step;
138 } 138 }
139 139
140 if (startAngle > angles[0].angle) 140 if (startAngle > angles[0].angle)
@@ -187,15 +187,15 @@ namespace OpenSim.Region.Physics.Meshing
187 AngleList hollowAngles = new AngleList(); 187 AngleList hollowAngles = new AngleList();
188 188
189 float xScale = 0.5f; 189 float xScale = 0.5f;
190 float yScale = 0.5f; 190 float yScale = 0.5f;
191 if (sides == 4) // corners of a square are sqrt(2) from center 191 if (sides == 4) // corners of a square are sqrt(2) from center
192 { 192 {
193 xScale = 0.707f; 193 xScale = 0.707f;
194 yScale = 0.707f; 194 yScale = 0.707f;
195 } 195 }
196 196
197 float startAngle = profileStart * twoPi; 197 float startAngle = profileStart * twoPi;
198 float stopAngle = profileEnd * twoPi; 198 float stopAngle = profileEnd * twoPi;
199 float stepSize = twoPi / sides; 199 float stepSize = twoPi / sides;
200 200
201 try { angles.makeAngles(sides, startAngle, stopAngle); } 201 try { angles.makeAngles(sides, startAngle, stopAngle); }
@@ -397,7 +397,7 @@ namespace OpenSim.Region.Physics.Meshing
397 { 397 {
398 vert = this.coords[i]; 398 vert = this.coords[i];
399 Vertex v = new Vertex(vert.X, vert.Y, vert.Z) * q; 399 Vertex v = new Vertex(vert.X, vert.Y, vert.Z) * q;
400 400
401 vert.X = v.X; 401 vert.X = v.X;
402 vert.Y = v.Y; 402 vert.Y = v.Y;
403 vert.Z = v.Z; 403 vert.Z = v.Z;
@@ -507,23 +507,23 @@ namespace OpenSim.Region.Physics.Meshing
507 s += "sides..................: " + this.sides.ToString(); 507 s += "sides..................: " + this.sides.ToString();
508 s += "\nhollowSides..........: " + this.hollowSides.ToString(); 508 s += "\nhollowSides..........: " + this.hollowSides.ToString();
509 s += "\nprofileStart.........: " + this.profileStart.ToString(); 509 s += "\nprofileStart.........: " + this.profileStart.ToString();
510 s += "\nprofileEnd...........: " + this.profileEnd.ToString(); 510 s += "\nprofileEnd...........: " + this.profileEnd.ToString();
511 s += "\nhollow...............: " + this.hollow.ToString(); 511 s += "\nhollow...............: " + this.hollow.ToString();
512 s += "\ntwistBegin...........: " + this.twistBegin.ToString(); 512 s += "\ntwistBegin...........: " + this.twistBegin.ToString();
513 s += "\ntwistEnd.............: " + this.twistEnd.ToString(); 513 s += "\ntwistEnd.............: " + this.twistEnd.ToString();
514 s += "\ntopShearX............: " + this.topShearX.ToString(); 514 s += "\ntopShearX............: " + this.topShearX.ToString();
515 s += "\ntopShearY............: " + this.topShearY.ToString(); 515 s += "\ntopShearY............: " + this.topShearY.ToString();
516 s += "\npathCutBegin.........: " + this.pathCutBegin.ToString(); 516 s += "\npathCutBegin.........: " + this.pathCutBegin.ToString();
517 s += "\npathCutEnd...........: " + this.pathCutEnd.ToString(); 517 s += "\npathCutEnd...........: " + this.pathCutEnd.ToString();
518 s += "\ndimpleBegin..........: " + this.dimpleBegin.ToString(); 518 s += "\ndimpleBegin..........: " + this.dimpleBegin.ToString();
519 s += "\ndimpleEnd............: " + this.dimpleEnd.ToString(); 519 s += "\ndimpleEnd............: " + this.dimpleEnd.ToString();
520 s += "\nskew.................: " + this.skew.ToString(); 520 s += "\nskew.................: " + this.skew.ToString();
521 s += "\nholeSizeX............: " + this.holeSizeX.ToString(); 521 s += "\nholeSizeX............: " + this.holeSizeX.ToString();
522 s += "\nholeSizeY............: " + this.holeSizeY.ToString(); 522 s += "\nholeSizeY............: " + this.holeSizeY.ToString();
523 s += "\ntaperX...............: " + this.taperX.ToString(); 523 s += "\ntaperX...............: " + this.taperX.ToString();
524 s += "\ntaperY...............: " + this.taperY.ToString(); 524 s += "\ntaperY...............: " + this.taperY.ToString();
525 s += "\nradius...............: " + this.radius.ToString(); 525 s += "\nradius...............: " + this.radius.ToString();
526 s += "\nrevolutions..........: " + this.revolutions.ToString(); 526 s += "\nrevolutions..........: " + this.revolutions.ToString();
527 s += "\nstepsPerRevolution...: " + this.stepsPerRevolution.ToString(); 527 s += "\nstepsPerRevolution...: " + this.stepsPerRevolution.ToString();
528 528
529 return s; 529 return s;
@@ -542,20 +542,20 @@ namespace OpenSim.Region.Physics.Meshing
542 this.hollowSides = hollowSides; 542 this.hollowSides = hollowSides;
543 543
544 if (sides < 3) 544 if (sides < 3)
545 this.sides = 3; 545 this.sides = 3;
546 if ( hollowSides < 3) 546 if ( hollowSides < 3)
547 this.hollowSides = 3; 547 this.hollowSides = 3;
548 if (profileStart < 0.0f) 548 if (profileStart < 0.0f)
549 this.profileStart = 0.0f; 549 this.profileStart = 0.0f;
550 if (profileEnd > 1.0f) 550 if (profileEnd > 1.0f)
551 this.profileEnd = 1.0f; 551 this.profileEnd = 1.0f;
552 if (profileEnd < 0.02f) 552 if (profileEnd < 0.02f)
553 this.profileEnd = 0.02f; 553 this.profileEnd = 0.02f;
554 if (profileStart >= profileEnd) 554 if (profileStart >= profileEnd)
555 this.profileStart = profileEnd - 0.02f; 555 this.profileStart = profileEnd - 0.02f;
556 if (hollow > 1.0f) 556 if (hollow > 1.0f)
557 this.hollow = 1.0f; 557 this.hollow = 1.0f;
558 if (hollow < 0.0f) 558 if (hollow < 0.0f)
559 this.hollow = 0.0f; 559 this.hollow = 0.0f;
560 } 560 }
561 561
@@ -578,7 +578,7 @@ namespace OpenSim.Region.Physics.Meshing
578 steps = (int)(steps * 4.5 * length); 578 steps = (int)(steps * 4.5 * length);
579 } 579 }
580#endif 580#endif
581 581
582 float twistBegin = this.twistBegin / 360.0f * twoPi; 582 float twistBegin = this.twistBegin / 360.0f * twoPi;
583 float twistEnd = this.twistEnd / 360.0f * twoPi; 583 float twistEnd = this.twistEnd / 360.0f * twoPi;
584 float twistTotal = twistEnd - twistBegin; 584 float twistTotal = twistEnd - twistBegin;
@@ -661,7 +661,7 @@ namespace OpenSim.Region.Physics.Meshing
661 newLayer.AddValue2Faces(coordsLen); 661 newLayer.AddValue2Faces(coordsLen);
662 662
663 this.coords.AddRange(newLayer.coords); 663 this.coords.AddRange(newLayer.coords);
664 this.faces.AddRange(newLayer.faces); 664 this.faces.AddRange(newLayer.faces);
665 665
666 // fill faces between layers 666 // fill faces between layers
667 667
@@ -707,7 +707,6 @@ namespace OpenSim.Region.Physics.Meshing
707 else done = true; 707 else done = true;
708 } 708 }
709 } 709 }
710
711 710
712 public void ExtrudeCircular() 711 public void ExtrudeCircular()
713 { 712 {
@@ -721,9 +720,9 @@ namespace OpenSim.Region.Physics.Meshing
721 float twistEnd = this.twistEnd / 360.0f * twoPi; 720 float twistEnd = this.twistEnd / 360.0f * twoPi;
722 float twistTotal = twistEnd - twistBegin; 721 float twistTotal = twistEnd - twistBegin;
723 722
724 // if the profile has a lot of twist, add more layers otherwise the layers may overlap 723 // if the profile has a lot of twist, add more layers otherwise the layers may overlap
725 // and the resulting mesh may be quite inaccurate. This method is arbitrary and doesn't 724 // and the resulting mesh may be quite inaccurate. This method is arbitrary and doesn't
726 // accurately match the viewer 725 // accurately match the viewer
727 float twistTotalAbs = Math.Abs(twistTotal); 726 float twistTotalAbs = Math.Abs(twistTotal);
728 if (twistTotalAbs > 0.01f) 727 if (twistTotalAbs > 0.01f)
729 { 728 {
@@ -732,19 +731,19 @@ namespace OpenSim.Region.Physics.Meshing
732 if (twistTotalAbs > Math.PI * 3.0f) 731 if (twistTotalAbs > Math.PI * 3.0f)
733 steps *= 2; 732 steps *= 2;
734 } 733 }
735 734
736 float yPathScale = this.holeSizeY * 0.5f; 735 float yPathScale = this.holeSizeY * 0.5f;
737 float pathLength = this.pathCutEnd - this.pathCutBegin; 736 float pathLength = this.pathCutEnd - this.pathCutBegin;
738 float totalSkew = this.skew * 2.0f * pathLength; 737 float totalSkew = this.skew * 2.0f * pathLength;
739 float skewStart = this.pathCutBegin * 2.0f * this.skew - this.skew; 738 float skewStart = this.pathCutBegin * 2.0f * this.skew - this.skew;
740 739
741 // It's not quite clear what pushY (Y top shear) does, but subtracting it from the start and end 740 // It's not quite clear what pushY (Y top shear) does, but subtracting it from the start and end
742 // angles appears to approximate it's effects on path cut. Likewise, adding it to the angle used 741 // angles appears to approximate it's effects on path cut. Likewise, adding it to the angle used
743 // to calculate the sine for generating the path radius appears to approximate it's effects there 742 // to calculate the sine for generating the path radius appears to approximate it's effects there
744 // too, but there are some subtle differences in the radius which are noticeable as the prim size 743 // too, but there are some subtle differences in the radius which are noticeable as the prim size
745 // increases and it may affect megaprims quite a bit. The effect of the Y top shear parameter on 744 // increases and it may affect megaprims quite a bit. The effect of the Y top shear parameter on
746 // the meshes generated with this technique appear nearly identical in shape to the same prims when 745 // the meshes generated with this technique appear nearly identical in shape to the same prims when
747 // displayed by the viewer. 746 // displayed by the viewer.
748 747
749 float startAngle = (twoPi * this.pathCutBegin * this.revolutions) - this.topShearY * 0.9f; 748 float startAngle = (twoPi * this.pathCutBegin * this.revolutions) - this.topShearY * 0.9f;
750 float endAngle = (twoPi * this.pathCutEnd * this.revolutions) - this.topShearY * 0.9f; 749 float endAngle = (twoPi * this.pathCutEnd * this.revolutions) - this.topShearY * 0.9f;
@@ -784,7 +783,7 @@ namespace OpenSim.Region.Physics.Meshing
784 hollow /= 0.7f; 783 hollow /= 0.7f;
785 } 784 }
786 } 785 }
787 786
788 Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides); 787 Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides);
789 788
790 if (initialProfileRot != 0.0f) 789 if (initialProfileRot != 0.0f)
@@ -834,7 +833,7 @@ namespace OpenSim.Region.Physics.Meshing
834 newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist)); 833 newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist));
835 834
836 // now orient the rotation of the profile layer relative to it's position on the path 835 // now orient the rotation of the profile layer relative to it's position on the path
837 // adding taperY to the angle used to generate the quat appears to approximate the viewer 836 // adding taperY to the angle used to generate the quat appears to approximate the viewer
838 newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY * 0.9f)); 837 newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY * 0.9f));
839 newLayer.AddPos(xOffset, yOffset, zOffset); 838 newLayer.AddPos(xOffset, yOffset, zOffset);
840 839
@@ -959,7 +958,7 @@ namespace OpenSim.Region.Physics.Meshing
959 958
960 sw.WriteLine(s); 959 sw.WriteLine(s);
961 } 960 }
962 961
963 sw.Close(); 962 sw.Close();
964 } 963 }
965 } 964 }