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 
26 namespace 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 
130  public: NormalMapSpace NormalMapType() const;
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 
174  public: double Metalness() const;
175 
178  public: void SetMetalness(const double _value);
179 
182  public: double Roughness() const;
183 
186  public: void SetRoughness(const double _value);
187 
192  public: std::string GlossinessMap() const;
193 
196  public: void SetGlossinessMap(const std::string &_map);
197 
200  public: double Glossiness() const;
201 
204  public: void SetGlossiness(const double _value);
205 
210  public: std::string SpecularMap() const;
211 
214  public: void SetSpecularMap(const std::string &_map);
215 
220  public: sdf::ElementPtr Element() const;
221 
224  public: PbrWorkflowType Type() const;
225 
228  public: void SetType(PbrWorkflowType _type);
229 
231  private: PbrWorkflowPrivate *dataPtr = nullptr;
232  };
233 
237  {
239  public: Pbr();
240 
243  public: Pbr(const Pbr &_pbr);
244 
247  public: Pbr(Pbr &&_pbr) noexcept;
248 
250  public: ~Pbr();
251 
255  public: Pbr &operator=(const Pbr &_pbr);
256 
260  public: Pbr &operator=(Pbr &&_pbr);
261 
268  public: Errors Load(ElementPtr _sdf);
269 
274  public: void SetWorkflow(PbrWorkflowType _type,
275  const PbrWorkflow &_workflow);
276 
281  public: PbrWorkflow *Workflow(PbrWorkflowType _type) const;
282 
284  private: PbrPrivate *dataPtr = nullptr;
285  };
286  }
287 }
288 #endif
NormalMapSpace
Space the normal map is defined in.
Definition: Pbr.hh:49
class SDFORMAT_VISIBLE Element
Definition: Element.hh:47
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:51
This class provides access to Physically-Based-Rendering (PBR) material workflows.
Definition: Pbr.hh:236
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:74
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
PbrWorkflowType
Type of PBR workflow.
Definition: Pbr.hh:36
Metal/Roughness workflow.
This class contains Physically-Based-Rendering (PBR) workflow properties.
Definition: Pbr.hh:60
Specular/Glossiness workflow.
namespace for Simulation Description Format parser
Definition: AirPressure.hh:25