aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/PrimMesher.cs
diff options
context:
space:
mode:
authorDahlia Trimble2008-10-12 08:52:42 +0000
committerDahlia Trimble2008-10-12 08:52:42 +0000
commit116a08f42e791ed5190c8e042e480715ce0f2d75 (patch)
tree42c63cdfd273f509ebaa2800c89e5f732fb48e04 /OpenSim/Region/Physics/Meshing/PrimMesher.cs
parentOptimization: calculation of profile vertex normals is now disabled as default. (diff)
downloadopensim-SC-116a08f42e791ed5190c8e042e480715ce0f2d75.zip
opensim-SC-116a08f42e791ed5190c8e042e480715ce0f2d75.tar.gz
opensim-SC-116a08f42e791ed5190c8e042e480715ce0f2d75.tar.bz2
opensim-SC-116a08f42e791ed5190c8e042e480715ce0f2d75.tar.xz
Fixed a missing face on a profile cut
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/PrimMesher.cs')
-rw-r--r--OpenSim/Region/Physics/Meshing/PrimMesher.cs27
1 files changed, 23 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
index 537d652..e96985d 100644
--- a/OpenSim/Region/Physics/Meshing/PrimMesher.cs
+++ b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
@@ -458,6 +458,10 @@ namespace PrimMesher
458 return; 458 return;
459 } 459 }
460 460
461 bool simpleFace = false; // flag to create as few triangles as possible for 3 or 4 side profile
462 if (sides < 5 && hollow == 0.0f && profileStart == 0.0f && profileEnd == 1.0f)
463 simpleFace = true;
464
461 if (this.calcVertexNormals) 465 if (this.calcVertexNormals)
462 { 466 {
463 if (sides > 4) 467 if (sides > 4)
@@ -501,7 +505,7 @@ namespace PrimMesher
501 } 505 }
502 } 506 }
503 } 507 }
504 else 508 else if (!simpleFace)
505 { 509 {
506 this.coords.Add(center); 510 this.coords.Add(center);
507 if (this.calcVertexNormals && sides > 4) 511 if (this.calcVertexNormals && sides > 4)
@@ -546,7 +550,7 @@ namespace PrimMesher
546 hollowCoords.Add(newVert); 550 hollowCoords.Add(newVert);
547 } 551 }
548 } 552 }
549 else if (createFaces && angle.angle > 0.0001f) 553 else if (!simpleFace && createFaces && angle.angle > 0.0001f)
550 { 554 {
551 Face newFace = new Face(); 555 Face newFace = new Face();
552 newFace.v1 = 0; 556 newFace.v1 = 0;
@@ -641,6 +645,18 @@ namespace PrimMesher
641 645
642 this.coords.AddRange(hollowCoords); 646 this.coords.AddRange(hollowCoords);
643 } 647 }
648
649 if (simpleFace && createFaces)
650 {
651 if (sides == 3)
652 this.faces.Add(new Face(0, 1, 2));
653 else if (sides == 4)
654 {
655 this.faces.Add(new Face(0, 1, 2));
656 this.faces.Add(new Face(0, 2, 3));
657 }
658 }
659
644 } 660 }
645 661
646 public Profile Clone() 662 public Profile Clone()
@@ -966,7 +982,7 @@ namespace PrimMesher
966 hollow *= 1.414f; 982 hollow *= 1.414f;
967 983
968 bool hasProfileCut = false; 984 bool hasProfileCut = false;
969 if (profileStart < 0.0 || profileEnd < 1.0) 985 if (profileStart > 0.0f || profileEnd < 1.0f)
970 hasProfileCut = true; 986 hasProfileCut = true;
971 987
972 Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, true, calcVertexNormals); 988 Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, true, calcVertexNormals);
@@ -1023,7 +1039,7 @@ namespace PrimMesher
1023 int startVert = coordsLen + 1; 1039 int startVert = coordsLen + 1;
1024 int endVert = this.coords.Count - 1; 1040 int endVert = this.coords.Count - 1;
1025 1041
1026 if (hasProfileCut || hollow > 0.0f) 1042 if (sides < 5 || hasProfileCut || hollow > 0.0f)
1027 startVert--; 1043 startVert--;
1028 1044
1029 for (int i = startVert; i < endVert; i++) 1045 for (int i = startVert; i < endVert; i++)
@@ -1067,6 +1083,9 @@ namespace PrimMesher
1067 } 1083 }
1068 else done = true; 1084 else done = true;
1069 } 1085 }
1086
1087 if (calcVertexNormals && sides < 5 && twistBegin == 0.0f && twistEnd == 0.0f)
1088 this.CalcNormals();
1070 } 1089 }
1071 1090
1072 public void ExtrudeCircular() 1091 public void ExtrudeCircular()