Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::ReplayableSampler Class Reference

Specialized sampler implementation used to seed MLT-style algorithm. More...

#include <mitsuba/bidir/rsampler.h>

+ Inheritance diagram for mitsuba::ReplayableSampler:

Public Member Functions

 ReplayableSampler ()
 Construct a new sampler. More...
 
 ReplayableSampler (Stream *stream, InstanceManager *manager)
 Unserialize a sampler. More...
 
virtual ref< Samplerclone ()
 
virtual void advance ()
 Advance to the next sample. More...
 
virtual void generate (const Point2i &pos)
 Generate new samples. More...
 
virtual void setSampleIndex (size_t sampleIndex)
 Manually set the current sample index. More...
 
virtual Float next1D ()
 Retrieve the next component value from the current sample. More...
 
virtual Point2 next2D ()
 Retrieve the next two component values from the current sample. More...
 
virtual void request2DArray (size_t size)
 Request that a 2D array will be made available for later consumption by next2DArray(). More...
 
virtual void request1DArray (size_t size)
 Same as request2DArray(), but in 1D. More...
 
virtual void serialize (Stream *stream, InstanceManager *manager) const
 Serialize this sampler to disk. More...
 
virtual std::string toString () const
 Return a string description. More...
 
RandomgetRandom ()
 Return the underlying random number generator. More...
 
void updateSampleIndex (size_t index)
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from mitsuba::Sampler
virtual void setFilmResolution (const Vector2i &res, bool blocked)
 Set the film size in pixels. More...
 
Point2next2DArray (size_t size)
 Retrieve the next 2D array of values from the current sample. More...
 
Floatnext1DArray (size_t size)
 Same as above, but 1D. More...
 
size_t getSampleCount () const
 Return total number of samples. More...
 
size_t getSampleIndex () const
 Return the current sample index. More...
 
- Public Member Functions inherited from mitsuba::ConfigurableObject
virtual void setParent (ConfigurableObject *parent)
 Notify the ConfigurableObject instance about its parent object. More...
 
virtual void addChild (const std::string &name, ConfigurableObject *child)
 Add a child (default implementation throws an error) More...
 
void addChild (ConfigurableObject *child)
 Add an unnamed child. More...
 
virtual void configure ()
 Configure the object (called once after construction and addition of all child ConfigurableObject instances)) More...
 
const std::string & getID () const
 Return the identifier associated with this instance (or "unnamed") More...
 
void setID (const std::string &name)
 Set the identifier associated with this instance. More...
 
const PropertiesgetProperties () const
 Return the properties object that was originally used to create this instance. More...
 
- Public Member Functions inherited from mitsuba::SerializableObject
 SerializableObject (Stream *stream, InstanceManager *manager)
 Unserialize a serializable object. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::Sampler
static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::ConfigurableObject
static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::SerializableObject
static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~ReplayableSampler ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from mitsuba::Sampler
 Sampler (const Properties &props)
 Construct a new sampler. More...
 
 Sampler (Stream *stream, InstanceManager *manager)
 Unserialize a sampler. More...
 
virtual ~Sampler ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from mitsuba::ConfigurableObject
virtual ~ConfigurableObject ()
 Virtual destructor. More...
 
 ConfigurableObject (const Properties &props)
 Construct a configurable object. More...
 
 ConfigurableObject (Stream *stream, InstanceManager *manager)
 Unserialize a configurable object. More...
 
- Protected Member Functions inherited from mitsuba::SerializableObject
 SerializableObject ()
 Construct a serializable object. More...
 
virtual ~SerializableObject ()
 Virtual deconstructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

ref< Randomm_initial
 
ref< Randomm_random
 
- Protected Attributes inherited from mitsuba::Sampler
size_t m_sampleCount
 
size_t m_sampleIndex
 
std::vector< size_t > m_req1D
 
std::vector< size_t > m_req2D
 
std::vector< Float * > m_sampleArrays1D
 
std::vector< Point2 * > m_sampleArrays2D
 
size_t m_dimension1DArray
 
size_t m_dimension2DArray
 
- Protected Attributes inherited from mitsuba::ConfigurableObject
Properties m_properties
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Specialized sampler implementation used to seed MLT-style algorithm.

Allows to query for the current sample index, which can later be used to rewind back to this state. In the case of MLT, this makes it possible to sample paths approximately proportional to their contribution without actually having to store millions of path. Note that `rewinding' is naive – it just resets & regenerates the whole random number sequence, which might be slow.

Constructor & Destructor Documentation

mitsuba::ReplayableSampler::ReplayableSampler ( )

Construct a new sampler.

mitsuba::ReplayableSampler::ReplayableSampler ( Stream stream,
InstanceManager manager 
)

Unserialize a sampler.

virtual mitsuba::ReplayableSampler::~ReplayableSampler ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual void mitsuba::ReplayableSampler::advance ( )
virtual

Advance to the next sample.

Reimplemented from mitsuba::Sampler.

virtual ref<Sampler> mitsuba::ReplayableSampler::clone ( )
virtual

Create a clone of this sampler. The clone is allowed to be different to some extent, e.g. a pseudorandom generator should be based on a different random seed compared to the original. All other parameters, are copied exactly.

Reimplemented from mitsuba::Sampler.

virtual void mitsuba::ReplayableSampler::generate ( const Point2i offset)
virtual

Generate new samples.

This function is called initially and every time the generated samples have been exhausted. When used in conjunction with a SamplingIntegrator, this will be called before starting to render each pixel, and the argument denotes the pixel position. Otherwise, some dummy value should be provided, e.g. Point2i(-1)

Reimplemented from mitsuba::Sampler.

virtual const Class* mitsuba::ReplayableSampler::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from mitsuba::Sampler.

Random* mitsuba::ReplayableSampler::getRandom ( )
inline

Return the underlying random number generator.

virtual Float mitsuba::ReplayableSampler::next1D ( )
virtual

Retrieve the next component value from the current sample.

Implements mitsuba::Sampler.

virtual Point2 mitsuba::ReplayableSampler::next2D ( )
virtual

Retrieve the next two component values from the current sample.

Implements mitsuba::Sampler.

virtual void mitsuba::ReplayableSampler::request1DArray ( size_t  size)
virtual

Same as request2DArray(), but in 1D.

Reimplemented from mitsuba::Sampler.

virtual void mitsuba::ReplayableSampler::request2DArray ( size_t  size)
virtual

Request that a 2D array will be made available for later consumption by next2DArray().

This function must be called before generate(). See next2DArray() for a more detailed description of this feature.

Reimplemented from mitsuba::Sampler.

virtual void mitsuba::ReplayableSampler::serialize ( Stream stream,
InstanceManager manager 
) const
virtual

Serialize this sampler to disk.

Reimplemented from mitsuba::Sampler.

virtual void mitsuba::ReplayableSampler::setSampleIndex ( size_t  sampleIndex)
virtual

Manually set the current sample index.

Reimplemented from mitsuba::Sampler.

virtual std::string mitsuba::ReplayableSampler::toString ( ) const
virtual

Return a string description.

Reimplemented from Object.

void mitsuba::ReplayableSampler::updateSampleIndex ( size_t  index)
inline

Update the current sample index, but without changing the RNG state. This is useful if the underlying random number generator has been used outside of this class

Member Data Documentation

ref<Random> mitsuba::ReplayableSampler::m_initial
protected
ref<Random> mitsuba::ReplayableSampler::m_random
protected
Class* mitsuba::ReplayableSampler::m_theClass
static

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