proland::ReadbackManager Class Reference
[terrain]

A manager for asynchronous readbacks from a framebuffer. More...

#include <ReadbackManager.h>

List of all members.

Classes

class  Callback
 A callback function called when a readback is done; see ReadbackManager. More...

Public Member Functions

 ReadbackManager (int maxReadbackPerFrame, int readbackDelay, int bufferSize)
 Creates a new readback manager.
virtual ~ReadbackManager ()
 Destroys this readback manager.
bool canReadback ()
 Returns true if a new readback can be started for the current frame.
bool readback (ptr< FrameBuffer > fb, int x, int y, int w, int h, TextureFormat f, PixelType t, ptr< Callback > cb)
 Starts a new readback and returns immediately.
void newFrame ()
 Informs this manager that a new frame has started.

Detailed Description

A manager for asynchronous readbacks from a framebuffer.

Asynchronous means that readbacks are non blocking: a read operation returns immediately with an empty result, and the actual result is passed via a callback function when it becomes available (in practice n frames after the read was started, where n is user defined).

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

proland::ReadbackManager::ReadbackManager ( int  maxReadbackPerFrame,
int  readbackDelay,
int  bufferSize 
)

Creates a new readback manager.

Parameters:
maxReadbackPerFrame maximum number of readbacks that can be started per frame.
readbackDelay number of frames between the start of a readback and its end.
bufferSize maximum number of bytes per readback.
virtual proland::ReadbackManager::~ReadbackManager (  )  [virtual]

Destroys this readback manager.


Member Function Documentation

bool proland::ReadbackManager::canReadback (  ) 

Returns true if a new readback can be started for the current frame.

void proland::ReadbackManager::newFrame (  ) 

Informs this manager that a new frame has started.

bool proland::ReadbackManager::readback ( ptr< FrameBuffer >  fb,
int  x,
int  y,
int  w,
int  h,
TextureFormat  f,
PixelType  t,
ptr< Callback cb 
)

Starts a new readback and returns immediately.

Returns true if the readback has effectively started (see canReadback()).

Parameters:
fb the framebuffer from which the data must be read. Data will be read from the last buffer specified with FrameBuffer::setReadBuffer for this framebuffer.
x x coordinate of the lower left corner of the region to be read.
y x coordinate of the lower left corner of the region to be read.
w width of the region to be read.
h height the region to be read.
f the components to be read.
t the type to be used to store the read data.
cb the function to be called when the readback is finished.

Generated on Sat May 12 09:41:38 2012 for proland by  doxygen 1.6.1