diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-01-16 19:32:14 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-01-16 19:32:14 +0200 |
commit | 7068bc90af1f452359a1fcfe20fa01fc88f3d70a (patch) | |
tree | 43ecf753c1e178cfc29ce4f736d77897a340ed44 /src/test.cpp | |
parent | 69e7cd9b5b36783ec83a663789a95a3c512809c4 (diff) | |
download | minetest-7068bc90af1f452359a1fcfe20fa01fc88f3d70a.tar.gz minetest-7068bc90af1f452359a1fcfe20fa01fc88f3d70a.tar.bz2 minetest-7068bc90af1f452359a1fcfe20fa01fc88f3d70a.zip |
Initial commit of mapgen v.2. Lacks configuration and saving to disk.
Diffstat (limited to 'src/test.cpp')
-rw-r--r-- | src/test.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/test.cpp b/src/test.cpp index f8f954742..d78c62120 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -695,10 +695,12 @@ struct TestHeightmap { //g_heightmap_debugprint = true; const s16 BS1 = 4; - UnlimitedHeightmap hm1(BS1, + /*UnlimitedHeightmap hm1(BS1, new ConstantGenerator(0.0), new ConstantGenerator(0.0), - new ConstantGenerator(5.0)); + new ConstantGenerator(5.0));*/ + PointAttributeDatabase padb; + UnlimitedHeightmap hm1(BS1, &padb); // Go through it so it generates itself for(s16 y=0; y<=BS1; y++){ for(s16 x=0; x<=BS1; x++){ @@ -729,10 +731,26 @@ struct TestHeightmap dstream<<std::endl; const s16 BS1 = 8; - UnlimitedHeightmap hm1(BS1, + /*UnlimitedHeightmap hm1(BS1, new ConstantGenerator(10.0), new ConstantGenerator(0.3), - new ConstantGenerator(0.0)); + new ConstantGenerator(0.0));*/ + + PointAttributeDatabase padb; + + padb.getList("hm_baseheight")->addPoint(v2s16(-BS1,0), Attribute(0)); + padb.getList("hm_randmax")->addPoint(v2s16(-BS1,0), Attribute(0)); + padb.getList("hm_randfactor")->addPoint(v2s16(-BS1,0), Attribute(0.0)); + + padb.getList("hm_baseheight")->addPoint(v2s16(0,0), Attribute(-20)); + padb.getList("hm_randmax")->addPoint(v2s16(0,0), Attribute(0)); + padb.getList("hm_randfactor")->addPoint(v2s16(0,0), Attribute(0.5)); + + padb.getList("hm_baseheight")->addPoint(v2s16(BS1*2,BS1), Attribute(0)); + padb.getList("hm_randmax")->addPoint(v2s16(BS1*2,BS1), Attribute(30)); + padb.getList("hm_randfactor")->addPoint(v2s16(BS1*2,BS1), Attribute(0.9)); + + UnlimitedHeightmap hm1(BS1, &padb); // Force hm1 to generate a some heightmap hm1.getGroundHeight(v2s16(0,0)); |