ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/quadland.C
(Generate patch)

Comparing deliantra/server/server/quadland.C (file contents):
Revision 1.10 by root, Wed May 4 12:04:33 2011 UTC vs.
Revision 1.11 by root, Wed May 4 16:12:15 2011 UTC

170 int h = 1000000; // height form heightmap 170 int h = 1000000; // height form heightmap
171 171
172 // the continent increases in height from 0 to ~700 levels in the absence of anything else 172 // the continent increases in height from 0 to ~700 levels in the absence of anything else
173 // thats about one step every 7 maps. 173 // thats about one step every 7 maps.
174 int base_height = blend (0, 300, xy_gradient, 0.2f, 0.9f); 174 int base_height = blend (0, 300, xy_gradient, 0.2f, 0.9f);
175 int river_height = base_height * 9 / 10; 175 int river_height = base_height; // * 9 / 10;
176 176
177 // add this to rivers to "dry them out" 177 // add this to rivers to "dry them out"
178 float dry_out = max (0.f, lerp (xy_gradient, 0.7f, 1.f, 0.f, 0.3f)); 178 float dry_out = max (0.f, lerp (xy_gradient, 0.7f, 1.f, 0.f, 0.3f));
179 179
180 static frac2d river_gen (2); 180 static frac2d river_gen (2);
181 float river1 = abs (river_gen.fBm (P * 0.001 + perturb * 4)) + dry_out; 181 float river1 = abs (river_gen.fBm (P * 0.001 + perturb * 4)) + dry_out;
182 float river2 = river_gen.ridgedmultifractal (P * 0.04, 0.8, 10) - y_gradient * 0.2 - 0.16 - dry_out; 182 float river2 = river_gen.ridgedmultifractal (P * 0.04, 0.8, 10) - y_gradient * 0.2 - 0.16 - dry_out;
183 183
184 float valley = river1 - 0.2f; 184 float valley = river1 - 0.2f;
185 185
186 static frac2d mountain_gen (8, 2.14, 0.5); 186 static frac2d mountain_gen (6, 2.14, 0.5);
187 float mountain = mountain_gen.ridgedmultifractal (P * 0.004); 187 float mountain = mountain_gen.ridgedmultifractal (P * 0.004);
188 188
189 //TODO: mountains should not lower the height, should they? 189 //TODO: mountains should not lower the height, should they?
190 t = valley < 0 ? T_VALLEY : T_MOUNTAIN; 190 t = valley < 0 ? T_VALLEY : T_MOUNTAIN;
191 c = blend0 (vec3d (0, 0.8, 0), vec3d (0.8, 0, 0), valley, 0.1f); 191 c = blend0 (vec3d (0, 0.8, 0), vec3d (0.8, 0, 0), valley, 0.1f);
192 h = blend0 (base_height + continent * 300*0, base_height + mountain * xy_gradient * 400, valley, 0.1f); 192 h = blend0 (base_height + continent * 3, base_height + mountain * xy_gradient * 100, valley, 0.1f);
193 193
194 if (river1 < 0.01f) 194 if (river1 < 0.01f)
195 { 195 {
196 // main rivers - they cut deeply into the mountains (base_height * 0.9f) 196 // main rivers - they cut deeply into the mountains (base_height * 0.9f)
197 t = T_RIVER; 197 t = T_RIVER;
198 c = vec3d (0.2, 0.2, 1); 198 c = vec3d (0.2, 0.2, 1);
199 h0 = river_height; 199 h0 = river_height;
200 min_it (h, river_height + lerp<float> (river1, 0.f, 0.01f, -20, -1)); 200 min_it (h, river_height + lerp<float> (river1, 0.f, 0.01f, -10, -1));
201 } 201 }
202 202
203 if (river2 > 0) 203 if (river2 > 0)
204 { 204 {
205 t = T_RIVER; 205 t = T_RIVER;
206 c = vec3d (0.2, 0.2, 1); 206 c = vec3d (0.2, 0.2, 1);
207 h0 = river_height; 207 h0 = river_height;
208 min_it (h, river_height + lerp<float> (river1, 0.f, 0.01f, -5, -1)); 208 min_it (h, river_height + max (-5, lerp<float> (river2, 0.01f, 0, -4, -1)));
209 } 209 }
210 210
211 if (continent < 0) 211 if (continent < 0)
212 { 212 {
213 t = T_OCEAN; 213 t = T_OCEAN;
287 287
288 case T_UNDERGROUND: 288 case T_UNDERGROUND:
289 // todo, use a fractal 289 // todo, use a fractal
290 if (z < h - 10) 290 if (z < h - 10)
291 { 291 {
292 arch_floor = shstr ("quad_dirt_floor"); 292 arch_floor = shstr ("quad_stone_floor");
293 arch_wall = shstr ("quad_dirt_wall"); 293 arch_wall = shstr ("quad_stone_wall");
294 } 294 }
295 else 295 else
296 { 296 {
297 arch_floor = shstr ("quad_stone_floor"); 297 arch_floor = shstr ("quad_dirt_floor");
298 arch_wall = shstr ("quad_stone_wall"); 298 arch_wall = shstr ("quad_dirt_wall");
299 } 299 }
300 break; 300 break;
301 301
302 case T_ACQUIFER: 302 case T_ACQUIFER:
303 arch_wall = shstr ("quad_water_wall"); 303 arch_wall = shstr ("quad_water_wall");
418 } 418 }
419#endif 419#endif
420 420
421 exit (0); 421 exit (0);
422} 422}
423

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines