From aa120266d79b87b39bf80f3f7aaca8970447bde1 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 8 Mar 2007 18:07:53 +0000 Subject: Primitive's shape and scale are now saved into database and reloaded. New ServerConsole command: regenerate - will regenerate the terrain of the whole sim. --- src/Config.cs | 2 + src/Config/SimConfig/Db4SimConfig.cs | 14 +++ src/GridInterfaces/ILocalStorage.cs | 31 +++---- .../Db4LocalStorage/Db4LocalStorage.cs | 34 +++++-- src/OpenSimClient.cs | 31 +++++++ src/OpenSimConsole.cs | 31 ++++--- src/world/Primitive.cs | 101 +++++++++++++++++++-- src/world/World.cs | 15 ++- 8 files changed, 211 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/Config.cs b/src/Config.cs index c42b80e..c7cd3cd 100644 --- a/src/Config.cs +++ b/src/Config.cs @@ -63,6 +63,8 @@ namespace OpenSim public abstract void InitConfig(); public abstract void LoadFromGrid(); public abstract World LoadWorld(); + public abstract void SaveMap(); + } public interface ISimConfig diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs index 4a06187..fc2c019 100644 --- a/src/Config/SimConfig/Db4SimConfig.cs +++ b/src/Config/SimConfig/Db4SimConfig.cs @@ -128,6 +128,20 @@ namespace Db40SimConfig } return blank; } + + public override void SaveMap() + { + IObjectSet world_result = db.Get(typeof(MapStorage)); + if(world_result.Count>0) { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database"); + MapStorage map=(MapStorage)world_result.Next(); + db.Delete(map); + } + MapStorage map1= new MapStorage(); + map1.Map = OpenSim_Main.local_world.LandMap; + db.Set(map1); + db.Commit(); + } public override void LoadFromGrid() { ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); diff --git a/src/GridInterfaces/ILocalStorage.cs b/src/GridInterfaces/ILocalStorage.cs index 5d6b9b1..6b7ded6 100644 --- a/src/GridInterfaces/ILocalStorage.cs +++ b/src/GridInterfaces/ILocalStorage.cs @@ -35,7 +35,7 @@ namespace GridInterfaces /// public interface ILocalStorage { - void StorePrim(PrimStorage prim); + void StorePrim(PrimData prim); void RemovePrim(LLUUID primID); void LoadPrimitives(ILocalStorageReceiver receiver); void ShutDown(); @@ -43,23 +43,10 @@ namespace GridInterfaces public interface ILocalStorageReceiver { - void PrimFromStorage(PrimStorage prim); + void PrimFromStorage(PrimData prim); } - public class PrimStorage - { - public PrimData Data; - public LLVector3 Position; - public LLQuaternion Rotation; - public uint LocalID; - public LLUUID FullID; - - public PrimStorage() - { - - } - - } + public class PrimData { public LLUUID OwnerID; @@ -78,6 +65,18 @@ namespace GridInterfaces public byte ProfileCurve; public uint ParentID=0; public byte ProfileHollow; + public sbyte PathRadiusOffset; + public byte PathRevolutions; + public sbyte PathTaperX; + public sbyte PathTaperY; + public sbyte PathTwist; + public sbyte PathTwistBegin; + + //following only used during prim storage + public LLVector3 Position; + public LLQuaternion Rotation; + public uint LocalID; + public LLUUID FullID; public PrimData() { diff --git a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs b/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs index 9dc81a1..bb9825c 100644 --- a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs +++ b/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs @@ -55,23 +55,43 @@ namespace Db4LocalStorage } } - public void StorePrim(PrimStorage prim) + public void StorePrim(PrimData prim) { IObjectSet result = db.Query(new UUIDQuery(prim.FullID)); if(result.Count>0) { //prim already in storage //so update it - PrimStorage found = (PrimStorage) result.Next(); - found.Data = prim.Data; + PrimData found = (PrimData) result.Next(); + found.PathBegin = prim.PathBegin; + found.PathCurve= prim.PathCurve; + found.PathEnd = prim.PathEnd; + found.PathRadiusOffset = prim.PathRadiusOffset; + found.PathRevolutions = prim.PathRevolutions; + found.PathScaleX= prim.PathScaleX; + found.PathScaleY = prim.PathScaleY; + found.PathShearX = prim.PathShearX; + found.PathShearY = prim.PathShearY; + found.PathSkew = prim.PathSkew; + found.PathTaperX = prim.PathTaperX; + found.PathTaperY = prim.PathTaperY; + found.PathTwist = prim.PathTwist; + found.PathTwistBegin = prim.PathTwistBegin; + found.PCode = prim.PCode; + found.ProfileBegin = prim.ProfileBegin; + found.ProfileCurve = prim.ProfileCurve; + found.ProfileEnd = prim.ProfileEnd; + found.ProfileHollow = prim.ProfileHollow; found.Position = prim.Position; found.Rotation = prim.Rotation; db.Set(found); + db.Commit(); } else { //not in storage db.Set(prim); + db.Commit(); } } @@ -80,7 +100,7 @@ namespace Db4LocalStorage IObjectSet result = db.Query(new UUIDQuery(primID)); if(result.Count>0) { - PrimStorage found = (PrimStorage) result.Next(); + PrimData found = (PrimData) result.Next(); db.Delete(found); } } @@ -88,9 +108,9 @@ namespace Db4LocalStorage public void LoadPrimitives(ILocalStorageReceiver receiver) { - IObjectSet result = db.Get(typeof(PrimStorage)); + IObjectSet result = db.Get(typeof(PrimData)); ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count); - foreach (PrimStorage prim in result) { + foreach (PrimData prim in result) { receiver.PrimFromStorage(prim); } } @@ -110,7 +130,7 @@ namespace Db4LocalStorage { _findID = find; } - public bool Match(PrimStorage prim) + public bool Match(PrimData prim) { return (prim.FullID == _findID); } diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs index 1f9c70c..eb190e9 100644 --- a/src/OpenSimClient.cs +++ b/src/OpenSimClient.cs @@ -104,6 +104,25 @@ namespace OpenSim case PacketType.ObjectAdd: OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); break; + case PacketType.ObjectLink: + ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString()); + break; + case PacketType.ObjectScale: + ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString()); + break; + case PacketType.ObjectShape: + ObjectShapePacket shape = (ObjectShapePacket)Pack; + for(int i =0; i 1200) //set to how often you want to backup (currently set for about every 2 minutes) + if(storageCount> 300) //set to how often you want to backup { this.Backup(); storageCount =0; @@ -107,13 +107,24 @@ 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); + OpenSim_Main.cfg.SaveMap(); + + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + this.SendLayerData(client); + } + } public void LoadPrimsFromStorage() { ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); this.localStorage.LoadPrimitives(this); } - public void PrimFromStorage(PrimStorage prim) + public void PrimFromStorage(PrimData prim) { if(prim.LocalID >= this._primCount) { -- cgit v1.1