Gazebo Rendering

API Reference

3.7.2
gz/rendering/Visual.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef GZ_RENDERING_VISUAL_HH_
18 #define GZ_RENDERING_VISUAL_HH_
19 
20 #include <variant>
21 #include <string>
22 #include "gz/rendering/config.hh"
23 #include "gz/rendering/Node.hh"
24 
25 namespace ignition
26 {
27  namespace rendering
28  {
29  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
30  //
31  using Variant = std::variant<int, float, double, std::string>;
32 
36  class IGNITION_RENDERING_VISIBLE Visual :
37  public virtual Node
38  {
40  public: virtual ~Visual() { }
41 
44  public: virtual unsigned int GeometryCount() const = 0;
45 
49  public: virtual bool HasGeometry(ConstGeometryPtr _geometry) const = 0;
50 
55  public: virtual GeometryPtr GeometryByIndex(
56  unsigned int _index) const = 0;
57 
61  public: virtual void AddGeometry(GeometryPtr _geometry) = 0;
62 
67  public: virtual GeometryPtr RemoveGeometry(GeometryPtr _geometry) = 0;
68 
73  public: virtual GeometryPtr RemoveGeometryByIndex(
74  unsigned int _index) = 0;
75 
77  public: virtual void RemoveGeometries() = 0;
78 
85  public: virtual void SetMaterial(const std::string &_name,
86  bool _unique = true) = 0;
87 
91  public: virtual void SetMaterial(MaterialPtr _material,
92  bool _unique = true) = 0;
93 
97  public: virtual void SetChildMaterial(MaterialPtr _material,
98  bool _unique = true) = 0;
99 
103  public: virtual void SetGeometryMaterial(MaterialPtr _material,
104  bool _unique = true) = 0;
105 
110  public: virtual MaterialPtr Material() = 0;
111 
114  public: virtual void SetVisible(bool _visible) = 0;
115 
119  public: virtual void SetUserData(const std::string &_key,
120  Variant _value) = 0;
121 
125  public: virtual Variant UserData(const std::string &_key) const = 0;
126  };
127  }
128  }
129 }
130 #endif
virtual unsigned int GeometryCount() const =0
Get the number of geometries attached to this visual.
Represents a single posable node in the scene graph.
Definition: gz/rendering/Node.hh:37
STL class.
STL class.
virtual void SetUserData(const std::string &_key, Variant _value)=0
Store any custom data associated with this visual.
virtual void SetMaterial(const std::string &_name, bool _unique=true)=0
Set the material for all attached visuals and geometries. The specified material will be retrieved fr...
virtual GeometryPtr RemoveGeometry(GeometryPtr _geometry)=0
Remove the given geometry from this visual. If the given node is not a child of this visual,...
virtual GeometryPtr RemoveGeometryByIndex(unsigned int _index)=0
Remove the geometry at the given index from this visual. If the specified node is not attached this v...
virtual Variant UserData(const std::string &_key) const =0
Get custom data stored in this visual.
virtual GeometryPtr GeometryByIndex(unsigned int _index) const =0
Get geometry at given index. If no geometry exists at given index, NULL will be returned.
virtual void AddGeometry(GeometryPtr _geometry)=0
Add the given geometry to this visual. If the given node is already attached, no work will be done.
virtual bool HasGeometry(ConstGeometryPtr _geometry) const =0
Determine if given geometry is attached to this visual.
Represents a visual node in a scene graph. A Visual is the only node that can have Geometry and other...
Definition: gz/rendering/Visual.hh:36
virtual ~Visual()
Deconstructor.
Definition: gz/rendering/Visual.hh:40
virtual MaterialPtr Material()=0
Get the material assigned to attached visuals and geometries.
virtual void SetVisible(bool _visible)=0
Specify if this visual is visible.
std::variant< int, float, double, std::string > Variant
Definition: gz/rendering/Visual.hh:31
Represents a surface material of a Geometry.
Definition: gz/rendering/Material.hh:47
virtual void RemoveGeometries()=0
Remove all attached geometries from this visual.
virtual void SetGeometryMaterial(MaterialPtr _material, bool _unique=true)=0
Set the material for all attached geometries only.
virtual void SetChildMaterial(MaterialPtr _material, bool _unique=true)=0
Set the material for all attached visuals only.