Choreonoid  1.8
Material.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_MATERIAL_H
7 #define CNOID_BODY_MATERIAL_H
8 
9 #include <cnoid/Referenced>
10 #include <cnoid/ValueTree>
11 #include "exportdecl.h"
12 
13 namespace cnoid {
14 
15 class CNOID_EXPORT Material : public Referenced
16 {
17 public:
18  Material();
19  Material(const Mapping* info);
20  Material(const Material& org);
21  ~Material();
22 
23  static int idOfName(const std::string& name);
24  [[deprecated("Use idOfName")]]
25  static int id(const std::string& name) { return idOfName(name); }
26 
27  static std::string nameOfId(int id);
28  [[deprecated("Use nameOfId")]]
29  static std::string name(int id) { return nameOfId(id); }
30 
31  const std::string& name() const { return name_; }
32  void setName(const std::string& name) { name_ = name; }
33  double roughness() const { return roughness_; }
34  void setRoughness(double r) { roughness_ = r; }
35  double viscosity() const { return viscosity_; }
36  void setViscosity(double v) { viscosity_ = v; }
37 
38  Mapping* info() { return info_; }
39  const Mapping* info() const { return info_; }
40  template<typename T> T info(const std::string& key, const T& defaultValue) const;
41 
42  void resetInfo(Mapping* info) { info_ = info; }
43 
44 private:
45  std::string name_;
46  double roughness_;
47  double viscosity_;
48  MappingPtr info_;
49 };
50 
51 template<> CNOID_EXPORT bool Material::info(const std::string& key, const bool& defaultValue) const;
52 template<> CNOID_EXPORT int Material::info(const std::string& key, const int& defaultValue) const;
53 template<> CNOID_EXPORT double Material::info(const std::string& key, const double& defaultValue) const;
54 
56 
57 }
58 
59 #endif
cnoid::Material::info
const Mapping * info() const
Definition: Material.h:39
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::Material::setName
void setName(const std::string &name)
Definition: Material.h:32
cnoid::Material::name
const std::string & name() const
Definition: Material.h:31
cnoid::Material::setViscosity
void setViscosity(double v)
Definition: Material.h:36
cnoid::Material::resetInfo
void resetInfo(Mapping *info)
Definition: Material.h:42
cnoid::Material::info
Mapping * info()
Definition: Material.h:38
cnoid::Material::setRoughness
void setRoughness(double r)
Definition: Material.h:34
cnoid::Material
Definition: Material.h:15
cnoid::ref_ptr< Mapping >
cnoid::MaterialPtr
ref_ptr< Material > MaterialPtr
Definition: Material.h:55
cnoid::Material::roughness
double roughness() const
Definition: Material.h:33
cnoid::Material::name
static std::string name(int id)
Definition: Material.h:29
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Material::id
static int id(const std::string &name)
Definition: Material.h:25
cnoid::Referenced
Definition: Referenced.h:54
cnoid::Material::viscosity
double viscosity() const
Definition: Material.h:35