-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from kralverde/plains_generation
implement density functions for terrain generation
- Loading branch information
Showing
26 changed files
with
4,703 additions
and
2,323 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pub struct VoxelShape { | ||
// TODO | ||
} | ||
|
||
impl VoxelShape { | ||
pub fn is_empty() -> bool { | ||
unimplemented!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use super::noise::density::NoisePos; | ||
|
||
pub struct Blender { | ||
// TODO | ||
} | ||
|
||
impl Blender { | ||
pub fn apply_blend_density(&self, _pos: &NoisePos, _density: f64) -> f64 { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use enum_dispatch::enum_dispatch; | ||
|
||
#[enum_dispatch] | ||
pub enum HeightLimitView { | ||
Standard(StandardHeightLimitView), | ||
} | ||
|
||
#[enum_dispatch(HeightLimitView)] | ||
pub trait HeightLimitViewImpl { | ||
fn height(&self) -> i32; | ||
|
||
fn bottom_y(&self) -> i32; | ||
|
||
fn top_y(&self) -> i32 { | ||
self.bottom_y() + self.height() | ||
} | ||
|
||
fn vertical_section_count(&self) -> i32 { | ||
self.top_section_coord() - self.bottom_section_coord() | ||
} | ||
|
||
fn bottom_section_coord(&self) -> i32 { | ||
self.bottom_y() >> 4 | ||
} | ||
|
||
fn top_section_coord(&self) -> i32 { | ||
((self.top_y() - 1) >> 4) + 1 | ||
} | ||
|
||
fn out_of_height(&self, height: i32) -> bool { | ||
height < self.bottom_y() || height >= self.top_y() | ||
} | ||
|
||
fn section_index(&self, y: i32) -> i32 { | ||
self.section_coord_to_index(y >> 4) | ||
} | ||
|
||
fn section_coord_to_index(&self, coord: i32) -> i32 { | ||
coord - self.bottom_section_coord() | ||
} | ||
|
||
fn section_index_to_coord(&self, index: i32) -> i32 { | ||
index + self.bottom_section_coord() | ||
} | ||
} | ||
|
||
pub struct StandardHeightLimitView { | ||
height: i32, | ||
bottom_y: i32, | ||
} | ||
|
||
impl StandardHeightLimitView { | ||
pub fn new(height: i32, bottom_y: i32) -> Self { | ||
Self { height, bottom_y } | ||
} | ||
} | ||
|
||
impl HeightLimitViewImpl for StandardHeightLimitView { | ||
fn height(&self) -> i32 { | ||
self.height | ||
} | ||
|
||
fn bottom_y(&self) -> i32 { | ||
self.bottom_y | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.