aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Physics/Manager/PhysicsScene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.Physics/Manager/PhysicsScene.cs98
1 files changed, 98 insertions, 0 deletions
diff --git a/OpenSim.Physics/Manager/PhysicsScene.cs b/OpenSim.Physics/Manager/PhysicsScene.cs
new file mode 100644
index 0000000..35c961e
--- /dev/null
+++ b/OpenSim.Physics/Manager/PhysicsScene.cs
@@ -0,0 +1,98 @@
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
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Physics.Manager
33{
34 public abstract class PhysicsScene
35 {
36 public static PhysicsScene Null
37 {
38 get
39 {
40 return new NullPhysicsScene();
41 }
42 }
43
44 public abstract PhysicsActor AddAvatar(PhysicsVector position);
45
46 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size);
47
48 public abstract void Simulate(float timeStep);
49
50 public abstract void GetResults();
51
52 public abstract void SetTerrain(float[] heightMap);
53
54 public abstract bool IsThreaded
55 {
56 get;
57 }
58 }
59
60 public class NullPhysicsScene : PhysicsScene
61 {
62 private static int m_workIndicator;
63
64 public override PhysicsActor AddAvatar(PhysicsVector position)
65 {
66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : AddAvatar({0})", position);
67 return PhysicsActor.Null;
68 }
69
70 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
71 {
72 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : AddPrim({0},{1})", position, size);
73 return PhysicsActor.Null;
74 }
75
76 public override void Simulate(float timeStep)
77 {
78 m_workIndicator = (m_workIndicator + 1) % 10;
79
80 OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString());
81 }
82
83 public override void GetResults()
84 {
85 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()");
86 }
87
88 public override void SetTerrain(float[] heightMap)
89 {
90 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
91 }
92
93 public override bool IsThreaded
94 {
95 get { return false; }
96 }
97 }
98}