aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs177
1 files changed, 0 insertions, 177 deletions
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
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace 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}