diff options
author | Teravus Ovares | 2008-12-10 23:46:20 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-12-10 23:46:20 +0000 |
commit | 7f80eff06732969f0d7f89e8774fc212123557e6 (patch) | |
tree | 0f927e87faa0012e0be938d3f5d62155c2be083e /OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |
parent | * refactor: Move test infrastructure code to its own package so that it can b... (diff) | |
download | opensim-SC-7f80eff06732969f0d7f89e8774fc212123557e6.zip opensim-SC-7f80eff06732969f0d7f89e8774fc212123557e6.tar.gz opensim-SC-7f80eff06732969f0d7f89e8774fc212123557e6.tar.bz2 opensim-SC-7f80eff06732969f0d7f89e8774fc212123557e6.tar.xz |
* Committing a slightly distilled version of nlin's ODECharacter race condition eliminator.
* The modifications that I made were only so that it didn't require changes to the public physics api.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index a875d84..b066d0c 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -213,6 +213,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
213 | private List<OdePrim> _prims = new List<OdePrim>(); | 213 | private List<OdePrim> _prims = new List<OdePrim>(); |
214 | private List<OdePrim> _activeprims = new List<OdePrim>(); | 214 | private List<OdePrim> _activeprims = new List<OdePrim>(); |
215 | private List<OdePrim> _taintedPrim = new List<OdePrim>(); | 215 | private List<OdePrim> _taintedPrim = new List<OdePrim>(); |
216 | private List<OdeCharacter> _taintedActors = new List<OdeCharacter>(); | ||
216 | private List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); | 217 | private List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); |
217 | private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); | 218 | private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); |
218 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); | 219 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); |
@@ -1793,6 +1794,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1793 | /// <param name="prim"></param> | 1794 | /// <param name="prim"></param> |
1794 | public override void AddPhysicsActorTaint(PhysicsActor prim) | 1795 | public override void AddPhysicsActorTaint(PhysicsActor prim) |
1795 | { | 1796 | { |
1797 | |||
1796 | if (prim is OdePrim) | 1798 | if (prim is OdePrim) |
1797 | { | 1799 | { |
1798 | OdePrim taintedprim = ((OdePrim) prim); | 1800 | OdePrim taintedprim = ((OdePrim) prim); |
@@ -1801,6 +1803,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1801 | if (!(_taintedPrim.Contains(taintedprim))) | 1803 | if (!(_taintedPrim.Contains(taintedprim))) |
1802 | _taintedPrim.Add(taintedprim); | 1804 | _taintedPrim.Add(taintedprim); |
1803 | } | 1805 | } |
1806 | return; | ||
1807 | } | ||
1808 | else if (prim is OdeCharacter) | ||
1809 | { | ||
1810 | OdeCharacter taintedchar = ((OdeCharacter)prim); | ||
1811 | lock (_taintedActors) | ||
1812 | { | ||
1813 | if (!(_taintedActors.Contains(taintedchar))) | ||
1814 | _taintedActors.Add(taintedchar); | ||
1815 | } | ||
1804 | } | 1816 | } |
1805 | } | 1817 | } |
1806 | 1818 | ||
@@ -1869,17 +1881,30 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1869 | //{ | 1881 | //{ |
1870 | // ode.dlock(world); | 1882 | // ode.dlock(world); |
1871 | try | 1883 | try |
1872 | { | 1884 | { |
1873 | lock (_characters) | 1885 | // Insert, remove Characters |
1886 | bool processedtaints = false; | ||
1887 | |||
1888 | lock (_taintedActors) | ||
1874 | { | 1889 | { |
1875 | foreach (OdeCharacter actor in _characters) | 1890 | if (_taintedActors.Count > 0) |
1876 | { | 1891 | { |
1877 | if (actor != null) | 1892 | foreach (OdeCharacter character in _taintedActors) |
1878 | actor.Move(timeStep); | 1893 | { |
1894 | |||
1895 | character.ProcessTaints(timeStep); | ||
1896 | |||
1897 | processedtaints = true; | ||
1898 | //character.m_collisionscore = 0; | ||
1899 | } | ||
1900 | |||
1901 | if (processedtaints) | ||
1902 | _taintedActors.Clear(); | ||
1879 | } | 1903 | } |
1880 | } | 1904 | } |
1881 | 1905 | ||
1882 | bool processedtaints = false; | 1906 | // Modify other objects in the scene. |
1907 | processedtaints = false; | ||
1883 | 1908 | ||
1884 | lock (_taintedPrim) | 1909 | lock (_taintedPrim) |
1885 | { | 1910 | { |
@@ -1898,9 +1923,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1898 | } | 1923 | } |
1899 | 1924 | ||
1900 | if (processedtaints) | 1925 | if (processedtaints) |
1901 | _taintedPrim = new List<OdePrim>(); | 1926 | _taintedPrim.Clear(); |
1927 | } | ||
1928 | |||
1929 | // Move characters | ||
1930 | lock (_characters) | ||
1931 | { | ||
1932 | foreach (OdeCharacter actor in _characters) | ||
1933 | { | ||
1934 | if (actor != null) | ||
1935 | actor.Move(timeStep); | ||
1936 | } | ||
1902 | } | 1937 | } |
1903 | 1938 | ||
1939 | // Move other active objects | ||
1904 | lock (_activeprims) | 1940 | lock (_activeprims) |
1905 | { | 1941 | { |
1906 | foreach (OdePrim prim in _activeprims) | 1942 | foreach (OdePrim prim in _activeprims) |