aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorDahlia Trimble2008-07-21 23:08:23 +0000
committerDahlia Trimble2008-07-21 23:08:23 +0000
commit492b25362ca85153c40c35152e317e2a16ff8acc (patch)
tree638d2a902c1257a77b183b4c71154193e1b1875d /OpenSim/Region/Physics
parent* Give new uuids to all the objects loaded in from an archive. (diff)
downloadopensim-SC-492b25362ca85153c40c35152e317e2a16ff8acc.zip
opensim-SC-492b25362ca85153c40c35152e317e2a16ff8acc.tar.gz
opensim-SC-492b25362ca85153c40c35152e317e2a16ff8acc.tar.bz2
opensim-SC-492b25362ca85153c40c35152e317e2a16ff8acc.tar.xz
Clean up Meshmerizer.cs a bit to make it more readable
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs252
1 files changed, 2 insertions, 250 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 045a25d..984114b 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -265,97 +265,8 @@ namespace OpenSim.Region.Physics.Meshing
265 { 265 {
266 float hollowFactorF = (float)fhollowFactor / (float)50000; 266 float hollowFactorF = (float)fhollowFactor / (float)50000;
267 267
268 //Vertex IQ1Q15 = new Vertex(-0.35f * hollowFactorF, -0.35f * hollowFactorF, 0.0f);
269 //Vertex IQ1Q16 = new Vertex(-0.30f * hollowFactorF, -0.40f * hollowFactorF, 0.0f);
270 //Vertex IQ1Q17 = new Vertex(-0.24f * hollowFactorF, -0.43f * hollowFactorF, 0.0f);
271 //Vertex IQ1Q18 = new Vertex(-0.18f * hollowFactorF, -0.46f * hollowFactorF, 0.0f);
272 //Vertex IQ1Q19 = new Vertex(-0.11f * hollowFactorF, -0.48f * hollowFactorF, 0.0f);
273
274 //Vertex IQ2Q10 = new Vertex(+0.0f * hollowFactorF, -0.50f * hollowFactorF, 0.0f);
275 //Vertex IQ2Q11 = new Vertex(+0.11f * hollowFactorF, -0.48f * hollowFactorF, 0.0f);
276 //Vertex IQ2Q12 = new Vertex(+0.18f * hollowFactorF, -0.46f * hollowFactorF, 0.0f);
277 //Vertex IQ2Q13 = new Vertex(+0.24f * hollowFactorF, -0.43f * hollowFactorF, 0.0f);
278 //Vertex IQ2Q14 = new Vertex(+0.30f * hollowFactorF, -0.40f * hollowFactorF, 0.0f);
279 //Vertex IQ2Q15 = new Vertex(+0.35f * hollowFactorF, -0.35f * hollowFactorF, 0.0f);
280 //Vertex IQ2Q16 = new Vertex(+0.40f * hollowFactorF, -0.30f * hollowFactorF, 0.0f);
281 //Vertex IQ2Q17 = new Vertex(+0.43f * hollowFactorF, -0.24f * hollowFactorF, 0.0f);
282 //Vertex IQ2Q18 = new Vertex(+0.46f * hollowFactorF, -0.18f * hollowFactorF, 0.0f);
283 //Vertex IQ2Q19 = new Vertex(+0.48f * hollowFactorF, -0.11f * hollowFactorF, 0.0f);
284
285 //Vertex IQ2Q20 = new Vertex(+0.50f * hollowFactorF, +0.0f * hollowFactorF, 0.0f);
286 //Vertex IQ2Q21 = new Vertex(+0.48f * hollowFactorF, +0.11f * hollowFactorF, 0.0f);
287 //Vertex IQ2Q22 = new Vertex(+0.46f * hollowFactorF, +0.18f * hollowFactorF, 0.0f);
288 //Vertex IQ2Q23 = new Vertex(+0.43f * hollowFactorF, +0.24f * hollowFactorF, 0.0f);
289 //Vertex IQ2Q24 = new Vertex(+0.40f * hollowFactorF, +0.30f * hollowFactorF, 0.0f);
290 //Vertex IQ2Q25 = new Vertex(+0.35f * hollowFactorF, +0.35f * hollowFactorF, 0.0f);
291 //Vertex IQ2Q26 = new Vertex(+0.30f * hollowFactorF, +0.40f * hollowFactorF, 0.0f);
292 //Vertex IQ2Q27 = new Vertex(+0.24f * hollowFactorF, +0.43f * hollowFactorF, 0.0f);
293 //Vertex IQ2Q28 = new Vertex(+0.18f * hollowFactorF, +0.46f * hollowFactorF, 0.0f);
294 //Vertex IQ2Q29 = new Vertex(+0.11f * hollowFactorF, +0.48f * hollowFactorF, 0.0f);
295
296 //Vertex IQ1Q20 = new Vertex(+0.0f * hollowFactorF, +0.50f * hollowFactorF, 0.0f);
297 //Vertex IQ1Q21 = new Vertex(-0.11f * hollowFactorF, +0.48f * hollowFactorF, 0.0f);
298 //Vertex IQ1Q22 = new Vertex(-0.18f * hollowFactorF, +0.46f * hollowFactorF, 0.0f);
299 //Vertex IQ1Q23 = new Vertex(-0.24f * hollowFactorF, +0.43f * hollowFactorF, 0.0f);
300 //Vertex IQ1Q24 = new Vertex(-0.30f * hollowFactorF, +0.40f * hollowFactorF, 0.0f);
301 //Vertex IQ1Q25 = new Vertex(-0.35f * hollowFactorF, +0.35f * hollowFactorF, 0.0f);
302 //Vertex IQ1Q26 = new Vertex(-0.40f * hollowFactorF, +0.30f * hollowFactorF, 0.0f);
303 //Vertex IQ1Q27 = new Vertex(-0.43f * hollowFactorF, +0.24f * hollowFactorF, 0.0f);
304 //Vertex IQ1Q28 = new Vertex(-0.46f * hollowFactorF, +0.18f * hollowFactorF, 0.0f);
305 //Vertex IQ1Q29 = new Vertex(-0.48f * hollowFactorF, +0.11f * hollowFactorF, 0.0f);
306
307 //Vertex IQ1Q10 = new Vertex(-0.50f * hollowFactorF, +0.0f * hollowFactorF, 0.0f);
308 //Vertex IQ1Q11 = new Vertex(-0.48f * hollowFactorF, -0.11f * hollowFactorF, 0.0f);
309 //Vertex IQ1Q12 = new Vertex(-0.46f * hollowFactorF, -0.18f * hollowFactorF, 0.0f);
310 //Vertex IQ1Q13 = new Vertex(-0.43f * hollowFactorF, -0.24f * hollowFactorF, 0.0f);
311 //Vertex IQ1Q14 = new Vertex(-0.40f * hollowFactorF, -0.30f * hollowFactorF, 0.0f);
312
313 //Counter clockwise around the quadrants 268 //Counter clockwise around the quadrants
314 holeHull = new SimpleHull(); 269 holeHull = new SimpleHull();
315 //holeHull.AddVertex(IQ1Q15);
316 //holeHull.AddVertex(IQ1Q14);
317 //holeHull.AddVertex(IQ1Q13);
318 //holeHull.AddVertex(IQ1Q12);
319 //holeHull.AddVertex(IQ1Q11);
320 //holeHull.AddVertex(IQ1Q10);
321
322 //holeHull.AddVertex(IQ1Q29);
323 //holeHull.AddVertex(IQ1Q28);
324 //holeHull.AddVertex(IQ1Q27);
325 //holeHull.AddVertex(IQ1Q26);
326 //holeHull.AddVertex(IQ1Q25);
327 //holeHull.AddVertex(IQ1Q24);
328 //holeHull.AddVertex(IQ1Q23);
329 //holeHull.AddVertex(IQ1Q22);
330 //holeHull.AddVertex(IQ1Q21);
331 //holeHull.AddVertex(IQ1Q20);
332
333 //holeHull.AddVertex(IQ2Q29);
334 //holeHull.AddVertex(IQ2Q28);
335 //holeHull.AddVertex(IQ2Q27);
336 //holeHull.AddVertex(IQ2Q26);
337 //holeHull.AddVertex(IQ2Q25);
338 //holeHull.AddVertex(IQ2Q24);
339 //holeHull.AddVertex(IQ2Q23);
340 //holeHull.AddVertex(IQ2Q22);
341 //holeHull.AddVertex(IQ2Q21);
342 //holeHull.AddVertex(IQ2Q20);
343
344 //holeHull.AddVertex(IQ2Q19);
345 //holeHull.AddVertex(IQ2Q18);
346 //holeHull.AddVertex(IQ2Q17);
347 //holeHull.AddVertex(IQ2Q16);
348 //holeHull.AddVertex(IQ2Q15);
349 //holeHull.AddVertex(IQ2Q14);
350 //holeHull.AddVertex(IQ2Q13);
351 //holeHull.AddVertex(IQ2Q12);
352 //holeHull.AddVertex(IQ2Q11);
353 //holeHull.AddVertex(IQ2Q10);
354
355 //holeHull.AddVertex(IQ1Q19);
356 //holeHull.AddVertex(IQ1Q18);
357 //holeHull.AddVertex(IQ1Q17);
358 //holeHull.AddVertex(IQ1Q16);
359 270
360 holeHull.AddVertex(new Vertex(0.353553f * hollowFactorF, 0.353553f * hollowFactorF, 0.0f)); // 45 degrees 271 holeHull.AddVertex(new Vertex(0.353553f * hollowFactorF, 0.353553f * hollowFactorF, 0.0f)); // 45 degrees
361 holeHull.AddVertex(new Vertex(0.433013f * hollowFactorF, 0.250000f * hollowFactorF, 0.0f)); // 30 degrees 272 holeHull.AddVertex(new Vertex(0.433013f * hollowFactorF, 0.250000f * hollowFactorF, 0.0f)); // 30 degrees
@@ -440,11 +351,6 @@ namespace OpenSim.Region.Physics.Meshing
440 351
441 // bottom 352 // bottom
442 353
443 //box.Add(new Vertex(maxX, maxY, minZ));
444 //box.Add(new Vertex(minX, maxY, minZ));
445 //box.Add(new Vertex(minX, minY, minZ));
446 //box.Add(new Vertex(maxX, minY, minZ));
447
448 box.Add(new Vertex(minX, maxY, minZ)); 354 box.Add(new Vertex(minX, maxY, minZ));
449 box.Add(new Vertex(maxX, maxY, minZ)); 355 box.Add(new Vertex(maxX, maxY, minZ));
450 box.Add(new Vertex(maxX, minY, minZ)); 356 box.Add(new Vertex(maxX, minY, minZ));
@@ -549,10 +455,7 @@ namespace OpenSim.Region.Physics.Meshing
549 Vertex MP = new Vertex(-0.5f, +0.5f, 0.0f); 455 Vertex MP = new Vertex(-0.5f, +0.5f, 0.0f);
550 456
551 SimpleHull outerHull = new SimpleHull(); 457 SimpleHull outerHull = new SimpleHull();
552 //outerHull.AddVertex(MM); 458
553 //outerHull.AddVertex(PM);
554 //outerHull.AddVertex(PP);
555 //outerHull.AddVertex(MP);
556 outerHull.AddVertex(PP); 459 outerHull.AddVertex(PP);
557 outerHull.AddVertex(MP); 460 outerHull.AddVertex(MP);
558 outerHull.AddVertex(MM); 461 outerHull.AddVertex(MM);
@@ -805,98 +708,8 @@ namespace OpenSim.Region.Physics.Meshing
805 // The mapping to Scene space is done later during the "extrusion" phase 708 // The mapping to Scene space is done later during the "extrusion" phase
806 709
807 // Base 710 // Base
808 // Q1Q15 = Quadrant 1, Quadrant1, Vertex 5
809 //Vertex Q1Q15 = new Vertex(-0.35f, -0.35f, 0.0f);
810 //Vertex Q1Q16 = new Vertex(-0.30f, -0.40f, 0.0f);
811 //Vertex Q1Q17 = new Vertex(-0.24f, -0.43f, 0.0f);
812 //Vertex Q1Q18 = new Vertex(-0.18f, -0.46f, 0.0f);
813 //Vertex Q1Q19 = new Vertex(-0.11f, -0.48f, 0.0f);
814
815 //Vertex Q2Q10 = new Vertex(+0.0f, -0.50f, 0.0f);
816 //Vertex Q2Q11 = new Vertex(+0.11f, -0.48f, 0.0f);
817 //Vertex Q2Q12 = new Vertex(+0.18f, -0.46f, 0.0f);
818 //Vertex Q2Q13 = new Vertex(+0.24f, -0.43f, 0.0f);
819 //Vertex Q2Q14 = new Vertex(+0.30f, -0.40f, 0.0f);
820 //Vertex Q2Q15 = new Vertex(+0.35f, -0.35f, 0.0f);
821 //Vertex Q2Q16 = new Vertex(+0.40f, -0.30f, 0.0f);
822 //Vertex Q2Q17 = new Vertex(+0.43f, -0.24f, 0.0f);
823 //Vertex Q2Q18 = new Vertex(+0.46f, -0.18f, 0.0f);
824 //Vertex Q2Q19 = new Vertex(+0.48f, -0.11f, 0.0f);
825
826 //Vertex Q2Q20 = new Vertex(+0.50f, +0.0f, 0.0f);
827 //Vertex Q2Q21 = new Vertex(+0.48f, +0.11f, 0.0f);
828 //Vertex Q2Q22 = new Vertex(+0.46f, +0.18f, 0.0f);
829 //Vertex Q2Q23 = new Vertex(+0.43f, +0.24f, 0.0f);
830 //Vertex Q2Q24 = new Vertex(+0.40f, +0.30f, 0.0f);
831 //Vertex Q2Q25 = new Vertex(+0.35f, +0.35f, 0.0f);
832 //Vertex Q2Q26 = new Vertex(+0.30f, +0.40f, 0.0f);
833 //Vertex Q2Q27 = new Vertex(+0.24f, +0.43f, 0.0f);
834 //Vertex Q2Q28 = new Vertex(+0.18f, +0.46f, 0.0f);
835 //Vertex Q2Q29 = new Vertex(+0.11f, +0.48f, 0.0f);
836
837 //Vertex Q1Q20 = new Vertex(+0.0f, +0.50f, 0.0f);
838 //Vertex Q1Q21 = new Vertex(-0.11f, +0.48f, 0.0f);
839 //Vertex Q1Q22 = new Vertex(-0.18f, +0.46f, 0.0f);
840 //Vertex Q1Q23 = new Vertex(-0.24f, +0.43f, 0.0f);
841 //Vertex Q1Q24 = new Vertex(-0.30f, +0.40f, 0.0f);
842 //Vertex Q1Q25 = new Vertex(-0.35f, +0.35f, 0.0f);
843 //Vertex Q1Q26 = new Vertex(-0.40f, +0.30f, 0.0f);
844 //Vertex Q1Q27 = new Vertex(-0.43f, +0.24f, 0.0f);
845 //Vertex Q1Q28 = new Vertex(-0.46f, +0.18f, 0.0f);
846 //Vertex Q1Q29 = new Vertex(-0.48f, +0.11f, 0.0f);
847
848 //Vertex Q1Q10 = new Vertex(-0.50f, +0.0f, 0.0f);
849 //Vertex Q1Q11 = new Vertex(-0.48f, -0.11f, 0.0f);
850 //Vertex Q1Q12 = new Vertex(-0.46f, -0.18f, 0.0f);
851 //Vertex Q1Q13 = new Vertex(-0.43f, -0.24f, 0.0f);
852 //Vertex Q1Q14 = new Vertex(-0.40f, -0.30f, 0.0f);
853 711
854 SimpleHull outerHull = new SimpleHull(); 712 SimpleHull outerHull = new SimpleHull();
855 //Clockwise around the quadrants
856 //outerHull.AddVertex(Q1Q15);
857 //outerHull.AddVertex(Q1Q16);
858 //outerHull.AddVertex(Q1Q17);
859 //outerHull.AddVertex(Q1Q18);
860 //outerHull.AddVertex(Q1Q19);
861
862 //outerHull.AddVertex(Q2Q10);
863 //outerHull.AddVertex(Q2Q11);
864 //outerHull.AddVertex(Q2Q12);
865 //outerHull.AddVertex(Q2Q13);
866 //outerHull.AddVertex(Q2Q14);
867 //outerHull.AddVertex(Q2Q15);
868 //outerHull.AddVertex(Q2Q16);
869 //outerHull.AddVertex(Q2Q17);
870 //outerHull.AddVertex(Q2Q18);
871 //outerHull.AddVertex(Q2Q19);
872
873 //outerHull.AddVertex(Q2Q20);
874 //outerHull.AddVertex(Q2Q21);
875 //outerHull.AddVertex(Q2Q22);
876 //outerHull.AddVertex(Q2Q23);
877 //outerHull.AddVertex(Q2Q24);
878 //outerHull.AddVertex(Q2Q25);
879 //outerHull.AddVertex(Q2Q26);
880 //outerHull.AddVertex(Q2Q27);
881 //outerHull.AddVertex(Q2Q28);
882 //outerHull.AddVertex(Q2Q29);
883
884 //outerHull.AddVertex(Q1Q20);
885 //outerHull.AddVertex(Q1Q21);
886 //outerHull.AddVertex(Q1Q22);
887 //outerHull.AddVertex(Q1Q23);
888 //outerHull.AddVertex(Q1Q24);
889 //outerHull.AddVertex(Q1Q25);
890 //outerHull.AddVertex(Q1Q26);
891 //outerHull.AddVertex(Q1Q27);
892 //outerHull.AddVertex(Q1Q28);
893 //outerHull.AddVertex(Q1Q29);
894
895 //outerHull.AddVertex(Q1Q10);
896 //outerHull.AddVertex(Q1Q11);
897 //outerHull.AddVertex(Q1Q12);
898 //outerHull.AddVertex(Q1Q13);
899 //outerHull.AddVertex(Q1Q14);
900 713
901 // counter-clockwise around the quadrants, start at 45 degrees 714 // counter-clockwise around the quadrants, start at 45 degrees
902 715
@@ -1182,9 +995,7 @@ namespace OpenSim.Region.Physics.Meshing
1182 995
1183 996
1184 SimpleHull outerHull = new SimpleHull(); 997 SimpleHull outerHull = new SimpleHull();
1185 //outerHull.AddVertex(MM); 998
1186 //outerHull.AddVertex(PM);
1187 //outerHull.AddVertex(PP);
1188 outerHull.AddVertex(PP); 999 outerHull.AddVertex(PP);
1189 outerHull.AddVertex(MM); 1000 outerHull.AddVertex(MM);
1190 outerHull.AddVertex(PM); 1001 outerHull.AddVertex(PM);
@@ -2130,53 +1941,6 @@ namespace OpenSim.Region.Physics.Meshing
2130 CalcNormals(mesh); 1941 CalcNormals(mesh);
2131 } 1942 }
2132 1943
2133 //else
2134 //{
2135 // switch (primShape.ProfileShape)
2136 // {
2137 // case ProfileShape.Square:
2138 // mesh = CreateBoxMesh(primName, primShape, size);
2139 // CalcNormals(mesh);
2140 // break;
2141 // case ProfileShape.Circle:
2142 // if (primShape.PathCurve == (byte)Extrusion.Straight)
2143 // {
2144 // mesh = CreateCylinderMesh(primName, primShape, size);
2145 // CalcNormals(mesh);
2146 // }
2147
2148 // // look at LLObject.cs in libsecondlife for how to know the prim type
2149 // // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
2150 // else if ((primShape.ProfileCurve & 0x07) == (byte)LLObject.ProfileCurve.Circle && LLObject.UnpackPathScale(primShape.PathScaleY) <= 0.75f)
2151 // { // dahlia's favorite, a torus :)
2152 // mesh = CreateCylinderMesh(primName, primShape, size);
2153 // CalcNormals(mesh);
2154 // }
2155
2156 // break;
2157 // case ProfileShape.HalfCircle:
2158 // if (primShape.PathCurve == (byte)Extrusion.Curve1)
2159 // {
2160 // mesh = CreateSphereMesh(primName, primShape, size);
2161 // CalcNormals(mesh);
2162 // }
2163 // break;
2164
2165 // case ProfileShape.EquilateralTriangle:
2166 // mesh = CreatePrismMesh(primName, primShape, size);
2167 // CalcNormals(mesh);
2168 // break;
2169
2170 // default:
2171 // mesh = CreateBoxMesh(primName, primShape, size);
2172 // CalcNormals(mesh);
2173 // //Set default mesh to cube otherwise it'll return
2174 // // null and crash on the 'setMesh' method in the physics plugins.
2175 // //mesh = null;
2176 // break;
2177 // }
2178 //}
2179
2180 if (mesh != null) 1944 if (mesh != null)
2181 { 1945 {
2182 if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh) 1946 if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
@@ -2191,18 +1955,6 @@ namespace OpenSim.Region.Physics.Meshing
2191 // trim the vertex and triangle lists to free up memory 1955 // trim the vertex and triangle lists to free up memory
2192 mesh.vertices.TrimExcess(); 1956 mesh.vertices.TrimExcess();
2193 mesh.triangles.TrimExcess(); 1957 mesh.triangles.TrimExcess();
2194
2195 //int vertCount = 0;
2196 //foreach (Vertex v in mesh.vertices)
2197 // if (v != null)
2198 // vertCount++;
2199 //mesh.vertices.Capacity = vertCount;
2200
2201 //int triCount = 0;
2202 //foreach (Triangle t in mesh.triangles)
2203 // if (t != null)
2204 // triCount++;
2205 //mesh.triangles.Capacity = triCount;
2206 } 1958 }
2207 1959
2208 return mesh; 1960 return mesh;