diff --git a/Changelog.md b/Changelog.md index cfb4b7417..68ea62afc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,9 @@ ### Ignition Rendering 4.0.0 +1. Scale BaseAxis properly + * [Pull request #88](https://github.com/ignitionrobotics/ign-rendering/pull/88) + 1. Add ogre2 AxisVisual and ArrowVisual * [Pull request 87](https://github.com/ignitionrobotics/ign-rendering/pull/87) diff --git a/include/ignition/rendering/base/BaseAxisVisual.hh b/include/ignition/rendering/base/BaseAxisVisual.hh index 486971236..c91ecedfd 100644 --- a/include/ignition/rendering/base/BaseAxisVisual.hh +++ b/include/ignition/rendering/base/BaseAxisVisual.hh @@ -36,7 +36,14 @@ namespace ignition public: virtual ~BaseAxisVisual(); - public: virtual void Init(); + public: virtual void Init() override; + + // Documentation inherited. + public: virtual void SetLocalScale( + const math::Vector3d &_scale) override; + + // Documentation inherited. + public: virtual math::Vector3d LocalScale() const override; }; ////////////////////////////////////////////////// @@ -51,6 +58,26 @@ namespace ignition { } + ////////////////////////////////////////////////// + template + math::Vector3d BaseAxisVisual::LocalScale() const + { + if (this->ChildCount() > 0) { + return this->ChildByIndex(0)->LocalScale(); + } + return math::Vector3d::Zero; + } + + ////////////////////////////////////////////////// + template + void BaseAxisVisual::SetLocalScale(const math::Vector3d &_scale) + { + for (unsigned int i = 0; i < this->ChildCount(); ++i) + this->ChildByIndex(i)->SetLocalScale(_scale.X(), + _scale.Y(), + _scale.Z()); + } + ////////////////////////////////////////////////// template void BaseAxisVisual::Init()