aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-06-15 19:34:48 +0000
committerTeravus Ovares2008-06-15 19:34:48 +0000
commit11d68ce0f5d84188d468004b918824feb6c57f0b (patch)
tree23ef0ad2fb86cc3d64bdf78d14beb15ed4e61014 /OpenSim/Region/Physics/Meshing/Meshmerizer.cs
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-11d68ce0f5d84188d468004b918824feb6c57f0b.zip
opensim-SC_OLD-11d68ce0f5d84188d468004b918824feb6c57f0b.tar.gz
opensim-SC_OLD-11d68ce0f5d84188d468004b918824feb6c57f0b.tar.bz2
opensim-SC_OLD-11d68ce0f5d84188d468004b918824feb6c57f0b.tar.xz
* 0001558: [PATCH] Add support for full collision geometry feature set for linear path prims (patch attached) By Dahlia. Thanks Dahlia!
* This update re-does the cube/cylinder/prism prims to dynamically add faces as twist is used.
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs192
1 files changed, 104 insertions, 88 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 0c62447..9afc7ae 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -57,8 +57,11 @@ namespace OpenSim.Region.Physics.Meshing
57 57
58 // Setting baseDir to a path will enable the dumping of raw files 58 // Setting baseDir to a path will enable the dumping of raw files
59 // raw files can be imported by blender so a visual inspection of the results can be done 59 // raw files can be imported by blender so a visual inspection of the results can be done
60 // const string baseDir = "rawFiles"; 60#if SPAM
61 const string baseDir = "rawFiles";
62#else
61 private const string baseDir = null; //"rawFiles"; 63 private const string baseDir = null; //"rawFiles";
64#endif
62 private const float DEG_TO_RAD = 0.01745329238f; 65 private const float DEG_TO_RAD = 0.01745329238f;
63 66
64// TODO: unused 67// TODO: unused
@@ -613,42 +616,46 @@ namespace OpenSim.Region.Physics.Meshing
613 } 616 }
614 } 617 }
615 618
616 if (twistTop != 0) 619 //if (twistTop != 0)
617 { 620 //{
618 extr.twistTop = 180 * ((float)twistTop / 100); 621 // extr.twistTop = 180 * ((float)twistTop / 100);
619 if (extr.twistTop > 0) 622 // if (extr.twistTop > 0)
620 { 623 // {
621 extr.twistTop = 360 - (-1 * extr.twistTop); 624 // extr.twistTop = 360 - (-1 * extr.twistTop);
622 625
623 } 626 // }
624 627
625 628
626 extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD); 629 // extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD);
627 } 630 //}
628 631
629 float twistMid = ((twistTop + twistBot) * 0.5f); 632 //float twistMid = ((twistTop + twistBot) * 0.5f);
630 633
631 if (twistMid != 0) 634 //if (twistMid != 0)
632 { 635 //{
633 extr.twistMid = 180 * ((float)twistMid / 100); 636 // extr.twistMid = 180 * ((float)twistMid / 100);
634 if (extr.twistMid > 0) 637 // if (extr.twistMid > 0)
635 { 638 // {
636 extr.twistMid = 360 - (-1 * extr.twistMid); 639 // extr.twistMid = 360 - (-1 * extr.twistMid);
637 } 640 // }
638 extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD); 641 // extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD);
639 } 642 //}
640 643
641 if (twistBot != 0) 644 //if (twistBot != 0)
642 { 645 //{
643 extr.twistBot = 180 * ((float)twistBot / 100); 646 // extr.twistBot = 180 * ((float)twistBot / 100);
644 if (extr.twistBot > 0) 647 // if (extr.twistBot > 0)
645 { 648 // {
646 extr.twistBot = 360 - (-1 * extr.twistBot); 649 // extr.twistBot = 360 - (-1 * extr.twistBot);
647 } 650 // }
648 extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD); 651 // extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD);
649 } 652 //}
653
654 extr.twistTop = (float)primShape.PathTwist * (float)Math.PI * 0.01f;
655 extr.twistBot = (float)primShape.PathTwistBegin * (float)Math.PI * 0.01f;
650 656
651 Mesh result = extr.Extrude(m); 657 //Mesh result = extr.Extrude(m);
658 Mesh result = extr.ExtrudeLinearPath(m);
652 result.DumpRaw(baseDir, primName, "Z extruded"); 659 result.DumpRaw(baseDir, primName, "Z extruded");
653 return result; 660 return result;
654 } 661 }
@@ -953,43 +960,47 @@ namespace OpenSim.Region.Physics.Meshing
953 960
954 } 961 }
955 962
956 if (twistTop != 0) 963 //if (twistTop != 0)
957 { 964 //{
958 extr.twistTop = 180 * ((float)twistTop / 100); 965 // extr.twistTop = 180 * ((float)twistTop / 100);
959 if (extr.twistTop > 0) 966 // if (extr.twistTop > 0)
960 { 967 // {
961 extr.twistTop = 360 - (-1 * extr.twistTop); 968 // extr.twistTop = 360 - (-1 * extr.twistTop);
962 969
963 } 970 // }
964 971
965 972
966 extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD); 973 // extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD);
967 } 974 //}
968 975
969 float twistMid = ((twistTop + twistBot) * 0.5f); 976 //float twistMid = ((twistTop + twistBot) * 0.5f);
970 977
971 if (twistMid != 0) 978 //if (twistMid != 0)
972 { 979 //{
973 extr.twistMid = 180 * ((float)twistMid / 100); 980 // extr.twistMid = 180 * ((float)twistMid / 100);
974 if (extr.twistMid > 0) 981 // if (extr.twistMid > 0)
975 { 982 // {
976 extr.twistMid = 360 - (-1 * extr.twistMid); 983 // extr.twistMid = 360 - (-1 * extr.twistMid);
977 } 984 // }
978 extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD); 985 // extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD);
979 } 986 //}
980 987
981 if (twistBot != 0) 988 //if (twistBot != 0)
982 { 989 //{
983 extr.twistBot = 180 * ((float)twistBot / 100); 990 // extr.twistBot = 180 * ((float)twistBot / 100);
984 if (extr.twistBot > 0) 991 // if (extr.twistBot > 0)
985 { 992 // {
986 extr.twistBot = 360 - (-1 * extr.twistBot); 993 // extr.twistBot = 360 - (-1 * extr.twistBot);
987 } 994 // }
988 extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD); 995 // extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD);
989 } 996 //}
990 997
998 extr.twistTop = (float)primShape.PathTwist * (float)Math.PI * 0.01f;
999 extr.twistBot = (float)primShape.PathTwistBegin * (float)Math.PI * 0.01f;
1000
991 //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString()); 1001 //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString());
992 Mesh result = extr.Extrude(m); 1002 //Mesh result = extr.Extrude(m);
1003 Mesh result = extr.ExtrudeLinearPath(m);
993 result.DumpRaw(baseDir, primName, "Z extruded"); 1004 result.DumpRaw(baseDir, primName, "Z extruded");
994 return result; 1005 return result;
995 } 1006 }
@@ -1185,42 +1196,47 @@ namespace OpenSim.Region.Physics.Meshing
1185 } 1196 }
1186 } 1197 }
1187 1198
1188 if (twistTop != 0) 1199 //if (twistTop != 0)
1189 { 1200 //{
1190 extr.twistTop = 180 * ((float)twistTop / 100); 1201 // extr.twistTop = 180 * ((float)twistTop / 100);
1191 if (extr.twistTop > 0) 1202 // if (extr.twistTop > 0)
1192 { 1203 // {
1193 extr.twistTop = 360 - (-1 * extr.twistTop); 1204 // extr.twistTop = 360 - (-1 * extr.twistTop);
1194 1205
1195 } 1206 // }
1196 1207
1197 1208
1198 extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD); 1209 // extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD);
1199 } 1210 //}
1200 1211
1201 float twistMid = ((twistTop + twistBot) * 0.5f); 1212 //float twistMid = ((twistTop + twistBot) * 0.5f);
1202 1213
1203 if (twistMid != 0) 1214 //if (twistMid != 0)
1204 { 1215 //{
1205 extr.twistMid = 180 * ((float)twistMid / 100); 1216 // extr.twistMid = 180 * ((float)twistMid / 100);
1206 if (extr.twistMid > 0) 1217 // if (extr.twistMid > 0)
1207 { 1218 // {
1208 extr.twistMid = 360 - (-1 * extr.twistMid); 1219 // extr.twistMid = 360 - (-1 * extr.twistMid);
1209 } 1220 // }
1210 extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD); 1221 // extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD);
1211 } 1222 //}
1212 1223
1213 if (twistBot != 0) 1224 //if (twistBot != 0)
1214 { 1225 //{
1215 extr.twistBot = 180 * ((float)twistBot / 100); 1226 // extr.twistBot = 180 * ((float)twistBot / 100);
1216 if (extr.twistBot > 0) 1227 // if (extr.twistBot > 0)
1217 { 1228 // {
1218 extr.twistBot = 360 - (-1 * extr.twistBot); 1229 // extr.twistBot = 360 - (-1 * extr.twistBot);
1219 } 1230 // }
1220 extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD); 1231 // extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD);
1221 } 1232 //}
1222 1233
1223 Mesh result = extr.Extrude(m); 1234 extr.twistTop = (float)primShape.PathTwist * (float)Math.PI * 0.01f;
1235 extr.twistBot = (float)primShape.PathTwistBegin * (float)Math.PI * 0.01f;
1236
1237 //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString());
1238 //Mesh result = extr.Extrude(m);
1239 Mesh result = extr.ExtrudeLinearPath(m);
1224 result.DumpRaw(baseDir, primName, "Z extruded"); 1240 result.DumpRaw(baseDir, primName, "Z extruded");
1225 return result; 1241 return result;
1226 } 1242 }