aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs83
1 files changed, 42 insertions, 41 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index bc52a43..81d1a4a 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -102,7 +102,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
102 102
103 terrainRenderer.Initialise(m_scene, m_config); 103 terrainRenderer.Initialise(m_scene, m_config);
104 104
105 mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 105 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
106 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
106 //long t = System.Environment.TickCount; 107 //long t = System.Environment.TickCount;
107 //for (int i = 0; i < 10; ++i) { 108 //for (int i = 0; i < 10; ++i) {
108 terrainRenderer.TerrainToBitmap(mapbmp); 109 terrainRenderer.TerrainToBitmap(mapbmp);
@@ -277,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
277 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) 278 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
278 { 279 {
279 int tc = 0; 280 int tc = 0;
280 double[,] hm = whichScene.Heightmap.GetDoubles(); 281 ITerrainChannel hm = whichScene.Heightmap;
281 tc = Environment.TickCount; 282 tc = Environment.TickCount;
282 m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); 283 m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
283 EntityBase[] objs = whichScene.GetEntities(); 284 EntityBase[] objs = whichScene.GetEntities();
@@ -287,8 +288,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
287 288
288 try 289 try
289 { 290 {
290 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
291
292 lock (objs) 291 lock (objs)
293 { 292 {
294 foreach (EntityBase obj in objs) 293 foreach (EntityBase obj in objs)
@@ -298,7 +297,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
298 { 297 {
299 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 298 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
300 Color mapdotspot = Color.Gray; // Default color when prim color is white 299 Color mapdotspot = Color.Gray; // Default color when prim color is white
301
302 // Loop over prim in group 300 // Loop over prim in group
303 foreach (SceneObjectPart part in mapdot.Parts) 301 foreach (SceneObjectPart part in mapdot.Parts)
304 { 302 {
@@ -363,7 +361,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
363 Vector3 pos = part.GetWorldPosition(); 361 Vector3 pos = part.GetWorldPosition();
364 362
365 // skip prim outside of retion 363 // skip prim outside of retion
366 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) 364 if (!m_scene.PositionIsInCurrentRegion(pos))
367 continue; 365 continue;
368 366
369 // skip prim in non-finite position 367 // skip prim in non-finite position
@@ -388,7 +386,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
388 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); 386 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z);
389 Vector3 scale = new Vector3(); 387 Vector3 scale = new Vector3();
390 Vector3 tScale = new Vector3(); 388 Vector3 tScale = new Vector3();
391 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); 389 Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z);
392 390
393 Quaternion llrot = part.GetWorldRotation(); 391 Quaternion llrot = part.GetWorldRotation();
394 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); 392 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
@@ -406,12 +404,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
406 int mapdrawendY = (int)(pos.Y + scale.Y); 404 int mapdrawendY = (int)(pos.Y + scale.Y);
407 405
408 // If object is beyond the edge of the map, don't draw it to avoid errors 406 // If object is beyond the edge of the map, don't draw it to avoid errors
409 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1) 407 if (mapdrawstartX < 0
410 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0 408 || mapdrawstartX > (hm.Width - 1)
411 || mapdrawendY > ((int)Constants.RegionSize - 1)) 409 || mapdrawendX < 0
410 || mapdrawendX > (hm.Width - 1)
411 || mapdrawstartY < 0
412 || mapdrawstartY > (hm.Height - 1)
413 || mapdrawendY < 0
414 || mapdrawendY > (hm.Height - 1))
412 continue; 415 continue;
413 416
414 #region obb face reconstruction part duex 417 #region obb face reconstruction part duex
415 Vector3[] vertexes = new Vector3[8]; 418 Vector3[] vertexes = new Vector3[8];
416 419
417 // float[] distance = new float[6]; 420 // float[] distance = new float[6];
@@ -515,7 +518,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
515 FaceD[2] = vertexes[7]; 518 FaceD[2] = vertexes[7];
516 FaceC[3] = vertexes[7]; 519 FaceC[3] = vertexes[7];
517 FaceD[5] = vertexes[7]; 520 FaceD[5] = vertexes[7];
518 #endregion 521 #endregion
519 522
520 //int wy = 0; 523 //int wy = 0;
521 524
@@ -530,11 +533,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
530 for (int i = 0; i < FaceA.Length; i++) 533 for (int i = 0; i < FaceA.Length; i++)
531 { 534 {
532 Point[] working = new Point[5]; 535 Point[] working = new Point[5];
533 working[0] = project(FaceA[i], axPos); 536 working[0] = project(hm, FaceA[i], axPos);
534 working[1] = project(FaceB[i], axPos); 537 working[1] = project(hm, FaceB[i], axPos);
535 working[2] = project(FaceD[i], axPos); 538 working[2] = project(hm, FaceD[i], axPos);
536 working[3] = project(FaceC[i], axPos); 539 working[3] = project(hm, FaceC[i], axPos);
537 working[4] = project(FaceA[i], axPos); 540 working[4] = project(hm, FaceA[i], axPos);
538 541
539 face workingface = new face(); 542 face workingface = new face();
540 workingface.pts = working; 543 workingface.pts = working;
@@ -546,27 +549,25 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
546 z_localIDs.Add(part.LocalId); 549 z_localIDs.Add(part.LocalId);
547 z_sortheights.Add(pos.Z); 550 z_sortheights.Add(pos.Z);
548 551
549 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) 552 for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
550 //{ 553 // {
551 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) 554 // for (wy = mapdrawstartY; wy < mapdrawendY; wy++)
552 //{ 555 // {
553 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy); 556 // m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy);
554 //try 557 // try
555 //{ 558 // {
556 // Remember, flip the y! 559 // // Remember, flip the y!
557 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot); 560 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
558 //} 561 // }
559 //catch (ArgumentException) 562 // catch (ArgumentException)
560 //{ 563 // {
561 // breakYN = true; 564 // breakYN = true;
562 //} 565 // }
563 566 // }
564 //if (breakYN) 567 // if (breakYN)
565 // break; 568 // break;
566 //} 569 // }
567 570 // }
568 //if (breakYN)
569 // break;
570 //} 571 //}
571 } // Object is within 256m Z of terrain 572 } // Object is within 256m Z of terrain
572 } // object is at least a meter wide 573 } // object is at least a meter wide
@@ -609,17 +610,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
609 return mapbmp; 610 return mapbmp;
610 } 611 }
611 612
612 private Point project(Vector3 point3d, Vector3 originpos) 613 private Point project(ITerrainChannel hm, Vector3 point3d, Vector3 originpos)
613 { 614 {
614 Point returnpt = new Point(); 615 Point returnpt = new Point();
615 //originpos = point3d; 616 //originpos = point3d;
616 //int d = (int)(256f / 1.5f); 617 //int d = (int)(256f / 1.5f);
617 618
618 //Vector3 topos = new Vector3(0, 0, 0); 619 //Vector3 topos = new Vector3(0, 0, 0);
619 // float z = -point3d.z - topos.z; 620 // float z = -point3d.z - topos.z;
620 621
621 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); 622 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d);
622 returnpt.Y = (int)(((int)Constants.RegionSize - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); 623 returnpt.Y = (int)((hm.Width - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
623 624
624 return returnpt; 625 return returnpt;
625 } 626 }