HDK
|
#include <BRAY_PixelOracle.h>
Classes | |
class | Factory |
Public Types | |
using | FactoryPtr = UT_UniquePtr< Factory > |
Public Member Functions | |
BRAY_PixelOracle (const UT_Options *args) | |
virtual | ~BRAY_PixelOracle () |
virtual const char * | className () const =0 |
Class name of the oracle. More... | |
virtual size_t | fillPixels (BRAY_PixelState *pstate, const UT_DimRect &rect, UT_Vector2i *pixels) |
virtual bool | initializeOracle (BRAY_FilterInit &init, int xres, int yres, int spp, const UT_StringArray &aov_names, const UT_IntArray &aov_sizes)=0 |
SYS_HashType | optionsHash () const |
Return the hash of the arguments for this filter. More... | |
virtual BRAY_SampleFilterPtr | sampleFilter (BRAY_FilterInit &init, const UT_StringArray &all_aovs) |
virtual bool | checkpoint (UT_JSONWriter &w) const =0 |
virtual bool | loadCheckpoint (UT_JSONParser &p) |
Static Public Member Functions | |
static void | listFactories (UT_StringArray &result) |
static void | registerPlugin (const UT_StringHolder &name, FactoryPtr factory) |
static UT_UniquePtr < BRAY_PixelOracle > | instancePlugin (const UT_StringRef &style, const UT_Options *options) |
static void | releasePlugin (UT_UniquePtr< BRAY_PixelOracle > p) |
static void | freePluginCache () |
Protected Member Functions | |
const float * | readPixel (const BRAY_PixelState &pstate, int aov_index, int px, int py) const |
float | randomF (BRAY_PixelState &pstate) const |
uint | randomI (BRAY_PixelState &pstate) const |
int | addAOV (BRAY_FilterInit &init, const UT_StringHolder &name, const UT_StringHolder &var, int tuple_size, const BRAY::OptionSet &options) |
BRAY::OptionSet | planeProperties (BRAY_FilterInit &init) const |
Create an option set before adding creating an extra AOV. More... | |
A Pixel Oracle is responsible for detemining which pixels should be sampled within a tile.
Definition at line 32 of file BRAY_PixelOracle.h.
Definition at line 42 of file BRAY_PixelOracle.h.
BRAY_PixelOracle::BRAY_PixelOracle | ( | const UT_Options * | args | ) |
|
virtual |
|
protected |
If the oracle needs an additional AOV, you can call this method during initializeOracle(). The function returns the index of the new AOV (or -1 on failure). If there are errors, the messages will be printed out to UT_ErrorLog.
If options are required, they can be initialized by planeProperties() Passing in an empty OptionSet is legal.
|
pure virtual |
The checkpoint function is called to save the state of the pixel filter to a checkpoint file.
The default method prints a warning that checkpointing isn't supported and fails.
|
pure virtual |
Class name of the oracle.
|
virtual |
Fill out the pixels which need to be sampled, returning the number of pixels filled out. The pixels
buffer is guaranteed to have at least rect.width()*rect.height() entries. The function should return the number of samples filled out. Each pixel should be inside the bounding rectangle.
The oracle is free to return a smaller number of rays. It's also possible to send multiple rays for a single pixel.
The default method will send one ray per pixel and is somewhat similar to
|
pure virtual |
Method used to initialize the oracle. This will be called prior to each render (oracles should clear any buffers on subsequent renders).
Note that sample filters are not cleared between subsequent renders, so if the oracle creates a sample filter, it should be persistent between runs.
|
static |
Factory access
|
static |
Factory access
|
virtual |
loadCheckpoint
is called to restore the state of the pixel filter. In theory, all the settings for the pixel filter should match. Only per-pixel data should be different.
|
inline |
Return the hash of the arguments for this filter.
Definition at line 94 of file BRAY_PixelOracle.h.
|
protected |
Create an option set before adding creating an extra AOV.
|
protected |
Return a random number. The sequence of random numbers will be consistent for every render, regardless of threading order.
The random functions use the same internal state so they should be called consistently.
|
protected |
Return an integer random number. This can be used as a seed if multiple random numbers need to be generated. The sequence of random numbers will be conssitent for every render, regardless of threading order.
The random functions use the same internal state so they should be called consistently.
|
protected |
Read a pixel from a given AOV. The aov_index should be the index into the aovnames
that was passed into initializeOracle()
(or the index returned by addAOV()
);
For greater efficiency, consider creating a paired SampleFilter.
|
static |
Factory access
|
static |
Factory access
|
inlinevirtual |
Sometimes an oracle can be more efficient when tied to a sampling filter. This method allows an oracle to create a sampling filter to keep track of samples written to the image. This method is called after initializeOracle()
.
If the oracle creates a sample filter, it should make sure to call BRAY_SampleFilter::initialize()
on the created sample filter.
Definition at line 103 of file BRAY_PixelOracle.h.