mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-05 07:09:07 +02:00
Move block_color() to new module
This commit is contained in:
parent
e801631561
commit
25710bb1ed
3 changed files with 21 additions and 15 deletions
10
src/resource/block_color.rs
Normal file
10
src/resource/block_color.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use super::{Biome, BlockType};
|
||||
|
||||
pub fn block_color(block: BlockType, _biome: &Biome, depth: f32) -> [u8; 4] {
|
||||
let h = 0.5 + 0.005 * depth;
|
||||
let c = block
|
||||
.color
|
||||
.0
|
||||
.map(|v| (f32::from(v) * h).clamp(0.0, 255.0) as u8);
|
||||
[c[0], c[1], c[2], 255]
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
mod biomes;
|
||||
mod block_color;
|
||||
mod block_types;
|
||||
mod legacy_block_types;
|
||||
|
||||
|
@ -90,6 +91,7 @@ impl BlockTypes {
|
|||
}
|
||||
|
||||
pub use biomes::Biome;
|
||||
pub use block_color::block_color;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BiomeTypes {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue