opensurgsim
RenderPass.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2016, SimQuest Solutions Inc.
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 #ifndef SURGSIM_GRAPHICS_RENDERPASS_H
17 #define SURGSIM_GRAPHICS_RENDERPASS_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Framework/SceneElement.h"
22 #include "SurgSim/Graphics/Camera.h"
23 
24 namespace SurgSim
25 {
26 
27 namespace Framework
28 {
29 
30 class Component;
31 
32 }
33 namespace Graphics
34 {
35 
36 class Group;
37 class Material;
38 class RenderTarget;
39 class ScreenSpaceQuadRepresentation;
40 class Texture;
41 class View;
42 
43 
51 {
52 public:
53 
56  explicit RenderPass(const std::string& name);
57  ~RenderPass();
58 
61  bool doInitialize() override;
62 
66  bool setRenderTarget(std::shared_ptr<RenderTarget> target);
67 
70  std::shared_ptr<RenderTarget> getRenderTarget();
71 
75  virtual void setRenderOrder(SurgSim::Graphics::Camera::RenderOrder order, int value);
76 
79  std::shared_ptr<Camera> getCamera();
80 
84  bool setMaterial(std::shared_ptr<SurgSim::Framework::Component> material);
85 
88  std::shared_ptr<Material> getMaterial();
89 
93  void showColorTarget(int x, int y, int width, int height);
94 
96  void hideColorTarget();
97 
101  void showDepthTarget(int x, int y, int width, int height);
102 
104  void hideDepthTarget();
105 
106 private:
107 
108 
109  std::shared_ptr<Camera> m_camera;
110  std::shared_ptr<Group> m_group;
111  std::shared_ptr<RenderTarget> m_renderTarget;
112  std::shared_ptr<Material> m_material;
113 
114  std::shared_ptr<ScreenSpaceQuadRepresentation> m_debugColor;
115  std::shared_ptr<ScreenSpaceQuadRepresentation> m_debugDepth;
116 
121  std::shared_ptr<ScreenSpaceQuadRepresentation> buildDebugQuad(
122  const std::string& name,
123  std::shared_ptr<Texture> texture);
124 };
125 
126 }; // Graphics
127 }; // SurgSim
128 
129 #endif
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
SceneElement is the basic part of a scene, it is a container of components.
Definition: SceneElement.h:51
Encapsulation of all the components necessary needed to implement a full renderpass, this SceneElement contains a Camera and Group, it can also take a Material (for shaders and uniforms) and a RenderTarget for textures that are used as the output for the camera.
Definition: RenderPass.h:50