black white
parent
413dd571ee
commit
e7e0d0013f
|
@ -8,6 +8,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -137,6 +138,8 @@ namespace OpenSim.Modules.PathFinding
|
||||||
|
|
||||||
private void createPathFindingScene(UUID script, String imageName, Vector3 start, Vector3 target)
|
private void createPathFindingScene(UUID script, String imageName, Vector3 start, Vector3 target)
|
||||||
{
|
{
|
||||||
|
List<PixelInfo> _pixels = new List<PixelInfo>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Bitmap _map = new Bitmap((int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY);
|
Bitmap _map = new Bitmap((int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY);
|
||||||
|
@ -148,19 +151,23 @@ namespace OpenSim.Modules.PathFinding
|
||||||
int _imageX = ((int)m_scene.RegionInfo.RegionSizeX - 1) - X;
|
int _imageX = ((int)m_scene.RegionInfo.RegionSizeX - 1) - X;
|
||||||
int _imageY = ((int)m_scene.RegionInfo.RegionSizeY - 1) - Y;
|
int _imageY = ((int)m_scene.RegionInfo.RegionSizeY - 1) - Y;
|
||||||
|
|
||||||
|
_pixels.Add(new PixelInfo(new Vector2(_imageX, _imageY)));
|
||||||
|
|
||||||
float baseheight = (float)m_scene.Heightmap[X, Y];
|
float baseheight = (float)m_scene.Heightmap[X, Y];
|
||||||
|
|
||||||
if (baseheight <= m_scene.RegionInfo.RegionSettings.WaterHeight)
|
if (baseheight <= m_scene.RegionInfo.RegionSettings.WaterHeight)
|
||||||
_map.SetPixel(_imageX, _imageY, Color.Blue);
|
_map.SetPixel(_imageX, _imageY, Color.Black);
|
||||||
|
|
||||||
if (baseheight > m_scene.RegionInfo.RegionSettings.WaterHeight)
|
if (baseheight > m_scene.RegionInfo.RegionSettings.WaterHeight)
|
||||||
_map.SetPixel(_imageX, _imageY, Color.Green);
|
_map.SetPixel(_imageX, _imageY, Color.White);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_map.SetPixel((int)start.X, (int)start.Y, Color.Aqua);
|
|
||||||
|
|
||||||
PathFindingSceneGenerator.DrawObjectVolume(m_scene, ref _map);
|
PathFindingSceneGenerator.DrawObjectVolume(m_scene, ref _map);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_map.Save(imageName + ".png", ImageFormat.Png);
|
_map.Save(imageName + ".png", ImageFormat.Png);
|
||||||
|
|
||||||
m_scriptModule.DispatchReply(script, 0, "done", imageName);
|
m_scriptModule.DispatchReply(script, 0, "done", imageName);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace OpenSim.Modules.PathFinding
|
||||||
if (mapdot.IsPhantom == true)
|
if (mapdot.IsPhantom == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Color mapdotspot = Color.Red; // Default color when prim color is white
|
Color mapdotspot = Color.Black; // Default color when prim color is white
|
||||||
// Loop over prim in group
|
// Loop over prim in group
|
||||||
foreach (SceneObjectPart part in mapdot.Parts)
|
foreach (SceneObjectPart part in mapdot.Parts)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ namespace OpenSim.Modules.PathFinding
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (part.Description.Contains("allowedpath"))
|
if (part.Description.Contains("allowedpath"))
|
||||||
mapdotspot = Color.Green;
|
mapdotspot = Color.White;
|
||||||
|
|
||||||
// Draw if the object is at least 1 meter wide in any direction
|
// Draw if the object is at least 1 meter wide in any direction
|
||||||
if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
|
if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
|
||||||
|
|
Loading…
Reference in New Issue