HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RAY_ProceduralGeo Class Reference

#include <RAY_Procedural.h>

+ Inheritance diagram for RAY_ProceduralGeo:

Public Member Functions

 RAY_ProceduralGeo ()
 Default constructor. More...
 
 RAY_ProceduralGeo (const RAY_ProceduralGeo &src)
 Copy c-tor. More...
 
 ~RAY_ProceduralGeo () override
 Destructor. More...
 
RAY_ProceduralGeooperator= (const RAY_ProceduralGeo &src)
 
GU_DetailHandle handle (int segment=0) const
 
bool setHandle (GU_ConstDetailHandle &gdh)
 
void setShutterOpen (fpreal shutter)
 
GU_DetailHandle appendSegmentGeometry (fpreal shutter)
 
bool removeSegmentGeometry (const GU_ConstDetailHandle &geo)
 
GA_AttributeappendSegmentAttribute (fpreal shutter, const char *name="P")
 
fpreal addVelocityBlur (fpreal pre_blur, fpreal post_blur, const UT_StringHolder &velocity_attribute=UTmakeUnsafeRef("v"), int acceleration_segments=1, const UT_StringHolder &acceleration_attribute=UT_StringHolder())
 
GU_Detailoperator-> () const
 
GU_Detailoperator* () const
 
GU_Detailget (int segment=0) const
 
bool changeSetting (const UT_StringRef &name, int argc, const char *const *argv)
 
bool changeSetting (const UT_StringRef &name, int argc, const UT_StringHolder *argv)
 
bool changeSetting (const UT_StringRef &name, int argc, const int *argv)
 
bool changeSetting (const UT_StringRef &name, int argc, const fpreal *argv)
 
- Public Member Functions inherited from RAY_ROProceduralGeo
 RAY_ROProceduralGeo ()
 
 RAY_ROProceduralGeo (const RAY_ROProceduralGeo &src)
 Copy c-tor. More...
 
virtual ~RAY_ROProceduralGeo ()
 Destructor. More...
 
RAY_ROProceduralGeooperator= (const RAY_ROProceduralGeo &src)
 
void clear ()
 Clear the geometry. More...
 
GU_ConstDetailHandle handle (int segment=0) const
 Access the GU_ConstDetailHandle for a given segment. More...
 
bool isValid () const
 Test validity. More...
 
SYS_SAFE_BOOL operator bool () const
 Bool operator on handle. More...
 
fpreal velocityBounds () const
 
int motionSegments () const
 Return the number of motion segments. More...
 
int getRef () const
 Return reference count on the underlying geometry. More...
 
bool operator== (const RAY_ROProceduralGeo &g) const
 
bool operator!= (const RAY_ROProceduralGeo &g) const
 
const GU_Detailoperator-> () const
 
const GU_Detailoperator* () const
 
const GU_Detailget (int segment=0) const
 

Friends

class RAY_Procedural
 
class RAY_ProceduralChild
 

Additional Inherited Members

- Protected Member Functions inherited from RAY_ROProceduralGeo
 RAY_ROProceduralGeo (RAY_Procedural *proc, bool writeable)
 
 RAY_ROProceduralGeo (RAY_Procedural *proc, const GU_ConstDetailHandle *gdh, int nsegments, const fpreal *shutter_times, bool writeable)
 
bool setGeometry (const GU_ConstDetailHandle &gdh)
 
bool setGeometry (const GU_ConstDetailHandle *gdh, int nsegments)
 
- Protected Attributes inherited from RAY_ROProceduralGeo
UT_SharedPtr< Data > myData
 

Detailed Description

RAY_ProceduralGeo is a read-write handle on mantra's geometry.

You can create these handles by calling RAY_Procedural::createGeometry() and then access the underlying GU_Detail, creating or manipulating geometry.

It's also possible to add motion segments to the geometry in one of three ways:

  • Pass in a reference to another VGEO_ROProceduralGeo object. This will add a motion segment, capturing transform changes on quadric and packed primitives as well as motion of points.
  • You can add a "motion segment" attribute. This method returns an attribute which you can fill out for the given segment. This method is fine in most cases, but doesn't caputre transforms on primitives.
  • Compute velocity blur.
Examples:
RAY/RAY_DemoBox.C, RAY/RAY_DemoFile.C, RAY/RAY_DemoMountain.C, RAY/RAY_DemoSprite.C, and RAY/RAY_DemoStamp.C.

Definition at line 259 of file RAY_Procedural.h.

Constructor & Destructor Documentation

RAY_ProceduralGeo::RAY_ProceduralGeo ( )
inline

Default constructor.

Definition at line 263 of file RAY_Procedural.h.

RAY_ProceduralGeo::RAY_ProceduralGeo ( const RAY_ProceduralGeo src)
inline

Copy c-tor.

Definition at line 266 of file RAY_Procedural.h.

RAY_ProceduralGeo::~RAY_ProceduralGeo ( )
override

Destructor.

Member Function Documentation

fpreal RAY_ProceduralGeo::addVelocityBlur ( fpreal  pre_blur,
fpreal  post_blur,
const UT_StringHolder velocity_attribute = UTmakeUnsafeRef("v"),
int  acceleration_segments = 1,
const UT_StringHolder acceleration_attribute = UT_StringHolder() 
)

Add motion blur based on the velocity attribute. This returns the maximum velocity displacement (for bounding box computation). The displacement is cached and can be retrieved by calling velocityBounds().

The method will returns -1 if the geometry has been locked (passed to mantra). This should be considered an error.

Examples:
RAY/RAY_DemoFile.C.
GA_Attribute* RAY_ProceduralGeo::appendSegmentAttribute ( fpreal  shutter,
const char *  name = "P" 
)

Add a motion segment for the given attribute. This returns the motion segment. Note that adding motion segments this way doesn't capture per-primitive transforms (i.e. quadrics, packed primitives, etc.)

The shutter times for all segments should be sequential and added in increasing order. A warning will be printed if the segments are added out of order.

The method will return a nullptr if the geometry has been locked (passed to mantra).

This method may return a "detached" attribute. The method should be called after the original geometry attributes have been created so the length of the segment attribute is the correct length.

Examples:
RAY/RAY_DemoSprite.C.
GU_DetailHandle RAY_ProceduralGeo::appendSegmentGeometry ( fpreal  shutter)

Append a motion segment.

The shutter times for all segments should be sequential and added in increasing order. A warning will be printed if the segments are added out of order.

The method will return an invalid GU_DetailHandle if the geometry has been locked (passed to mantra).

Examples:
RAY/RAY_DemoFile.C.
bool RAY_ProceduralGeo::changeSetting ( const UT_StringRef name,
int  argc,
const char *const argv 
)

Change a geometry setting:

  • changeSetting(const char *name, int argc, char **argv)
  • changeSetting(const char *name, int argc, int *argv)
  • changeSetting(const char *name, int argc, fpreal *argv) If the setting specified by "name" isn't found, the function will fail (return false).

Some settings which can be changed on geometry include:

  • "timescale": The time scale for velocity motion blur
  • "segmentattrs": The attributes to keep on motion segments
  • "volumevelocitynames": Names for velocity attributes on volume prims
bool RAY_ProceduralGeo::changeSetting ( const UT_StringRef name,
int  argc,
const UT_StringHolder argv 
)

Change a geometry setting:

  • changeSetting(const char *name, int argc, char **argv)
  • changeSetting(const char *name, int argc, int *argv)
  • changeSetting(const char *name, int argc, fpreal *argv) If the setting specified by "name" isn't found, the function will fail (return false).

Some settings which can be changed on geometry include:

  • "timescale": The time scale for velocity motion blur
  • "segmentattrs": The attributes to keep on motion segments
  • "volumevelocitynames": Names for velocity attributes on volume prims
bool RAY_ProceduralGeo::changeSetting ( const UT_StringRef name,
int  argc,
const int argv 
)

Change a geometry setting:

  • changeSetting(const char *name, int argc, char **argv)
  • changeSetting(const char *name, int argc, int *argv)
  • changeSetting(const char *name, int argc, fpreal *argv) If the setting specified by "name" isn't found, the function will fail (return false).

Some settings which can be changed on geometry include:

  • "timescale": The time scale for velocity motion blur
  • "segmentattrs": The attributes to keep on motion segments
  • "volumevelocitynames": Names for velocity attributes on volume prims
bool RAY_ProceduralGeo::changeSetting ( const UT_StringRef name,
int  argc,
const fpreal argv 
)

Change a geometry setting:

  • changeSetting(const char *name, int argc, char **argv)
  • changeSetting(const char *name, int argc, int *argv)
  • changeSetting(const char *name, int argc, fpreal *argv) If the setting specified by "name" isn't found, the function will fail (return false).

Some settings which can be changed on geometry include:

  • "timescale": The time scale for velocity motion blur
  • "segmentattrs": The attributes to keep on motion segments
  • "volumevelocitynames": Names for velocity attributes on volume prims
GU_Detail* RAY_ProceduralGeo::get ( int  segment = 0) const

Standard "pointer" operations

Examples:
RAY/RAY_DemoMountain.C, and RAY/RAY_DemoSprite.C.
GU_DetailHandle RAY_ProceduralGeo::handle ( int  segment = 0) const

Access the geometry using a GU_DetailHandle. If the geometry is locked, this method will return an invalid handle. The geometry will be locked if it's already been passed to mantra.

GU_Detail& RAY_ProceduralGeo::operator* ( ) const
inline

Standard "pointer" operations

Definition at line 282 of file RAY_Procedural.h.

GU_Detail* RAY_ProceduralGeo::operator-> ( ) const
inline

Standard "pointer" operations

Definition at line 281 of file RAY_Procedural.h.

RAY_ProceduralGeo& RAY_ProceduralGeo::operator= ( const RAY_ProceduralGeo src)
inline

Definition at line 273 of file RAY_Procedural.h.

bool RAY_ProceduralGeo::removeSegmentGeometry ( const GU_ConstDetailHandle geo)

Remove a motion segment that was added with appendSegmentGeometry()

The method will return an invalid GU_DetailHandle if the geometry has been locked (passed to mantra).

Examples:
RAY/RAY_DemoFile.C.
bool RAY_ProceduralGeo::setHandle ( GU_ConstDetailHandle gdh)

Set the geometry for the first motion segment. This method will fail if there are any motion segments already. This will delete any geometry already assigned to the object.

void RAY_ProceduralGeo::setShutterOpen ( fpreal  shutter)

Set the shutter start value. This should be set before any motion segments are added to the geometry. The default shutter open is 0.

Friends And Related Function Documentation

friend class RAY_Procedural
friend

Definition at line 376 of file RAY_Procedural.h.

friend class RAY_ProceduralChild
friend

Definition at line 377 of file RAY_Procedural.h.


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