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 <ignition/utils/ImplPtr.hh>
22 #include "sdf/Element.hh"
23 #include "sdf/Types.hh"
24 #include "sdf/sdf_config.h"
25 #include "sdf/system_util.hh"
26 
27 namespace sdf
28 {
29  // Inline bracket to help doxygen filtering.
30  inline namespace SDF_VERSION_NAMESPACE {
31  //
32 
33  // Forward declarations.
34  class Pbr;
35 
36  enum class ShaderType : int
37  {
38  PIXEL = 0,
39  VERTEX = 1,
42  };
43 
46  {
48  public: Material();
49 
56  public: Errors Load(ElementPtr _sdf);
57 
62  public: ignition::math::Color Ambient() const;
63 
68  public: void SetAmbient(const ignition::math::Color &_color);
69 
74  public: ignition::math::Color Diffuse() const;
75 
80  public: void SetDiffuse(const ignition::math::Color &_color);
81 
86  public: ignition::math::Color Specular() const;
87 
92  public: void SetSpecular(const ignition::math::Color &_color);
93 
98  public: ignition::math::Color Emissive() const;
99 
104  public: void SetEmissive(const ignition::math::Color &_color);
105 
110  public: float RenderOrder() const;
111 
115  public: void SetRenderOrder(const float _renderOrder);
116 
120  public: bool Lighting() const;
121 
124  public: void SetLighting(const bool _lighting);
125 
129  public: bool DoubleSided() const;
130 
133  public: void SetDoubleSided(bool _doubleSided);
134 
139  public: sdf::ElementPtr Element() const;
140 
144  public: std::string ScriptUri() const;
145 
148  public: void SetScriptUri(const std::string &_uri);
149 
155  public: std::string ScriptName() const;
156 
160  public: void SetScriptName(const std::string &_name);
161 
164  public: ShaderType Shader() const;
165 
168  public: void SetShader(const ShaderType &_type);
169 
174  public: std::string NormalMap() const;
175 
178  public: void SetNormalMap(const std::string &_map);
179 
182  public: void SetPbrMaterial(const Pbr &_pbr);
183 
186  public: const Pbr *PbrMaterial() const;
187 
190  public: const std::string &FilePath() const;
191 
194  public: void SetFilePath(const std::string &_filePath);
195 
201  public: sdf::ElementPtr ToElement() const;
202 
204  IGN_UTILS_IMPL_PTR(dataPtr)
205  };
206  }
207 }
208 #endif
sdf::v12::Pbr
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition: Pbr.hh:238
sdf::v12::ShaderType::VERTEX
@ VERTEX
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:34
sdf::v12::ShaderType::NORMAL_MAP_OBJECTSPACE
@ NORMAL_MAP_OBJECTSPACE
sdf::v12::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
Types.hh
sdf_config.h
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
sdf::v12::Element
class IGNITION_SDFORMAT_VISIBLE Element
Definition: Element.hh:50
sdf::v12::Material
This class contains visual material properties.
Definition: Material.hh:45
sdf::v12::ShaderType::NORMAL_MAP_TANGENTSPACE
@ NORMAL_MAP_TANGENTSPACE
sdf::v12::ShaderType::PIXEL
@ PIXEL
sdf::v12::ShaderType
ShaderType
Definition: Material.hh:36
system_util.hh
sdf::v12::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
Element.hh