Gazebo Rendering

API Reference

6.6.3
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 
167  public: virtual void SetAlphaFromTexture(bool _enabled,
168  double _alpha = 0.5, bool _twoSided = true) = 0;
169 
172  public: virtual bool TextureAlphaEnabled() const = 0;
173 
176  public: virtual double AlphaThreshold() const = 0;
177 
180  public: virtual bool TwoSidedEnabled() const = 0;
181 
184  public: virtual double Reflectivity() const = 0;
185 
188  public: virtual void SetReflectivity(const double _reflectivity) = 0;
189 
192  public: virtual bool CastShadows() const = 0;
193 
196  public: virtual void SetCastShadows(const bool _castShadows) = 0;
197 
200  public: virtual bool ReceiveShadows() const = 0;
201 
204  public: virtual void SetReceiveShadows(const bool _receiveShadows) = 0;
205 
208  public: virtual bool ReflectionEnabled() const = 0;
209 
212  public: virtual void SetReflectionEnabled(const bool _enabled) = 0;
213 
216  public: virtual bool HasTexture() const = 0;
217 
220  public: virtual std::string Texture() const = 0;
221 
224  public: virtual void SetTexture(const std::string &_texture) = 0;
225 
227  public: virtual void ClearTexture() = 0;
228 
231  public: virtual bool HasNormalMap() const = 0;
232 
235  public: virtual std::string NormalMap() const = 0;
236 
239  public: virtual void SetNormalMap(const std::string &_normalMap) = 0;
240 
242  public: virtual void ClearNormalMap() = 0;
243 
246  public: virtual bool HasRoughnessMap() const = 0;
247 
250  public: virtual std::string RoughnessMap() const = 0;
251 
254  public: virtual void SetRoughnessMap(
255  const std::string &_roughnessMap) = 0;
256 
258  public: virtual void ClearRoughnessMap() = 0;
259 
262  public: virtual bool HasMetalnessMap() const = 0;
263 
266  public: virtual std::string MetalnessMap() const = 0;
267 
270  public: virtual void SetMetalnessMap(
271  const std::string &_metalnessMap) = 0;
272 
274  public: virtual void ClearMetalnessMap() = 0;
275 
278  public: virtual bool HasEnvironmentMap() const = 0;
279 
282  public: virtual std::string EnvironmentMap() const = 0;
283 
286  public: virtual void SetEnvironmentMap(
287  const std::string &_metalnessMap) = 0;
288 
290  public: virtual void ClearEnvironmentMap() = 0;
291 
294  public: virtual bool HasEmissiveMap() const = 0;
295 
298  public: virtual std::string EmissiveMap() const = 0;
299 
302  public: virtual void SetEmissiveMap(
303  const std::string &_emissiveMap) = 0;
304 
306  public: virtual void ClearEmissiveMap() = 0;
307 
310  public: virtual bool HasLightMap() const = 0;
311 
314  public: virtual std::string LightMap() const = 0;
315 
318  public: virtual unsigned int LightMapTexCoordSet() const = 0;
319 
323  public: virtual void SetLightMap(const std::string &_lightMap,
324  unsigned int _uvSet = 0u) = 0;
325 
327  public: virtual void ClearLightMap() = 0;
328 
334  public: virtual void SetRenderOrder(const float _renderOrder) = 0;
335 
338  public: virtual float RenderOrder() const = 0;
339 
342  public: virtual void SetRoughness(const float _roughness) = 0;
343 
346  public: virtual float Roughness() const = 0;
347 
350  public: virtual void SetMetalness(const float _metalness) = 0;
351 
354  public: virtual float Metalness() const = 0;
355 
357  public: virtual enum MaterialType Type() const = 0;
358 
361  public: virtual enum ShaderType ShaderType() const = 0;
362 
365  public: virtual void SetShaderType(enum ShaderType _type) = 0;
366 
369  public: virtual MaterialPtr Clone(const std::string &_name = "")
370  const = 0;
371 
374  public: virtual void CopyFrom(ConstMaterialPtr _material) = 0;
375 
378  public: virtual void CopyFrom(const common::Material &_material) = 0;
379 
382  public: virtual std::string VertexShader() const = 0;
383 
386  public: virtual ShaderParamsPtr VertexShaderParams() = 0;
387 
390  public: virtual void SetVertexShader(const std::string &_path) = 0;
391 
394  public: virtual std::string FragmentShader() const = 0;
395 
398  public: virtual ShaderParamsPtr FragmentShaderParams() = 0;
399 
402  public: virtual void SetFragmentShader(const std::string &_path) = 0;
403  };
404  }
405  }
406 }
407 #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 std::string LightMap() const =0
Get the URI of the light map 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 void SetAlphaFromTexture(bool _enabled, double _alpha=0.5, bool _twoSided=true)=0
Set the material to use the alpha channel from the textures.
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 unsigned int LightMapTexCoordSet() const =0
Get the texture coordinate set used by lightmap.
virtual float Metalness() const =0
Get the metalness value of this material.
virtual void SetLightMap(const std::string &_lightMap, unsigned int _uvSet=0u)=0
Set the material light map.
virtual bool TwoSidedEnabled() const =0
Get the enable two sided rendering value.
virtual bool TextureAlphaEnabled() const =0
Get the enable alpha from textures.
virtual bool HasLightMap() const =0
Determine if this material has a light map.
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 float RenderOrder() const =0
Get the render order value of 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 double AlphaThreshold() const =0
Get the alpha threshold.
virtual void SetRenderOrder(const float _renderOrder)=0
Set the render order. When polygons are coplanar, you can get problems with 'depth fighting' where th...
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 void ClearLightMap()=0
Removes any light 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.