mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 08:06:27 +08:00
* Updated MapImageModule to support primitives showing on the world map image. As MapImageModule is of unknown use, this may or may not be reflected on the world map. See the ShadeBuildings function in MapImageModule for reference.
This commit is contained in:
@@ -58,6 +58,47 @@ namespace OpenSim.Region.Environment.Modules.Terrain
|
||||
return imageData;
|
||||
}
|
||||
|
||||
private void ShadeBuildings(ref Bitmap map)
|
||||
{
|
||||
lock (map)
|
||||
{
|
||||
lock (m_scene.Entities)
|
||||
{
|
||||
foreach (EntityBase entity in m_scene.Entities.Values)
|
||||
{
|
||||
if (entity is SceneObjectGroup)
|
||||
{
|
||||
SceneObjectGroup sog = (SceneObjectGroup)entity;
|
||||
|
||||
foreach (SceneObjectPart primitive in sog.Children.Values)
|
||||
{
|
||||
int x, y, w, h, dx, dy;
|
||||
x = (int)(primitive.AbsolutePosition.X - (primitive.Scale.X / 2));
|
||||
y = (int)(primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2));
|
||||
w = (int)primitive.Scale.X;
|
||||
h = (int)primitive.Scale.Y;
|
||||
|
||||
for (dx = x; dx < x + w; dx++)
|
||||
{
|
||||
for (dy = y; dy < y + h; dy++)
|
||||
{
|
||||
if (x < 0 || y < 0)
|
||||
continue;
|
||||
if (x >= map.Width || y >= map.Height)
|
||||
continue;
|
||||
|
||||
map.SetPixel(dx, dy, Color.DarkGray);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap TerrainToBitmap(string gradientmap)
|
||||
{
|
||||
Bitmap gradientmapLd = new Bitmap(gradientmap);
|
||||
@@ -84,8 +125,9 @@ namespace OpenSim.Region.Environment.Modules.Terrain
|
||||
bmp.SetPixel(x, copy.Height - y - 1, colours[colorindex]);
|
||||
}
|
||||
}
|
||||
ShadeBuildings(ref bmp);
|
||||
return bmp;
|
||||
}
|
||||
return bmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user