Each Region will now generate a texture image of their terrain and this will be used by the map. Note: Currently each region generates a new image every time they start; even if the terrain is read from the database. And also they don't update it when the terrain changes.
parent
45d407c7b5
commit
ef494fdf9c
|
@ -91,6 +91,7 @@ namespace OpenSim.Framework.Types
|
|||
public double terrainMultiplier = 60.0;
|
||||
public float waterHeight = (float)20.0;
|
||||
|
||||
public LLUUID terrainImageID = LLUUID.Zero; // the assetID that is the current Map image for this region
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
# Visual C# Express 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Communications", "Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj", "{683344D5-0000-0000-0000-000000000000}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\OpenSim\OpenSim.csproj", "{438A9556-0000-0000-0000-000000000000}"
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace OpenSim.LocalCommunications
|
|||
map.X = (ushort)regInfo.RegionLocX;
|
||||
map.Y = (ushort)regInfo.RegionLocY;
|
||||
map.WaterHeight =(byte) regInfo.estateSettings.waterHeight;
|
||||
map.MapImageId = new LLUUID("00000000-0000-0000-9999-000000000007");
|
||||
map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007");
|
||||
map.Agents = 1;
|
||||
map.RegionFlags = 72458694;
|
||||
map.Access = 13;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ReferencePath>C:\Documents and Settings\Stefan\My Documents\source\opensim\branches\Sugilite\bin\</ReferencePath>
|
||||
<ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\Sugilite\bin\</ReferencePath>
|
||||
<LastOpenVersion>8.0.50727</LastOpenVersion>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<ProjectTrust>0</ProjectTrust>
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Region.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
this.CheckBorderCrossing();
|
||||
this.CheckForBorderCrossing();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace OpenSim.Region.Scenes
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protected void CheckBorderCrossing()
|
||||
protected void CheckForBorderCrossing()
|
||||
{
|
||||
LLVector3 pos2 = this.Pos;
|
||||
LLVector3 vel = this.Velocity;
|
||||
|
|
|
@ -228,24 +228,6 @@ namespace OpenSim.Region.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pack"></param>
|
||||
public void HandleAgentUpdate(Packet pack)
|
||||
{
|
||||
this.HandleUpdate((AgentUpdatePacket)pack);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pack"></param>
|
||||
public void HandleUpdate(AgentUpdatePacket pack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -424,6 +424,17 @@ namespace OpenSim.Region.Scenes
|
|||
{
|
||||
this.Terrain.setHeights1D(map);
|
||||
}
|
||||
|
||||
//create a texture asset of the terrain
|
||||
byte[] data =this.Terrain.exportJpegImage("defaultstripe.png");
|
||||
this.m_regInfo.estateSettings.terrainImageID= LLUUID.Random();
|
||||
AssetBase asset = new AssetBase();
|
||||
asset.FullID = this.m_regInfo.estateSettings.terrainImageID;
|
||||
asset.Data = data;
|
||||
asset.Name = "terrainImage";
|
||||
asset.Type = 0;
|
||||
this.assetCache.AddAsset(asset);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -365,22 +365,22 @@ namespace OpenSim
|
|||
|
||||
public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
|
||||
{
|
||||
TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
|
||||
tpLocal2.Info.AgentID = this.AgentID;
|
||||
tpLocal2.Info.TeleportFlags = flags;
|
||||
tpLocal2.Info.LocationID = 2;
|
||||
tpLocal2.Info.LookAt = lookAt;
|
||||
tpLocal2.Info.Position = position;
|
||||
OutPacket(tpLocal2);
|
||||
TeleportLocalPacket tpLocal = new TeleportLocalPacket();
|
||||
tpLocal.Info.AgentID = this.AgentID;
|
||||
tpLocal.Info.TeleportFlags = flags;
|
||||
tpLocal.Info.LocationID = 2;
|
||||
tpLocal.Info.LookAt = lookAt;
|
||||
tpLocal.Info.Position = position;
|
||||
OutPacket(tpLocal);
|
||||
}
|
||||
|
||||
public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags)
|
||||
{
|
||||
TeleportFinishPacket Teleport = new TeleportFinishPacket();
|
||||
Teleport.Info.AgentID = this.AgentID;
|
||||
Teleport.Info.RegionHandle = regionHandle;
|
||||
Teleport.Info.SimAccess = simAccess;
|
||||
Teleport.Info.SeedCapability = new byte[0];
|
||||
TeleportFinishPacket teleport = new TeleportFinishPacket();
|
||||
teleport.Info.AgentID = this.AgentID;
|
||||
teleport.Info.RegionHandle = regionHandle;
|
||||
teleport.Info.SimAccess = simAccess;
|
||||
teleport.Info.SeedCapability = new byte[0];
|
||||
|
||||
System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress);
|
||||
byte[] byteIP = oIP.GetAddressBytes();
|
||||
|
@ -389,11 +389,11 @@ namespace OpenSim
|
|||
ip += (uint)byteIP[1] << 8;
|
||||
ip += (uint)byteIP[0];
|
||||
|
||||
Teleport.Info.SimIP = ip;
|
||||
Teleport.Info.SimPort = ipPort;
|
||||
Teleport.Info.LocationID = 4;
|
||||
Teleport.Info.TeleportFlags = 1 << 4;
|
||||
OutPacket(Teleport);
|
||||
teleport.Info.SimIP = ip;
|
||||
teleport.Info.SimPort = ipPort;
|
||||
teleport.Info.LocationID = 4;
|
||||
teleport.Info.TeleportFlags = 1 << 4;
|
||||
OutPacket(teleport);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -190,9 +190,7 @@ namespace OpenSim
|
|||
mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]);
|
||||
}
|
||||
this.OutPacket(mbReply);
|
||||
* */
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -399,7 +399,6 @@ namespace OpenSim
|
|||
{
|
||||
OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
|
||||
}
|
||||
//this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
|
||||
break;
|
||||
case PacketType.TeleportLandmarkRequest:
|
||||
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
|
||||
|
@ -463,32 +462,8 @@ namespace OpenSim
|
|||
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
|
||||
tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
|
||||
tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
|
||||
|
||||
OutPacket(tpCancel);
|
||||
}
|
||||
|
||||
/* if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
|
||||
{
|
||||
// m_gridServer.getRegion(tpLocReq.Info.RegionHandle);
|
||||
Console.WriteLine("Inter-sim teleport not yet implemented");
|
||||
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
|
||||
tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
|
||||
tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
|
||||
|
||||
OutPacket(tpCancel);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Local teleport");
|
||||
TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
|
||||
tpLocal2.Info.AgentID = tpLocReq.AgentData.AgentID;
|
||||
tpLocal2.Info.TeleportFlags = tpStart.Info.TeleportFlags;
|
||||
tpLocal2.Info.LocationID = 2;
|
||||
tpLocal2.Info.LookAt = tpLocReq.Info.LookAt;
|
||||
tpLocal2.Info.Position = tpLocReq.Info.Position;
|
||||
OutPacket(tpLocal2);
|
||||
|
||||
}*/
|
||||
break;
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ namespace OpenSim
|
|||
protected IWorld m_world;
|
||||
private Dictionary<uint, ClientView> m_clientThreads;
|
||||
private AssetCache m_assetCache;
|
||||
//private IGridServer m_gridServer;
|
||||
private InventoryCache m_inventoryCache;
|
||||
private int cachedtextureserial = 0;
|
||||
private RegionInfo m_regionData;
|
||||
|
@ -95,7 +94,6 @@ namespace OpenSim
|
|||
cirpack = initialcirpack;
|
||||
userEP = remoteEP;
|
||||
|
||||
//this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
|
||||
this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
|
||||
|
||||
PacketQueue = new BlockingQueue<QueItem>();
|
||||
|
|
|
@ -62,6 +62,10 @@
|
|||
<HintPath>..\..\bin\libTerrain-BSD.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="openjpegnet.dll" >
|
||||
<HintPath>..\..\bin\openjpegnet.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" >
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||
</lib>
|
||||
<include name="../../bin/libTerrain-BSD.dll" />
|
||||
<include name="../../bin/openjpegnet.dll" />
|
||||
<include name="System.dll" />
|
||||
<include name="System.Data.dll" />
|
||||
<include name="System.Drawing.dll" />
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Drawing;
|
||||
using libTerrain;
|
||||
using OpenJPEGNet;
|
||||
|
||||
namespace OpenSim.Terrain
|
||||
{
|
||||
|
@ -507,5 +508,48 @@ namespace OpenSim.Terrain
|
|||
Console.WriteLine("Failed generating terrain map: " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exports the current heightmap in Jpeg2000 format to a byte[]
|
||||
/// </summary>
|
||||
/// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
|
||||
public byte[] exportJpegImage(string gradientmap)
|
||||
{
|
||||
byte[] imageData = null;
|
||||
try
|
||||
{
|
||||
Bitmap gradientmapLd = new Bitmap(gradientmap);
|
||||
|
||||
int pallete = gradientmapLd.Height;
|
||||
|
||||
Bitmap bmp = new Bitmap(heightmap.w, heightmap.h);
|
||||
Color[] colours = new Color[pallete];
|
||||
|
||||
for (int i = 0; i < pallete; i++)
|
||||
{
|
||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||
}
|
||||
|
||||
Channel copy = heightmap.copy();
|
||||
for (int x = 0; x < copy.w; x++)
|
||||
{
|
||||
for (int y = 0; y < copy.h; y++)
|
||||
{
|
||||
// 512 is the largest possible height before colours clamp
|
||||
int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.w -x, copy.h - y) / 512.0), 0.0) * pallete);
|
||||
bmp.SetPixel(x, y, colours[colorindex]);
|
||||
}
|
||||
}
|
||||
|
||||
//bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png);
|
||||
imageData = OpenJPEGNet.OpenJPEG.EncodeFromImage(bmp, "map");
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Failed generating terrain map: " + e.ToString());
|
||||
}
|
||||
return imageData;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 887 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -429,6 +429,7 @@
|
|||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="libTerrain-BSD.dll"/>
|
||||
<Reference name="openjpegnet.dll" />
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
|
|
Loading…
Reference in New Issue