From 2a126fff83081771ceec885a54a18ce71ce9dcf5 Mon Sep 17 00:00:00 2001 From: Imbris Date: Mon, 30 Mar 2020 19:44:51 -0400 Subject: [PATCH] Upgrade vek version so that it actually uses the patch --- Cargo.lock | 37 ++++++++++++++++++++---------- client/Cargo.toml | 2 +- common/Cargo.toml | 2 +- server/Cargo.toml | 2 +- voxygen/Cargo.toml | 2 +- voxygen/src/ui/graphic/renderer.rs | 26 ++++++++++++++++++--- world/Cargo.toml | 2 +- 7 files changed, 53 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 71815ff909..4466efcfbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1227,7 +1227,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c20f6684a8420df7c300a36bed7cb0b2387b2bc385d4940282399b5df0c08ebd" dependencies = [ - "vek", + "vek 0.9.12", ] [[package]] @@ -4242,6 +4242,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "stb_truetype" version = "0.3.1" @@ -4854,8 +4860,20 @@ dependencies = [ "num-integer", "num-traits 0.1.43", "rustc_version", + "static_assertions 0.2.5", +] + +[[package]] +name = "vek" +version = "0.10.0" +source = "git+https://github.com/Imberflur/vek?branch=is_normalized#43bef0a9e953fbf6b00a073aef914c48b784c995" +dependencies = [ + "approx 0.3.2", + "num-integer", + "num-traits 0.2.11", + "rustc_version", "serde", - "static_assertions", + "static_assertions 1.1.0", ] [[package]] @@ -4880,7 +4898,7 @@ dependencies = [ "num_cpus", "specs", "uvth", - "vek", + "vek 0.10.0", "veloren-common", ] @@ -4913,7 +4931,7 @@ dependencies = [ "specs", "specs-idvs", "sum_type", - "vek", + "vek 0.10.0", ] [[package]] @@ -4938,7 +4956,7 @@ dependencies = [ "specs", "specs-idvs", "uvth", - "vek", + "vek 0.10.0", "veloren-common", "veloren-world", ] @@ -4996,7 +5014,7 @@ dependencies = [ "specs-idvs", "treeculler", "uvth", - "vek", + "vek 0.10.0", "veloren-client", "veloren-common", "veloren-server", @@ -5030,7 +5048,7 @@ dependencies = [ "roots", "serde", "serde_derive", - "vek", + "vek 0.10.0", "veloren-common", ] @@ -5443,8 +5461,3 @@ name = "xml-rs" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5" - -[[patch.unused]] -name = "vek" -version = "0.10.0" -source = "git+https://github.com/Imberflur/vek?branch=is_normalized#43bef0a9e953fbf6b00a073aef914c48b784c995" diff --git a/client/Cargo.toml b/client/Cargo.toml index 9d649f0b01..ad417fb0e3 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -13,6 +13,6 @@ image = "0.22.3" num_cpus = "1.10.1" log = "0.4.8" specs = "0.15.1" -vek = { version = "0.9.9", features = ["serde"] } +vek = { version = "0.10.0", features = ["serde"] } hashbrown = { version = "0.6.2", features = ["rayon", "serde", "nightly"] } authc = { git = "https://gitlab.com/veloren/auth.git", rev = "65571ade0d954a0e0bd995fdb314854ff146ab97" } diff --git a/common/Cargo.toml b/common/Cargo.toml index f70c8c1b6c..69d7217c7a 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -11,7 +11,7 @@ no-assets = [] specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git" } specs = { version = "0.15.1", features = ["serde", "nightly", "storage-event-control"] } -vek = { version = "0.9.9", features = ["serde"] } +vek = { version = "0.10.0", features = ["serde"] } dot_vox = "4.0.0" image = "0.22.3" mio = "0.6.19" diff --git a/server/Cargo.toml b/server/Cargo.toml index c86adf42d8..e93df3f701 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -16,7 +16,7 @@ specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git" } log = "0.4.8" specs = { version = "0.15.1", features = ["shred-derive"] } -vek = "0.9.9" +vek = "0.10.0" uvth = "3.1.1" lazy_static = "1.4.0" scan_fmt = "0.2.4" diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index b8224fa256..4938dc55a3 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -34,7 +34,7 @@ specs = "0.15.1" specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git" } # Mathematics -vek = { version = "0.9.9", features = ["serde"] } +vek = { version = "0.10.0", features = ["serde"] } # Controller gilrs = { version = "0.7", features = ["serde"] } diff --git a/voxygen/src/ui/graphic/renderer.rs b/voxygen/src/ui/graphic/renderer.rs index 653b386ce5..946b464a54 100644 --- a/voxygen/src/ui/graphic/renderer.rs +++ b/voxygen/src/ui/graphic/renderer.rs @@ -57,10 +57,30 @@ impl Vert { } } +#[derive(Clone, Copy)] +struct VsOut(Rgba); +impl euc::Interpolate for VsOut { + #[inline(always)] + fn lerp2(a: Self, b: Self, x: f32, y: f32) -> Self { + //a * x + b * y + Self(a.0.map2(b.0, |a, b| a.mul_add(x, b * y))) + } + + #[inline(always)] + fn lerp3(a: Self, b: Self, c: Self, x: f32, y: f32, z: f32) -> Self { + //a * x + b * y + c * z + Self( + a.0.map2(b.0.map2(c.0, |b, c| b.mul_add(y, c * z)), |a, bc| { + a.mul_add(x, bc) + }), + ) + } +} + impl<'a> Pipeline for Voxel { type Pixel = [u8; 4]; type Vertex = Vert; - type VsOut = Rgba; + type VsOut = VsOut; #[inline(always)] fn vert( @@ -75,12 +95,12 @@ impl<'a> Pipeline for Voxel { let light = Rgba::from_opaque(Rgb::from(*ao_level as f32 / 4.0 + 0.25)); let color = light * srgba_to_linear(Rgba::from_opaque(*col)); let position = (self.mvp * Vec4::from_point(*pos)).xyz().into_array(); - (position, color) + (position, VsOut(color)) } #[inline(always)] fn frag(&self, color: &Self::VsOut) -> Self::Pixel { - linear_to_srgba(*color) + linear_to_srgba(color.0) .map(|e| (e * 255.0) as u8) .into_array() } diff --git a/world/Cargo.toml b/world/Cargo.toml index 4dd4c22b71..0784d933a9 100644 --- a/world/Cargo.toml +++ b/world/Cargo.toml @@ -10,7 +10,7 @@ common = { package = "veloren-common", path = "../common" } bitvec = "0.15.2" image = "0.22.3" itertools = "0.8.2" -vek = "0.9.9" +vek = "0.10.0" noise = { version = "0.6.0", default-features = false } num = "0.2.0" ordered-float = "1.0"