MobileRT  1.0
A multi platform C++ CPU progressive Ray Tracer.
MobileRT::Sampler Class Referenceabstract

#include <Sampler.hpp>

Inheritance diagram for MobileRT::Sampler:
Inheritance graph
Collaboration diagram for MobileRT::Sampler:
Collaboration graph

Public Member Functions

 Sampler ()=default
 
 Sampler (::std::uint32_t width, ::std::uint32_t height, ::std::uint32_t samples)
 
 Sampler (const Sampler &sampler)=delete
 
 Sampler (Sampler &&sampler) noexcept=delete
 
virtual ~Sampler ()
 
Sampleroperator= (const Sampler &sampler)=delete
 
Sampleroperator= (Sampler &&sampler) noexcept=delete
 
void resetSampling ()
 
void stopSampling ()
 
virtual float getSample (::std::uint32_t sample)=0
 
float getSample ()
 

Public Attributes

::std::atomic<::std::uint32_t > sample_ {}
 
const ::std::uint32_t domainSize_ {::std::numeric_limits<::std::uint32_t>::max()}
 
::std::uint32_t samples_ {::std::numeric_limits<::std::uint32_t>::max()}
 

Protected Member Functions

template<const ::std::size_t S>
float getSampleFromArray (const ::std::array< float, S > &values)
 

Detailed Description

A class which abstracts a random number generator.

Constructor & Destructor Documentation

◆ Sampler() [1/4]

MobileRT::Sampler::Sampler ( )
explicitdefault

◆ Sampler() [2/4]

MobileRT::Sampler::Sampler ( ::std::uint32_t  width,
::std::uint32_t  height,
::std::uint32_t  samples 
)
explicit

◆ Sampler() [3/4]

MobileRT::Sampler::Sampler ( const Sampler sampler)
delete

◆ Sampler() [4/4]

MobileRT::Sampler::Sampler ( Sampler &&  sampler)
deletenoexcept

◆ ~Sampler()

Sampler::~Sampler ( )
virtual

The destructor.

Member Function Documentation

◆ getSample() [1/2]

virtual float MobileRT::Sampler::getSample ( ::std::uint32_t  sample)
pure virtual

Calculates a new sample.

Parameters
sampleThe index of the desired sample.
Returns
A random value between 0 and 1.

Implemented in Components::Constant, Components::HaltonSeq, Components::StaticHaltonSeq, Components::Stratified, Components::PCG, Components::MersenneTwister, Components::StaticMersenneTwister, and Components::StaticPCG.

◆ getSample() [2/2]

float Sampler::getSample ( )

Calculates a new sample.

Returns
A random value between 0 and 1.
Here is the call graph for this function:

◆ getSampleFromArray()

template<const ::std::size_t S>
float MobileRT::Sampler::getSampleFromArray ( const ::std::array< float, S > &  values)
inlineprotected

An auxiliary method that increments the sample counter and gets the current sample from an array received via parameters.

Template Parameters
SThe size of the array.
Parameters
valuesThe array to read the current sample.
Returns
The value in the array corresponding to the current sample.

◆ operator=() [1/2]

Sampler& MobileRT::Sampler::operator= ( const Sampler sampler)
delete

◆ operator=() [2/2]

Sampler& MobileRT::Sampler::operator= ( Sampler &&  sampler)
deletenoexcept

◆ resetSampling()

void Sampler::resetSampling ( )

Resets the sampling counter.

◆ stopSampling()

void Sampler::stopSampling ( )

Stops the sampling process.

Member Data Documentation

◆ domainSize_

const ::std::uint32_t MobileRT::Sampler::domainSize_ {::std::numeric_limits<::std::uint32_t>::max()}

◆ sample_

::std::atomic<::std::uint32_t> MobileRT::Sampler::sample_ {}

◆ samples_

::std::uint32_t MobileRT::Sampler::samples_ {::std::numeric_limits<::std::uint32_t>::max()}

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