17 #ifndef GZ_RENDERING_BASE_BASEARROWVISUAL_HH_
18 #define GZ_RENDERING_BASE_BASEARROWVISUAL_HH_
22 #include <gz/common/MeshManager.hh>
31 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
45 protected:
virtual void Destroy()
override;
48 public:
virtual VisualPtr Head()
const override;
51 public:
virtual VisualPtr Shaft()
const override;
54 public:
virtual VisualPtr Rotation()
const override;
57 public:
virtual void ShowArrowHead(
bool _b)
override;
60 public:
virtual void ShowArrowShaft(
bool _b)
override;
63 public:
virtual void ShowArrowRotation(
bool _b)
override;
66 public:
virtual void SetVisible(
bool _visible)
override;
69 protected:
virtual void Init()
override;
72 protected:
bool rotationVisible =
false;
91 while (this->ChildCount() > 0u)
93 auto visual = std::dynamic_pointer_cast<Visual>(this->ChildByIndex(0));
106 return std::dynamic_pointer_cast<Visual>(this->ChildByIndex(2));
113 return std::dynamic_pointer_cast<Visual>(this->ChildByIndex(1));
120 return std::dynamic_pointer_cast<Visual>(this->ChildByIndex(0));
127 NodePtr child = this->ChildByIndex(2);
128 VisualPtr visual = std::dynamic_pointer_cast<Visual>(child);
131 visual->SetVisible(_b);
139 NodePtr child = this->ChildByIndex(1);
140 VisualPtr visual = std::dynamic_pointer_cast<Visual>(child);
143 visual->SetVisible(_b);
151 NodePtr child = this->ChildByIndex(0);
152 VisualPtr visual = std::dynamic_pointer_cast<Visual>(child);
155 visual->SetVisible(_b);
156 this->rotationVisible = _b;
164 T::SetVisible(_visible);
166 NodePtr child = this->ChildByIndex(0);
167 VisualPtr visual = std::dynamic_pointer_cast<Visual>(child);
174 visual->SetVisible(this->rotationVisible && _visible);
185 cone->AddGeometry(this->
Scene()->CreateCone());
186 cone->SetOrigin(0, 0, -0.5);
187 cone->SetLocalPosition(0, 0, 0);
188 cone->SetLocalScale(0.1, 0.1, 0.25);
189 this->AddChild(cone);
192 cylinder->AddGeometry(this->
Scene()->CreateCylinder());
193 cylinder->SetOrigin(0, 0, 0.5);
194 cylinder->SetLocalPosition(0, 0, 0);
195 cylinder->SetLocalScale(0.05, 0.05, 0.5);
196 this->AddChild(cylinder);
200 if (!meshMgr->
HasMesh(rotMeshName))
201 meshMgr->
CreateTube(rotMeshName, 0.070f, 0.075f, 0.01f, 1, 32);
204 rotationVis->AddGeometry(this->
Scene()->CreateMesh(rotMeshName));
205 rotationVis->SetOrigin(0, 0, -0.125);
206 rotationVis->SetLocalPosition(0, 0, 0);
207 rotationVis->SetVisible(this->rotationVisible);
208 this->AddChild(rotationVis);
210 this->SetOrigin(0, 0, -0.5);