Open CASCADE Technology  7.1.0.beta
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

OpenGl_TileSampler Class Reference

Tool object used for sampling screen tiles according to estimated pixel variance (used in path tracing engine). To improve GPU thread coherency, render window is split into pixel blocks or tiles. More...

#include <OpenGl_TileSampler.hxx>

Public Member Functions

 OpenGl_TileSampler ()
 Creates new tile sampler. More...
 
int SizeX () const
 Returns width of ray-tracing viewport. More...
 
int SizeY () const
 Returns height of ray-tracing viewport. More...
 
int NbTilesX () const
 Returns number of tiles in X dimension. More...
 
int NbTilesY () const
 Returns number of tiles in Y dimension. More...
 
int NbTiles () const
 Returns total number of tiles in viewport. More...
 
void SetSize (const int theSizeX, const int theSizeY)
 Specifies size of ray-tracing viewport. More...
 
int TileArea (const int theX, const int theY) const
 Returns number of pixels in the given tile. More...
 
void GrabVarianceMap (const Handle< OpenGl_Context > &theContext)
 Fetches current error estimation from the GPU and builds 2D discrete distribution for tile sampling. More...
 
void Sample (int &theOffsetX, int &theOffsetY)
 Samples tile location according to estimated error. More...
 
void Reset ()
 Resets tile sampler to initial state. More...
 
void Upload (const Handle< OpenGl_Context > &theContext, const Handle< OpenGl_Texture > &theTexture, bool theAdaptive)
 Uploads offsets of sampled tiles to the given OpenGL texture. More...
 

Static Public Member Functions

static int TileSize ()
 Size of individual tile in pixels. More...
 

Protected Member Functions

float Tile (const int theX, const int theY) const
 Returns tile value (estimated error). More...
 
float & ChangeTile (const int theX, const int theY)
 Returns tile value (estimated error). More...
 

Protected Attributes

std::vector< float > myVarianceMap
 Estimation of visual error per tile. More...
 
std::vector< float > myMarginalMap
 Marginal distribution of 2D error map. More...
 
OpenGl_HaltonSampler mySampler
 Halton sequence generator. More...
 
int mySample
 Index of generated sample. More...
 
int mySizeX
 Width of ray-tracing viewport. More...
 
int mySizeY
 Height of ray-tracing viewport. More...
 
int myTilesX
 Number of tiles in X dimension. More...
 
int myTilesY
 Number of tiles in Y dimension. More...
 

Detailed Description

Tool object used for sampling screen tiles according to estimated pixel variance (used in path tracing engine). To improve GPU thread coherency, render window is split into pixel blocks or tiles.

Constructor & Destructor Documentation

OpenGl_TileSampler::OpenGl_TileSampler ( )

Creates new tile sampler.

Member Function Documentation

float& OpenGl_TileSampler::ChangeTile ( const int  theX,
const int  theY 
)
inlineprotected

Returns tile value (estimated error).

void OpenGl_TileSampler::GrabVarianceMap ( const Handle< OpenGl_Context > &  theContext)

Fetches current error estimation from the GPU and builds 2D discrete distribution for tile sampling.

int OpenGl_TileSampler::NbTiles ( ) const
inline

Returns total number of tiles in viewport.

int OpenGl_TileSampler::NbTilesX ( ) const
inline

Returns number of tiles in X dimension.

int OpenGl_TileSampler::NbTilesY ( ) const
inline

Returns number of tiles in Y dimension.

void OpenGl_TileSampler::Reset ( void  )
inline

Resets tile sampler to initial state.

void OpenGl_TileSampler::Sample ( int &  theOffsetX,
int &  theOffsetY 
)

Samples tile location according to estimated error.

void OpenGl_TileSampler::SetSize ( const int  theSizeX,
const int  theSizeY 
)

Specifies size of ray-tracing viewport.

int OpenGl_TileSampler::SizeX ( ) const
inline

Returns width of ray-tracing viewport.

int OpenGl_TileSampler::SizeY ( ) const
inline

Returns height of ray-tracing viewport.

float OpenGl_TileSampler::Tile ( const int  theX,
const int  theY 
) const
inlineprotected

Returns tile value (estimated error).

int OpenGl_TileSampler::TileArea ( const int  theX,
const int  theY 
) const
inline

Returns number of pixels in the given tile.

static int OpenGl_TileSampler::TileSize ( )
inlinestatic

Size of individual tile in pixels.

void OpenGl_TileSampler::Upload ( const Handle< OpenGl_Context > &  theContext,
const Handle< OpenGl_Texture > &  theTexture,
bool  theAdaptive 
)

Uploads offsets of sampled tiles to the given OpenGL texture.

Field Documentation

std::vector<float> OpenGl_TileSampler::myMarginalMap
protected

Marginal distribution of 2D error map.

int OpenGl_TileSampler::mySample
protected

Index of generated sample.

OpenGl_HaltonSampler OpenGl_TileSampler::mySampler
protected

Halton sequence generator.

int OpenGl_TileSampler::mySizeX
protected

Width of ray-tracing viewport.

int OpenGl_TileSampler::mySizeY
protected

Height of ray-tracing viewport.

int OpenGl_TileSampler::myTilesX
protected

Number of tiles in X dimension.

int OpenGl_TileSampler::myTilesY
protected

Number of tiles in Y dimension.

std::vector<float> OpenGl_TileSampler::myVarianceMap
protected

Estimation of visual error per tile.


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