Improve colors

This commit is contained in:
Imbris 2019-08-11 21:53:48 -04:00
parent 8c99796e1d
commit ec28d628bd
11 changed files with 146 additions and 56 deletions

80
Cargo.lock generated
View File

@ -1972,6 +1972,28 @@ dependencies = [
"stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "palette"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"palette_derive 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "palette_derive"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "pango" name = "pango"
version = "0.4.0" version = "0.4.0"
@ -2126,6 +2148,40 @@ dependencies = [
"fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "phf"
version = "0.7.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "phf_codegen"
version = "0.7.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "phf_generator"
version = "0.7.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "phf_shared"
version = "0.7.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "piston-float" name = "piston-float"
version = "0.3.0" version = "0.3.0"
@ -2727,6 +2783,11 @@ dependencies = [
"term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "siphasher"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.2" version = "0.4.2"
@ -2842,6 +2903,16 @@ name = "svg_fmt"
version = "0.2.1" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "0.14.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "0.15.44" version = "0.15.44"
@ -3075,6 +3146,7 @@ dependencies = [
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"notify 5.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)", "notify 5.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
"palette 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3583,6 +3655,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" "checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
"checksum palette 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6cd2b5f49faa585c1416e35717fc04328a4c353b368c3ad6e8b34e743bd7cae1"
"checksum palette_derive 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76bc2c163e12167b6b7cf3f76a94c2abf8f87086a2d03efbe07d12b0f792189e"
"checksum pango 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45374801e224373c3c0393cd48073c81093494c8735721e81d1dbaa4096b2767" "checksum pango 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45374801e224373c3c0393cd48073c81093494c8735721e81d1dbaa4096b2767"
"checksum pango-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94039b3921a4af4058a3e4335e5d15099101f298a92f5afc40bab3a3027594a1" "checksum pango-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94039b3921a4af4058a3e4335e5d15099101f298a92f5afc40bab3a3027594a1"
"checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e"
@ -3598,6 +3672,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
"checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
"checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18"
"checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e"
"checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662"
"checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0"
"checksum piston-float 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b058c3a640efd4bcf63266512e4bb03187192c1b29edd38b16d5a014613e3199" "checksum piston-float 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b058c3a640efd4bcf63266512e4bb03187192c1b29edd38b16d5a014613e3199"
"checksum piston-viewport 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d96dd995f7dabe6d57cda668ec0fda39d6fe6e1e0b23f772582f383f2013611" "checksum piston-viewport 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d96dd995f7dabe6d57cda668ec0fda39d6fe6e1e0b23f772582f383f2013611"
"checksum pistoncore-input 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c612ce242c7bac8e96426a0ca34275fd980af440f0cca7c6c0e840ef8a4052f" "checksum pistoncore-input 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c612ce242c7bac8e96426a0ca34275fd980af440f0cca7c6c0e840ef8a4052f"
@ -3666,6 +3744,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fcf34e5e5302d3024aba7afc291f6d1ca7573ed035d3c0796976ba3f10691a1" "checksum shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fcf34e5e5302d3024aba7afc291f6d1ca7573ed035d3c0796976ba3f10691a1"
"checksum shrev 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5752e017e03af9d735b4b069f53b7a7fd90fefafa04d8bd0c25581b0bff437f" "checksum shrev 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5752e017e03af9d735b4b069f53b7a7fd90fefafa04d8bd0c25581b0bff437f"
"checksum simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9c948a5a26cd38340ddbeaa557a8c8a5ce4442408eb60453bee2bb3c84a3fb" "checksum simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9c948a5a26cd38340ddbeaa557a8c8a5ce4442408eb60453bee2bb3c84a3fb"
"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum slice-deque 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ffddf594f5f597f63533d897427a570dbaa9feabaaa06595b74b71b7014507d7" "checksum slice-deque 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ffddf594f5f597f63533d897427a570dbaa9feabaaa06595b74b71b7014507d7"
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
@ -3680,6 +3759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
"checksum sum_type 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da5b4a0c9f3c7c8e891e445a7c776627e208e8bba23ab680798066dd283e6a15" "checksum sum_type 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da5b4a0c9f3c7c8e891e445a7c776627e208e8bba23ab680798066dd283e6a15"
"checksum svg_fmt 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20e5f95e89d737f30cd1f98a9af9a85c2a1cc162cfedfba5a0c54cf92d7206fc" "checksum svg_fmt 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20e5f95e89d737f30cd1f98a9af9a85c2a1cc162cfedfba5a0c54cf92d7206fc"
"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
"checksum syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f5e3aaa79319573d19938ea38d068056b826db9883a5d47f86c1cecc688f0e" "checksum syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f5e3aaa79319573d19938ea38d068056b826db9883a5d47f86c1cecc688f0e"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

View File

@ -1,13 +1,13 @@
const float PI = 3.141592; const float PI = 3.141592;
const vec3 SKY_DAY_TOP = vec3(0.35, 0.45, 0.9); const vec3 SKY_DAY_TOP = vec3(0.1, 0.2, 0.9);
const vec3 SKY_DAY_MID = vec3(0.25, 0.35, 0.8); const vec3 SKY_DAY_MID = vec3(0.02, 0.08, 0.8);
const vec3 SKY_DAY_BOT = vec3(0.02, 0.1, 0.3); const vec3 SKY_DAY_BOT = vec3(0.02, 0.01, 0.3);
const vec3 DAY_LIGHT = vec3(0.5, 0.5, 1.0); const vec3 DAY_LIGHT = vec3(0.5, 0.5, 1.0);
const vec3 SKY_DUSK_TOP = vec3(0.1, 0.15, 0.3); const vec3 SKY_DUSK_TOP = vec3(0.21, 0.28, 0.50);
const vec3 SKY_DUSK_MID = vec3(0.8, 0.25, 0.2); const vec3 SKY_DUSK_MID = vec3(0.68, 0.03, 0.0);
const vec3 SKY_DUSK_BOT = vec3(0.01, 0.05, 0.15); const vec3 SKY_DUSK_BOT = vec3(0.0, 0.0, 0.13);
const vec3 DUSK_LIGHT = vec3(0.9, 0.4, 0.3); const vec3 DUSK_LIGHT = vec3(0.9, 0.4, 0.3);
const vec3 SKY_NIGHT_TOP = vec3(0.001, 0.001, 0.0025); const vec3 SKY_NIGHT_TOP = vec3(0.001, 0.001, 0.0025);

View File

@ -28,3 +28,4 @@ find_folder = "0.3.0"
parking_lot = "0.9.0" parking_lot = "0.9.0"
crossbeam = "0.7.2" crossbeam = "0.7.2"
notify = "5.0.0-pre.1" notify = "5.0.0-pre.1"
palette = "0.4.1"

View File

@ -105,27 +105,27 @@ pub fn load_watched<A: Asset + 'static>(
let asset = load(specifier)?; let asset = load(specifier)?;
// Determine path to watch // Determine path to watch
let mut path = unpack_specifier(specifier); let path = unpack_specifier(specifier);
let mut file_exists = false; let mut path_with_extension = None;
for ending in A::ENDINGS { for ending in A::ENDINGS {
let mut path = path.clone(); let mut path = path.clone();
path.set_extension(ending); path.set_extension(ending);
if path.exists() { if path.exists() {
file_exists = true; path_with_extension = Some(path);
break; break;
} }
} }
if !file_exists {
return Err(Error::NotFound(path.to_string_lossy().into_owned()));
}
let owned_specifier = specifier.to_string(); let owned_specifier = specifier.to_string();
indicator.add(path, move || { indicator.add(
if let Err(err) = reload::<A>(&owned_specifier) { path_with_extension.ok_or_else(|| Error::NotFound(path.to_string_lossy().into_owned()))?,
error!("Error reloading {}: {:#?}", &owned_specifier, err); move || {
} if let Err(err) = reload::<A>(&owned_specifier) {
}); error!("Error reloading {}: {:#?}", &owned_specifier, err);
}
},
);
Ok(asset) Ok(asset)
} }

View File

@ -1,6 +1,8 @@
pub const GIT_HASH: &str = include_str!(concat!(env!("OUT_DIR"), "/githash")); pub const GIT_HASH: &str = include_str!(concat!(env!("OUT_DIR"), "/githash"));
use palette::{Hsv, Saturate, Srgb};
use vek::{Rgb, Rgba}; use vek::{Rgb, Rgba};
#[inline(always)] #[inline(always)]
pub fn srgb_to_linear(col: Rgb<f32>) -> Rgb<f32> { pub fn srgb_to_linear(col: Rgb<f32>) -> Rgb<f32> {
#[inline(always)] #[inline(always)]
@ -33,3 +35,12 @@ pub fn srgba_to_linear(col: Rgba<f32>) -> Rgba<f32> {
pub fn linear_to_srgba(col: Rgba<f32>) -> Rgba<f32> { pub fn linear_to_srgba(col: Rgba<f32>) -> Rgba<f32> {
Rgba::from_translucent(linear_to_srgb(Rgb::from(col)), col.a) Rgba::from_translucent(linear_to_srgb(Rgb::from(col)), col.a)
} }
#[inline(always)]
pub fn saturate_srgb(col: Rgb<f32>, value: f32) -> Rgb<f32> {
Rgb::from(
Srgb::from(Hsv::from(Srgb::from_components(col.into_tuple())).saturate(value))
.into_components(),
)
.map(|c: f32| (c.max(0.0).min(1.0)))
.into()
}

View File

@ -147,11 +147,11 @@ image_ids! {
charlist_frame: "voxygen.element.frames.window_4", charlist_frame: "voxygen.element.frames.window_4",
server_frame: "voxygen.element.frames.server_frame", server_frame: "voxygen.element.frames.server_frame",
selection: "voxygen.element.frames.selection", selection: "voxygen.element.frames.selection",
<ImageGraphic>
slider_range: "voxygen.element.slider.track", slider_range: "voxygen.element.slider.track",
slider_indicator: "voxygen.element.slider.indicator", slider_indicator: "voxygen.element.slider.indicator",
<ImageGraphic>
// Tool Icons // Tool Icons
daggers: "voxygen.element.icons.daggers", daggers: "voxygen.element.icons.daggers",
sword: "voxygen.element.icons.sword", sword: "voxygen.element.icons.sword",

View File

@ -23,7 +23,7 @@ pub type TgtColorFmt = gfx::format::Srgba8;
pub type TgtDepthFmt = gfx::format::Depth; pub type TgtDepthFmt = gfx::format::Depth;
/// Represents the format of the window's color target. /// Represents the format of the window's color target.
pub type WinColorFmt = gfx::format::Rgba8; pub type WinColorFmt = gfx::format::Srgba8;
/// Represents the format of the window's depth target. /// Represents the format of the window's depth target.
pub type WinDepthFmt = gfx::format::Depth; pub type WinDepthFmt = gfx::format::Depth;

View File

@ -7,7 +7,7 @@ use crate::{
}; };
use common::{ use common::{
terrain::{structure::StructureBlock, Block, Structure}, terrain::{structure::StructureBlock, Block, Structure},
util::linear_to_srgb, util::saturate_srgb,
vol::{ReadVol, Vox}, vol::{ReadVol, Vox},
}; };
use noise::NoiseFn; use noise::NoiseFn;
@ -210,7 +210,8 @@ impl<'a> BlockGen<'a> {
// Sample blocks // Sample blocks
// let stone_col = Rgb::new(240, 230, 220); // let stone_col = Rgb::new(240, 230, 220);
let stone_col = Rgb::new(248, 243, 239); let stone_col = Rgb::new(195, 187, 201);
// let dirt_col = Rgb::new(79, 67, 60); // let dirt_col = Rgb::new(79, 67, 60);
let air = Block::empty(); let air = Block::empty();
@ -219,13 +220,14 @@ impl<'a> BlockGen<'a> {
// let dirt = Block::new(1, dirt_col); // let dirt = Block::new(1, dirt_col);
// let sand = Block::new(1, Rgb::new(180, 150, 50)); // let sand = Block::new(1, Rgb::new(180, 150, 50));
// let warm_stone = Block::new(1, Rgb::new(165, 165, 130)); // let warm_stone = Block::new(1, Rgb::new(165, 165, 130));
// let water = Block::new(1, Rgb::new(100, 150, 255));
let water = Block::new(1, Rgb::new(168, 202, 255)); //let water = Block::new(1, Rgb::new(100, 150, 255));
let water = Block::new(1, Rgb::new(0, 24, 255));
let grass_depth = 1.5 + 2.0 * chaos; let grass_depth = 1.5 + 2.0 * chaos;
let block = if (wposf.z as f32) < height - grass_depth { let block = if (wposf.z as f32) < height - grass_depth {
let col = Lerp::lerp( let col = Lerp::lerp(
linear_to_srgb(sub_surface_color).map(|e| (e * 255.0) as u8), saturate_srgb(sub_surface_color, 0.45).map(|e| (e * 255.0) as u8),
stone_col, stone_col,
(height - grass_depth - wposf.z as f32) * 0.15, (height - grass_depth - wposf.z as f32) * 0.15,
); );
@ -247,7 +249,7 @@ impl<'a> BlockGen<'a> {
// Surface // Surface
Some(Block::new( Some(Block::new(
1, 1,
linear_to_srgb(col).map(|e| (e * 255.0) as u8), saturate_srgb(col, 0.45).map(|e| (e * 255.0) as u8),
)) ))
} else if (wposf.z as f32) < water_height { } else if (wposf.z as f32) < water_height {
// Ocean // Ocean
@ -413,7 +415,7 @@ impl StructureInfo {
.map(|e: i32| (e.abs() / 2) * 2) .map(|e: i32| (e.abs() / 2) * 2)
.reduce_max() .reduce_max()
{ {
Some(Block::new(2, Rgb::new(219, 196, 160))) Some(Block::new(2, Rgb::new(203, 170, 146)))
} else { } else {
None None
} }
@ -452,8 +454,8 @@ fn block_from_structure(
StructureBlock::TemperateLeaves => Some(Block::new( StructureBlock::TemperateLeaves => Some(Block::new(
1, 1,
Lerp::lerp( Lerp::lerp(
Rgb::new(0.00, 143.0, 103.6), Rgb::new(0.0, 132.0, 94.0),
Rgb::new(168.1, 195.5, 0.0), Rgb::new(142.0, 181.0, 0.0),
lerp, lerp,
) )
.map(|e| e as u8), .map(|e| e as u8),
@ -461,8 +463,8 @@ fn block_from_structure(
StructureBlock::PineLeaves => Some(Block::new( StructureBlock::PineLeaves => Some(Block::new(
1, 1,
Lerp::lerp( Lerp::lerp(
Rgb::new(0.00, 133.2, 122.4), Rgb::new(0.0, 108.0, 113.0),
Rgb::new(96.3, 168.1, 55.8), Rgb::new(30.0, 156.0, 10.0),
lerp, lerp,
) )
.map(|e| e as u8), .map(|e| e as u8),
@ -470,29 +472,21 @@ fn block_from_structure(
StructureBlock::PalmLeaves => Some(Block::new( StructureBlock::PalmLeaves => Some(Block::new(
1, 1,
Lerp::lerp( Lerp::lerp(
Rgb::new(68.6, 168.1, 96.3), Rgb::new(15.0, 156.0, 70.0),
Rgb::new(128.0, 239.0, 0.00), Rgb::new(40.0, 222.0, 0.0),
lerp, lerp,
) )
.map(|e| e as u8), .map(|e| e as u8),
)), )),
StructureBlock::Acacia => Some(Block::new( StructureBlock::Acacia => Some(Block::new(
1, 1,
Lerp::lerp( Lerp::lerp(Rgb::new(35.0, 156.0, 0.0), Rgb::new(62.0, 208.0, 0.0), lerp)
Rgb::new(103.6, 168.1, 55.8), .map(|e| e as u8),
Rgb::new(143.0, 224.0, 88.2),
lerp,
)
.map(|e| e as u8),
)), )),
StructureBlock::Fruit => Some(Block::new( StructureBlock::Fruit => Some(Block::new(
1, 1,
Lerp::lerp( Lerp::lerp(Rgb::new(237.0, 0.0, 0.0), Rgb::new(200.0, 237.0, 0.0), lerp)
Rgb::new(255.0, 0.0, 0.0), .map(|e| e as u8),
Rgb::new(229.1, 255.0, 42.4),
lerp,
)
.map(|e| e as u8),
)), )),
StructureBlock::Hollow => Some(Block::empty()), StructureBlock::Hollow => Some(Block::empty()),
StructureBlock::Block(block) => Some(block).filter(|block| !block.is_empty()), StructureBlock::Block(block) => Some(block).filter(|block| !block.is_empty()),

View File

@ -188,24 +188,28 @@ impl<'a> Sampler for ColumnGen<'a> {
.add(marble_small.sub(0.5).mul(0.25)); .add(marble_small.sub(0.5).mul(0.25));
// Colours // Colours
let cold_grass = Rgb::new(0.0, 0.21, 0.06); let cold_grass = Rgb::new(0.0, 0.498, 0.408);
let warm_grass = Rgb::new(0.0, 0.55, 0.0); let warm_grass = Rgb::new(0.05, 0.765, 0.0);
let cold_stone = Rgb::new(0.39, 0.58, 0.64); let cold_stone = Rgb::new(0.569, 0.675, 0.796);
let warm_stone = Rgb::new(0.55, 0.55, 0.18); let warm_stone = Rgb::new(0.765, 0.765, 0.643);
let beach_sand = Rgb::new(0.77, 0.70, 0.03); let beach_sand = Rgb::new(0.886, 0.867, 0.635);
let desert_sand = Rgb::new(0.85, 0.48, 0.0); let desert_sand = Rgb::new(0.929, 0.796, 0.53);
let snow = Rgb::broadcast(0.85); let snow = Rgb::broadcast(0.765);
let dirt = Lerp::lerp(Rgb::new(0.17, 0.05, 0.0), Rgb::new(0.34, 0.16, 0.0), marble); let dirt = Lerp::lerp(
Rgb::new(0.078, 0.078, 0.196),
Rgb::new(0.612, 0.49, 0.0),
marble,
);
let cliff = Rgb::lerp(cold_stone, warm_stone, marble); let cliff = Rgb::lerp(cold_stone, warm_stone, marble);
let grass = Rgb::lerp(cold_grass, warm_grass, marble); let grass = Rgb::lerp(cold_grass, warm_grass, marble.powf(1.5));
let sand = Rgb::lerp(beach_sand, desert_sand, marble); let sand = Rgb::lerp(beach_sand, desert_sand, marble);
let tropical = Rgb::lerp( let tropical = Rgb::lerp(
grass, grass,
Rgb::new(0.72, 0.17, 0.0), Rgb::new(0.867, 0.62, 0.561),
marble_small.sub(0.5).mul(0.2).add(0.75), marble_small.sub(0.5).mul(0.2).add(0.75).powf(0.667),
); );
let ground = Rgb::lerp( let ground = Rgb::lerp(