aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Physics
diff options
context:
space:
mode:
authorgareth2007-03-25 01:23:34 +0000
committergareth2007-03-25 01:23:34 +0000
commita31f7e21e9feb72e76f485923616866178e47ba0 (patch)
tree4852f18e2b80988f2cfadaebe5054b7e70428157 /OpenSim.Physics
parent.pdb files shouldn't reside in SVN. (diff)
downloadopensim-SC_OLD-a31f7e21e9feb72e76f485923616866178e47ba0.zip
opensim-SC_OLD-a31f7e21e9feb72e76f485923616866178e47ba0.tar.gz
opensim-SC_OLD-a31f7e21e9feb72e76f485923616866178e47ba0.tar.bz2
opensim-SC_OLD-a31f7e21e9feb72e76f485923616866178e47ba0.tar.xz
Added skeleton ODE plugin
Diffstat (limited to 'OpenSim.Physics')
-rw-r--r--OpenSim.Physics/OdePlugin/AssemblyInfo.cs31
-rw-r--r--OpenSim.Physics/OdePlugin/OdePlugin.cs357
-rw-r--r--OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build43
3 files changed, 431 insertions, 0 deletions
diff --git a/OpenSim.Physics/OdePlugin/AssemblyInfo.cs b/OpenSim.Physics/OdePlugin/AssemblyInfo.cs
new file mode 100644
index 0000000..913aae7
--- /dev/null
+++ b/OpenSim.Physics/OdePlugin/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using 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.Physics/OdePlugin/OdePlugin.cs b/OpenSim.Physics/OdePlugin/OdePlugin.cs
new file mode 100644
index 0000000..cb96533
--- /dev/null
+++ b/OpenSim.Physics/OdePlugin/OdePlugin.cs
@@ -0,0 +1,357 @@
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*/
27using System;
28using System.Collections.Generic;
29using OpenSim.Physics.Manager;
30
31namespace OpenSim.Physics.OdePlugin
32{
33 /// <summary>
34 /// ODE plugin
35 /// </summary>
36 public class OdePlugin : IPhysicsPlugin
37 {
38 private OdeScene _mScene;
39
40 public OdePlugin()
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 OdeScene();
55 }
56 return(_mScene);
57 }
58
59 public string GetName()
60 {
61 return("OpenDynamicsEngine");
62 }
63
64 public void Dispose()
65 {
66
67 }
68 }
69
70 public class OdeScene :PhysicsScene
71 {
72
73 public OdeScene()
74 {
75
76 }
77
78 public override PhysicsActor AddAvatar(PhysicsVector position)
79 {
80 PhysicsVector pos = new PhysicsVector();
81 pos.X = position.X;
82 pos.Y = position.Y;
83 pos.Z = position.Z;
84 return new OdeCharacter();
85 }
86
87 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
88 {
89 PhysicsVector pos = new PhysicsVector();
90 pos.X = position.X;
91 pos.Y = position.Y;
92 pos.Z = position.Z;
93 PhysicsVector siz = new PhysicsVector();
94 siz.X = size.X;
95 siz.Y = size.Y;
96 siz.Z = size.Z;
97 return new OdePrim();
98 }
99
100 public override void Simulate(float timeStep)
101 {
102
103 }
104
105 public override void GetResults()
106 {
107
108 }
109
110 public override bool IsThreaded
111 {
112 get
113 {
114 return(false); // for now we won't be multithreaded
115 }
116 }
117
118 public override void SetTerrain(float[] heightMap)
119 {
120 }
121 }
122
123 public class OdeCharacter : PhysicsActor
124 {
125 private PhysicsVector _position;
126 private PhysicsVector _velocity;
127 private PhysicsVector _acceleration;
128 private bool flying;
129 private float gravityAccel;
130
131 public OdeCharacter()
132 {
133 _velocity = new PhysicsVector();
134 _position = new PhysicsVector();
135 _acceleration = new PhysicsVector();
136 }
137
138 public override bool Flying
139 {
140 get
141 {
142 return flying;
143 }
144 set
145 {
146 flying = value;
147 }
148 }
149
150 public override PhysicsVector Position
151 {
152 get
153 {
154 return _position;
155 }
156 set
157 {
158 _position = value;
159 }
160 }
161
162 public override PhysicsVector Velocity
163 {
164 get
165 {
166 return _velocity;
167 }
168 set
169 {
170 _velocity = value;
171 }
172 }
173
174 public override bool Kinematic
175 {
176 get
177 {
178 return false;
179 }
180 set
181 {
182
183 }
184 }
185
186 public override Axiom.MathLib.Quaternion Orientation
187 {
188 get
189 {
190 return Axiom.MathLib.Quaternion.Identity;
191 }
192 set
193 {
194
195 }
196 }
197
198 public override PhysicsVector Acceleration
199 {
200 get
201 {
202 return _acceleration;
203 }
204
205 }
206 public void SetAcceleration (PhysicsVector accel)
207 {
208 this._acceleration = accel;
209 }
210
211 public override void AddForce(PhysicsVector force)
212 {
213
214 }
215
216 public override void SetMomentum(PhysicsVector momentum)
217 {
218
219 }
220
221 public void Move(float timeStep)
222 {
223 PhysicsVector vec = new PhysicsVector();
224 vec.X = this._velocity.X * timeStep;
225 vec.Y = this._velocity.Y * timeStep;
226 if(flying)
227 {
228 vec.Z = ( this._velocity.Z) * timeStep;
229 }
230 else
231 {
232 gravityAccel+= -9.8f;
233 vec.Z = (gravityAccel + this._velocity.Z) * timeStep;
234 }
235 //int res = this._character.Move(vec);
236 //if(res == 1)
237 //{
238 // gravityAccel = 0;
239 //}
240 }
241
242 public void UpdatePosition()
243 {
244 }
245 }
246
247 public class OdePrim : PhysicsActor
248 {
249 private PhysicsVector _position;
250 private PhysicsVector _velocity;
251 private PhysicsVector _acceleration;
252
253 public OdePrim()
254 {
255 _velocity = new PhysicsVector();
256 _position = new PhysicsVector();
257 _acceleration = new PhysicsVector();
258 }
259 public override bool Flying
260 {
261 get
262 {
263 return false; //no flying prims for you
264 }
265 set
266 {
267
268 }
269 }
270 public override PhysicsVector Position
271 {
272 get
273 {
274 PhysicsVector pos = new PhysicsVector();
275 //PhysicsVector vec = this._prim.Position;
276 //pos.X = vec.X;
277 //pos.Y = vec.Y;
278 //pos.Z = vec.Z;
279 return pos;
280
281 }
282 set
283 {
284 /*PhysicsVector vec = value;
285 PhysicsVector pos = new PhysicsVector();
286 pos.X = vec.X;
287 pos.Y = vec.Y;
288 pos.Z = vec.Z;
289 this._prim.Position = pos;*/
290 }
291 }
292
293 public override PhysicsVector Velocity
294 {
295 get
296 {
297 return _velocity;
298 }
299 set
300 {
301 _velocity = value;
302 }
303 }
304
305 public override bool Kinematic
306 {
307 get
308 {
309 return false;
310 //return this._prim.Kinematic;
311 }
312 set
313 {
314 //this._prim.Kinematic = value;
315 }
316 }
317
318 public override Axiom.MathLib.Quaternion Orientation
319 {
320 get
321 {
322 Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion();
323 return res;
324 }
325 set
326 {
327
328 }
329 }
330
331 public override PhysicsVector Acceleration
332 {
333 get
334 {
335 return _acceleration;
336 }
337
338 }
339 public void SetAcceleration (PhysicsVector accel)
340 {
341 this._acceleration = accel;
342 }
343
344 public override void AddForce(PhysicsVector force)
345 {
346
347 }
348
349 public override void SetMomentum(PhysicsVector momentum)
350 {
351
352 }
353
354
355 }
356
357}
diff --git a/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build b/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build
new file mode 100644
index 0000000..e738ab1
--- /dev/null
+++ b/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" 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="../Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
25 <include name="../../bin/../lib/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>