From e406ac15cbe88f599aa70ca58946d99c2b0654a3 Mon Sep 17 00:00:00 2001 From: Elias Stepanik <40958815+eliasstepanik@users.noreply.github.com> Date: Mon, 9 Jun 2025 19:29:18 +0200 Subject: [PATCH] Fix color serialization and enable serde feature --- client/Cargo.toml | 3 ++- client/src/plugins/environment/systems/voxels/structure.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/Cargo.toml b/client/Cargo.toml index 2ec4468..0de68ce 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -9,7 +9,7 @@ build = "build.rs" [dependencies] -bevy = { version = "0.15.1", features = ["jpeg", "trace_tracy", "trace_tracy_memory"] } +bevy = { version = "0.15.1", features = ["jpeg", "trace_tracy", "trace_tracy_memory", "serialize"] } rand = "0.8.5" serde = { version = "1.0", features = ["derive"] } toml = "0.8" @@ -21,3 +21,4 @@ smallvec = "1.14.0" once_cell = "1.21.3" rayon = "1.10.0" bincode = "1.3" + diff --git a/client/src/plugins/environment/systems/voxels/structure.rs b/client/src/plugins/environment/systems/voxels/structure.rs index ab5057c..06ab422 100644 --- a/client/src/plugins/environment/systems/voxels/structure.rs +++ b/client/src/plugins/environment/systems/voxels/structure.rs @@ -7,7 +7,7 @@ fn serialize_color(color: &Color, serializer: S) -> Result where S: Serializer, { - let [r, g, b, a] = color.as_linear_rgba_f32(); + let [r, g, b, a] = color.to_linear().to_f32_array(); [r, g, b, a].serialize(serializer) } @@ -16,7 +16,7 @@ where D: Deserializer<'de>, { let arr: [f32; 4] = Deserialize::deserialize(deserializer)?; - Ok(Color::rgba_linear(arr[0], arr[1], arr[2], arr[3])) + Ok(Color::linear_rgba(arr[0], arr[1], arr[2], arr[3])) }