diff options
author | Melanie | 2012-02-21 10:20:56 +0000 |
---|---|---|
committer | Melanie | 2012-02-21 10:20:56 +0000 |
commit | 03e7bc1526d24efe23f61f6a8dee88010ccfdb8c (patch) | |
tree | c2c2afef43a697dec1373ef5987f7d163031e5e2 /OpenSim/Region/Physics | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff) | |
parent | Both 32-bit and 64-bit BulletSim.dll must have the same name. Rename the 64 ... (diff) | |
download | opensim-SC-03e7bc1526d24efe23f61f6a8dee88010ccfdb8c.zip opensim-SC-03e7bc1526d24efe23f61f6a8dee88010ccfdb8c.tar.gz opensim-SC-03e7bc1526d24efe23f61f6a8dee88010ccfdb8c.tar.bz2 opensim-SC-03e7bc1526d24efe23f61f6a8dee88010ccfdb8c.tar.xz |
Merge branch 'master' into careminster
Conflicts:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs | 349 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs | 341 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs | 177 |
6 files changed, 4 insertions, 939 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs index 61be56d..0730824 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs | |||
@@ -51,6 +51,9 @@ public class BSPlugin : IPhysicsPlugin | |||
51 | { | 51 | { |
52 | if (_mScene == null) | 52 | if (_mScene == null) |
53 | { | 53 | { |
54 | if (Util.IsWindows()) | ||
55 | Util.LoadArchSpecificWindowsDll("BulletSim.dll"); | ||
56 | |||
54 | _mScene = new BSScene(sceneIdentifier); | 57 | _mScene = new BSScene(sceneIdentifier); |
55 | } | 58 | } |
56 | return (_mScene); | 59 | return (_mScene); |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index e8bb476..478dd95 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -66,20 +66,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
66 | // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be | 66 | // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be |
67 | // controlled in Ode.NET.dll.config | 67 | // controlled in Ode.NET.dll.config |
68 | if (Util.IsWindows()) | 68 | if (Util.IsWindows()) |
69 | { | 69 | Util.LoadArchSpecificWindowsDll("ode.dll"); |
70 | string nativeLibraryPath; | ||
71 | |||
72 | if (Util.Is64BitProcess()) | ||
73 | nativeLibraryPath = "lib64/ode.dll"; | ||
74 | else | ||
75 | nativeLibraryPath = "lib32/ode.dll"; | ||
76 | |||
77 | m_log.DebugFormat("[ODE PLUGIN]: Loading native Windows ODE library at {0}", nativeLibraryPath); | ||
78 | |||
79 | if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero) | ||
80 | m_log.ErrorFormat( | ||
81 | "[ODE PLUGIN]: Couldn't find native Windows ODE library at {0}", nativeLibraryPath); | ||
82 | } | ||
83 | 70 | ||
84 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | 71 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to |
85 | // http://opensimulator.org/mantis/view.php?id=2750). | 72 | // http://opensimulator.org/mantis/view.php?id=2750). |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs deleted file mode 100644 index fa5e66a..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | |||
31 | // Information about this assembly is defined by the following | ||
32 | // attributes. | ||
33 | // | ||
34 | // change them to the information which is associated with the assembly | ||
35 | // you compile. | ||
36 | |||
37 | [assembly : AssemblyTitle("RealPhysXplugin")] | ||
38 | [assembly : AssemblyDescription("")] | ||
39 | [assembly : AssemblyConfiguration("")] | ||
40 | [assembly : AssemblyCompany("http://opensimulator.org")] | ||
41 | [assembly : AssemblyProduct("RealPhysXplugin")] | ||
42 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] | ||
43 | [assembly : AssemblyTrademark("")] | ||
44 | [assembly : AssemblyCulture("")] | ||
45 | |||
46 | // This sets the default COM visibility of types in the assembly to invisible. | ||
47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
48 | |||
49 | [assembly : ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [assembly : AssemblyVersion("0.6.5.*")] | ||
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs deleted file mode 100644 index 9216a9e..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs +++ /dev/null | |||
@@ -1,349 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Physics.Manager; | ||
33 | using PhysXWrapper; | ||
34 | using Quaternion=OpenMetaverse.Quaternion; | ||
35 | using System.Reflection; | ||
36 | using log4net; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Region.Physics.PhysXPlugin | ||
40 | { | ||
41 | public class PhysXCharacter : PhysicsActor | ||
42 | { | ||
43 | private Vector3 _position; | ||
44 | private Vector3 _velocity; | ||
45 | private Vector3 m_rotationalVelocity = Vector3.Zero; | ||
46 | private Vector3 _acceleration; | ||
47 | private NxCharacter _character; | ||
48 | private bool flying; | ||
49 | private bool iscolliding = false; | ||
50 | private float gravityAccel; | ||
51 | |||
52 | public PhysXCharacter(NxCharacter character) | ||
53 | { | ||
54 | _character = character; | ||
55 | } | ||
56 | |||
57 | public override int PhysicsActorType | ||
58 | { | ||
59 | get { return (int) ActorTypes.Agent; } | ||
60 | set { return; } | ||
61 | } | ||
62 | |||
63 | public override bool SetAlwaysRun | ||
64 | { | ||
65 | get { return false; } | ||
66 | set { return; } | ||
67 | } | ||
68 | |||
69 | public override uint LocalID | ||
70 | { | ||
71 | set { return; } | ||
72 | } | ||
73 | |||
74 | public override bool Grabbed | ||
75 | { | ||
76 | set { return; } | ||
77 | } | ||
78 | |||
79 | public override bool Selected | ||
80 | { | ||
81 | set { return; } | ||
82 | } | ||
83 | |||
84 | public override float Buoyancy | ||
85 | { | ||
86 | get { return 0f; } | ||
87 | set { return; } | ||
88 | } | ||
89 | |||
90 | public override bool FloatOnWater | ||
91 | { | ||
92 | set { return; } | ||
93 | } | ||
94 | |||
95 | public override bool IsPhysical | ||
96 | { | ||
97 | get { return false; } | ||
98 | set { return; } | ||
99 | } | ||
100 | |||
101 | public override bool ThrottleUpdates | ||
102 | { | ||
103 | get { return false; } | ||
104 | set { return; } | ||
105 | } | ||
106 | |||
107 | public override bool Flying | ||
108 | { | ||
109 | get { return flying; } | ||
110 | set { flying = value; } | ||
111 | } | ||
112 | |||
113 | public override bool IsColliding | ||
114 | { | ||
115 | get { return iscolliding; } | ||
116 | set { iscolliding = value; } | ||
117 | } | ||
118 | |||
119 | public override bool CollidingGround | ||
120 | { | ||
121 | get { return false; } | ||
122 | set { return; } | ||
123 | } | ||
124 | |||
125 | public override bool CollidingObj | ||
126 | { | ||
127 | get { return false; } | ||
128 | set { return; } | ||
129 | } | ||
130 | |||
131 | public override Vector3 RotationalVelocity | ||
132 | { | ||
133 | get { return m_rotationalVelocity; } | ||
134 | set { m_rotationalVelocity = value; } | ||
135 | } | ||
136 | |||
137 | public override bool Stopped | ||
138 | { | ||
139 | get { return false; } | ||
140 | } | ||
141 | |||
142 | public override Vector3 Position | ||
143 | { | ||
144 | get { return _position; } | ||
145 | set | ||
146 | { | ||
147 | _position = value; | ||
148 | Vec3 ps = new Vec3(); | ||
149 | ps.X = value.X; | ||
150 | ps.Y = value.Y; | ||
151 | ps.Z = value.Z; | ||
152 | _character.Position = ps; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | public override Vector3 Size | ||
157 | { | ||
158 | get { return Vector3.Zero; } | ||
159 | set { } | ||
160 | } | ||
161 | |||
162 | public override float Mass | ||
163 | { | ||
164 | get { return 0f; } | ||
165 | } | ||
166 | |||
167 | public override Vector3 Force | ||
168 | { | ||
169 | get { return Vector3.Zero; } | ||
170 | set { return; } | ||
171 | } | ||
172 | |||
173 | public override int VehicleType | ||
174 | { | ||
175 | get { return 0; } | ||
176 | set { return; } | ||
177 | } | ||
178 | |||
179 | public override void VehicleFloatParam(int param, float value) | ||
180 | { | ||
181 | } | ||
182 | |||
183 | public override void VehicleVectorParam(int param, Vector3 value) | ||
184 | { | ||
185 | } | ||
186 | |||
187 | public override void VehicleRotationParam(int param, Quaternion rotation) | ||
188 | { | ||
189 | } | ||
190 | |||
191 | public override void VehicleFlags(int param, bool remove) | ||
192 | { | ||
193 | } | ||
194 | |||
195 | public override void SetVolumeDetect(int param) | ||
196 | { | ||
197 | } | ||
198 | |||
199 | public override Vector3 CenterOfMass | ||
200 | { | ||
201 | get { return Vector3.Zero; } | ||
202 | } | ||
203 | |||
204 | public override Vector3 GeometricCenter | ||
205 | { | ||
206 | get { return Vector3.Zero; } | ||
207 | } | ||
208 | |||
209 | public override Vector3 Velocity | ||
210 | { | ||
211 | get { return _velocity; } | ||
212 | set { _velocity = value; } | ||
213 | } | ||
214 | |||
215 | public override float CollisionScore | ||
216 | { | ||
217 | get { return 0f; } | ||
218 | set { } | ||
219 | } | ||
220 | |||
221 | public override bool Kinematic | ||
222 | { | ||
223 | get { return false; } | ||
224 | set { } | ||
225 | } | ||
226 | |||
227 | public override Quaternion Orientation | ||
228 | { | ||
229 | get { return Quaternion.Identity; } | ||
230 | set { } | ||
231 | } | ||
232 | |||
233 | public override Vector3 Acceleration | ||
234 | { | ||
235 | get { return _acceleration; } | ||
236 | set { _acceleration = value; } | ||
237 | } | ||
238 | |||
239 | public override void AddForce(Vector3 force, bool pushforce) | ||
240 | { | ||
241 | } | ||
242 | |||
243 | public override Vector3 Torque | ||
244 | { | ||
245 | get { return Vector3.Zero; } | ||
246 | set { return; } | ||
247 | } | ||
248 | |||
249 | public override void AddAngularForce(Vector3 force, bool pushforce) | ||
250 | { | ||
251 | } | ||
252 | |||
253 | public override void link(PhysicsActor obj) | ||
254 | { | ||
255 | } | ||
256 | |||
257 | public override void delink() | ||
258 | { | ||
259 | } | ||
260 | |||
261 | public override void LockAngularMotion(Vector3 axis) | ||
262 | { | ||
263 | } | ||
264 | |||
265 | public override void SetMomentum(Vector3 momentum) | ||
266 | { | ||
267 | } | ||
268 | |||
269 | public void Move(float timeStep) | ||
270 | { | ||
271 | Vec3 vec = new Vec3(); | ||
272 | vec.X = _velocity.X*timeStep; | ||
273 | vec.Y = _velocity.Y*timeStep; | ||
274 | if (flying) | ||
275 | { | ||
276 | vec.Z = (_velocity.Z)*timeStep; | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | gravityAccel += -9.8f; | ||
281 | vec.Z = (gravityAccel + _velocity.Z)*timeStep; | ||
282 | } | ||
283 | int res = _character.Move(vec); | ||
284 | if (res == 1) | ||
285 | { | ||
286 | gravityAccel = 0; | ||
287 | } | ||
288 | } | ||
289 | |||
290 | public override PrimitiveBaseShape Shape | ||
291 | { | ||
292 | set { return; } | ||
293 | } | ||
294 | |||
295 | public void UpdatePosition() | ||
296 | { | ||
297 | Vec3 vec = _character.Position; | ||
298 | _position.X = vec.X; | ||
299 | _position.Y = vec.Y; | ||
300 | _position.Z = vec.Z; | ||
301 | } | ||
302 | |||
303 | public override void CrossingFailure() | ||
304 | { | ||
305 | } | ||
306 | |||
307 | public override Vector3 PIDTarget { set { return; } } | ||
308 | public override bool PIDActive { set { return; } } | ||
309 | public override float PIDTau { set { return; } } | ||
310 | |||
311 | public override float PIDHoverHeight { set { return; } } | ||
312 | public override bool PIDHoverActive { set { return; } } | ||
313 | public override PIDHoverType PIDHoverType { set { return; } } | ||
314 | public override float PIDHoverTau { set { return; } } | ||
315 | |||
316 | public override Quaternion APIDTarget | ||
317 | { | ||
318 | set { return; } | ||
319 | } | ||
320 | |||
321 | public override bool APIDActive | ||
322 | { | ||
323 | set { return; } | ||
324 | } | ||
325 | |||
326 | public override float APIDStrength | ||
327 | { | ||
328 | set { return; } | ||
329 | } | ||
330 | |||
331 | public override float APIDDamping | ||
332 | { | ||
333 | set { return; } | ||
334 | } | ||
335 | |||
336 | public override void SubscribeEvents(int ms) | ||
337 | { | ||
338 | |||
339 | } | ||
340 | public override void UnSubscribeEvents() | ||
341 | { | ||
342 | |||
343 | } | ||
344 | public override bool SubscribedEvents() | ||
345 | { | ||
346 | return false; | ||
347 | } | ||
348 | } | ||
349 | } | ||
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs deleted file mode 100644 index 42bd119..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs +++ /dev/null | |||
@@ -1,341 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Physics.Manager; | ||
33 | using PhysXWrapper; | ||
34 | using Quaternion=OpenMetaverse.Quaternion; | ||
35 | using System.Reflection; | ||
36 | using log4net; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Region.Physics.PhysXPlugin | ||
40 | { | ||
41 | public class PhysXPrim : PhysicsActor | ||
42 | { | ||
43 | private Vector3 _velocity; | ||
44 | private Vector3 _acceleration; | ||
45 | private Vector3 m_rotationalVelocity; | ||
46 | private NxActor _prim; | ||
47 | |||
48 | public PhysXPrim(NxActor prim) | ||
49 | { | ||
50 | _velocity = Vector3.Zero; | ||
51 | _acceleration = Vector3.Zero; | ||
52 | _prim = prim; | ||
53 | } | ||
54 | |||
55 | public override int PhysicsActorType | ||
56 | { | ||
57 | get { return (int) ActorTypes.Prim; } | ||
58 | set { return; } | ||
59 | } | ||
60 | |||
61 | public override bool IsPhysical | ||
62 | { | ||
63 | get { return false; } | ||
64 | set { return; } | ||
65 | } | ||
66 | |||
67 | public override bool SetAlwaysRun | ||
68 | { | ||
69 | get { return false; } | ||
70 | set { return; } | ||
71 | } | ||
72 | |||
73 | public override uint LocalID | ||
74 | { | ||
75 | set { return; } | ||
76 | } | ||
77 | |||
78 | public override bool Grabbed | ||
79 | { | ||
80 | set { return; } | ||
81 | } | ||
82 | |||
83 | public override bool Selected | ||
84 | { | ||
85 | set { return; } | ||
86 | } | ||
87 | |||
88 | public override float Buoyancy | ||
89 | { | ||
90 | get { return 0f; } | ||
91 | set { return; } | ||
92 | } | ||
93 | |||
94 | public override bool FloatOnWater | ||
95 | { | ||
96 | set { return; } | ||
97 | } | ||
98 | |||
99 | public override bool ThrottleUpdates | ||
100 | { | ||
101 | get { return false; } | ||
102 | set { return; } | ||
103 | } | ||
104 | |||
105 | public override Vector3 RotationalVelocity | ||
106 | { | ||
107 | get { return m_rotationalVelocity; } | ||
108 | set { m_rotationalVelocity = value; } | ||
109 | } | ||
110 | |||
111 | public override bool Flying | ||
112 | { | ||
113 | get { return false; //no flying prims for you | ||
114 | } | ||
115 | set { } | ||
116 | } | ||
117 | |||
118 | public override bool IsColliding | ||
119 | { | ||
120 | get { return false; } | ||
121 | set { } | ||
122 | } | ||
123 | |||
124 | public override bool CollidingGround | ||
125 | { | ||
126 | get { return false; } | ||
127 | set { return; } | ||
128 | } | ||
129 | |||
130 | public override bool CollidingObj | ||
131 | { | ||
132 | get { return false; } | ||
133 | set { return; } | ||
134 | } | ||
135 | |||
136 | public override bool Stopped | ||
137 | { | ||
138 | get { return false; } | ||
139 | } | ||
140 | |||
141 | public override Vector3 Position | ||
142 | { | ||
143 | get | ||
144 | { | ||
145 | Vector3 pos = Vector3.Zero; | ||
146 | Vec3 vec = _prim.Position; | ||
147 | pos.X = vec.X; | ||
148 | pos.Y = vec.Y; | ||
149 | pos.Z = vec.Z; | ||
150 | return pos; | ||
151 | } | ||
152 | set | ||
153 | { | ||
154 | Vector3 vec = value; | ||
155 | Vec3 pos = new Vec3(); | ||
156 | pos.X = vec.X; | ||
157 | pos.Y = vec.Y; | ||
158 | pos.Z = vec.Z; | ||
159 | _prim.Position = pos; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | public override PrimitiveBaseShape Shape | ||
164 | { | ||
165 | set { return; } | ||
166 | } | ||
167 | |||
168 | public override Vector3 Velocity | ||
169 | { | ||
170 | get { return _velocity; } | ||
171 | set { _velocity = value; } | ||
172 | } | ||
173 | |||
174 | public override Vector3 Torque | ||
175 | { | ||
176 | get { return Vector3.Zero; } | ||
177 | set { return; } | ||
178 | } | ||
179 | |||
180 | public override float CollisionScore | ||
181 | { | ||
182 | get { return 0f; } | ||
183 | set { } | ||
184 | } | ||
185 | |||
186 | public override bool Kinematic | ||
187 | { | ||
188 | get { return _prim.Kinematic; } | ||
189 | set { _prim.Kinematic = value; } | ||
190 | } | ||
191 | |||
192 | public override Quaternion Orientation | ||
193 | { | ||
194 | get | ||
195 | { | ||
196 | Quaternion res; | ||
197 | PhysXWrapper.Quaternion quat = _prim.GetOrientation(); | ||
198 | res.W = quat.W; | ||
199 | res.X = quat.X; | ||
200 | res.Y = quat.Y; | ||
201 | res.Z = quat.Z; | ||
202 | return res; | ||
203 | } | ||
204 | set { } | ||
205 | } | ||
206 | |||
207 | public override Vector3 Acceleration | ||
208 | { | ||
209 | get { return _acceleration; } | ||
210 | set { _acceleration = value; } | ||
211 | } | ||
212 | |||
213 | public override void AddForce(Vector3 force, bool pushforce) | ||
214 | { | ||
215 | } | ||
216 | |||
217 | public override void AddAngularForce(Vector3 force, bool pushforce) | ||
218 | { | ||
219 | } | ||
220 | |||
221 | public override void SetMomentum(Vector3 momentum) | ||
222 | { | ||
223 | } | ||
224 | |||
225 | public override Vector3 Size | ||
226 | { | ||
227 | get { return Vector3.Zero; } | ||
228 | set { } | ||
229 | } | ||
230 | |||
231 | public override void link(PhysicsActor obj) | ||
232 | { | ||
233 | } | ||
234 | |||
235 | public override void delink() | ||
236 | { | ||
237 | } | ||
238 | |||
239 | public override void LockAngularMotion(Vector3 axis) | ||
240 | { | ||
241 | |||
242 | } | ||
243 | |||
244 | public override float Mass | ||
245 | { | ||
246 | get { return 0f; } | ||
247 | } | ||
248 | |||
249 | public override Vector3 Force | ||
250 | { | ||
251 | get { return Vector3.Zero; } | ||
252 | set { return; } | ||
253 | } | ||
254 | |||
255 | public override int VehicleType | ||
256 | { | ||
257 | get { return 0; } | ||
258 | set { return; } | ||
259 | } | ||
260 | |||
261 | public override void VehicleFloatParam(int param, float value) | ||
262 | { | ||
263 | |||
264 | } | ||
265 | |||
266 | public override void VehicleVectorParam(int param, Vector3 value) | ||
267 | { | ||
268 | |||
269 | } | ||
270 | |||
271 | public override void VehicleRotationParam(int param, Quaternion rotation) | ||
272 | { | ||
273 | |||
274 | } | ||
275 | |||
276 | public override void VehicleFlags(int param, bool remove) { } | ||
277 | |||
278 | public override void SetVolumeDetect(int param) | ||
279 | { | ||
280 | |||
281 | } | ||
282 | |||
283 | public override Vector3 CenterOfMass | ||
284 | { | ||
285 | get { return Vector3.Zero; } | ||
286 | } | ||
287 | |||
288 | public override Vector3 GeometricCenter | ||
289 | { | ||
290 | get { return Vector3.Zero; } | ||
291 | } | ||
292 | |||
293 | public override void CrossingFailure() | ||
294 | { | ||
295 | } | ||
296 | |||
297 | public override Vector3 PIDTarget { set { return; } } | ||
298 | public override bool PIDActive { set { return; } } | ||
299 | public override float PIDTau { set { return; } } | ||
300 | |||
301 | public override float PIDHoverHeight { set { return; } } | ||
302 | public override bool PIDHoverActive { set { return; } } | ||
303 | public override PIDHoverType PIDHoverType { set { return; } } | ||
304 | public override float PIDHoverTau { set { return; } } | ||
305 | |||
306 | public override Quaternion APIDTarget | ||
307 | { | ||
308 | set { return; } | ||
309 | } | ||
310 | |||
311 | public override bool APIDActive | ||
312 | { | ||
313 | set { return; } | ||
314 | } | ||
315 | |||
316 | public override float APIDStrength | ||
317 | { | ||
318 | set { return; } | ||
319 | } | ||
320 | |||
321 | public override float APIDDamping | ||
322 | { | ||
323 | set { return; } | ||
324 | } | ||
325 | |||
326 | |||
327 | |||
328 | public override void SubscribeEvents(int ms) | ||
329 | { | ||
330 | |||
331 | } | ||
332 | public override void UnSubscribeEvents() | ||
333 | { | ||
334 | |||
335 | } | ||
336 | public override bool SubscribedEvents() | ||
337 | { | ||
338 | return false; | ||
339 | } | ||
340 | } | ||
341 | } | ||
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs deleted file mode 100644 index beb3404..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Physics.Manager; | ||
33 | using PhysXWrapper; | ||
34 | using Quaternion=OpenMetaverse.Quaternion; | ||
35 | using System.Reflection; | ||
36 | using log4net; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Region.Physics.PhysXPlugin | ||
40 | { | ||
41 | public class PhysXScene : PhysicsScene | ||
42 | { | ||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); | ||
45 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); | ||
46 | private float[] _heightMap = null; | ||
47 | private NxPhysicsSDK mySdk; | ||
48 | private NxScene scene; | ||
49 | |||
50 | // protected internal string sceneIdentifier; | ||
51 | public PhysXScene(string _sceneIdentifier) | ||
52 | { | ||
53 | //sceneIdentifier = _sceneIdentifier; | ||
54 | |||
55 | mySdk = NxPhysicsSDK.CreateSDK(); | ||
56 | m_log.Info("Sdk created - now creating scene"); | ||
57 | scene = mySdk.CreateScene(); | ||
58 | } | ||
59 | |||
60 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | ||
61 | { | ||
62 | // Does nothing right now | ||
63 | } | ||
64 | public override void Dispose() | ||
65 | { | ||
66 | |||
67 | } | ||
68 | |||
69 | public override void SetWaterLevel(float baseheight) | ||
70 | { | ||
71 | |||
72 | } | ||
73 | |||
74 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) | ||
75 | { | ||
76 | Vec3 pos = new Vec3(); | ||
77 | pos.X = position.X; | ||
78 | pos.Y = position.Y; | ||
79 | pos.Z = position.Z; | ||
80 | PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos)); | ||
81 | act.Flying = isFlying; | ||
82 | act.Position = position; | ||
83 | _characters.Add(act); | ||
84 | return act; | ||
85 | } | ||
86 | |||
87 | public override void RemovePrim(PhysicsActor prim) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | public override void RemoveAvatar(PhysicsActor actor) | ||
92 | { | ||
93 | } | ||
94 | |||
95 | private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) | ||
96 | { | ||
97 | Vec3 pos = new Vec3(); | ||
98 | pos.X = position.X; | ||
99 | pos.Y = position.Y; | ||
100 | pos.Z = position.Z; | ||
101 | Vec3 siz = new Vec3(); | ||
102 | siz.X = size.X; | ||
103 | siz.Y = size.Y; | ||
104 | siz.Z = size.Z; | ||
105 | PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz)); | ||
106 | _prims.Add(act); | ||
107 | return act; | ||
108 | } | ||
109 | |||
110 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
111 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) | ||
112 | { | ||
113 | return AddPrim(position, size, rotation); | ||
114 | } | ||
115 | |||
116 | public override void AddPhysicsActorTaint(PhysicsActor prim) | ||
117 | { | ||
118 | } | ||
119 | |||
120 | public override float Simulate(float timeStep) | ||
121 | { | ||
122 | float fps = 0f; | ||
123 | try | ||
124 | { | ||
125 | foreach (PhysXCharacter actor in _characters) | ||
126 | { | ||
127 | actor.Move(timeStep); | ||
128 | } | ||
129 | scene.Simulate(timeStep); | ||
130 | scene.FetchResults(); | ||
131 | scene.UpdateControllers(); | ||
132 | |||
133 | foreach (PhysXCharacter actor in _characters) | ||
134 | { | ||
135 | actor.UpdatePosition(); | ||
136 | } | ||
137 | } | ||
138 | catch (Exception e) | ||
139 | { | ||
140 | m_log.Error(e.Message); | ||
141 | } | ||
142 | return fps; | ||
143 | } | ||
144 | |||
145 | public override void GetResults() | ||
146 | { | ||
147 | } | ||
148 | |||
149 | public override bool IsThreaded | ||
150 | { | ||
151 | // for now we won't be multithreaded | ||
152 | get { return (false); } | ||
153 | } | ||
154 | |||
155 | public override void SetTerrain(float[] heightMap) | ||
156 | { | ||
157 | if (_heightMap != null) | ||
158 | { | ||
159 | m_log.Debug("PhysX - deleting old terrain"); | ||
160 | scene.DeleteTerrain(); | ||
161 | } | ||
162 | _heightMap = heightMap; | ||
163 | scene.AddTerrain(heightMap); | ||
164 | } | ||
165 | |||
166 | public override void DeleteTerrain() | ||
167 | { | ||
168 | scene.DeleteTerrain(); | ||
169 | } | ||
170 | |||
171 | public override Dictionary<uint, float> GetTopColliders() | ||
172 | { | ||
173 | Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); | ||
174 | return returncolliders; | ||
175 | } | ||
176 | } | ||
177 | } | ||