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 
129  public: float RenderOrder() const;
130 
133  public: void SetRenderOrder(const float _renderOrder);
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
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
ShaderType
Definition: Material.hh:36
This class contains visual material properties.
Definition: Material.hh:45
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition: Pbr.hh:261
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
namespace for Simulation Description Format parser
Definition: Actor.hh:32
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95