mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 11:33:28 +08:00
Merge branch 'master' into vehicles
This commit is contained in:
@@ -48,7 +48,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||
int[] getIndexListAsIntLocked();
|
||||
float[] getVertexListAsFloatLocked();
|
||||
void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount);
|
||||
void getVertexListAsPtrToFloatArray( out IntPtr vertexList, out int vertexStride, out int vertexCount );
|
||||
void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount);
|
||||
void releaseSourceMeshData();
|
||||
void releasePinned();
|
||||
void Append(IMesh newMesh);
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||
throw new NotSupportedException("Attempt to Add to a pinned Mesh");
|
||||
// If a vertex of the triangle is not yet in the vertices list,
|
||||
// add it and set its index to the current index count
|
||||
if( !m_vertices.ContainsKey(triangle.v1) )
|
||||
if (!m_vertices.ContainsKey(triangle.v1))
|
||||
m_vertices[triangle.v1] = m_vertices.Count;
|
||||
if (!m_vertices.ContainsKey(triangle.v2))
|
||||
m_vertices[triangle.v2] = m_vertices.Count;
|
||||
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||
|
||||
private float[] getVertexListAsFloat()
|
||||
{
|
||||
if(m_vertices == null)
|
||||
if (m_vertices == null)
|
||||
throw new NotSupportedException();
|
||||
float[] result = new float[m_vertices.Count * 3];
|
||||
foreach (KeyValuePair<Vertex, int> kvp in m_vertices)
|
||||
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||
|
||||
public float[] getVertexListAsFloatLocked()
|
||||
{
|
||||
if( m_pinnedVertexes.IsAllocated )
|
||||
if (m_pinnedVertexes.IsAllocated)
|
||||
return (float[])(m_pinnedVertexes.Target);
|
||||
|
||||
float[] result = getVertexListAsFloat();
|
||||
|
||||
@@ -1105,7 +1105,19 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
public void UpdatePositionAndVelocity()
|
||||
{
|
||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||
d.Vector3 vec = d.BodyGetPosition(Body);
|
||||
d.Vector3 vec;
|
||||
try
|
||||
{
|
||||
vec = d.BodyGetPosition(Body);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
_parent_scene.BadCharacter(this);
|
||||
vec = new d.Vector3(_position.X, _position.Y, _position.Z);
|
||||
base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
|
||||
m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar: {0}", m_name);
|
||||
}
|
||||
|
||||
|
||||
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
||||
if (vec.X < 0.0f) vec.X = 0.0f;
|
||||
@@ -1137,7 +1149,16 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
else
|
||||
{
|
||||
m_lastUpdateSent = false;
|
||||
vec = d.BodyGetLinearVel(Body);
|
||||
try
|
||||
{
|
||||
vec = d.BodyGetLinearVel(Body);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
vec.X = _velocity.X;
|
||||
vec.Y = _velocity.Y;
|
||||
vec.Z = _velocity.Z;
|
||||
}
|
||||
_velocity.X = (vec.X);
|
||||
_velocity.Y = (vec.Y);
|
||||
|
||||
|
||||
@@ -827,8 +827,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
IntPtr vertices, indices;
|
||||
int vertexCount, indexCount;
|
||||
int vertexStride, triStride;
|
||||
mesh.getVertexListAsPtrToFloatArray( out vertices, out vertexStride, out vertexCount ); // Note, that vertices are fixed in unmanaged heap
|
||||
mesh.getIndexListAsPtrToIntArray( out indices, out triStride, out indexCount ); // Also fixed, needs release after usage
|
||||
mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap
|
||||
mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
|
||||
|
||||
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
|
||||
|
||||
|
||||
@@ -243,6 +243,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>();
|
||||
private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
|
||||
private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
|
||||
private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
||||
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
|
||||
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
|
||||
private bool m_NINJA_physics_joints_enabled = false;
|
||||
@@ -1678,6 +1679,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
public void BadCharacter(OdeCharacter chr)
|
||||
{
|
||||
lock (_badCharacter)
|
||||
{
|
||||
if (!_badCharacter.Contains(chr))
|
||||
_badCharacter.Add(chr);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RemoveAvatar(PhysicsActor actor)
|
||||
{
|
||||
@@ -2987,6 +2996,18 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
}
|
||||
}
|
||||
|
||||
lock (_badCharacter)
|
||||
{
|
||||
if (_badCharacter.Count > 0)
|
||||
{
|
||||
foreach (OdeCharacter chr in _badCharacter)
|
||||
{
|
||||
RemoveCharacter(chr);
|
||||
}
|
||||
_badCharacter.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
lock (_activeprims)
|
||||
{
|
||||
//if (timeStep < 0.2f)
|
||||
@@ -3792,7 +3813,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
}
|
||||
|
||||
public void start(int unused)
|
||||
{
|
||||
{
|
||||
ds.SetViewpoint(ref xyz, ref hpr);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user