aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-07-21 22:08:19 +0000
committerAdam Frisby2007-07-21 22:08:19 +0000
commit1f17275a20807d9d3d194f12ffecd112151b392d (patch)
treea23c11dbc742e016a67e6d522c86b29bb1d6e2cd
parent* Issue#211 - 30 second timeout is too low. (Thanks Babblefrog) (diff)
downloadopensim-SC_OLD-1f17275a20807d9d3d194f12ffecd112151b392d.zip
opensim-SC_OLD-1f17275a20807d9d3d194f12ffecd112151b392d.tar.gz
opensim-SC_OLD-1f17275a20807d9d3d194f12ffecd112151b392d.tar.bz2
opensim-SC_OLD-1f17275a20807d9d3d194f12ffecd112151b392d.tar.xz
* Fixed an issue whereby extremely tall terrains would be unable to output a gradient map.
* Renamed several terrain variable names for clarity.
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs70
1 files changed, 35 insertions, 35 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
index 8f3e04f..686b35d 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
@@ -578,7 +578,7 @@ namespace OpenSim.Region.Terrain
578 { 578 {
579 FileInfo file = new FileInfo(filename); 579 FileInfo file = new FileInfo(filename);
580 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); 580 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
581 BinaryWriter bs = new BinaryWriter(s); 581 BinaryWriter binStream = new BinaryWriter(s);
582 582
583 int x, y; 583 int x, y;
584 584
@@ -615,22 +615,22 @@ namespace OpenSim.Region.Terrain
615 byte alpha9 = (byte)(revertmap.get(x, y) / ((double)backupMultiplier / 128.0)); 615 byte alpha9 = (byte)(revertmap.get(x, y) / ((double)backupMultiplier / 128.0));
616 byte alpha10 = backupMultiplier; 616 byte alpha10 = backupMultiplier;
617 617
618 bs.Write(red); 618 binStream.Write(red);
619 bs.Write(green); 619 binStream.Write(green);
620 bs.Write(blue); 620 binStream.Write(blue);
621 bs.Write(alpha1); 621 binStream.Write(alpha1);
622 bs.Write(alpha2); 622 binStream.Write(alpha2);
623 bs.Write(alpha3); 623 binStream.Write(alpha3);
624 bs.Write(alpha4); 624 binStream.Write(alpha4);
625 bs.Write(alpha5); 625 binStream.Write(alpha5);
626 bs.Write(alpha6); 626 binStream.Write(alpha6);
627 bs.Write(alpha7); 627 binStream.Write(alpha7);
628 bs.Write(alpha8); 628 binStream.Write(alpha8);
629 bs.Write(alpha9); 629 binStream.Write(alpha9);
630 bs.Write(alpha10); 630 binStream.Write(alpha10);
631 } 631 }
632 } 632 }
633 bs.Close(); 633 binStream.Close();
634 s.Close(); 634 s.Close();
635 } 635 }
636 636
@@ -643,16 +643,16 @@ namespace OpenSim.Region.Terrain
643 { 643 {
644 FileInfo file = new FileInfo(filename); 644 FileInfo file = new FileInfo(filename);
645 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); 645 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
646 BinaryWriter bs = new BinaryWriter(s); 646 BinaryWriter binStream = new BinaryWriter(s);
647 647
648 // Generate a smegging big lookup table to speed the operation up (it needs it) 648 // Generate a smegging big lookup table to speed the operation up (it needs it)
649 double[] lookupTable = new double[65536]; 649 double[] lookupHeightTable = new double[65536];
650 int i, j, x, y; 650 int i, j, x, y;
651 for (i = 0; i < 256; i++) 651 for (i = 0; i < 256; i++)
652 { 652 {
653 for (j = 0; j < 256; j++) 653 for (j = 0; j < 256; j++)
654 { 654 {
655 lookupTable[i + (j * 256)] = ((double)i * ((double)j / 127.0)); 655 lookupHeightTable[i + (j * 256)] = ((double)i * ((double)j / 127.0));
656 } 656 }
657 } 657 }
658 658
@@ -667,9 +667,9 @@ namespace OpenSim.Region.Terrain
667 667
668 for (i = 0; i < 65536; i++) 668 for (i = 0; i < 65536; i++)
669 { 669 {
670 if (Math.Abs(t - lookupTable[i]) < min) 670 if (Math.Abs(t - lookupHeightTable[i]) < min)
671 { 671 {
672 min = Math.Abs(t - lookupTable[i]); 672 min = Math.Abs(t - lookupHeightTable[i]);
673 index = i; 673 index = i;
674 } 674 }
675 } 675 }
@@ -688,23 +688,23 @@ namespace OpenSim.Region.Terrain
688 byte alpha9 = red; 688 byte alpha9 = red;
689 byte alpha10 = green; 689 byte alpha10 = green;
690 690
691 bs.Write(red); 691 binStream.Write(red);
692 bs.Write(green); 692 binStream.Write(green);
693 bs.Write(blue); 693 binStream.Write(blue);
694 bs.Write(alpha1); 694 binStream.Write(alpha1);
695 bs.Write(alpha2); 695 binStream.Write(alpha2);
696 bs.Write(alpha3); 696 binStream.Write(alpha3);
697 bs.Write(alpha4); 697 binStream.Write(alpha4);
698 bs.Write(alpha5); 698 binStream.Write(alpha5);
699 bs.Write(alpha6); 699 binStream.Write(alpha6);
700 bs.Write(alpha7); 700 binStream.Write(alpha7);
701 bs.Write(alpha8); 701 binStream.Write(alpha8);
702 bs.Write(alpha9); 702 binStream.Write(alpha9);
703 bs.Write(alpha10); 703 binStream.Write(alpha10);
704 } 704 }
705 } 705 }
706 706
707 bs.Close(); 707 binStream.Close();
708 s.Close(); 708 s.Close();
709 } 709 }
710 710
@@ -900,7 +900,7 @@ namespace OpenSim.Region.Terrain
900 for (int y = 0; y < copy.h; y++) 900 for (int y = 0; y < copy.h; y++)
901 { 901 {
902 // 512 is the largest possible height before colours clamp 902 // 512 is the largest possible height before colours clamp
903 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * pallete); 903 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * (pallete - 1));
904 bmp.SetPixel(x, y, colours[colorindex]); 904 bmp.SetPixel(x, y, colours[colorindex]);
905 } 905 }
906 } 906 }