From: Mikko Rasa Date: Wed, 9 Nov 2022 20:57:15 +0000 (+0200) Subject: Add setters for the individual parts of Transform X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c23855e4ac4a1ed3e20f06c95a28a665b657221c;p=libs%2Fgame.git Add setters for the individual parts of Transform --- 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; }