mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
resource/block_color: fix scaling of biome-specific colors
All biome-specific colors (water/foliage/grass) were too bright by a factor of 255 (i.e., white).
This commit is contained in:
parent
99c4de0b07
commit
c471f84573
1 changed files with 6 additions and 2 deletions
|
@ -2,10 +2,14 @@ use super::{Biome, BlockType, Color};
|
|||
|
||||
use glam::Vec3;
|
||||
|
||||
fn color_vec(color: Color) -> Vec3 {
|
||||
fn color_vec_unscaled(color: Color) -> Vec3 {
|
||||
Vec3::from_array(color.0.map(f32::from))
|
||||
}
|
||||
|
||||
fn color_vec(color: Color) -> Vec3 {
|
||||
color_vec_unscaled(color) / 255.0
|
||||
}
|
||||
|
||||
fn color_from_params(colors: &[Vec3; 3], biome: &Biome, depth: f32) -> Vec3 {
|
||||
let temp = (biome.temp() - f32::max((depth - 64.0) / 600.0, 0.0)).clamp(0.0, 1.0);
|
||||
let downfall = biome.downfall().clamp(0.0, 1.0) * temp;
|
||||
|
@ -71,7 +75,7 @@ const EVERGREEN_COLOR: Vec3 = Vec3::new(0.380, 0.600, 0.380); // == color_vec(Co
|
|||
pub fn block_color(block: BlockType, biome: &Biome, depth: f32) -> [u8; 4] {
|
||||
use super::BlockFlag::*;
|
||||
|
||||
let mut color = color_vec(block.color);
|
||||
let mut color = color_vec_unscaled(block.color);
|
||||
|
||||
if block.is(Grass) {
|
||||
color *= biome.grass_color(depth);
|
||||
|
|
Loading…
Add table
Reference in a new issue