diff options
author | gareth | 2007-03-13 11:28:04 +0000 |
---|---|---|
committer | gareth | 2007-03-13 11:28:04 +0000 |
commit | 82e18112f2cee5ebb876d430ca8cb4a6c36c1cfd (patch) | |
tree | 785434fa2013b727b1dc3b9773944cf4b757ff91 /src/physics | |
parent | Rolled back all but the VS solution (diff) | |
download | opensim-SC-82e18112f2cee5ebb876d430ca8cb4a6c36c1cfd.zip opensim-SC-82e18112f2cee5ebb876d430ca8cb4a6c36c1cfd.tar.gz opensim-SC-82e18112f2cee5ebb876d430ca8cb4a6c36c1cfd.tar.bz2 opensim-SC-82e18112f2cee5ebb876d430ca8cb4a6c36c1cfd.tar.xz |
added movement etc from r191
Diffstat (limited to 'src/physics')
-rw-r--r-- | src/physics/AssemblyInfo.cs | 2 | ||||
-rw-r--r-- | src/physics/PhysicsManager.cs | 119 | ||||
-rw-r--r-- | src/physics/plugins/AssemblyInfo.cs | 2 |
3 files changed, 117 insertions, 6 deletions
diff --git a/src/physics/AssemblyInfo.cs b/src/physics/AssemblyInfo.cs index 1cc3ee1..c78d44c 100644 --- a/src/physics/AssemblyInfo.cs +++ b/src/physics/AssemblyInfo.cs | |||
@@ -14,7 +14,7 @@ using System.Runtime.InteropServices; | |||
14 | 14 | ||
15 | [assembly: ComVisibleAttribute(false)] | 15 | [assembly: ComVisibleAttribute(false)] |
16 | [assembly: CLSCompliantAttribute(false)] | 16 | [assembly: CLSCompliantAttribute(false)] |
17 | [assembly: AssemblyVersionAttribute("0.1.*.191")] | 17 | [assembly: AssemblyVersionAttribute("0.1.*.192")] |
18 | [assembly: AssemblyTitleAttribute("opensim-physicsmanager")] | 18 | [assembly: AssemblyTitleAttribute("opensim-physicsmanager")] |
19 | [assembly: AssemblyDescriptionAttribute("Handles physics plugins")] | 19 | [assembly: AssemblyDescriptionAttribute("Handles physics plugins")] |
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | 20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] |
diff --git a/src/physics/PhysicsManager.cs b/src/physics/PhysicsManager.cs index e5d5bd6..1fee628 100644 --- a/src/physics/PhysicsManager.cs +++ b/src/physics/PhysicsManager.cs | |||
@@ -46,15 +46,21 @@ namespace PhysicsSystem | |||
46 | 46 | ||
47 | public PhysicsScene GetPhysicsScene(string engineName) | 47 | public PhysicsScene GetPhysicsScene(string engineName) |
48 | { | 48 | { |
49 | if(_plugins.ContainsKey(engineName)) | 49 | if( String.IsNullOrEmpty( engineName ) ) |
50 | { | ||
51 | return new NullPhysicsScene(); | ||
52 | } | ||
53 | |||
54 | if(_plugins.ContainsKey(engineName)) | ||
50 | { | 55 | { |
51 | ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName); | 56 | ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName); |
52 | return _plugins[engineName].GetScene(); | 57 | return _plugins[engineName].GetScene(); |
53 | } | 58 | } |
54 | else | 59 | else |
55 | { | 60 | { |
56 | ServerConsole.MainConsole.Instance.WriteLine("couldn't find physicsEngine: "+ engineName); | 61 | string error = String.Format("couldn't find physicsEngine: {0}", engineName); |
57 | return null; | 62 | ServerConsole.MainConsole.Instance.WriteLine( error ); |
63 | throw new ArgumentException( error ); | ||
58 | } | 64 | } |
59 | } | 65 | } |
60 | 66 | ||
@@ -108,6 +114,14 @@ namespace PhysicsSystem | |||
108 | 114 | ||
109 | public abstract class PhysicsScene | 115 | public abstract class PhysicsScene |
110 | { | 116 | { |
117 | public static PhysicsScene Null | ||
118 | { | ||
119 | get | ||
120 | { | ||
121 | return new NullPhysicsScene(); | ||
122 | } | ||
123 | } | ||
124 | |||
111 | public abstract PhysicsActor AddAvatar(PhysicsVector position); | 125 | public abstract PhysicsActor AddAvatar(PhysicsVector position); |
112 | 126 | ||
113 | public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); | 127 | public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); |
@@ -124,8 +138,49 @@ namespace PhysicsSystem | |||
124 | } | 138 | } |
125 | } | 139 | } |
126 | 140 | ||
141 | public class NullPhysicsScene : PhysicsScene | ||
142 | { | ||
143 | private static int m_workIndicator; | ||
144 | |||
145 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
146 | { | ||
147 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddAvatar({0})", position ); | ||
148 | return PhysicsActor.Null; | ||
149 | } | ||
150 | |||
151 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
152 | { | ||
153 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddPrim({0},{1})", position, size ); | ||
154 | return PhysicsActor.Null; | ||
155 | } | ||
156 | |||
157 | public override void Simulate(float timeStep) | ||
158 | { | ||
159 | m_workIndicator = ( m_workIndicator + 1 ) % 10; | ||
160 | |||
161 | ServerConsole.MainConsole.Instance.SetStatus( m_workIndicator.ToString() ); | ||
162 | } | ||
163 | |||
164 | public override void GetResults() | ||
165 | { | ||
166 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()" ); | ||
167 | } | ||
168 | |||
169 | public override void SetTerrain(float[] heightMap) | ||
170 | { | ||
171 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length ); | ||
172 | } | ||
173 | |||
174 | public override bool IsThreaded | ||
175 | { | ||
176 | get { return false; } | ||
177 | } | ||
178 | } | ||
179 | |||
127 | public abstract class PhysicsActor | 180 | public abstract class PhysicsActor |
128 | { | 181 | { |
182 | public static readonly PhysicsActor Null = new NullPhysicsActor(); | ||
183 | |||
129 | public abstract PhysicsVector Position | 184 | public abstract PhysicsVector Position |
130 | { | 185 | { |
131 | get; | 186 | get; |
@@ -153,7 +208,61 @@ namespace PhysicsSystem | |||
153 | public abstract void SetMomentum(PhysicsVector momentum); | 208 | public abstract void SetMomentum(PhysicsVector momentum); |
154 | } | 209 | } |
155 | 210 | ||
156 | public class PhysicsVector | 211 | public class NullPhysicsActor : PhysicsActor |
212 | { | ||
213 | public override PhysicsVector Position | ||
214 | { | ||
215 | get | ||
216 | { | ||
217 | return PhysicsVector.Zero; | ||
218 | } | ||
219 | set | ||
220 | { | ||
221 | return; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | public override PhysicsVector Velocity | ||
226 | { | ||
227 | get | ||
228 | { | ||
229 | return PhysicsVector.Zero; | ||
230 | } | ||
231 | set | ||
232 | { | ||
233 | return; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | public override PhysicsVector Acceleration | ||
238 | { | ||
239 | get { return PhysicsVector.Zero; } | ||
240 | } | ||
241 | |||
242 | public override bool Flying | ||
243 | { | ||
244 | get | ||
245 | { | ||
246 | return false; | ||
247 | } | ||
248 | set | ||
249 | { | ||
250 | return; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | public override void AddForce(PhysicsVector force) | ||
255 | { | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | public override void SetMomentum(PhysicsVector momentum) | ||
260 | { | ||
261 | return; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | public class PhysicsVector | ||
157 | { | 266 | { |
158 | public float X; | 267 | public float X; |
159 | public float Y; | 268 | public float Y; |
@@ -170,5 +279,7 @@ namespace PhysicsSystem | |||
170 | Y = y; | 279 | Y = y; |
171 | Z = z; | 280 | Z = z; |
172 | } | 281 | } |
282 | |||
283 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); | ||
173 | } | 284 | } |
174 | } | 285 | } |
diff --git a/src/physics/plugins/AssemblyInfo.cs b/src/physics/plugins/AssemblyInfo.cs index 2c12da4..a24c947 100644 --- a/src/physics/plugins/AssemblyInfo.cs +++ b/src/physics/plugins/AssemblyInfo.cs | |||
@@ -14,7 +14,7 @@ using System.Runtime.InteropServices; | |||
14 | 14 | ||
15 | [assembly: ComVisibleAttribute(false)] | 15 | [assembly: ComVisibleAttribute(false)] |
16 | [assembly: CLSCompliantAttribute(false)] | 16 | [assembly: CLSCompliantAttribute(false)] |
17 | [assembly: AssemblyVersionAttribute("0.1.*.191")] | 17 | [assembly: AssemblyVersionAttribute("0.1.*.192")] |
18 | [assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")] | 18 | [assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")] |
19 | [assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")] | 19 | [assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")] |
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | 20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] |