diff options
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs index eaca695..57ba729 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs | |||
@@ -42,14 +42,14 @@ namespace libTerrain | |||
42 | /// <param name="ry">The Y coordinate of the terrain mask</param> | 42 | /// <param name="ry">The Y coordinate of the terrain mask</param> |
43 | /// <param name="size">The size of the terrain mask</param> | 43 | /// <param name="size">The size of the terrain mask</param> |
44 | /// <param name="amount">The scale of the terrain mask</param> | 44 | /// <param name="amount">The scale of the terrain mask</param> |
45 | public void flatten(double rx, double ry, double size, double amount) | 45 | public void Flatten(double rx, double ry, double size, double amount) |
46 | { | 46 | { |
47 | // Generate the mask | 47 | // Generate the mask |
48 | Channel temp = new Channel(w, h); | 48 | Channel temp = new Channel(w, h); |
49 | temp.fill(0); | 49 | temp.Fill(0); |
50 | temp.raise(rx, ry, size, amount); | 50 | temp.Raise(rx, ry, size, amount); |
51 | temp.normalise(); | 51 | temp.Normalise(); |
52 | double total_mod = temp.sum(); | 52 | double total_mod = temp.Sum(); |
53 | 53 | ||
54 | // Establish the average height under the area | 54 | // Establish the average height under the area |
55 | Channel newmap = new Channel(w, h); | 55 | Channel newmap = new Channel(w, h); |
@@ -57,26 +57,26 @@ namespace libTerrain | |||
57 | 57 | ||
58 | newmap *= temp; | 58 | newmap *= temp; |
59 | 59 | ||
60 | double total_terrain = newmap.sum(); | 60 | double total_terrain = newmap.Sum(); |
61 | double avg_height = total_terrain / total_mod; | 61 | double avg_height = total_terrain / total_mod; |
62 | 62 | ||
63 | // Create a flat terrain using the average height | 63 | // Create a flat terrain using the average height |
64 | Channel flat = new Channel(w, h); | 64 | Channel flat = new Channel(w, h); |
65 | flat.fill(avg_height); | 65 | flat.Fill(avg_height); |
66 | 66 | ||
67 | // Blend the current terrain with the average height terrain | 67 | // Blend the current terrain with the average height terrain |
68 | // using the "raised" empty terrain as a mask | 68 | // using the "raised" empty terrain as a mask |
69 | blend(flat, temp); | 69 | Blend(flat, temp); |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | public void flatten(Channel mask, double amount) | 73 | public void Flatten(Channel mask, double amount) |
74 | { | 74 | { |
75 | // Generate the mask | 75 | // Generate the mask |
76 | Channel temp = mask * amount; | 76 | Channel temp = mask * amount; |
77 | temp.clip(0, 1); // Cut off out-of-bounds values | 77 | temp.Clip(0, 1); // Cut off out-of-bounds values |
78 | 78 | ||
79 | double total_mod = temp.sum(); | 79 | double total_mod = temp.Sum(); |
80 | 80 | ||
81 | // Establish the average height under the area | 81 | // Establish the average height under the area |
82 | Channel map = new Channel(w, h); | 82 | Channel map = new Channel(w, h); |
@@ -84,16 +84,16 @@ namespace libTerrain | |||
84 | 84 | ||
85 | map *= temp; | 85 | map *= temp; |
86 | 86 | ||
87 | double total_terrain = map.sum(); | 87 | double total_terrain = map.Sum(); |
88 | double avg_height = total_terrain / total_mod; | 88 | double avg_height = total_terrain / total_mod; |
89 | 89 | ||
90 | // Create a flat terrain using the average height | 90 | // Create a flat terrain using the average height |
91 | Channel flat = new Channel(w, h); | 91 | Channel flat = new Channel(w, h); |
92 | flat.fill(avg_height); | 92 | flat.Fill(avg_height); |
93 | 93 | ||
94 | // Blend the current terrain with the average height terrain | 94 | // Blend the current terrain with the average height terrain |
95 | // using the "raised" empty terrain as a mask | 95 | // using the "raised" empty terrain as a mask |
96 | blend(flat, temp); | 96 | Blend(flat, temp); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | } \ No newline at end of file | 99 | } \ No newline at end of file |