aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-09 05:18:52 +0000
committerTeravus Ovares2008-02-09 05:18:52 +0000
commitc9b5516ca8664786d85a6c3f48bb831476050c6e (patch)
treed3912f3f2694ee4241e389dbee33fda57bdddada /OpenSim/Region/Physics
parent* Tweaked timing of rapid mesh requests. Helps a race condition. (diff)
downloadopensim-SC_OLD-c9b5516ca8664786d85a6c3f48bb831476050c6e.zip
opensim-SC_OLD-c9b5516ca8664786d85a6c3f48bb831476050c6e.tar.gz
opensim-SC_OLD-c9b5516ca8664786d85a6c3f48bb831476050c6e.tar.bz2
opensim-SC_OLD-c9b5516ca8664786d85a6c3f48bb831476050c6e.tar.xz
* Adds Top Shear support to the Meshmerizer for the Cube prim and the Cylinder prim.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Meshing/Extruder.cs10
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs71
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs3
4 files changed, 87 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs
index 5886c9e..086261b 100644
--- a/OpenSim/Region/Physics/Meshing/Extruder.cs
+++ b/OpenSim/Region/Physics/Meshing/Extruder.cs
@@ -40,6 +40,8 @@ namespace OpenSim.Region.Physics.Meshing
40 public float taperTopFactorY = 1f; 40 public float taperTopFactorY = 1f;
41 public float taperBotFactorX = 1f; 41 public float taperBotFactorX = 1f;
42 public float taperBotFactorY = 1f; 42 public float taperBotFactorY = 1f;
43 public float pushX = 0f;
44 public float pushY = 0f;
43 45
44 public Mesh Extrude(Mesh m) 46 public Mesh Extrude(Mesh m)
45 { 47 {
@@ -54,10 +56,17 @@ namespace OpenSim.Region.Physics.Meshing
54 if (v == null) 56 if (v == null)
55 continue; 57 continue;
56 58
59 // This is the top
60 // Set the Z + .5 to match the rest of the scale of the mesh
61 // Scale it by Size, and Taper the scaling
57 v.Z = +.5f; 62 v.Z = +.5f;
58 v.X *= (size.X * taperTopFactorX); 63 v.X *= (size.X * taperTopFactorX);
59 v.Y *= (size.Y * taperTopFactorY); 64 v.Y *= (size.Y * taperTopFactorY);
60 v.Z *= size.Z; 65 v.Z *= size.Z;
66
67 //Push the top of the object over by the Top Shear amount
68 v.X += pushX * size.X;
69 v.Y += pushY * size.X;
61 } 70 }
62 71
63 foreach (Vertex v in workingMinus.vertices) 72 foreach (Vertex v in workingMinus.vertices)
@@ -65,6 +74,7 @@ namespace OpenSim.Region.Physics.Meshing
65 if (v == null) 74 if (v == null)
66 continue; 75 continue;
67 76
77 // This is the bottom
68 v.Z = -.5f; 78 v.Z = -.5f;
69 v.X *= (size.X * taperBotFactorX); 79 v.X *= (size.X * taperBotFactorX);
70 v.Y *= (size.Y * taperBotFactorY); 80 v.Y *= (size.Y * taperBotFactorY);
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index a2bbd3a..641e25d 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -183,11 +183,14 @@ namespace OpenSim.Region.Physics.Meshing
183 UInt16 profileEnd = primShape.ProfileEnd; 183 UInt16 profileEnd = primShape.ProfileEnd;
184 UInt16 taperX = primShape.PathScaleX; 184 UInt16 taperX = primShape.PathScaleX;
185 UInt16 taperY = primShape.PathScaleY; 185 UInt16 taperY = primShape.PathScaleY;
186 UInt16 pathShearX = primShape.PathShearX;
187 UInt16 pathShearY = primShape.PathShearY;
186 188
187 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); 189 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString());
188 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); 190 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString());
189 //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString()); 191 //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString());
190 //m_log.Error("PathScale:" + primShape.PathScaleX.ToString() + "," + primShape.PathScaleY.ToString()); 192 //m_log.Error("PathScale:" + primShape.PathScaleX.ToString() + "," + primShape.PathScaleY.ToString());
193
191 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface 194 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
192 // of a block are basically the same 195 // of a block are basically the same
193 // They may be warped differently but the shape is identical 196 // They may be warped differently but the shape is identical
@@ -242,7 +245,7 @@ namespace OpenSim.Region.Physics.Meshing
242 // Calculated separately to avoid errors 245 // Calculated separately to avoid errors
243 cutHull.AddVertex(legEnd); 246 cutHull.AddVertex(legEnd);
244 247
245 m_log.Debug(String.Format("Starting cutting of the hollow shape from the prim {1}", 0, primName)); 248 //m_log.Debug(String.Format("Starting cutting of the hollow shape from the prim {1}", 0, primName));
246 SimpleHull cuttedHull = SimpleHull.SubtractHull(outerHull, cutHull); 249 SimpleHull cuttedHull = SimpleHull.SubtractHull(outerHull, cutHull);
247 250
248 outerHull = cuttedHull; 251 outerHull = cuttedHull;
@@ -334,6 +337,37 @@ namespace OpenSim.Region.Physics.Meshing
334 } 337 }
335 } 338 }
336 339
340
341 if (pathShearX != 0)
342 {
343 if (pathShearX > 50) {
344 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
345 extr.pushX = (((float)(256 - pathShearX) / 100) * -1f);
346 // m_log.Warn("pushX: " + extr.pushX);
347 }
348 else
349 {
350 extr.pushX = (float)pathShearX / 100;
351 // m_log.Warn("pushX: " + extr.pushX);
352 }
353 }
354
355 if (pathShearY != 0)
356 {
357 if (pathShearY > 50) {
358 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
359 extr.pushY = (((float)(256 - pathShearY) / 100) * -1f);
360 //m_log.Warn("pushY: " + extr.pushY);
361 }
362 else
363 {
364 extr.pushY = (float)pathShearY / 100;
365 //m_log.Warn("pushY: " + extr.pushY);
366 }
367 }
368
369
370
337 Mesh result = extr.Extrude(m); 371 Mesh result = extr.Extrude(m);
338 result.DumpRaw(baseDir, primName, "Z extruded"); 372 result.DumpRaw(baseDir, primName, "Z extruded");
339 return result; 373 return result;
@@ -346,6 +380,9 @@ namespace OpenSim.Region.Physics.Meshing
346 UInt16 profileEnd = primShape.ProfileEnd; 380 UInt16 profileEnd = primShape.ProfileEnd;
347 UInt16 taperX = primShape.PathScaleX; 381 UInt16 taperX = primShape.PathScaleX;
348 UInt16 taperY = primShape.PathScaleY; 382 UInt16 taperY = primShape.PathScaleY;
383 UInt16 pathShearX = primShape.PathShearX;
384 UInt16 pathShearY = primShape.PathShearY;
385
349 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface 386 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
350 // of a block are basically the same 387 // of a block are basically the same
351 // They may be warped differently but the shape is identical 388 // They may be warped differently but the shape is identical
@@ -653,7 +690,37 @@ namespace OpenSim.Region.Physics.Meshing
653 //m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString()); 690 //m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString());
654 } 691 }
655 } 692 }
656 693
694 if (pathShearX != 0)
695 {
696 if (pathShearX > 50)
697 {
698 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
699 extr.pushX = (((float)(256 - pathShearX) / 100) * -1f);
700 //m_log.Warn("pushX: " + extr.pushX);
701 }
702 else
703 {
704 extr.pushX = (float)pathShearX / 100;
705 //m_log.Warn("pushX: " + extr.pushX);
706 }
707 }
708
709 if (pathShearY != 0)
710 {
711 if (pathShearY > 50)
712 {
713 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
714 extr.pushY = (((float)(256 - pathShearY) / 100) * -1f);
715 //m_log.Warn("pushY: " + extr.pushY);
716 }
717 else
718 {
719 extr.pushY = (float)pathShearY / 100;
720 //m_log.Warn("pushY: " + extr.pushY);
721 }
722 }
723
657 Mesh result = extr.Extrude(m); 724 Mesh result = extr.Extrude(m);
658 result.DumpRaw(baseDir, primName, "Z extruded"); 725 result.DumpRaw(baseDir, primName, "Z extruded");
659 return result; 726 return result;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 52a975e..d171947 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -389,7 +389,12 @@ namespace OpenSim.Region.Physics.OdePlugin
389 { 389 {
390 disableBody(); 390 disableBody();
391 } 391 }
392
393 // This sleeper is there to moderate how long it takes between
394 // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object
392 System.Threading.Thread.Sleep(10); 395 System.Threading.Thread.Sleep(10);
396
397
393 float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory 398 float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
394 int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage 399 int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
395 int VertexCount = vertexList.GetLength(0)/3; 400 int VertexCount = vertexList.GetLength(0)/3;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 0ee8eb5..2b3d186 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1014,6 +1014,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1014 if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100)) 1014 if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100))
1015 return true; 1015 return true;
1016 1016
1017 if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0))
1018 return true;
1019
1017 if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight) 1020 if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight)
1018 return true; 1021 return true;
1019 1022