default macro gen randomizes biomes now
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
5109eb97a9
commit
2d55b16119
@ -1,5 +1,11 @@
|
||||
package electrosphere.server.terrain.generation.macro;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.game.data.biome.BiomeData;
|
||||
import electrosphere.game.data.biome.BiomeTypeMap;
|
||||
import electrosphere.server.terrain.models.TerrainModel;
|
||||
|
||||
/**
|
||||
@ -16,18 +22,22 @@ public class DefaultMacroGenerator implements MacroGenerator {
|
||||
public void generate(TerrainModel model) {
|
||||
int DIM = model.getDiscreteArrayDimension();
|
||||
float[][] elevation = model.getElevation();
|
||||
short[][] biome = model.getBiome();
|
||||
short[][] biomeArr = model.getBiome();
|
||||
long seed = model.getSeed();
|
||||
Random rand = new Random(seed);
|
||||
BiomeTypeMap biomeTypeMap = Globals.gameConfigCurrent.getBiomeMap();
|
||||
List<BiomeData> biomes = biomeTypeMap.getSurfaceBiomes();
|
||||
|
||||
for(int x = 0; x < DIM; x++){
|
||||
for(int y = 0; y < DIM; y++){
|
||||
BiomeData biome = biomes.get(rand.nextInt(biomes.size()));
|
||||
elevation[x][y] = 1;
|
||||
biome[x][y] = DEFAULT_SURFACE_BIOME;
|
||||
biomeArr[x][y] = (short)(int)(biomeTypeMap.getIndexOfBiome(biome));
|
||||
}
|
||||
}
|
||||
|
||||
model.setElevationArray(elevation);
|
||||
model.setBiome(biome);
|
||||
model.setBiome(biomeArr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user