diff options
Diffstat (limited to 'src/physics/RealPhysX')
3 files changed, 0 insertions, 438 deletions
diff --git a/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs b/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs deleted file mode 100644 index 913aae7..0000000 --- a/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
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/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs b/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs deleted file mode 100644 index 9576a40..0000000 --- a/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs +++ /dev/null | |||
@@ -1,361 +0,0 @@ | |||
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 PhysicsSystem; | ||
56 | using PhysXWrapper; | ||
57 | |||
58 | namespace 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; | ||
102 | private NxPhysicsSDK mySdk; | ||
103 | private NxScene scene; | ||
104 | |||
105 | public PhysXScene() | ||
106 | { | ||
107 | mySdk = NxPhysicsSDK.CreateSDK(); | ||
108 | scene = mySdk.CreateScene(); | ||
109 | |||
110 | } | ||
111 | |||
112 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
113 | { | ||
114 | Vec3 pos = new Vec3(); | ||
115 | pos.X = position.X; | ||
116 | pos.Y = position.Y; | ||
117 | pos.Z = position.Z; | ||
118 | PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); | ||
119 | act.Position = position; | ||
120 | _characters.Add(act); | ||
121 | return act; | ||
122 | } | ||
123 | |||
124 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
125 | { | ||
126 | Vec3 pos = new Vec3(); | ||
127 | pos.X = position.X; | ||
128 | pos.Y = position.Y; | ||
129 | pos.Z = position.Z; | ||
130 | Vec3 siz = new Vec3(); | ||
131 | siz.X = size.X; | ||
132 | siz.Y = size.Y; | ||
133 | siz.Z = size.Z; | ||
134 | PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); | ||
135 | _prims.Add(act); | ||
136 | return act; | ||
137 | } | ||
138 | public override void Simulate(float timeStep) | ||
139 | { | ||
140 | foreach (PhysXCharacter actor in _characters) | ||
141 | { | ||
142 | actor.Move(timeStep); | ||
143 | } | ||
144 | scene.Simulate(timeStep); | ||
145 | scene.FetchResults(); | ||
146 | scene.UpdateControllers(); | ||
147 | |||
148 | foreach (PhysXCharacter actor in _characters) | ||
149 | { | ||
150 | actor.UpdatePosition(); | ||
151 | } | ||
152 | |||
153 | } | ||
154 | |||
155 | public override void GetResults() | ||
156 | { | ||
157 | |||
158 | } | ||
159 | |||
160 | public override bool IsThreaded | ||
161 | { | ||
162 | get | ||
163 | { | ||
164 | return(false); // for now we won't be multithreaded | ||
165 | } | ||
166 | } | ||
167 | |||
168 | public override void SetTerrain(float[] heightMap) | ||
169 | { | ||
170 | this._heightMap = heightMap; | ||
171 | this.scene.AddTerrain(heightMap); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | public class PhysXCharacter : PhysicsActor | ||
176 | { | ||
177 | private PhysicsVector _position; | ||
178 | private PhysicsVector _velocity; | ||
179 | private PhysicsVector _acceleration; | ||
180 | private NxCharacter _character; | ||
181 | private bool flying; | ||
182 | |||
183 | public PhysXCharacter(NxCharacter character) | ||
184 | { | ||
185 | _velocity = new PhysicsVector(); | ||
186 | _position = new PhysicsVector(); | ||
187 | _acceleration = new PhysicsVector(); | ||
188 | _character = character; | ||
189 | } | ||
190 | |||
191 | public override bool Flying | ||
192 | { | ||
193 | get | ||
194 | { | ||
195 | return flying; | ||
196 | } | ||
197 | set | ||
198 | { | ||
199 | flying = value; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | public override PhysicsVector Position | ||
204 | { | ||
205 | get | ||
206 | { | ||
207 | return _position; | ||
208 | } | ||
209 | set | ||
210 | { | ||
211 | _position = value; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | public override PhysicsVector Velocity | ||
216 | { | ||
217 | get | ||
218 | { | ||
219 | return _velocity; | ||
220 | } | ||
221 | set | ||
222 | { | ||
223 | _velocity = value; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | public override PhysicsVector Acceleration | ||
228 | { | ||
229 | get | ||
230 | { | ||
231 | return _acceleration; | ||
232 | } | ||
233 | |||
234 | } | ||
235 | public void SetAcceleration (PhysicsVector accel) | ||
236 | { | ||
237 | this._acceleration = accel; | ||
238 | } | ||
239 | |||
240 | public override void AddForce(PhysicsVector force) | ||
241 | { | ||
242 | |||
243 | } | ||
244 | |||
245 | public override void SetMomentum(PhysicsVector momentum) | ||
246 | { | ||
247 | |||
248 | } | ||
249 | |||
250 | public void Move(float timeStep) | ||
251 | { | ||
252 | Vec3 vec = new Vec3(); | ||
253 | vec.X = this._velocity.X * timeStep; | ||
254 | vec.Y = this._velocity.Y * timeStep; | ||
255 | if(flying) | ||
256 | { | ||
257 | vec.Z = ( this._velocity.Z) * timeStep; | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | vec.Z = (-9.8f + this._velocity.Z) * timeStep; | ||
262 | } | ||
263 | this._character.Move(vec); | ||
264 | } | ||
265 | |||
266 | public void UpdatePosition() | ||
267 | { | ||
268 | Vec3 vec = this._character.Position; | ||
269 | this._position.X = vec.X; | ||
270 | this._position.Y = vec.Y; | ||
271 | this._position.Z = vec.Z; | ||
272 | } | ||
273 | } | ||
274 | |||
275 | public class PhysXPrim : PhysicsActor | ||
276 | { | ||
277 | private PhysicsVector _position; | ||
278 | private PhysicsVector _velocity; | ||
279 | private PhysicsVector _acceleration; | ||
280 | private NxActor _prim; | ||
281 | |||
282 | public PhysXPrim(NxActor prim) | ||
283 | { | ||
284 | _velocity = new PhysicsVector(); | ||
285 | _position = new PhysicsVector(); | ||
286 | _acceleration = new PhysicsVector(); | ||
287 | _prim = prim; | ||
288 | } | ||
289 | public override bool Flying | ||
290 | { | ||
291 | get | ||
292 | { | ||
293 | return false; //no flying prims for you | ||
294 | } | ||
295 | set | ||
296 | { | ||
297 | |||
298 | } | ||
299 | } | ||
300 | public override PhysicsVector Position | ||
301 | { | ||
302 | get | ||
303 | { | ||
304 | PhysicsVector pos = new PhysicsVector(); | ||
305 | Vec3 vec = this._prim.Position; | ||
306 | pos.X = vec.X; | ||
307 | pos.Y = vec.Y; | ||
308 | pos.Z = vec.Z; | ||
309 | return pos; | ||
310 | |||
311 | } | ||
312 | set | ||
313 | { | ||
314 | PhysicsVector vec = value; | ||
315 | Vec3 pos = new Vec3(); | ||
316 | pos.X = vec.X; | ||
317 | pos.Y = vec.Y; | ||
318 | pos.Z = vec.Z; | ||
319 | this._prim.Position = pos; | ||
320 | } | ||
321 | } | ||
322 | |||
323 | public override PhysicsVector Velocity | ||
324 | { | ||
325 | get | ||
326 | { | ||
327 | return _velocity; | ||
328 | } | ||
329 | set | ||
330 | { | ||
331 | _velocity = value; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | public override PhysicsVector Acceleration | ||
336 | { | ||
337 | get | ||
338 | { | ||
339 | return _acceleration; | ||
340 | } | ||
341 | |||
342 | } | ||
343 | public void SetAcceleration (PhysicsVector accel) | ||
344 | { | ||
345 | this._acceleration = accel; | ||
346 | } | ||
347 | |||
348 | public override void AddForce(PhysicsVector force) | ||
349 | { | ||
350 | |||
351 | } | ||
352 | |||
353 | public override void SetMomentum(PhysicsVector momentum) | ||
354 | { | ||
355 | |||
356 | } | ||
357 | |||
358 | |||
359 | } | ||
360 | |||
361 | } | ||
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj b/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj deleted file mode 100644 index 554df5e..0000000 --- a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>RealPhysXplugin</RootNamespace> | ||
5 | <AssemblyName>RealPhysXplugin</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{56C1D214-F389-4228-921A-0A3A0712C159}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>..\..\..\..\bin\Physics\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>..\..\..\..\bin\Physics\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="PhysX_Wrapper_Dotnet"> | ||
30 | <HintPath>..\..\..\..\bin\PhysX_Wrapper_Dotnet.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | <Private>False</Private> | ||
33 | </Reference> | ||
34 | </ItemGroup> | ||
35 | <ItemGroup> | ||
36 | <Compile Include="RealPhysX.cs" /> | ||
37 | </ItemGroup> | ||
38 | <ItemGroup> | ||
39 | <ProjectReference Include="..\..\PhysicsManager.csproj"> | ||
40 | <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project> | ||
41 | <Name>PhysicsManager</Name> | ||
42 | <Private>False</Private> | ||
43 | </ProjectReference> | ||
44 | </ItemGroup> | ||
45 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
46 | </Project> \ No newline at end of file | ||