All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RenderPass.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, 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 
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  virtual 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<Material> 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 
115 
116  std::shared_ptr<ScreenSpaceQuadRepresentation> m_debugColor;
117  std::shared_ptr<ScreenSpaceQuadRepresentation> m_debugDepth;
118 
123  std::shared_ptr<ScreenSpaceQuadRepresentation> buildDebugQuad(
124  const std::string& name,
125  std::shared_ptr<Texture> texture);
126 };
127 
128 }; // Graphics
129 }; // SurgSim
130 
131 #endif
std::shared_ptr< RenderTarget > getRenderTarget()
Gets render target that is being used in this pass.
Definition: RenderPass.cpp:68
bool setMaterial(std::shared_ptr< Material > material)
Sets the material used for rendering.
Definition: RenderPass.cpp:73
void showDepthTarget(int x, int y, int width, int height)
Shows a quad on the screen with the texture used as the depth target for this pass.
Definition: RenderPass.cpp:116
RenderPass(const std::string &name)
Constructor.
Definition: RenderPass.cpp:31
~RenderPass()
Definition: RenderPass.cpp:41
std::shared_ptr< Camera > m_camera
The camera used for the pass.
Definition: RenderPass.h:109
std::shared_ptr< RenderTarget > m_renderTarget
The camera's rendertarget.
Definition: RenderPass.h:111
std::shared_ptr< Group > m_group
The groupd used for the pass.
Definition: RenderPass.h:110
virtual bool doInitialize() override
Executes the initialize operation.
Definition: RenderPass.cpp:46
void hideColorTarget()
Hides the color target display.
Definition: RenderPass.cpp:108
int m_renderOrder
The renderorder that is being used for this pass.
Definition: RenderPass.h:114
void hideDepthTarget()
Hides the depth target display.
Definition: RenderPass.cpp:131
std::shared_ptr< ScreenSpaceQuadRepresentation > m_debugColor
Definition: RenderPass.h:116
virtual void setRenderOrder(SurgSim::Graphics::Camera::RenderOrder order, int value)
Sets render order.
Definition: RenderPass.cpp:88
std::shared_ptr< ScreenSpaceQuadRepresentation > buildDebugQuad(const std::string &name, std::shared_ptr< Texture > texture)
Utility function to build a debug quad.
Definition: RenderPass.cpp:139
std::shared_ptr< Camera > getCamera()
Gets the camera.
Definition: RenderPass.cpp:53
std::shared_ptr< ScreenSpaceQuadRepresentation > m_debugDepth
Definition: RenderPass.h:117
std::shared_ptr< Material > m_material
The material, attached to the camera.
Definition: RenderPass.h:112
bool setRenderTarget(std::shared_ptr< RenderTarget > target)
Sets render target for the camera, this abstracts the textures that are being used for rendering into...
Definition: RenderPass.cpp:58
SceneElement is the basic part of a scene, it is a container of components.
Definition: SceneElement.h:48
std::shared_ptr< Material > getMaterial()
Gets the current material.
Definition: RenderPass.cpp:83
RenderOrder
Definition: Camera.h:53
void showColorTarget(int x, int y, int width, int height)
Shows a quad on the screen with the texture used as the color target for this pass.
Definition: RenderPass.cpp:93
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