GPU-Accelerated Coverage  0.1.0
Compute coverage tours for known environment with articulated objects on GPU
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
gpu_coverage::VisibilityRenderer Class Reference

Determines regions visible from a given camera pose and marks the regions as observed on the texture. More...

#include <VisibilityRenderer.h>

Inheritance diagram for gpu_coverage::VisibilityRenderer:
Inheritance graph
[legend]

Public Member Functions

 VisibilityRenderer (const Scene *const scene, const bool renderToWindow, const bool countPixels)
 Constructor. More...
 
 ~VisibilityRenderer ()
 Destructor.
 
virtual void display ()
 Renders the scene. More...
 
void display (const bool countPixels)
 Renders the scene. More...
 
void getPixelCounts (std::vector< GLuint > &counts)
 Returns the list of observed pixels of the previous frames. More...
 
const GLuint & getTexture () const
 Returns the OpenGL texture ID of the result texture. More...
 
const GLuint & getTexture (const size_t &i) const
 Returns the OpenGL texture ID of the result texture in case of multiple textures. More...
 
const int & getTextureHeight () const
 Height of the result texture. More...
 
const int & getTextureWidth () const
 Width of the result texture. More...
 
- Public Member Functions inherited from gpu_coverage::AbstractRenderer
 AbstractRenderer (const Scene *const scene, const std::string &name)
 Constructor. More...
 
virtual ~AbstractRenderer ()
 Destructor.
 
const bool & isReady () const
 Returns true if the renderer has been initialized correctly. More...
 
const std::string & getName () const
 Returns the name of the renderer for logging purposes. More...
 

Protected Types

enum  TextureRole {
  DEPTH = 0, COLOR = 1, COLORTEXTURE = 2, COUNTER = 3,
  VISIBILITY = 4
}
 
typedef std::list< std::pair< Node *, GLuint > > Targets
 List of targets (regions of interest) with corresponding texture.
 

Protected Member Functions

void readBack ()
 Read back ring bufer.
 

Protected Attributes

const bool renderToWindow
 True if renderer should also render to window framebuffer.
 
const bool countPixels
 True if observed pixels should be counted, can be overwritten by argument to display(const bool countPixels)
 
ProgramVisualFlat progFlat
 Shader for 3D rendering without material (used to fill depth buffer)
 
ProgramVisibility progVisibility
 Shader for marking observed texels.
 
ProgramShowTextureprogShowTexture
 Shader for rendering observation texture for debugging (only if renderToWindow is true)
 
ProgramPixelCounterprogPixelCounter
 Shadere for counting observed pixels (only if countPixels is true)
 
const int width
 Width of the framebuffer for rendering the 3D scene in pixels.
 
const int height
 Height of the framebuffer for rendering the 3D scene in pixels.
 
const int textureWidth
 Width of the result texture in pixels.
 
const int textureHeight
 Height of the result texture in pixels.
 
std::list< GLuint > pixelCounts
 List of number of observed pixels in the previous frames, see getPixelCounts()
 
GLuint pixelCountBuffer
 Atomic counter buffer for reading back pixels counts from GPU.
 
GLuint framebuffers [2]
 Framebuffers for rendering 3D scene and for rendering visibility texture.
 
GLuint textures [20]
 4 internal textures and up to 16 target textures
 
size_t numTextures
 Number of allocated teextures.
 
GLuint vao
 Vertex array object.
 
GLuint vbo
 Vertex buffer objeect.
 
NodeprojectionPlaneNode
 Virtual surface where camera can be placed, only used to hide while rendering.
 
AbstractCameracamera
 Camera observing the scene.
 
Targets targets
 List of targets (regions of interest) with corresponding texture.
 
ProgramCounterToFBprogCounterToFB
 Shader counting pixels and writing result directly to framebuffer.
 
GLuint pbo [4]
 Pixel buffer objects as ring buffer.
 
const GLuint numPbo
 Number of allocated pixel buffer objects.
 
GLuint curPbo
 Current pixel buffer object.
 
GLuint run
 Ring buffer index.
 
GLuint vaoPoint
 Vertex array object for rendering single output pixel.
 
GLuint vboPoint
 Vertex buffer object for rendering single output pixel.
 
- Protected Attributes inherited from gpu_coverage::AbstractRenderer
const Scene *const scene
 Pointer to the scene to be rendered.
 
const std::string name
 Name of the renderer, see getName().
 
bool ready
 Set to true when renderer is ready, see isReady().
 

Detailed Description

Determines regions visible from a given camera pose and marks the regions as observed on the texture.

Member Enumeration Documentation

Enumerator
DEPTH 

Depth buffer of the 3D scene.

COLOR 

Color buffer of the 3D scene, unused.

COLORTEXTURE 

Visibility texture for debugging.

COUNTER 

Texture for reading back pixel counter.

VISIBILITY 

Result texture.

Constructor & Destructor Documentation

gpu_coverage::VisibilityRenderer::VisibilityRenderer ( const Scene *const  scene,
const bool  renderToWindow,
const bool  countPixels 
)

Constructor.

Parameters
[in]sceneSceen to be rendered.
[in]renderToWindowSet to true to render also to the window framebuffer.
[in]countPixelsSet to true to count the number of observed pixels.

Member Function Documentation

virtual void gpu_coverage::VisibilityRenderer::display ( )
virtual

Renders the scene.

This method redirects to display(const bool countPixels) with the default value for countPixels passed to the constructor.

Implements gpu_coverage::AbstractRenderer.

void gpu_coverage::VisibilityRenderer::display ( const bool  countPixels)

Renders the scene.

Parameters
countPixelsTrue if number of newly observed pixels should be counted.

This method does the main work of the renderer.

void gpu_coverage::VisibilityRenderer::getPixelCounts ( std::vector< GLuint > &  counts)

Returns the list of observed pixels of the previous frames.

Parameters
[out]countsNumber of pixels that were observed in the previous frames.
Exceptions
std::invalid_argumentPixel counting has been disabled in the constructor.

This method clears fills the vector countPixels with the number of target texels that have been observed since the last call to this method.

This method causes the GPU pipeline to be flushed in order to get access to the pixel count of the most recent frame. Hence, this method should be called as rarely as possible, in the optimal case only once after all rendering has been completed.

const GLuint& gpu_coverage::VisibilityRenderer::getTexture ( ) const
inlinevirtual

Returns the OpenGL texture ID of the result texture.

Returns
OpenGL texture ID.

Implements gpu_coverage::AbstractRenderer.

const GLuint& gpu_coverage::VisibilityRenderer::getTexture ( const size_t &  i) const
inline

Returns the OpenGL texture ID of the result texture in case of multiple textures.

Parameters
iNumber of the texture
Returns
OpenGL texture ID.
const int& gpu_coverage::VisibilityRenderer::getTextureHeight ( ) const
inlinevirtual

Height of the result texture.

Returns
Height in pixels.

Implements gpu_coverage::AbstractRenderer.

const int& gpu_coverage::VisibilityRenderer::getTextureWidth ( ) const
inlinevirtual

Width of the result texture.

Returns
Width in pixels.

Implements gpu_coverage::AbstractRenderer.


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