Some points:
*the default mapsize is customizeable via config.xml (open with notepad)
*loading an existing map with a different size should change the mapsize
*You can load existing maps. Copy the existing bmp into the MapDesigner directory with the name "heightmap.bmp", then ctrl-l to load map.
*The slopemap is generated with the Spring algorithm, taken from ReadMap.h
*There are some parameters in config.xml to control the slopemap generation. You can open config.xml using notepad.
- exportmaxslope controls how the slopes are mapped to the bmp. 0 slope is mapped to 0. exportmaxslope is mapped to 255. Everything else falls within the two. Higher slopes are mapped to 255.
- you can control minimum and maximum height from the config file. This should affect slope generation.
Edit: just for info, here's the slopemap algorithm, in Mapping/SlopeMap.cs. The original C++ is in ReadMap.cpp.
Code: Select all
// ported from Spring's ReadMap.cpp by Hugh Perkins
public double[,]GetSlopeMap()
{
HeightMap heightmap = HeightMap.GetInstance();
float[,] mesh = heightmap.Map;
int mapwidth = heightmap.Width;
int mapheight = heightmap.Height;
slopemapwidth = mapwidth / 2;
slopemapheight = mapheight / 2;
//logfile.WriteLine( "Getting heightmap, this could take a while... " );
double[,]SlopeMap = new double[ slopemapwidth, slopemapheight ];
for(int y = 2; y < mapheight - 2; y+= 2)
{
for(int x = 2; x < mapwidth - 2; x+= 2)
{
Vector3 e1 = new Vector3(-squaresize * 4, mesh[x - 1, y - 1] - mesh[x + 3, y - 1], 0);
Vector3 e2 = new Vector3(0, mesh[x - 1, y - 1] - mesh[x - 1, y + 3], -squaresize * 4);
Vector3 n = Vector3.CrossProduct( e2, e1 );
n.Normalize();
e1 = new Vector3(squaresize * 4, mesh[x + 3, y + 3] - mesh[x - 1, y + 3], 0);
e2 = new Vector3(0, mesh[x + 3, y + 3] - mesh[x + 3, y - 1], squaresize * 4);
Vector3 n2 = Vector3.CrossProduct( e2, e1 );
n2.Normalize();
SlopeMap[ x / 2, y / 2 ]= 1 - ( n.y + n2.y ) * 0.5;
}
}
//logfile.WriteLine("... slopes calculated" );
return SlopeMap;
}