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 <gz/utils/ImplPtr.hh>
22#include "sdf/Element.hh"
23#include "sdf/Types.hh"
24#include "sdf/config.hh"
25#include "sdf/system_util.hh"
26
27namespace sdf
28{
29 // Inline bracke to help doxygen filtering.
30 inline namespace SDF_VERSION_NAMESPACE {
31 //
32
34 enum class PbrWorkflowType : int
35 {
37 NONE = 0,
38
40 METAL = 1,
41
43 SPECULAR = 2,
44 };
45
47 enum class NormalMapSpace: int
48 {
50 TANGENT = 0,
51
53 OBJECT = 1,
54 };
55
59 {
61 public: PbrWorkflow();
62
69 public: Errors Load(ElementPtr _sdf);
70
74 public: bool operator==(const PbrWorkflow &_workflow) const;
75
80 public: bool operator!=(const PbrWorkflow &_workflow) const;
81
86 public: std::string AlbedoMap() const;
87
90 public: void SetAlbedoMap(const std::string &_map);
91
96 public: std::string NormalMap() const;
97
102 public: void SetNormalMap(const std::string &_map,
103 NormalMapSpace _space = NormalMapSpace::TANGENT);
104
108
113 public: std::string EnvironmentMap() const;
114
117 public: void SetEnvironmentMap(const std::string &_map);
118
123 public: std::string AmbientOcclusionMap() const;
124
127 public: void SetAmbientOcclusionMap(const std::string &_map);
128
133 public: std::string RoughnessMap() const;
134
137 public: void SetRoughnessMap(const std::string &_map);
138
143 public: std::string MetalnessMap() const;
144
147 public: void SetMetalnessMap(const std::string &_map);
148
153 public: std::string EmissiveMap() const;
154
157 public: void SetEmissiveMap(const std::string &_map);
158
163 public: std::string LightMap() const;
164
168 public: void SetLightMap(const std::string &_map, unsigned int _uvSet = 0u);
169
172 public: unsigned int LightMapTexCoordSet() const;
173
176 public: double Metalness() const;
177
180 public: void SetMetalness(const double _value);
181
184 public: double Roughness() const;
185
188 public: void SetRoughness(const double _value);
189
194 public: std::string GlossinessMap() const;
195
198 public: void SetGlossinessMap(const std::string &_map);
199
202 public: double Glossiness() const;
203
206 public: void SetGlossiness(const double _value);
207
212 public: std::string SpecularMap() const;
213
216 public: void SetSpecularMap(const std::string &_map);
217
222 public: sdf::ElementPtr Element() const;
223
226 public: PbrWorkflowType Type() const;
227
230 public: void SetType(PbrWorkflowType _type);
231
233 GZ_UTILS_IMPL_PTR(dataPtr)
234 };
235
239 {
241 public: Pbr();
242
249 public: Errors Load(ElementPtr _sdf);
250
255 public: void SetWorkflow(PbrWorkflowType _type,
256 const PbrWorkflow &_workflow);
257
262 public: const PbrWorkflow *Workflow(PbrWorkflowType _type) const;
263
265 GZ_UTILS_IMPL_PTR(dataPtr)
266 };
267 }
268}
269#endif
This class contains Physically-Based-Rendering (PBR) workflow properties.
Definition Pbr.hh:59
std::string LightMap() const
Get the light map filename.
void SetAmbientOcclusionMap(const std::string &_map)
Set the ambient occlusion map filename.
void SetGlossiness(const double _value)
Set the glossiness value of the material for specular workflow.
void SetSpecularMap(const std::string &_map)
Set the specular map filename for specular workflow.
Errors Load(ElementPtr _sdf)
Load the pbr workflow based on an element pointer.
std::string NormalMap() const
Get the normal map filename.
void SetEnvironmentMap(const std::string &_map)
Set the environment map filename.
void SetType(PbrWorkflowType _type)
Set the PBR workflow to use.
std::string SpecularMap() const
Get the specular map filename for specular workflow.
void SetLightMap(const std::string &_map, unsigned int _uvSet=0u)
Set the light map filename.
double Glossiness() const
Get the glossiness value of the material for specular workflow.
void SetMetalness(const double _value)
Set the metalness value of the material for metal workflow.
double Roughness() const
Get the roughness value of the material for metal workflow.
std::string AlbedoMap() const
Get the albedo map filename.
std::string AmbientOcclusionMap() const
Get the ambient occlusion map filename.
PbrWorkflowType Type() const
Get the workflow type.
std::string EmissiveMap() const
Get the emissive map filename.
void SetAlbedoMap(const std::string &_map)
Set the albedo map filename.
void SetRoughnessMap(const std::string &_map)
Set the roughness map filename for metal workflow.
std::string MetalnessMap() const
Get the metalness map filename for metal workflow.
bool operator==(const PbrWorkflow &_workflow) const
Return true if both PbrWorkflow objects contain the same values.
void SetNormalMap(const std::string &_map, NormalMapSpace _space=NormalMapSpace::TANGENT)
Set the normal map filename.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
double Metalness() const
Get the metalness value of the material for metal workflow.
unsigned int LightMapTexCoordSet() const
Get the light map texture coordinate set.
void SetRoughness(const double _value)
Set the roughness value of the material for metal workflow.
bool operator!=(const PbrWorkflow &_workflow) const
Return true this PbrWorkflow object does not contain the same values as the passed in parameter.
std::string GlossinessMap() const
Get the glossiness map filename for specular workflow.
void SetEmissiveMap(const std::string &_map)
Set the emissive map filename.
std::string RoughnessMap() const
Get the roughness map filename for metal workflow.
std::string EnvironmentMap() const
Get the environment map filename.
void SetGlossinessMap(const std::string &_map)
Set the glossiness map filename for specular workflow.
void SetMetalnessMap(const std::string &_map)
Set the metalness map filename for metal workflow.
NormalMapSpace NormalMapType() const
Get the normal map type, either tangent or object space.
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition Pbr.hh:239
Pbr()
Default constructor.
const PbrWorkflow * Workflow(PbrWorkflowType _type) const
Get a PBR workflow by type.
Errors Load(ElementPtr _sdf)
Load the pbr based on an element pointer.
void SetWorkflow(PbrWorkflowType _type, const PbrWorkflow &_workflow)
Set a PBR workflow by type.
PbrWorkflowType
Type of PBR workflow.
Definition Pbr.hh:35
@ SPECULAR
Specular/Glossiness workflow.
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:81
NormalMapSpace
Space the normal map is defined in.
Definition Pbr.hh:48
std::shared_ptr< Element > ElementPtr
Definition Element.hh:55
namespace for Simulation Description Format parser
Definition Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:25