SurgSim::Graphics::RenderPass Class Reference

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. More...

`#include <SurgSim/Graphics/RenderPass.h>`

Inheritance diagram for SurgSim::Graphics::RenderPass:

## Public Member Functions

| RenderPass (const std::string &name)
| Constructor. More...
| ~RenderPass ()
bool | doInitialize () override
| Executes the initialize operation. More...
bool | setRenderTarget (std::shared_ptr< RenderTarget > target)
| Sets render target for the camera, this abstracts the textures that are being used for rendering into. More...
std::shared_ptr< RenderTarget > | getRenderTarget ()
| Gets render target that is being used in this pass. More...
virtual void | setRenderOrder (SurgSim::Graphics::Camera::RenderOrder order, int value)
| Sets render order. More...
std::shared_ptr< Camera > | getCamera ()
| Gets the camera. More...
bool | setMaterial (std::shared_ptr< SurgSim::Framework::Component > material)
| Sets the material used for rendering. More...
std::shared_ptr< Material > | getMaterial ()
| Gets the current material. More...
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. More...
void | hideColorTarget ()
| Hides the color target display. More...
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. More...
void | hideDepthTarget ()
| Hides the depth target display. More...
Public Member Functions inherited from SurgSim::Framework::SceneElement
| SceneElement (const std::string &name)
| Constructor. More...
virtual | ~SceneElement ()
| Destructor. More...
virtual std::string | getClassName () const
bool | addComponent (std::shared_ptr< Component > component)
| Adds a component, calls initialize() on the component, if SceneElement::isInitialized() is true. More...
bool | removeComponent (std::shared_ptr< Component > component)
| Removes a given component. More...
bool | removeComponent (const std::string &name)
| Removes the component described by name. More...
void | removeComponents ()
| Removes all components. More...
std::shared_ptr< Component > | getComponent (const std::string &name) const
| Gets the component identified by name. More...
std::vector< std::shared_ptr< Component > > | getComponents () const
| Gets all the components of this SceneElement. More...
template<class T >
std::vector< std::shared_ptr< T > > | getComponents () const
| Template version of getComponents method to get all the components with type T. More...
template<class T >
T | getValue (const std::string &component, const std::string &property) const
| Retrieves the property value from a component. More...
boost::any | getValue (const std::string &component, const std::string &property) const
| Retrieves the property value from a component. More...
template<class T >
bool | getValue (const std::string &component, const std::string &property, T *value) const
| Retrieves the property value from a component, and convertis it to the type of the output parameter. More...
void | setValue (const std::string &component, const std::string &property, const boost::any &value)
| Sets the property value of a component. More...
void | addToGroup (const std::string &group)
| Add this scene element to the given group. More...
void | removeFromGroup (const std::string &group)
| Remove this scene element from the given group. More...
void | setGroups (const std::vector< std::string > &groups)
| Set the groups of this scene element. More...
std::vector< std::string > | getGroups () const
bool | inGroup (const std::string &name)
| Test whether this SceneElement is in a specific group. More...
bool | initialize ()
| Executes the initialize operation. More...
std::string | getName () const
| Return the name of this SceneElement. More...
void | setPose (const SurgSim::Math::RigidTransform3d &pose)
| Set the pose of this SceneElement. More...
const SurgSim::Math::RigidTransform3d & | getPose () const
| Get the pose of this SceneElement. More...
std::shared_ptr< PoseComponent > | getPoseComponent ()
| Get the PoseComponent that controls the pose all Representations in this SceneElement. More...
void | setScene (std::weak_ptr< Scene > scene)
| Sets the Scene. More...
std::shared_ptr< Scene > | getScene ()
| Gets the Scene. More...
void | setRuntime (std::weak_ptr< Runtime > runtime)
| Sets the Runtime. More...
std::shared_ptr< Runtime > | getRuntime ()
| Gets the runtime. More...
bool | isInitialized () const
| Return if this SceneElement is initialized. More...
void | setActive (bool val)
| Set this SceneElement's status (active/inactive) More...
bool | isActive () const
std::shared_ptr< SceneElement > | getSharedPtr ()
| Gets a shared pointer to this SceneElement. More...
virtual YAML::Node | encode (bool standalone) const
| Convert to a YAML::Node. More...
virtual bool | decode (const YAML::Node &node)
| Pull data from a YAML::Node. More...

## Private Member Functions

std::shared_ptr< ScreenSpaceQuadRepresentation > | buildDebugQuad (const std::string &name, std::shared_ptr< Texture > texture)
| Utility function to build a debug quad. More...

## Private Attributes

std::shared_ptr< Camera > | m_camera
| The camera used for the pass. More...
std::shared_ptr< Group > | m_group
| The groupd used for the pass. More...
std::shared_ptr< RenderTarget > | m_renderTarget
| The camera's rendertarget. More...
std::shared_ptr< Material > | m_material
| The material, attached to the camera. More...
int | m_renderOrder
| The renderorder that is being used for this pass. More...
std::shared_ptr< ScreenSpaceQuadRepresentation > | m_debugColor
std::shared_ptr< ScreenSpaceQuadRepresentation > | m_debugDepth

## Detailed Description

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.

Other components do not need to be added to the pass explicitly, they only need to refer to the passes name in their respective groupReferences to be added to the render pass. The passes attributes should all be set up through uniforms in the material.

## Constructor & Destructor Documentation

## RenderPass()

SurgSim::Graphics::RenderPass::RenderPass | ( | const std::string & | name | ) |

explicit

Constructor.

Parameters

  name | The name for this SceneElement

## ~RenderPass()

SurgSim::Graphics::RenderPass::~RenderPass | ( |  | ) |

## Member Function Documentation

## buildDebugQuad()

std::shared_ptr< ScreenSpaceQuadRepresentation > SurgSim::Graphics::RenderPass::buildDebugQuad | ( | const std::string & | name,
|  | std::shared_ptr< Texture > | texture
| ) |  |

private

Utility function to build a debug quad.

Parameters

  name | The name for the component.
  texture | The texture for redering.

Returns
  a constructed quads.

## doInitialize()

bool SurgSim::Graphics::RenderPass::doInitialize | ( |  | ) |

override virtual

Executes the initialize operation.

Returns
  true if it succeeds, false if it fails.

Implements SurgSim::Framework::SceneElement.

## getCamera()

std::shared_ptr< Camera > SurgSim::Graphics::RenderPass::getCamera | ( |  | ) |

Gets the camera.

Returns
  The camera.

## getMaterial()

std::shared_ptr< Material > SurgSim::Graphics::RenderPass::getMaterial | ( |  | ) |

Gets the current material.

Returns
  The material.

## getRenderTarget()

std::shared_ptr< RenderTarget > SurgSim::Graphics::RenderPass::getRenderTarget | ( |  | ) |

Gets render target that is being used in this pass.

Returns
  The render target that should be used.

## hideColorTarget()

void SurgSim::Graphics::RenderPass::hideColorTarget | ( |  | ) |

Hides the color target display.

## hideDepthTarget()

void SurgSim::Graphics::RenderPass::hideDepthTarget | ( |  | ) |

Hides the depth target display.

## setMaterial()

bool SurgSim::Graphics::RenderPass::setMaterial | ( | std::shared_ptr< SurgSim::Framework::Component > | material | ) |

Sets the material used for rendering.

Parameters

  material | The material.

Returns
  true if it succeeds, false if it fails.

## setRenderOrder()

void SurgSim::Graphics::RenderPass::setRenderOrder | ( | SurgSim::Graphics::Camera::RenderOrder | order,
|  | int | value
| ) |  |

virtual

Sets render order.

Parameters

  order | The general render stage for this pass.
  value | An order value for this pass, lower means earlier.

## setRenderTarget()

bool SurgSim::Graphics::RenderPass::setRenderTarget | ( | std::shared_ptr< RenderTarget > | target | ) |

Sets render target for the camera, this abstracts the textures that are being used for rendering into.

Parameters

  target | The rendertarget structure.

Returns
  true if the target was successfully set

## showColorTarget()

void SurgSim::Graphics::RenderPass::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.

Parameters

  x,y | The x and y coordinates on the screen.
  width,height | The width and height on the scree.

## showDepthTarget()

void SurgSim::Graphics::RenderPass::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.

Parameters

  x,y | The x and y coordinates on the screen.
  width,height | The width and height on the screen.

## Member Data Documentation

## m_camera

std::shared_ptr<Camera> SurgSim::Graphics::RenderPass::m_camera

private

The camera used for the pass.

## m_debugColor

std::shared_ptr<ScreenSpaceQuadRepresentation> SurgSim::Graphics::RenderPass::m_debugColor

private

## m_debugDepth

std::shared_ptr<ScreenSpaceQuadRepresentation> SurgSim::Graphics::RenderPass::m_debugDepth

private

## m_group

std::shared_ptr<Group> SurgSim::Graphics::RenderPass::m_group

private

The groupd used for the pass.

## m_material

std::shared_ptr<Material> SurgSim::Graphics::RenderPass::m_material

private

The material, attached to the camera.

## m_renderOrder

int SurgSim::Graphics::RenderPass::m_renderOrder

private

The renderorder that is being used for this pass.

## m_renderTarget

std::shared_ptr<RenderTarget> SurgSim::Graphics::RenderPass::m_renderTarget

private

The camera's rendertarget.

The documentation for this class was generated from the following files:

- SurgSim/Graphics/RenderPass.h
- SurgSim/Graphics/RenderPass.cpp