aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOdeMeshing
diff options
context:
space:
mode:
authorUbitUmarov2016-09-03 07:51:53 +0100
committerUbitUmarov2016-09-03 07:51:53 +0100
commit9aec227767cf726216514d0494f11b5d8bf5b807 (patch)
tree8f308f4c1eefa19954fc30a560ac780f8a8e916a /OpenSim/Region/PhysicsModules/ubOdeMeshing
parentmerge issue (diff)
parenttests making sure evering thing is coerently wrong.. (diff)
downloadopensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.zip
opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.gz
opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.bz2
opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs87
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs20
2 files changed, 87 insertions, 20 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
index 6e43cf8..d9544db 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
@@ -121,9 +121,9 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
121 121
122 CacheExpire = TimeSpan.FromHours(fcache); 122 CacheExpire = TimeSpan.FromHours(fcache);
123 123
124 if(doMeshFileCache && cachePath != "") 124 lock (diskLock)
125 { 125 {
126 lock (diskLock) 126 if(doMeshFileCache && cachePath != "")
127 { 127 {
128 try 128 try
129 { 129 {
@@ -619,7 +619,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
619 vs.Clear(); 619 vs.Clear();
620 continue; 620 continue;
621 } 621 }
622 622/*
623 if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f)) 623 if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
624 { 624 {
625 vs.Clear(); 625 vs.Clear();
@@ -657,6 +657,45 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
657 f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3); 657 f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
658 faces.Add(f); 658 faces.Add(f);
659 } 659 }
660*/
661 List<int> indices;
662 if (!HullUtils.ComputeHull(vs, out indices))
663 {
664 vs.Clear();
665 continue;
666 }
667
668 nverts = vs.Count;
669 nindexs = indices.Count;
670
671 if (nindexs % 3 != 0)
672 {
673 vs.Clear();
674 continue;
675 }
676
677 for (i = 0; i < nverts; i++)
678 {
679 c.X = vs[i].x;
680 c.Y = vs[i].y;
681 c.Z = vs[i].z;
682 coords.Add(c);
683 }
684
685 for (i = 0; i < nindexs; i += 3)
686 {
687 t1 = indices[i];
688 if (t1 > nverts)
689 break;
690 t2 = indices[i + 1];
691 if (t2 > nverts)
692 break;
693 t3 = indices[i + 2];
694 if (t3 > nverts)
695 break;
696 f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
697 faces.Add(f);
698 }
660 vertsoffset += nverts; 699 vertsoffset += nverts;
661 vs.Clear(); 700 vs.Clear();
662 } 701 }
@@ -686,13 +725,15 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
686 vs.Add(f3); 725 vs.Add(f3);
687 } 726 }
688 727
689 if (vs.Count < 3) 728 nverts = vs.Count;
729
730 if (nverts < 3)
690 { 731 {
691 vs.Clear(); 732 vs.Clear();
692 return false; 733 return false;
693 } 734 }
694 735
695 if (vs.Count < 5) 736 if (nverts < 5)
696 { 737 {
697 foreach (float3 point in vs) 738 foreach (float3 point in vs)
698 { 739 {
@@ -701,10 +742,11 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
701 c.Z = point.z; 742 c.Z = point.z;
702 coords.Add(c); 743 coords.Add(c);
703 } 744 }
745
704 f = new Face(0, 1, 2); 746 f = new Face(0, 1, 2);
705 faces.Add(f); 747 faces.Add(f);
706 748
707 if (vs.Count == 4) 749 if (nverts == 4)
708 { 750 {
709 f = new Face(0, 2, 3); 751 f = new Face(0, 2, 3);
710 faces.Add(f); 752 faces.Add(f);
@@ -716,7 +758,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
716 vs.Clear(); 758 vs.Clear();
717 return true; 759 return true;
718 } 760 }
719 761/*
720 if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f)) 762 if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
721 return false; 763 return false;
722 764
@@ -747,7 +789,38 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
747 f = new Face(t1, t2, t3); 789 f = new Face(t1, t2, t3);
748 faces.Add(f); 790 faces.Add(f);
749 } 791 }
792*/
793 List<int> indices;
794 if (!HullUtils.ComputeHull(vs, out indices))
795 return false;
796
797 nindexs = indices.Count;
750 798
799 if (nindexs % 3 != 0)
800 return false;
801
802 for (i = 0; i < nverts; i++)
803 {
804 c.X = vs[i].x;
805 c.Y = vs[i].y;
806 c.Z = vs[i].z;
807 coords.Add(c);
808 }
809 for (i = 0; i < nindexs; i += 3)
810 {
811 t1 = indices[i];
812 if (t1 > nverts)
813 break;
814 t2 = indices[i + 1];
815 if (t2 > nverts)
816 break;
817 t3 = indices[i + 2];
818 if (t3 > nverts)
819 break;
820 f = new Face(t1, t2, t3);
821 faces.Add(f);
822 }
823 vs.Clear();
751 if (coords.Count > 0 && faces.Count > 0) 824 if (coords.Count > 0 && faces.Count > 0)
752 return true; 825 return true;
753 } 826 }
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs
index 1c75db6..2ca2af7 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs
@@ -57,7 +57,7 @@ namespace PrimMesher
57 int numLodPixels = lod * lod; // (32 * 2)^2 = 64^2 pixels for default sculpt map image 57 int numLodPixels = lod * lod; // (32 * 2)^2 = 64^2 pixels for default sculpt map image
58 58
59 bool needsScaling = false; 59 bool needsScaling = false;
60 bool smallMap = false; 60 bool smallMap = false;
61 61
62 width = bmW; 62 width = bmW;
63 height = bmH; 63 height = bmH;
@@ -69,16 +69,8 @@ namespace PrimMesher
69 needsScaling = true; 69 needsScaling = true;
70 } 70 }
71 71
72 try 72 if (needsScaling)
73 { 73 bm = ScaleImage(bm, width, height);
74 if (needsScaling)
75 bm = ScaleImage(bm, width, height);
76 }
77
78 catch (Exception e)
79 {
80 throw new Exception("Exception in ScaleImage(): e: " + e.ToString());
81 }
82 74
83 if (width * height > numLodPixels) 75 if (width * height > numLodPixels)
84 { 76 {
@@ -129,11 +121,15 @@ namespace PrimMesher
129 } 121 }
130 catch (Exception e) 122 catch (Exception e)
131 { 123 {
124 if (needsScaling)
125 bm.Dispose();
132 throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e.ToString()); 126 throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e.ToString());
133 } 127 }
134 128
135 width++; 129 width++;
136 height++; 130 height++;
131 if(needsScaling)
132 bm.Dispose();
137 } 133 }
138 134
139 public List<List<Coord>> ToRows(bool mirror) 135 public List<List<Coord>> ToRows(bool mirror)
@@ -168,11 +164,9 @@ namespace PrimMesher
168 164
169 private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight) 165 private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight)
170 { 166 {
171
172 Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb); 167 Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb);
173 168
174 Color c; 169 Color c;
175
176 170
177 // will let last step to be eventually diferent, as seems to be in sl 171 // will let last step to be eventually diferent, as seems to be in sl
178 172