Nori  24
BlockGenerator Class Reference

Spiraling block generator. More...

#include <block.h>

Collaboration diagram for BlockGenerator:

Public Member Functions

 BlockGenerator (const Vector2i &size, int blockSize)
 Create a block generator with. More...
 
bool next (ImageBlock &block)
 Return the next block to be rendered. More...
 
void reset ()
 Reset to the first block. More...
 
int getBlockCount () const
 Return the total number of blocks.
 

Protected Types

enum  EDirection { ERight = 0 , EDown , ELeft , EUp }
 

Protected Attributes

Point2i m_block
 
Vector2i m_numBlocks
 
Vector2i m_size
 
int m_blockSize
 
int m_numSteps
 
int m_blocksLeft
 
int m_stepsLeft
 
int m_direction
 
tbb::mutex m_mutex
 

Detailed Description

Spiraling block generator.

This class can be used to chop up an image into many small rectangular blocks suitable for parallel rendering. The blocks are ordered in spiraling pattern so that the center is rendered first.

Definition at line 137 of file block.h.

Constructor & Destructor Documentation

◆ BlockGenerator()

BlockGenerator::BlockGenerator ( const Vector2i size,
int  blockSize 
)

Create a block generator with.

Parameters
sizeSize of the image that should be split into blocks
blockSizeMaximum size of the individual blocks

Definition at line 140 of file block.cpp.

Member Function Documentation

◆ next()

bool BlockGenerator::next ( ImageBlock block)

Return the next block to be rendered.

This function is thread-safe

Returns
false if there were no more blocks

Definition at line 156 of file block.cpp.

◆ reset()

void BlockGenerator::reset ( )

Reset to the first block.

This function is thread-safe

Definition at line 148 of file block.cpp.


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