aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs44
1 files changed, 29 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index cb32680..568416c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1027,7 +1027,7 @@ namespace OpenSim.Region.Environment.Scenes
1027 m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); 1027 m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
1028 Bitmap mapbmp = new Bitmap(256, 256); 1028 Bitmap mapbmp = new Bitmap(256, 256);
1029 double[,] hm = Heightmap.GetDoubles(); 1029 double[,] hm = Heightmap.GetDoubles();
1030 1030 bool ShadowDebugContinue = true;
1031 //Color prim = Color.FromArgb(120, 120, 120); 1031 //Color prim = Color.FromArgb(120, 120, 120);
1032 //LLVector3 RayEnd = new LLVector3(0, 0, 0); 1032 //LLVector3 RayEnd = new LLVector3(0, 0, 0);
1033 //LLVector3 RayStart = new LLVector3(0, 0, 0); 1033 //LLVector3 RayStart = new LLVector3(0, 0, 0);
@@ -1059,7 +1059,7 @@ namespace OpenSim.Region.Environment.Scenes
1059 float hfvaluecompare = hfvalue; 1059 float hfvaluecompare = hfvalue;
1060 float hfdiff = hfvalue; 1060 float hfdiff = hfvalue;
1061 int hfdiffi = 0; 1061 int hfdiffi = 0;
1062 int hfdiffi2 = 0; 1062
1063 1063
1064 for (int x = 0; x < 256; x++) 1064 for (int x = 0; x < 256; x++)
1065 { 1065 {
@@ -1133,24 +1133,38 @@ namespace OpenSim.Region.Environment.Scenes
1133 // We have to desaturate and blacken the land at the same time 1133 // We have to desaturate and blacken the land at the same time
1134 // we use floats, colors use bytes, so shrink are space down to 1134 // we use floats, colors use bytes, so shrink are space down to
1135 // 0-255 1135 // 0-255
1136 hfdiffi = Math.Abs((int)((hfdiff * 4) + (hfdiff * 0.5))) + 1; 1136
1137 if (hfdiff % 1 != 0) 1137
1138 try
1138 { 1139 {
1139 hfdiffi = hfdiffi + Math.Abs((int)(((hfdiff % 1) * 0.5f) * 10f) + 1); 1140 hfdiffi = Math.Abs((int)((hfdiff * 4) + (hfdiff * 0.5))) + 1;
1141 if (hfdiff % 1 != 0)
1142 {
1143 hfdiffi = hfdiffi + Math.Abs((int)(((hfdiff % 1) * 0.5f) * 10f) - 1);
1144 }
1140 } 1145 }
1141 //hfdiffi2 = (int)(hfdiff * 0.5f) + 1; 1146 catch (System.OverflowException)
1142 if ((256 - y) - 1 > 0)
1143 { 1147 {
1144 Color Shade = mapbmp.GetPixel(x - 1, (256 - y) - 1); 1148 m_log.Debug("[MAPTILE]: Shadow failed at value: " + hfdiff.ToString());
1145 1149 ShadowDebugContinue = false;
1146 int r = Shade.R; 1150 }
1147 1151
1148 int g = Shade.G; 1152 if (ShadowDebugContinue)
1149 int b = Shade.B; 1153 {
1150 Shade = Color.FromArgb((r - hfdiffi > 0) ? r - hfdiffi : 0, (g - hfdiffi > 0) ? g - hfdiffi : 0, (b - hfdiffi > 0) ? b - hfdiffi : 0); 1154 if ((256 - y) - 1 > 0)
1151 //Console.WriteLine("d:" + hfdiff.ToString() + ", i:" + hfdiffi + ", pos: " + x + "," + y + " - R:" + Shade.R.ToString() + ", G:" + Shade.G.ToString() + ", B:" + Shade.G.ToString()); 1155 {
1152 mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade); 1156 Color Shade = mapbmp.GetPixel(x - 1, (256 - y) - 1);
1157
1158 int r = Shade.R;
1159
1160 int g = Shade.G;
1161 int b = Shade.B;
1162 Shade = Color.FromArgb((r - hfdiffi > 0) ? r - hfdiffi : 0, (g - hfdiffi > 0) ? g - hfdiffi : 0, (b - hfdiffi > 0) ? b - hfdiffi : 0);
1163 //Console.WriteLine("d:" + hfdiff.ToString() + ", i:" + hfdiffi + ", pos: " + x + "," + y + " - R:" + Shade.R.ToString() + ", G:" + Shade.G.ToString() + ", B:" + Shade.G.ToString());
1164 mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade);
1165 }
1153 } 1166 }
1167
1154 1168
1155 } 1169 }
1156 1170