diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs index 9534ad3..226b330 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs | |||
@@ -79,6 +79,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
79 | /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting | 79 | /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting |
80 | /// Note we create a 256x256 dimension texture even if the actual terrain is larger. | 80 | /// Note we create a 256x256 dimension texture even if the actual terrain is larger. |
81 | /// </remarks> | 81 | /// </remarks> |
82 | |||
82 | public static Bitmap Splat(ITerrainChannel terrain, | 83 | public static Bitmap Splat(ITerrainChannel terrain, |
83 | UUID[] textureIDs, float[] startHeights, float[] heightRanges, | 84 | UUID[] textureIDs, float[] startHeights, float[] heightRanges, |
84 | Vector3d regionPosition, IAssetService assetService, bool textureTerrain) | 85 | Vector3d regionPosition, IAssetService assetService, bool textureTerrain) |
@@ -129,8 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
129 | asset = assetService.Get(textureIDs[i].ToString()); | 130 | asset = assetService.Get(textureIDs[i].ToString()); |
130 | if (asset != null) | 131 | if (asset != null) |
131 | { | 132 | { |
132 | // m_log.DebugFormat( | 133 | // m_log.DebugFormat( |
133 | // "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID); | 134 | // "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID); |
134 | 135 | ||
135 | try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } | 136 | try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } |
136 | catch (Exception ex) | 137 | catch (Exception ex) |
@@ -140,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
140 | } | 141 | } |
141 | 142 | ||
142 | if (detailTexture[i] != null) | 143 | if (detailTexture[i] != null) |
143 | { | 144 | { |
144 | // Make sure this texture is the correct size, otherwise resize | 145 | // Make sure this texture is the correct size, otherwise resize |
145 | if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) | 146 | if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) |
146 | { | 147 | { |
@@ -225,7 +226,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
225 | float pctX = (float)x / 255f; | 226 | float pctX = (float)x / 255f; |
226 | float pctY = (float)y / 255f; | 227 | float pctY = (float)y / 255f; |
227 | 228 | ||
228 | // Use bilinear interpolation between the four corners of start height and | 229 | // Use bilinear interpolation between the four corners of start height and |
229 | // height range to select the current values at this position | 230 | // height range to select the current values at this position |
230 | float startHeight = ImageUtils.Bilinear( | 231 | float startHeight = ImageUtils.Bilinear( |
231 | startHeights[0], | 232 | startHeights[0], |
@@ -256,7 +257,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
256 | float highFreq = Perlin.turbulence2(vec.X, vec.Y, 2f) * 2.25f; | 257 | float highFreq = Perlin.turbulence2(vec.X, vec.Y, 2f) * 2.25f; |
257 | float noise = (lowFreq + highFreq) * 2f; | 258 | float noise = (lowFreq + highFreq) * 2f; |
258 | 259 | ||
259 | // Combine the current height, generated noise, start height, and height range parameters, then scale all of it | 260 | // Combine the current height, generated noise, start height, and height range parameters, then scale all of it |
260 | float layer = ((height + noise - startHeight) / heightRange) * 4f; | 261 | float layer = ((height + noise - startHeight) / heightRange) * 4f; |
261 | if (Single.IsNaN(layer)) | 262 | if (Single.IsNaN(layer)) |
262 | layer = 0f; | 263 | layer = 0f; |
@@ -352,7 +353,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
352 | b.Dispose(); | 353 | b.Dispose(); |
353 | return result; | 354 | return result; |
354 | } | 355 | } |
355 | |||
356 | public static Bitmap SplatSimple(float[] heightmap) | 356 | public static Bitmap SplatSimple(float[] heightmap) |
357 | { | 357 | { |
358 | const float BASE_HSV_H = 93f / 360f; | 358 | const float BASE_HSV_H = 93f / 360f; |