Ignition Rendering

API Reference

5.0.0
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 IGNITION_RENDERING_MATERIAL_HH_
18 #define IGNITION_RENDERING_MATERIAL_HH_
19 
20 #include <string>
21 #include <ignition/math/Color.hh>
23 #include "ignition/rendering/config.hh"
27 #include "ignition/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 &_name) = 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 &_name) = 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(const std::string &_name) = 0;
255 
257  public: virtual void ClearRoughnessMap() = 0;
258 
261  public: virtual bool HasMetalnessMap() const = 0;
262 
265  public: virtual std::string MetalnessMap() const = 0;
266 
269  public: virtual void SetMetalnessMap(const std::string &_name) = 0;
270 
272  public: virtual void ClearMetalnessMap() = 0;
273 
276  public: virtual bool HasEnvironmentMap() const = 0;
277 
280  public: virtual std::string EnvironmentMap() const = 0;
281 
284  public: virtual void SetEnvironmentMap(const std::string &_name) = 0;
285 
287  public: virtual void ClearEnvironmentMap() = 0;
288 
291  public: virtual bool HasEmissiveMap() const = 0;
292 
295  public: virtual std::string EmissiveMap() const = 0;
296 
299  public: virtual void SetEmissiveMap(const std::string &_name) = 0;
300 
302  public: virtual void ClearEmissiveMap() = 0;
303 
306  public: virtual bool HasLightMap() const = 0;
307 
310  public: virtual std::string LightMap() const = 0;
311 
314  public: virtual unsigned int LightMapTexCoordSet() const = 0;
315 
319  public: virtual void SetLightMap(const std::string &_name,
320  unsigned int _uvSet = 0u) = 0;
321 
323  public: virtual void ClearLightMap() = 0;
324 
330  public: virtual void SetRenderOrder(const float _renderOrder) = 0;
331 
334  public: virtual float RenderOrder() const = 0;
335 
338  public: virtual void SetRoughness(const float _roughness) = 0;
339 
342  public: virtual float Roughness() const = 0;
343 
346  public: virtual void SetMetalness(const float _metalness) = 0;
347 
350  public: virtual float Metalness() const = 0;
351 
353  public: virtual enum MaterialType Type() const = 0;
354 
357  public: virtual enum ShaderType ShaderType() const = 0;
358 
361  public: virtual void SetShaderType(enum ShaderType _type) = 0;
362 
365  public: virtual MaterialPtr Clone(const std::string &_name = "")
366  const = 0;
367 
370  public: virtual void CopyFrom(ConstMaterialPtr _material) = 0;
371 
374  public: virtual void CopyFrom(const common::Material &_material) = 0;
375 
378  public: virtual std::string VertexShader() const = 0;
379 
382  public: virtual ShaderParamsPtr VertexShaderParams() = 0;
383 
386  public: virtual void SetVertexShader(const std::string &_path) = 0;
387 
390  public: virtual std::string FragmentShader() const = 0;
391 
394  public: virtual ShaderParamsPtr FragmentShaderParams() = 0;
395 
398  public: virtual void SetFragmentShader(const std::string &_path) = 0;
399  };
400  }
401  }
402 }
403 #endif
STL class.
Physically Based Shading.
Definition: Material.hh:42
virtual ~Material()
Destructor.
Definition: Material.hh:51
ShaderType
Available types of shaders. Note that not all rendering-engines will be able to use each type...
Definition: ShaderType.hh:34
Classic shading, i.e. variants of Phong.
Definition: Material.hh:39
Represents a surface material of a Geometry.
Definition: Material.hh:47
Represents an object present in the scene graph. This includes sub-meshes, materials, render targets, as well as posable nodes.
Definition: Object.hh:34
MaterialType
An enum for the type of material.
Definition: Material.hh:36