aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorMelanie2009-10-19 21:58:51 +0100
committerMelanie2009-10-19 21:58:51 +0100
commitffd59868f5e2d797160b1bbfc13f3b4bac717b36 (patch)
treefb807a129a6e449ac17dadce15d7b27268c92c3f /OpenSim/Region/Physics
parentMerge branch 'master' into vehicles (diff)
parentMinor formatting cleanup. (diff)
downloadopensim-SC-ffd59868f5e2d797160b1bbfc13f3b4bac717b36.zip
opensim-SC-ffd59868f5e2d797160b1bbfc13f3b4bac717b36.tar.gz
opensim-SC-ffd59868f5e2d797160b1bbfc13f3b4bac717b36.tar.bz2
opensim-SC-ffd59868f5e2d797160b1bbfc13f3b4bac717b36.tar.xz
Merge branch 'master' into vehicles
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs25
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs23
5 files changed, 51 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index ac14292..1a8c948 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.Physics.Manager
48 int[] getIndexListAsIntLocked(); 48 int[] getIndexListAsIntLocked();
49 float[] getVertexListAsFloatLocked(); 49 float[] getVertexListAsFloatLocked();
50 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount); 50 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount);
51 void getVertexListAsPtrToFloatArray( out IntPtr vertexList, out int vertexStride, out int vertexCount ); 51 void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount);
52 void releaseSourceMeshData(); 52 void releaseSourceMeshData();
53 void releasePinned(); 53 void releasePinned();
54 void Append(IMesh newMesh); 54 void Append(IMesh newMesh);
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index 94d926a..4c3cf33 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Physics.Meshing
70 throw new NotSupportedException("Attempt to Add to a pinned Mesh"); 70 throw new NotSupportedException("Attempt to Add to a pinned Mesh");
71 // If a vertex of the triangle is not yet in the vertices list, 71 // If a vertex of the triangle is not yet in the vertices list,
72 // add it and set its index to the current index count 72 // add it and set its index to the current index count
73 if( !m_vertices.ContainsKey(triangle.v1) ) 73 if (!m_vertices.ContainsKey(triangle.v1))
74 m_vertices[triangle.v1] = m_vertices.Count; 74 m_vertices[triangle.v1] = m_vertices.Count;
75 if (!m_vertices.ContainsKey(triangle.v2)) 75 if (!m_vertices.ContainsKey(triangle.v2))
76 m_vertices[triangle.v2] = m_vertices.Count; 76 m_vertices[triangle.v2] = m_vertices.Count;
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Physics.Meshing
153 153
154 private float[] getVertexListAsFloat() 154 private float[] getVertexListAsFloat()
155 { 155 {
156 if(m_vertices == null) 156 if (m_vertices == null)
157 throw new NotSupportedException(); 157 throw new NotSupportedException();
158 float[] result = new float[m_vertices.Count * 3]; 158 float[] result = new float[m_vertices.Count * 3];
159 foreach (KeyValuePair<Vertex, int> kvp in m_vertices) 159 foreach (KeyValuePair<Vertex, int> kvp in m_vertices)
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Physics.Meshing
169 169
170 public float[] getVertexListAsFloatLocked() 170 public float[] getVertexListAsFloatLocked()
171 { 171 {
172 if( m_pinnedVertexes.IsAllocated ) 172 if (m_pinnedVertexes.IsAllocated)
173 return (float[])(m_pinnedVertexes.Target); 173 return (float[])(m_pinnedVertexes.Target);
174 174
175 float[] result = getVertexListAsFloat(); 175 float[] result = getVertexListAsFloat();
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index bd81d50..1fff846 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1105,7 +1105,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1105 public void UpdatePositionAndVelocity() 1105 public void UpdatePositionAndVelocity()
1106 { 1106 {
1107 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 1107 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
1108 d.Vector3 vec = d.BodyGetPosition(Body); 1108 d.Vector3 vec;
1109 try
1110 {
1111 vec = d.BodyGetPosition(Body);
1112 }
1113 catch (NullReferenceException)
1114 {
1115 _parent_scene.BadCharacter(this);
1116 vec = new d.Vector3(_position.X, _position.Y, _position.Z);
1117 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
1118 m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar: {0}", m_name);
1119 }
1120
1109 1121
1110 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1122 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1111 if (vec.X < 0.0f) vec.X = 0.0f; 1123 if (vec.X < 0.0f) vec.X = 0.0f;
@@ -1137,7 +1149,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1137 else 1149 else
1138 { 1150 {
1139 m_lastUpdateSent = false; 1151 m_lastUpdateSent = false;
1140 vec = d.BodyGetLinearVel(Body); 1152 try
1153 {
1154 vec = d.BodyGetLinearVel(Body);
1155 }
1156 catch (NullReferenceException)
1157 {
1158 vec.X = _velocity.X;
1159 vec.Y = _velocity.Y;
1160 vec.Z = _velocity.Z;
1161 }
1141 _velocity.X = (vec.X); 1162 _velocity.X = (vec.X);
1142 _velocity.Y = (vec.Y); 1163 _velocity.Y = (vec.Y);
1143 1164
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 7840ae3..864ea80 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -827,8 +827,8 @@ namespace OpenSim.Region.Physics.OdePlugin
827 IntPtr vertices, indices; 827 IntPtr vertices, indices;
828 int vertexCount, indexCount; 828 int vertexCount, indexCount;
829 int vertexStride, triStride; 829 int vertexStride, triStride;
830 mesh.getVertexListAsPtrToFloatArray( out vertices, out vertexStride, out vertexCount ); // Note, that vertices are fixed in unmanaged heap 830 mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap
831 mesh.getIndexListAsPtrToIntArray( out indices, out triStride, out indexCount ); // Also fixed, needs release after usage 831 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
832 832
833 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory 833 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
834 834
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 78831f8..9429544 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -243,6 +243,7 @@ namespace OpenSim.Region.Physics.OdePlugin
243 private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); 243 private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>();
244 private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); 244 private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
245 private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); 245 private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
246 private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
246 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 247 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
247 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); 248 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
248 private bool m_NINJA_physics_joints_enabled = false; 249 private bool m_NINJA_physics_joints_enabled = false;
@@ -1678,6 +1679,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1678 } 1679 }
1679 } 1680 }
1680 } 1681 }
1682 public void BadCharacter(OdeCharacter chr)
1683 {
1684 lock (_badCharacter)
1685 {
1686 if (!_badCharacter.Contains(chr))
1687 _badCharacter.Add(chr);
1688 }
1689 }
1681 1690
1682 public override void RemoveAvatar(PhysicsActor actor) 1691 public override void RemoveAvatar(PhysicsActor actor)
1683 { 1692 {
@@ -2987,6 +2996,18 @@ namespace OpenSim.Region.Physics.OdePlugin
2987 } 2996 }
2988 } 2997 }
2989 2998
2999 lock (_badCharacter)
3000 {
3001 if (_badCharacter.Count > 0)
3002 {
3003 foreach (OdeCharacter chr in _badCharacter)
3004 {
3005 RemoveCharacter(chr);
3006 }
3007 _badCharacter.Clear();
3008 }
3009 }
3010
2990 lock (_activeprims) 3011 lock (_activeprims)
2991 { 3012 {
2992 //if (timeStep < 0.2f) 3013 //if (timeStep < 0.2f)
@@ -3792,7 +3813,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3792 } 3813 }
3793 3814
3794 public void start(int unused) 3815 public void start(int unused)
3795 { 3816 {
3796 ds.SetViewpoint(ref xyz, ref hpr); 3817 ds.SetViewpoint(ref xyz, ref hpr);
3797 } 3818 }
3798#endif 3819#endif