Loading...
Searching...
No Matches
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
27namespace 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,
40 NORMAL_MAP_OBJECTSPACE = 2,
41 NORMAL_MAP_TANGENTSPACE = 3,
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
108 public: float RenderOrder() const;
109
112 public: void SetRenderOrder(const float _renderOrder);
113
117 public: bool Lighting() const;
118
121 public: void SetLighting(const bool _lighting);
122
126 public: bool DoubleSided() const;
127
130 public: void SetDoubleSided(bool _doubleSided);
131
136 public: sdf::ElementPtr Element() const;
137
141 public: std::string ScriptUri() const;
142
145 public: void SetScriptUri(const std::string &_uri);
146
152 public: std::string ScriptName() const;
153
157 public: void SetScriptName(const std::string &_name);
158
161 public: ShaderType Shader() const;
162
165 public: void SetShader(const ShaderType &_type);
166
171 public: std::string NormalMap() const;
172
175 public: void SetNormalMap(const std::string &_map);
176
179 public: void SetPbrMaterial(const Pbr &_pbr);
180
183 public: const Pbr *PbrMaterial() const;
184
187 public: const std::string &FilePath() const;
188
191 public: void SetFilePath(const std::string &_filePath);
192
194 IGN_UTILS_IMPL_PTR(dataPtr)
195 };
196 }
197}
198#endif
This class contains visual material properties.
Definition Material.hh:46
void SetLighting(const bool _lighting)
Set whether dynamic lighting is enabled.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
ignition::math::Color Emissive() const
Get the emissive color.
void SetPbrMaterial(const Pbr &_pbr)
Set the Physically Based Rendering (PBR) material.
ignition::math::Color Specular() const
Get the specular color.
bool Lighting() const
Get whether dynamic lighting is enabled.
std::string ScriptUri() const
Get the URI of the material script, if one has been set.
Errors Load(ElementPtr _sdf)
Load the material based on a element pointer.
const Pbr * PbrMaterial() const
Get the Physically Based Rendering (PBR) material.
std::string ScriptName() const
Get the name of the material script, or empty if one has not been specified.
void SetScriptUri(const std::string &_uri)
Set the URI of the material script.
ignition::math::Color Ambient() const
Get the ambient color.
ShaderType Shader() const
Get the type of shader.
void SetDoubleSided(bool _doubleSided)
Set whether double sided material is enabled.
const std::string & FilePath() const
The path to the file where this element was loaded from.
void SetEmissive(const ignition::math::Color &_color)
Set the emissive color.
ignition::math::Color Diffuse() const
Get the diffuse color.
void SetSpecular(const ignition::math::Color &_color)
Set the specular color.
void SetRenderOrder(const float _renderOrder)
Set render order.
Material()
Default constructor.
void SetAmbient(const ignition::math::Color &_color)
Set the ambient color.
void SetDiffuse(const ignition::math::Color &_color)
Set the diffuse color.
void SetFilePath(const std::string &_filePath)
Set the path to the file where this element was loaded from.
std::string NormalMap() const
Get the normal map filename.
void SetNormalMap(const std::string &_map)
Set the normal map filename.
float RenderOrder() const
Get render order.
void SetShader(const ShaderType &_type)
Set the type of shader.
void SetScriptName(const std::string &_name)
Set the name of the material script.
bool DoubleSided() const
Get whether double sided material is enabled.
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition Pbr.hh:239
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:106
std::shared_ptr< Element > ElementPtr
Definition Element.hh:54
ShaderType
Definition Material.hh:37
namespace for Simulation Description Format parser
Definition Actor.hh:34
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:41