aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs119
1 files changed, 118 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 80f5bd1..d4b6a50 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Region.Physics.Meshing
58 // raw files can be imported by blender so a visual inspection of the results can be done 58 // raw files can be imported by blender so a visual inspection of the results can be done
59 // const string baseDir = "rawFiles"; 59 // const string baseDir = "rawFiles";
60 private const string baseDir = null; //"rawFiles"; 60 private const string baseDir = null; //"rawFiles";
61 private const float DEG_TO_RAD = 0.01745329238f;
61 62
62// TODO: unused 63// TODO: unused
63// private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, 64// private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2,
@@ -195,6 +196,7 @@ namespace OpenSim.Region.Physics.Meshing
195 196
196 break; 197 break;
197 198
199 case ProfileShape.HalfCircle:
198 case ProfileShape.Circle: 200 case ProfileShape.Circle:
199 if (pbs.PathCurve == (byte)Extrusion.Straight) 201 if (pbs.PathCurve == (byte)Extrusion.Straight)
200 { 202 {
@@ -359,6 +361,8 @@ namespace OpenSim.Region.Physics.Meshing
359 UInt16 taperY = primShape.PathScaleY; 361 UInt16 taperY = primShape.PathScaleY;
360 UInt16 pathShearX = primShape.PathShearX; 362 UInt16 pathShearX = primShape.PathShearX;
361 UInt16 pathShearY = primShape.PathShearY; 363 UInt16 pathShearY = primShape.PathShearY;
364 Int16 twistTop = primShape.PathTwistBegin;
365 Int16 twistBot = primShape.PathTwist;
362 366
363 367
364 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); 368 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString());
@@ -531,7 +535,42 @@ namespace OpenSim.Region.Physics.Meshing
531 //m_log.Warn("pushY: " + extr.pushY); 535 //m_log.Warn("pushY: " + extr.pushY);
532 } 536 }
533 } 537 }
534 538
539 if (twistTop != 0)
540 {
541 extr.twistTop = 180 * ((float)twistTop / 100);
542 if (extr.twistTop > 0)
543 {
544 extr.twistTop = 360 - (-1 * extr.twistTop);
545
546 }
547
548
549 extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD);
550 }
551
552 float twistMid = ((twistTop + twistBot) * 0.5f);
553
554 if (twistMid != 0)
555 {
556 extr.twistMid = 180 * ((float)twistMid / 100);
557 if (extr.twistMid > 0)
558 {
559 extr.twistMid = 360 - (-1 * extr.twistMid);
560 }
561 extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD);
562 }
563
564 if (twistBot != 0)
565 {
566 extr.twistBot = 180 * ((float)twistBot / 100);
567 if (extr.twistBot > 0)
568 {
569 extr.twistBot = 360 - (-1 * extr.twistBot);
570 }
571 extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD);
572 }
573
535 Mesh result = extr.Extrude(m); 574 Mesh result = extr.Extrude(m);
536 result.DumpRaw(baseDir, primName, "Z extruded"); 575 result.DumpRaw(baseDir, primName, "Z extruded");
537 return result; 576 return result;
@@ -540,6 +579,7 @@ namespace OpenSim.Region.Physics.Meshing
540 private static Mesh CreateCyllinderMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) 579 private static Mesh CreateCyllinderMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size)
541 // Builds the z (+ and -) surfaces of a box shaped prim 580 // Builds the z (+ and -) surfaces of a box shaped prim
542 { 581 {
582
543 UInt16 hollowFactor = primShape.ProfileHollow; 583 UInt16 hollowFactor = primShape.ProfileHollow;
544 UInt16 profileBegin = primShape.ProfileBegin; 584 UInt16 profileBegin = primShape.ProfileBegin;
545 UInt16 profileEnd = primShape.ProfileEnd; 585 UInt16 profileEnd = primShape.ProfileEnd;
@@ -547,6 +587,9 @@ namespace OpenSim.Region.Physics.Meshing
547 UInt16 taperY = primShape.PathScaleY; 587 UInt16 taperY = primShape.PathScaleY;
548 UInt16 pathShearX = primShape.PathShearX; 588 UInt16 pathShearX = primShape.PathShearX;
549 UInt16 pathShearY = primShape.PathShearY; 589 UInt16 pathShearY = primShape.PathShearY;
590 Int16 twistBot = primShape.PathTwist;
591 Int16 twistTop = primShape.PathTwistBegin;
592
550 593
551 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface 594 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
552 // of a block are basically the same 595 // of a block are basically the same
@@ -797,8 +840,45 @@ namespace OpenSim.Region.Physics.Meshing
797 extr.pushY = (float)pathShearY / 100; 840 extr.pushY = (float)pathShearY / 100;
798 //m_log.Warn("pushY: " + extr.pushY); 841 //m_log.Warn("pushY: " + extr.pushY);
799 } 842 }
843
844 }
845
846 if (twistTop != 0)
847 {
848 extr.twistTop = 180 * ((float)twistTop / 100);
849 if (extr.twistTop > 0)
850 {
851 extr.twistTop = 360 - (-1 * extr.twistTop);
852
853 }
854
855
856 extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD);
857 }
858
859 float twistMid = ((twistTop + twistBot) * 0.5f);
860
861 if (twistMid != 0)
862 {
863 extr.twistMid = 180 * ((float)twistMid / 100);
864 if (extr.twistMid > 0)
865 {
866 extr.twistMid = 360 - (-1 * extr.twistMid);
867 }
868 extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD);
869 }
870
871 if (twistBot != 0)
872 {
873 extr.twistBot = 180 * ((float)twistBot / 100);
874 if (extr.twistBot > 0)
875 {
876 extr.twistBot = 360 - (-1 * extr.twistBot);
877 }
878 extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD);
800 } 879 }
801 880
881 //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString());
802 Mesh result = extr.Extrude(m); 882 Mesh result = extr.Extrude(m);
803 result.DumpRaw(baseDir, primName, "Z extruded"); 883 result.DumpRaw(baseDir, primName, "Z extruded");
804 return result; 884 return result;
@@ -815,6 +895,8 @@ namespace OpenSim.Region.Physics.Meshing
815 UInt16 pathShearX = primShape.PathShearX; 895 UInt16 pathShearX = primShape.PathShearX;
816 UInt16 pathShearY = primShape.PathShearY; 896 UInt16 pathShearY = primShape.PathShearY;
817 897
898 Int16 twistTop = primShape.PathTwistBegin;
899 Int16 twistBot = primShape.PathTwist;
818 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); 900 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString());
819 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); 901 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString());
820 //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString()); 902 //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString());
@@ -984,6 +1066,41 @@ namespace OpenSim.Region.Physics.Meshing
984 } 1066 }
985 } 1067 }
986 1068
1069 if (twistTop != 0)
1070 {
1071 extr.twistTop = 180 * ((float)twistTop / 100);
1072 if (extr.twistTop > 0)
1073 {
1074 extr.twistTop = 360 - (-1 * extr.twistTop);
1075
1076 }
1077
1078
1079 extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD);
1080 }
1081
1082 float twistMid = ((twistTop + twistBot) * 0.5f);
1083
1084 if (twistMid != 0)
1085 {
1086 extr.twistMid = 180 * ((float)twistMid / 100);
1087 if (extr.twistMid > 0)
1088 {
1089 extr.twistMid = 360 - (-1 * extr.twistMid);
1090 }
1091 extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD);
1092 }
1093
1094 if (twistBot != 0)
1095 {
1096 extr.twistBot = 180 * ((float)twistBot / 100);
1097 if (extr.twistBot > 0)
1098 {
1099 extr.twistBot = 360 - (-1 * extr.twistBot);
1100 }
1101 extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD);
1102 }
1103
987 Mesh result = extr.Extrude(m); 1104 Mesh result = extr.Extrude(m);
988 result.DumpRaw(baseDir, primName, "Z extruded"); 1105 result.DumpRaw(baseDir, primName, "Z extruded");
989 return result; 1106 return result;