mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
This commit is contained in:
@@ -27,24 +27,26 @@
|
||||
*/
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("PhysicsManager")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PhysicsManager")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly : AssemblyTitle("PhysicsManager")]
|
||||
[assembly : AssemblyDescription("")]
|
||||
[assembly : AssemblyConfiguration("")]
|
||||
[assembly : AssemblyCompany("")]
|
||||
[assembly : AssemblyProduct("PhysicsManager")]
|
||||
[assembly : AssemblyCopyright("")]
|
||||
[assembly : AssemblyTrademark("")]
|
||||
[assembly : AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly : ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly : AssemblyVersion("1.0.*")]
|
||||
@@ -30,7 +30,9 @@ using Axiom.Math;
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
public delegate void PositionUpdate(PhysicsVector position);
|
||||
|
||||
public delegate void VelocityUpdate(PhysicsVector velocity);
|
||||
|
||||
public delegate void OrientationUpdate(Quaternion orientation);
|
||||
|
||||
public abstract class PhysicsActor
|
||||
@@ -43,52 +45,22 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public static PhysicsActor Null
|
||||
{
|
||||
get
|
||||
{
|
||||
return new NullPhysicsActor();
|
||||
}
|
||||
get { return new NullPhysicsActor(); }
|
||||
}
|
||||
|
||||
public abstract PhysicsVector Size
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public abstract PhysicsVector Size { get; set; }
|
||||
|
||||
public abstract PhysicsVector Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public abstract PhysicsVector Position { get; set; }
|
||||
|
||||
public abstract PhysicsVector Velocity
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public abstract PhysicsVector Velocity { get; set; }
|
||||
|
||||
public abstract PhysicsVector Acceleration
|
||||
{
|
||||
get;
|
||||
}
|
||||
public abstract PhysicsVector Acceleration { get; }
|
||||
|
||||
public abstract Quaternion Orientation
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public abstract Quaternion Orientation { get; set; }
|
||||
|
||||
public abstract bool Flying
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public abstract bool Flying { get; set; }
|
||||
|
||||
public abstract bool Kinematic
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public abstract bool Kinematic { get; set; }
|
||||
|
||||
public abstract void AddForce(PhysicsVector force);
|
||||
|
||||
@@ -99,50 +71,26 @@ namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
public override PhysicsVector Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhysicsVector.Zero;
|
||||
}
|
||||
set
|
||||
{
|
||||
return;
|
||||
}
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhysicsVector.Zero;
|
||||
}
|
||||
set
|
||||
{
|
||||
return;
|
||||
}
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhysicsVector.Zero;
|
||||
}
|
||||
set
|
||||
{
|
||||
return;
|
||||
}
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override Quaternion Orientation
|
||||
{
|
||||
get
|
||||
{
|
||||
return Quaternion.Identity;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
}
|
||||
get { return Quaternion.Identity; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
@@ -152,26 +100,14 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public override bool Flying
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
set
|
||||
{
|
||||
return;
|
||||
}
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Kinematic
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
return;
|
||||
}
|
||||
get { return true; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force)
|
||||
@@ -184,4 +120,4 @@ namespace OpenSim.Region.Physics.Manager
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,77 +33,77 @@ using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of MyClass.
|
||||
/// </summary>
|
||||
public class PhysicsPluginManager
|
||||
{
|
||||
private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>();
|
||||
|
||||
public PhysicsPluginManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PhysicsScene GetPhysicsScene(string engineName)
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of MyClass.
|
||||
/// </summary>
|
||||
public class PhysicsPluginManager
|
||||
{
|
||||
private Dictionary<string, IPhysicsPlugin> _plugins = new Dictionary<string, IPhysicsPlugin>();
|
||||
|
||||
public PhysicsPluginManager()
|
||||
{
|
||||
}
|
||||
|
||||
public PhysicsScene GetPhysicsScene(string engineName)
|
||||
{
|
||||
if (String.IsNullOrEmpty(engineName))
|
||||
{
|
||||
return PhysicsScene.Null;
|
||||
}
|
||||
|
||||
if(_plugins.ContainsKey(engineName))
|
||||
{
|
||||
MainLog.Instance.Verbose("PHYSICS","creating "+engineName);
|
||||
return _plugins[engineName].GetScene();
|
||||
}
|
||||
else
|
||||
if (_plugins.ContainsKey(engineName))
|
||||
{
|
||||
MainLog.Instance.Verbose("PHYSICS", "creating " + engineName);
|
||||
return _plugins[engineName].GetScene();
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", engineName);
|
||||
throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName));
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadPlugins()
|
||||
{
|
||||
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics");
|
||||
string[] pluginFiles = Directory.GetFiles(path, "*.dll");
|
||||
|
||||
|
||||
for(int i= 0; i<pluginFiles.Length; i++)
|
||||
{
|
||||
this.AddPlugin(pluginFiles[i]);
|
||||
}
|
||||
throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", engineName));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddPlugin(string FileName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
|
||||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
plug.Init();
|
||||
this._plugins.Add(plug.GetName(),plug);
|
||||
OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS","Added physics engine: " + plug.GetName());
|
||||
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginAssembly = null;
|
||||
}
|
||||
|
||||
public void LoadPlugins()
|
||||
{
|
||||
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics");
|
||||
string[] pluginFiles = Directory.GetFiles(path, "*.dll");
|
||||
|
||||
|
||||
for (int i = 0; i < pluginFiles.Length; i++)
|
||||
{
|
||||
AddPlugin(pluginFiles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddPlugin(string FileName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
|
||||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
IPhysicsPlugin plug =
|
||||
(IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
plug.Init();
|
||||
_plugins.Add(plug.GetName(), plug);
|
||||
MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName());
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginAssembly = null;
|
||||
}
|
||||
|
||||
//---
|
||||
public static void PhysicsPluginMessage(string message, bool isWarning)
|
||||
{
|
||||
@@ -116,14 +116,15 @@ namespace OpenSim.Region.Physics.Manager
|
||||
MainLog.Instance.Verbose("PHYSICS", message);
|
||||
}
|
||||
}
|
||||
//---
|
||||
}
|
||||
|
||||
public interface IPhysicsPlugin
|
||||
{
|
||||
bool Init();
|
||||
PhysicsScene GetScene();
|
||||
string GetName();
|
||||
void Dispose();
|
||||
}
|
||||
}
|
||||
//---
|
||||
}
|
||||
|
||||
public interface IPhysicsPlugin
|
||||
{
|
||||
bool Init();
|
||||
PhysicsScene GetScene();
|
||||
string GetName();
|
||||
void Dispose();
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,9 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using Axiom.Math;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using Axiom.Math;
|
||||
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
@@ -35,10 +35,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
public static PhysicsScene Null
|
||||
{
|
||||
get
|
||||
{
|
||||
return new NullPhysicsScene();
|
||||
}
|
||||
get { return new NullPhysicsScene(); }
|
||||
}
|
||||
|
||||
public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position);
|
||||
@@ -47,7 +44,8 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public abstract void RemovePrim(PhysicsActor prim);
|
||||
|
||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation);
|
||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation);
|
||||
|
||||
public abstract void Simulate(float timeStep);
|
||||
|
||||
@@ -57,10 +55,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public abstract void DeleteTerrain();
|
||||
|
||||
public abstract bool IsThreaded
|
||||
{
|
||||
get;
|
||||
}
|
||||
public abstract bool IsThreaded { get; }
|
||||
|
||||
private class NullPhysicsScene : PhysicsScene
|
||||
{
|
||||
@@ -74,12 +69,10 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public override void RemoveAvatar(PhysicsActor actor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void RemovePrim(PhysicsActor prim)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -89,7 +82,9 @@ namespace OpenSim.Region.Physics.Manager
|
||||
return PhysicsActor.Null;
|
||||
}
|
||||
*/
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation)
|
||||
{
|
||||
MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||
return PhysicsActor.Null;
|
||||
@@ -97,7 +92,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public override void Simulate(float timeStep)
|
||||
{
|
||||
m_workIndicator = (m_workIndicator + 1) % 10;
|
||||
m_workIndicator = (m_workIndicator + 1)%10;
|
||||
|
||||
//OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString());
|
||||
}
|
||||
@@ -114,7 +109,6 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public override void DeleteTerrain()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool IsThreaded
|
||||
@@ -123,4 +117,4 @@ namespace OpenSim.Region.Physics.Manager
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public PhysicsVector()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PhysicsVector(float x, float y, float z)
|
||||
@@ -49,7 +48,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "<" + this.X + "," + this.Y + "," + this.Z + ">";
|
||||
return "<" + X + "," + Y + "," + Z + ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user