Cleanup a bit
Started to add Primitive creation (very basic at the moment) Should now be ready for merging into trunkConvertToPlugins
parent
6a1cc7c70f
commit
0fcaa11f43
|
@ -1,21 +1,31 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
[assembly: CLSCompliantAttribute(false)]
|
||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
||||
[assembly: AssemblyTitleAttribute("opensim-simconfig")]
|
||||
[assembly: AssemblyDescriptionAttribute("The default configuration handler")]
|
||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("SimConfig")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SimConfig")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
|
|
@ -119,11 +119,6 @@ namespace Db40SimConfig
|
|||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
|
||||
HeightmapGenHills hills = new HeightmapGenHills();
|
||||
blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
/* blank.LandMap = new float[65536];
|
||||
for(int i = 0 ; i <65536; i++)
|
||||
{
|
||||
blank.LandMap[i] = 20.49f;
|
||||
}*/
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
|
||||
db.Set(blank.LandMap);
|
||||
db.Commit();
|
||||
|
|
|
@ -26,12 +26,8 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="OpenSim">
|
||||
<HintPath>..\..\bin\OpenSim.exe</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="Db4objects.Db4o">
|
||||
<HintPath>..\..\..\..\..\Program Files\Db4objects\db4o-6.1\bin\net-2.0\Db4objects.Db4o.dll</HintPath>
|
||||
<HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
@ -44,6 +40,10 @@
|
|||
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
|
||||
<Name>ServerConsole</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Second-server.csproj">
|
||||
<Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
|
||||
<Name>Second-server</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
</Project>
|
|
@ -1,21 +1,31 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
[assembly: CLSCompliantAttribute(false)]
|
||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
||||
[assembly: AssemblyTitleAttribute("opensim-gridinterfaces")]
|
||||
[assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")]
|
||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("GridInterfaces")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("GridInterfaces")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="libsecondlife">
|
||||
<HintPath>..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
[assembly: CLSCompliantAttribute(false)]
|
||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
||||
[assembly: AssemblyTitleAttribute("opensim-localservers")]
|
||||
[assembly: AssemblyDescriptionAttribute("local grid servers")]
|
||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("LocalGridServers")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LocalGridServers")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="libsecondlife">
|
||||
<HintPath>..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
|
423
src/Main.cs
423
src/Main.cs
|
@ -47,126 +47,126 @@ using PhysicsSystem;
|
|||
|
||||
namespace OpenSim
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of MainForm.
|
||||
/// </summary>
|
||||
public class OpenSim_Main
|
||||
{
|
||||
public static OpenSim_Main sim;
|
||||
public static SimConfig cfg;
|
||||
public static World local_world;
|
||||
public static Grid gridServers;
|
||||
|
||||
public static Socket Server;
|
||||
private static IPEndPoint ServerIncoming;
|
||||
private static byte[] RecvBuffer = new byte[4096];
|
||||
private byte[] ZeroBuffer = new byte[8192];
|
||||
private static IPEndPoint ipeSender;
|
||||
private static EndPoint epSender;
|
||||
private static AsyncCallback ReceivedData;
|
||||
/// <summary>
|
||||
/// Description of MainForm.
|
||||
/// </summary>
|
||||
public class OpenSim_Main
|
||||
{
|
||||
public static OpenSim_Main sim;
|
||||
public static SimConfig cfg;
|
||||
public static World local_world;
|
||||
public static Grid gridServers;
|
||||
|
||||
public static Socket Server;
|
||||
private static IPEndPoint ServerIncoming;
|
||||
private static byte[] RecvBuffer = new byte[4096];
|
||||
private byte[] ZeroBuffer = new byte[8192];
|
||||
private static IPEndPoint ipeSender;
|
||||
private static EndPoint epSender;
|
||||
private static AsyncCallback ReceivedData;
|
||||
|
||||
public AssetCache assetCache;
|
||||
public DateTime startuptime;
|
||||
public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
|
||||
private PhysicsManager physManager;
|
||||
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
||||
private string ConfigDll = "SimConfig.dll";
|
||||
public bool sandbox = false;
|
||||
public bool loginserver = false;
|
||||
|
||||
[STAThread]
|
||||
public static void Main( string[] args )
|
||||
{
|
||||
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
||||
Console.WriteLine("Starting...\n");
|
||||
ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0);
|
||||
|
||||
sim = new OpenSim_Main();
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if(args[i] == "-sandbox")
|
||||
{
|
||||
sim.sandbox = true;
|
||||
}
|
||||
if(args[i] == "-loginserver")
|
||||
{
|
||||
sim.loginserver = true;
|
||||
}
|
||||
}
|
||||
|
||||
OpenSim_Main.gridServers = new Grid();
|
||||
if(sim.sandbox)
|
||||
{
|
||||
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.gridServers.LoadPlugins();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll";
|
||||
OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll";
|
||||
OpenSim_Main.gridServers.LoadPlugins();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
||||
}
|
||||
|
||||
if(sim.loginserver && sim.sandbox)
|
||||
{
|
||||
LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer);
|
||||
loginServer.Startup();
|
||||
}
|
||||
sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
|
||||
|
||||
sim.Startup();
|
||||
|
||||
while(true) {
|
||||
ServerConsole.MainConsole.Instance.MainConsolePrompt();
|
||||
}
|
||||
}
|
||||
public AssetCache assetCache;
|
||||
public DateTime startuptime;
|
||||
public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
|
||||
private PhysicsManager physManager;
|
||||
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
||||
private string ConfigDll = "SimConfig.dll";
|
||||
public bool sandbox = false;
|
||||
public bool loginserver = false;
|
||||
|
||||
[STAThread]
|
||||
public static void Main( string[] args )
|
||||
{
|
||||
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
||||
Console.WriteLine("Starting...\n");
|
||||
ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0);
|
||||
|
||||
sim = new OpenSim_Main();
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if(args[i] == "-sandbox")
|
||||
{
|
||||
sim.sandbox = true;
|
||||
}
|
||||
if(args[i] == "-loginserver")
|
||||
{
|
||||
sim.loginserver = true;
|
||||
}
|
||||
}
|
||||
|
||||
OpenSim_Main.gridServers = new Grid();
|
||||
if(sim.sandbox)
|
||||
{
|
||||
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.gridServers.LoadPlugins();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll";
|
||||
OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll";
|
||||
OpenSim_Main.gridServers.LoadPlugins();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
||||
}
|
||||
|
||||
if(sim.loginserver && sim.sandbox)
|
||||
{
|
||||
LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer);
|
||||
loginServer.Startup();
|
||||
}
|
||||
sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
|
||||
|
||||
sim.Startup();
|
||||
|
||||
while(true) {
|
||||
ServerConsole.MainConsole.Instance.MainConsolePrompt();
|
||||
}
|
||||
}
|
||||
|
||||
private OpenSim_Main() {
|
||||
}
|
||||
|
||||
private void Startup() {
|
||||
startuptime=DateTime.Now;
|
||||
timer1.Enabled = true;
|
||||
timer1.Interval = 100;
|
||||
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
|
||||
|
||||
// We check our local database first, then the grid for config options
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||
cfg = this.LoadConfigDll(this.ConfigDll);
|
||||
cfg.InitConfig();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
|
||||
cfg.LoadFromGrid();
|
||||
private OpenSim_Main() {
|
||||
}
|
||||
|
||||
private void Startup() {
|
||||
startuptime=DateTime.Now;
|
||||
timer1.Enabled = true;
|
||||
timer1.Interval = 100;
|
||||
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
|
||||
|
||||
// We check our local database first, then the grid for config options
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||
cfg = this.LoadConfigDll(this.ConfigDll);
|
||||
cfg.InitConfig();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
|
||||
cfg.LoadFromGrid();
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
|
||||
local_world = cfg.LoadWorld();
|
||||
|
||||
this.physManager = new PhysicsSystem.PhysicsManager();
|
||||
this.physManager.LoadPlugins();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
||||
local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use
|
||||
local_world.PhysScene.SetTerrain(local_world.LandMap);
|
||||
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
|
||||
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
|
||||
|
||||
MainServerListener();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
|
||||
local_world = cfg.LoadWorld();
|
||||
|
||||
this.physManager = new PhysicsSystem.PhysicsManager();
|
||||
this.physManager.LoadPlugins();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
||||
local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use
|
||||
local_world.PhysScene.SetTerrain(local_world.LandMap);
|
||||
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
|
||||
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
|
||||
|
||||
MainServerListener();
|
||||
|
||||
}
|
||||
|
||||
private SimConfig LoadConfigDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
}
|
||||
|
||||
private SimConfig LoadConfigDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
SimConfig config = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("ISimConfig", true);
|
||||
|
||||
|
@ -175,100 +175,99 @@ namespace OpenSim
|
|||
ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
config = plug.GetConfigObject();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
pluginAssembly = null;
|
||||
pluginAssembly = null;
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReceivedData(IAsyncResult result) {
|
||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||
epSender = (EndPoint)ipeSender;
|
||||
Packet packet = null;
|
||||
int numBytes = Server.EndReceiveFrom(result, ref epSender);
|
||||
int packetEnd = numBytes - 1;
|
||||
packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
|
||||
//Console.Error.WriteLine(packet.ToString());
|
||||
private void OnReceivedData(IAsyncResult result) {
|
||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||
epSender = (EndPoint)ipeSender;
|
||||
Packet packet = null;
|
||||
int numBytes = Server.EndReceiveFrom(result, ref epSender);
|
||||
int packetEnd = numBytes - 1;
|
||||
packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
|
||||
|
||||
// This is either a new client or a packet to send to an old one
|
||||
if(ClientThreads.ContainsKey(epSender)) {
|
||||
ClientThreads[epSender].InPacket(packet);
|
||||
} else if( packet.Type == PacketType.UseCircuitCode ) { // new client
|
||||
OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet);
|
||||
ClientThreads.Add(epSender, newuser);
|
||||
} else { // invalid client
|
||||
Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
|
||||
}
|
||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||
}
|
||||
|
||||
// This is either a new client or a packet to send to an old one
|
||||
if(ClientThreads.ContainsKey(epSender)) {
|
||||
ClientThreads[epSender].InPacket(packet);
|
||||
} else if( packet.Type == PacketType.UseCircuitCode ) { // new client
|
||||
OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet);
|
||||
ClientThreads.Add(epSender, newuser);
|
||||
} else { // invalid client
|
||||
Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
|
||||
}
|
||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||
}
|
||||
private void MainServerListener() {
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
|
||||
|
||||
private void MainServerListener() {
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
|
||||
ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
|
||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
Server.Bind(ServerIncoming);
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
|
||||
|
||||
ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
|
||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
Server.Bind(ServerIncoming);
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
|
||||
|
||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||
epSender = (EndPoint) ipeSender;
|
||||
ReceivedData = new AsyncCallback(this.OnReceivedData);
|
||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
|
||||
|
||||
}
|
||||
|
||||
public static void Shutdown() {
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
||||
// IMPLEMENT THIS
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
||||
ServerConsole.MainConsole.Instance.Close();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
void Timer1Tick( object sender, System.EventArgs e )
|
||||
{
|
||||
Console.WriteLine("UPDATE WORLD!");
|
||||
local_world.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public class Grid
|
||||
{
|
||||
public IAssetServer AssetServer;
|
||||
public IGridServer GridServer;
|
||||
public string AssetDll = "";
|
||||
public string GridDll = "";
|
||||
|
||||
public Grid()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadPlugins()
|
||||
{
|
||||
this.AssetServer = this.LoadAssetDll(this.AssetDll);
|
||||
this.GridServer = this.LoadGridDll(this.GridDll);
|
||||
}
|
||||
|
||||
private IAssetServer LoadAssetDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||
epSender = (EndPoint) ipeSender;
|
||||
ReceivedData = new AsyncCallback(this.OnReceivedData);
|
||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
|
||||
|
||||
}
|
||||
|
||||
public static void Shutdown() {
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
||||
// IMPLEMENT THIS
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
||||
ServerConsole.MainConsole.Instance.Close();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
void Timer1Tick( object sender, System.EventArgs e )
|
||||
{
|
||||
|
||||
local_world.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public class Grid
|
||||
{
|
||||
public IAssetServer AssetServer;
|
||||
public IGridServer GridServer;
|
||||
public string AssetDll = "";
|
||||
public string GridDll = "";
|
||||
|
||||
public Grid()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadPlugins()
|
||||
{
|
||||
this.AssetServer = this.LoadAssetDll(this.AssetDll);
|
||||
this.GridServer = this.LoadGridDll(this.GridDll);
|
||||
}
|
||||
|
||||
private IAssetServer LoadAssetDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
IAssetServer server = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
|
||||
|
||||
|
@ -277,26 +276,26 @@ namespace OpenSim
|
|||
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
server = plug.GetAssetServer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
pluginAssembly = null;
|
||||
pluginAssembly = null;
|
||||
return server;
|
||||
}
|
||||
|
||||
private IGridServer LoadGridDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
}
|
||||
|
||||
private IGridServer LoadGridDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
IGridServer server = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
|
||||
|
||||
|
@ -305,14 +304,14 @@ namespace OpenSim
|
|||
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
server = plug.GetGridServer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
pluginAssembly = null;
|
||||
pluginAssembly = null;
|
||||
return server;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,9 @@ namespace OpenSim
|
|||
case PacketType.AgentWearablesRequest:
|
||||
ClientAvatar.SendInitialAppearance();
|
||||
break;
|
||||
case PacketType.ObjectAdd:
|
||||
OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
|
||||
break;
|
||||
case PacketType.TransferRequest:
|
||||
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
|
||||
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
|
||||
|
@ -251,7 +254,7 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
|
||||
ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
|
||||
|
||||
byte[] ZeroOutBuffer = new byte[4096];
|
||||
byte[] sendbuffer;
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
[assembly: CLSCompliantAttribute(false)]
|
||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
||||
[assembly: AssemblyTitleAttribute("opensim-remoteservers")]
|
||||
[assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")]
|
||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("RemoteGridServers")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RemoteGridServers")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="libsecondlife">
|
||||
<HintPath>..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -39,16 +39,16 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\Version0_2_myserver\OpenSim\bin\Debug\log4net.dll</HintPath>
|
||||
<Reference Include="libsecondlife">
|
||||
<HintPath>..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="Axiom.MathLib">
|
||||
<HintPath>..\Version0_2_myserver\OpenSim\bin\Debug\Axiom.MathLib.dll</HintPath>
|
||||
<HintPath>..\..\..\..\..\Opensim-pluginsystem\bin\Axiom.MathLib.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="libsecondlife">
|
||||
<HintPath>..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\bin\log4net.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
[assembly: CLSCompliantAttribute(false)]
|
||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
||||
[assembly: AssemblyTitleAttribute("opensim-serverconsole")]
|
||||
[assembly: AssemblyDescriptionAttribute("The default server console")]
|
||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("ServerConsole")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ServerConsole")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
|
116
src/Util.cs
116
src/Util.cs
|
@ -84,120 +84,4 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VoipConnectionPacket : Packet
|
||||
{
|
||||
/// <exclude/>
|
||||
// [XmlType("VoipConnection_Serverblock1")]
|
||||
public class ServerBlock
|
||||
{
|
||||
public uint Test1;
|
||||
public uint IP;
|
||||
public ushort Port;
|
||||
private byte[] userName;
|
||||
public byte[] UserName
|
||||
{
|
||||
get { return userName; }
|
||||
set
|
||||
{
|
||||
if (value == null) { userName = null; return; }
|
||||
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
||||
else { userName = new byte[value.Length]; Array.Copy(value, userName, value.Length); }
|
||||
}
|
||||
}
|
||||
|
||||
//[XmlIgnore]
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
int length = 4;
|
||||
if (UserName != null) { length += 1 + UserName.Length; }
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
public ServerBlock() { }
|
||||
public ServerBlock(byte[] bytes, ref int i)
|
||||
{
|
||||
try
|
||||
{
|
||||
Test1 = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new MalformedDataException();
|
||||
}
|
||||
}
|
||||
|
||||
public void ToBytes(byte[] bytes, ref int i)
|
||||
{
|
||||
bytes[i++] = (byte)(Test1 % 256);
|
||||
bytes[i++] = (byte)((Test1 >> 8) % 256);
|
||||
bytes[i++] = (byte)((Test1 >> 16) % 256);
|
||||
bytes[i++] = (byte)((Test1 >> 24) % 256);
|
||||
if(UserName == null) { Console.WriteLine("Warning: UserName is null, in " + this.GetType()); }
|
||||
bytes[i++] = (byte)UserName.Length;
|
||||
Array.Copy(UserName, 0, bytes, i, UserName.Length);
|
||||
i += UserName.Length;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string output = "-- ServerBlock1 --" + Environment.NewLine;
|
||||
output += "Test1: " + Test1.ToString() + "" + Environment.NewLine;
|
||||
output = output.Trim();
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Header header;
|
||||
public override Header Header { get { return header; } set { header = value; } }
|
||||
public override PacketType Type { get { return PacketType.TestMessage; } }
|
||||
public ServerBlock ServerBlock1;
|
||||
|
||||
public VoipConnectionPacket()
|
||||
{
|
||||
Header = new LowHeader();
|
||||
Header.ID = 600;
|
||||
Header.Reliable = true;
|
||||
Header.Zerocoded = true;
|
||||
ServerBlock1 = new ServerBlock();
|
||||
}
|
||||
|
||||
public VoipConnectionPacket(byte[] bytes, ref int i)
|
||||
{
|
||||
int packetEnd = bytes.Length - 1;
|
||||
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
||||
ServerBlock1 = new ServerBlock(bytes, ref i);
|
||||
}
|
||||
|
||||
public VoipConnectionPacket(Header head, byte[] bytes, ref int i)
|
||||
{
|
||||
Header = head;
|
||||
ServerBlock1 = new ServerBlock(bytes, ref i);
|
||||
}
|
||||
|
||||
public override byte[] ToBytes()
|
||||
{
|
||||
int length = 8;
|
||||
length += ServerBlock1.Length;;
|
||||
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
||||
byte[] bytes = new byte[length];
|
||||
int i = 0;
|
||||
header.ToBytes(bytes, ref i);
|
||||
ServerBlock1.ToBytes(bytes, ref i);
|
||||
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string output = "--- VoipConnection ---" + Environment.NewLine;
|
||||
output += ServerBlock1.ToString() + Environment.NewLine;
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
[assembly: CLSCompliantAttribute(false)]
|
||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
||||
[assembly: AssemblyTitleAttribute("opensim-physicsmanager")]
|
||||
[assembly: AssemblyDescriptionAttribute("Handles physics plugins")]
|
||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("PhysicsManager")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PhysicsManager")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
[assembly: CLSCompliantAttribute(false)]
|
||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
||||
[assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")]
|
||||
[assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")]
|
||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("PhysXplugin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PhysXplugin")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
|
|
@ -87,10 +87,8 @@ namespace PhysXplugin
|
|||
|
||||
public override void Simulate(float timeStep)
|
||||
{
|
||||
Console.WriteLine("SIMULATE!");
|
||||
foreach (PhysXActor actor in _actors)
|
||||
{
|
||||
Console.WriteLine("AN ACTOR!");
|
||||
actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep;
|
||||
actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep;
|
||||
actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep;
|
||||
|
@ -120,7 +118,7 @@ namespace PhysXplugin
|
|||
|
||||
public override void GetResults()
|
||||
{
|
||||
Console.WriteLine("GET RESULTS!");
|
||||
|
||||
}
|
||||
|
||||
public override bool IsThreaded
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace OpenSim.world
|
|||
ControllingClient=TheClient;
|
||||
SetupTemplate("avatar-template.dat");
|
||||
position = new LLVector3(100.0f,100.0f,30.0f);
|
||||
position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1;
|
||||
}
|
||||
|
||||
public PhysicsActor PhysActor
|
||||
|
@ -43,7 +44,6 @@ namespace OpenSim.world
|
|||
{
|
||||
for(int i=0 ; i < this.forcesList.Count; i++)
|
||||
{
|
||||
Console.WriteLine("ADDING A FORCE!");
|
||||
NewForce force = this.forcesList[i];
|
||||
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
|
||||
this._physActor.Velocity = phyVector;
|
||||
|
@ -61,8 +61,8 @@ namespace OpenSim.world
|
|||
|
||||
public override void update()
|
||||
{
|
||||
Console.WriteLine("UPDATING AVATAR!");
|
||||
if(this.updateflag)
|
||||
|
||||
if(this.updateflag)
|
||||
{
|
||||
//need to send movement info
|
||||
//so create the improvedterseobjectupdate packet
|
||||
|
@ -74,28 +74,31 @@ namespace OpenSim.world
|
|||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = terseBlock;
|
||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
|
||||
updateflag =false;
|
||||
updateflag =false;
|
||||
this._updateCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_updateCount++;
|
||||
if(_updateCount>5)
|
||||
if(walking)
|
||||
{
|
||||
//It has been a while since last update was sent so lets send one.
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 64096;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = terseBlock;
|
||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||
client.OutPacket(terse);
|
||||
_updateCount++;
|
||||
if(_updateCount>3)
|
||||
{
|
||||
//It has been a while since last update was sent so lets send one.
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 64096;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = terseBlock;
|
||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
_updateCount = 0;
|
||||
}
|
||||
_updateCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace OpenSim.world
|
|||
{
|
||||
public class Entity
|
||||
{
|
||||
protected libsecondlife.LLUUID uuid;
|
||||
protected uint localid;
|
||||
public libsecondlife.LLUUID uuid;
|
||||
public uint localid;
|
||||
public LLVector3 position;
|
||||
public LLVector3 velocity;
|
||||
public Quaternion rotation;
|
||||
|
|
|
@ -2,6 +2,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.types;
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
|
||||
namespace OpenSim.world
|
||||
{
|
||||
|
@ -9,6 +11,9 @@ namespace OpenSim.world
|
|||
{
|
||||
protected float mesh_cutbegin;
|
||||
protected float mesh_cutend;
|
||||
protected PrimData primData;
|
||||
protected bool newPrimFlag;
|
||||
protected ObjectUpdatePacket OurPacket;
|
||||
|
||||
public Primitive()
|
||||
{
|
||||
|
@ -29,5 +34,103 @@ namespace OpenSim.world
|
|||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
if(this.newPrimFlag)
|
||||
{
|
||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||
client.OutPacket(OurPacket);
|
||||
}
|
||||
this.newPrimFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
|
||||
{
|
||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
|
||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
PrimData PData = new PrimData();
|
||||
this.primData = PData;
|
||||
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();//OpenSim_Main.local_world.PrimTemplate;
|
||||
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||
objupdate.ObjectData[0].ExtraParams = new byte[1];
|
||||
objupdate.ObjectData[0].MediaURL = new byte[0];
|
||||
objupdate.ObjectData[0].NameValue = new byte[0];
|
||||
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||
objupdate.ObjectData[0].Text = new byte[0];
|
||||
objupdate.ObjectData[0].TextColor = new byte[4];
|
||||
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0);
|
||||
objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0);
|
||||
objupdate.ObjectData[0].Material = 3;
|
||||
objupdate.ObjectData[0].TextureAnim = new byte[0];
|
||||
objupdate.ObjectData[0].Sound = LLUUID.Zero;
|
||||
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
||||
objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
|
||||
objupdate.ObjectData[0].State = 0;
|
||||
objupdate.ObjectData[0].Data = new byte[0];
|
||||
PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID;
|
||||
PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
|
||||
PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
|
||||
PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
|
||||
PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
|
||||
PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
|
||||
PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
|
||||
PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
|
||||
PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
|
||||
PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
|
||||
PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
|
||||
PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
|
||||
PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
|
||||
PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
|
||||
PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
|
||||
PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
|
||||
//finish off copying rest of shape data
|
||||
|
||||
objupdate.ObjectData[0].ID = (uint)(localID);
|
||||
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda" + (localID- 702000).ToString("000"));
|
||||
|
||||
objupdate.ObjectData[0].ObjectData = new byte[60];
|
||||
objupdate.ObjectData[0].ObjectData[46] = 128;
|
||||
objupdate.ObjectData[0].ObjectData[47] = 63;
|
||||
LLVector3 pos1= addPacket.ObjectData.RayEnd;
|
||||
//update position
|
||||
byte[] pb = pos1.GetBytes();
|
||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
|
||||
|
||||
this.newPrimFlag = true;
|
||||
this.uuid = objupdate.ObjectData[0].FullID;
|
||||
this.localid = objupdate.ObjectData[0].ID;
|
||||
this.position = pos1;
|
||||
this.OurPacket = objupdate;
|
||||
}
|
||||
}
|
||||
|
||||
public class PrimData
|
||||
{
|
||||
public LLUUID OwnerID;
|
||||
public byte PCode;
|
||||
public byte PathBegin;
|
||||
public byte PathEnd;
|
||||
public byte PathScaleX;
|
||||
public byte PathScaleY;
|
||||
public byte PathShearX;
|
||||
public byte PathShearY;
|
||||
public sbyte PathSkew;
|
||||
public byte ProfileBegin;
|
||||
public byte ProfileEnd;
|
||||
public LLVector3 Scale;
|
||||
public byte PathCurve;
|
||||
public byte ProfileCurve;
|
||||
public uint ParentID=0;
|
||||
public byte ProfileHollow;
|
||||
|
||||
public PrimData()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace OpenSim.world
|
|||
private libsecondlife.TerrainManager TerrainManager;
|
||||
|
||||
private Random Rand = new Random();
|
||||
private uint _primCount = 702000;
|
||||
|
||||
public World()
|
||||
{
|
||||
|
@ -95,11 +96,22 @@ namespace OpenSim.world
|
|||
//this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
|
||||
this.Entities.Add(AgentClient.AgentID, NewAvatar);
|
||||
}
|
||||
|
||||
public void AddNewPrim(ObjectAddPacket addPacket, OpenSimClient AgentClient)
|
||||
{
|
||||
ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
||||
Primitive prim = new Primitive();
|
||||
prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
|
||||
this.Entities.Add(prim.uuid, prim);
|
||||
this._primCount++;
|
||||
}
|
||||
|
||||
public bool Backup() {
|
||||
/* TODO: Save the current world entities state. */
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue