本文整理汇总了Java中com.flowpowered.noise.module.source.Perlin.setFrequency方法的典型用法代码示例。如果您正苦于以下问题:Java Perlin.setFrequency方法的具体用法?Java Perlin.setFrequency怎么用?Java Perlin.setFrequency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.flowpowered.noise.module.source.Perlin
的用法示例。
在下文中一共展示了Perlin.setFrequency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WorldGenerator
import com.flowpowered.noise.module.source.Perlin; //导入方法依赖的package包/类
public WorldGenerator(int gen_seed, int num_biomes, int map_width) {
biome_list = new ArrayList<>();
max_heights = new HashMap<>();
biome_locations = new HashMap<>();
/* separation of different biomes */
Voronoi biomes = new Voronoi();
biomes.setSeed(gen_seed);
biomes.setFrequency(0.01);
/* random variation sprinkled around the terrain */
Perlin basefluct = new Perlin();
basefluct.setSeed(gen_seed);
basefluct.setFrequency(0.02f);
/* generate the biomes of the world */
for (int i = 0; i < num_biomes; i++) {
biome_list.add(new Biome(i));
}
/* find which biome will be at each x-value of the world. */
for (int i = 0; i < map_width; i++) {
biome_locations.put(i, (int) (Math.abs(biomes.getValue(i, 0, 0)) * num_biomes));
}
/* add the base variation to the terrain */
for (int i = 0; i < map_width; i++) {
max_heights.put(i, 10 + (int) (Math.abs(basefluct.getValue(i, 0, 0)) * 7));
}
/* add hills */
for (int i = 0; i < map_width; i++) {
if (MathUtils.randomBoolean(biome_list.get(biome_locations.get(i)).getHilliness())) {
buildHill(i, MathUtils.random(6, 10));
}
}
}