mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-22 11:58:21 -06:00
getting somewhere
This commit is contained in:
parent
37ab56115f
commit
4bd7371f84
|
@ -3,6 +3,9 @@ name = "kubi"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[profile.dev.package.noise]
|
||||||
|
opt-level = 3
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
glium = "0.32"
|
glium = "0.32"
|
||||||
image = { version = "0.24", default_features = false, features = ["png"] }
|
image = { version = "0.24", default_features = false, features = ["png"] }
|
||||||
|
|
|
@ -9,7 +9,8 @@ const HEIGHTMAP_SCALE: f64 = 0.004;
|
||||||
const MOUNTAINESS_SCALE: f64 = 0.0001;
|
const MOUNTAINESS_SCALE: f64 = 0.0001;
|
||||||
const MNT_RAMP_1: f64 = 0.5;
|
const MNT_RAMP_1: f64 = 0.5;
|
||||||
const MNT_RAMP_2: f64 = 0.6;
|
const MNT_RAMP_2: f64 = 0.6;
|
||||||
const TERRAIN_HEIGHT_MIN: f64 = 64.;
|
const MTN_VAL_SCALE: f64 = 1.233;
|
||||||
|
const TERRAIN_HEIGHT_MIN: f64 = 60.;
|
||||||
const TERRAIN_HEIGHT_MAX: f64 = 80.;
|
const TERRAIN_HEIGHT_MAX: f64 = 80.;
|
||||||
|
|
||||||
pub fn generate_chunk(position: IVec2, seed: u32) -> ChunkData {
|
pub fn generate_chunk(position: IVec2, seed: u32) -> ChunkData {
|
||||||
|
@ -29,19 +30,19 @@ pub fn generate_chunk(position: IVec2, seed: u32) -> ChunkData {
|
||||||
let point = world_xz.as_dvec2() + DVec2::from_array([x as f64, z as f64]);
|
let point = world_xz.as_dvec2() + DVec2::from_array([x as f64, z as f64]);
|
||||||
|
|
||||||
let heightmap = (terrain_base_fbm.get((point * HEIGHTMAP_SCALE).to_array()) + 1.) / 2.;
|
let heightmap = (terrain_base_fbm.get((point * HEIGHTMAP_SCALE).to_array()) + 1.) / 2.;
|
||||||
let mountainess = (mountainess_base_fbm.get((point * MOUNTAINESS_SCALE).to_array()) + 1.) / 2.;
|
let mountainess = MTN_VAL_SCALE * ((mountainess_base_fbm.get((point * MOUNTAINESS_SCALE).to_array()) + 1.) / 2.);
|
||||||
|
|
||||||
//generate basic terrain
|
//generate basic terrain
|
||||||
let terain_height =
|
let terain_height =
|
||||||
(
|
(
|
||||||
TERRAIN_HEIGHT_MIN +
|
TERRAIN_HEIGHT_MIN +
|
||||||
(heightmap * TERRAIN_HEIGHT_MAX * (1. + if mountainess < MNT_RAMP_1 {
|
(heightmap * TERRAIN_HEIGHT_MAX * (0.1 + 1.5 * if mountainess < MNT_RAMP_1 {
|
||||||
0.
|
0.
|
||||||
} else {
|
} else {
|
||||||
if mountainess > MNT_RAMP_2 {
|
if mountainess > MNT_RAMP_2 {
|
||||||
1.
|
1.
|
||||||
} else {
|
} else {
|
||||||
mountainess - MNT_RAMP_1
|
(mountainess - MNT_RAMP_1) / (MNT_RAMP_2 - MNT_RAMP_1) * 1.
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
).floor() as usize;
|
).floor() as usize;
|
||||||
|
|
Loading…
Reference in a new issue