aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-03-13 08:55:47 +0000
committerlbsa712007-03-13 08:55:47 +0000
commit0587158f9208ecf9f39a6dd0ef7cb7c5663a39f8 (patch)
treebf86015426ec54fa1f1b5902236670f752473497
parent(no commit message) (diff)
downloadopensim-SC_OLD-0587158f9208ecf9f39a6dd0ef7cb7c5663a39f8.zip
opensim-SC_OLD-0587158f9208ecf9f39a6dd0ef7cb7c5663a39f8.tar.gz
opensim-SC_OLD-0587158f9208ecf9f39a6dd0ef7cb7c5663a39f8.tar.bz2
opensim-SC_OLD-0587158f9208ecf9f39a6dd0ef7cb7c5663a39f8.tar.xz
-- Trying to get trunk to run from first build
* Collected required dll's into /bin * Moved timer start for great justice * Added some Writes to Console, and a Status field * Added dumb NullPhysicsScene and NullPhysicsActor that kicks in if Physics Plugin not specified * Svn-ignored a shitload
Diffstat (limited to '')
-rw-r--r--src/Config/SimConfig/SimConfig.csproj2
-rw-r--r--src/Main.cs18
-rw-r--r--src/OpenSimConsole.cs43
-rw-r--r--src/Properties/AssemblyInfo.cs33
-rw-r--r--src/Second-server.csproj17
-rw-r--r--src/ServerConsole/ServerConsole/ServerConsole.cs22
-rw-r--r--src/opensim.sln62
-rw-r--r--src/physics/PhysicsManager.cs119
8 files changed, 273 insertions, 43 deletions
diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj
index 3131405..5aee907 100644
--- a/src/Config/SimConfig/SimConfig.csproj
+++ b/src/Config/SimConfig/SimConfig.csproj
@@ -8,7 +8,7 @@
8 <ProjectGuid>{B063760D-DB8D-4F64-B6FE-335FAD1E650A}</ProjectGuid> 8 <ProjectGuid>{B063760D-DB8D-4F64-B6FE-335FAD1E650A}</ProjectGuid>
9 </PropertyGroup> 9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> 10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath> 11 <OutputPath>..\..\..\bin\</OutputPath>
12 <Optimize>False</Optimize> 12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants> 13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols> 14 <DebugSymbols>True</DebugSymbols>
diff --git a/src/Main.cs b/src/Main.cs
index 3103ea3..0680cbb 100644
--- a/src/Main.cs
+++ b/src/Main.cs
@@ -71,7 +71,7 @@ namespace OpenSim
71 private PhysicsManager physManager; 71 private PhysicsManager physManager;
72 private System.Timers.Timer timer1 = new System.Timers.Timer(); 72 private System.Timers.Timer timer1 = new System.Timers.Timer();
73 private string ConfigDll = "SimConfig.dll"; 73 private string ConfigDll = "SimConfig.dll";
74 private string _physicsEngine = "PhysX"; 74 private string _physicsEngine = "";
75 public bool sandbox = false; 75 public bool sandbox = false;
76 public bool loginserver = false; 76 public bool loginserver = false;
77 77
@@ -83,13 +83,18 @@ namespace OpenSim
83 ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0); 83 ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0);
84 84
85 sim = new OpenSim_Main(); 85 sim = new OpenSim_Main();
86 86
87 sim.sandbox = false;
88 sim.loginserver = false;
89 sim._physicsEngine = "";
90
87 for (int i = 0; i < args.Length; i++) 91 for (int i = 0; i < args.Length; i++)
88 { 92 {
89 if(args[i] == "-sandbox") 93 if(args[i] == "-sandbox")
90 { 94 {
91 sim.sandbox = true; 95 sim.sandbox = true;
92 } 96 }
97
93 if(args[i] == "-loginserver") 98 if(args[i] == "-loginserver")
94 { 99 {
95 sim.loginserver = true; 100 sim.loginserver = true;
@@ -136,9 +141,6 @@ namespace OpenSim
136 141
137 private void Startup() { 142 private void Startup() {
138 startuptime=DateTime.Now; 143 startuptime=DateTime.Now;
139 timer1.Enabled = true;
140 timer1.Interval = 100;
141 timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
142 144
143 // We check our local database first, then the grid for config options 145 // We check our local database first, then the grid for config options
144 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); 146 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
@@ -150,7 +152,11 @@ namespace OpenSim
150 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); 152 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
151 ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); 153 ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
152 local_world = cfg.LoadWorld(); 154 local_world = cfg.LoadWorld();
153 155
156 timer1.Enabled = true;
157 timer1.Interval = 100;
158 timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick);
159
154 this.physManager = new PhysicsSystem.PhysicsManager(); 160 this.physManager = new PhysicsSystem.PhysicsManager();
155 this.physManager.LoadPlugins(); 161 this.physManager.LoadPlugins();
156 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); 162 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
diff --git a/src/OpenSimConsole.cs b/src/OpenSimConsole.cs
index 11bc648..00a4cee 100644
--- a/src/OpenSimConsole.cs
+++ b/src/OpenSimConsole.cs
@@ -61,6 +61,7 @@ namespace OpenSim
61 ConsType = constype; 61 ConsType = constype;
62 switch(constype) { 62 switch(constype) {
63 case ConsoleType.Local: 63 case ConsoleType.Local:
64
64 Console.WriteLine("ServerConsole.cs - creating new local console"); 65 Console.WriteLine("ServerConsole.cs - creating new local console");
65 Console.WriteLine("Logs will be saved to current directory in opensim-console.log"); 66 Console.WriteLine("Logs will be saved to current directory in opensim-console.log");
66 Log=File.AppendText("opensim-console.log"); 67 Log=File.AppendText("opensim-console.log");
@@ -75,22 +76,30 @@ namespace OpenSim
75 default: 76 default:
76 Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!"); 77 Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!");
77 break; 78 break;
78 } 79 }
79 } 80 }
80 81
81 public override void Close() { 82 public override void Close() {
82 Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString()); 83 Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString());
83 Log.Close(); 84 Log.Close();
84 } 85 }
85 86
86 // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here 87 public override void Write(string format, params object[] args)
87 public override void WriteLine(string Line) { 88 {
88 Log.WriteLine(Line); 89 Log.Write(format, args);
89 Console.WriteLine(Line); 90 Console.Write(format, args);
90 return; 91 return;
91 } 92 }
92 93
93 public override string ReadLine() { 94 public override void WriteLine(string format, params object[] args)
95 {
96 Log.WriteLine(format, args);
97 Console.WriteLine(format, args);
98 return;
99 }
100
101 public override string ReadLine()
102 {
94 string TempStr=Console.ReadLine(); 103 string TempStr=Console.ReadLine();
95 Log.WriteLine(TempStr); 104 Log.WriteLine(TempStr);
96 return TempStr; 105 return TempStr;
@@ -102,12 +111,6 @@ namespace OpenSim
102 return TempInt; 111 return TempInt;
103 } 112 }
104 113
105 public override void Write(string Line) {
106 Console.Write(Line);
107 Log.Write(Line);
108 return;
109 }
110
111 // Displays a command prompt and waits for the user to enter a string, then returns that string 114 // Displays a command prompt and waits for the user to enter a string, then returns that string
112 public override string CmdPrompt(string prompt) { 115 public override string CmdPrompt(string prompt) {
113 this.Write(prompt); 116 this.Write(prompt);
@@ -196,7 +199,13 @@ namespace OpenSim
196 string[] cmdparams=(string[])tempstrarray; 199 string[] cmdparams=(string[])tempstrarray;
197 RunCmd(cmd,cmdparams); 200 RunCmd(cmd,cmdparams);
198 } 201 }
199 } 202
203
204 public override void SetStatus(string status)
205 {
206 Console.Write( status + "\r" );
207 }
208 }
200} 209}
201 210
202 211
diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..90fc127
--- /dev/null
+++ b/src/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("opensim")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("Playahead AB")]
12[assembly: AssemblyProduct("opensim")]
13[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("1d09756b-a461-4302-b6fe-15c455317909")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Second-server.csproj b/src/Second-server.csproj
index 81399ce..89b508a 100644
--- a/src/Second-server.csproj
+++ b/src/Second-server.csproj
@@ -35,6 +35,9 @@
35 <PlatformTarget>AnyCPU</PlatformTarget> 35 <PlatformTarget>AnyCPU</PlatformTarget>
36 <FileAlignment>4096</FileAlignment> 36 <FileAlignment>4096</FileAlignment>
37 </PropertyGroup> 37 </PropertyGroup>
38 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
39 <OutputPath>..\bin\</OutputPath>
40 </PropertyGroup>
38 <ItemGroup> 41 <ItemGroup>
39 <Reference Include="System" /> 42 <Reference Include="System" />
40 <Reference Include="System.Data" /> 43 <Reference Include="System.Data" />
@@ -73,16 +76,26 @@
73 <Compile Include="VersionInfo.cs" /> 76 <Compile Include="VersionInfo.cs" />
74 </ItemGroup> 77 </ItemGroup>
75 <ItemGroup> 78 <ItemGroup>
76 <Folder Include="GridServers" />
77 <Folder Include="Assets" />
78 <ProjectReference Include="GridInterfaces\GridInterfaces.csproj"> 79 <ProjectReference Include="GridInterfaces\GridInterfaces.csproj">
79 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> 80 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
80 <Name>GridInterfaces</Name> 81 <Name>GridInterfaces</Name>
81 </ProjectReference> 82 </ProjectReference>
83 <ProjectReference Include="LocalServers\LocalGridServers\LocalGridServers.csproj">
84 <Project>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</Project>
85 <Name>LocalGridServers</Name>
86 </ProjectReference>
87 <ProjectReference Include="LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj">
88 <Project>{74784F23-B0FD-484C-82C1-96C0215733DC}</Project>
89 <Name>Db4LocalStorage</Name>
90 </ProjectReference>
82 <ProjectReference Include="physics\PhysicsManager.csproj"> 91 <ProjectReference Include="physics\PhysicsManager.csproj">
83 <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project> 92 <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
84 <Name>PhysicsManager</Name> 93 <Name>PhysicsManager</Name>
85 </ProjectReference> 94 </ProjectReference>
95 <ProjectReference Include="RemoteServers\RemoteGridServers\RemoteGridServers.csproj">
96 <Project>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</Project>
97 <Name>RemoteGridServers</Name>
98 </ProjectReference>
86 <ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj"> 99 <ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj">
87 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> 100 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
88 <Name>ServerConsole</Name> 101 <Name>ServerConsole</Name>
diff --git a/src/ServerConsole/ServerConsole/ServerConsole.cs b/src/ServerConsole/ServerConsole/ServerConsole.cs
index 93c8114..27d97e5 100644
--- a/src/ServerConsole/ServerConsole/ServerConsole.cs
+++ b/src/ServerConsole/ServerConsole/ServerConsole.cs
@@ -43,12 +43,7 @@ namespace ServerConsole
43 instance = value; 43 instance = value;
44 } 44 }
45 } 45 }
46 46 }
47 public MainConsole()
48 {
49
50 }
51 }
52 47
53 public abstract class ConsoleBase 48 public abstract class ConsoleBase
54 { 49 {
@@ -60,16 +55,15 @@ namespace ServerConsole
60 } 55 }
61 56
62 public abstract void Close(); 57 public abstract void Close();
63 58
64 // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here 59 public abstract void Write(string format, params object[] args);
65 public abstract void WriteLine(string Line) ; 60
66 61 public abstract void WriteLine(string format, params object[] args);
62
67 public abstract string ReadLine(); 63 public abstract string ReadLine();
68 64
69 public abstract int Read() ; 65 public abstract int Read() ;
70 66
71 public abstract void Write(string Line) ;
72
73 // Displays a command prompt and waits for the user to enter a string, then returns that string 67 // Displays a command prompt and waits for the user to enter a string, then returns that string
74 public abstract string CmdPrompt(string prompt) ; 68 public abstract string CmdPrompt(string prompt) ;
75 69
@@ -87,5 +81,7 @@ namespace ServerConsole
87 81
88 // Displays a prompt to the user and then runs the command they entered 82 // Displays a prompt to the user and then runs the command they entered
89 public abstract void MainConsolePrompt() ; 83 public abstract void MainConsolePrompt() ;
90 } 84
85 public abstract void SetStatus( string status );
86 }
91} 87}
diff --git a/src/opensim.sln b/src/opensim.sln
new file mode 100644
index 0000000..930bf09
--- /dev/null
+++ b/src/opensim.sln
@@ -0,0 +1,62 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# Visual Studio 2005
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}"
5EndProject
6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces\GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}"
7EndProject
8Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "physics\PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}"
9EndProject
10Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}"
11EndProject
12Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalServers\LocalGridServers\LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}"
13EndProject
14Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteServers\RemoteGridServers\RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}"
15EndProject
16Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "Config\SimConfig\SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}"
17EndProject
18Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}"
19EndProject
20Global
21 GlobalSection(SolutionConfigurationPlatforms) = preSolution
22 Debug|Any CPU = Debug|Any CPU
23 Release|Any CPU = Release|Any CPU
24 EndGlobalSection
25 GlobalSection(ProjectConfigurationPlatforms) = postSolution
26 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU
30 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU
34 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU
38 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU
42 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.Build.0 = Release|Any CPU
46 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
49 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.Build.0 = Release|Any CPU
50 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.Build.0 = Debug|Any CPU
52 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.ActiveCfg = Release|Any CPU
53 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.Build.0 = Release|Any CPU
54 {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55 {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
56 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
57 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.Build.0 = Release|Any CPU
58 EndGlobalSection
59 GlobalSection(SolutionProperties) = preSolution
60 HideSolutionNode = FALSE
61 EndGlobalSection
62EndGlobal
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}