add to thread

master
Christopher Latza 2020-06-10 18:03:33 +02:00
parent 7737270894
commit a1ca6409dd
1 changed files with 17 additions and 4 deletions

View File

@ -7,11 +7,13 @@ using OpenSim.Region.Framework.Scenes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading;
using System.Timers; using System.Timers;
[assembly: Addin("BasicPathFindingModule", "0.1")] [assembly: Addin("BasicPathFindingModule", "0.1")]
@ -131,15 +133,19 @@ namespace OpenSim.Modules.PathFinding
return false; return false;
} }
[ScriptInvocation] private void createTestImage()
public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID)
{ {
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);
for (int X = 0; X <= m_scene.RegionInfo.RegionSizeX; X++) for (int X = 0; X <= m_scene.RegionInfo.RegionSizeX; X++)
{ {
m_log.Info("X: " + X);
for (int Y = 0; Y <= m_scene.RegionInfo.RegionSizeY; Y++) for (int Y = 0; Y <= m_scene.RegionInfo.RegionSizeY; Y++)
{ {
m_log.Info("Y: " + Y);
_map.SetPixel(X, Y, Color.Green);
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)
@ -150,7 +156,14 @@ namespace OpenSim.Modules.PathFinding
} }
} }
_map.Save("debug.png"); _map.Save("debug.png", ImageFormat.Png);
}
[ScriptInvocation]
public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID)
{
(new Thread(delegate () { createTestImage(); })).Start();
return ""; return "";
} }