diff options
Diffstat (limited to 'OpenSim-Source/OpenSim.Physics')
23 files changed, 2368 insertions, 0 deletions
diff --git a/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs new file mode 100644 index 0000000..0c9c06c --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/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("PhysXplugin")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("PhysXplugin")] | ||
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/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs new file mode 100644 index 0000000..c37acc8 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -0,0 +1,277 @@ | |||
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 OpenSim.Physics.Manager; | ||
30 | |||
31 | namespace OpenSim.Physics.BasicPhysicsPlugin | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Will be the PhysX plugin but for now will be a very basic physics engine | ||
35 | /// </summary> | ||
36 | public class BasicPhysicsPlugin : IPhysicsPlugin | ||
37 | { | ||
38 | private BasicScene _mScene; | ||
39 | |||
40 | public BasicPhysicsPlugin() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | |||
45 | public bool Init() | ||
46 | { | ||
47 | return true; | ||
48 | } | ||
49 | |||
50 | public PhysicsScene GetScene() | ||
51 | { | ||
52 | if(_mScene == null) | ||
53 | { | ||
54 | _mScene = new BasicScene(); | ||
55 | } | ||
56 | return(_mScene); | ||
57 | } | ||
58 | |||
59 | public string GetName() | ||
60 | { | ||
61 | return("basicphysics"); | ||
62 | } | ||
63 | |||
64 | public void Dispose() | ||
65 | { | ||
66 | |||
67 | } | ||
68 | } | ||
69 | |||
70 | public class BasicScene :PhysicsScene | ||
71 | { | ||
72 | private List<BasicActor> _actors = new List<BasicActor>(); | ||
73 | private float[] _heightMap; | ||
74 | |||
75 | public BasicScene() | ||
76 | { | ||
77 | |||
78 | } | ||
79 | |||
80 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
81 | { | ||
82 | BasicActor act = new BasicActor(); | ||
83 | act.Position = position; | ||
84 | _actors.Add(act); | ||
85 | return act; | ||
86 | } | ||
87 | |||
88 | public override void RemoveAvatar(PhysicsActor actor) | ||
89 | { | ||
90 | BasicActor act = (BasicActor)actor; | ||
91 | if(_actors.Contains(act)) | ||
92 | { | ||
93 | _actors.Remove(act); | ||
94 | } | ||
95 | |||
96 | } | ||
97 | |||
98 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
99 | { | ||
100 | return null; | ||
101 | } | ||
102 | |||
103 | public override void Simulate(float timeStep) | ||
104 | { | ||
105 | foreach (BasicActor actor in _actors) | ||
106 | { | ||
107 | actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); | ||
108 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); | ||
109 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | ||
110 | /*if(actor.Flying) | ||
111 | { | ||
112 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); | ||
117 | } | ||
118 | if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) | ||
119 | {*/ | ||
120 | if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) | ||
121 | { | ||
122 | actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1; | ||
123 | } | ||
124 | //} | ||
125 | |||
126 | |||
127 | |||
128 | // This code needs sorting out - border crossings etc | ||
129 | /* if(actor.Position.X<0) | ||
130 | { | ||
131 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
132 | actor.Position.X = 0; | ||
133 | actor.Velocity.X = 0; | ||
134 | } | ||
135 | if(actor.Position.Y < 0) | ||
136 | { | ||
137 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
138 | actor.Position.Y = 0; | ||
139 | actor.Velocity.Y = 0; | ||
140 | } | ||
141 | if(actor.Position.X > 255) | ||
142 | { | ||
143 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
144 | actor.Position.X = 255; | ||
145 | actor.Velocity.X = 0; | ||
146 | } | ||
147 | if(actor.Position.Y > 255) | ||
148 | { | ||
149 | ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); | ||
150 | actor.Position.Y = 255; | ||
151 | actor.Velocity.X = 0; | ||
152 | }*/ | ||
153 | } | ||
154 | } | ||
155 | |||
156 | public override void GetResults() | ||
157 | { | ||
158 | |||
159 | } | ||
160 | |||
161 | public override bool IsThreaded | ||
162 | { | ||
163 | get | ||
164 | { | ||
165 | return(false); // for now we won't be multithreaded | ||
166 | } | ||
167 | } | ||
168 | |||
169 | public override void SetTerrain(float[] heightMap) | ||
170 | { | ||
171 | this._heightMap = heightMap; | ||
172 | } | ||
173 | |||
174 | public override void DeleteTerrain() | ||
175 | { | ||
176 | |||
177 | } | ||
178 | } | ||
179 | |||
180 | public class BasicActor : PhysicsActor | ||
181 | { | ||
182 | private PhysicsVector _position; | ||
183 | private PhysicsVector _velocity; | ||
184 | private PhysicsVector _acceleration; | ||
185 | private bool flying; | ||
186 | public BasicActor() | ||
187 | { | ||
188 | _velocity = new PhysicsVector(); | ||
189 | _position = new PhysicsVector(); | ||
190 | _acceleration = new PhysicsVector(); | ||
191 | } | ||
192 | |||
193 | public override bool Flying | ||
194 | { | ||
195 | get | ||
196 | { | ||
197 | return false; | ||
198 | } | ||
199 | set | ||
200 | { | ||
201 | flying= value; | ||
202 | } | ||
203 | } | ||
204 | |||
205 | public override PhysicsVector Position | ||
206 | { | ||
207 | get | ||
208 | { | ||
209 | return _position; | ||
210 | } | ||
211 | set | ||
212 | { | ||
213 | _position = value; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | public override PhysicsVector Velocity | ||
218 | { | ||
219 | get | ||
220 | { | ||
221 | return _velocity; | ||
222 | } | ||
223 | set | ||
224 | { | ||
225 | _velocity = value; | ||
226 | } | ||
227 | } | ||
228 | |||
229 | public override Axiom.MathLib.Quaternion Orientation | ||
230 | { | ||
231 | get | ||
232 | { | ||
233 | return Axiom.MathLib.Quaternion.Identity; | ||
234 | } | ||
235 | set | ||
236 | { | ||
237 | |||
238 | } | ||
239 | } | ||
240 | |||
241 | public override PhysicsVector Acceleration | ||
242 | { | ||
243 | get | ||
244 | { | ||
245 | return _acceleration; | ||
246 | } | ||
247 | |||
248 | } | ||
249 | |||
250 | public override bool Kinematic | ||
251 | { | ||
252 | get | ||
253 | { | ||
254 | return true; | ||
255 | } | ||
256 | set | ||
257 | { | ||
258 | |||
259 | } | ||
260 | } | ||
261 | public void SetAcceleration (PhysicsVector accel) | ||
262 | { | ||
263 | this._acceleration = accel; | ||
264 | } | ||
265 | |||
266 | public override void AddForce(PhysicsVector force) | ||
267 | { | ||
268 | |||
269 | } | ||
270 | |||
271 | public override void SetMomentum(PhysicsVector momentum) | ||
272 | { | ||
273 | |||
274 | } | ||
275 | } | ||
276 | |||
277 | } | ||
diff --git a/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj new file mode 100644 index 0000000..6d5b4d0 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj | |||
@@ -0,0 +1,93 @@ | |||
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>{4F874463-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.BasicPhysicsPlugin</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.BasicPhysicsPlugin</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\Physics\</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\Physics\</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="Axiom.MathLib.dll" > | ||
66 | <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | </ItemGroup> | ||
70 | <ItemGroup> | ||
71 | <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj"> | ||
72 | <Name>OpenSim.Physics.Manager</Name> | ||
73 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
74 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
75 | <Private>False</Private> | ||
76 | </ProjectReference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <Compile Include="AssemblyInfo.cs"> | ||
80 | <SubType>Code</SubType> | ||
81 | </Compile> | ||
82 | <Compile Include="BasicPhysicsPlugin.cs"> | ||
83 | <SubType>Code</SubType> | ||
84 | </Compile> | ||
85 | </ItemGroup> | ||
86 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
87 | <PropertyGroup> | ||
88 | <PreBuildEvent> | ||
89 | </PreBuildEvent> | ||
90 | <PostBuildEvent> | ||
91 | </PostBuildEvent> | ||
92 | </PropertyGroup> | ||
93 | </Project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user new file mode 100644 index 0000000..d47d65d --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.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/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build new file mode 100644 index 0000000..3497a55 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build | |||
@@ -0,0 +1,42 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.BasicPhysicsPlugin" 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.BasicPhysicsPlugin" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="BasicPhysicsPlugin.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="System.dll" /> | ||
23 | <include name="../../bin/Axiom.MathLib.dll" /> | ||
24 | <include name="../../bin/OpenSim.Physics.Manager.dll" /> | ||
25 | </references> | ||
26 | </csc> | ||
27 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" /> | ||
28 | <mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/> | ||
29 | <copy todir="${project::get-base-directory()}/../../bin/Physics/"> | ||
30 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
31 | <include name="*.dll"/> | ||
32 | <include name="*.exe"/> | ||
33 | </fileset> | ||
34 | </copy> | ||
35 | </target> | ||
36 | <target name="clean"> | ||
37 | <delete dir="${bin.dir}" failonerror="false" /> | ||
38 | <delete dir="${obj.dir}" failonerror="false" /> | ||
39 | </target> | ||
40 | <target name="doc" description="Creates documentation."> | ||
41 | </target> | ||
42 | </project> | ||
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 | } | ||
diff --git a/OpenSim-Source/OpenSim.Physics/OdePlugin/AssemblyInfo.cs b/OpenSim-Source/OpenSim.Physics/OdePlugin/AssemblyInfo.cs new file mode 100644 index 0000000..913aae7 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/OdePlugin/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("RealPhysXplugin")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("RealPhysXplugin")] | ||
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/OdePlugin/OdePlugin.cs b/OpenSim-Source/OpenSim.Physics/OdePlugin/OdePlugin.cs new file mode 100644 index 0000000..599dea8 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/OdePlugin/OdePlugin.cs | |||
@@ -0,0 +1,452 @@ | |||
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 OpenSim.Physics.Manager; | ||
30 | using Ode.NET; | ||
31 | |||
32 | namespace OpenSim.Physics.OdePlugin | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// ODE plugin | ||
36 | /// </summary> | ||
37 | public class OdePlugin : IPhysicsPlugin | ||
38 | { | ||
39 | private OdeScene _mScene; | ||
40 | |||
41 | public OdePlugin() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public bool Init() | ||
47 | { | ||
48 | return true; | ||
49 | } | ||
50 | |||
51 | public PhysicsScene GetScene() | ||
52 | { | ||
53 | if (_mScene == null) | ||
54 | { | ||
55 | _mScene = new OdeScene(); | ||
56 | } | ||
57 | return (_mScene); | ||
58 | } | ||
59 | |||
60 | public string GetName() | ||
61 | { | ||
62 | return ("OpenDynamicsEngine"); | ||
63 | } | ||
64 | |||
65 | public void Dispose() | ||
66 | { | ||
67 | |||
68 | } | ||
69 | } | ||
70 | |||
71 | public class OdeScene : PhysicsScene | ||
72 | { | ||
73 | static public IntPtr world; | ||
74 | static public IntPtr space; | ||
75 | static private IntPtr contactgroup; | ||
76 | static private IntPtr LandGeom; | ||
77 | //static private IntPtr Land; | ||
78 | private double[] _heightmap; | ||
79 | static private d.NearCallback nearCallback = near; | ||
80 | private List<OdeCharacter> _characters = new List<OdeCharacter>(); | ||
81 | private static d.ContactGeom[] contacts = new d.ContactGeom[30]; | ||
82 | private static d.Contact contact; | ||
83 | |||
84 | public OdeScene() | ||
85 | { | ||
86 | contact.surface.mode = d.ContactFlags.Bounce | d.ContactFlags.SoftCFM; | ||
87 | contact.surface.mu = d.Infinity; | ||
88 | contact.surface.mu2 = 0.0f; | ||
89 | contact.surface.bounce = 0.1f; | ||
90 | contact.surface.bounce_vel = 0.1f; | ||
91 | contact.surface.soft_cfm = 0.01f; | ||
92 | |||
93 | world = d.WorldCreate(); | ||
94 | space = d.HashSpaceCreate(IntPtr.Zero); | ||
95 | contactgroup = d.JointGroupCreate(0); | ||
96 | d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f); | ||
97 | //d.WorldSetCFM(world, 1e-5f); | ||
98 | d.WorldSetAutoDisableFlag(world, false); | ||
99 | d.WorldSetContactSurfaceLayer(world, 0.001f); | ||
100 | // d.CreatePlane(space, 0, 0, 1, 0); | ||
101 | this._heightmap = new double[65536]; | ||
102 | } | ||
103 | |||
104 | // This function blatantly ripped off from BoxStack.cs | ||
105 | static private void near(IntPtr space, IntPtr g1, IntPtr g2) | ||
106 | { | ||
107 | //Console.WriteLine("collision callback"); | ||
108 | IntPtr b1 = d.GeomGetBody(g1); | ||
109 | IntPtr b2 = d.GeomGetBody(g2); | ||
110 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) | ||
111 | return; | ||
112 | |||
113 | int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf); | ||
114 | for (int i = 0; i < count; ++i) | ||
115 | { | ||
116 | contact.geom = contacts[i]; | ||
117 | IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); | ||
118 | d.JointAttach(joint, b1, b2); | ||
119 | } | ||
120 | |||
121 | } | ||
122 | |||
123 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
124 | { | ||
125 | PhysicsVector pos = new PhysicsVector(); | ||
126 | pos.X = position.X; | ||
127 | pos.Y = position.Y; | ||
128 | pos.Z = position.Z + 20; | ||
129 | OdeCharacter newAv = new OdeCharacter(this, pos); | ||
130 | this._characters.Add(newAv); | ||
131 | return newAv; | ||
132 | } | ||
133 | |||
134 | public override void RemoveAvatar(PhysicsActor actor) | ||
135 | { | ||
136 | |||
137 | } | ||
138 | |||
139 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
140 | { | ||
141 | PhysicsVector pos = new PhysicsVector(); | ||
142 | pos.X = position.X; | ||
143 | pos.Y = position.Y; | ||
144 | pos.Z = position.Z; | ||
145 | PhysicsVector siz = new PhysicsVector(); | ||
146 | siz.X = size.X; | ||
147 | siz.Y = size.Y; | ||
148 | siz.Z = size.Z; | ||
149 | return new OdePrim(); | ||
150 | } | ||
151 | |||
152 | public override void Simulate(float timeStep) | ||
153 | { | ||
154 | foreach (OdeCharacter actor in _characters) | ||
155 | { | ||
156 | actor.Move(timeStep * 5f); | ||
157 | } | ||
158 | d.SpaceCollide(space, IntPtr.Zero, nearCallback); | ||
159 | d.WorldQuickStep(world, timeStep * 5f); | ||
160 | d.JointGroupEmpty(contactgroup); | ||
161 | foreach (OdeCharacter actor in _characters) | ||
162 | { | ||
163 | actor.UpdatePosition(); | ||
164 | } | ||
165 | |||
166 | } | ||
167 | |||
168 | public override void GetResults() | ||
169 | { | ||
170 | |||
171 | } | ||
172 | |||
173 | public override bool IsThreaded | ||
174 | { | ||
175 | get | ||
176 | { | ||
177 | return (false); // for now we won't be multithreaded | ||
178 | } | ||
179 | } | ||
180 | |||
181 | public override void SetTerrain(float[] heightMap) | ||
182 | { | ||
183 | for (int i = 0; i < 65536; i++) | ||
184 | { | ||
185 | this._heightmap[i] = (double)heightMap[i]; | ||
186 | } | ||
187 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); | ||
188 | d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0); | ||
189 | d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); | ||
190 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); | ||
191 | d.Matrix3 R = new d.Matrix3(); | ||
192 | |||
193 | Axiom.MathLib.Quaternion q1 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(1,0,0)); | ||
194 | Axiom.MathLib.Quaternion q2 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(0,1,0)); | ||
195 | //Axiom.MathLib.Quaternion q3 = Axiom.MathLib.Quaternion.FromAngleAxis(3.14f, new Axiom.MathLib.Vector3(0, 0, 1)); | ||
196 | |||
197 | q1 = q1 * q2; | ||
198 | //q1 = q1 * q3; | ||
199 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(); | ||
200 | float angle = 0; | ||
201 | q1.ToAngleAxis(ref angle, ref v3); | ||
202 | |||
203 | d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); | ||
204 | d.GeomSetRotation(LandGeom, ref R); | ||
205 | d.GeomSetPosition(LandGeom, 128, 128, 0); | ||
206 | } | ||
207 | |||
208 | public override void DeleteTerrain() | ||
209 | { | ||
210 | |||
211 | } | ||
212 | } | ||
213 | |||
214 | public class OdeCharacter : PhysicsActor | ||
215 | { | ||
216 | private PhysicsVector _position; | ||
217 | private PhysicsVector _velocity; | ||
218 | private PhysicsVector _acceleration; | ||
219 | private bool flying; | ||
220 | //private float gravityAccel; | ||
221 | private IntPtr BoundingCapsule; | ||
222 | IntPtr capsule_geom; | ||
223 | d.Mass capsule_mass; | ||
224 | |||
225 | public OdeCharacter(OdeScene parent_scene, PhysicsVector pos) | ||
226 | { | ||
227 | _velocity = new PhysicsVector(); | ||
228 | _position = pos; | ||
229 | _acceleration = new PhysicsVector(); | ||
230 | d.MassSetCapsule(out capsule_mass, 5.0f, 3, 0.5f, 2f); | ||
231 | capsule_geom = d.CreateCapsule(OdeScene.space, 0.5f, 2f); | ||
232 | this.BoundingCapsule = d.BodyCreate(OdeScene.world); | ||
233 | d.BodySetMass(BoundingCapsule, ref capsule_mass); | ||
234 | d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z); | ||
235 | d.GeomSetBody(capsule_geom, BoundingCapsule); | ||
236 | } | ||
237 | |||
238 | public override bool Flying | ||
239 | { | ||
240 | get | ||
241 | { | ||
242 | return flying; | ||
243 | } | ||
244 | set | ||
245 | { | ||
246 | flying = value; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | public override PhysicsVector Position | ||
251 | { | ||
252 | get | ||
253 | { | ||
254 | return _position; | ||
255 | } | ||
256 | set | ||
257 | { | ||
258 | _position = value; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | public override PhysicsVector Velocity | ||
263 | { | ||
264 | get | ||
265 | { | ||
266 | return _velocity; | ||
267 | } | ||
268 | set | ||
269 | { | ||
270 | _velocity = value; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | public override bool Kinematic | ||
275 | { | ||
276 | get | ||
277 | { | ||
278 | return false; | ||
279 | } | ||
280 | set | ||
281 | { | ||
282 | |||
283 | } | ||
284 | } | ||
285 | |||
286 | public override Axiom.MathLib.Quaternion Orientation | ||
287 | { | ||
288 | get | ||
289 | { | ||
290 | return Axiom.MathLib.Quaternion.Identity; | ||
291 | } | ||
292 | set | ||
293 | { | ||
294 | |||
295 | } | ||
296 | } | ||
297 | |||
298 | public override PhysicsVector Acceleration | ||
299 | { | ||
300 | get | ||
301 | { | ||
302 | return _acceleration; | ||
303 | } | ||
304 | |||
305 | } | ||
306 | public void SetAcceleration(PhysicsVector accel) | ||
307 | { | ||
308 | this._acceleration = accel; | ||
309 | } | ||
310 | |||
311 | public override void AddForce(PhysicsVector force) | ||
312 | { | ||
313 | |||
314 | } | ||
315 | |||
316 | public override void SetMomentum(PhysicsVector momentum) | ||
317 | { | ||
318 | |||
319 | } | ||
320 | |||
321 | public void Move(float timeStep) | ||
322 | { | ||
323 | PhysicsVector vec = new PhysicsVector(); | ||
324 | vec.X = this._velocity.X * timeStep; | ||
325 | vec.Y = this._velocity.Y * timeStep; | ||
326 | if (flying) | ||
327 | { | ||
328 | vec.Z = (this._velocity.Z + 0.5f) * timeStep; | ||
329 | } | ||
330 | d.BodySetLinearVel(this.BoundingCapsule, vec.X, vec.Y, vec.Z); | ||
331 | } | ||
332 | |||
333 | public void UpdatePosition() | ||
334 | { | ||
335 | d.Vector3 vec = d.BodyGetPosition(BoundingCapsule); | ||
336 | this._position.X = vec.X; | ||
337 | this._position.Y = vec.Y; | ||
338 | this._position.Z = vec.Z; | ||
339 | } | ||
340 | } | ||
341 | |||
342 | public class OdePrim : PhysicsActor | ||
343 | { | ||
344 | private PhysicsVector _position; | ||
345 | private PhysicsVector _velocity; | ||
346 | private PhysicsVector _acceleration; | ||
347 | |||
348 | public OdePrim() | ||
349 | { | ||
350 | _velocity = new PhysicsVector(); | ||
351 | _position = new PhysicsVector(); | ||
352 | _acceleration = new PhysicsVector(); | ||
353 | } | ||
354 | public override bool Flying | ||
355 | { | ||
356 | get | ||
357 | { | ||
358 | return false; //no flying prims for you | ||
359 | } | ||
360 | set | ||
361 | { | ||
362 | |||
363 | } | ||
364 | } | ||
365 | public override PhysicsVector Position | ||
366 | { | ||
367 | get | ||
368 | { | ||
369 | PhysicsVector pos = new PhysicsVector(); | ||
370 | // PhysicsVector vec = this._prim.Position; | ||
371 | //pos.X = vec.X; | ||
372 | //pos.Y = vec.Y; | ||
373 | //pos.Z = vec.Z; | ||
374 | return pos; | ||
375 | |||
376 | } | ||
377 | set | ||
378 | { | ||
379 | /*PhysicsVector vec = value; | ||
380 | PhysicsVector pos = new PhysicsVector(); | ||
381 | pos.X = vec.X; | ||
382 | pos.Y = vec.Y; | ||
383 | pos.Z = vec.Z; | ||
384 | this._prim.Position = pos;*/ | ||
385 | } | ||
386 | } | ||
387 | |||
388 | public override PhysicsVector Velocity | ||
389 | { | ||
390 | get | ||
391 | { | ||
392 | return _velocity; | ||
393 | } | ||
394 | set | ||
395 | { | ||
396 | _velocity = value; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | public override bool Kinematic | ||
401 | { | ||
402 | get | ||
403 | { | ||
404 | return false; | ||
405 | //return this._prim.Kinematic; | ||
406 | } | ||
407 | set | ||
408 | { | ||
409 | //this._prim.Kinematic = value; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | public override Axiom.MathLib.Quaternion Orientation | ||
414 | { | ||
415 | get | ||
416 | { | ||
417 | Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); | ||
418 | return res; | ||
419 | } | ||
420 | set | ||
421 | { | ||
422 | |||
423 | } | ||
424 | } | ||
425 | |||
426 | public override PhysicsVector Acceleration | ||
427 | { | ||
428 | get | ||
429 | { | ||
430 | return _acceleration; | ||
431 | } | ||
432 | |||
433 | } | ||
434 | public void SetAcceleration(PhysicsVector accel) | ||
435 | { | ||
436 | this._acceleration = accel; | ||
437 | } | ||
438 | |||
439 | public override void AddForce(PhysicsVector force) | ||
440 | { | ||
441 | |||
442 | } | ||
443 | |||
444 | public override void SetMomentum(PhysicsVector momentum) | ||
445 | { | ||
446 | |||
447 | } | ||
448 | |||
449 | |||
450 | } | ||
451 | |||
452 | } | ||
diff --git a/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj b/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj new file mode 100644 index 0000000..68f1aa1 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj | |||
@@ -0,0 +1,97 @@ | |||
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>{63A05FE9-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.OdePlugin</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.OdePlugin</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\Physics\</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\Physics\</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="Axiom.MathLib.dll" > | ||
66 | <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="Ode.NET.dll" > | ||
70 | <HintPath>..\..\bin\Ode.NET.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj"> | ||
76 | <Name>OpenSim.Physics.Manager</Name> | ||
77 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <Compile Include="AssemblyInfo.cs"> | ||
84 | <SubType>Code</SubType> | ||
85 | </Compile> | ||
86 | <Compile Include="OdePlugin.cs"> | ||
87 | <SubType>Code</SubType> | ||
88 | </Compile> | ||
89 | </ItemGroup> | ||
90 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
91 | <PropertyGroup> | ||
92 | <PreBuildEvent> | ||
93 | </PreBuildEvent> | ||
94 | <PostBuildEvent> | ||
95 | </PostBuildEvent> | ||
96 | </PropertyGroup> | ||
97 | </Project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj.user b/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj.user new file mode 100644 index 0000000..d47d65d --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.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/OdePlugin/OpenSim.Physics.OdePlugin.dll.build b/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build new file mode 100644 index 0000000..f25361a --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build | |||
@@ -0,0 +1,43 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.OdePlugin" 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.OdePlugin" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="OdePlugin.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="System.dll" /> | ||
23 | <include name="../../bin/Axiom.MathLib.dll" /> | ||
24 | <include name="../../bin/OpenSim.Physics.Manager.dll" /> | ||
25 | <include name="../../bin/Ode.NET.dll" /> | ||
26 | </references> | ||
27 | </csc> | ||
28 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" /> | ||
29 | <mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/> | ||
30 | <copy todir="${project::get-base-directory()}/../../bin/Physics/"> | ||
31 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
32 | <include name="*.dll"/> | ||
33 | <include name="*.exe"/> | ||
34 | </fileset> | ||
35 | </copy> | ||
36 | </target> | ||
37 | <target name="clean"> | ||
38 | <delete dir="${bin.dir}" failonerror="false" /> | ||
39 | <delete dir="${obj.dir}" failonerror="false" /> | ||
40 | </target> | ||
41 | <target name="doc" description="Creates documentation."> | ||
42 | </target> | ||
43 | </project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs new file mode 100644 index 0000000..913aae7 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/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("RealPhysXplugin")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("RealPhysXplugin")] | ||
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/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj new file mode 100644 index 0000000..efe9c79 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj | |||
@@ -0,0 +1,97 @@ | |||
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>{988F0AC4-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.PhysXPlugin</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.PhysXPlugin</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\Physics\</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\Physics\</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="Axiom.MathLib.dll" > | ||
66 | <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="PhysX_Wrapper_Dotnet.dll" > | ||
70 | <HintPath>..\..\bin\PhysX_Wrapper_Dotnet.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | </ItemGroup> | ||
74 | <ItemGroup> | ||
75 | <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj"> | ||
76 | <Name>OpenSim.Physics.Manager</Name> | ||
77 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
78 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
79 | <Private>False</Private> | ||
80 | </ProjectReference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <Compile Include="AssemblyInfo.cs"> | ||
84 | <SubType>Code</SubType> | ||
85 | </Compile> | ||
86 | <Compile Include="PhysXPlugin.cs"> | ||
87 | <SubType>Code</SubType> | ||
88 | </Compile> | ||
89 | </ItemGroup> | ||
90 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
91 | <PropertyGroup> | ||
92 | <PreBuildEvent> | ||
93 | </PreBuildEvent> | ||
94 | <PostBuildEvent> | ||
95 | </PostBuildEvent> | ||
96 | </PropertyGroup> | ||
97 | </Project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj.user b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj.user new file mode 100644 index 0000000..d47d65d --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.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/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build new file mode 100644 index 0000000..5ab70bb --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build | |||
@@ -0,0 +1,43 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Physics.PhysXPlugin" 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.PhysXPlugin" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="PhysXPlugin.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="System.dll" /> | ||
23 | <include name="../../bin/Axiom.MathLib.dll" /> | ||
24 | <include name="../../bin/PhysX_Wrapper_Dotnet.dll" /> | ||
25 | <include name="../../bin/OpenSim.Physics.Manager.dll" /> | ||
26 | </references> | ||
27 | </csc> | ||
28 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" /> | ||
29 | <mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/> | ||
30 | <copy todir="${project::get-base-directory()}/../../bin/Physics/"> | ||
31 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
32 | <include name="*.dll"/> | ||
33 | <include name="*.exe"/> | ||
34 | </fileset> | ||
35 | </copy> | ||
36 | </target> | ||
37 | <target name="clean"> | ||
38 | <delete dir="${bin.dir}" failonerror="false" /> | ||
39 | <delete dir="${obj.dir}" failonerror="false" /> | ||
40 | </target> | ||
41 | <target name="doc" description="Creates documentation."> | ||
42 | </target> | ||
43 | </project> | ||
diff --git a/OpenSim-Source/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs new file mode 100644 index 0000000..dff1ee2 --- /dev/null +++ b/OpenSim-Source/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -0,0 +1,449 @@ | |||
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 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
29 | * | ||
30 | * Redistribution and use in source and binary forms, with or without | ||
31 | * modification, are permitted provided that the following conditions are met: | ||
32 | * * Redistributions of source code must retain the above copyright | ||
33 | * notice, this list of conditions and the following disclaimer. | ||
34 | * * Redistributions in binary form must reproduce the above copyright | ||
35 | * notice, this list of conditions and the following disclaimer in the | ||
36 | * documentation and/or other materials provided with the distribution. | ||
37 | * * Neither the name of the <organization> nor the | ||
38 | * names of its contributors may be used to endorse or promote products | ||
39 | * derived from this software without specific prior written permission. | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
42 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
43 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
44 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
45 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
46 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
48 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
49 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
50 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | * | ||
52 | */ | ||
53 | using System; | ||
54 | using System.Collections.Generic; | ||
55 | using OpenSim.Physics.Manager; | ||
56 | using PhysXWrapper; | ||
57 | |||
58 | namespace OpenSim.Physics.PhysXPlugin | ||
59 | { | ||
60 | /// <summary> | ||
61 | /// Will be the PhysX plugin but for now will be a very basic physics engine | ||
62 | /// </summary> | ||
63 | public class PhysXPlugin : IPhysicsPlugin | ||
64 | { | ||
65 | private PhysXScene _mScene; | ||
66 | |||
67 | public PhysXPlugin() | ||
68 | { | ||
69 | |||
70 | } | ||
71 | |||
72 | public bool Init() | ||
73 | { | ||
74 | return true; | ||
75 | } | ||
76 | |||
77 | public PhysicsScene GetScene() | ||
78 | { | ||
79 | if(_mScene == null) | ||
80 | { | ||
81 | _mScene = new PhysXScene(); | ||
82 | } | ||
83 | return(_mScene); | ||
84 | } | ||
85 | |||
86 | public string GetName() | ||
87 | { | ||
88 | return("RealPhysX"); | ||
89 | } | ||
90 | |||
91 | public void Dispose() | ||
92 | { | ||
93 | |||
94 | } | ||
95 | } | ||
96 | |||
97 | public class PhysXScene :PhysicsScene | ||
98 | { | ||
99 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); | ||
100 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); | ||
101 | private float[] _heightMap = null; | ||
102 | private NxPhysicsSDK mySdk; | ||
103 | private NxScene scene; | ||
104 | |||
105 | public PhysXScene() | ||
106 | { | ||
107 | mySdk = NxPhysicsSDK.CreateSDK(); | ||
108 | Console.WriteLine("Sdk created - now creating scene"); | ||
109 | scene = mySdk.CreateScene(); | ||
110 | |||
111 | } | ||
112 | |||
113 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
114 | { | ||
115 | Vec3 pos = new Vec3(); | ||
116 | pos.X = position.X; | ||
117 | pos.Y = position.Y; | ||
118 | pos.Z = position.Z; | ||
119 | PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); | ||
120 | act.Position = position; | ||
121 | _characters.Add(act); | ||
122 | return act; | ||
123 | } | ||
124 | |||
125 | public override void RemoveAvatar(PhysicsActor actor) | ||
126 | { | ||
127 | |||
128 | } | ||
129 | |||
130 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
131 | { | ||
132 | Vec3 pos = new Vec3(); | ||
133 | pos.X = position.X; | ||
134 | pos.Y = position.Y; | ||
135 | pos.Z = position.Z; | ||
136 | Vec3 siz = new Vec3(); | ||
137 | siz.X = size.X; | ||
138 | siz.Y = size.Y; | ||
139 | siz.Z = size.Z; | ||
140 | PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); | ||
141 | _prims.Add(act); | ||
142 | return act; | ||
143 | } | ||
144 | public override void Simulate(float timeStep) | ||
145 | { | ||
146 | try | ||
147 | { | ||
148 | foreach (PhysXCharacter actor in _characters) | ||
149 | { | ||
150 | actor.Move(timeStep); | ||
151 | } | ||
152 | scene.Simulate(timeStep); | ||
153 | scene.FetchResults(); | ||
154 | scene.UpdateControllers(); | ||
155 | |||
156 | foreach (PhysXCharacter actor in _characters) | ||
157 | { | ||
158 | actor.UpdatePosition(); | ||
159 | } | ||
160 | } | ||
161 | catch (Exception e) | ||
162 | { | ||
163 | Console.WriteLine(e.Message); | ||
164 | } | ||
165 | |||
166 | } | ||
167 | |||
168 | public override void GetResults() | ||
169 | { | ||
170 | |||
171 | } | ||
172 | |||
173 | public override bool IsThreaded | ||
174 | { | ||
175 | get | ||
176 | { | ||
177 | return(false); // for now we won't be multithreaded | ||
178 | } | ||
179 | } | ||
180 | |||
181 | public override void SetTerrain(float[] heightMap) | ||
182 | { | ||
183 | if (this._heightMap != null) | ||
184 | { | ||
185 | Console.WriteLine("PhysX - deleting old terrain"); | ||
186 | this.scene.DeleteTerrain(); | ||
187 | } | ||
188 | this._heightMap = heightMap; | ||
189 | this.scene.AddTerrain(heightMap); | ||
190 | } | ||
191 | |||
192 | public override void DeleteTerrain() | ||
193 | { | ||
194 | this.scene.DeleteTerrain(); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | public class PhysXCharacter : PhysicsActor | ||
199 | { | ||
200 | private PhysicsVector _position; | ||
201 | private PhysicsVector _velocity; | ||
202 | private PhysicsVector _acceleration; | ||
203 | private NxCharacter _character; | ||
204 | private bool flying; | ||
205 | private float gravityAccel; | ||
206 | |||
207 | public PhysXCharacter(NxCharacter character) | ||
208 | { | ||
209 | _velocity = new PhysicsVector(); | ||
210 | _position = new PhysicsVector(); | ||
211 | _acceleration = new PhysicsVector(); | ||
212 | _character = character; | ||
213 | } | ||
214 | |||
215 | public override bool Flying | ||
216 | { | ||
217 | get | ||
218 | { | ||
219 | return flying; | ||
220 | } | ||
221 | set | ||
222 | { | ||
223 | flying = value; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | public override PhysicsVector Position | ||
228 | { | ||
229 | get | ||
230 | { | ||
231 | return _position; | ||
232 | } | ||
233 | set | ||
234 | { | ||
235 | _position = value; | ||
236 | Vec3 ps = new Vec3(); | ||
237 | ps.X = value.X; | ||
238 | ps.Y = value.Y; | ||
239 | ps.Z = value.Z; | ||
240 | this._character.Position = ps; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | public override PhysicsVector Velocity | ||
245 | { | ||
246 | get | ||
247 | { | ||
248 | return _velocity; | ||
249 | } | ||
250 | set | ||
251 | { | ||
252 | _velocity = value; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | public override bool Kinematic | ||
257 | { | ||
258 | get | ||
259 | { | ||
260 | return false; | ||
261 | } | ||
262 | set | ||
263 | { | ||
264 | |||
265 | } | ||
266 | } | ||
267 | |||
268 | public override Axiom.MathLib.Quaternion Orientation | ||
269 | { | ||
270 | get | ||
271 | { | ||
272 | return Axiom.MathLib.Quaternion.Identity; | ||
273 | } | ||
274 | set | ||
275 | { | ||
276 | |||
277 | } | ||
278 | } | ||
279 | |||
280 | public override PhysicsVector Acceleration | ||
281 | { | ||
282 | get | ||
283 | { | ||
284 | return _acceleration; | ||
285 | } | ||
286 | |||
287 | } | ||
288 | public void SetAcceleration (PhysicsVector accel) | ||
289 | { | ||
290 | this._acceleration = accel; | ||
291 | } | ||
292 | |||
293 | public override void AddForce(PhysicsVector force) | ||
294 | { | ||
295 | |||
296 | } | ||
297 | |||
298 | public override void SetMomentum(PhysicsVector momentum) | ||
299 | { | ||
300 | |||
301 | } | ||
302 | |||
303 | public void Move(float timeStep) | ||
304 | { | ||
305 | Vec3 vec = new Vec3(); | ||
306 | vec.X = this._velocity.X * timeStep; | ||
307 | vec.Y = this._velocity.Y * timeStep; | ||
308 | if(flying) | ||
309 | { | ||
310 | vec.Z = ( this._velocity.Z) * timeStep; | ||
311 | } | ||
312 | else | ||
313 | { | ||
314 | gravityAccel+= -9.8f; | ||
315 | vec.Z = (gravityAccel + this._velocity.Z) * timeStep; | ||
316 | } | ||
317 | int res = this._character.Move(vec); | ||
318 | if(res == 1) | ||
319 | { | ||
320 | gravityAccel = 0; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | public void UpdatePosition() | ||
325 | { | ||
326 | Vec3 vec = this._character.Position; | ||
327 | this._position.X = vec.X; | ||
328 | this._position.Y = vec.Y; | ||
329 | this._position.Z = vec.Z; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | public class PhysXPrim : PhysicsActor | ||
334 | { | ||
335 | private PhysicsVector _position; | ||
336 | private PhysicsVector _velocity; | ||
337 | private PhysicsVector _acceleration; | ||
338 | private NxActor _prim; | ||
339 | |||
340 | public PhysXPrim(NxActor prim) | ||
341 | { | ||
342 | _velocity = new PhysicsVector(); | ||
343 | _position = new PhysicsVector(); | ||
344 | _acceleration = new PhysicsVector(); | ||
345 | _prim = prim; | ||
346 | } | ||
347 | public override bool Flying | ||
348 | { | ||
349 | get | ||
350 | { | ||
351 | return false; //no flying prims for you | ||
352 | } | ||
353 | set | ||
354 | { | ||
355 | |||
356 | } | ||
357 | } | ||
358 | public override PhysicsVector Position | ||
359 | { | ||
360 | get | ||
361 | { | ||
362 | PhysicsVector pos = new PhysicsVector(); | ||
363 | Vec3 vec = this._prim.Position; | ||
364 | pos.X = vec.X; | ||
365 | pos.Y = vec.Y; | ||
366 | pos.Z = vec.Z; | ||
367 | return pos; | ||
368 | |||
369 | } | ||
370 | set | ||
371 | { | ||
372 | PhysicsVector vec = value; | ||
373 | Vec3 pos = new Vec3(); | ||
374 | pos.X = vec.X; | ||
375 | pos.Y = vec.Y; | ||
376 | pos.Z = vec.Z; | ||
377 | this._prim.Position = pos; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | public override PhysicsVector Velocity | ||
382 | { | ||
383 | get | ||
384 | { | ||
385 | return _velocity; | ||
386 | } | ||
387 | set | ||
388 | { | ||
389 | _velocity = value; | ||
390 | } | ||
391 | } | ||
392 | |||
393 | public override bool Kinematic | ||
394 | { | ||
395 | get | ||
396 | { | ||
397 | return this._prim.Kinematic; | ||
398 | } | ||
399 | set | ||
400 | { | ||
401 | this._prim.Kinematic = value; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | public override Axiom.MathLib.Quaternion Orientation | ||
406 | { | ||
407 | get | ||
408 | { | ||
409 | Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); | ||
410 | PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); | ||
411 | res.w = quat.W; | ||
412 | res.x = quat.X; | ||
413 | res.y = quat.Y; | ||
414 | res.z = quat.Z; | ||
415 | return res; | ||
416 | } | ||
417 | set | ||
418 | { | ||
419 | |||
420 | } | ||
421 | } | ||
422 | |||
423 | public override PhysicsVector Acceleration | ||
424 | { | ||
425 | get | ||
426 | { | ||
427 | return _acceleration; | ||
428 | } | ||
429 | |||
430 | } | ||
431 | public void SetAcceleration (PhysicsVector accel) | ||
432 | { | ||
433 | this._acceleration = accel; | ||
434 | } | ||
435 | |||
436 | public override void AddForce(PhysicsVector force) | ||
437 | { | ||
438 | |||
439 | } | ||
440 | |||
441 | public override void SetMomentum(PhysicsVector momentum) | ||
442 | { | ||
443 | |||
444 | } | ||
445 | |||
446 | |||
447 | } | ||
448 | |||
449 | } | ||