RenderPass.h
Go to the documentation of this file.
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 
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 
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
SurgSim::Graphics::RenderPass::~RenderPass
~RenderPass()
Definition: RenderPass.cpp:41
SurgSim::Graphics::RenderPass::getMaterial
std::shared_ptr< Material > getMaterial()
Gets the current material.
Definition: RenderPass.cpp:83
SurgSim::Graphics::RenderPass::showDepthTarget
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
SurgSim::Graphics::RenderPass::showColorTarget
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
SurgSim::Graphics::RenderPass::buildDebugQuad
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
SurgSim::Graphics::RenderPass::m_camera
std::shared_ptr< Camera > m_camera
The camera used for the pass.
Definition: RenderPass.h:109
SurgSim::Graphics::RenderPass::doInitialize
bool doInitialize() override
Executes the initialize operation.
Definition: RenderPass.cpp:46
SceneElement.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Graphics::RenderPass::RenderPass
RenderPass(const std::string &name)
Constructor.
Definition: RenderPass.cpp:31
SurgSim::Graphics::RenderPass::setMaterial
bool setMaterial(std::shared_ptr< SurgSim::Framework::Component > material)
Sets the material used for rendering.
Definition: RenderPass.cpp:73
SurgSim::Graphics::RenderPass::m_renderTarget
std::shared_ptr< RenderTarget > m_renderTarget
The camera's rendertarget.
Definition: RenderPass.h:111
SurgSim::Graphics::RenderPass::m_renderOrder
int m_renderOrder
The renderorder that is being used for this pass.
Definition: RenderPass.h:114
SurgSim::Graphics::RenderPass::setRenderTarget
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
SurgSim::Graphics::RenderPass::m_debugColor
std::shared_ptr< ScreenSpaceQuadRepresentation > m_debugColor
Definition: RenderPass.h:116
SurgSim::Graphics::RenderPass::m_debugDepth
std::shared_ptr< ScreenSpaceQuadRepresentation > m_debugDepth
Definition: RenderPass.h:117
SurgSim::Graphics::Camera::RenderOrder
RenderOrder
Definition: Camera.h:56
SurgSim::Graphics::RenderPass::hideColorTarget
void hideColorTarget()
Hides the color target display.
Definition: RenderPass.cpp:108
SurgSim::Graphics::RenderPass::m_material
std::shared_ptr< Material > m_material
The material, attached to the camera.
Definition: RenderPass.h:112
SurgSim::Framework::SceneElement
SceneElement is the basic part of a scene, it is a container of components.
Definition: SceneElement.h:52
Camera.h
SurgSim::Graphics::RenderPass
Encapsulation of all the components necessary needed to implement a full renderpass,...
Definition: RenderPass.h:51
SurgSim::Graphics::RenderPass::getRenderTarget
std::shared_ptr< RenderTarget > getRenderTarget()
Gets render target that is being used in this pass.
Definition: RenderPass.cpp:68
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Graphics::RenderPass::m_group
std::shared_ptr< Group > m_group
The groupd used for the pass.
Definition: RenderPass.h:110
SurgSim::Graphics::RenderPass::getCamera
std::shared_ptr< Camera > getCamera()
Gets the camera.
Definition: RenderPass.cpp:53
SurgSim::Graphics::RenderPass::setRenderOrder
virtual void setRenderOrder(SurgSim::Graphics::Camera::RenderOrder order, int value)
Sets render order.
Definition: RenderPass.cpp:88
SurgSim::Graphics::RenderPass::hideDepthTarget
void hideDepthTarget()
Hides the depth target display.
Definition: RenderPass.cpp:131