HDK
|
#include <BRAY_Procedural.h>
Classes | |
class | Hit |
class | HitPtr |
struct | Ray |
Public Types | |
using | Ray32 = Ray< fpreal32 > |
using | Ray64 = Ray< fpreal64 > |
Public Member Functions | |
BRAY_Procedural () | |
virtual | ~BRAY_Procedural () |
const UT_StringHolder & | className () const |
Return a name for this procedural. This defaults to factory()->name();. More... | |
const BRAY_ProceduralFactory * | factory () const |
Return the factory definition. More... | |
virtual const BRAY_AttribList * | attribList () const =0 |
Return an attribute list for the attributes supported by this primitive. More... | |
virtual const BRAY_AttribList * | paramList () 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 HitPtr | intersect (const Ray32 &ray) const =0 |
virtual HitPtr | intersect (const Ray64 &ray) const =0 |
virtual const int32 * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, int32 *buf, int size) const =0 |
virtual const int64 * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, int64 *buf, int size) const =0 |
virtual const fpreal32 * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, fpreal32 *buf, int size) const =0 |
virtual const fpreal64 * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, fpreal64 *buf, int size) const =0 |
virtual const UT_StringHolder * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, UT_StringHolder *buf, int size) const =0 |
virtual const UT_ValArray < int32 > * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, UT_ValArray< int32 > *buf, int size) const |
virtual const UT_ValArray < int64 > * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, UT_ValArray< int64 > *buf, int size) const |
virtual const UT_ValArray < fpreal32 > * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, UT_ValArray< fpreal32 > *buf, int size) const |
virtual const UT_ValArray < fpreal64 > * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, UT_ValArray< fpreal64 > *buf, int size) const |
virtual const UT_StringArray * | attribVal (int attrib, BRAYtime time, const Hit &hit_info, UT_StringArray *buf, int size) const |
Protected Member Functions | |
HitPtr | getHit () const |
virtual HitPtr | newHit () const |
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 |
Definition at line 22 of file BRAY_Procedural.h.
using BRAY_Procedural::Ray32 = Ray<fpreal32> |
Definition at line 38 of file BRAY_Procedural.h.
using BRAY_Procedural::Ray64 = Ray<fpreal64> |
Definition at line 39 of file BRAY_Procedural.h.
BRAY_Procedural::BRAY_Procedural | ( | ) |
|
virtual |
|
pure virtual |
Return an attribute list for the attributes supported by this primitive.
Implemented in BRAY_ProceduralScene.
|
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
Implemented in BRAY_ProceduralScene.
|
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
Implemented in BRAY_ProceduralScene.
|
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
Implemented in BRAY_ProceduralScene.
|
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
Implemented in BRAY_ProceduralScene.
|
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
Implemented in BRAY_ProceduralScene.
|
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.
Reimplemented in BRAY_ProceduralScene.
|
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.
Reimplemented in BRAY_ProceduralScene.
|
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.
Reimplemented in BRAY_ProceduralScene.
|
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.
Reimplemented in BRAY_ProceduralScene.
|
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.
Reimplemented in BRAY_ProceduralScene.
|
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 236 of file BRAY_Procedural.h.
|
pure virtual |
Return the bounding box for the object at a given time.
Implemented in BRAY_ProceduralScene.
|
protectedpure virtual |
Check to see whether the procedural is valid.
Implemented in BRAY_ProceduralScene.
|
inline |
Return a name for this procedural. This defaults to factory()->name();.
Definition at line 179 of file BRAY_Procedural.h.
|
inlinevirtual |
Return a display color for low-quality rendering.
Definition at line 274 of file BRAY_Procedural.h.
These functions are the ones that each procedural will override for doing preupdate/post update operations.
Implemented in BRAY_ProceduralScene.
|
protectedpure virtual |
Implemented in BRAY_ProceduralScene.
|
protectedpure virtual |
These methods will be used by the implementing classes to set parameters that the procedural will support
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedpure virtual |
|
virtual |
Dump out information about the procedural for debugging. By default, a null is written to the stream.
|
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 241 of file BRAY_Procedural.h.
|
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.
|
inline |
Return the factory definition.
Definition at line 182 of file BRAY_Procedural.h.
|
protected |
Hit
objects are virtual which allows you to create a sub-class that stores information specific to your procedural type. The Hit structure should be kept relatively small if possible. When you need to allocate a Hit object for your intersect method, you should call getHit()
.
To implement the actual allocation of the custom Hit
object, you need to implement newHit()
.
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.
Implemented in BRAY_ProceduralScene.
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.
Implemented in BRAY_ProceduralScene.
|
inline |
Check whether the procedural is valid.
Definition at line 248 of file BRAY_Procedural.h.
|
protectedvirtual |
The newHit()
method is used to allocate a custom Hit
type. The typical way this is done is:
Reimplemented in BRAY_ProceduralScene.
|
inlinevirtual |
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();
Definition at line 190 of file BRAY_Procedural.h.
|
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 211 of file BRAY_Procedural.h.
|
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 217 of file BRAY_Procedural.h.
|
pure virtual |
This method can be used to be notified of changes to the object.