From 730930955a7edc0bfa69ff1cac93acd024cf8d24 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 25 Oct 2009 00:40:21 -0700 Subject: Changing Scene.ForEachClient to use the synchronous for loop instead of Parallel. This is quite possibly the source of some deadlocking, and at the very least the synchronous version gives better stack traces * Lock the LLUDPClient RTO math * Add a helper function for backing off the RTO, and follow the optional advice in RFC 2988 to clear existing SRTT and RTTVAR values during a backoff * Removing the unused PrimitiveBaseShape.SculptImage parameter * Improved performance of SceneObjectPart instantiation * ZeroMesher now drops SculptData bytes like Meshmerizer, to allow the texture data to be GCed * Improved typecasting speed in MySQLLegacyRegionData.BuildShape() * Improved the instantiation of PrimitiveBaseShape --- OpenSim/Region/Physics/Manager/ZeroMesher.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/Manager') diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index f9d0f2a..81eeed2 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs @@ -67,6 +67,9 @@ namespace OpenSim.Region.Physics.Manager public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) { + // Remove the reference to the encoded JPEG2000 data so it can be GCed + primShape.SculptData = OpenMetaverse.Utils.EmptyBytes; + return null; } } -- cgit v1.1 From d199767e6991d6f368661fce9c5a072e564b8a4b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 25 Oct 2009 23:16:12 -0700 Subject: Experimental change of PhysicsVector to Vector3. Untested --- OpenSim/Region/Physics/Manager/IMesher.cs | 7 +- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 86 ++++++++++++------------- OpenSim/Region/Physics/Manager/PhysicsJoint.cs | 2 +- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 32 ++++----- OpenSim/Region/Physics/Manager/PhysicsSensor.cs | 7 +- OpenSim/Region/Physics/Manager/PhysicsVector.cs | 28 ++++---- OpenSim/Region/Physics/Manager/ZeroMesher.cs | 5 +- 7 files changed, 85 insertions(+), 82 deletions(-) (limited to 'OpenSim/Region/Physics/Manager') diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index 1a8c948..1181b8d 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs @@ -28,13 +28,14 @@ using System; using System.Collections.Generic; using OpenSim.Framework; +using OpenMetaverse; namespace OpenSim.Region.Physics.Manager { public interface IMesher { - IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod); - IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical); + IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); + IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); } public interface IVertex @@ -43,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager public interface IMesh { - List getVertexList(); + List getVertexList(); int[] getIndexListAsInt(); int[] getIndexListAsIntLocked(); float[] getVertexListAsFloatLocked(); diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 7603131..6bfdff2 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -32,8 +32,8 @@ using OpenMetaverse; namespace OpenSim.Region.Physics.Manager { - public delegate void PositionUpdate(PhysicsVector position); - public delegate void VelocityUpdate(PhysicsVector velocity); + public delegate void PositionUpdate(Vector3 position); + public delegate void VelocityUpdate(Vector3 velocity); public delegate void OrientationUpdate(Quaternion orientation); public enum ActorTypes : int @@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.Manager { public delegate void RequestTerseUpdate(); public delegate void CollisionUpdate(EventArgs e); - public delegate void OutOfBounds(PhysicsVector pos); + public delegate void OutOfBounds(Vector3 pos); // disable warning: public events #pragma warning disable 67 @@ -125,7 +125,7 @@ namespace OpenSim.Region.Physics.Manager public abstract bool Stopped { get; } - public abstract PhysicsVector Size { get; set; } + public abstract Vector3 Size { get; set; } public abstract PrimitiveBaseShape Shape { set; } @@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.Manager public abstract void delink(); - public abstract void LockAngularMotion(PhysicsVector axis); + public abstract void LockAngularMotion(Vector3 axis); public virtual void RequestPhysicsterseUpdate() { @@ -159,7 +159,7 @@ namespace OpenSim.Region.Physics.Manager } } - public virtual void RaiseOutOfBounds(PhysicsVector pos) + public virtual void RaiseOutOfBounds(Vector3 pos) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes @@ -187,23 +187,23 @@ namespace OpenSim.Region.Physics.Manager } - public abstract PhysicsVector Position { get; set; } + public abstract Vector3 Position { get; set; } public abstract float Mass { get; } - public abstract PhysicsVector Force { get; set; } + public abstract Vector3 Force { get; set; } public abstract int VehicleType { get; set; } public abstract void VehicleFloatParam(int param, float value); - public abstract void VehicleVectorParam(int param, PhysicsVector value); + public abstract void VehicleVectorParam(int param, Vector3 value); public abstract void VehicleRotationParam(int param, Quaternion rotation); public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more - public abstract PhysicsVector GeometricCenter { get; } - public abstract PhysicsVector CenterOfMass { get; } - public abstract PhysicsVector Velocity { get; set; } - public abstract PhysicsVector Torque { get; set; } + public abstract Vector3 GeometricCenter { get; } + public abstract Vector3 CenterOfMass { get; } + public abstract Vector3 Velocity { get; set; } + public abstract Vector3 Torque { get; set; } public abstract float CollisionScore { get; set;} - public abstract PhysicsVector Acceleration { get; } + public abstract Vector3 Acceleration { get; } public abstract Quaternion Orientation { get; set; } public abstract int PhysicsActorType { get; set; } public abstract bool IsPhysical { get; set; } @@ -214,12 +214,12 @@ namespace OpenSim.Region.Physics.Manager public abstract bool CollidingGround { get; set; } public abstract bool CollidingObj { get; set; } public abstract bool FloatOnWater { set; } - public abstract PhysicsVector RotationalVelocity { get; set; } + public abstract Vector3 RotationalVelocity { get; set; } public abstract bool Kinematic { get; set; } public abstract float Buoyancy { get; set; } // Used for MoveTo - public abstract PhysicsVector PIDTarget { set;} + public abstract Vector3 PIDTarget { set; } public abstract bool PIDActive { set;} public abstract float PIDTau { set; } @@ -231,9 +231,9 @@ namespace OpenSim.Region.Physics.Manager public abstract float PIDHoverTau { set;} - public abstract void AddForce(PhysicsVector force, bool pushforce); - public abstract void AddAngularForce(PhysicsVector force, bool pushforce); - public abstract void SetMomentum(PhysicsVector momentum); + public abstract void AddForce(Vector3 force, bool pushforce); + public abstract void AddAngularForce(Vector3 force, bool pushforce); + public abstract void SetMomentum(Vector3 momentum); public abstract void SubscribeEvents(int ms); public abstract void UnSubscribeEvents(); public abstract bool SubscribedEvents(); @@ -246,9 +246,9 @@ namespace OpenSim.Region.Physics.Manager get{ return false; } } - public override PhysicsVector Position + public override Vector3 Position { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } set { return; } } @@ -296,9 +296,9 @@ namespace OpenSim.Region.Physics.Manager set { return; } } - public override PhysicsVector Size + public override Vector3 Size { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } set { return; } } @@ -307,9 +307,9 @@ namespace OpenSim.Region.Physics.Manager get { return 0f; } } - public override PhysicsVector Force + public override Vector3 Force { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } set { return; } } @@ -324,7 +324,7 @@ namespace OpenSim.Region.Physics.Manager } - public override void VehicleVectorParam(int param, PhysicsVector value) + public override void VehicleVectorParam(int param, Vector3 value) { } @@ -344,14 +344,14 @@ namespace OpenSim.Region.Physics.Manager } - public override PhysicsVector CenterOfMass + public override Vector3 CenterOfMass { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } } - public override PhysicsVector GeometricCenter + public override Vector3 GeometricCenter { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } } public override PrimitiveBaseShape Shape @@ -359,15 +359,15 @@ namespace OpenSim.Region.Physics.Manager set { return; } } - public override PhysicsVector Velocity + public override Vector3 Velocity { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } set { return; } } - public override PhysicsVector Torque + public override Vector3 Torque { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } set { return; } } @@ -387,9 +387,9 @@ namespace OpenSim.Region.Physics.Manager set { } } - public override PhysicsVector Acceleration + public override Vector3 Acceleration { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } } public override bool IsPhysical @@ -436,26 +436,26 @@ namespace OpenSim.Region.Physics.Manager { } - public override void LockAngularMotion(PhysicsVector axis) + public override void LockAngularMotion(Vector3 axis) { } - public override void AddForce(PhysicsVector force, bool pushforce) + public override void AddForce(Vector3 force, bool pushforce) { } - public override void AddAngularForce(PhysicsVector force, bool pushforce) + public override void AddAngularForce(Vector3 force, bool pushforce) { } - public override PhysicsVector RotationalVelocity + public override Vector3 RotationalVelocity { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } set { return; } } - public override PhysicsVector PIDTarget { set { return; } } + public override Vector3 PIDTarget { set { return; } } public override bool PIDActive { set { return; } } public override float PIDTau { set { return; } } @@ -464,7 +464,7 @@ namespace OpenSim.Region.Physics.Manager public override PIDHoverType PIDHoverType { set { return; } } public override float PIDHoverTau { set { return; } } - public override void SetMomentum(PhysicsVector momentum) + public override void SetMomentum(Vector3 momentum) { } diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs index f463597..b685d04 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager public PhysicsJointType Type; public string RawParams; public List BodyNames = new List(); - public PhysicsVector Position; // global coords + public Vector3 Position; // global coords public Quaternion Rotation; // global coords public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 6dd26bb..bb0d18e 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -64,23 +64,23 @@ namespace OpenSim.Region.Physics.Manager public abstract void Initialise(IMesher meshmerizer, IConfigSource config); - public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying); + public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); public abstract void RemoveAvatar(PhysicsActor actor); public abstract void RemovePrim(PhysicsActor prim); - public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation); //To be removed - public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation, bool isPhysical); + public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation); //To be removed + public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical); public virtual bool SupportsNINJAJoints { get { return false; } } - public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, + public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, Quaternion rotation, string parms, List bodyNames, string trackedBodyName, Quaternion localRotation) { return null; } @@ -129,11 +129,11 @@ namespace OpenSim.Region.Physics.Manager } } - public virtual PhysicsVector GetJointAnchor(PhysicsJoint joint) - { return null; } + public virtual Vector3 GetJointAnchor(PhysicsJoint joint) + { return Vector3.Zero; } - public virtual PhysicsVector GetJointAxis(PhysicsJoint joint) - { return null; } + public virtual Vector3 GetJointAxis(PhysicsJoint joint) + { return Vector3.Zero; } public abstract void AddPhysicsActorTaint(PhysicsActor prim); @@ -212,7 +212,7 @@ namespace OpenSim.Region.Physics.Manager // Does nothing right now } - public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) { m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); return PhysicsActor.Null; @@ -231,21 +231,21 @@ namespace OpenSim.Region.Physics.Manager } /* - public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) + public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) { m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size); return PhysicsActor.Null; } */ - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation) //To be removed + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation) //To be removed { return AddPrimShape(primName, pbs, position, size, rotation, false); } - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation, bool isPhysical) + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical) { m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); return PhysicsActor.Null; diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/Physics/Manager/PhysicsSensor.cs index 090ad52..f480d71 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsSensor.cs @@ -27,6 +27,7 @@ using System; using System.Timers; +using OpenMetaverse; namespace OpenSim.Region.Physics.Manager { @@ -46,7 +47,7 @@ namespace OpenSim.Region.Physics.Manager { get { return new NullPhysicsSensor(); } } - public abstract PhysicsVector Position {get; set;} + public abstract Vector3 Position { get; set; } public abstract void TimerCallback (object obj, ElapsedEventArgs eea); public abstract float radianarc {get; set;} public abstract string targetname {get; set;} @@ -58,9 +59,9 @@ namespace OpenSim.Region.Physics.Manager public class NullPhysicsSensor : PhysicsSensor { - public override PhysicsVector Position + public override Vector3 Position { - get { return PhysicsVector.Zero; } + get { return Vector3.Zero; } set { return; } } public override void TimerCallback(object obj, ElapsedEventArgs eea) diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index d6f4d0d..f60a636 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs @@ -29,24 +29,24 @@ using System; namespace OpenSim.Region.Physics.Manager { - public class PhysicsVector + /*public class PhysicsVector { public float X; public float Y; public float Z; - public PhysicsVector() + public Vector3() { } - public PhysicsVector(float x, float y, float z) + public Vector3(float x, float y, float z) { X = x; Y = y; Z = z; } - public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z) + public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z) { } @@ -115,17 +115,17 @@ namespace OpenSim.Region.Physics.Manager } // Operations - public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b) + public static PhysicsVector operator +(Vector3 a, Vector3 b) { return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z); } - public static PhysicsVector operator -(PhysicsVector a, PhysicsVector b) + public static PhysicsVector operator -(Vector3 a, Vector3 b) { return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z); } - public static PhysicsVector cross(PhysicsVector a, PhysicsVector b) + public static PhysicsVector cross(Vector3 a, Vector3 b) { return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X); } @@ -135,7 +135,7 @@ namespace OpenSim.Region.Physics.Manager return (float) Math.Sqrt(X*X + Y*Y + Z*Z); } - public static float GetDistanceTo(PhysicsVector a, PhysicsVector b) + public static float GetDistanceTo(Vector3 a, Vector3 b) { float dx = a.X - b.X; float dy = a.Y - b.Y; @@ -143,22 +143,22 @@ namespace OpenSim.Region.Physics.Manager return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz); } - public static PhysicsVector operator /(PhysicsVector v, float f) + public static PhysicsVector operator /(Vector3 v, float f) { return new PhysicsVector(v.X/f, v.Y/f, v.Z/f); } - public static PhysicsVector operator *(PhysicsVector v, float f) + public static PhysicsVector operator *(Vector3 v, float f) { return new PhysicsVector(v.X*f, v.Y*f, v.Z*f); } - public static PhysicsVector operator *(float f, PhysicsVector v) + public static PhysicsVector operator *(float f, Vector3 v) { return v*f; } - public static bool isFinite(PhysicsVector v) + public static bool isFinite(Vector3 v) { if (v == null) return false; @@ -172,7 +172,7 @@ namespace OpenSim.Region.Physics.Manager return true; } - public virtual bool IsIdentical(PhysicsVector v, float tolerance) + public virtual bool IsIdentical(Vector3 v, float tolerance) { PhysicsVector diff = this - v; float d = diff.length(); @@ -182,5 +182,5 @@ namespace OpenSim.Region.Physics.Manager return false; } - } + }*/ } diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index 81eeed2..e6e75f9 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs @@ -27,6 +27,7 @@ using System; using OpenSim.Framework; +using OpenMetaverse; /* * This is the zero mesher. @@ -60,12 +61,12 @@ namespace OpenSim.Region.Physics.Manager public class ZeroMesher : IMesher { - public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) + public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) { return CreateMesh(primName, primShape, size, lod, false); } - public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) + public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) { // Remove the reference to the encoded JPEG2000 data so it can be GCed primShape.SculptData = OpenMetaverse.Utils.EmptyBytes; -- cgit v1.1