From c23855e4ac4a1ed3e20f06c95a28a665b657221c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 9 Nov 2022 22:57:15 +0200 Subject: [PATCH] Add setters for the individual parts of Transform --- source/game/transform.cpp | 15 +++++++++++++++ source/game/transform.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/source/game/transform.cpp b/source/game/transform.cpp index 6af24c0..e5655f9 100644 --- a/source/game/transform.cpp +++ b/source/game/transform.cpp @@ -12,6 +12,21 @@ void Transform::set_values(const TransformValues &v) values = v; } +void Transform::set_position(const LinAl::Vector &p) +{ + values.position = p; +} + +void Transform::set_rotation(const Geometry::Quaternion &r) +{ + values.rotation = normalize(r); +} + +void Transform::set_scale(const LinAl::Vector &s) +{ + values.scale = s; +} + void Transform::update_world_matrix(const Transform *parent) { using Affine = Geometry::AffineTransform; diff --git a/source/game/transform.h b/source/game/transform.h index d698499..6030760 100644 --- a/source/game/transform.h +++ b/source/game/transform.h @@ -26,6 +26,9 @@ public: Transform(Handle); void set_values(const TransformValues &); + void set_position(const LinAl::Vector &); + void set_rotation(const Geometry::Quaternion &); + void set_scale(const LinAl::Vector &); const TransformValues &get_values() const { return values; } const LinAl::Vector &get_position() const { return values.position; } const Geometry::Quaternion &get_rotation() const { return values.rotation; } -- 2.43.0