Ignition Rendering

API Reference

4.1.0
RenderPassSystem.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 IGNITION_RENDERING_RENDERPASSSYSTEM_HH_
18 #define IGNITION_RENDERING_RENDERPASSSYSTEM_HH_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <typeinfo>
24 
25 #include "ignition/rendering/config.hh"
26 #include "ignition/rendering/Export.hh"
29 
30 namespace ignition
31 {
32  namespace rendering
33  {
34  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
35  //
36  // forward declaration
37  class RenderPassSystemPrivate;
38 
39  /* \class RenderPassFactory RenderPassSystem.hh \
40  * ignition/rendering/RenderPassSystem.hh
41  */
43  class IGNITION_RENDERING_VISIBLE RenderPassFactory
44  {
47  public: virtual RenderPass *New() const = 0;
48  };
49 
50  /* \class RenderPassSystem RenderPassSystem.hh \
51  * ignition/rendering/RenderPassSystem.hh
52  */
54  class IGNITION_RENDERING_VISIBLE RenderPassSystem
55  {
57  public: RenderPassSystem();
58 
60  public: virtual ~RenderPassSystem();
61 
64  public: template<typename T> RenderPassPtr Create()
65  {
66  return this->CreateImpl(typeid(T).name());
67  }
68 
72  public: static void Register(const std::string &_type,
73  RenderPassFactory *_factory);
74 
78  private: RenderPassPtr CreateImpl(const std::string &_type);
79 
81  private: static std::map<std::string, RenderPassFactory *> renderPassMap;
82 
86  };
87 
91  #define IGN_RENDERING_REGISTER_RENDER_PASS(classname, interface) \
92  class classname##Factory : public ignition::rendering::RenderPassFactory \
93  { \
94  public: classname##Factory() \
95  { \
96  ignition::rendering::RenderPassSystem::Register( \
97  typeid(interface).name(), this); \
98  } \
99  public: RenderPass *New() const override \
100  { \
101  return new classname(); \
102  } \
103  }; \
104  static classname##Factory global_##classname##Factory;
105  }
106  }
107 }
108 #endif
A class for creating and managing render passes.
Definition: RenderPassSystem.hh:54
A factory interface for creating render passes.
Definition: RenderPassSystem.hh:43
A render pass can be added to a camera to affect how the scene is rendered. It can be used to add pos...
Definition: RenderPass.hh:34
STL class.
STL class.
RenderPassPtr Create()
Templated function for creating render passes.
Definition: RenderPassSystem.hh:64