Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
FloodFiller Class Reference

Perform an approximate flood fill on the GPU, outputing a color filled image or a distance map. Implement the method described in Jump Flooding in GPU with Applications to Voronoi Diagram and Distance Transform, Rong et al., 2006. More...

#include <FloodFiller.hpp>

Public Types

enum class  Output { COLOR , DISTANCE }
 Output mode: either the color of the input seeds propagated, or the normalized distance to the closest seed at each pixel.
 

Public Member Functions

 FloodFiller (uint width, uint height)
 
void process (const Texture &texture, Output mode)
 
void resize (uint width, uint height)
 
const Texturetexture () const
 

Private Member Functions

TextureextractAndPropagate (const Texture &texture)
 

Private Attributes

Program_extract
 Extract the flood fill seeds.
 
Program_floodfill
 Perform one pass of the flood fill.
 
Program_compositeColor
 Generate the color image from the flood-fill seed map.
 
Program_compositeDist
 Generate the normalized distance map from the flood-fill seed map.
 
Texture _ping
 First flooding texture.
 
Texture _pong
 Second flooding texture.
 
Texture _final
 Texture containing the result.
 
int _iterations
 Number of iterations to perform (derived from input size).
 

Detailed Description

Perform an approximate flood fill on the GPU, outputing a color filled image or a distance map. Implement the method described in Jump Flooding in GPU with Applications to Voronoi Diagram and Distance Transform, Rong et al., 2006.

Constructor & Destructor Documentation

◆ FloodFiller()

FloodFiller::FloodFiller ( uint  width,
uint  height 
)

Constructor.

Parameters
widthinternal processing width
heightinternal processing height

Member Function Documentation

◆ extractAndPropagate()

Texture * FloodFiller::extractAndPropagate ( const Texture texture)
private

Extract seeds from the input texture and propagate them so that each pixel contains the coordinates of the closest seed (approximately). The result will be stored in _ping.

Parameters
texturethe input texture
Returns
the internal texture containing the final result

◆ process()

void FloodFiller::process ( const Texture texture,
Output  mode 
)

Fill a given input texture.

Parameters
texturethe GPU ID of the texture
modethe output mode (color or distance)

◆ resize()

void FloodFiller::resize ( uint  width,
uint  height 
)

Resize the internal buffers.

Parameters
widththe new width
heightthe new height

◆ texture()

const Texture * FloodFiller::texture ( ) const
inline

The GPU ID of the filter result.

Returns
the ID of the result texture

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