Go to the documentation of this file.
17 #ifndef GZ_RENDERING_BASE_BASEAXISVISUAL_HH_
18 #define GZ_RENDERING_BASE_BASEAXISVISUAL_HH_
28 inline namespace IGNITION_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,
IGN_PI / 2, 0);
145 xArrow->SetMaterial(
"Default/TransRed");
146 this->AddChild(xArrow);
149 yArrow->SetLocalPosition(0, 0, 0);
150 yArrow->SetLocalRotation(-
IGN_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);
virtual math::Vector3d LocalScale() const override
Get the local scale.
Definition: gz/rendering/base/BaseAxisVisual.hh:91
BaseAxisVisual()
Definition: gz/rendering/base/BaseAxisVisual.hh:63
virtual void Destroy() override
Destroy any resources associated with this object. Invoking any other functions after destroying an o...
Definition: gz/rendering/base/BaseAxisVisual.hh:75
Manages a single scene-graph. This class updates scene-wide properties and holds the root scene node....
Definition: gz/rendering/Scene.hh:49
virtual void SetVisible(bool _visible) override
Specify if this visual is visible.
Definition: gz/rendering/base/BaseAxisVisual.hh:163
static const Vector3 Zero
void ShowAxisHead(bool _b) override
set true to show the axis heads, false otherwise
Definition: gz/rendering/base/BaseAxisVisual.hh:111
Definition: gz/rendering/base/BaseAxisVisual.hh:31
Represents a axis composite visual.
Definition: gz/rendering/AxisVisual.hh:31
virtual ArrowVisualPtr CreateArrowVisual()=0
Create new arrow visual. A unique ID and name will automatically be assigned to the visual.
virtual ~BaseAxisVisual()
Definition: gz/rendering/base/BaseAxisVisual.hh:69
virtual void Init() override
Definition: gz/rendering/base/BaseAxisVisual.hh:138
virtual void SetLocalScale(const math::Vector3d &_scale) override
Set the local scale.
Definition: gz/rendering/base/BaseAxisVisual.hh:101