-
Notifications
You must be signed in to change notification settings - Fork 0
Trees #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trees #55
Conversation
bevy_renet = { git = "https://github.com/CuddlyBunion341/renet.git" } | ||
bincode = "1.3.3" | ||
rand = "0.8.5" | ||
rand = {version = "0.9.0", features = ["small_rng"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old one didn't support range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Terracota is no longer planned in terrain generation, had to make room for trees and ores
IronOre, | ||
CoalOre, | ||
Bedrock, | ||
RedSand, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bye bye
const ATLAS_HEIGHT: usize = 4; | ||
|
||
let textures: [[TextureName; ATLAS_WIDTH]; ATLAS_HEIGHT] = [ | ||
[Stone, CobbleStone, GrassTop, OakLeaves], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This texture definition makes me happier than I was before, hopefully making adding textures simpler ^^
max: Vec3, | ||
} | ||
|
||
let proposal_bounds = proposal.iter().fold( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe overkill, but the goal is to first generate a tree scheme (with relative positions to spawn origin) and then determine a planting position that is in bounds of the chunk, thus not wasting spawn attempts.
let proposal_valid = proposal.iter().all(|(relative_pos, _block)| { | ||
let Vec3 { x, y, z } = relative_pos; | ||
Chunk::valid_padded( | ||
(sapling_x as f32 + *x) as usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code, I know....
what do I do?
for dx in -bush_radius..bush_radius { | ||
for dz in -bush_radius..bush_radius { | ||
for dy in -bush_radius..bush_radius { | ||
let distance_from_center = dx * dx + dy * dy + dz * dz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pythagoras saves the day
} | ||
} | ||
|
||
for dy in 1..tree_stump_height { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to override the leaves with stump.
Finally decided to add so called "trees".
Two components:
Also added debug UI to tweak params, such as the number of attempts and tree size.
Implementation details
Additional notes
Unrelated changes