Fixed snow biome trees

This commit is contained in:
Joshua Barretto 2021-03-06 20:07:46 +00:00
parent 911acdd9db
commit 9910398917
6 changed files with 16 additions and 36 deletions

View File

@ -184,7 +184,10 @@ void main() {
float ao = f_ao * sqrt(f_ao);//0.25 + f_ao * 0.75; ///*pow(f_ao, 0.5)*/f_ao * 0.85 + 0.15;
vec3 glow = pow(pow(model_glow.w, 2.0) * (max(dot(f_norm, normalize(model_glow.xyz)) * 0.5 + 0.5, 0.0) * 1.0 + max(1.0 - length(model_glow.xyz), 0.0)), 1) * 4 * glow_light(f_pos);
float glow_mag = length(model_glow.xyz);
vec3 glow = pow(model_glow.w, 2) * 4
* glow_light(f_pos)
* (max(dot(f_norm, model_glow.xyz / glow_mag) * 0.5 + 0.5, 0.0) + max(1.0 - glow_mag, 0.0));
emitted_light += glow;
reflected_light *= ao;

View File

@ -305,6 +305,7 @@ pub fn apply_caves_supplement<'a>(
}
}
#[allow(dead_code)]
pub fn apply_coral_to(canvas: &mut Canvas) {
let info = canvas.info();

View File

@ -313,21 +313,21 @@ impl TreeConfig {
}
pub fn pine(rng: &mut impl Rng, scale: f32) -> Self {
let scale = scale * (1.0 + rng.gen::<f32>().powi(4));
let scale = scale * (1.0 + rng.gen::<f32>().powi(4) * 0.5);
let log_scale = 1.0 + scale.log2().max(0.0);
Self {
trunk_len: 24.0 * scale,
trunk_len: 32.0 * scale,
trunk_radius: 1.25 * scale,
branch_child_len: 0.4 / scale,
branch_child_len: 0.35 / scale,
branch_child_radius: 0.0,
leaf_radius: 1.5 * log_scale..2.0 * log_scale,
leaf_radius: 2.5 * log_scale..2.75 * log_scale,
straightness: 0.0,
max_depth: 1,
splits: 50.0..70.0,
split_range: 0.15..1.2,
splits: 40.0..50.0,
split_range: 0.165..1.2,
branch_len_bias: 0.75,
leaf_vertical_scale: 0.5,
leaf_vertical_scale: 0.3,
proportionality: 1.0,
inhabited: false,
}
@ -443,8 +443,8 @@ impl ProceduralTree {
const PHI: f32 = 0.618;
const RAD_PER_BRANCH: f32 = f32::consts::TAU * PHI;
let screw = (screw_shift + dist * splits as f32 * RAD_PER_BRANCH).sin() * x_axis
+ (screw_shift + dist * splits as f32 * RAD_PER_BRANCH).cos() * y_axis;
let screw = (screw_shift + i as f32 * RAD_PER_BRANCH).sin() * x_axis
+ (screw_shift + i as f32 * RAD_PER_BRANCH).cos() * y_axis;
// Choose a point close to the branch to act as the target direction for the
// branch to grow in let split_factor =

View File

@ -299,7 +299,7 @@ impl World {
layer::apply_trees_to(&mut canvas, &mut dynamic_rng);
layer::apply_scatter_to(&mut canvas, &mut dynamic_rng);
layer::apply_paths_to(&mut canvas);
layer::apply_coral_to(&mut canvas);
// layer::apply_coral_to(&mut canvas);
// Apply site generation
sim_chunk

View File

@ -1545,30 +1545,6 @@ impl WorldSim {
}
}
// for locs in cliff_path.windows(3) {
// let to_prev_idx = NEIGHBORS
// .iter()
// .enumerate()
// .find(|(_, dir)| **dir == locs[0].0 - locs[1].0)
// .expect("Track locations must be neighbors")
// .0;
// let to_next_idx = NEIGHBORS
// .iter()
// .enumerate()
// .find(|(_, dir)| **dir == locs[2].0 - locs[1].0)
// .expect("Track locations must be neighbors")
// .0;
// self.get_mut(locs[0].0).unwrap().cliff.0.neighbors |=
// 1 << ((to_prev_idx as u8 + 4) % 8);
// self.get_mut(locs[1].0).unwrap().cliff.0.neighbors |=
// (1 << (to_prev_idx as u8)) | (1 << (to_next_idx as u8));
// self.get_mut(locs[2].0).unwrap().cliff.0.neighbors |=
// 1 << ((to_next_idx as u8 + 4) % 8);
// self.get_mut(locs[1].0).unwrap().cliff.0.offset =
// Vec2::new(rng.gen_range(-16..17), rng.gen_range(-16..17)); }
for cliff in cliffs {
Spiral2d::new()
.take((4usize * 2 + 1).pow(2))

View File

@ -81,7 +81,7 @@ impl Tree {
canvas.set(wpos, Block::new(BlockKind::Wood, Rgb::new(80, 32, 0)));
}
above = true;
above = false;
}
}
});