OpenWalnut  1.5.0dev
Classes | Public Member Functions | Private Attributes | List of all members
WTuringTextureCreator Class Reference

Class to create a Turing noise texture using multiple threads if needed. More...

#include <WTuringTextureCreator.h>

+ Collaboration diagram for WTuringTextureCreator:

Classes

class  TextureThread
 The thread calculating the Turing concentration diffusion in a given range. More...
 

Public Member Functions

 WTuringTextureCreator (std::size_t numThreads=boost::thread::hardware_concurrency())
 Constructor. More...
 
 ~WTuringTextureCreator ()
 Destructor. More...
 
osg::ref_ptr< WGETexture3Dcreate (std::size_t sizeX, std::size_t sizeY, std::size_t sizeZ)
 Create the Turing noise texture of arbitrary size. More...
 
void setSpotSize (float size)
 Define the size of the spots inside the texture. More...
 
void setSpotIrregularity (float irr)
 The irregularity of the spots. More...
 
void setNumIterations (std::size_t iter)
 The number of iterations to use for calculating the texture. More...
 

Private Attributes

float m_numIterations
 Number of iterations. More...
 
float m_spotIrregularity
 Spot irregularity. More...
 
float m_spotSize
 Spot size. More...
 
std::vector< std::shared_ptr< TextureThread > > m_threads
 The thread pool. More...
 

Detailed Description

Class to create a Turing noise texture using multiple threads if needed.

Definition at line 38 of file WTuringTextureCreator.h.

Constructor & Destructor Documentation

◆ WTuringTextureCreator()

WTuringTextureCreator::WTuringTextureCreator ( std::size_t  numThreads = boost::thread::hardware_concurrency())

Constructor.

Initializes threading but does not yet start texture creation.

Parameters
numThreadsthe number of threads to use. By default, this is the number of threads natively supported by the CPU.

Definition at line 35 of file WTuringTextureCreator.cpp.

References m_threads.

◆ ~WTuringTextureCreator()

WTuringTextureCreator::~WTuringTextureCreator ( )

Destructor.

Definition at line 48 of file WTuringTextureCreator.cpp.

Member Function Documentation

◆ create()

osg::ref_ptr< WGETexture3D > WTuringTextureCreator::create ( std::size_t  sizeX,
std::size_t  sizeY,
std::size_t  sizeZ 
)

Create the Turing noise texture of arbitrary size.

This function is synchronous and returns a valid texture.

Parameters
sizeXthe size along the x axis.
sizeYthe size along the y axis.
sizeZthe size along the z axis.
Returns
the texture.

Definition at line 73 of file WTuringTextureCreator.cpp.

References m_numIterations, m_spotIrregularity, m_spotSize, and m_threads.

◆ setNumIterations()

void WTuringTextureCreator::setNumIterations ( std::size_t  iter)

The number of iterations to use for calculating the texture.

Parameters
iterthe number of iterations. 100 is recommended, lower values create a noisy texture, higher values cause the spots to be rather smooth.

Definition at line 52 of file WTuringTextureCreator.cpp.

References m_numIterations.

◆ setSpotIrregularity()

void WTuringTextureCreator::setSpotIrregularity ( float  irr)

The irregularity of the spots.

Parameters
irrthe irregularity in [0,1]; 0 producing a very regular grid of spots, whereas 1 causes the spots to be rather irregular.

Definition at line 59 of file WTuringTextureCreator.cpp.

References m_spotIrregularity.

◆ setSpotSize()

void WTuringTextureCreator::setSpotSize ( float  size)

Define the size of the spots inside the texture.

Parameters
sizethe size in [0,1], 1 meaning larger spots.

Definition at line 66 of file WTuringTextureCreator.cpp.

References m_spotSize.

Member Data Documentation

◆ m_numIterations

float WTuringTextureCreator::m_numIterations
private

Number of iterations.

100 by default.

Definition at line 211 of file WTuringTextureCreator.h.

Referenced by create(), and setNumIterations().

◆ m_spotIrregularity

float WTuringTextureCreator::m_spotIrregularity
private

Spot irregularity.

0.1 by default.

Definition at line 216 of file WTuringTextureCreator.h.

Referenced by create(), and setSpotIrregularity().

◆ m_spotSize

float WTuringTextureCreator::m_spotSize
private

Spot size.

0.1 by default.

Definition at line 221 of file WTuringTextureCreator.h.

Referenced by create(), and setSpotSize().

◆ m_threads

std::vector< std::shared_ptr< TextureThread > > WTuringTextureCreator::m_threads
private

The thread pool.

Definition at line 226 of file WTuringTextureCreator.h.

Referenced by create(), and WTuringTextureCreator().


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