Ignition Common

API Reference

3.14.0
Pbr.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2020 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_COMMON_PBR_HH_
18 #define IGNITION_COMMON_PBR_HH_
19 
20 #include <string>
21 #include <ignition/common/graphics/Export.hh>
22 
23 namespace ignition
24 {
25 namespace common
26 {
27  // Forward declarations.
28  class PbrPrivate;
29 
31  enum class PbrType : int
32  {
34  NONE = 0,
35 
37  METAL = 1,
38 
40  SPECULAR = 2,
41  };
42 
44  enum class NormalMapSpace: int
45  {
47  TANGENT = 0,
48 
50  OBJECT = 1,
51  };
52 
55  class IGNITION_COMMON_GRAPHICS_VISIBLE Pbr
56  {
58  public: Pbr();
59 
62  public: Pbr(const Pbr &_pbr);
63 
66  public: Pbr(Pbr &&_pbr) noexcept;
67 
69  public: ~Pbr();
70 
74  public: Pbr &operator=(const Pbr &_pbr);
75 
79  public: Pbr &operator=(Pbr &&_pbr);
80 
84  public: bool operator==(const Pbr &_pbr) const;
85 
90  public: bool operator!=(const Pbr &_pbr) const;
91 
96  public: std::string AlbedoMap() const;
97 
100  public: void SetAlbedoMap(const std::string &_map);
101 
106  public: std::string NormalMap() const;
107 
112  public: void SetNormalMap(const std::string &_map,
114 
117  public: NormalMapSpace NormalMapType() const;
118 
123  public: std::string EnvironmentMap() const;
124 
127  public: void SetEnvironmentMap(const std::string &_map);
128 
134 
137  public: void SetAmbientOcclusionMap(const std::string &_map);
138 
143  public: std::string RoughnessMap() const;
144 
147  public: void SetRoughnessMap(const std::string &_map);
148 
153  public: std::string MetalnessMap() const;
154 
157  public: void SetMetalnessMap(const std::string &_map);
158 
163  public: std::string EmissiveMap() const;
164 
167  public: void SetEmissiveMap(const std::string &_map);
168 
173  public: std::string LightMap() const;
174 
178  public: void SetLightMap(const std::string &_map, unsigned int _uvSet = 0u);
179 
182  public: unsigned int LightMapTexCoordSet() const;
183 
186  public: double Metalness() const;
187 
190  public: void SetMetalness(double _value);
191 
194  public: double Roughness() const;
195 
198  public: void SetRoughness(double _value);
199 
204  public: std::string GlossinessMap() const;
205 
208  public: void SetGlossinessMap(const std::string &_map);
209 
212  public: double Glossiness() const;
213 
216  public: void SetGlossiness(double _value);
217 
222  public: std::string SpecularMap() const;
223 
226  public: void SetSpecularMap(const std::string &_map);
227 
230  public: PbrType Type() const;
231 
234  public: void SetType(PbrType _type);
235 
237  private: PbrPrivate *dataPtr = nullptr;
238  };
239 }
240 }
241 #endif
This class contains Physically-Based-Rendering (PBR) workflow properties.
Definition: Pbr.hh:56
bool operator==(const Pbr &_pbr) const
Return true if both Pbr objects contain the same values.
double Metalness() const
Get the metalness value of the material for metal workflow.
std::string RoughnessMap() const
Get the roughness map filename for metal workflow. This will be an empty string if a roughness map ha...
std::string MetalnessMap() const
Get the metalness map filename for metal workflow. This will be an empty string if a metalness map ha...
void SetAlbedoMap(const std::string &_map)
Set the albedo map filename.
std::string NormalMap() const
Get the normal map filename. This will be an empty string if a normal map has not been set.
void SetRoughnessMap(const std::string &_map)
Set the roughness map filename for metal workflow.
void SetSpecularMap(const std::string &_map)
Set the specular map filename for specular workflow.
void SetMetalness(double _value)
Set the metalness value of the material for metal workflow.
std::string SpecularMap() const
Get the specular map filename for specular workflow. This will be an empty string if a specular map h...
std::string GlossinessMap() const
Get the glossiness map filename for specular workflow. This will be an empty string if a glossiness m...
Pbr(Pbr &&_pbr) noexcept
Move constructor.
double Roughness() const
Get the roughness value of the material for metal workflow.
NormalMapSpace NormalMapType() const
Get the normal map type, either tangent or object space.
Pbr & operator=(const Pbr &_pbr)
Assignment operator.
void SetGlossinessMap(const std::string &_map)
Set the glossiness map filename for specular workflow.
double Glossiness() const
Get the glossiness value of the material for specular workflow.
void SetEmissiveMap(const std::string &_map)
Set the emissive map filename.
void SetRoughness(double _value)
Set the roughness value of the material for metal workflow.
PbrType Type() const
Get the workflow type.
void SetGlossiness(double _value)
Set the glossiness value of the material for specular workflow.
void SetMetalnessMap(const std::string &_map)
Set the metalness map filename for metal workflow.
std::string AlbedoMap() const
Get the albedo map filename. This will be an empty string if an albedo map has not been set.
Pbr(const Pbr &_pbr)
Copy constructor.
void SetLightMap(const std::string &_map, unsigned int _uvSet=0u)
Set the light map filename.
std::string AmbientOcclusionMap() const
Get the ambient occlusion map filename. This will be an empty string if an ambient occlusion map has ...
std::string EnvironmentMap() const
Get the environment map filename. This will be an empty string if an environment map has not been set...
unsigned int LightMapTexCoordSet() const
Get the light map texture coordinate set.
void SetAmbientOcclusionMap(const std::string &_map)
Set the ambient occlusion map filename.
std::string EmissiveMap() const
Get the emissive map filename. This will be an empty string if an emissive map has not been set.
Pbr()
Default constructor.
Pbr & operator=(Pbr &&_pbr)
Move assignment operator.
std::string LightMap() const
Get the light map filename. This will be an empty string if an light map has not been set.
void SetType(PbrType _type)
Set the PBR workflow to use.
bool operator!=(const Pbr &_pbr) const
Return true this Pbr object does not contain the same values as the passed in parameter.
void SetNormalMap(const std::string &_map, NormalMapSpace _space=NormalMapSpace::TANGENT)
Set the normal map filename.
void SetEnvironmentMap(const std::string &_map)
Set the environment map filename.
PbrType
Type of PBR workflow.
Definition: Pbr.hh:32
@ SPECULAR
Specular/Glossiness workflow.
@ METAL
Metal/Roughness workflow.
NormalMapSpace
Space the normal map is defined in.
Definition: Pbr.hh:45
Forward declarations for the common classes.