From b9f7e6c69f47ecdd5b24013e892d850764a67f49 Mon Sep 17 00:00:00 2001 From: gareth Date: Wed, 28 Feb 2007 17:01:25 +0000 Subject: Got LayerData working, need asset management to get the avatar to display --- src/OpenSimClient.cs | 5 ++++- src/world/Avatar.cs | 4 ++-- src/world/TerrainDecoder.cs | 2 +- src/world/World.cs | 26 ++++++++++++++++++-------- 4 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs index d3f90b7..b430c3e 100644 --- a/src/OpenSimClient.cs +++ b/src/OpenSimClient.cs @@ -83,6 +83,9 @@ namespace OpenSim case PacketType.CompleteAgentMovement: ClientAvatar.CompleteMovement(OpenSim_Main.local_world); break; + case PacketType.RegionHandshakeReply: + OpenSim_Main.local_world.SendLayerData(this); + break; } } @@ -285,7 +288,7 @@ namespace OpenSim AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); AckTimer.Start(); - Thread ClientThread = new Thread(new ThreadStart(AuthUser)); + ClientThread = new Thread(new ThreadStart(AuthUser)); ClientThread.IsBackground = true; ClientThread.Start(); } diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index 863ce29..dfb739e 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs @@ -25,7 +25,7 @@ namespace OpenSim.world mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle; // TODO - dynamicalise this stuff mov.Data.Timestamp = 1169838966; - mov.Data.Position = new LLVector3(100f, 100f, 22f); + mov.Data.Position = new LLVector3(100f, 100f, 35f); mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); Console.WriteLine("Sending AgentMovementComplete packet"); @@ -49,7 +49,7 @@ namespace OpenSim.world handshake.RegionInfo.TerrainStartHeight10 = 20; handshake.RegionInfo.TerrainStartHeight11 = 20; handshake.RegionInfo.SimAccess = 13; - handshake.RegionInfo.WaterHeight = 5; + handshake.RegionInfo.WaterHeight = 10; handshake.RegionInfo.RegionFlags = 72458694; handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0"); handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); diff --git a/src/world/TerrainDecoder.cs b/src/world/TerrainDecoder.cs index 0f1b733..0c72c92 100644 --- a/src/world/TerrainDecoder.cs +++ b/src/world/TerrainDecoder.cs @@ -410,7 +410,7 @@ namespace OpenSim return output; } - public Packet CreateLayerPacket(float[] heightmap, int minX, int maxX, int minY, int maxY) + public Packet CreateLayerPacket(float[] heightmap, int minX, int minY, int maxX, int maxY) { //int minX = 0, maxX = 2, minY = 0, maxY = 1; //these should be passed to this function LayerDataPacket layer = new LayerDataPacket(); diff --git a/src/world/World.cs b/src/world/World.cs index cf337a8..d7e3370 100644 --- a/src/world/World.cs +++ b/src/world/World.cs @@ -1,5 +1,6 @@ using System; using libsecondlife; +using libsecondlife.Packets; using System.Collections.Generic; using System.Text; @@ -8,8 +9,10 @@ namespace OpenSim.world public class World { public Dictionary Entities; - public SurfacePatch[] LandMap; + public float[] LandMap; public ScriptEngine Scripts; + public TerrainDecode terrainengine = new TerrainDecode(); + public World() { @@ -18,13 +21,13 @@ namespace OpenSim.world // We need a 16x16 array of 16m2 surface patches for a 256m2 sim Console.WriteLine("World.cs - creating LandMap"); - LandMap = new SurfacePatch[16*16]; - int xinc; - int yinc; - for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) { - LandMap[xinc+(yinc*16)]=new SurfacePatch(); - } - + terrainengine = new TerrainDecode(); + LandMap = new float[65536]; + for(int i =0; i < 65536; i++) { + LandMap[i] = 30.4989f; + } + + Console.WriteLine("World.cs - Creating script engine instance"); // Initialise this only after the world has loaded Scripts = new ScriptEngine(this); @@ -38,6 +41,13 @@ namespace OpenSim.world } } + public void SendLayerData(OpenSimClient RemoteClient) { + for(int i=1; i<16; i++) { + Packet layerpack=this.terrainengine.CreateLayerPacket(LandMap, i,1,1,16); + RemoteClient.OutPacket(layerpack); + } + } + public void AddViewerAgent(OpenSimClient AgentClient) { Console.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); Avatar NewAvatar = new Avatar(AgentClient); -- cgit v1.1