Material.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018 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 SDF_MATERIAL_HH_
18 #define SDF_MATERIAL_HH_
19 
20 #include <string>
21 #include "sdf/Element.hh"
22 #include "sdf/Types.hh"
23 #include "sdf/sdf_config.h"
24 #include "sdf/system_util.hh"
25 
26 namespace sdf
27 {
28  // Inline bracket to help doxygen filtering.
29  inline namespace SDF_VERSION_NAMESPACE {
30  //
31 
32  // Forward declarations.
33  class MaterialPrivate;
34  class Pbr;
35 
36  enum class ShaderType : int
37  {
38  PIXEL = 0,
39  VERTEX = 1,
42  };
43 
46  {
48  public: Material();
49 
52  public: Material(const Material &_material);
53 
56  public: Material(Material &&_material) noexcept;
57 
59  public: ~Material();
60 
64  public: Material &operator=(const Material &_material);
65 
69  public: Material &operator=(Material &&_material);
70 
77  public: Errors Load(ElementPtr _sdf);
78 
83  public: gz::math::Color Ambient() const;
84 
89  public: void SetAmbient(const gz::math::Color &_color) const;
90 
95  public: gz::math::Color Diffuse() const;
96 
101  public: void SetDiffuse(const gz::math::Color &_color) const;
102 
107  public: gz::math::Color Specular() const;
108 
113  public: void SetSpecular(const gz::math::Color &_color) const;
114 
117  public: double Shininess() const;
118 
121  public: void SetShininess(const double _shininess);
122 
127  public: gz::math::Color Emissive() const;
128 
133  public: void SetEmissive(const gz::math::Color &_color) const;
134 
138  public: bool Lighting() const;
139 
142  public: void SetLighting(const bool _lighting);
143 
147  public: bool DoubleSided() const;
148 
151  public: void SetDoubleSided(bool _doubleSided);
152 
157  public: sdf::ElementPtr Element() const;
158 
162  public: std::string ScriptUri() const;
163 
166  public: void SetScriptUri(const std::string &_uri);
167 
173  public: std::string ScriptName() const;
174 
178  public: void SetScriptName(const std::string &_name);
179 
182  public: ShaderType Shader() const;
183 
186  public: void SetShader(const ShaderType &_type);
187 
192  public: std::string NormalMap() const;
193 
196  public: void SetNormalMap(const std::string &_map);
197 
200  public: void SetPbrMaterial(const Pbr &_pbr);
201 
204  public: Pbr *PbrMaterial() const;
205 
208  public: const std::string &FilePath() const;
209 
212  public: void SetFilePath(const std::string &_filePath);
213 
215  private: MaterialPrivate *dataPtr = nullptr;
216  };
217  }
218 }
219 #endif
sdf::v9::ShaderType::NORMAL_MAP_TANGENTSPACE
@ NORMAL_MAP_TANGENTSPACE
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
sdf::v9::ShaderType::PIXEL
@ PIXEL
sdf::v9::Material
This class contains visual material properties.
Definition: Material.hh:45
Types.hh
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::ShaderType::NORMAL_MAP_OBJECTSPACE
@ NORMAL_MAP_OBJECTSPACE
sdf::v9::ShaderType
ShaderType
Definition: Material.hh:36
sdf::v9::Pbr
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition: Pbr.hh:261
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
system_util.hh
sdf::v9::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::v9::ShaderType::VERTEX
@ VERTEX
Element.hh