From c9b5516ca8664786d85a6c3f48bb831476050c6e Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 9 Feb 2008 05:18:52 +0000 Subject: * Adds Top Shear support to the Meshmerizer for the Cube prim and the Cylinder prim. --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 71 ++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs') 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 UInt16 profileEnd = primShape.ProfileEnd; UInt16 taperX = primShape.PathScaleX; UInt16 taperY = primShape.PathScaleY; + UInt16 pathShearX = primShape.PathShearX; + UInt16 pathShearY = primShape.PathShearY; //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString()); //m_log.Error("PathScale:" + primShape.PathScaleX.ToString() + "," + primShape.PathScaleY.ToString()); + // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface // of a block are basically the same // They may be warped differently but the shape is identical @@ -242,7 +245,7 @@ namespace OpenSim.Region.Physics.Meshing // Calculated separately to avoid errors cutHull.AddVertex(legEnd); - m_log.Debug(String.Format("Starting cutting of the hollow shape from the prim {1}", 0, primName)); + //m_log.Debug(String.Format("Starting cutting of the hollow shape from the prim {1}", 0, primName)); SimpleHull cuttedHull = SimpleHull.SubtractHull(outerHull, cutHull); outerHull = cuttedHull; @@ -334,6 +337,37 @@ namespace OpenSim.Region.Physics.Meshing } } + + if (pathShearX != 0) + { + if (pathShearX > 50) { + // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50 + extr.pushX = (((float)(256 - pathShearX) / 100) * -1f); + // m_log.Warn("pushX: " + extr.pushX); + } + else + { + extr.pushX = (float)pathShearX / 100; + // m_log.Warn("pushX: " + extr.pushX); + } + } + + if (pathShearY != 0) + { + if (pathShearY > 50) { + // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50 + extr.pushY = (((float)(256 - pathShearY) / 100) * -1f); + //m_log.Warn("pushY: " + extr.pushY); + } + else + { + extr.pushY = (float)pathShearY / 100; + //m_log.Warn("pushY: " + extr.pushY); + } + } + + + Mesh result = extr.Extrude(m); result.DumpRaw(baseDir, primName, "Z extruded"); return result; @@ -346,6 +380,9 @@ namespace OpenSim.Region.Physics.Meshing UInt16 profileEnd = primShape.ProfileEnd; UInt16 taperX = primShape.PathScaleX; UInt16 taperY = primShape.PathScaleY; + UInt16 pathShearX = primShape.PathShearX; + UInt16 pathShearY = primShape.PathShearY; + // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface // of a block are basically the same // They may be warped differently but the shape is identical @@ -653,7 +690,37 @@ namespace OpenSim.Region.Physics.Meshing //m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString()); } } - + + if (pathShearX != 0) + { + if (pathShearX > 50) + { + // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50 + extr.pushX = (((float)(256 - pathShearX) / 100) * -1f); + //m_log.Warn("pushX: " + extr.pushX); + } + else + { + extr.pushX = (float)pathShearX / 100; + //m_log.Warn("pushX: " + extr.pushX); + } + } + + if (pathShearY != 0) + { + if (pathShearY > 50) + { + // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50 + extr.pushY = (((float)(256 - pathShearY) / 100) * -1f); + //m_log.Warn("pushY: " + extr.pushY); + } + else + { + extr.pushY = (float)pathShearY / 100; + //m_log.Warn("pushY: " + extr.pushY); + } + } + Mesh result = extr.Extrude(m); result.DumpRaw(baseDir, primName, "Z extruded"); return result; -- cgit v1.1