* Reduced effect of terraforming brushes by 1000%.

* Added new exportImage() function to BasicTerrain which will output a gradient-mapped image of the terrain which can be uploaded to the grid for things like world map images. (shiinnny), will update later with an improved version using the bilinear quad method employed in client terrain rendering.
* Rebuild project & build files for basicterrain with System.Drawing dependency. Prebuild updated.
zircon^2
Adam Frisby 2007-05-24 05:44:53 +00:00
parent 9fcffee76b
commit 497af009bd
6 changed files with 247 additions and 134 deletions

View File

@ -21,12 +21,12 @@ namespace OpenSim.world
{ {
case 1: case 1:
// raise terrain // raise terrain
Terrain.raise(North, West, 10.0, 0.1); Terrain.raise(North, West, 10.0, 0.001);
RegenerateTerrain(true, (int)North, (int)West); RegenerateTerrain(true, (int)North, (int)West);
break; break;
case 2: case 2:
//lower terrain //lower terrain
Terrain.lower(North, West, 10.0, 0.1); Terrain.lower(North, West, 10.0, 0.001);
RegenerateTerrain(true, (int)North, (int)West); RegenerateTerrain(true, (int)North, (int)West);
break; break;
} }

View File

@ -66,6 +66,10 @@
<HintPath>System.dll</HintPath> <HintPath>System.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Drawing" >
<HintPath>System.Drawing.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Data" > <Reference Include="System.Data" >
<HintPath>System.Data.dll</HintPath> <HintPath>System.Data.dll</HintPath>
<Private>False</Private> <Private>False</Private>

View File

@ -21,6 +21,7 @@
</lib> </lib>
<include name="../bin/libTerrain-BSD.dll" /> <include name="../bin/libTerrain-BSD.dll" />
<include name="System.dll" /> <include name="System.dll" />
<include name="System.Drawing.dll" />
<include name="System.Data.dll" /> <include name="System.Data.dll" />
<include name="System.Xml.dll" /> <include name="System.Xml.dll" />
</references> </references>

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Drawing;
using libTerrain; using libTerrain;
namespace OpenSim.Terrain namespace OpenSim.Terrain
@ -403,5 +404,45 @@ namespace OpenSim.Terrain
heightmap.set(x,y,(double)value); heightmap.set(x,y,(double)value);
} }
} }
/// <summary>
/// Exports the current heightmap to a PNG file
/// </summary>
/// <param name="filename">The destination filename for the image</param>
/// <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 void exportImage(string filename, string gradientmap)
{
try
{
Bitmap gradientmapLd = new Bitmap(gradientmap);
int pallete = gradientmapLd.Width;
Bitmap bmp = new Bitmap(heightmap.w, heightmap.h);
Color[] colours = new Color[pallete];
for (int i = 0; i < pallete; i++)
{
colours[i] = gradientmapLd.GetPixel(1, 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(x, y) / 512.0), 0.0) * pallete);
bmp.SetPixel(x, y, colours[colorindex]);
}
}
bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png);
}
catch (Exception e)
{
Console.WriteLine("Failed generating terrain map: " + e.ToString());
}
}
} }
} }

View File

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C# Express 2005 # Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Terrain.BasicTerrain", "OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj", "{2270B8FE-0000-0000-0000-000000000000}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Terrain.BasicTerrain", "OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj", "{2270B8FE-0000-0000-0000-000000000000}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Storage.LocalStorageBerkeleyDB", "OpenSim.Storage\LocalStorageBerkeleyDB\OpenSim.Storage.LocalStorageBerkeleyDB.csproj", "{EE9E5D96-0000-0000-0000-000000000000}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Storage.LocalStorageBerkeleyDB", "OpenSim.Storage\LocalStorageBerkeleyDB\OpenSim.Storage.LocalStorageBerkeleyDB.csproj", "{EE9E5D96-0000-0000-0000-000000000000}"
@ -65,6 +65,72 @@ Global
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
({EE9E5D96-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000})
({EE9E5D96-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000})
({63A05FE9-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).5 = ({2270B8FE-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).8 = ({8BE16150-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).9 = ({8BB20F0A-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).10 = ({632E1BFD-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).11 = ({E88EF749-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).12 = ({8E81D43C-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).5 = ({2270B8FE-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).8 = ({E88EF749-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).9 = ({8BE16150-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).10 = ({8BB20F0A-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).11 = ({8E81D43C-0000-0000-0000-000000000000})
({8ACA2445-0000-0000-0000-000000000000}).4 = ({8E81D43C-0000-0000-0000-000000000000})
({8BE16150-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({8BE16150-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({97A82740-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
({0F3C3AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000})
({E88EF749-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
({66591469-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({66591469-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({66591469-0000-0000-0000-000000000000}).5 = ({62CDF671-0000-0000-0000-000000000000})
({66591469-0000-0000-0000-000000000000}).6 = ({8BB20F0A-0000-0000-0000-000000000000})
({66591469-0000-0000-0000-000000000000}).9 = ({8E81D43C-0000-0000-0000-000000000000})
({4F874463-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
({8BB20F0A-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
({8BB20F0A-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
({8BB20F0A-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
({B0027747-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
({B0027747-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
({988F0AC4-0000-0000-0000-000000000000}).3 = ({8BE16150-0000-0000-0000-000000000000})
({0A563AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000})
({7924FD35-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
({7924FD35-0000-0000-0000-000000000000}).2 = ({8BB20F0A-0000-0000-0000-000000000000})
({7924FD35-0000-0000-0000-000000000000}).4 = ({8E81D43C-0000-0000-0000-000000000000})
({B55C0B5D-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({B55C0B5D-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({B55C0B5D-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).5 = ({8BB20F0A-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).6 = ({62CDF671-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).7 = ({7924FD35-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).10 = ({8E81D43C-0000-0000-0000-000000000000})
({E1B79ECF-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
({E1B79ECF-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
({6B20B603-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
({6B20B603-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
({39BD9497-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000})
({7E494328-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
({7E494328-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
({1E3F341A-0000-0000-0000-000000000000}).4 = ({62CDF671-0000-0000-0000-000000000000})
({546099CD-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
({546099CD-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
({0021261B-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({0021261B-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({0021261B-0000-0000-0000-000000000000}).5 = ({546099CD-0000-0000-0000-000000000000})
({0021261B-0000-0000-0000-000000000000}).6 = ({8BB20F0A-0000-0000-0000-000000000000})
({0021261B-0000-0000-0000-000000000000}).9 = ({8E81D43C-0000-0000-0000-000000000000})
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU

View File

@ -711,6 +711,7 @@
<ReferencePath>../bin/</ReferencePath> <ReferencePath>../bin/</ReferencePath>
<Reference name="libTerrain-BSD.dll"/> <Reference name="libTerrain-BSD.dll"/>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Data"/> <Reference name="System.Data"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>