aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorTeravus Ovares2008-08-16 06:09:45 +0000
committerTeravus Ovares2008-08-16 06:09:45 +0000
commit80186a68dfd71d941e439ce788af077031c1fdcc (patch)
tree9d03ecd4b1b895025509fa6766861e0a57d68706 /OpenSim/Region/Environment/Scenes
parentReshuffle to eliminate prim owner lookups unless gridgods are enabled (diff)
downloadopensim-SC-80186a68dfd71d941e439ce788af077031c1fdcc.zip
opensim-SC-80186a68dfd71d941e439ce788af077031c1fdcc.tar.gz
opensim-SC-80186a68dfd71d941e439ce788af077031c1fdcc.tar.bz2
opensim-SC-80186a68dfd71d941e439ce788af077031c1fdcc.tar.xz
* Adds Slightly better terrain shading to maptile generation.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs86
1 files changed, 86 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 22251e9..ae7e3aa 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1053,6 +1053,14 @@ namespace OpenSim.Region.Environment.Scenes
1053 } 1053 }
1054 1054
1055 float mid = (high + low) * 0.5f; 1055 float mid = (high + low) * 0.5f;
1056
1057 // temporary initializer
1058 float hfvalue = (float)m_regInfo.RegionSettings.WaterHeight;
1059 float hfvaluecompare = hfvalue;
1060 float hfdiff = hfvalue;
1061 int hfdiffi = 0;
1062 int hfdiffi2 = 0;
1063
1056 for (int x = 0; x < 256; x++) 1064 for (int x = 0; x < 256; x++)
1057 { 1065 {
1058 //int tc = System.Environment.TickCount; 1066 //int tc = System.Environment.TickCount;
@@ -1096,6 +1104,84 @@ namespace OpenSim.Region.Environment.Scenes
1096 1104
1097 // Y flip the cordinates 1105 // Y flip the cordinates
1098 mapbmp.SetPixel(x, (256 - y) - 1, green); 1106 mapbmp.SetPixel(x, (256 - y) - 1, green);
1107
1108 //X
1109 // .
1110 //
1111
1112 if ((x - 1 > 0) && (y - 1 > 0))
1113 {
1114 hfvalue = (float)hm[x, y];
1115 hfvaluecompare = (float)hm[x - 1, y - 1];
1116 hfdiff = hfvaluecompare - hfvalue;
1117
1118 if (Single.IsInfinity(hfvalue) || Single.IsNaN(hfvalue))
1119 hfvalue = 0;
1120
1121 if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare))
1122 hfvaluecompare = 0;
1123
1124 if (hfdiff > 0.3f)
1125 {
1126
1127 }
1128 else if (hfdiff < -0.3f)
1129 {
1130 hfdiffi = Math.Abs((int)((hfdiff * 4) + (hfdiff * 0.5))) + Math.Abs((int)(((hfdiff % 1) * 0.5f) * 10f));
1131 //hfdiffi2 = (int)(hfdiff * 0.5f) + 1;
1132 if ((256 - y) - 1 > 0)
1133 {
1134 Color Shade = mapbmp.GetPixel(x - 1, (256 - y) - 1);
1135
1136 int r = Shade.R;
1137
1138 int g = Shade.G;
1139 int b = Shade.B;
1140 Shade = Color.FromArgb((r - hfdiffi > 0) ? r - hfdiffi : 0, (g - hfdiffi > 0) ? g - hfdiffi : 0, (b - hfdiffi > 0) ? b - hfdiffi : 0);
1141 //Console.WriteLine("d:" + hfdiff.ToString() + ", i:" + hfdiffi + ", pos: " + x + "," + y + " - R:" + Shade.R.ToString() + ", G:" + Shade.G.ToString() + ", B:" + Shade.G.ToString());
1142 mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade);
1143 }
1144
1145 }
1146
1147 }
1148
1149 /*
1150 //
1151 // .
1152 // X
1153 if ((x + 1 < 255) && (y + 1 < 255))
1154 {
1155 hfvalue = (float)hm[x, y];
1156 hfvaluecompare = (float)hm[x + 1, y + 1];
1157 hfdiff = hfvaluecompare - hfvalue;
1158
1159 if (hfdiff > 0.3f)
1160 {
1161
1162 }
1163 else if (hfdiff < -0.3f)
1164 {
1165 hfdiffi = Math.Abs((int)hfdiff) + 1;
1166 if ((256 - y) + 1 < 256)
1167 {
1168 Color Shade = mapbmp.GetPixel(x + 1, (256 - y) + 1);
1169
1170 int r = Shade.R;
1171 int g = Shade.G;
1172 int b = Shade.B;
1173 Shade = Color.FromArgb((r - hfdiffi > 0) ? r - hfdiffi : 0, (g - hfdiffi > 0) ? g - hfdiffi : 0, (b - hfdiffi > 0) ? g - hfdiffi : 0);
1174 mapbmp.SetPixel(x + 1, (256 - y) + 1, Shade);
1175 }
1176
1177 }
1178
1179
1180 }
1181 */
1182 //if ((x
1183
1184
1099 } 1185 }
1100 catch (System.ArgumentException) 1186 catch (System.ArgumentException)
1101 { 1187 {