diff options
author | UbitUmarov | 2018-05-05 02:50:27 +0100 |
---|---|---|
committer | UbitUmarov | 2018-05-05 02:50:27 +0100 |
commit | 020f34f75bf9e4d4ce61f3d3979726f7533176a2 (patch) | |
tree | a34442dea118ee23365f404832e43d91328fa10e /OpenSim/Region | |
parent | change warp3d terrain rendering, so it does cover all area (diff) | |
download | opensim-SC-020f34f75bf9e4d4ce61f3d3979726f7533176a2.zip opensim-SC-020f34f75bf9e4d4ce61f3d3979726f7533176a2.tar.gz opensim-SC-020f34f75bf9e4d4ce61f3d3979726f7533176a2.tar.bz2 opensim-SC-020f34f75bf9e4d4ce61f3d3979726f7533176a2.tar.xz |
a few more changes to warp3d and export-map
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 42 |
2 files changed, 32 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 850ffc3..ce017aa 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -166,8 +166,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
166 | } | 166 | } |
167 | 167 | ||
168 | Vector3 camPos = new Vector3( | 168 | Vector3 camPos = new Vector3( |
169 | (m_scene.RegionInfo.RegionSizeX - 1) * 0.5f, | 169 | (m_scene.RegionInfo.RegionSizeX) * 0.5f, |
170 | (m_scene.RegionInfo.RegionSizeY - 1) * 0.5f, | 170 | (m_scene.RegionInfo.RegionSizeY) * 0.5f, |
171 | 221.7025033688163f); | 171 | 221.7025033688163f); |
172 | // Viewport viewing down onto the region | 172 | // Viewport viewing down onto the region |
173 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, | 173 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, |
@@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
241 | 241 | ||
242 | m_colors.Clear(); | 242 | m_colors.Clear(); |
243 | GC.Collect(); | 243 | GC.Collect(); |
244 | m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); | 244 | // m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); |
245 | 245 | ||
246 | return bitmap; | 246 | return bitmap; |
247 | } | 247 | } |
@@ -271,10 +271,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
271 | { | 271 | { |
272 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; | 272 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; |
273 | 273 | ||
274 | renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); | 274 | renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f + 1.0f); |
275 | renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX * 0.5f - 0.5f, | 275 | renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX * 0.5f, |
276 | waterHeight, | 276 | waterHeight, |
277 | m_scene.RegionInfo.RegionSizeY * 0.5f - 0.5f); | 277 | m_scene.RegionInfo.RegionSizeY * 0.5f); |
278 | 278 | ||
279 | warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); | 279 | warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); |
280 | waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif | 280 | waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif |
@@ -299,8 +299,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
299 | int npointsx = (int)(regionsx / diff) + 1; | 299 | int npointsx = (int)(regionsx / diff) + 1; |
300 | int npointsy = (int)(regionsy / diff) + 1; | 300 | int npointsy = (int)(regionsy / diff) + 1; |
301 | 301 | ||
302 | float invsx = 1.0f / regionsx; | 302 | float invsx = 1.0f / (npointsx * diff); |
303 | float invsy = 1.0f / regionsy; | 303 | float invsy = 1.0f / (npointsy * diff); |
304 | 304 | ||
305 | // Create all the vertices for the terrain | 305 | // Create all the vertices for the terrain |
306 | warp_Object obj = new warp_Object(); | 306 | warp_Object obj = new warp_Object(); |
@@ -321,10 +321,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
321 | for (x = 0; x < regionsx; x += diff) | 321 | for (x = 0; x < regionsx; x += diff) |
322 | { | 322 | { |
323 | pos = ConvertVector(x , y , (float)terrain[(int)x, lastY]); | 323 | pos = ConvertVector(x , y , (float)terrain[(int)x, lastY]); |
324 | obj.addVertex(new warp_Vertex(pos, x * invsx, 1.0f - y * invsy)); | 324 | obj.addVertex(new warp_Vertex(pos, x * invsx, 0f)); |
325 | } | 325 | } |
326 | pos = ConvertVector(x , y , (float)terrain[(int)(x - diff), lastY]); | 326 | pos = ConvertVector(x , y , (float)terrain[(int)(x - diff), lastY]); |
327 | obj.addVertex(new warp_Vertex(pos, 1.0f, 1.0f)); | 327 | obj.addVertex(new warp_Vertex(pos, 1.0f, 0f)); |
328 | 328 | ||
329 | // Now that we have all the vertices, make another pass and | 329 | // Now that we have all the vertices, make another pass and |
330 | // create the list of triangle indices. | 330 | // create the list of triangle indices. |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 12ac436..476d90a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1399,12 +1399,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1399 | m_log.InfoFormat( | 1399 | m_log.InfoFormat( |
1400 | "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); | 1400 | "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); |
1401 | 1401 | ||
1402 | const int TEXTURESIZE = 2048; | ||
1403 | Bitmap mapTexture = new Bitmap(TEXTURESIZE, TEXTURESIZE); | ||
1404 | Graphics g = Graphics.FromImage(mapTexture); | ||
1405 | SolidBrush sea = new SolidBrush(Color.DarkBlue); | ||
1406 | g.FillRectangle(sea, 0, 0, TEXTURESIZE, TEXTURESIZE); | ||
1407 | |||
1408 | // assumed this is 1m less than next grid line | 1402 | // assumed this is 1m less than next grid line |
1409 | int regionsView = (int)m_scene.MaxRegionViewDistance; | 1403 | int regionsView = (int)m_scene.MaxRegionViewDistance; |
1410 | 1404 | ||
@@ -1420,6 +1414,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1420 | int endX = regionX + regionSizeX + regionsView; | 1414 | int endX = regionX + regionSizeX + regionsView; |
1421 | int endY = regionY + regionSizeY + regionsView; | 1415 | int endY = regionY + regionSizeY + regionsView; |
1422 | 1416 | ||
1417 | int spanX = endX - startX + 2; | ||
1418 | int spanY = endY - startY + 2; | ||
1419 | |||
1420 | Bitmap mapTexture = new Bitmap(spanX, spanY); | ||
1421 | Graphics g = Graphics.FromImage(mapTexture); | ||
1422 | g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; | ||
1423 | g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; | ||
1424 | g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; | ||
1425 | g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; | ||
1426 | |||
1427 | SolidBrush sea = new SolidBrush(Color.DarkBlue); | ||
1428 | g.FillRectangle(sea, 0, 0, spanX - 1, spanY - 1); | ||
1429 | sea.Dispose(); | ||
1430 | |||
1423 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 1431 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
1424 | startX, startY, endX, endY); | 1432 | startX, startY, endX, endY); |
1425 | 1433 | ||
@@ -1434,11 +1442,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1434 | startX--; | 1442 | startX--; |
1435 | startY--; | 1443 | startY--; |
1436 | 1444 | ||
1437 | int spanX = endX - startX + 1; | ||
1438 | float scaleX = (float)TEXTURESIZE / (float)spanX; | ||
1439 | int spanY = endY - startY + 1; | ||
1440 | float scaleY = (float)TEXTURESIZE / (float)spanY; | ||
1441 | |||
1442 | foreach(GridRegion r in regions) | 1445 | foreach(GridRegion r in regions) |
1443 | { | 1446 | { |
1444 | if(r.TerrainImage == UUID.Zero) | 1447 | if(r.TerrainImage == UUID.Zero) |
@@ -1450,15 +1453,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1450 | 1453 | ||
1451 | if(OpenJPEG.DecodeToImage(texAsset.Data, out managedImage, out image)) | 1454 | if(OpenJPEG.DecodeToImage(texAsset.Data, out managedImage, out image)) |
1452 | { | 1455 | { |
1453 | int x = (int)((r.RegionLocX - startX) * scaleX); | 1456 | int x = r.RegionLocX - startX; |
1454 | int y = (int)((r.RegionLocY - startY ) * scaleY); | 1457 | int y = r.RegionLocY - startY; |
1455 | int sx = (int)(r.RegionSizeX * scaleX); | 1458 | int sx = r.RegionSizeX; |
1456 | int sy = (int)(r.RegionSizeY * scaleY); | 1459 | int sy = r.RegionSizeY; |
1457 | g.DrawImage(image, x, TEXTURESIZE - y - sy, sx, sy); // y origin is top | 1460 | g.DrawImage(image, x, spanY - y - sy, sx, sy); // y origin is top |
1458 | if(r.RegionHandle == m_scene.RegionInfo.RegionHandle) | 1461 | if(r.RegionHandle == m_scene.RegionInfo.RegionHandle) |
1459 | { | 1462 | { |
1460 | SizeF stringSize = g.MeasureString(r.RegionName, drawFont); | 1463 | SizeF stringSize = g.MeasureString(r.RegionName, drawFont); |
1461 | g.DrawString(r.RegionName, drawFont, drawBrush, x + 30, TEXTURESIZE - y - 30 - stringSize.Height); | 1464 | g.DrawString(r.RegionName, drawFont, drawBrush, x + 30, spanY - y - 30 - stringSize.Height); |
1462 | } | 1465 | } |
1463 | } | 1466 | } |
1464 | } | 1467 | } |
@@ -1473,11 +1476,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1473 | drawFont.Dispose(); | 1476 | drawFont.Dispose(); |
1474 | } | 1477 | } |
1475 | 1478 | ||
1476 | mapTexture.Save(exportPath, ImageFormat.Jpeg); | ||
1477 | |||
1478 | g.Dispose(); | 1479 | g.Dispose(); |
1480 | |||
1481 | mapTexture.Save(exportPath, ImageFormat.Jpeg); | ||
1479 | mapTexture.Dispose(); | 1482 | mapTexture.Dispose(); |
1480 | sea.Dispose(); | ||
1481 | 1483 | ||
1482 | m_log.InfoFormat( | 1484 | m_log.InfoFormat( |
1483 | "[WORLD MAP]: Successfully exported world map for {0} to {1}", | 1485 | "[WORLD MAP]: Successfully exported world map for {0} to {1}", |