RIP OpenSimRoot. (removed)

Merged most of the bug fixes etc in from LLdemo branch.
Added the textures from that branch.
tourmaline
MW 2007-03-28 13:08:27 +00:00
parent c88eaa7f9a
commit 98d81485e7
29 changed files with 438 additions and 248 deletions

View File

@ -137,52 +137,92 @@ namespace OpenSim.GridInterfaces.Local
private void SetUpAssetDatabase() private void SetUpAssetDatabase()
{ {
Console.WriteLine("setting up Asset database"); try
{
AssetBase Image = new AssetBase(); Console.WriteLine("setting up Asset database");
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();
Image = new AssetBase(); AssetBase Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
Image.Name = "test Texture2"; Image.Name = "Bricks";
this.LoadAsset(Image, true, "map_base.jp2"); this.LoadAsset(Image, true, "bricks.jp2");
store = new AssetStorage(); AssetStorage store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
Image.Name = "Prim Base Texture"; Image.Name = "Plywood";
this.LoadAsset(Image, true, "testpic2.jp2"); this.LoadAsset(Image, true, "plywood.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
Image.Name = "Shape"; Image.Name = "Rocks";
this.LoadAsset(Image, false, "base_shape.dat"); this.LoadAsset(Image, true, "rocks.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); 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);
}
} }

View File

@ -149,6 +149,11 @@ namespace OpenSim.Physics.BasicPhysicsPlugin
{ {
this._heightMap = heightMap; this._heightMap = heightMap;
} }
public override void DeleteTerrain()
{
}
} }
public class BasicActor : PhysicsActor public class BasicActor : PhysicsActor

View File

@ -51,6 +51,8 @@ namespace OpenSim.Physics.Manager
public abstract void SetTerrain(float[] heightMap); public abstract void SetTerrain(float[] heightMap);
public abstract void DeleteTerrain();
public abstract bool IsThreaded public abstract bool IsThreaded
{ {
get; get;
@ -76,6 +78,8 @@ namespace OpenSim.Physics.Manager
public override void Simulate(float timeStep) public override void Simulate(float timeStep)
{ {
m_workIndicator = (m_workIndicator + 1) % 10; m_workIndicator = (m_workIndicator + 1) % 10;
//OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString());
} }
public override void GetResults() public override void GetResults()
@ -88,6 +92,11 @@ namespace OpenSim.Physics.Manager
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
} }
public override void DeleteTerrain()
{
}
public override bool IsThreaded public override bool IsThreaded
{ {
get { return false; } get { return false; }

View File

@ -170,6 +170,11 @@ namespace OpenSim.Physics.OdePlugin
d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0); d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0);
LandGeom=d.CreateHeightfield(space, HeightmapData, 0); LandGeom=d.CreateHeightfield(space, HeightmapData, 0);
} }
public override void DeleteTerrain()
{
}
} }
public class OdeCharacter : PhysicsActor public class OdeCharacter : PhysicsActor

View File

@ -98,7 +98,7 @@ namespace OpenSim.Physics.PhysXPlugin
{ {
private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
private List<PhysXPrim> _prims = new List<PhysXPrim>(); private List<PhysXPrim> _prims = new List<PhysXPrim>();
private float[] _heightMap; private float[] _heightMap = null;
private NxPhysicsSDK mySdk; private NxPhysicsSDK mySdk;
private NxScene scene; private NxScene scene;
@ -138,18 +138,25 @@ namespace OpenSim.Physics.PhysXPlugin
} }
public override void Simulate(float timeStep) public override void Simulate(float timeStep)
{ {
foreach (PhysXCharacter actor in _characters) try
{ {
actor.Move(timeStep); foreach (PhysXCharacter actor in _characters)
} {
scene.Simulate(timeStep); actor.Move(timeStep);
scene.FetchResults(); }
scene.UpdateControllers(); scene.Simulate(timeStep);
scene.FetchResults();
scene.UpdateControllers();
foreach (PhysXCharacter actor in _characters) foreach (PhysXCharacter actor in _characters)
{ {
actor.UpdatePosition(); actor.UpdatePosition();
} }
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
} }
@ -168,10 +175,20 @@ namespace OpenSim.Physics.PhysXPlugin
public override void SetTerrain(float[] heightMap) public override void SetTerrain(float[] heightMap)
{ {
if (this._heightMap != null)
{
Console.WriteLine("PhysX - deleting old terrain");
this.scene.DeleteTerrain();
}
this._heightMap = heightMap; this._heightMap = heightMap;
this.scene.AddTerrain(heightMap); this.scene.AddTerrain(heightMap);
} }
}
public override void DeleteTerrain()
{
this.scene.DeleteTerrain();
}
}
public class PhysXCharacter : PhysicsActor public class PhysXCharacter : PhysicsActor
{ {
@ -211,6 +228,11 @@ namespace OpenSim.Physics.PhysXPlugin
set set
{ {
_position = value; _position = value;
Vec3 ps = new Vec3();
ps.X = value.X;
ps.Y = value.Y;
ps.Z = value.Z;
this._character.Position = ps;
} }
} }

View File

@ -55,7 +55,7 @@ namespace OpenSim.Assets
private IAssetServer _assetServer; private IAssetServer _assetServer;
private Thread _assetCacheThread; private Thread _assetCacheThread;
private LLUUID[] textureList = new LLUUID[2]; private LLUUID[] textureList = new LLUUID[5];
/// <summary> /// <summary>
/// ///
@ -100,6 +100,10 @@ namespace OpenSim.Assets
//hack: so we can give each user a set of textures //hack: so we can give each user a set of textures
textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001"); textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001");
textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002"); 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++) for (int i = 0; i < textureList.Length; i++)
{ {
this._assetServer.RequestAsset(textureList[i], true); this._assetServer.RequestAsset(textureList[i], true);

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.CAPS
{
public interface IXmlRPCHandler
{
string HandleRPC(string requestBody);
}
}

View File

@ -50,6 +50,7 @@ namespace OpenSim.CAPS
private Thread m_workerThread; private Thread m_workerThread;
private HttpListener m_httpListener; private HttpListener m_httpListener;
private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>(); private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>();
private Dictionary<string, IXmlRPCHandler> RPCHandlers = new Dictionary<string, IXmlRPCHandler>();
private IGridServer m_gridServer; private IGridServer m_gridServer;
private int m_port; private int m_port;
@ -96,8 +97,22 @@ namespace OpenSim.CAPS
//must already have a handler for that path so return false //must already have a handler for that path so return false
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) protected virtual string ParseXMLRPC(string requestBody)
{ {
string responseString = "";
try try
{ {
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
@ -115,17 +130,23 @@ namespace OpenSim.CAPS
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
if (m_gridServer.GetName() == "Remote") 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) catch (Exception e)
{ {
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
} }
return ""; return responseString;
} }
protected virtual string ParseREST(string requestBody, string requestURL, string requestMethod) protected virtual string ParseREST(string requestBody, string requestURL, string requestMethod)

View File

@ -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> <PropertyGroup>
<ProjectType>Local</ProjectType> <ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{ADD974E2-994C-4998-864E-4B54D8AD5F00}</ProjectGuid> <ProjectGuid>{ADD974E2-994C-4998-864E-4B54D8AD5F00}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon> <ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName> <AssemblyKeyContainerName>
</AssemblyKeyContainerName> </AssemblyKeyContainerName>
<AssemblyName>OpenSim.RegionServer</AssemblyName> <AssemblyName>OpenSim.RegionServer</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema> <DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder> <AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.RegionServer</RootNamespace> <RootNamespace>OpenSim.RegionServer</RootNamespace>
<StartupObject></StartupObject> <StartupObject>
</StartupObject>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
</PropertyGroup> </PropertyGroup>
@ -28,7 +31,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants> <DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -46,7 +51,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols> <DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
@ -55,26 +61,28 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" > <Reference Include="System">
<HintPath>System.dll</HintPath> <HintPath>System.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Xml" > <Reference Include="System.Data" />
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath> <HintPath>System.Xml.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="libsecondlife.dll" > <Reference Include="libsecondlife.dll">
<HintPath>..\bin\libsecondlife.dll</HintPath> <HintPath>..\bin\libsecondlife.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Axiom.MathLib.dll" > <Reference Include="Axiom.MathLib.dll">
<HintPath>..\bin\Axiom.MathLib.dll</HintPath> <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Db4objects.Db4o.dll" > <Reference Include="Db4objects.Db4o.dll">
<HintPath>..\bin\Db4objects.Db4o.dll</HintPath> <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
@ -84,46 +92,44 @@
<Name>OpenSim.Framework</Name> <Name>OpenSim.Framework</Name>
<Project>{BD7866A4-04BA-47F0-905F-B2359118F5B2}</Project> <Project>{BD7866A4-04BA-47F0-905F-B2359118F5B2}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name> <Name>OpenSim.Framework.Console</Name>
<Project>{4B0A7290-36C2-4C74-B9B4-07775B031CF2}</Project> <Project>{4B0A7290-36C2-4C74-B9B4-07775B031CF2}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
<Name>OpenSim.Physics.Manager</Name> <Name>OpenSim.Physics.Manager</Name>
<Project>{2EAB18A1-8187-4C79-9947-A671F9C007D9}</Project> <Project>{2EAB18A1-8187-4C79-9947-A671F9C007D9}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Servers\OpenSim.Servers.csproj"> <ProjectReference Include="..\Servers\OpenSim.Servers.csproj">
<Name>OpenSim.Servers</Name> <Name>OpenSim.Servers</Name>
<Project>{B9D6A5F0-3BD2-4161-8AF1-90C03295D4EE}</Project> <Project>{B9D6A5F0-3BD2-4161-8AF1-90C03295D4EE}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AgentAssetUpload.cs"> <Compile Include="AgentAssetUpload.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="CAPS\IXmlRPCHandler.cs" />
<Compile Include="ConsoleCmds.cs"> <Compile Include="ConsoleCmds.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Grid.cs"> <Compile Include="Grid.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="OpenSimApplication.cs"> <Compile Include="OpenSimNetworkHandler.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="OpenSimMain.cs"> <Compile Include="OpenSimMain.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="OpenSimRoot.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="QueItem.cs"> <Compile Include="QueItem.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>

View File

@ -14,8 +14,8 @@
<include name="AgentAssetUpload.cs" /> <include name="AgentAssetUpload.cs" />
<include name="ConsoleCmds.cs" /> <include name="ConsoleCmds.cs" />
<include name="Grid.cs" /> <include name="Grid.cs" />
<include name="OpenSimApplication.cs" />
<include name="OpenSimMain.cs" /> <include name="OpenSimMain.cs" />
<include name="OpenSimNetworkHandler.cs" />
<include name="OpenSimRoot.cs" /> <include name="OpenSimRoot.cs" />
<include name="QueItem.cs" /> <include name="QueItem.cs" />
<include name="SimClient.cs" /> <include name="SimClient.cs" />
@ -25,6 +25,7 @@
<include name="Assets/InventoryCache.cs" /> <include name="Assets/InventoryCache.cs" />
<include name="CAPS/AdminWebFront.cs" /> <include name="CAPS/AdminWebFront.cs" />
<include name="CAPS/IRestHandler.cs" /> <include name="CAPS/IRestHandler.cs" />
<include name="CAPS/IXmlRPCHandler.cs" />
<include name="CAPS/SimHttp.cs" /> <include name="CAPS/SimHttp.cs" />
<include name="types/Mesh.cs" /> <include name="types/Mesh.cs" />
<include name="types/Triangle.cs" /> <include name="types/Triangle.cs" />

View File

@ -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);
}
}

View File

@ -48,10 +48,19 @@ using OpenSim.Physics.Manager;
namespace OpenSim 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 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; public Socket Server;
private IPEndPoint ServerIncoming; private IPEndPoint ServerIncoming;
@ -79,68 +88,68 @@ namespace OpenSim
OpenSim.Framework.Console.MainConsole.Instance = m_console; 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 ) if ( m_sandbox )
{ {
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
m_console.WriteLine("Starting in Sandbox mode"); m_console.WriteLine("Starting in Sandbox mode");
} }
else else
{ {
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
m_console.WriteLine("Starting in Grid mode"); 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); AssetCache = new AssetCache(GridServers.AssetServer);
OpenSimRoot.Instance.InventoryCache = new InventoryCache(); InventoryCache = new InventoryCache();
// We check our local database first, then the grid for config options // We check our local database first, then the grid for config options
m_console.WriteLine("Main.cs:Startup() - Loading configuration"); m_console.WriteLine("Main.cs:Startup() - Loading configuration");
OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll); Cfg = this.LoadConfigDll(this.ConfigDll);
OpenSimRoot.Instance.Cfg.InitConfig(this.m_sandbox); Cfg.InitConfig(this.m_sandbox);
m_console.WriteLine("Main.cs:Startup() - Contacting gridserver"); 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"); m_console.WriteLine("Initialising world");
OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg); LocalWorld = new World(ClientThreads, Cfg.RegionHandle, Cfg.RegionName, Cfg);
OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld(); LocalWorld.LandMap = Cfg.LoadWorld();
this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
this.physManager.LoadPlugins(); this.physManager.LoadPlugins();
m_console.WriteLine("Main.cs:Startup() - Starting up messaging system"); 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 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.SetTerrain(LocalWorld.LandMap);
OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey); GridServers.AssetServer.SetServerInfo(Cfg.AssetURL, Cfg.AssetSendKey);
OpenSimRoot.Instance.GridServers.GridServer.SetServerInfo(OpenSimRoot.Instance.Cfg.GridURL, OpenSimRoot.Instance.Cfg.GridSendKey, OpenSimRoot.Instance.Cfg.GridRecvKey); 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. LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage(); LocalWorld.LoadPrimsFromStorage();
if ( m_sandbox) if ( m_sandbox)
{ {
OpenSimRoot.Instance.AssetCache.LoadDefaultTextureSet(); AssetCache.LoadDefaultTextureSet();
} }
m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort); HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld)); HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld));
if ( m_loginserver && m_sandbox) 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(); loginServer.Startup();
} }
@ -194,15 +203,15 @@ namespace OpenSim
// do we already have a circuit for this endpoint // do we already have a circuit for this endpoint
if(this.clientCircuits.ContainsKey(epSender)) 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) else if (packet.Type == PacketType.UseCircuitCode)
{ // new client { // new client
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 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(epSender, newuser);
OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
} }
else else
{ // invalid client { // invalid client
@ -214,9 +223,9 @@ namespace OpenSim
private void MainServerListener() private void MainServerListener()
{ {
m_console.WriteLine("Main.cs:MainServerListener() - New thread started"); 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 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
Server.Bind(ServerIncoming); 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 // find the endpoint for this circuit
EndPoint sendto = null; 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) 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() - Closing all threads");
m_console.WriteLine("Main.cs:Shutdown() - Killing listener thread"); m_console.WriteLine("Main.cs:Shutdown() - Killing listener thread");
m_console.WriteLine("Main.cs:Shutdown() - Killing clients"); m_console.WriteLine("Main.cs:Shutdown() - Killing clients");
// IMPLEMENT THIS // IMPLEMENT THIS
m_console.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); m_console.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
OpenSimRoot.Instance.LocalWorld.Close(); LocalWorld.Close();
OpenSimRoot.Instance.GridServers.Close(); GridServers.Close();
m_console.Close(); m_console.Close();
Environment.Exit(0); Environment.Exit(0);
} }
void Timer1Tick(object sender, System.EventArgs e) void Timer1Tick(object sender, System.EventArgs e)
{ {
OpenSimRoot.Instance.LocalWorld.Update(); LocalWorld.Update();
} }
public void RunCmd(string command, string[] cmdparams) public void RunCmd(string command, string[] cmdparams)
@ -295,7 +304,7 @@ namespace OpenSim
break; break;
case "regenerate": case "regenerate":
OpenSimRoot.Instance.LocalWorld.RegenerateTerrain(); LocalWorld.RegenerateTerrain();
break; break;
case "shutdown": case "shutdown":
@ -309,17 +318,17 @@ namespace OpenSim
switch (ShowWhat) switch (ShowWhat)
{ {
case "uptime": case "uptime":
m_console.WriteLine("OpenSim has been running since " + OpenSimRoot.Instance.startuptime.ToString()); m_console.WriteLine("OpenSim has been running since " + startuptime.ToString());
m_console.WriteLine("That is " + (DateTime.Now - OpenSimRoot.Instance.startuptime).ToString()); m_console.WriteLine("That is " + (DateTime.Now - startuptime).ToString());
break; break;
case "users": case "users":
OpenSim.world.Avatar TempAv; 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")); 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())); 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()));
} }
} }

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -75,7 +75,7 @@ namespace OpenSim
private Dictionary<uint, SimClient> m_clientThreads; private Dictionary<uint, SimClient> m_clientThreads;
private AssetCache m_assetCache; private AssetCache m_assetCache;
private IGridServer m_gridServer; private IGridServer m_gridServer;
private OpenSimApplication m_application; private OpenSimNetworkHandler m_application;
private InventoryCache m_inventoryCache; private InventoryCache m_inventoryCache;
private bool m_sandboxMode; private bool m_sandboxMode;
@ -188,7 +188,7 @@ namespace OpenSim
{ {
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 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; ((OpenSim.world.Primitive)ent).UpdateFlag = true;
} }
} }
@ -576,7 +576,7 @@ namespace OpenSim
this.PacketQueue.Enqueue(item); 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_world = world;
m_clientThreads = clientThreads; m_clientThreads = clientThreads;

View File

@ -309,7 +309,7 @@ namespace OpenSim.UserServer
Hashtable Inventory2 = (Hashtable)InventoryList[1]; Hashtable Inventory2 = (Hashtable)InventoryList[1];
LLUUID BaseFolderID = LLUUID.Random(); LLUUID BaseFolderID = LLUUID.Random();
LLUUID InventoryFolderID = LLUUID.Random(); LLUUID InventoryFolderID = LLUUID.Random();
Inventory2["name"] = "Base"; Inventory2["name"] = "Textures";
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
Inventory2["type_default"] = 0; Inventory2["type_default"] = 0;
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();

View File

@ -44,7 +44,7 @@ namespace OpenSim.world
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
ControllingClient = TheClient; ControllingClient = TheClient;
localid = 8880000 + (m_world._localNumber++); localid = 8880000 + (this.m_world._localNumber++);
position = new LLVector3(100.0f, 100.0f, 30.0f); position = new LLVector3(100.0f, 100.0f, 30.0f);
position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1; position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
visualParams = new byte[218]; visualParams = new byte[218];
@ -82,7 +82,10 @@ namespace OpenSim.world
{ {
NewForce force = this.forcesList[i]; NewForce force = this.forcesList[i];
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); 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.updateflag = true;
this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this 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. // 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(); AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.AgentData.SessionID = this.ControllingClient.SessionID; mov.AgentData.SessionID = this.ControllingClient.SessionID;
mov.AgentData.AgentID = this.ControllingClient.AgentID; mov.AgentData.AgentID = this.ControllingClient.AgentID;
mov.Data.RegionHandle = m_regionHandle; mov.Data.RegionHandle = this.m_regionHandle;
// TODO - dynamicalise this stuff // TODO - dynamicalise this stuff
mov.Data.Timestamp = 1172750370; mov.Data.Timestamp = 1172750370;
mov.Data.Position = new LLVector3(100f, 100f, 23f); mov.Data.Position = new LLVector3(100f, 100f, 23f);
@ -475,7 +478,12 @@ namespace OpenSim.world
ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
ani.AnimationList[0].AnimID = this.current_anim; ani.AnimationList[0].AnimID = this.current_anim;
ani.AnimationList[0].AnimSequenceID = this.anim_seq; 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 //should be moved somewhere else
@ -522,7 +530,11 @@ namespace OpenSim.world
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; 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; uint ID = this.localid;
@ -542,8 +554,11 @@ namespace OpenSim.world
ushort InternVelocityX; ushort InternVelocityX;
ushort InternVelocityY; ushort InternVelocityY;
ushort InternVelocityZ; ushort InternVelocityZ;
Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); 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 = internDirec / 128.0f;
internDirec.x += 1; internDirec.x += 1;
internDirec.y += 1; internDirec.y += 1;
@ -596,6 +611,27 @@ namespace OpenSim.world
Avatar.Animations = new AvatarAnimations(); Avatar.Animations = new AvatarAnimations();
Avatar.Animations.LoadAnims(); 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 public class NewForce

View File

@ -63,5 +63,10 @@ namespace OpenSim.world
{ {
} }
public virtual void LandRenegerated()
{
}
} }
} }

View File

@ -12,6 +12,7 @@ namespace OpenSim.world
{ {
public class Primitive : Entity public class Primitive : Entity
{ {
//private static object physicsLock = new object();
protected float mesh_cutbegin; protected float mesh_cutbegin;
protected float mesh_cutend; protected float mesh_cutend;
protected PrimData primData; protected PrimData primData;
@ -21,7 +22,8 @@ namespace OpenSim.world
private ObjectUpdatePacket OurPacket; private ObjectUpdatePacket OurPacket;
private PhysicsActor _physActor; private PhysicsActor _physActor;
private bool physicsEnabled = false; 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 Dictionary<uint, SimClient> m_clientThreads;
private ulong m_regionHandle; private ulong m_regionHandle;
private World m_world; private World m_world;
@ -97,13 +99,30 @@ namespace OpenSim.world
this.position = pos; this.position = pos;
if (this._physActor != null) // && this.physicsEnabled) 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; this.updateFlag = true;
} }
public override void update() 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) if (this.newPrimFlag)
{ {
foreach (SimClient client in m_clientThreads.Values) foreach (SimClient client in m_clientThreads.Values)
@ -137,15 +156,19 @@ namespace OpenSim.world
{ {
if (this._physActor != null && this.physicsEnabled) if (this._physActor != null && this.physicsEnabled)
{ {
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); if (pos2 != this.positionLastFrame)
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); 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.LocalID = this.localid;
this.primData.Position = this.position; this.primData.Position = this.position;
this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); 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);
} }
} }

View File

@ -14,6 +14,7 @@ namespace OpenSim.world
{ {
public class World : ILocalStorageReceiver public class World : ILocalStorageReceiver
{ {
public object LockPhysicsEngine = new object();
public Dictionary<libsecondlife.LLUUID, Entity> Entities; public Dictionary<libsecondlife.LLUUID, Entity> Entities;
public float[] LandMap; public float[] LandMap;
public ScriptEngine Scripts; public ScriptEngine Scripts;
@ -25,19 +26,19 @@ namespace OpenSim.world
private Random Rand = new Random(); private Random Rand = new Random();
private uint _primCount = 702000; private uint _primCount = 702000;
private int storageCount; private int storageCount;
private Dictionary<uint, SimClient> m_clientThreads; private Dictionary<uint, SimClient> m_clientThreads;
private ulong m_regionHandle; private ulong m_regionHandle;
private string m_regionName; private string m_regionName;
private SimConfig m_cfg; 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_clientThreads = clientThreads;
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_regionName = regionName; m_regionName = regionName;
m_cfg = cfg; 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>(); Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
@ -74,7 +75,10 @@ namespace OpenSim.world
Entities[UUID].addForces(); Entities[UUID].addForces();
} }
this.phyScene.Simulate(timeStep); lock (this.LockPhysicsEngine)
{
this.phyScene.Simulate(timeStep);
}
foreach (libsecondlife.LLUUID UUID in Entities.Keys) foreach (libsecondlife.LLUUID UUID in Entities.Keys)
{ {
@ -119,17 +123,48 @@ namespace OpenSim.world
return(store == null); return(store == null);
} }
public void RegenerateTerrain() public void RegenerateTerrain()
{ {
HeightmapGenHills hills = new HeightmapGenHills(); HeightmapGenHills hills = new HeightmapGenHills();
this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
this.phyScene.SetTerrain(this.LandMap); lock (this.LockPhysicsEngine)
m_cfg.SaveMap(this.LandMap); {
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() public void LoadPrimsFromStorage()
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
@ -143,7 +178,7 @@ namespace OpenSim.world
_primCount = prim.LocalID + 1; _primCount = prim.LocalID + 1;
} }
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); 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); nPrim.CreateFromStorage(prim);
this.Entities.Add(nPrim.uuid, nPrim); 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"); 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() - Adding new avatar to world");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
NewAvatar.SendRegionHandshake(this); NewAvatar.SendRegionHandshake(this);
PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); 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); this.Entities.Add(AgentClient.AgentID, NewAvatar);
} }
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 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); prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f); PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
if(OpenSim.world.Avatar.PhysicsEngineFlying) 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; //prim.PhysicsEnabled = true;
this.Entities.Add(prim.uuid, prim); this.Entities.Add(prim.uuid, prim);
@ -243,9 +285,9 @@ namespace OpenSim.world
} }
foreach( libsecondlife.LLUUID uuid in DeRezEnts ) foreach( libsecondlife.LLUUID uuid in DeRezEnts )
{ {
lock (this.Entities) lock (Entities)
{ {
this.Entities.Remove(uuid); Entities.Remove(uuid);
} }
} }

View File

@ -42,8 +42,8 @@ namespace OpenSim
} }
OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine ); OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine );
OpenSimRoot.Instance.Application = sim; // OpenSimRoot.Instance.Application = sim;
OpenSimRoot.Instance.Sandbox = sandBoxMode; sim.m_sandbox = sandBoxMode;
OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying; OpenSim.world.Avatar.PhysicsEngineFlying = allowFlying;
sim.StartUp(); sim.StartUp();

View File

@ -12,7 +12,6 @@
</resources> </resources>
<sources failonempty="true"> <sources failonempty="true">
<include name="BaseHttpServer.cs" /> <include name="BaseHttpServer.cs" />
<include name="dummy.cs" />
</sources> </sources>
<references basedir="${project::get-base-directory()}"> <references basedir="${project::get-base-directory()}">
<lib> <lib>

Binary file not shown.

Binary file not shown.

BIN
bin/assets/bricks.jp2 Normal file

Binary file not shown.

BIN
bin/assets/granite.jp2 Normal file

Binary file not shown.

BIN
bin/assets/hardwood.jp2 Normal file

Binary file not shown.

BIN
bin/assets/plywood.jp2 Normal file

Binary file not shown.

BIN
bin/assets/rocks.jp2 Normal file

Binary file not shown.