From 7eacf0d0a5ddef6da124be356a2f0e808bbb29eb Mon Sep 17 00:00:00 2001 From: Verox001 Date: Sun, 4 May 2025 12:55:12 +0200 Subject: [PATCH] Implemented scaling for instances --- simulator/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/simulator/src/main.rs b/simulator/src/main.rs index 21fb16a..882e4da 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -25,15 +25,17 @@ struct RenderInstance { position: cgmath::Vector3, rotation: cgmath::Quaternion, color: [f32; 3], + scale: f32 } impl RenderInstance { fn to_raw(&self) -> InstanceRaw { let model = cgmath::Matrix4::from_translation(self.position) - * cgmath::Matrix4::from(self.rotation); + * cgmath::Matrix4::from(self.rotation) + * cgmath::Matrix4::from_scale(self.scale); InstanceRaw { model: model.into(), - color: self.color + color: self.color, } } } @@ -228,6 +230,7 @@ impl<'a> State<'a> { 1 => [0.0, 0.0, 1.0], _ => [0.5, 0.5, 0.5], }, + scale: 0.1, }).collect::>() }; @@ -275,6 +278,7 @@ impl<'a> State<'a> { 1 => [0.0, 0.0, 1.0], _ => [0.5, 0.5, 0.5], }, + scale: 0.5, }).collect() };