17 #ifndef GZ_RENDERING_BASE_BASEAXISVISUAL_HH_
18 #define GZ_RENDERING_BASE_BASEAXISVISUAL_HH_
28 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
39 public:
virtual void Init()
override;
42 protected:
virtual void Destroy()
override;
45 public:
virtual void SetLocalScale(
52 public:
void ShowAxisHead(
bool _b)
override;
55 public:
void ShowAxisHead(
unsigned int _axis,
bool _b)
override;
58 public:
virtual void SetVisible(
bool _visible)
override;
77 for (
unsigned int i = 0; i < this->ChildCount(); ++i)
79 auto arrow = std::dynamic_pointer_cast<rendering::ArrowVisual>(
80 this->ChildByIndex(i));
93 if (this->ChildCount() > 0) {
94 return this->ChildByIndex(0)->LocalScale();
103 for (
unsigned int i = 0; i < this->ChildCount(); ++i)
104 this->ChildByIndex(i)->SetLocalScale(_scale.
X(),
113 for (
unsigned int i = 0; i < this->ChildCount(); ++i)
115 auto arrow = std::dynamic_pointer_cast<rendering::ArrowVisual>(
116 this->ChildByIndex(i));
119 arrow->ShowArrowHead(_b);
128 auto arrow = std::dynamic_pointer_cast<rendering::ArrowVisual>(
129 this->ChildByIndex(2u - _axis));
132 arrow->ShowArrowHead(_b);
143 xArrow->SetLocalPosition(0, 0, 0);
144 xArrow->SetLocalRotation(0,
GZ_PI / 2, 0);
145 xArrow->SetMaterial(
"Default/TransRed");
146 this->AddChild(xArrow);
149 yArrow->SetLocalPosition(0, 0, 0);
150 yArrow->SetLocalRotation(-
GZ_PI / 2, 0, 0);
151 yArrow->SetMaterial(
"Default/TransGreen");
152 this->AddChild(yArrow);
155 zArrow->SetLocalPosition(0, 0, 0);
156 zArrow->SetLocalRotation(0, 0, 0);
157 zArrow->SetMaterial(
"Default/TransBlue");
158 this->AddChild(zArrow);
165 T::SetVisible(_visible);
167 for (
unsigned int i = 0; i < this->ChildCount(); ++i)
169 auto arrow = std::dynamic_pointer_cast<rendering::ArrowVisual>(
170 this->ChildByIndex(i));
171 if (arrow !=
nullptr)
172 arrow->SetVisible(_visible);