aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-10-14 02:48:30 +0000
committerTeravus Ovares2008-10-14 02:48:30 +0000
commit180e3de50f23436ef8800183a84259750564c157 (patch)
tree818e541c4151d122bcc8e7ab2c176d1ebd0afc52 /OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
parent* Remove a warning from BaseHttpServer (diff)
downloadopensim-SC_OLD-180e3de50f23436ef8800183a84259750564c157.zip
opensim-SC_OLD-180e3de50f23436ef8800183a84259750564c157.tar.gz
opensim-SC_OLD-180e3de50f23436ef8800183a84259750564c157.tar.bz2
opensim-SC_OLD-180e3de50f23436ef8800183a84259750564c157.tar.xz
* Cleaned up tons of code duplication in ODEPrim
* Re-enabled the native ODE prim types when possible * Fixed several invalid assumptions in the prim recycle process. * Added better message for 'reused a disposed physicsactor' * Added a way to recover from errors during collision_optimized * Added a way to recover from an error condition where prim_geom wasn't reset properly
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs150
1 files changed, 102 insertions, 48 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 9d6b773..2676def 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1042,6 +1042,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1042 1042
1043 lock (_activeprims) 1043 lock (_activeprims)
1044 { 1044 {
1045 List<OdePrim> removeprims = null;
1045 foreach (OdePrim chr in _activeprims) 1046 foreach (OdePrim chr in _activeprims)
1046 { 1047 {
1047 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) 1048 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
@@ -1056,7 +1057,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1056 } 1057 }
1057 else 1058 else
1058 { 1059 {
1059 m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed"); 1060 if (removeprims == null)
1061 {
1062 removeprims = new List<OdePrim>();
1063 }
1064 removeprims.Add(chr);
1065 m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!");
1060 } 1066 }
1061 } 1067 }
1062 } 1068 }
@@ -1066,6 +1072,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1066 } 1072 }
1067 } 1073 }
1068 } 1074 }
1075 if (removeprims != null)
1076 {
1077 foreach (OdePrim chr in removeprims)
1078 {
1079 _activeprims.Remove(chr);
1080 }
1081 }
1069 } 1082 }
1070 } 1083 }
1071 1084
@@ -1466,6 +1479,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1466 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); 1479 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
1467 d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space); 1480 d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space);
1468 waitForSpaceUnlock(space); 1481 waitForSpaceUnlock(space);
1482 d.SpaceSetSublevel(space, 1);
1469 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); 1483 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
1470 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; 1484 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
1471 } 1485 }
@@ -1522,72 +1536,112 @@ namespace OpenSim.Region.Physics.OdePlugin
1522 1536
1523 // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f) 1537 // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f)
1524 // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString()); 1538 // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString());
1539 int iPropertiesNotSupportedDefault = 0;
1540
1525 if (pbs.SculptEntry && !meshSculptedPrim) 1541 if (pbs.SculptEntry && !meshSculptedPrim)
1526 { 1542 {
1543#if SPAM
1544 m_log.Warn("NonMesh");
1545#endif
1527 return false; 1546 return false;
1528 } 1547 }
1529 1548
1530 // if it's a standard box or sphere with no cuts or hollows or twist, return false since ODE can use an internal representation for the prim 1549 // if it's a standard box or sphere with no cuts or hollows or twist, return false since ODE can use an internal representation for the prim
1531 //if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) 1550 if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight)
1532 // || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 1551 || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1
1533 // && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)) 1552 && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z))
1534 //{ 1553 {
1535 // if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0
1536 // && pbs.ProfileHollow == 0
1537 // && pbs.PathTwist == 0 && pbs.PathTwistBegin == 0
1538 // && pbs.PathBegin == 0 && pbs.PathEnd == 0
1539 // //&& pbs.PathTaperX == 0 && pbs.PathTaperY == 0
1540 // && pbs.PathScaleX == 100 && pbs.PathScaleY == 100)
1541 // return false;
1542 //}
1543
1544 // if (pbs.ProfileHollow != 0)
1545 // return true;
1546
1547 // if (((Int16)pbs.PathTwistBegin != 0) || ((Int16)pbs.PathTwist != 0))
1548 // return true;
1549 1554
1550 // if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) 1555 if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0
1551 // return true; 1556 && pbs.ProfileHollow == 0
1557 && pbs.PathTwist == 0 && pbs.PathTwistBegin == 0
1558 && pbs.PathBegin == 0 && pbs.PathEnd == 0
1559 && pbs.PathTaperX == 0 && pbs.PathTaperY == 0
1560 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100)
1561 {
1562#if SPAM
1563 m_log.Warn("NonMesh");
1564#endif
1565 return false;
1566 }
1567 }
1552 1568
1553 // if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100)) 1569 if (pbs.ProfileHollow != 0)
1554 // return true; 1570 iPropertiesNotSupportedDefault++;
1555 1571
1556 // if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0)) 1572 if (((Int16)pbs.PathTwistBegin != 0) || ((Int16)pbs.PathTwist != 0))
1557 // return true; 1573 iPropertiesNotSupportedDefault++;
1558 1574
1559 // if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight) 1575 if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0)
1560 // return true; 1576 iPropertiesNotSupportedDefault++;
1561 // //if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 && (pbs.Scale.X != pbs.Scale.Y || pbs.Scale.Y != pbs.Scale.Z || pbs.Scale.Z != pbs.Scale.X))
1562 // // return true;
1563 1577
1564 // if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1) 1578 if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100))
1565 // return true; 1579 iPropertiesNotSupportedDefault++;
1566 1580
1567 // // test for torus 1581 if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0))
1568 // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle 1582 iPropertiesNotSupportedDefault++;
1569 // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.Circle
1570 // && Primitive.UnpackPathScale(pbs.PathScaleY) <= 0.75f)
1571 // return true;
1572 1583
1573 // // test for tube 1584 if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight)
1574 // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle 1585 iPropertiesNotSupportedDefault++;
1575 // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle)
1576 // return true;
1577 1586
1578 // // test for ring 1587 if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 && (pbs.Scale.X != pbs.Scale.Y || pbs.Scale.Y != pbs.Scale.Z || pbs.Scale.Z != pbs.Scale.X))
1579 // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle 1588 iPropertiesNotSupportedDefault++;
1580 // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle)
1581 // return true;
1582 1589
1583 // if (pbs.ProfileShape == ProfileShape.EquilateralTriangle) 1590 if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1)
1584 // return true; 1591 iPropertiesNotSupportedDefault++;
1585 1592
1593 // test for torus
1594 if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
1595 {
1596 if (pbs.PathCurve == (byte)Extrusion.Curve1)
1597 {
1598 iPropertiesNotSupportedDefault++;
1599 }
1600 }
1601 else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
1602 {
1603 if (pbs.PathCurve == (byte)Extrusion.Straight)
1604 {
1605 iPropertiesNotSupportedDefault++;
1606 }
1586 1607
1608 // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
1609 else if (pbs.PathCurve == (byte)Extrusion.Curve1)
1610 {
1611 iPropertiesNotSupportedDefault++;
1612 }
1613 }
1614 else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
1615 {
1616 if (pbs.PathCurve == (byte)Extrusion.Curve1 || pbs.PathCurve == (byte)Extrusion.Curve2)
1617 {
1618 iPropertiesNotSupportedDefault++;
1619 }
1620 }
1621 else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle)
1622 {
1623 if (pbs.PathCurve == (byte)Extrusion.Straight)
1624 {
1625 iPropertiesNotSupportedDefault++;
1626 }
1627 else if (pbs.PathCurve == (byte)Extrusion.Curve1)
1628 {
1629 iPropertiesNotSupportedDefault++;
1630 }
1631 }
1587 1632
1588 // return false;
1589 1633
1590 return true; // assume the mesher will return a default shape or null and later code can deal with this 1634 if (iPropertiesNotSupportedDefault == 0)
1635 {
1636#if SPAM
1637 m_log.Warn("NonMesh");
1638#endif
1639 return false;
1640 }
1641#if SPAM
1642 m_log.Debug("Mesh");
1643#endif
1644 return true;
1591 } 1645 }
1592 1646
1593 /// <summary> 1647 /// <summary>