aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDahlia Trimble2008-10-11 00:30:27 +0000
committerDahlia Trimble2008-10-11 00:30:27 +0000
commit09c8713801a12fdbfb575bc13cddbe45ca74806d (patch)
tree580f633f35ab12be735a86818a6e9a43ec217d67
parentFix an exception handling issue in XEngine (diff)
downloadopensim-SC-09c8713801a12fdbfb575bc13cddbe45ca74806d.zip
opensim-SC-09c8713801a12fdbfb575bc13cddbe45ca74806d.tar.gz
opensim-SC-09c8713801a12fdbfb575bc13cddbe45ca74806d.tar.bz2
opensim-SC-09c8713801a12fdbfb575bc13cddbe45ca74806d.tar.xz
Eliminate some unnecessary polygons
-rw-r--r--OpenSim/Region/Physics/Meshing/PrimMesher.cs35
1 files changed, 25 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
index dc19b1c..63fb7f7 100644
--- a/OpenSim/Region/Physics/Meshing/PrimMesher.cs
+++ b/OpenSim/Region/Physics/Meshing/PrimMesher.cs
@@ -879,6 +879,10 @@ namespace PrimMesher
879 else if (this.sides == 24 && this.hollowSides == 4) 879 else if (this.sides == 24 && this.hollowSides == 4)
880 hollow *= 1.414f; 880 hollow *= 1.414f;
881 881
882 bool hasProfileCut = false;
883 if (profileStart < 0.0 || profileEnd < 1.0)
884 hasProfileCut = true;
885
882 Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, true); 886 Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides, true);
883 887
884 if (initialProfileRot != 0.0f) 888 if (initialProfileRot != 0.0f)
@@ -927,9 +931,16 @@ namespace PrimMesher
927 931
928 int numVerts = newLayer.coords.Count; 932 int numVerts = newLayer.coords.Count;
929 Face newFace = new Face(); 933 Face newFace = new Face();
934
930 if (step > 0) 935 if (step > 0)
931 { 936 {
932 for (int i = coordsLen; i < this.coords.Count - 1; i++) 937 int startVert = coordsLen + 1;
938 int endVert = this.coords.Count - 1;
939
940 if (hasProfileCut || hollow > 0.0f)
941 startVert--;
942
943 for (int i = startVert; i < endVert; i++)
933 { 944 {
934 newFace.v1 = i; 945 newFace.v1 = i;
935 newFace.v2 = i - numVerts; 946 newFace.v2 = i - numVerts;
@@ -941,15 +952,19 @@ namespace PrimMesher
941 this.faces.Add(newFace); 952 this.faces.Add(newFace);
942 } 953 }
943 954
944 newFace.v1 = coordsLen - 1; 955 if (hasProfileCut)
945 newFace.v2 = coordsLen - numVerts; 956 {
946 newFace.v3 = coordsLen; 957 newFace.v1 = coordsLen - 1;
947 this.faces.Add(newFace); 958 newFace.v2 = coordsLen - numVerts;
959 newFace.v3 = coordsLen;
960 this.faces.Add(newFace);
961
962 newFace.v1 = coordsLen + numVerts - 1;
963 newFace.v2 = coordsLen - 1;
964 newFace.v3 = coordsLen;
965 this.faces.Add(newFace);
966 }
948 967
949 newFace.v1 = coordsLen + numVerts - 1;
950 newFace.v2 = coordsLen - 1;
951 newFace.v3 = coordsLen;
952 this.faces.Add(newFace);
953 } 968 }
954 969
955 // calc the step for the next iteration of the loop 970 // calc the step for the next iteration of the loop
@@ -1173,7 +1188,7 @@ namespace PrimMesher
1173 1188
1174 public Coord SurfaceNormal(int faceIndex) 1189 public Coord SurfaceNormal(int faceIndex)
1175 { 1190 {
1176 //int numFaces = faces.Count; 1191 int numFaces = faces.Count;
1177 if (faceIndex < 0 || faceIndex >= faces.Count) 1192 if (faceIndex < 0 || faceIndex >= faces.Count)
1178 return new Coord(0.0f, 0.0f, 0.0f); 1193 return new Coord(0.0f, 0.0f, 0.0f);
1179 1194