aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
diff options
context:
space:
mode:
authorRobert Adams2015-03-29 16:55:18 -0700
committerRobert Adams2015-03-29 16:55:18 -0700
commit6081ae355456f8b7c361a9d4676376429518b0bf (patch)
treeaaedd1c1e3fbcfc9c14c89958b66bebb350c7ecd /OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
parentvarregion: update LandManagementModule and LandObject for variable sized regi... (diff)
downloadopensim-SC_OLD-6081ae355456f8b7c361a9d4676376429518b0bf.zip
opensim-SC_OLD-6081ae355456f8b7c361a9d4676376429518b0bf.tar.gz
opensim-SC_OLD-6081ae355456f8b7c361a9d4676376429518b0bf.tar.bz2
opensim-SC_OLD-6081ae355456f8b7c361a9d4676376429518b0bf.tar.xz
varregion: update MapImageModule and ShadedMapTimeRenderer for variable sized regions.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs36
1 files changed, 21 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index bc52a43..c7ffeaf 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();
@@ -363,7 +364,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
363 Vector3 pos = part.GetWorldPosition(); 364 Vector3 pos = part.GetWorldPosition();
364 365
365 // skip prim outside of retion 366 // skip prim outside of retion
366 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) 367 if (!m_scene.PositionIsInCurrentRegion(pos))
367 continue; 368 continue;
368 369
369 // skip prim in non-finite position 370 // skip prim in non-finite position
@@ -388,7 +389,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
388 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); 389 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z);
389 Vector3 scale = new Vector3(); 390 Vector3 scale = new Vector3();
390 Vector3 tScale = new Vector3(); 391 Vector3 tScale = new Vector3();
391 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); 392 Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z);
392 393
393 Quaternion llrot = part.GetWorldRotation(); 394 Quaternion llrot = part.GetWorldRotation();
394 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); 395 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
@@ -406,9 +407,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
406 int mapdrawendY = (int)(pos.Y + scale.Y); 407 int mapdrawendY = (int)(pos.Y + scale.Y);
407 408
408 // If object is beyond the edge of the map, don't draw it to avoid errors 409 // 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) 410 if (mapdrawstartX < 0
410 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0 411 || mapdrawstartX > (hm.Width - 1)
411 || mapdrawendY > ((int)Constants.RegionSize - 1)) 412 || mapdrawendX < 0
413 || mapdrawendX > (hm.Width - 1)
414 || mapdrawstartY < 0
415 || mapdrawstartY > (hm.Height - 1)
416 || mapdrawendY < 0
417 || mapdrawendY > (hm.Height - 1))
412 continue; 418 continue;
413 419
414 #region obb face reconstruction part duex 420 #region obb face reconstruction part duex
@@ -530,11 +536,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
530 for (int i = 0; i < FaceA.Length; i++) 536 for (int i = 0; i < FaceA.Length; i++)
531 { 537 {
532 Point[] working = new Point[5]; 538 Point[] working = new Point[5];
533 working[0] = project(FaceA[i], axPos); 539 working[0] = project(hm, FaceA[i], axPos);
534 working[1] = project(FaceB[i], axPos); 540 working[1] = project(hm, FaceB[i], axPos);
535 working[2] = project(FaceD[i], axPos); 541 working[2] = project(hm, FaceD[i], axPos);
536 working[3] = project(FaceC[i], axPos); 542 working[3] = project(hm, FaceC[i], axPos);
537 working[4] = project(FaceA[i], axPos); 543 working[4] = project(hm, FaceA[i], axPos);
538 544
539 face workingface = new face(); 545 face workingface = new face();
540 workingface.pts = working; 546 workingface.pts = working;
@@ -609,17 +615,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
609 return mapbmp; 615 return mapbmp;
610 } 616 }
611 617
612 private Point project(Vector3 point3d, Vector3 originpos) 618 private Point project(ITerrainChannel hm, Vector3 point3d, Vector3 originpos)
613 { 619 {
614 Point returnpt = new Point(); 620 Point returnpt = new Point();
615 //originpos = point3d; 621 //originpos = point3d;
616 //int d = (int)(256f / 1.5f); 622 //int d = (int)(256f / 1.5f);
617 623
618 //Vector3 topos = new Vector3(0, 0, 0); 624 //Vector3 topos = new Vector3(0, 0, 0);
619 // float z = -point3d.z - topos.z; 625 // float z = -point3d.z - topos.z;
620 626
621 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); 627 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))); 628 returnpt.Y = (int)((hm.Width - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
623 629
624 return returnpt; 630 return returnpt;
625 } 631 }