RIP OpenSimRoot. (removed)
Merged most of the bug fixes etc in from LLdemo branch. Added the textures from that branch.tourmaline
parent
c88eaa7f9a
commit
98d81485e7
|
@ -137,52 +137,92 @@ namespace OpenSim.GridInterfaces.Local
|
|||
|
||||
private void SetUpAssetDatabase()
|
||||
{
|
||||
Console.WriteLine("setting up Asset database");
|
||||
try
|
||||
{
|
||||
|
||||
AssetBase Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
|
||||
Image.Name = "test Texture";
|
||||
this.LoadAsset(Image, true, "testpic2.jp2");
|
||||
AssetStorage store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
Console.WriteLine("setting up Asset database");
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
|
||||
Image.Name = "test Texture2";
|
||||
this.LoadAsset(Image, true, "map_base.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
AssetBase Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
|
||||
Image.Name = "Bricks";
|
||||
this.LoadAsset(Image, true, "bricks.jp2");
|
||||
AssetStorage store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||
Image.Name = "Prim Base Texture";
|
||||
this.LoadAsset(Image, true, "testpic2.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
|
||||
Image.Name = "Plywood";
|
||||
this.LoadAsset(Image, true, "plywood.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
Image.Name = "Shape";
|
||||
this.LoadAsset(Image, false, "base_shape.dat");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
|
||||
Image.Name = "Rocks";
|
||||
this.LoadAsset(Image, true, "rocks.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
|
||||
Image.Name = "Granite";
|
||||
this.LoadAsset(Image, true, "granite.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
|
||||
Image.Name = "Hardwood";
|
||||
this.LoadAsset(Image, true, "hardwood.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||
Image.Name = "Prim Base Texture";
|
||||
this.LoadAsset(Image, true, "plywood.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
Image.Name = "Shape";
|
||||
this.LoadAsset(Image, false, "base_shape.dat");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
store.UUID = Image.FullID;
|
||||
db.Set(store);
|
||||
db.Commit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -149,6 +149,11 @@ namespace OpenSim.Physics.BasicPhysicsPlugin
|
|||
{
|
||||
this._heightMap = heightMap;
|
||||
}
|
||||
|
||||
public override void DeleteTerrain()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class BasicActor : PhysicsActor
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace OpenSim.Physics.Manager
|
|||
|
||||
public abstract void SetTerrain(float[] heightMap);
|
||||
|
||||
public abstract void DeleteTerrain();
|
||||
|
||||
public abstract bool IsThreaded
|
||||
{
|
||||
get;
|
||||
|
@ -76,6 +78,8 @@ namespace OpenSim.Physics.Manager
|
|||
public override void Simulate(float timeStep)
|
||||
{
|
||||
m_workIndicator = (m_workIndicator + 1) % 10;
|
||||
|
||||
//OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString());
|
||||
}
|
||||
|
||||
public override void GetResults()
|
||||
|
@ -88,6 +92,11 @@ namespace OpenSim.Physics.Manager
|
|||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
|
||||
}
|
||||
|
||||
public override void DeleteTerrain()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool IsThreaded
|
||||
{
|
||||
get { return false; }
|
||||
|
|
|
@ -170,6 +170,11 @@ namespace OpenSim.Physics.OdePlugin
|
|||
d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0);
|
||||
LandGeom=d.CreateHeightfield(space, HeightmapData, 0);
|
||||
}
|
||||
|
||||
public override void DeleteTerrain()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class OdeCharacter : PhysicsActor
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace OpenSim.Physics.PhysXPlugin
|
|||
{
|
||||
private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
|
||||
private List<PhysXPrim> _prims = new List<PhysXPrim>();
|
||||
private float[] _heightMap;
|
||||
private float[] _heightMap = null;
|
||||
private NxPhysicsSDK mySdk;
|
||||
private NxScene scene;
|
||||
|
||||
|
@ -138,18 +138,25 @@ namespace OpenSim.Physics.PhysXPlugin
|
|||
}
|
||||
public override void Simulate(float timeStep)
|
||||
{
|
||||
foreach (PhysXCharacter actor in _characters)
|
||||
{
|
||||
actor.Move(timeStep);
|
||||
}
|
||||
scene.Simulate(timeStep);
|
||||
scene.FetchResults();
|
||||
scene.UpdateControllers();
|
||||
try
|
||||
{
|
||||
foreach (PhysXCharacter actor in _characters)
|
||||
{
|
||||
actor.Move(timeStep);
|
||||
}
|
||||
scene.Simulate(timeStep);
|
||||
scene.FetchResults();
|
||||
scene.UpdateControllers();
|
||||
|
||||
foreach (PhysXCharacter actor in _characters)
|
||||
{
|
||||
actor.UpdatePosition();
|
||||
}
|
||||
foreach (PhysXCharacter actor in _characters)
|
||||
{
|
||||
actor.UpdatePosition();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -168,10 +175,20 @@ namespace OpenSim.Physics.PhysXPlugin
|
|||
|
||||
public override void SetTerrain(float[] heightMap)
|
||||
{
|
||||
if (this._heightMap != null)
|
||||
{
|
||||
Console.WriteLine("PhysX - deleting old terrain");
|
||||
this.scene.DeleteTerrain();
|
||||
}
|
||||
this._heightMap = heightMap;
|
||||
this.scene.AddTerrain(heightMap);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeleteTerrain()
|
||||
{
|
||||
this.scene.DeleteTerrain();
|
||||
}
|
||||
}
|
||||
|
||||
public class PhysXCharacter : PhysicsActor
|
||||
{
|
||||
|
@ -211,6 +228,11 @@ namespace OpenSim.Physics.PhysXPlugin
|
|||
set
|
||||
{
|
||||
_position = value;
|
||||
Vec3 ps = new Vec3();
|
||||
ps.X = value.X;
|
||||
ps.Y = value.Y;
|
||||
ps.Z = value.Z;
|
||||
this._character.Position = ps;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Assets
|
|||
|
||||
private IAssetServer _assetServer;
|
||||
private Thread _assetCacheThread;
|
||||
private LLUUID[] textureList = new LLUUID[2];
|
||||
private LLUUID[] textureList = new LLUUID[5];
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
@ -100,6 +100,10 @@ namespace OpenSim.Assets
|
|||
//hack: so we can give each user a set of textures
|
||||
textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001");
|
||||
textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002");
|
||||
textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003");
|
||||
textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004");
|
||||
textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005");
|
||||
|
||||
for (int i = 0; i < textureList.Length; i++)
|
||||
{
|
||||
this._assetServer.RequestAsset(textureList[i], true);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.CAPS
|
||||
{
|
||||
public interface IXmlRPCHandler
|
||||
{
|
||||
string HandleRPC(string requestBody);
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ namespace OpenSim.CAPS
|
|||
private Thread m_workerThread;
|
||||
private HttpListener m_httpListener;
|
||||
private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>();
|
||||
private Dictionary<string, IXmlRPCHandler> RPCHandlers = new Dictionary<string, IXmlRPCHandler>();
|
||||
private IGridServer m_gridServer;
|
||||
private int m_port;
|
||||
|
||||
|
@ -96,8 +97,22 @@ namespace OpenSim.CAPS
|
|||
//must already have a handler for that path so return false
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AddXmlRPCHandler(string method, IXmlRPCHandler handler)
|
||||
{
|
||||
if (!this.RPCHandlers.ContainsKey(method))
|
||||
{
|
||||
this.RPCHandlers.Add(method, handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
//must already have a handler for that path so return false
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual string ParseXMLRPC(string requestBody)
|
||||
{
|
||||
string responseString = "";
|
||||
try
|
||||
{
|
||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||
|
@ -115,17 +130,23 @@ namespace OpenSim.CAPS
|
|||
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||
if (m_gridServer.GetName() == "Remote")
|
||||
{
|
||||
|
||||
((RemoteGridBase)m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
|
||||
((RemoteGridBase) m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
|
||||
}
|
||||
return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
|
||||
responseString = "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
|
||||
break;
|
||||
default:
|
||||
if (this.RPCHandlers.ContainsKey(request.MethodName))
|
||||
{
|
||||
//responseString = this.RPCHandlers[request.MethodName]
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
}
|
||||
return "";
|
||||
return responseString;
|
||||
}
|
||||
|
||||
protected virtual string ParseREST(string requestBody, string requestURL, string requestMethod)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
|
@ -6,7 +6,8 @@
|
|||
<ProjectGuid>{ADD974E2-994C-4998-864E-4B54D8AD5F00}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>OpenSim.RegionServer</AssemblyName>
|
||||
|
@ -15,9 +16,11 @@
|
|||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder></AppDesignerFolder>
|
||||
<AppDesignerFolder>
|
||||
</AppDesignerFolder>
|
||||
<RootNamespace>OpenSim.RegionServer</RootNamespace>
|
||||
<StartupObject></StartupObject>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
</PropertyGroup>
|
||||
|
@ -28,7 +31,8 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
|
@ -37,7 +41,8 @@
|
|||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
|
@ -46,7 +51,8 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
|
@ -55,26 +61,28 @@
|
|||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" >
|
||||
<Reference Include="System">
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" >
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml">
|
||||
<HintPath>System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="libsecondlife.dll" >
|
||||
<Reference Include="libsecondlife.dll">
|
||||
<HintPath>..\bin\libsecondlife.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Axiom.MathLib.dll" >
|
||||
<Reference Include="Axiom.MathLib.dll">
|
||||
<HintPath>..\bin\Axiom.MathLib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Db4objects.Db4o.dll" >
|
||||
<Reference Include="Db4objects.Db4o.dll">
|
||||
<HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
|
@ -84,46 +92,44 @@
|
|||
<Name>OpenSim.Framework</Name>
|
||||
<Project>{BD7866A4-04BA-47F0-905F-B2359118F5B2}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||
<Name>OpenSim.Framework.Console</Name>
|
||||
<Project>{4B0A7290-36C2-4C74-B9B4-07775B031CF2}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
|
||||
<Name>OpenSim.Physics.Manager</Name>
|
||||
<Project>{2EAB18A1-8187-4C79-9947-A671F9C007D9}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Servers\OpenSim.Servers.csproj">
|
||||
<Name>OpenSim.Servers</Name>
|
||||
<Project>{B9D6A5F0-3BD2-4161-8AF1-90C03295D4EE}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AgentAssetUpload.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CAPS\IXmlRPCHandler.cs" />
|
||||
<Compile Include="ConsoleCmds.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Grid.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OpenSimApplication.cs">
|
||||
<Compile Include="OpenSimNetworkHandler.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OpenSimMain.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OpenSimRoot.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="QueItem.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<include name="AgentAssetUpload.cs" />
|
||||
<include name="ConsoleCmds.cs" />
|
||||
<include name="Grid.cs" />
|
||||
<include name="OpenSimApplication.cs" />
|
||||
<include name="OpenSimMain.cs" />
|
||||
<include name="OpenSimNetworkHandler.cs" />
|
||||
<include name="OpenSimRoot.cs" />
|
||||
<include name="QueItem.cs" />
|
||||
<include name="SimClient.cs" />
|
||||
|
@ -25,6 +25,7 @@
|
|||
<include name="Assets/InventoryCache.cs" />
|
||||
<include name="CAPS/AdminWebFront.cs" />
|
||||
<include name="CAPS/IRestHandler.cs" />
|
||||
<include name="CAPS/IXmlRPCHandler.cs" />
|
||||
<include name="CAPS/SimHttp.cs" />
|
||||
<include name="types/Mesh.cs" />
|
||||
<include name="types/Triangle.cs" />
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
public abstract class OpenSimApplication
|
||||
{
|
||||
public abstract void StartUp();
|
||||
public abstract void Shutdown();
|
||||
public abstract void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
|
||||
public abstract void RemoveClientCircuit(uint circuitcode);
|
||||
}
|
||||
}
|
|
@ -48,10 +48,19 @@ using OpenSim.Physics.Manager;
|
|||
|
||||
namespace OpenSim
|
||||
{
|
||||
public class OpenSimMain : OpenSimApplication, conscmd_callback
|
||||
public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback
|
||||
{
|
||||
private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
||||
private PhysicsManager physManager;
|
||||
private World LocalWorld;
|
||||
private Grid GridServers;
|
||||
private SimConfig Cfg;
|
||||
private SimCAPSHTTPServer HttpServer;
|
||||
private AssetCache AssetCache;
|
||||
private InventoryCache InventoryCache;
|
||||
//public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>();
|
||||
private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
|
||||
private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
||||
private DateTime startuptime;
|
||||
|
||||
public Socket Server;
|
||||
private IPEndPoint ServerIncoming;
|
||||
|
@ -79,68 +88,68 @@ namespace OpenSim
|
|||
OpenSim.Framework.Console.MainConsole.Instance = m_console;
|
||||
}
|
||||
|
||||
public override void StartUp()
|
||||
public virtual void StartUp()
|
||||
{
|
||||
OpenSimRoot.Instance.GridServers = new Grid();
|
||||
GridServers = new Grid();
|
||||
if ( m_sandbox )
|
||||
{
|
||||
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
|
||||
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
|
||||
GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
|
||||
GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
|
||||
|
||||
m_console.WriteLine("Starting in Sandbox mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||
GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||
GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||
|
||||
m_console.WriteLine("Starting in Grid mode");
|
||||
}
|
||||
|
||||
OpenSimRoot.Instance.GridServers.Initialise();
|
||||
GridServers.Initialise();
|
||||
|
||||
OpenSimRoot.Instance.startuptime = DateTime.Now;
|
||||
startuptime = DateTime.Now;
|
||||
|
||||
OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer);
|
||||
OpenSimRoot.Instance.InventoryCache = new InventoryCache();
|
||||
AssetCache = new AssetCache(GridServers.AssetServer);
|
||||
InventoryCache = new InventoryCache();
|
||||
|
||||
// We check our local database first, then the grid for config options
|
||||
m_console.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||
OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll);
|
||||
OpenSimRoot.Instance.Cfg.InitConfig(this.m_sandbox);
|
||||
Cfg = this.LoadConfigDll(this.ConfigDll);
|
||||
Cfg.InitConfig(this.m_sandbox);
|
||||
m_console.WriteLine("Main.cs:Startup() - Contacting gridserver");
|
||||
OpenSimRoot.Instance.Cfg.LoadFromGrid();
|
||||
Cfg.LoadFromGrid();
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString());
|
||||
m_console.WriteLine("Main.cs:Startup() - We are " + Cfg.RegionName + " at " + Cfg.RegionLocX.ToString() + "," + Cfg.RegionLocY.ToString());
|
||||
m_console.WriteLine("Initialising world");
|
||||
OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg);
|
||||
OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld();
|
||||
LocalWorld = new World(ClientThreads, Cfg.RegionHandle, Cfg.RegionName, Cfg);
|
||||
LocalWorld.LandMap = Cfg.LoadWorld();
|
||||
|
||||
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
||||
this.physManager.LoadPlugins();
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
||||
OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use
|
||||
OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap);
|
||||
LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use
|
||||
LocalWorld.PhysScene.SetTerrain(LocalWorld.LandMap);
|
||||
|
||||
OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey);
|
||||
OpenSimRoot.Instance.GridServers.GridServer.SetServerInfo(OpenSimRoot.Instance.Cfg.GridURL, OpenSimRoot.Instance.Cfg.GridSendKey, OpenSimRoot.Instance.Cfg.GridRecvKey);
|
||||
GridServers.AssetServer.SetServerInfo(Cfg.AssetURL, Cfg.AssetSendKey);
|
||||
GridServers.GridServer.SetServerInfo(Cfg.GridURL, Cfg.GridSendKey, Cfg.GridRecvKey);
|
||||
|
||||
OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
|
||||
OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage();
|
||||
LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
|
||||
LocalWorld.LoadPrimsFromStorage();
|
||||
|
||||
if ( m_sandbox)
|
||||
{
|
||||
OpenSimRoot.Instance.AssetCache.LoadDefaultTextureSet();
|
||||
AssetCache.LoadDefaultTextureSet();
|
||||
}
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
|
||||
OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||
OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld));
|
||||
HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
|
||||
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld));
|
||||
|
||||
if ( m_loginserver && m_sandbox)
|
||||
{
|
||||
LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenAddr, OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||
LoginServer loginServer = new LoginServer(GridServers.GridServer, Cfg.IPListenAddr, Cfg.IPListenPort);
|
||||
loginServer.Startup();
|
||||
}
|
||||
|
||||
|
@ -194,15 +203,15 @@ namespace OpenSim
|
|||
// do we already have a circuit for this endpoint
|
||||
if(this.clientCircuits.ContainsKey(epSender))
|
||||
{
|
||||
OpenSimRoot.Instance.ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
|
||||
ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
|
||||
}
|
||||
else if (packet.Type == PacketType.UseCircuitCode)
|
||||
{ // new client
|
||||
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
|
||||
this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
|
||||
SimClient newuser = new SimClient(epSender, useCircuit, OpenSimRoot.Instance.LocalWorld, OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.AssetCache, OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Application, OpenSimRoot.Instance.InventoryCache, OpenSimRoot.Instance.Sandbox);
|
||||
SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox);
|
||||
//OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
|
||||
OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
|
||||
ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
|
||||
}
|
||||
else
|
||||
{ // invalid client
|
||||
|
@ -214,9 +223,9 @@ namespace OpenSim
|
|||
private void MainServerListener()
|
||||
{
|
||||
m_console.WriteLine("Main.cs:MainServerListener() - New thread started");
|
||||
m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + OpenSimRoot.Instance.Cfg.IPListenAddr + ":" + OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||
m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + Cfg.IPListenAddr + ":" + Cfg.IPListenPort);
|
||||
|
||||
ServerIncoming = new IPEndPoint(IPAddress.Any, OpenSimRoot.Instance.Cfg.IPListenPort);
|
||||
ServerIncoming = new IPEndPoint(IPAddress.Any, Cfg.IPListenPort);
|
||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
Server.Bind(ServerIncoming);
|
||||
|
||||
|
@ -231,7 +240,7 @@ namespace OpenSim
|
|||
|
||||
}
|
||||
|
||||
public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender)
|
||||
public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender)
|
||||
{
|
||||
// find the endpoint for this circuit
|
||||
EndPoint sendto = null;
|
||||
|
@ -250,7 +259,7 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
public override void RemoveClientCircuit(uint circuitcode)
|
||||
public virtual void RemoveClientCircuit(uint circuitcode)
|
||||
{
|
||||
foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits)
|
||||
{
|
||||
|
@ -262,22 +271,22 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
public virtual void Shutdown()
|
||||
{
|
||||
m_console.WriteLine("Main.cs:Shutdown() - Closing all threads");
|
||||
m_console.WriteLine("Main.cs:Shutdown() - Killing listener thread");
|
||||
m_console.WriteLine("Main.cs:Shutdown() - Killing clients");
|
||||
// IMPLEMENT THIS
|
||||
m_console.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
||||
OpenSimRoot.Instance.LocalWorld.Close();
|
||||
OpenSimRoot.Instance.GridServers.Close();
|
||||
LocalWorld.Close();
|
||||
GridServers.Close();
|
||||
m_console.Close();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
void Timer1Tick(object sender, System.EventArgs e)
|
||||
{
|
||||
OpenSimRoot.Instance.LocalWorld.Update();
|
||||
LocalWorld.Update();
|
||||
}
|
||||
|
||||
public void RunCmd(string command, string[] cmdparams)
|
||||
|
@ -295,7 +304,7 @@ namespace OpenSim
|
|||
break;
|
||||
|
||||
case "regenerate":
|
||||
OpenSimRoot.Instance.LocalWorld.RegenerateTerrain();
|
||||
LocalWorld.RegenerateTerrain();
|
||||
break;
|
||||
|
||||
case "shutdown":
|
||||
|
@ -309,17 +318,17 @@ namespace OpenSim
|
|||
switch (ShowWhat)
|
||||
{
|
||||
case "uptime":
|
||||
m_console.WriteLine("OpenSim has been running since " + OpenSimRoot.Instance.startuptime.ToString());
|
||||
m_console.WriteLine("That is " + (DateTime.Now - OpenSimRoot.Instance.startuptime).ToString());
|
||||
m_console.WriteLine("OpenSim has been running since " + startuptime.ToString());
|
||||
m_console.WriteLine("That is " + (DateTime.Now - startuptime).ToString());
|
||||
break;
|
||||
case "users":
|
||||
OpenSim.world.Avatar TempAv;
|
||||
m_console.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP"));
|
||||
foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
|
||||
foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys)
|
||||
{
|
||||
if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
|
||||
if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
|
||||
{
|
||||
TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
|
||||
TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID];
|
||||
m_console.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
public interface OpenSimNetworkHandler
|
||||
{
|
||||
//public abstract void StartUp();
|
||||
// public abstract void Shutdown();
|
||||
void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
|
||||
void RemoveClientCircuit(uint circuitcode);
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
//using System.Net.Sockets;
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
using OpenSim.world;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.UserServer;
|
||||
using OpenSim.Assets;
|
||||
using OpenSim.CAPS;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Physics.Manager;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
public sealed class OpenSimRoot
|
||||
{
|
||||
private static OpenSimRoot instance = new OpenSimRoot();
|
||||
|
||||
public static OpenSimRoot Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private OpenSimRoot()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public World LocalWorld;
|
||||
public Grid GridServers;
|
||||
public SimConfig Cfg;
|
||||
public SimCAPSHTTPServer HttpServer;
|
||||
public AssetCache AssetCache;
|
||||
public InventoryCache InventoryCache;
|
||||
//public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>();
|
||||
public Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
|
||||
public DateTime startuptime;
|
||||
public OpenSimApplication Application;
|
||||
public bool Sandbox = false;
|
||||
|
||||
}
|
||||
}
|
|
@ -75,7 +75,7 @@ namespace OpenSim
|
|||
private Dictionary<uint, SimClient> m_clientThreads;
|
||||
private AssetCache m_assetCache;
|
||||
private IGridServer m_gridServer;
|
||||
private OpenSimApplication m_application;
|
||||
private OpenSimNetworkHandler m_application;
|
||||
private InventoryCache m_inventoryCache;
|
||||
private bool m_sandboxMode;
|
||||
|
||||
|
@ -188,7 +188,7 @@ namespace OpenSim
|
|||
{
|
||||
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
|
||||
{
|
||||
ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.W);
|
||||
ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
|
||||
((OpenSim.world.Primitive)ent).UpdateFlag = true;
|
||||
}
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ namespace OpenSim
|
|||
this.PacketQueue.Enqueue(item);
|
||||
}
|
||||
|
||||
public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimApplication application, InventoryCache inventoryCache, bool sandboxMode)
|
||||
public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode)
|
||||
{
|
||||
m_world = world;
|
||||
m_clientThreads = clientThreads;
|
||||
|
|
|
@ -309,7 +309,7 @@ namespace OpenSim.UserServer
|
|||
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||
LLUUID BaseFolderID = LLUUID.Random();
|
||||
LLUUID InventoryFolderID = LLUUID.Random();
|
||||
Inventory2["name"] = "Base";
|
||||
Inventory2["name"] = "Textures";
|
||||
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||
Inventory2["type_default"] = 0;
|
||||
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.world
|
|||
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
||||
ControllingClient = TheClient;
|
||||
localid = 8880000 + (m_world._localNumber++);
|
||||
localid = 8880000 + (this.m_world._localNumber++);
|
||||
position = new LLVector3(100.0f, 100.0f, 30.0f);
|
||||
position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
|
||||
visualParams = new byte[218];
|
||||
|
@ -82,7 +82,10 @@ namespace OpenSim.world
|
|||
{
|
||||
NewForce force = this.forcesList[i];
|
||||
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
|
||||
this._physActor.Velocity = phyVector;
|
||||
lock (m_world.LockPhysicsEngine)
|
||||
{
|
||||
this._physActor.Velocity = phyVector;
|
||||
}
|
||||
this.updateflag = true;
|
||||
this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
|
||||
// but as we are setting the velocity (rather than using real forces) at the moment it is okay.
|
||||
|
@ -181,7 +184,7 @@ namespace OpenSim.world
|
|||
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
||||
mov.AgentData.SessionID = this.ControllingClient.SessionID;
|
||||
mov.AgentData.AgentID = this.ControllingClient.AgentID;
|
||||
mov.Data.RegionHandle = m_regionHandle;
|
||||
mov.Data.RegionHandle = this.m_regionHandle;
|
||||
// TODO - dynamicalise this stuff
|
||||
mov.Data.Timestamp = 1172750370;
|
||||
mov.Data.Position = new LLVector3(100f, 100f, 23f);
|
||||
|
@ -475,7 +478,12 @@ namespace OpenSim.world
|
|||
ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
|
||||
ani.AnimationList[0].AnimID = this.current_anim;
|
||||
ani.AnimationList[0].AnimSequenceID = this.anim_seq;
|
||||
ControllingClient.OutPacket(ani);
|
||||
|
||||
//ControllingClient.OutPacket(ani);
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
{
|
||||
client.OutPacket(ani);
|
||||
}
|
||||
}
|
||||
|
||||
//should be moved somewhere else
|
||||
|
@ -522,7 +530,11 @@ namespace OpenSim.world
|
|||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
|
||||
|
||||
dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry;
|
||||
libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
|
||||
libsecondlife.LLVector3 pos2 = new LLVector3(0, 0, 0);
|
||||
lock (m_world.LockPhysicsEngine)
|
||||
{
|
||||
pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
|
||||
}
|
||||
|
||||
uint ID = this.localid;
|
||||
|
||||
|
@ -542,8 +554,11 @@ namespace OpenSim.world
|
|||
ushort InternVelocityX;
|
||||
ushort InternVelocityY;
|
||||
ushort InternVelocityZ;
|
||||
|
||||
Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z);
|
||||
Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
|
||||
lock (m_world.LockPhysicsEngine)
|
||||
{
|
||||
internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z);
|
||||
}
|
||||
internDirec = internDirec / 128.0f;
|
||||
internDirec.x += 1;
|
||||
internDirec.y += 1;
|
||||
|
@ -596,6 +611,27 @@ namespace OpenSim.world
|
|||
Avatar.Animations = new AvatarAnimations();
|
||||
Avatar.Animations.LoadAnims();
|
||||
}
|
||||
|
||||
public override void LandRenegerated()
|
||||
{
|
||||
position = new LLVector3(100.0f, 100.0f, 30.0f);
|
||||
position.Z = this.m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 50;
|
||||
if (this._physActor != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (this.m_world.LockPhysicsEngine)
|
||||
{
|
||||
|
||||
this._physActor.Position = new PhysicsVector(position.X, position.Y, position.Z);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class NewForce
|
||||
|
|
|
@ -63,5 +63,10 @@ namespace OpenSim.world
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void LandRenegerated()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace OpenSim.world
|
|||
{
|
||||
public class Primitive : Entity
|
||||
{
|
||||
//private static object physicsLock = new object();
|
||||
protected float mesh_cutbegin;
|
||||
protected float mesh_cutend;
|
||||
protected PrimData primData;
|
||||
|
@ -21,7 +22,8 @@ namespace OpenSim.world
|
|||
private ObjectUpdatePacket OurPacket;
|
||||
private PhysicsActor _physActor;
|
||||
private bool physicsEnabled = false;
|
||||
private bool physicstest = false; //just added for testing
|
||||
private bool physicstest = false;
|
||||
private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
|
||||
private Dictionary<uint, SimClient> m_clientThreads;
|
||||
private ulong m_regionHandle;
|
||||
private World m_world;
|
||||
|
@ -97,13 +99,30 @@ namespace OpenSim.world
|
|||
this.position = pos;
|
||||
if (this._physActor != null) // && this.physicsEnabled)
|
||||
{
|
||||
this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
|
||||
try
|
||||
{
|
||||
lock (m_world.LockPhysicsEngine)
|
||||
{
|
||||
this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
this.updateFlag = true;
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
LLVector3 pos2 = new LLVector3(0, 0, 0);
|
||||
if (this._physActor != null && this.physicsEnabled)
|
||||
{
|
||||
|
||||
PhysicsVector pPos = this._physActor.Position;
|
||||
pos2 = new LLVector3(pPos.X, pPos.Y, pPos.Z);
|
||||
}
|
||||
if (this.newPrimFlag)
|
||||
{
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
|
@ -137,15 +156,19 @@ namespace OpenSim.world
|
|||
{
|
||||
if (this._physActor != null && this.physicsEnabled)
|
||||
{
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 64096;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = this.CreateImprovedBlock();
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
if (pos2 != this.positionLastFrame)
|
||||
{
|
||||
client.OutPacket(terse);
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = m_regionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 64096;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = this.CreateImprovedBlock();
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
{
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
}
|
||||
this.positionLastFrame = pos2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -487,7 +510,7 @@ namespace OpenSim.world
|
|||
this.primData.LocalID = this.localid;
|
||||
this.primData.Position = this.position;
|
||||
this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
|
||||
m_world.localStorage.StorePrim(this.primData);
|
||||
this.m_world.localStorage.StorePrim(this.primData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace OpenSim.world
|
|||
{
|
||||
public class World : ILocalStorageReceiver
|
||||
{
|
||||
public object LockPhysicsEngine = new object();
|
||||
public Dictionary<libsecondlife.LLUUID, Entity> Entities;
|
||||
public float[] LandMap;
|
||||
public ScriptEngine Scripts;
|
||||
|
@ -25,19 +26,19 @@ namespace OpenSim.world
|
|||
private Random Rand = new Random();
|
||||
private uint _primCount = 702000;
|
||||
private int storageCount;
|
||||
private Dictionary<uint, SimClient> m_clientThreads;
|
||||
private ulong m_regionHandle;
|
||||
private string m_regionName;
|
||||
private SimConfig m_cfg;
|
||||
private Dictionary<uint, SimClient> m_clientThreads;
|
||||
private ulong m_regionHandle;
|
||||
private string m_regionName;
|
||||
private SimConfig m_cfg;
|
||||
|
||||
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName, SimConfig cfg)
|
||||
{
|
||||
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName, SimConfig cfg)
|
||||
{
|
||||
m_clientThreads = clientThreads;
|
||||
m_regionHandle = regionHandle;
|
||||
m_regionName = regionName;
|
||||
m_cfg = cfg;
|
||||
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
|
||||
Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
|
||||
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
|
||||
|
@ -74,7 +75,10 @@ namespace OpenSim.world
|
|||
Entities[UUID].addForces();
|
||||
}
|
||||
|
||||
this.phyScene.Simulate(timeStep);
|
||||
lock (this.LockPhysicsEngine)
|
||||
{
|
||||
this.phyScene.Simulate(timeStep);
|
||||
}
|
||||
|
||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||
{
|
||||
|
@ -119,17 +123,48 @@ namespace OpenSim.world
|
|||
return(store == null);
|
||||
}
|
||||
|
||||
public void RegenerateTerrain()
|
||||
{
|
||||
HeightmapGenHills hills = new HeightmapGenHills();
|
||||
this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
this.phyScene.SetTerrain(this.LandMap);
|
||||
m_cfg.SaveMap(this.LandMap);
|
||||
public void RegenerateTerrain()
|
||||
{
|
||||
HeightmapGenHills hills = new HeightmapGenHills();
|
||||
this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
lock (this.LockPhysicsEngine)
|
||||
{
|
||||
this.phyScene.SetTerrain(this.LandMap);
|
||||
}
|
||||
m_cfg.SaveMap(this.LandMap);
|
||||
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
{
|
||||
this.SendLayerData(client);
|
||||
}
|
||||
|
||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||
{
|
||||
Entities[UUID].LandRenegerated();
|
||||
}
|
||||
}
|
||||
|
||||
public void RegenerateTerrain(float[] newMap)
|
||||
{
|
||||
|
||||
this.LandMap = newMap;
|
||||
lock (this.LockPhysicsEngine)
|
||||
{
|
||||
this.phyScene.SetTerrain(this.LandMap);
|
||||
}
|
||||
m_cfg.SaveMap(this.LandMap);
|
||||
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
{
|
||||
this.SendLayerData(client);
|
||||
}
|
||||
|
||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||
{
|
||||
Entities[UUID].LandRenegerated();
|
||||
}
|
||||
}
|
||||
|
||||
foreach(SimClient client in m_clientThreads.Values) {
|
||||
this.SendLayerData(client);
|
||||
}
|
||||
}
|
||||
public void LoadPrimsFromStorage()
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
|
||||
|
@ -143,7 +178,7 @@ namespace OpenSim.world
|
|||
_primCount = prim.LocalID + 1;
|
||||
}
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
|
||||
Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
|
||||
Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
|
||||
nPrim.CreateFromStorage(prim);
|
||||
this.Entities.Add(nPrim.uuid, nPrim);
|
||||
}
|
||||
|
@ -182,27 +217,34 @@ namespace OpenSim.world
|
|||
}
|
||||
}
|
||||
|
||||
public void AddViewerAgent(SimClient AgentClient) {
|
||||
public void AddViewerAgent(SimClient AgentClient)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
|
||||
Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle );
|
||||
Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle);
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
|
||||
NewAvatar.SendRegionHandshake(this);
|
||||
PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z);
|
||||
NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
|
||||
lock (this.LockPhysicsEngine)
|
||||
{
|
||||
NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
|
||||
}
|
||||
this.Entities.Add(AgentClient.AgentID, NewAvatar);
|
||||
}
|
||||
|
||||
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
||||
Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this );
|
||||
Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
|
||||
prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
|
||||
PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
|
||||
PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
|
||||
if(OpenSim.world.Avatar.PhysicsEngineFlying)
|
||||
{
|
||||
prim.PhysActor = this.phyScene.AddPrim(pVec, pSize );
|
||||
lock (this.LockPhysicsEngine)
|
||||
{
|
||||
prim.PhysActor = this.phyScene.AddPrim(pVec, pSize);
|
||||
}
|
||||
}
|
||||
//prim.PhysicsEnabled = true;
|
||||
this.Entities.Add(prim.uuid, prim);
|
||||
|
@ -243,9 +285,9 @@ namespace OpenSim.world
|
|||
}
|
||||
foreach( libsecondlife.LLUUID uuid in DeRezEnts )
|
||||
{
|
||||
lock (this.Entities)
|
||||
lock (Entities)
|
||||
{
|
||||
this.Entities.Remove(uuid);
|
||||
Entities.Remove(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace OpenSim
|
|||
}
|
||||
|
||||
OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine );
|
||||
OpenSimRoot.Instance.Application = sim;
|
||||
OpenSimRoot.Instance.Sandbox = sandBoxMode;
|
||||
// OpenSimRoot.Instance.Application = sim;
|
||||
sim.m_sandbox = sandBoxMode;
|
||||
OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying;
|
||||
|
||||
sim.StartUp();
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
</resources>
|
||||
<sources failonempty="true">
|
||||
<include name="BaseHttpServer.cs" />
|
||||
<include name="dummy.cs" />
|
||||
</sources>
|
||||
<references basedir="${project::get-base-directory()}">
|
||||
<lib>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue