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

#include <BRAY_Procedural.h>

Classes

struct  Hit
 
struct  Ray
 

Public Types

using Ray32 = Ray< fpreal32 >
 
using Ray64 = Ray< fpreal64 >
 

Public Member Functions

 BRAY_Procedural ()
 
virtual ~BRAY_Procedural ()
 
virtual const char * className () const
 Return a name for this procedural. This defaults to factory()->name();. More...
 
virtual const
BRAY_ProceduralFactory
factory () const =0
 Return the factory definition. More...
 
virtual const BRAY_AttribListattribList () const =0
 Return an attribute list for the attributes supported by this primitive. More...
 
virtual const BRAY_AttribListparamList () const
 
virtual void bounds (UT_BoundingBox &bounds, BRAYtime time) const =0
 Return the bounding box for the object at a given time. More...
 
bool isValid () const
 Check whether the procedural is valid. More...
 
virtual UT_Vector3 displayColor () const
 Return a display color for low-quality rendering. More...
 
virtual void update (BRAY_EventType event)=0
 This method can be used to be notified of changes to the object. More...
 
virtual void dumpInfo (UT_JSONWriter &w) const
 
template<typename T >
void setParameter (const UT_StringRef &key, const T &val)
 
template<typename T >
void setParameter (const UT_StringRef &key, const T *values, int n)
 
void beginUpdate ()
 
void endUpdate ()
 
virtual bool intersect (const Ray32 &ray, Hit &hit_info) const =0
 
virtual bool intersect (const Ray64 &ray, Hit &hit_info) const =0
 
virtual const int32attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, int32 *buf, int size) const =0
 
virtual const int64attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, int64 *buf, int size) const =0
 
virtual const fpreal32attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, fpreal32 *buf, int size) const =0
 
virtual const fpreal64attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, fpreal64 *buf, int size) const =0
 
virtual const UT_StringHolderattribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, UT_StringHolder *buf, int size) const =0
 
virtual const UT_ValArray
< int32 > * 
attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, UT_ValArray< int32 > *buf, int size) const
 
virtual const UT_ValArray
< int64 > * 
attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, UT_ValArray< int64 > *buf, int size) const
 
virtual const UT_ValArray
< fpreal32 > * 
attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, UT_ValArray< fpreal32 > *buf, int size) const
 
virtual const UT_ValArray
< fpreal64 > * 
attribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, UT_ValArray< fpreal64 > *buf, int size) const
 
virtual const UT_StringArrayattribVal (int attrib, BRAYtime time, const Ray32 &ray, const Hit &hit_info, UT_StringArray *buf, int size) const
 

Protected Member Functions

virtual void errorMessage (const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
 
virtual void virtual void doBeginUpdate ()=0
 
virtual void doEndUpdate ()=0
 
virtual bool checkIsValid () const =0
 Check to see whether the procedural is valid. More...
 
virtual void doSetParameter (const UT_StringRef &key, const int32 *values, int n=1)=0
 
virtual void doSetParameter (const UT_StringRef &key, const int64 *values, int n=1)=0
 
virtual void doSetParameter (const UT_StringRef &key, const fpreal32 *values, int n=1)=0
 
virtual void doSetParameter (const UT_StringRef &key, const fpreal64 *value, int n=1)=0
 
virtual void doSetParameter (const UT_StringRef &key, const UT_StringHolder *value, int n=1)=0
 

Detailed Description

Definition at line 21 of file BRAY_Procedural.h.

Member Typedef Documentation

Definition at line 36 of file BRAY_Procedural.h.

Definition at line 37 of file BRAY_Procedural.h.

Constructor & Destructor Documentation

BRAY_Procedural::BRAY_Procedural ( )
virtual BRAY_Procedural::~BRAY_Procedural ( )
virtual

Member Function Documentation

virtual const BRAY_AttribList* BRAY_Procedural::attribList ( ) const
pure virtual

Return an attribute list for the attributes supported by this primitive.

virtual const int32* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
int32 buf,
int  size 
) const
pure virtual

Evaluate an attribute on this primitive. The methods should return a pointer to the attribute data. If there isn't a direct raw pointer to the data, the buffer passed in can be used to store the data and that pointer can be returned. The element is the element

virtual const int64* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
int64 buf,
int  size 
) const
pure virtual

Evaluate an attribute on this primitive. The methods should return a pointer to the attribute data. If there isn't a direct raw pointer to the data, the buffer passed in can be used to store the data and that pointer can be returned. The element is the element

virtual const fpreal32* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
fpreal32 buf,
int  size 
) const
pure virtual

Evaluate an attribute on this primitive. The methods should return a pointer to the attribute data. If there isn't a direct raw pointer to the data, the buffer passed in can be used to store the data and that pointer can be returned. The element is the element

virtual const fpreal64* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
fpreal64 buf,
int  size 
) const
pure virtual

Evaluate an attribute on this primitive. The methods should return a pointer to the attribute data. If there isn't a direct raw pointer to the data, the buffer passed in can be used to store the data and that pointer can be returned. The element is the element

virtual const UT_StringHolder* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
UT_StringHolder buf,
int  size 
) const
pure virtual

Evaluate an attribute on this primitive. The methods should return a pointer to the attribute data. If there isn't a direct raw pointer to the data, the buffer passed in can be used to store the data and that pointer can be returned. The element is the element

virtual const UT_ValArray<int32>* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
UT_ValArray< int32 > *  buf,
int  size 
) const
virtual

Evaluation of array attributes (each attribute can have an arbitrary number of entries. By default, the array attribute evaluators set the arrays to a size of 0 and return the storage array.

virtual const UT_ValArray<int64>* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
UT_ValArray< int64 > *  buf,
int  size 
) const
virtual

Evaluation of array attributes (each attribute can have an arbitrary number of entries. By default, the array attribute evaluators set the arrays to a size of 0 and return the storage array.

virtual const UT_ValArray<fpreal32>* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
UT_ValArray< fpreal32 > *  buf,
int  size 
) const
virtual

Evaluation of array attributes (each attribute can have an arbitrary number of entries. By default, the array attribute evaluators set the arrays to a size of 0 and return the storage array.

virtual const UT_ValArray<fpreal64>* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
UT_ValArray< fpreal64 > *  buf,
int  size 
) const
virtual

Evaluation of array attributes (each attribute can have an arbitrary number of entries. By default, the array attribute evaluators set the arrays to a size of 0 and return the storage array.

virtual const UT_StringArray* BRAY_Procedural::attribVal ( int  attrib,
BRAYtime  time,
const Ray32 ray,
const Hit hit_info,
UT_StringArray buf,
int  size 
) const
virtual

Evaluation of array attributes (each attribute can have an arbitrary number of entries. By default, the array attribute evaluators set the arrays to a size of 0 and return the storage array.

void BRAY_Procedural::beginUpdate ( )
inline

Signal the procedural

We allow for the Procedural to update itself and do any further processing in case any parameters have been set. The set parameter methods are generally invoked on the procedural, which might be implemented by the procedural to copy data, precompute stuff, validate parameter ranges etc. Once these have been set, the begin/end update methods can be used by the procedural to perform operations that can be performed only when there's nothing more to set as parameters to the procedural. The procedural can now start working on doing other things with the set parameters because it can be sure that the parameters now have become immutable.

Definition at line 126 of file BRAY_Procedural.h.

virtual void BRAY_Procedural::bounds ( UT_BoundingBox bounds,
BRAYtime  time 
) const
pure virtual

Return the bounding box for the object at a given time.

virtual bool BRAY_Procedural::checkIsValid ( ) const
protectedpure virtual

Check to see whether the procedural is valid.

virtual const char* BRAY_Procedural::className ( ) const
virtual

Return a name for this procedural. This defaults to factory()->name();.

virtual UT_Vector3 BRAY_Procedural::displayColor ( ) const
inlinevirtual

Return a display color for low-quality rendering.

Definition at line 164 of file BRAY_Procedural.h.

virtual void virtual void BRAY_Procedural::doBeginUpdate ( )
protectedpure virtual

These functions are the ones that each procedural will override for doing preupdate/post update operations.

virtual void BRAY_Procedural::doEndUpdate ( )
protectedpure virtual
virtual void BRAY_Procedural::doSetParameter ( const UT_StringRef key,
const int32 values,
int  n = 1 
)
protectedpure virtual

These methods will be used by the implementing classes to set parameters that the procedural will support

virtual void BRAY_Procedural::doSetParameter ( const UT_StringRef key,
const int64 values,
int  n = 1 
)
protectedpure virtual
virtual void BRAY_Procedural::doSetParameter ( const UT_StringRef key,
const fpreal32 values,
int  n = 1 
)
protectedpure virtual
virtual void BRAY_Procedural::doSetParameter ( const UT_StringRef key,
const fpreal64 value,
int  n = 1 
)
protectedpure virtual
virtual void BRAY_Procedural::doSetParameter ( const UT_StringRef key,
const UT_StringHolder value,
int  n = 1 
)
protectedpure virtual
virtual void BRAY_Procedural::dumpInfo ( UT_JSONWriter w) const
virtual

Dump out information about the procedural for debugging. By default, a null is written to the stream.

void BRAY_Procedural::endUpdate ( )
inline

Signal the procedural

We allow for the Procedural to update itself and do any further processing in case any parameters have been set. The set parameter methods are generally invoked on the procedural, which might be implemented by the procedural to copy data, precompute stuff, validate parameter ranges etc. Once these have been set, the begin/end update methods can be used by the procedural to perform operations that can be performed only when there's nothing more to set as parameters to the procedural. The procedural can now start working on doing other things with the set parameters because it can be sure that the parameters now have become immutable.

Definition at line 131 of file BRAY_Procedural.h.

virtual void BRAY_Procedural::errorMessage ( const char *  fmt,
  ... 
)
protectedvirtual

This method will be called to print out an error if the procedural isn't set up properly. You can override it to silence the errors.

virtual const BRAY_ProceduralFactory* BRAY_Procedural::factory ( ) const
pure virtual

Return the factory definition.

virtual bool BRAY_Procedural::intersect ( const Ray32 ray,
Hit hit_info 
) const
pure virtual

Perform ray-intersection

If the distanct to the closest intersection point for the procedural object is closer than the distance already stored in the hit_info, the hit information should be replaced and the intersect() method should return true.

If the distance to the closest intersection point is farther than the existing distance, then the hit_info should remain unchanged.

NOTE: The ray's direction vector CANNOT be expected to be unit length Hence the procedural is responsible for accounting and returning the correct 't' in the hit_info struct if it ever scaled it internally to unit length.

virtual bool BRAY_Procedural::intersect ( const Ray64 ray,
Hit hit_info 
) const
pure virtual

Perform ray-intersection

If the distanct to the closest intersection point for the procedural object is closer than the distance already stored in the hit_info, the hit information should be replaced and the intersect() method should return true.

If the distance to the closest intersection point is farther than the existing distance, then the hit_info should remain unchanged.

NOTE: The ray's direction vector CANNOT be expected to be unit length Hence the procedural is responsible for accounting and returning the correct 't' in the hit_info struct if it ever scaled it internally to unit length.

bool BRAY_Procedural::isValid ( ) const
inline

Check whether the procedural is valid.

Definition at line 138 of file BRAY_Procedural.h.

virtual const BRAY_AttribList* BRAY_Procedural::paramList ( ) const
virtual

Return a parameter list that the procedural exposes to the outside world that could be set using the setParameter() methods The default implementation calls factory()->paramList();

template<typename T >
void BRAY_Procedural::setParameter ( const UT_StringRef key,
const T val 
)
inline

Set parameters on procedurals in addition to attributes that the procedural might provide. One way to think of parameters and attributes is that attributes are what procedurals bring to the table internally, where as parameters are something that can be applied onto procedurals. For example, a 'Sphere' object is a procedural. It's attributes could be like 'color', 'normal' on vertices. whereas 'parameters' could be 'radius', etc. Depending upon the procedural the meaning of these two terms change contextually.

The templates are specialized for:

Definition at line 101 of file BRAY_Procedural.h.

template<typename T >
void BRAY_Procedural::setParameter ( const UT_StringRef key,
const T values,
int  n 
)
inline

Set parameters on procedurals in addition to attributes that the procedural might provide. One way to think of parameters and attributes is that attributes are what procedurals bring to the table internally, where as parameters are something that can be applied onto procedurals. For example, a 'Sphere' object is a procedural. It's attributes could be like 'color', 'normal' on vertices. whereas 'parameters' could be 'radius', etc. Depending upon the procedural the meaning of these two terms change contextually.

The templates are specialized for:

Definition at line 107 of file BRAY_Procedural.h.

virtual void BRAY_Procedural::update ( BRAY_EventType  event)
pure virtual

This method can be used to be notified of changes to the object.


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