GPU-Accelerated Coverage
0.1.0
Compute coverage tours for known environment with articulated objects on GPU
|
Determines regions visible from a given camera pose and marks the regions as observed on the texture. More...
#include <VisibilityRenderer.h>
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... | |
![]() | |
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. | |
ProgramShowTexture * | progShowTexture |
Shader for rendering observation texture for debugging (only if renderToWindow is true) | |
ProgramPixelCounter * | progPixelCounter |
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. | |
Node * | projectionPlaneNode |
Virtual surface where camera can be placed, only used to hide while rendering. | |
AbstractCamera * | camera |
Camera observing the scene. | |
Targets | targets |
List of targets (regions of interest) with corresponding texture. | |
ProgramCounterToFB * | progCounterToFB |
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. | |
![]() | |
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(). | |
Determines regions visible from a given camera pose and marks the regions as observed on the texture.
|
protected |
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. |
gpu_coverage::VisibilityRenderer::VisibilityRenderer | ( | const Scene *const | scene, |
const bool | renderToWindow, | ||
const bool | countPixels | ||
) |
Constructor.
[in] | scene | Sceen to be rendered. |
[in] | renderToWindow | Set to true to render also to the window framebuffer. |
[in] | countPixels | Set to true to count the number of observed pixels. |
|
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.
countPixels | True 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.
[out] | counts | Number of pixels that were observed in the previous frames. |
std::invalid_argument | Pixel 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.
|
inlinevirtual |
Returns the OpenGL texture ID of the result texture.
Implements gpu_coverage::AbstractRenderer.
|
inline |
Returns the OpenGL texture ID of the result texture in case of multiple textures.
i | Number of the texture |
|
inlinevirtual |
|
inlinevirtual |