OpenWalnut
1.5.0dev
|
Class to create a Turing noise texture using multiple threads if needed. More...
#include <WTuringTextureCreator.h>
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< WGETexture3D > | create (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... | |
Class to create a Turing noise texture using multiple threads if needed.
Definition at line 38 of file WTuringTextureCreator.h.
WTuringTextureCreator::WTuringTextureCreator | ( | std::size_t | numThreads = boost::thread::hardware_concurrency() | ) |
Constructor.
Initializes threading but does not yet start texture creation.
numThreads | the 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 | ( | ) |
Destructor.
Definition at line 48 of file WTuringTextureCreator.cpp.
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.
sizeX | the size along the x axis. |
sizeY | the size along the y axis. |
sizeZ | the size along the z axis. |
Definition at line 73 of file WTuringTextureCreator.cpp.
References m_numIterations, m_spotIrregularity, m_spotSize, and m_threads.
void WTuringTextureCreator::setNumIterations | ( | std::size_t | iter | ) |
The number of iterations to use for calculating the texture.
iter | the 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.
void WTuringTextureCreator::setSpotIrregularity | ( | float | irr | ) |
The irregularity of the spots.
irr | the 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.
void WTuringTextureCreator::setSpotSize | ( | float | size | ) |
Define the size of the spots inside the texture.
size | the size in [0,1], 1 meaning larger spots. |
Definition at line 66 of file WTuringTextureCreator.cpp.
References m_spotSize.
|
private |
Number of iterations.
100 by default.
Definition at line 211 of file WTuringTextureCreator.h.
Referenced by create(), and setNumIterations().
|
private |
Spot irregularity.
0.1 by default.
Definition at line 216 of file WTuringTextureCreator.h.
Referenced by create(), and setSpotIrregularity().
|
private |
Spot size.
0.1 by default.
Definition at line 221 of file WTuringTextureCreator.h.
Referenced by create(), and setSpotSize().
|
private |
The thread pool.
Definition at line 226 of file WTuringTextureCreator.h.
Referenced by create(), and WTuringTextureCreator().