Gazebo Rendering

API Reference

3.7.2
gz/rendering/Material.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 GZ_RENDERING_MATERIAL_HH_
18 #define GZ_RENDERING_MATERIAL_HH_
19 
20 #include <string>
21 #include <gz/math/Color.hh>
22 #include <gz/common/Material.hh>
23 #include "gz/rendering/config.hh"
25 #include "gz/rendering/Object.hh"
27 #include "gz/rendering/Export.hh"
28 
29 namespace ignition
30 {
31  namespace rendering
32  {
33  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
34  //
36  enum IGNITION_RENDERING_VISIBLE MaterialType
37  {
40 
42  MT_PBS = 1
43  };
44 
47  class IGNITION_RENDERING_VISIBLE Material :
48  public virtual Object
49  {
51  public: virtual ~Material() { }
52 
55  public: virtual bool LightingEnabled() const = 0;
56 
59  public: virtual void SetLightingEnabled(const bool _enabled) = 0;
60 
63  public: virtual void SetDepthCheckEnabled(bool _enabled) = 0;
64 
67  public: virtual bool DepthCheckEnabled() const = 0;
68 
71  public: virtual void SetDepthWriteEnabled(bool _enabled) = 0;
72 
75  public: virtual bool DepthWriteEnabled() const = 0;
76 
79  public: virtual math::Color Ambient() const = 0;
80 
86  public: virtual void SetAmbient(const double _r, const double _g,
87  const double _b, const double _a = 1.0) = 0;
88 
91  public: virtual void SetAmbient(const math::Color &_color) = 0;
92 
95  public: virtual math::Color Diffuse() const = 0;
96 
102  public: virtual void SetDiffuse(const double _r, const double _g,
103  const double _b, const double _a = 1.0) = 0;
104 
107  public: virtual void SetDiffuse(const math::Color &_color) = 0;
108 
111  public: virtual math::Color Specular() const = 0;
112 
118  public: virtual void SetSpecular(const double _r, const double _g,
119  const double _b, const double _a = 1.0) = 0;
120 
123  public: virtual void SetSpecular(const math::Color &_color) = 0;
124 
127  public: virtual math::Color Emissive() const = 0;
128 
134  public: virtual void SetEmissive(const double _r, const double _g,
135  const double _b, const double _a = 1.0) = 0;
136 
139  public: virtual void SetEmissive(const math::Color &_color) = 0;
140 
143  public: virtual double Shininess() const = 0;
144 
147  public: virtual void SetShininess(const double _shininess) = 0;
148 
151  public: virtual double Transparency() const = 0;
152 
156  public: virtual void SetDepthMaterial(const double far,
157  const double near) = 0;
158 
161  public: virtual void SetTransparency(const double _transparency) = 0;
162 
165  public: virtual double Reflectivity() const = 0;
166 
169  public: virtual void SetReflectivity(const double _reflectivity) = 0;
170 
173  public: virtual bool CastShadows() const = 0;
174 
177  public: virtual void SetCastShadows(const bool _castShadows) = 0;
178 
181  public: virtual bool ReceiveShadows() const = 0;
182 
185  public: virtual void SetReceiveShadows(const bool _receiveShadows) = 0;
186 
189  public: virtual bool ReflectionEnabled() const = 0;
190 
193  public: virtual void SetReflectionEnabled(const bool _enabled) = 0;
194 
197  public: virtual bool HasTexture() const = 0;
198 
201  public: virtual std::string Texture() const = 0;
202 
205  public: virtual void SetTexture(const std::string &_texture) = 0;
206 
208  public: virtual void ClearTexture() = 0;
209 
212  public: virtual bool HasNormalMap() const = 0;
213 
216  public: virtual std::string NormalMap() const = 0;
217 
220  public: virtual void SetNormalMap(const std::string &_normalMap) = 0;
221 
223  public: virtual void ClearNormalMap() = 0;
224 
227  public: virtual bool HasRoughnessMap() const = 0;
228 
231  public: virtual std::string RoughnessMap() const = 0;
232 
235  public: virtual void SetRoughnessMap(
236  const std::string &_roughnessMap) = 0;
237 
239  public: virtual void ClearRoughnessMap() = 0;
240 
243  public: virtual bool HasMetalnessMap() const = 0;
244 
247  public: virtual std::string MetalnessMap() const = 0;
248 
251  public: virtual void SetMetalnessMap(
252  const std::string &_metalnessMap) = 0;
253 
255  public: virtual void ClearMetalnessMap() = 0;
256 
259  public: virtual bool HasEnvironmentMap() const = 0;
260 
263  public: virtual std::string EnvironmentMap() const = 0;
264 
267  public: virtual void SetEnvironmentMap(
268  const std::string &_metalnessMap) = 0;
269 
271  public: virtual void ClearEnvironmentMap() = 0;
272 
275  public: virtual bool HasEmissiveMap() const = 0;
276 
279  public: virtual std::string EmissiveMap() const = 0;
280 
283  public: virtual void SetEmissiveMap(
284  const std::string &_emissiveMap) = 0;
285 
287  public: virtual void ClearEmissiveMap() = 0;
288 
291  public: virtual void SetRoughness(const float _roughness) = 0;
292 
295  public: virtual float Roughness() const = 0;
296 
299  public: virtual void SetMetalness(const float _metalness) = 0;
300 
303  public: virtual float Metalness() const = 0;
304 
306  public: virtual enum MaterialType Type() const = 0;
307 
310  public: virtual enum ShaderType ShaderType() const = 0;
311 
314  public: virtual void SetShaderType(enum ShaderType _type) = 0;
315 
318  public: virtual MaterialPtr Clone(const std::string &_name = "")
319  const = 0;
320 
323  public: virtual void CopyFrom(ConstMaterialPtr _material) = 0;
324 
327  public: virtual void CopyFrom(const common::Material &_material) = 0;
328 
331  public: virtual std::string VertexShader() const = 0;
332 
335  public: virtual ShaderParamsPtr VertexShaderParams() = 0;
336 
339  public: virtual void SetVertexShader(const std::string &_path) = 0;
340 
343  public: virtual std::string FragmentShader() const = 0;
344 
347  public: virtual ShaderParamsPtr FragmentShaderParams() = 0;
348 
351  public: virtual void SetFragmentShader(const std::string &_path) = 0;
352  };
353  }
354  }
355 }
356 #endif
virtual bool HasEnvironmentMap() const =0
Determine if this material has a environment map.
MaterialType
An enum for the type of material.
Definition: gz/rendering/Material.hh:36
virtual void SetCastShadows(const bool _castShadows)=0
Specify if this material casts shadows.
virtual bool ReflectionEnabled() const =0
Determine if this material has a reflection.
@ MT_PBS
Physically Based Shading.
Definition: gz/rendering/Material.hh:42
virtual double Reflectivity() const =0
Get the reflectivity value.
STL class.
virtual void ClearEmissiveMap()=0
Removes any emissive map mapped to this material.
STL class.
virtual std::string Texture() const =0
Get the URI of the texture file.
virtual void SetAmbient(const double _r, const double _g, const double _b, const double _a=1.0)=0
Set the ambient color.
virtual bool HasNormalMap() const =0
Determine if this material has a normal map.
virtual std::string RoughnessMap() const =0
Get the URI of the roughness map file.
virtual bool DepthCheckEnabled() const =0
Determine if depth buffer checking is enabled.
virtual void SetNormalMap(const std::string &_normalMap)=0
Set the material normal map.
virtual std::string FragmentShader() const =0
Get path to the fragment shader.
virtual void SetDepthMaterial(const double far, const double near)=0
Configuration for Depth Material.
virtual std::string VertexShader() const =0
Get path to the vertex shader.
virtual void ClearTexture()=0
Removes any texture mapped to this material.
virtual std::string NormalMap() const =0
Get the URI of the normal map file.
virtual bool HasRoughnessMap() const =0
Determine if this material has a roughness map.
virtual ~Material()
Deconstructor.
Definition: gz/rendering/Material.hh:51
virtual enum ShaderType ShaderType() const =0
Get the ShaderType value.
virtual ShaderParamsPtr VertexShaderParams()=0
Get params for the vertex shader.
virtual void SetVertexShader(const std::string &_path)=0
Set the vertex shader.
virtual void SetShaderType(enum ShaderType _type)=0
Set the ShaderType value.
virtual std::string EmissiveMap() const =0
Get the URI of the emissive map file.
virtual void SetDepthWriteEnabled(bool _enabled)=0
Specify if depth buffer writing is enabled.
virtual void SetRoughness(const float _roughness)=0
Set the roughness value. Only affects material of type MT_PBS.
virtual bool HasTexture() const =0
Determine if this material has a texture.
virtual float Roughness() const =0
Get the roughness value of this material.
virtual bool LightingEnabled() const =0
Determine if lighting affects this material.
virtual bool HasMetalnessMap() const =0
Determine if this material has a metalness map.
virtual math::Color Diffuse() const =0
Get the diffuse color.
virtual void SetMetalnessMap(const std::string &_metalnessMap)=0
Set the material metalness map.
virtual void SetDiffuse(const double _r, const double _g, const double _b, const double _a=1.0)=0
Set the diffuse color.
virtual float Metalness() const =0
Get the metalness value of this material.
virtual math::Color Emissive() const =0
Get the emissive color.
virtual MaterialPtr Clone(const std::string &_name="") const =0
Clone this material.
@ MT_CLASSIC
Classic shading, i.e. variants of Phong.
Definition: gz/rendering/Material.hh:39
virtual void ClearRoughnessMap()=0
Removes any roughness map mapped to this material.
virtual std::string MetalnessMap() const =0
Get the URI of the metalness map file.
virtual math::Color Ambient() const =0
Get the ambient color.
virtual std::string EnvironmentMap() const =0
Get the URI of the environment map file.
virtual void SetTransparency(const double _transparency)=0
Set the transparency value.
virtual math::Color Specular() const =0
Get the specular color.
virtual void SetLightingEnabled(const bool _enabled)=0
Specify if lighting affects this material.
virtual bool CastShadows() const =0
Determine if this material casts shadows.
virtual void SetShininess(const double _shininess)=0
Set the shininess value.
virtual void SetReflectionEnabled(const bool _enabled)=0
Specify if this material has a reflection.
virtual void SetEmissiveMap(const std::string &_emissiveMap)=0
Set the material emissive map.
virtual void CopyFrom(ConstMaterialPtr _material)=0
Copy properties from given Material.
virtual void SetFragmentShader(const std::string &_path)=0
Set the fragment shader.
Represents an object present in the scene graph. This includes sub-meshes, materials,...
Definition: gz/rendering/Object.hh:34
virtual void ClearNormalMap()=0
Removes any normal map mapped to this material.
virtual void SetSpecular(const double _r, const double _g, const double _b, const double _a=1.0)=0
Set the specular color.
virtual void SetMetalness(const float _metalness)=0
Set the metalness value. Only affects material of type MT_PBS.
virtual bool HasEmissiveMap() const =0
Determine if this material has an emissive map.
virtual ShaderParamsPtr FragmentShaderParams()=0
Get params for the fragment shader.
virtual void SetReceiveShadows(const bool _receiveShadows)=0
Specify if this material receives shadows.
ShaderType
Available types of shaders. Note that not all rendering-engines will be able to use each type....
Definition: gz/rendering/ShaderType.hh:34
virtual void ClearEnvironmentMap()=0
Removes any environment map mapped to this material.
virtual void SetRoughnessMap(const std::string &_roughnessMap)=0
Set the material roughness map.
virtual void SetEmissive(const double _r, const double _g, const double _b, const double _a=1.0)=0
Set the emissive color.
Represents a surface material of a Geometry.
Definition: gz/rendering/Material.hh:47
virtual bool ReceiveShadows() const =0
Determine if this material receives shadows.
virtual double Shininess() const =0
Get the shininess value.
virtual void SetDepthCheckEnabled(bool _enabled)=0
Specify if depth buffer checking is enabled.
virtual double Transparency() const =0
Get the transparency value.
virtual void SetTexture(const std::string &_texture)=0
Set the material texture.
virtual void ClearMetalnessMap()=0
Removes any metalness map mapped to this material.
virtual enum MaterialType Type() const =0
Removes any metalness map mapped to this material.
virtual void SetReflectivity(const double _reflectivity)=0
Set the reflectivity value.
virtual void SetEnvironmentMap(const std::string &_metalnessMap)=0
Set the material environment map.
virtual bool DepthWriteEnabled() const =0
Determine if depth buffer writing is enabled.