HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TIL_RasterFilter Class Referenceabstract

#include <TIL_RasterFilter.h>

+ Inheritance diagram for TIL_RasterFilter:

Classes

struct  Factory
 The factory to define a filter. More...
 
struct  LayerData
 
struct  RasterData
 
class  VulkanResolver
 

Public Types

enum  AOVType {
  AT_NONE = 0, AT_BEAUTY, AT_SPECULAR, AT_REFLECT,
  AT_REFRACT, AT_DIFFUSE
}
 
enum  RasterDataTypes { RDT_PXL_RASTER, RDT_VK_BUFFER, RDT_RAW_CUDA }
 
using TIL_RasterFilterPtr = UT_UniquePtr< TIL_RasterFilter >
 

Public Member Functions

virtual const char * className () const =0
 For debugging. More...
 
virtual bool setOptions (const UT_Options &options)
 
void setAuxPlane (const UT_StringHolder &planename, const PXL_Raster *raster)
 
void setAuxPlane (const UT_StringHolder &planename, const RasterData &aux)
 
virtual bool apply (PXL_Raster *raster)=0
 Returns false if fail. More...
 
virtual bool apply (UT_Array< LayerData > &layersdata, bool upscale, bool firstframe)=0
 Returns false if fail. More...
 
virtual void reset ()
 
const UT_StringArraygetAuxPlaneNames () const
 Get the list of aux plane names. More...
 
const UT_StringHoldergetErrorString () const
 
virtual bool isInteractive () const
 
virtual bool matchesDevice (uint8(&uuid)[16]) const
 
 TIL_RasterFilter ()
 
virtual ~TIL_RasterFilter ()
 

Static Public Member Functions

static void setVulkanResolver (UT_UniquePtr< VulkanResolver >)
 
static VulkanResolvergetVulkanResolver ()
 
static AOVType stringToAOVType (const UT_StringHolder &type)
 
static void registerFactory (UT_UniquePtr< Factory > factory)
 
static void removeFactory (const UT_StringRef &name)
 Remove a factory from the list. More...
 
static void getFilters (UT_Array< const Factory * > &filters)
 Get a list of all the filters. More...
 
static TIL_RasterFilterPtr allocFilter (const UT_StringRef &name)
 
static const UT_StringHolderalbedoToken ()
 
static const UT_StringHoldernormalToken ()
 
static const UT_StringHoldermvectorToken ()
 
static const UT_StringHolderprevfrToken ()
 

Protected Attributes

UT_StringArray myAuxPlaneNames
 
UT_StringMap< RasterDatamyAuxPlanes
 
UT_StringHolder myErrorString
 

Detailed Description

Apply arbitrary filters to PXL_Raster image(s).

The DSO must implement "newRasterFilter" function which should create new filters by calling TIL_RasterFilter::registerFactory(). Image filters will be searched for in $HOUDINI_DSO_PATH/img_filter.

When the filter is instantiated, the caller will initialize the filter calling setOptions. This is only called one time, though the filter may be invoked multiple times.

Prior to invoking the filter, the reset() method will be called. This lets the filter reset any information that changes from run to run.

The caller will then set up any optional read-only auxilliary rasters the filter may need for processing. That is, the caller will call setAuxPlane zero or more times.

After the filter is reset and auxilliary planes are added, the apply() method will finally be called. This should modify the raster passed in to create the resulting image. It's possible the apply() method may be called multiple times before reset() is called again.

Examples:
IMG/TIL_NullFilter.h.

Definition at line 56 of file TIL_RasterFilter.h.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
AT_NONE 
AT_BEAUTY 
AT_SPECULAR 
AT_REFLECT 
AT_REFRACT 
AT_DIFFUSE 

Definition at line 88 of file TIL_RasterFilter.h.

Enumerator
RDT_PXL_RASTER 
RDT_VK_BUFFER 
RDT_RAW_CUDA 

Definition at line 99 of file TIL_RasterFilter.h.

Constructor & Destructor Documentation

TIL_RasterFilter::TIL_RasterFilter ( )
inline

Constructor/Destructor

Definition at line 74 of file TIL_RasterFilter.h.

virtual TIL_RasterFilter::~TIL_RasterFilter ( )
inlinevirtual

Constructor/Destructor

Definition at line 75 of file TIL_RasterFilter.h.

Member Function Documentation

static const UT_StringHolder& TIL_RasterFilter::albedoToken ( )
static

Get tokens that are used to store auxilliary planes

static TIL_RasterFilterPtr TIL_RasterFilter::allocFilter ( const UT_StringRef name)
static
virtual bool TIL_RasterFilter::apply ( PXL_Raster raster)
pure virtual

Returns false if fail.

Implemented in TIL_NullFilter.

virtual bool TIL_RasterFilter::apply ( UT_Array< LayerData > &  layersdata,
bool  upscale,
bool  firstframe 
)
pure virtual

Returns false if fail.

Implemented in TIL_NullFilter.

virtual const char* TIL_RasterFilter::className ( ) const
pure virtual

For debugging.

Implemented in TIL_NullFilter.

const UT_StringArray& TIL_RasterFilter::getAuxPlaneNames ( ) const
inline

Get the list of aux plane names.

Definition at line 213 of file TIL_RasterFilter.h.

const UT_StringHolder& TIL_RasterFilter::getErrorString ( ) const
inline

Get stored error msg in case apply() fails. Sub-classes can set myErrorString to something meaningful for the caller.

Definition at line 218 of file TIL_RasterFilter.h.

static void TIL_RasterFilter::getFilters ( UT_Array< const Factory * > &  filters)
static

Get a list of all the filters.

static VulkanResolver* TIL_RasterFilter::getVulkanResolver ( )
static
virtual bool TIL_RasterFilter::isInteractive ( ) const
inlinevirtual

If the filter can run in a few milliseconds, you can try returning true.

Reimplemented in TIL_NullFilter.

Definition at line 223 of file TIL_RasterFilter.h.

virtual bool TIL_RasterFilter::matchesDevice ( uint8(&)  uuid[16]) const
inlinevirtual

Returns true if this filter can use device pointers from the device represented by uuid a RasterData struct

Definition at line 227 of file TIL_RasterFilter.h.

static const UT_StringHolder& TIL_RasterFilter::mvectorToken ( )
static

Get tokens that are used to store auxilliary planes

static const UT_StringHolder& TIL_RasterFilter::normalToken ( )
static

Get tokens that are used to store auxilliary planes

static const UT_StringHolder& TIL_RasterFilter::prevfrToken ( )
static

Get tokens that are used to store auxilliary planes

static void TIL_RasterFilter::registerFactory ( UT_UniquePtr< Factory factory)
static

Register a new factory. Set HOUDINI_DSO_ERROR=1 to get information on why the filter might not be installed.

Examples:
IMG/TIL_NullFilter.C.
static void TIL_RasterFilter::removeFactory ( const UT_StringRef name)
static

Remove a factory from the list.

virtual void TIL_RasterFilter::reset ( void  )
inlinevirtual

Reset and get ready for a new filter. If you subclass this method, please make sure to call the base class method.

Reimplemented in TIL_NullFilter.

Examples:
IMG/TIL_NullFilter.C.

Definition at line 207 of file TIL_RasterFilter.h.

void TIL_RasterFilter::setAuxPlane ( const UT_StringHolder planename,
const PXL_Raster raster 
)
inline

Set up an auxilliary plane. This is a raster which isn't actually modified, but is used in the filtering (for example a mask). The caller looks at the myAuxPlaneNames list to see which rasters you might require. If they are available, they will be stashed in this array.

Definition at line 181 of file TIL_RasterFilter.h.

void TIL_RasterFilter::setAuxPlane ( const UT_StringHolder planename,
const RasterData aux 
)
inline

Set up an auxiliary plane using RasterData. If the RasterData provides a Cuda or Vulkan device handle, it will be used directly, avoiding internal device memory allocation. Otherwise, the filter may allocate its own buffer. The caller looks at the myAuxPlaneNames list to determine which planes are required.

Definition at line 193 of file TIL_RasterFilter.h.

virtual bool TIL_RasterFilter::setOptions ( const UT_Options options)
inlinevirtual

Initiaze the filter with user specified options. This method is only called once. If the filter isn't valid, the myErrorString member should be set to a meaningful error and the function should return false.

Aside from setting any specific options, this is also the time you should build myAuxPlaneNames. This lets the caller know which extra AOVs you can read from. Not all of them may exist, but this lets the caller know which planes you can look at.

Reimplemented in TIL_NullFilter.

Definition at line 174 of file TIL_RasterFilter.h.

static void TIL_RasterFilter::setVulkanResolver ( UT_UniquePtr< VulkanResolver )
static
static AOVType TIL_RasterFilter::stringToAOVType ( const UT_StringHolder type)
static

Member Data Documentation

UT_StringArray TIL_RasterFilter::myAuxPlaneNames
protected

Definition at line 230 of file TIL_RasterFilter.h.

UT_StringMap<RasterData> TIL_RasterFilter::myAuxPlanes
protected
Examples:
IMG/TIL_NullFilter.C.

Definition at line 231 of file TIL_RasterFilter.h.

UT_StringHolder TIL_RasterFilter::myErrorString
protected
Examples:
IMG/TIL_NullFilter.C.

Definition at line 232 of file TIL_RasterFilter.h.


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