From fcc7f86427f14f9a43a918f30cdf97b438c49a77 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 13 Jul 2007 16:12:38 +0000 Subject: Changed simpleApp to use basic physics. Done some work of fixing primitive/SceneObject copying. Set DefaultHome region to 1000,1000. --- .../Framework/General/Types/NetworkServersInfo.cs | 4 ++-- .../Framework/General/Types/PrimitiveBaseShape.cs | 5 +++++ OpenSim/Region/Application/OpenSimMain.cs | 1 - OpenSim/Region/Environment/Scenes/Primitive.cs | 16 ++++++++++++---- OpenSim/Region/Environment/Scenes/SceneObject.cs | 22 +++++++++++----------- OpenSim/Region/Examples/SimpleApp/Program.cs | 5 ++++- 6 files changed, 34 insertions(+), 19 deletions(-) diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs index 89ebf94..21ff4b9 100644 --- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs +++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs @@ -44,8 +44,8 @@ namespace OpenSim.Framework.Types public string UserRecvKey = ""; public bool isSandbox; - public uint DefaultHomeLocX = 0; - public uint DefaultHomeLocY = 0; + public uint DefaultHomeLocX = 1000; + public uint DefaultHomeLocY = 1000; public int HttpListenerPort = 9000; public int RemotingListenerPort = 8895; diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs index 886c00d..1844caa 100644 --- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs @@ -70,6 +70,11 @@ namespace OpenSim.Framework.Types } + public PrimitiveBaseShape Copy() + { + return (PrimitiveBaseShape) this.MemberwiseClone(); + } + public static PrimitiveBaseShape DefaultBox() { PrimitiveBaseShape primShape = new PrimitiveBaseShape(); diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 67b4d8c..bc9537b 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -233,7 +233,6 @@ namespace OpenSim LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); } - LocalWorld.StartTimer(); } } diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 4bb43d2..53314e3 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes this.m_isRootPrim = isRoot; this.m_RootParent = rootObject; - this.CreateFromPacket(ownerID, localID, pos, shape); + this.CreateFromShape(ownerID, localID, pos, shape); this.Rotation = Axiom.Math.Quaternion.Identity; } @@ -164,14 +164,22 @@ namespace OpenSim.Region.Environment.Scenes dupe.m_Parent = parent; dupe.m_RootParent = rootParent; // TODO: Copy this properly. - dupe.m_Shape = this.m_Shape; - + dupe.m_Shape = this.m_Shape.Copy(); + dupe.children = new List(); uint newLocalID = this.m_world.PrimIDAllocate(); + dupe.uuid = LLUUID.Random(); dupe.LocalId = newLocalID; dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); dupe.Pos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); + rootParent.AddChildToList(dupe); + + foreach (Primitive prim in this.children) + { + Primitive primClone = prim.Copy(this, rootParent); + dupe.children.Add(primClone); + } return dupe; } @@ -210,7 +218,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void CreateFromPacket(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) + public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) { this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; this.OwnerID = ownerID; diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 5eed115..c586e9b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Scenes private bool physicsEnabled = false; private PhysicsScene m_PhysScene; private PhysicsActor m_PhysActor; - + public LLUUID rootUUID { get @@ -73,7 +73,7 @@ namespace OpenSim.Region.Environment.Scenes m_regionHandle = regionHandle; m_world = world; this.Pos = pos; - this.CreateRootFromPacket(ownerID, localID, shape, pos ); + this.CreateRootFromShape(ownerID, localID, shape, pos); } /// @@ -91,11 +91,11 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void CreateRootFromPacket(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) + public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) { - this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); - this.children.Add(rootPrimitive); - this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); + this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); + this.children.Add(rootPrimitive); + this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); } /// @@ -207,7 +207,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - this.rootPrimitive.Pos = pos ; + this.rootPrimitive.Pos = pos; this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); } @@ -232,16 +232,16 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID; proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0"); proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName +"\0") ; - proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name +"\0"); - proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description +"\0"); + proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0"); + proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0"); + proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0"); proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask; proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask; proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask; proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask; - client.OutPacket(proper); + client.OutPacket(proper); } } } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 7770538..ce3c056 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -41,6 +41,9 @@ namespace SimpleApp assetServer.SetReceiver(this); AssetCache assetCache = new AssetCache(assetServer); + + PhysicsManager physManager = new PhysicsManager(); + physManager.LoadPlugins(); UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager ); PacketServer packetServer = new PacketServer(udpServer); @@ -55,7 +58,7 @@ namespace SimpleApp RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "127.0.0.1" ); MyWorld world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); - world.PhysScene = PhysicsScene.Null; + world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; udpServer.LocalWorld = world; httpServer.Start(); -- cgit v1.1