Loading...
Searching...
No Matches
Pbr.hh
Go to the documentation of this file.
1/*
2 * Copyright 2019 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_PBR_HH_
18#define SDF_PBR_HH_
19
20#include <string>
21#include "sdf/Element.hh"
22#include "sdf/Types.hh"
23#include "sdf/sdf_config.h"
24#include "sdf/system_util.hh"
25
26namespace sdf
27{
28 // Inline bracke to help doxygen filtering.
29 inline namespace SDF_VERSION_NAMESPACE {
30 //
31 // Forward declarations.
32 class PbrPrivate;
33 class PbrWorkflowPrivate;
34
36 enum class PbrWorkflowType : int
37 {
39 NONE = 0,
40
42 METAL = 1,
43
45 SPECULAR = 2,
46 };
47
49 enum class NormalMapSpace: int
50 {
52 TANGENT = 0,
53
55 OBJECT = 1,
56 };
57
61 {
63 public: PbrWorkflow();
64
67 public: PbrWorkflow(const PbrWorkflow &_workflow);
68
71 public: PbrWorkflow(PbrWorkflow &&_workflow) noexcept;
72
74 public: ~PbrWorkflow();
75
82 public: Errors Load(ElementPtr _sdf);
83
87 public: PbrWorkflow &operator=(const PbrWorkflow &_workflow);
88
92 public: PbrWorkflow &operator=(PbrWorkflow &&_workflow);
93
97 public: bool operator==(const PbrWorkflow &_workflow) const;
98
103 public: bool operator!=(const PbrWorkflow &_workflow) const;
104
109 public: std::string AlbedoMap() const;
110
113 public: void SetAlbedoMap(const std::string &_map);
114
119 public: std::string NormalMap() const;
120
125 public: void SetNormalMap(const std::string &_map,
126 NormalMapSpace _space = NormalMapSpace::TANGENT);
127
131
136 public: std::string EnvironmentMap() const;
137
140 public: void SetEnvironmentMap(const std::string &_map);
141
146 public: std::string AmbientOcclusionMap() const;
147
150 public: void SetAmbientOcclusionMap(const std::string &_map);
151
156 public: std::string RoughnessMap() const;
157
160 public: void SetRoughnessMap(const std::string &_map);
161
166 public: std::string MetalnessMap() const;
167
170 public: void SetMetalnessMap(const std::string &_map);
171
176 public: std::string EmissiveMap() const;
177
180 public: void SetEmissiveMap(const std::string &_map);
181
186 public: std::string LightMap() const;
187
191 public: void SetLightMap(const std::string &_map, unsigned int _uvSet = 0u);
192
195 public: unsigned int LightMapTexCoordSet() const;
196
199 public: double Metalness() const;
200
203 public: void SetMetalness(const double _value);
204
207 public: double Roughness() const;
208
211 public: void SetRoughness(const double _value);
212
217 public: std::string GlossinessMap() const;
218
221 public: void SetGlossinessMap(const std::string &_map);
222
225 public: double Glossiness() const;
226
229 public: void SetGlossiness(const double _value);
230
235 public: std::string SpecularMap() const;
236
239 public: void SetSpecularMap(const std::string &_map);
240
245 public: sdf::ElementPtr Element() const;
246
249 public: PbrWorkflowType Type() const;
250
253 public: void SetType(PbrWorkflowType _type);
254
256 private: PbrWorkflowPrivate *dataPtr = nullptr;
257 };
258
262 {
264 public: Pbr();
265
268 public: Pbr(const Pbr &_pbr);
269
272 public: Pbr(Pbr &&_pbr) noexcept;
273
275 public: ~Pbr();
276
280 public: Pbr &operator=(const Pbr &_pbr);
281
285 public: Pbr &operator=(Pbr &&_pbr);
286
293 public: Errors Load(ElementPtr _sdf);
294
299 public: void SetWorkflow(PbrWorkflowType _type,
300 const PbrWorkflow &_workflow);
301
306 public: PbrWorkflow *Workflow(PbrWorkflowType _type) const;
307
309 private: PbrPrivate *dataPtr = nullptr;
310 };
311 }
312}
313#endif
This class contains Physically-Based-Rendering (PBR) workflow properties.
Definition Pbr.hh:61
~PbrWorkflow()
Destructor.
void SetNormalMap(const std::string &_map, NormalMapSpace _space=NormalMapSpace::TANGENT)
Set the normal map filename.
bool operator==(const PbrWorkflow &_workflow) const
Return true if both PbrWorkflow objects contain the same values.
PbrWorkflow & operator=(const PbrWorkflow &_workflow)
Assignment operator.
void SetMetalness(const double _value)
Set the metalness value of the material for metal workflow.
NormalMapSpace NormalMapType() const
Get the normal map type, either tangent or object space.
void SetGlossiness(const double _value)
Set the glossiness value of the material for specular workflow.
double Metalness() const
Get the metalness value of the material for metal workflow.
void SetMetalnessMap(const std::string &_map)
Set the metalness map filename for metal workflow.
std::string NormalMap() const
Get the normal map filename.
void SetRoughnessMap(const std::string &_map)
Set the roughness map filename for metal workflow.
double Roughness() const
Get the roughness value of the material for metal workflow.
void SetAlbedoMap(const std::string &_map)
Set the albedo map filename.
void SetEnvironmentMap(const std::string &_map)
Set the environment map filename.
std::string LightMap() const
Get the light map filename.
PbrWorkflowType Type() const
Get the workflow type.
std::string RoughnessMap() const
Get the roughness map filename for metal workflow.
void SetGlossinessMap(const std::string &_map)
Set the glossiness map filename for specular workflow.
void SetLightMap(const std::string &_map, unsigned int _uvSet=0u)
Set the light map filename.
std::string AlbedoMap() const
Get the albedo map filename.
std::string EnvironmentMap() const
Get the environment map filename.
PbrWorkflow & operator=(PbrWorkflow &&_workflow)
Move assignment operator.
void SetEmissiveMap(const std::string &_map)
Set the emissive map filename.
std::string SpecularMap() const
Get the specular map filename for specular workflow.
std::string GlossinessMap() const
Get the glossiness map filename for specular workflow.
PbrWorkflow(PbrWorkflow &&_workflow) noexcept
Move constructor.
bool operator!=(const PbrWorkflow &_workflow) const
Return true this PbrWorkflow object does not contain the same values as the passed in parameter.
std::string AmbientOcclusionMap() const
Get the ambient occlusion map filename.
void SetSpecularMap(const std::string &_map)
Set the specular map filename for specular workflow.
std::string MetalnessMap() const
Get the metalness map filename for metal workflow.
void SetType(PbrWorkflowType _type)
Set the PBR workflow to use.
PbrWorkflow()
Default constructor.
Errors Load(ElementPtr _sdf)
Load the pbr workflow based on an element pointer.
void SetAmbientOcclusionMap(const std::string &_map)
Set the ambient occlusion map filename.
PbrWorkflow(const PbrWorkflow &_workflow)
Copy constructor.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
std::string EmissiveMap() const
Get the emissive map filename.
void SetRoughness(const double _value)
Set the roughness value of the material for metal workflow.
double Glossiness() const
Get the glossiness value of the material for specular workflow.
unsigned int LightMapTexCoordSet() const
Get the light map texture coordinate set.
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition Pbr.hh:262
Pbr()
Default constructor.
Pbr & operator=(Pbr &&_pbr)
Move assignment operator.
void SetWorkflow(PbrWorkflowType _type, const PbrWorkflow &_workflow)
Set a PBR workflow by type.
Pbr(Pbr &&_pbr) noexcept
Move constructor.
Pbr & operator=(const Pbr &_pbr)
Assignment operator.
Pbr(const Pbr &_pbr)
Copy constructor.
PbrWorkflow * Workflow(PbrWorkflowType _type) const
Get a PBR workflow by type.
~Pbr()
Destructor.
Errors Load(ElementPtr _sdf)
Load the pbr based on an element pointer.
@ NONE
An unspecified sensor type.
NormalMapSpace
Space the normal map is defined in.
Definition Pbr.hh:50
PbrWorkflowType
Type of PBR workflow.
Definition Pbr.hh:37
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:89
std::shared_ptr< Element > ElementPtr
Definition Element.hh:53
namespace for Simulation Description Format parser
Definition Actor.hh:33
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:48