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: ignition::math::Color Ambient() const;
84 
89  public: void SetAmbient(const ignition::math::Color &_color) const;
90 
95  public: ignition::math::Color Diffuse() const;
96 
101  public: void SetDiffuse(const ignition::math::Color &_color) const;
102 
107  public: ignition::math::Color Specular() const;
108 
113  public: void SetSpecular(const ignition::math::Color &_color) const;
114 
119  public: ignition::math::Color Emissive() const;
120 
125  public: void SetEmissive(const ignition::math::Color &_color) const;
126 
130  public: bool Lighting() const;
131 
134  public: void SetLighting(const bool _lighting);
135 
140  public: sdf::ElementPtr Element() const;
141 
145  public: std::string ScriptUri() const;
146 
149  public: void SetScriptUri(const std::string &_uri);
150 
156  public: std::string ScriptName() const;
157 
161  public: void SetScriptName(const std::string &_name);
162 
165  public: ShaderType Shader() const;
166 
169  public: void SetShader(const ShaderType &_type);
170 
175  public: std::string NormalMap() const;
176 
179  public: void SetNormalMap(const std::string &_map);
180 
183  public: void SetPbrMaterial(const Pbr &_pbr);
184 
187  public: Pbr *PbrMaterial() const;
188 
191  public: const std::string &FilePath() const;
192 
195  public: void SetFilePath(const std::string &_filePath);
196 
198  private: MaterialPrivate *dataPtr = nullptr;
199  };
200  }
201 }
202 #endif
This class contains visual material properties.
Definition: Material.hh:45
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition: Pbr.hh:246
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
namespace for Simulation Description Format parser
Definition: Actor.hh:32
ShaderType
Definition: Material.hh:36