aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Meshing/Extruder.cs42
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs150
2 files changed, 132 insertions, 60 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs
index 8a95df9..54ef4ce 100644
--- a/OpenSim/Region/Physics/Meshing/Extruder.cs
+++ b/OpenSim/Region/Physics/Meshing/Extruder.cs
@@ -24,6 +24,7 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27//#define SPAM
27 28
28using OpenSim.Region.Physics.Manager; 29using OpenSim.Region.Physics.Manager;
29 30
@@ -246,9 +247,6 @@ namespace OpenSim.Region.Physics.Meshing
246 247
247 public Mesh ExtrudeCircularPath(Mesh m) 248 public Mesh ExtrudeCircularPath(Mesh m)
248 { 249 {
249 //startParameter = float.MinValue;
250 //stopParameter = float.MaxValue;
251 // Currently only works for iSteps=1;
252 Mesh result = new Mesh(); 250 Mesh result = new Mesh();
253 251
254 Quaternion tt = new Quaternion(); 252 Quaternion tt = new Quaternion();
@@ -257,7 +255,7 @@ namespace OpenSim.Region.Physics.Meshing
257 Mesh newLayer; 255 Mesh newLayer;
258 Mesh lastLayer = null; 256 Mesh lastLayer = null;
259 257
260 int start = 0; 258 //int start = 0;
261 int step; 259 int step;
262 int steps = 24; 260 int steps = 24;
263 261
@@ -268,39 +266,37 @@ namespace OpenSim.Region.Physics.Meshing
268 double percentOfPathMultiplier = 1.0 / steps; 266 double percentOfPathMultiplier = 1.0 / steps;
269 double angleStepMultiplier = System.Math.PI * 2.0 / steps; 267 double angleStepMultiplier = System.Math.PI * 2.0 / steps;
270 268
271 //System.Console.WriteLine("twistTop: " + twistTop.ToString() + " twistbot: " + twistBot.ToString() + " twisttotal: " + twistTotal.ToString());
272
273 float yPathScale = pathScaleY * 0.5f; 269 float yPathScale = pathScaleY * 0.5f;
274 float skewStart = -skew; 270 float pathLength = pathCutEnd - pathCutBegin;
275 float skewOffset = 0.0f; 271 float totalSkew = skew * 2.0f * pathLength;
276 float totalSkew = skew * 2.0f; 272 float skewStart = (-skew) + pathCutBegin * 2.0f * skew;
277 273
278 274
279 float startAngle = (float)(System.Math.PI * 2.0 * pathCutBegin * revolutions); 275 float startAngle = (float)(System.Math.PI * 2.0 * pathCutBegin * revolutions);
280 float endAngle = (float)(System.Math.PI * 2.0 * pathCutEnd * revolutions); 276 float endAngle = (float)(System.Math.PI * 2.0 * pathCutEnd * revolutions);
281 float stepSize = (float)0.2617993878; // 2*PI / 24 segments 277 float stepSize = (float)0.2617993878; // 2*PI / 24 segments per revolution
282 step = (int)(startAngle / stepSize); 278 step = (int)(startAngle / stepSize);
283 float angle = startAngle; 279 float angle = startAngle;
284 280
285 float xProfileScale = 1.0f; 281 float xProfileScale = 1.0f;
286 float yProfileScale = 1.0f; 282 float yProfileScale = 1.0f;
287 283
288 //System.Console.WriteLine("startAngle: " + startAngle.ToString() + " endAngle: " + endAngle.ToString() + " step: " + step.ToString()); 284#if SPAM
289 bool done = false; 285 System.Console.WriteLine("Extruder: twistTop: " + twistTop.ToString() + " twistbot: " + twistBot.ToString() + " twisttotal: " + twistTotal.ToString());
290 286 System.Console.WriteLine("Extruder: startAngle: " + startAngle.ToString() + " endAngle: " + endAngle.ToString() + " step: " + step.ToString());
291 //System.Console.WriteLine(" PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString()); 287 System.Console.WriteLine("Extruder: taperBotFactorX: " + taperBotFactorX.ToString() + " taperBotFactorY: " + taperBotFactorY.ToString()
292 288 + " taperTopFactorX: " + taperTopFactorX.ToString() + " taperTopFactorY: " + taperTopFactorY.ToString());
293 //System.Console.WriteLine("taperBotFactorX: " + taperBotFactorX.ToString() + " taperBotFactorY: " + taperBotFactorY.ToString() 289 System.Console.WriteLine("Extruder: PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString());
294 // + " taperTopFactorX: " + taperTopFactorX.ToString() + " taperTopFactorY: " + taperTopFactorY.ToString()); 290#endif
291
295 292
293 bool done = false;
296 do 294 do
297 { 295 {
298 float percentOfPath = 1.0f; 296 float percentOfPath = 1.0f;
299 297
300 percentOfPath = (angle - startAngle) / (endAngle - startAngle); // endAngle should always be larger than startAngle 298 percentOfPath = (angle - startAngle) / (endAngle - startAngle); // endAngle should always be larger than startAngle
301 299
302 // System.Console.WriteLine("angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString());
303
304 if (pathTaperX > 0.001f) // can't really compare to 0.0f as the value passed is never exactly zero 300 if (pathTaperX > 0.001f) // can't really compare to 0.0f as the value passed is never exactly zero
305 xProfileScale = 1.0f - percentOfPath * pathTaperX; 301 xProfileScale = 1.0f - percentOfPath * pathTaperX;
306 else if (pathTaperX < -0.001f) 302 else if (pathTaperX < -0.001f)
@@ -323,7 +319,10 @@ namespace OpenSim.Region.Physics.Meshing
323 319
324 //radiusScale = 1.0f; 320 //radiusScale = 1.0f;
325 321
326 //System.Console.WriteLine("Extruder: radius: " + radius.ToString() + " radiusScale: " + radiusScale.ToString()); 322#if SPAM
323 System.Console.WriteLine("Extruder: angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString()
324 + " radius: " + radius.ToString() + " radiusScale: " + radiusScale.ToString());
325#endif
327 326
328 float twist = twistBot + (twistTotal * (float)percentOfPath); 327 float twist = twistBot + (twistTotal * (float)percentOfPath);
329 328
@@ -397,8 +396,8 @@ namespace OpenSim.Region.Physics.Meshing
397 } 396 }
398 lastLayer = newLayer; 397 lastLayer = newLayer;
399 398
400 // calc next angle
401 399
400 // calc the angle for the next interation of the loop
402 if (angle >= endAngle) 401 if (angle >= endAngle)
403 done = true; 402 done = true;
404 else 403 else
@@ -407,6 +406,7 @@ namespace OpenSim.Region.Physics.Meshing
407 if (angle > endAngle) 406 if (angle > endAngle)
408 angle = endAngle; 407 angle = endAngle;
409 } 408 }
409
410 } while (!done); 410 } while (!done);
411 411
412 // scale the mesh to the desired size 412 // scale the mesh to the desired size
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 3fbc7c9..a716d93 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -24,6 +24,7 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27//#define SPAM
27 28
28using System; 29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
@@ -431,6 +432,9 @@ namespace OpenSim.Region.Physics.Meshing
431 Int16 twistTop = primShape.PathTwistBegin; 432 Int16 twistTop = primShape.PathTwistBegin;
432 Int16 twistBot = primShape.PathTwist; 433 Int16 twistBot = primShape.PathTwist;
433 434
435#if SPAM
436 reportPrimParams("[BOX] " + primName, primShape);
437#endif
434 438
435 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); 439 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString());
436 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); 440 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString());
@@ -553,13 +557,13 @@ namespace OpenSim.Region.Physics.Meshing
553 { 557 {
554 if (taperX > 100) 558 if (taperX > 100)
555 { 559 {
556 extr.taperTopFactorX = 1.0f - ((float)taperX / 200); 560 extr.taperTopFactorX = 1.0f - ((float)(taperX - 100) / 100);
557 //m_log.Warn("taperTopFactorX: " + extr.taperTopFactorX.ToString()); 561 //System.Console.WriteLine("taperTopFactorX: " + extr.taperTopFactorX.ToString());
558 } 562 }
559 else 563 else
560 { 564 {
561 extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100); 565 extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100);
562 //m_log.Warn("taperBotFactorX: " + extr.taperBotFactorX.ToString()); 566 //System.Console.WriteLine("taperBotFactorX: " + extr.taperBotFactorX.ToString());
563 } 567 }
564 568
565 } 569 }
@@ -568,28 +572,29 @@ namespace OpenSim.Region.Physics.Meshing
568 { 572 {
569 if (taperY > 100) 573 if (taperY > 100)
570 { 574 {
571 extr.taperTopFactorY = 1.0f - ((float)taperY / 200); 575 extr.taperTopFactorY = 1.0f - ((float)(taperY - 100) / 100);
572 //m_log.Warn("taperTopFactorY: " + extr.taperTopFactorY.ToString()); 576 //System.Console.WriteLine("taperTopFactorY: " + extr.taperTopFactorY.ToString());
573 } 577 }
574 else 578 else
575 { 579 {
576 extr.taperBotFactorY = 1.0f - ((100 - (float)taperY) / 100); 580 extr.taperBotFactorY = 1.0f - ((100 - (float)taperY) / 100);
577 //m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString()); 581 //System.Console.WriteLine("taperBotFactorY: " + extr.taperBotFactorY.ToString());
578 } 582 }
579 } 583 }
580 584
581 if (pathShearX != 0) 585 if (pathShearX != 0)
582 { 586 {
587 //System.Console.WriteLine("pushX: " + pathShearX.ToString());
583 if (pathShearX > 50) 588 if (pathShearX > 50)
584 { 589 {
585 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50 590 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
586 extr.pushX = (((float)(256 - pathShearX) / 100) * -1f); 591 extr.pushX = (((float)(256 - pathShearX) / 100) * -1f);
587 // m_log.Warn("pushX: " + extr.pushX); 592 //System.Console.WriteLine("pushX: " + extr.pushX);
588 } 593 }
589 else 594 else
590 { 595 {
591 extr.pushX = (float)pathShearX / 100; 596 extr.pushX = (float)pathShearX / 100;
592 // m_log.Warn("pushX: " + extr.pushX); 597 //System.Console.WriteLine("pushX: " + extr.pushX);
593 } 598 }
594 } 599 }
595 600
@@ -599,12 +604,12 @@ namespace OpenSim.Region.Physics.Meshing
599 { 604 {
600 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50 605 // Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
601 extr.pushY = (((float)(256 - pathShearY) / 100) * -1f); 606 extr.pushY = (((float)(256 - pathShearY) / 100) * -1f);
602 //m_log.Warn("pushY: " + extr.pushY); 607 //System.Console.WriteLine("pushY: " + extr.pushY);
603 } 608 }
604 else 609 else
605 { 610 {
606 extr.pushY = (float)pathShearY / 100; 611 extr.pushY = (float)pathShearY / 100;
607 //m_log.Warn("pushY: " + extr.pushY); 612 //System.Console.WriteLine("pushY: " + extr.pushY);
608 } 613 }
609 } 614 }
610 615
@@ -662,6 +667,10 @@ namespace OpenSim.Region.Physics.Meshing
662 Int16 twistBot = primShape.PathTwist; 667 Int16 twistBot = primShape.PathTwist;
663 Int16 twistTop = primShape.PathTwistBegin; 668 Int16 twistTop = primShape.PathTwistBegin;
664 669
670#if SPAM
671 reportPrimParams("[CYLINDER] " + primName, primShape);
672#endif
673
665 674
666 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface 675 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
667 // of a block are basically the same 676 // of a block are basically the same
@@ -903,7 +912,7 @@ namespace OpenSim.Region.Physics.Meshing
903 { 912 {
904 if (taperY > 100) 913 if (taperY > 100)
905 { 914 {
906 extr.taperTopFactorY = 1.0f - ((float)(taperY - 100) / 200); 915 extr.taperTopFactorY = 1.0f - ((float)(taperY - 100) / 100);
907 // System.Console.WriteLine("taperTopFactorY: " + extr.taperTopFactorY.ToString()); 916 // System.Console.WriteLine("taperTopFactorY: " + extr.taperTopFactorY.ToString());
908 } 917 }
909 else 918 else
@@ -998,6 +1007,11 @@ namespace OpenSim.Region.Physics.Meshing
998 1007
999 Int16 twistTop = primShape.PathTwistBegin; 1008 Int16 twistTop = primShape.PathTwistBegin;
1000 Int16 twistBot = primShape.PathTwist; 1009 Int16 twistBot = primShape.PathTwist;
1010
1011#if SPAM
1012 reportPrimParams("[PRISM] " + primName, primShape);
1013#endif
1014
1001 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); 1015 //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString());
1002 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); 1016 //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString());
1003 //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString()); 1017 //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString());
@@ -1116,7 +1130,7 @@ namespace OpenSim.Region.Physics.Meshing
1116 { 1130 {
1117 if (taperX > 100) 1131 if (taperX > 100)
1118 { 1132 {
1119 extr.taperTopFactorX = 1.0f - ((float)taperX / 200); 1133 extr.taperTopFactorX = 1.0f - ((float)(taperX - 100) / 100);
1120 //System.Console.WriteLine("taperTopFactorX: " + extr.taperTopFactorX.ToString()); 1134 //System.Console.WriteLine("taperTopFactorX: " + extr.taperTopFactorX.ToString());
1121 } 1135 }
1122 else 1136 else
@@ -1124,14 +1138,15 @@ namespace OpenSim.Region.Physics.Meshing
1124 extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100); 1138 extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100);
1125 //System.Console.WriteLine("taperBotFactorX: " + extr.taperBotFactorX.ToString()); 1139 //System.Console.WriteLine("taperBotFactorX: " + extr.taperBotFactorX.ToString());
1126 } 1140 }
1141
1127 } 1142 }
1128 1143
1129 if (taperY != 100) 1144 if (taperY != 100)
1130 { 1145 {
1131 if (taperY > 100) 1146 if (taperY > 100)
1132 { 1147 {
1133 extr.taperTopFactorY = 1.0f - ((float)taperY / 200); 1148 extr.taperTopFactorY = 1.0f - ((float)(taperY - 100) / 100);
1134 //System.Console.WriteLine("taperTopFactorY: " + extr.taperTopFactorY.ToString()); 1149 // System.Console.WriteLine("taperTopFactorY: " + extr.taperTopFactorY.ToString());
1135 } 1150 }
1136 else 1151 else
1137 { 1152 {
@@ -1209,6 +1224,8 @@ namespace OpenSim.Region.Physics.Meshing
1209 result.DumpRaw(baseDir, primName, "Z extruded"); 1224 result.DumpRaw(baseDir, primName, "Z extruded");
1210 return result; 1225 return result;
1211 } 1226 }
1227
1228
1212 private static Mesh CreateSphereMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) 1229 private static Mesh CreateSphereMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size)
1213 { 1230 {
1214 // Builds an icosahedral geodesic sphere 1231 // Builds an icosahedral geodesic sphere
@@ -1230,6 +1247,10 @@ namespace OpenSim.Region.Physics.Meshing
1230 UInt16 pathShearY = primShape.PathShearY; 1247 UInt16 pathShearY = primShape.PathShearY;
1231 Mesh m = new Mesh(); 1248 Mesh m = new Mesh();
1232 1249
1250#if SPAM
1251 reportPrimParams("[SPHERE] " + primName, primShape);
1252#endif
1253
1233 float LOD = 0.2f; 1254 float LOD = 0.2f;
1234 float diameter = 0.5f;// Our object will result in -0.5 to 0.5 1255 float diameter = 0.5f;// Our object will result in -0.5 to 0.5
1235 float sq5 = (float) Math.Sqrt(5.0); 1256 float sq5 = (float) Math.Sqrt(5.0);
@@ -1298,6 +1319,11 @@ namespace OpenSim.Region.Physics.Meshing
1298 } 1319 }
1299 private SculptMesh CreateSculptMesh(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) 1320 private SculptMesh CreateSculptMesh(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
1300 { 1321 {
1322
1323#if SPAM
1324 reportPrimParams("[SCULPT] " + primName, primShape);
1325#endif
1326
1301 SculptMesh sm = new SculptMesh(primShape.SculptData, lod); 1327 SculptMesh sm = new SculptMesh(primShape.SculptData, lod);
1302 // Scale the mesh based on our prim scale 1328 // Scale the mesh based on our prim scale
1303 foreach (Vertex v in sm.vertices) 1329 foreach (Vertex v in sm.vertices)
@@ -1320,7 +1346,7 @@ namespace OpenSim.Region.Physics.Meshing
1320 1346
1321 } 1347 }
1322 1348
1323 private static Mesh CreateCircularProfileMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) 1349 private static Mesh CreateCircularPathMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size)
1324 { 1350 {
1325 1351
1326 UInt16 hollowFactor = primShape.ProfileHollow; 1352 UInt16 hollowFactor = primShape.ProfileHollow;
@@ -1334,18 +1360,23 @@ namespace OpenSim.Region.Physics.Meshing
1334 Int16 twistTop = primShape.PathTwistBegin; 1360 Int16 twistTop = primShape.PathTwistBegin;
1335 HollowShape hollowShape = primShape.HollowShape; 1361 HollowShape hollowShape = primShape.HollowShape;
1336 1362
1337 //Console.WriteLine("pathTwist: " + primShape.PathTwist.ToString() + " pathTwistBegin: " + primShape.PathTwistBegin.ToString()); 1363#if SPAM
1364 reportPrimParams("[CIRCULAR PATH PRIM] " + primName, primShape);
1365 Console.WriteLine("pathTwist: " + primShape.PathTwist.ToString() + " pathTwistBegin: " + primShape.PathTwistBegin.ToString());
1366 Console.WriteLine("primShape.ProfileCurve & 0x07: " + Convert.ToString(primShape.ProfileCurve & 0x07));
1338 1367
1339 SimpleHull outerHull = new SimpleHull(); 1368#endif
1340 1369
1341 //Console.WriteLine("primShape.ProfileCurve & 0x07: " + Convert.ToString(primShape.ProfileCurve & 0x07)); 1370 SimpleHull outerHull = new SimpleHull();
1342 1371
1343 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) 1372 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
1344 1373
1345 //if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle 1374 //if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle
1346 // || (primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Square) 1375 // || (primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Square)
1347 { 1376 {
1348 //Console.WriteLine("Meshmerizer thinks " + primName + " is a TORUS"); 1377#if SPAM
1378 Console.WriteLine("Meshmerizer thinks " + primName + " is a TORUS");
1379#endif
1349 if (hollowShape == HollowShape.Same) 1380 if (hollowShape == HollowShape.Same)
1350 hollowShape = HollowShape.Circle; 1381 hollowShape = HollowShape.Circle;
1351 1382
@@ -1380,7 +1411,9 @@ namespace OpenSim.Region.Physics.Meshing
1380 1411
1381 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) // a ring 1412 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) // a ring
1382 { 1413 {
1383 //Console.WriteLine("Meshmerizer thinks " + primName + " is a TUBE"); 1414#if SPAM
1415 Console.WriteLine("Meshmerizer thinks " + primName + " is a TUBE");
1416#endif
1384 if (hollowShape == HollowShape.Same) 1417 if (hollowShape == HollowShape.Same)
1385 hollowShape = HollowShape.Square; 1418 hollowShape = HollowShape.Square;
1386 1419
@@ -1392,7 +1425,9 @@ namespace OpenSim.Region.Physics.Meshing
1392 1425
1393 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) 1426 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle)
1394 { 1427 {
1395 //Console.WriteLine("Meshmerizer thinks " + primName + " is a RING"); 1428#if SPAM
1429 Console.WriteLine("Meshmerizer thinks " + primName + " is a RING");
1430#endif
1396 if (hollowShape == HollowShape.Same) 1431 if (hollowShape == HollowShape.Same)
1397 hollowShape = HollowShape.Triangle; 1432 hollowShape = HollowShape.Triangle;
1398 1433
@@ -1404,7 +1439,9 @@ namespace OpenSim.Region.Physics.Meshing
1404 1439
1405 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) 1440 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
1406 { 1441 {
1407 //Console.WriteLine("Meshmerizer thinks " + primName + " is a SPHERE"); 1442#if SPAM
1443 Console.WriteLine("Meshmerizer thinks " + primName + " is a SPHERE");
1444#endif
1408 if (hollowShape == HollowShape.Same) 1445 if (hollowShape == HollowShape.Same)
1409 hollowShape = HollowShape.Circle; 1446 hollowShape = HollowShape.Circle;
1410 1447
@@ -1544,15 +1581,20 @@ namespace OpenSim.Region.Physics.Meshing
1544 1581
1545 Vertex vTemp = new Vertex(0.0f, 0.0f, 0.0f); 1582 Vertex vTemp = new Vertex(0.0f, 0.0f, 0.0f);
1546 1583
1547 //Console.WriteLine("primShape.PathScaleX: " + primShape.PathScaleX.ToString() + " primShape.PathScaleY: " + primShape.PathScaleY.ToString()); 1584
1548 //Console.WriteLine("primShape.PathSkew: " + primShape.PathSkew.ToString() + " primShape.PathRadiusOffset: " + primShape.PathRadiusOffset.ToString() + " primShape.pathRevolutions: " + primShape.PathRevolutions.ToString());
1549
1550 float skew = primShape.PathSkew * 0.01f; 1585 float skew = primShape.PathSkew * 0.01f;
1551 float pathScaleX = (float)(200 - primShape.PathScaleX) * 0.01f; 1586 float pathScaleX = (float)(200 - primShape.PathScaleX) * 0.01f;
1552 float pathScaleY = (float)(200 - primShape.PathScaleY) * 0.01f; 1587 float pathScaleY = (float)(200 - primShape.PathScaleY) * 0.01f;
1553 //Console.WriteLine("PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString());
1554
1555 float profileXComp = pathScaleX * (1.0f - Math.Abs(skew)); 1588 float profileXComp = pathScaleX * (1.0f - Math.Abs(skew));
1589
1590#if SPAM
1591 //Console.WriteLine("primShape.PathScaleX: " + primShape.PathScaleX.ToString() + " primShape.PathScaleY: " + primShape.PathScaleY.ToString());
1592 //Console.WriteLine("primShape.PathSkew: " + primShape.PathSkew.ToString() + " primShape.PathRadiusOffset: " + primShape.PathRadiusOffset.ToString() + " primShape.pathRevolutions: " + primShape.PathRevolutions.ToString());
1593 Console.WriteLine("PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString());
1594 Console.WriteLine("skew: " + skew.ToString() + " profileXComp: " + profileXComp.ToString());
1595#endif
1596
1597
1556 foreach (Vertex v in m.vertices) 1598 foreach (Vertex v in m.vertices)
1557 if (v != null) 1599 if (v != null)
1558 { 1600 {
@@ -1572,20 +1614,22 @@ namespace OpenSim.Region.Physics.Meshing
1572 extr.pathEnd = primShape.PathEnd; 1614 extr.pathEnd = primShape.PathEnd;
1573 extr.skew = skew; 1615 extr.skew = skew;
1574 extr.revolutions = 1.0f + (float)primShape.PathRevolutions * 3.0f / 200.0f; 1616 extr.revolutions = 1.0f + (float)primShape.PathRevolutions * 3.0f / 200.0f;
1617 extr.pathTaperX = 0.01f * (float)primShape.PathTaperX;
1618 extr.pathTaperY = 0.01f * (float)primShape.PathTaperY;
1575 1619
1620 extr.radius = 0.01f * (float)primShape.PathRadiusOffset;
1621
1622#if SPAM
1576 //System.Console.WriteLine("primShape.PathBegin: " + primShape.PathBegin.ToString() + " primShape.PathEnd: " + primShape.PathEnd.ToString()); 1623 //System.Console.WriteLine("primShape.PathBegin: " + primShape.PathBegin.ToString() + " primShape.PathEnd: " + primShape.PathEnd.ToString());
1577 //System.Console.WriteLine("extr.pathCutBegin: " + extr.pathCutBegin.ToString() + " extr.pathCutEnd: " + extr.pathCutEnd.ToString()); 1624 System.Console.WriteLine("extr.pathCutBegin: " + extr.pathCutBegin.ToString() + " extr.pathCutEnd: " + extr.pathCutEnd.ToString());
1578 //System.Console.WriteLine("extr.revolutions: " + extr.revolutions.ToString()); 1625 System.Console.WriteLine("extr.revolutions: " + extr.revolutions.ToString());
1579 1626
1580 //System.Console.WriteLine("primShape.PathTaperX: " + primShape.PathTaperX.ToString()); 1627 //System.Console.WriteLine("primShape.PathTaperX: " + primShape.PathTaperX.ToString());
1581 //System.Console.WriteLine("primShape.PathTaperY: " + primShape.PathTaperY.ToString()); 1628 //System.Console.WriteLine("primShape.PathTaperY: " + primShape.PathTaperY.ToString());
1582 1629
1583 extr.pathTaperX = 0.01f * (float)primShape.PathTaperX;
1584 extr.pathTaperY = 0.01f * (float)primShape.PathTaperY;
1585
1586 extr.radius = 0.01f * (float)primShape.PathRadiusOffset;
1587 //System.Console.WriteLine("primShape.PathRadiusOffset: " + primShape.PathRadiusOffset.ToString());
1588 1630
1631 //System.Console.WriteLine("primShape.PathRadiusOffset: " + primShape.PathRadiusOffset.ToString());
1632#endif
1589 1633
1590 1634
1591 1635
@@ -1744,7 +1788,7 @@ namespace OpenSim.Region.Physics.Meshing
1744 mesh = (Mesh)smesh; 1788 mesh = (Mesh)smesh;
1745 CalcNormals(mesh); 1789 CalcNormals(mesh);
1746 } 1790 }
1747 else if ((primShape.ProfileCurve & (byte)ProfileShape.Square) == (byte)ProfileShape.Square) 1791 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
1748 { 1792 {
1749 if (primShape.PathCurve == (byte)LLObject.PathCurve.Line) 1793 if (primShape.PathCurve == (byte)LLObject.PathCurve.Line)
1750 { // its a box 1794 { // its a box
@@ -1755,7 +1799,7 @@ namespace OpenSim.Region.Physics.Meshing
1755 { // tube 1799 { // tube
1756 // do a cylinder for now 1800 // do a cylinder for now
1757 //mesh = CreateCylinderMesh(primName, primShape, size); 1801 //mesh = CreateCylinderMesh(primName, primShape, size);
1758 mesh = CreateCircularProfileMesh(primName, primShape, size); 1802 mesh = CreateCircularPathMesh(primName, primShape, size);
1759 CalcNormals(mesh); 1803 CalcNormals(mesh);
1760 } 1804 }
1761 } 1805 }
@@ -1771,7 +1815,7 @@ namespace OpenSim.Region.Physics.Meshing
1771 // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits 1815 // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
1772 else if (primShape.PathCurve == (byte) Extrusion.Curve1 && LLObject.UnpackPathScale(primShape.PathScaleY) <= 0.75f) 1816 else if (primShape.PathCurve == (byte) Extrusion.Curve1 && LLObject.UnpackPathScale(primShape.PathScaleY) <= 0.75f)
1773 { // dahlia's favorite, a torus :) 1817 { // dahlia's favorite, a torus :)
1774 mesh = CreateCircularProfileMesh(primName, primShape, size); 1818 mesh = CreateCircularPathMesh(primName, primShape, size);
1775 CalcNormals(mesh); 1819 CalcNormals(mesh);
1776 } 1820 }
1777 } 1821 }
@@ -1793,7 +1837,7 @@ namespace OpenSim.Region.Physics.Meshing
1793 else if (primShape.PathCurve == (byte) Extrusion.Curve1) 1837 else if (primShape.PathCurve == (byte) Extrusion.Curve1)
1794 { // a ring - do a cylinder for now 1838 { // a ring - do a cylinder for now
1795 //mesh = CreateCylinderMesh(primName, primShape, size); 1839 //mesh = CreateCylinderMesh(primName, primShape, size);
1796 mesh = CreateCircularProfileMesh(primName, primShape, size); 1840 mesh = CreateCircularPathMesh(primName, primShape, size);
1797 CalcNormals(mesh); 1841 CalcNormals(mesh);
1798 } 1842 }
1799 } 1843 }
@@ -1853,6 +1897,34 @@ namespace OpenSim.Region.Physics.Meshing
1853 return mesh; 1897 return mesh;
1854 } 1898 }
1855 1899
1856 1900 private static void reportPrimParams(string name, PrimitiveBaseShape primShape)
1901 {
1902#if SPAM
1903
1904 Console.WriteLine("********************* PrimitiveBaseShape Parameters *******************\n"
1905 + "Name.............: " + name.ToString() + "\n"
1906 + "HollowShape......: " + primShape.HollowShape.ToString() + "\n"
1907 + "PathBegin........: " + primShape.PathBegin.ToString() + "\n"
1908 + "PathCurve........: " + primShape.PathCurve.ToString() + "\n"
1909 + "PathEnd..........: " + primShape.PathEnd.ToString() + "\n"
1910 + "PathRadiusOffset.: " + primShape.PathRadiusOffset.ToString() + "\n"
1911 + "PathRevolutions..: " + primShape.PathRevolutions.ToString() + "\n"
1912 + "PathScaleX.......: " + primShape.PathScaleX.ToString() + "\n"
1913 + "PathScaleY.......: " + primShape.PathScaleY.ToString() + "\n"
1914 + "PathShearX.......: " + primShape.PathShearX.ToString() + "\n"
1915 + "PathShearY.......: " + primShape.PathShearY.ToString() + "\n"
1916 + "PathSkew.........: " + primShape.PathSkew.ToString() + "\n"
1917 + "PathTaperX.......: " + primShape.PathTaperX.ToString() + "\n"
1918 + "PathTaperY.......: " + primShape.PathTaperY.ToString() + "\n"
1919 + "PathTwist........: " + primShape.PathTwist.ToString() + "\n"
1920 + "PathTwistBegin...: " + primShape.PathTwistBegin.ToString() + "\n"
1921 + "ProfileBegin.....: " + primShape.ProfileBegin.ToString() + "\n"
1922 + "ProfileCurve.....: " + primShape.ProfileCurve.ToString() + "\n"
1923 + "ProfileEnd.......: " + primShape.ProfileEnd.ToString() + "\n"
1924 + "ProfileHollow....: " + primShape.ProfileHollow.ToString() + "\n"
1925 + "ProfileShape.....: " + primShape.ProfileShape.ToString() + "\n"
1926 );
1927#endif
1928 }
1857 } 1929 }
1858} 1930}