Planet

<
>
July 26, 2021

I added the first version of a Planet. For now it only has a width and height and uses perlin noise for generating a Tile map.
A Tile for a position is chosen depending on the value of the perlin noise at the location. Offsets and factors used within the noise generator are currently hard coded but could later be specific to individual Planets.

let v = self
    .ng
    .get([pos.col as f64 * 0.02 + 13.3, pos.row as f64 * 0.02 + 14.4]);
if v < 0.05 {
    Some(Tile::Water)
} else if v < 0.1 {
    Some(Tile::Sand)
} else {
    Some(Tile::Ground)
}

The tiles can then be rendered similar to Structures of a Blueprint, resulting in the following view:


The rendering is currently really slow when zoomed out. This is caused by rendering too many tiles at once.
For now the Blueprint is simply rendered somewhere on top of the Planet.