diff options
Diffstat (limited to 'OpenSim-Source/OpenSim.Physics/Manager')
8 files changed, 646 insertions, 0 deletions
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/AssemblyInfo.cs b/OpenSim-Source/OpenSim.Physics/Manager/AssemblyInfo.cs new file mode 100644 index 0000000..57a8913 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/AssemblyInfo.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // Information about this assembly is defined by the following | ||
6 | // attributes. | ||
7 | // | ||
8 | // change them to the information which is associated with the assembly | ||
9 | // you compile. | ||
10 | |||
11 | [assembly: AssemblyTitle("PhysicsManager")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("PhysicsManager")] | ||
16 | [assembly: AssemblyCopyright("")] | ||
17 | [assembly: AssemblyTrademark("")] | ||
18 | [assembly: AssemblyCulture("")] | ||
19 | |||
20 | // This sets the default COM visibility of types in the assembly to invisible. | ||
21 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
22 | [assembly: ComVisible(false)] | ||
23 | |||
24 | // The assembly version has following format : | ||
25 | // | ||
26 | // Major.Minor.Build.Revision | ||
27 | // | ||
28 | // You can specify all values by your own or you can build default build and revision | ||
29 | // numbers with the '*' character (the default): | ||
30 | |||
31 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj b/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj new file mode 100644 index 0000000..294e005 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj | |||
@@ -0,0 +1,112 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{8BE16150-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Physics.Manager</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Physics.Manager</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="System" > | ||
62 | <HintPath>System.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System.Xml" > | ||
66 | <HintPath>System.Xml.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="Axiom.MathLib.dll" > | ||
70 | <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
76 | <Name>OpenSim.Framework</Name> | ||
77 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
82 | <Name>OpenSim.Framework.Console</Name> | ||
83 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
84 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
85 | <Private>False</Private> | ||
86 | </ProjectReference> | ||
87 | </ItemGroup> | ||
88 | <ItemGroup> | ||
89 | <Compile Include="AssemblyInfo.cs"> | ||
90 | <SubType>Code</SubType> | ||
91 | </Compile> | ||
92 | <Compile Include="PhysicsActor.cs"> | ||
93 | <SubType>Code</SubType> | ||
94 | </Compile> | ||
95 | <Compile Include="PhysicsManager.cs"> | ||
96 | <SubType>Code</SubType> | ||
97 | </Compile> | ||
98 | <Compile Include="PhysicsScene.cs"> | ||
99 | <SubType>Code</SubType> | ||
100 | </Compile> | ||
101 | <Compile Include="PhysicsVector.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj.user b/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj.user new file mode 100644 index 0000000..d47d65d --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj.user | |||
@@ -0,0 +1,12 @@ | |||
1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath> | ||
6 | <LastOpenVersion>8.0.50727</LastOpenVersion> | ||
7 | <ProjectView>ProjectFiles</ProjectView> | ||
8 | <ProjectTrust>0</ProjectTrust> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " /> | ||
11 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " /> | ||
12 | </Project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build b/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build new file mode 100644 index 0000000..4b5ee51 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build | |||
@@ -0,0 +1,47 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.Manager" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Physics.Manager" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="PhysicsActor.cs" /> | ||
16 | <include name="PhysicsManager.cs" /> | ||
17 | <include name="PhysicsScene.cs" /> | ||
18 | <include name="PhysicsVector.cs" /> | ||
19 | </sources> | ||
20 | <references basedir="${project::get-base-directory()}"> | ||
21 | <lib> | ||
22 | <include name="${project::get-base-directory()}" /> | ||
23 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
24 | </lib> | ||
25 | <include name="System.dll" /> | ||
26 | <include name="System.Xml.dll" /> | ||
27 | <include name="../../bin/Axiom.MathLib.dll" /> | ||
28 | <include name="../../bin/OpenSim.Framework.dll" /> | ||
29 | <include name="../../bin/OpenSim.Framework.Console.dll" /> | ||
30 | </references> | ||
31 | </csc> | ||
32 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
33 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
34 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
35 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
36 | <include name="*.dll"/> | ||
37 | <include name="*.exe"/> | ||
38 | </fileset> | ||
39 | </copy> | ||
40 | </target> | ||
41 | <target name="clean"> | ||
42 | <delete dir="${bin.dir}" failonerror="false" /> | ||
43 | <delete dir="${obj.dir}" failonerror="false" /> | ||
44 | </target> | ||
45 | <target name="doc" description="Creates documentation."> | ||
46 | </target> | ||
47 | </project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/PhysicsActor.cs b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsActor.cs new file mode 100644 index 0000000..a0b6c21 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsActor.cs | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Physics.Manager | ||
33 | { | ||
34 | public abstract class PhysicsActor | ||
35 | { | ||
36 | public static PhysicsActor Null | ||
37 | { | ||
38 | get | ||
39 | { | ||
40 | return new NullPhysicsActor(); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | public abstract PhysicsVector Position | ||
45 | { | ||
46 | get; | ||
47 | set; | ||
48 | } | ||
49 | |||
50 | public abstract PhysicsVector Velocity | ||
51 | { | ||
52 | get; | ||
53 | set; | ||
54 | } | ||
55 | |||
56 | public abstract PhysicsVector Acceleration | ||
57 | { | ||
58 | get; | ||
59 | } | ||
60 | |||
61 | public abstract Axiom.MathLib.Quaternion Orientation | ||
62 | { | ||
63 | get; | ||
64 | set; | ||
65 | } | ||
66 | |||
67 | public abstract bool Flying | ||
68 | { | ||
69 | get; | ||
70 | set; | ||
71 | } | ||
72 | |||
73 | public abstract bool Kinematic | ||
74 | { | ||
75 | get; | ||
76 | set; | ||
77 | } | ||
78 | |||
79 | public abstract void AddForce(PhysicsVector force); | ||
80 | |||
81 | public abstract void SetMomentum(PhysicsVector momentum); | ||
82 | } | ||
83 | |||
84 | public class NullPhysicsActor : PhysicsActor | ||
85 | { | ||
86 | public override PhysicsVector Position | ||
87 | { | ||
88 | get | ||
89 | { | ||
90 | return PhysicsVector.Zero; | ||
91 | } | ||
92 | set | ||
93 | { | ||
94 | return; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public override PhysicsVector Velocity | ||
99 | { | ||
100 | get | ||
101 | { | ||
102 | return PhysicsVector.Zero; | ||
103 | } | ||
104 | set | ||
105 | { | ||
106 | return; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | public override Axiom.MathLib.Quaternion Orientation | ||
111 | { | ||
112 | get | ||
113 | { | ||
114 | return Axiom.MathLib.Quaternion.Identity; | ||
115 | } | ||
116 | set | ||
117 | { | ||
118 | |||
119 | } | ||
120 | } | ||
121 | |||
122 | public override PhysicsVector Acceleration | ||
123 | { | ||
124 | get { return PhysicsVector.Zero; } | ||
125 | } | ||
126 | |||
127 | public override bool Flying | ||
128 | { | ||
129 | get | ||
130 | { | ||
131 | return false; | ||
132 | } | ||
133 | set | ||
134 | { | ||
135 | return; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | public override bool Kinematic | ||
140 | { | ||
141 | get | ||
142 | { | ||
143 | return true; | ||
144 | } | ||
145 | set | ||
146 | { | ||
147 | return; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | public override void AddForce(PhysicsVector force) | ||
152 | { | ||
153 | return; | ||
154 | } | ||
155 | |||
156 | public override void SetMomentum(PhysicsVector momentum) | ||
157 | { | ||
158 | return; | ||
159 | } | ||
160 | } | ||
161 | } | ||
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/PhysicsManager.cs b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsManager.cs new file mode 100644 index 0000000..291fc7e --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsManager.cs | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using Axiom.MathLib; | ||
33 | using OpenSim.Framework.Console; | ||
34 | |||
35 | namespace OpenSim.Physics.Manager | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Description of MyClass. | ||
39 | /// </summary> | ||
40 | public class PhysicsManager | ||
41 | { | ||
42 | private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); | ||
43 | |||
44 | public PhysicsManager() | ||
45 | { | ||
46 | |||
47 | } | ||
48 | |||
49 | public PhysicsScene GetPhysicsScene(string engineName) | ||
50 | { | ||
51 | if (String.IsNullOrEmpty(engineName)) | ||
52 | { | ||
53 | return new NullPhysicsScene(); | ||
54 | } | ||
55 | |||
56 | if(_plugins.ContainsKey(engineName)) | ||
57 | { | ||
58 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW,"creating "+engineName); | ||
59 | return _plugins[engineName].GetScene(); | ||
60 | } | ||
61 | else | ||
62 | { | ||
63 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName); | ||
64 | throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | public void LoadPlugins() | ||
69 | { | ||
70 | string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); | ||
71 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); | ||
72 | |||
73 | |||
74 | for(int i= 0; i<pluginFiles.Length; i++) | ||
75 | { | ||
76 | this.AddPlugin(pluginFiles[i]); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | private void AddPlugin(string FileName) | ||
81 | { | ||
82 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
83 | |||
84 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
85 | { | ||
86 | if (pluginType.IsPublic) | ||
87 | { | ||
88 | if (!pluginType.IsAbstract) | ||
89 | { | ||
90 | Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | ||
91 | |||
92 | if (typeInterface != null) | ||
93 | { | ||
94 | IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
95 | plug.Init(); | ||
96 | this._plugins.Add(plug.GetName(),plug); | ||
97 | |||
98 | } | ||
99 | |||
100 | typeInterface = null; | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | |||
105 | pluginAssembly = null; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | public interface IPhysicsPlugin | ||
110 | { | ||
111 | bool Init(); | ||
112 | PhysicsScene GetScene(); | ||
113 | string GetName(); | ||
114 | void Dispose(); | ||
115 | } | ||
116 | } | ||
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/PhysicsScene.cs b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsScene.cs new file mode 100644 index 0000000..7dab4e1 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsScene.cs | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Framework.Console; | ||
32 | |||
33 | namespace OpenSim.Physics.Manager | ||
34 | { | ||
35 | public abstract class PhysicsScene | ||
36 | { | ||
37 | public static PhysicsScene Null | ||
38 | { | ||
39 | get | ||
40 | { | ||
41 | return new NullPhysicsScene(); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | public abstract PhysicsActor AddAvatar(PhysicsVector position); | ||
46 | |||
47 | public abstract void RemoveAvatar(PhysicsActor actor); | ||
48 | |||
49 | public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); | ||
50 | |||
51 | public abstract void Simulate(float timeStep); | ||
52 | |||
53 | public abstract void GetResults(); | ||
54 | |||
55 | public abstract void SetTerrain(float[] heightMap); | ||
56 | |||
57 | public abstract void DeleteTerrain(); | ||
58 | |||
59 | public abstract bool IsThreaded | ||
60 | { | ||
61 | get; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public class NullPhysicsScene : PhysicsScene | ||
66 | { | ||
67 | private static int m_workIndicator; | ||
68 | |||
69 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
70 | { | ||
71 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE,"NullPhysicsScene : AddAvatar({0})", position); | ||
72 | return PhysicsActor.Null; | ||
73 | } | ||
74 | |||
75 | public override void RemoveAvatar(PhysicsActor actor) | ||
76 | { | ||
77 | |||
78 | } | ||
79 | |||
80 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
81 | { | ||
82 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "NullPhysicsScene : AddPrim({0},{1})", position, size); | ||
83 | return PhysicsActor.Null; | ||
84 | } | ||
85 | |||
86 | public override void Simulate(float timeStep) | ||
87 | { | ||
88 | m_workIndicator = (m_workIndicator + 1) % 10; | ||
89 | |||
90 | //OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString()); | ||
91 | } | ||
92 | |||
93 | public override void GetResults() | ||
94 | { | ||
95 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "NullPhysicsScene : GetResults()"); | ||
96 | } | ||
97 | |||
98 | public override void SetTerrain(float[] heightMap) | ||
99 | { | ||
100 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); | ||
101 | } | ||
102 | |||
103 | public override void DeleteTerrain() | ||
104 | { | ||
105 | |||
106 | } | ||
107 | |||
108 | public override bool IsThreaded | ||
109 | { | ||
110 | get { return false; } | ||
111 | } | ||
112 | } | ||
113 | } | ||
diff --git a/OpenSim-Source/OpenSim.Physics/Manager/PhysicsVector.cs b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsVector.cs new file mode 100644 index 0000000..3c824d0 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/Manager/PhysicsVector.cs | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Physics.Manager | ||
33 | { | ||
34 | public class PhysicsVector | ||
35 | { | ||
36 | public float X; | ||
37 | public float Y; | ||
38 | public float Z; | ||
39 | |||
40 | public PhysicsVector() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | |||
45 | public PhysicsVector(float x, float y, float z) | ||
46 | { | ||
47 | X = x; | ||
48 | Y = y; | ||
49 | Z = z; | ||
50 | } | ||
51 | |||
52 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); | ||
53 | } | ||
54 | } | ||