Ignition Rendering

API Reference

5.0.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 
26 
27 #include "ignition/rendering/config.hh"
28 #include "ignition/rendering/Export.hh"
31 
32 namespace ignition
33 {
34  namespace rendering
35  {
36  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
37  //
38  // forward declaration
39  class RenderPassSystemPrivate;
40 
41  /* \class RenderPassFactory RenderPassSystem.hh \
42  * ignition/rendering/RenderPassSystem.hh
43  */
45  class IGNITION_RENDERING_VISIBLE RenderPassFactory
46  {
49  public: virtual RenderPass *New() const = 0;
50  };
51 
52  /* \class RenderPassSystem RenderPassSystem.hh \
53  * ignition/rendering/RenderPassSystem.hh
54  */
56  class IGNITION_RENDERING_VISIBLE RenderPassSystem
57  {
59  public: RenderPassSystem();
60 
62  public: virtual ~RenderPassSystem();
63 
66  public: template<typename T> RenderPassPtr Create()
67  {
68  return this->CreateImpl(typeid(T).name());
69  }
70 
74  public: static void Register(const std::string &_type,
75  RenderPassFactory *_factory);
76 
80  private: RenderPassPtr CreateImpl(const std::string &_type);
81 
84  private: static std::map<std::string, RenderPassFactory *> renderPassMap;
85 
90  };
91 
95  #define IGN_RENDERING_REGISTER_RENDER_PASS(classname, interface) \
96  class classname##Factory : public ignition::rendering::RenderPassFactory \
97  { \
98  public: classname##Factory() \
99  { \
100  ignition::rendering::RenderPassSystem::Register( \
101  typeid(interface).name(), this); \
102  } \
103  public: RenderPass *New() const override \
104  { \
105  return new classname(); \
106  } \
107  }; \
108  static classname##Factory global_##classname##Factory;
109  }
110  }
111 }
112 #endif
A class for creating and managing render passes.
Definition: RenderPassSystem.hh:56
A factory interface for creating render passes.
Definition: RenderPassSystem.hh:45
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
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
STL class.
STL class.
RenderPassPtr Create()
Templated function for creating render passes.
Definition: RenderPassSystem.hh:66
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING