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

Class representing a child object of the current procedural. More...

#include <RAY_Procedural.h>

+ Inheritance diagram for RAY_ProceduralChild:

Public Types

enum  AutoProceduralType {
  AUTOPROCEDURAL_ANY, AUTOPROCEDURAL_AGENT, AUTOPROCEDURAL_PACK, AUTOPROCEDURAL_HEIGHTFIELD,
  AUTOPROCEDURAL_NONE
}
 

Public Member Functions

 RAY_ProceduralChild (RAY_Procedural *parent)
 
 ~RAY_ProceduralChild ()
 
bool isValid () const
 
SYS_SAFE_BOOL operator bool () const
 Bool operator on handle. More...
 
const RAY_Proceduralparent () const
 Return parent procedural. More...
 
void addGeometry (const RAY_ROProceduralGeo &geo)
 
void limitAutoProcedural (AutoProceduralType aproc)
 
bool addProcedural (int argc, char *argv[], const UT_BoundingBox *box=0)
 
void addProcedural (RAY_Procedural *proc)
 
void addVolume (VGEO_Volume *volume, fpreal shutter)
 
void setPreTransform (const UT_Matrix4D &transform, fpreal shutter)
 
void setStylerInfo (const RAY_StylerInfo &styler_info)
 
void setTransform (const UT_Matrix4D &transform, fpreal shutter)
 
void debugSettings (const char *style="object") const
 Print out the object's settings to stderr. More...
 
void declarePrimitiveAttributeSettings (const GEO_Primitive &prim, const char *prefix)
 
bool setShopMaterialPath (const UT_StringHolder &shop_materialpath, const UT_StringHolder &material_override=UT_StringHolder(), const UT_StringHolder &property_map=UT_StringHolder())
 
void declarePackedPrimRenderStateSetting (const GEO_Primitive &)
 
void setPackedQuery (RAY_PackedQuery *q)
 
bool changeSetting (const char *name, const char *value, const char *style="object")
 
bool changeSetting (const char *name, int argc, const char *const *argv, const char *style="object")
 
bool changeSetting (const char *name, int argc, const UT_StringHolder *argv, const char *style="object")
 
bool changeSetting (const char *name, int argc, const int *argv, const char *style="object")
 
bool changeSetting (const char *name, int argc, const fpreal *argv, const char *style="object")
 
bool declareSetting (const char *name, const char *value)
 
bool declareSetting (const char *name, int argc, const char *const *argv)
 
bool declareSetting (const char *name, int argc, const int *argv)
 
bool declareSetting (const char *name, int argc, const fpreal *argv)
 
void processPrimitiveMaterial (const GEO_Primitive *prim)
 
void processPrimitiveMaterial (const GEO_Primitive *prim, const RAY_PrimitiveMaterialAttributes &attribs)
 This version takes a set of cached attributes for faster processing. More...
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< RAY_ProceduralChild >
SYS_FORCE_INLINE UT_IntrusiveRefCounter () noexcept
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &) noexcept
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const noexcept
 Return current counter. More...
 
SYS_FORCE_INLINE bool conditionalAddRef () noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from UT_IntrusiveRefCounter< RAY_ProceduralChild >
SYS_FORCE_INLINE ~UT_IntrusiveRefCounter ()
 Destructor: Only derived classes can destruct this. More...
 

Detailed Description

Class representing a child object of the current procedural.

When a RAY_Procedural is rendered, the procedural can create child geometry objects, further procedurals, or even a mix of the two.

When creating geometry to be rendered, the code would look something along the lines of:

// Create geometry by loading geometry from disk.
RAY_ProceduralGeo geo = createGeometry();
geo->load("defgeo.bgeo");
// Add the geometry to the render
RAY_ProceduralChildPtr obj = createChild();
obj->addGeometry(geo);

When adding further procedural children, the code might look something like:

RAY_ProceduralChildPtr obj = createChild();
child->addProcedural(new procedural_subclass(parameters));
Note
: RAY_ProceduralChildPtr's are thread safe. So, unlike the deprecated addGeometry()/addProcedural() methods, multiple child objects can be created in a threaded fashion within a render() method.
// Create geometry by loading geometry from disk.
RAY_ProceduralGeo geo = createGeometry();
geo->load("defgeo.bgeo");
[=](const UT_BlockedRange<int> &r)) {
for (auto it = r.begin(); it != r.end(); ++it) {
RAY_ProceduralChildPtr obj = createChild();
obj->addGeometry(geo);
}
}

See the HDK examples RAY_DemoMountain or RAY_DemoBox for concrete examples.

Definition at line 432 of file RAY_Procedural.h.

Member Enumeration Documentation

When rendering geometry with packed prims or heightfields, mantra will normally create special procedurals to handle each type of primitive automatically. However, care must be taken when there are a mix of special primitives and other primitives. For example, if there are agent primitives, they are also considered as packed primitives, so the packed procedural shouldn't double render them. The AutoProcType is used internally to indicate what types of geometry should be allowed to show up when creating procedurals. Note that this list may change in future versions.

Enumerator
AUTOPROCEDURAL_ANY 
AUTOPROCEDURAL_AGENT 
AUTOPROCEDURAL_PACK 
AUTOPROCEDURAL_HEIGHTFIELD 
AUTOPROCEDURAL_NONE 

Definition at line 462 of file RAY_Procedural.h.

Constructor & Destructor Documentation

RAY_ProceduralChild::RAY_ProceduralChild ( RAY_Procedural parent)
RAY_ProceduralChild::~RAY_ProceduralChild ( )

Member Function Documentation

void RAY_ProceduralChild::addGeometry ( const RAY_ROProceduralGeo geo)

Set the geometry for the child procedural. This is the preferred interface for setting a child's geometry.

bool RAY_ProceduralChild::addProcedural ( int  argc,
char *  argv[],
const UT_BoundingBox box = 0 
)

Set a child procedural. There are two ways to add a procedural.

The first process is to call with an argc/argv and an optional bounding box. This invokes the standard mantra process of creating a procedural object. Using this interface will cause the initialize() method to be called on the created procedural. The creation status is returned.

void RAY_ProceduralChild::addProcedural ( RAY_Procedural proc)

The second process for adding a procedural is to add the procedural directly. Using this process bypasses the standard mantra initialization proces (i.e. the initialize() virtual will not be called). This can be used to add procedural objects which aren't registered with mantra (i.e. private classes).

void RAY_ProceduralChild::addVolume ( VGEO_Volume volume,
fpreal  shutter 
)

Add a volume primitive to the currently open volume object. Volume objects are reference counted, so if you need to keep a reference to the volume after calling addVolume(), use the incref()/decref() interface to retain a reference. An easy way to do this is to own a UT_IntrusivePtr<VGEO_Volume> object. If you do not own a reference, it's possible the VGEO_Volume pointer will be invalid after this call.

bool RAY_ProceduralChild::changeSetting ( const char *  name,
const char *  value,
const char *  style = "object" 
)

Change any setting on the object (geometry, procedural, volume)

  • changeSetting(const char *name, const char *value)
    Parses the string into arguments and changes the setting If you want to change a setting to a single string value, it is better to call: changeSettings(name, 1, &value);
  • 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).
bool RAY_ProceduralChild::changeSetting ( const char *  name,
int  argc,
const char *const *  argv,
const char *  style = "object" 
)

Change any setting on the object (geometry, procedural, volume)

  • changeSetting(const char *name, const char *value)
    Parses the string into arguments and changes the setting If you want to change a setting to a single string value, it is better to call: changeSettings(name, 1, &value);
  • 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).
bool RAY_ProceduralChild::changeSetting ( const char *  name,
int  argc,
const UT_StringHolder argv,
const char *  style = "object" 
)

Change any setting on the object (geometry, procedural, volume)

  • changeSetting(const char *name, const char *value)
    Parses the string into arguments and changes the setting If you want to change a setting to a single string value, it is better to call: changeSettings(name, 1, &value);
  • 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).
bool RAY_ProceduralChild::changeSetting ( const char *  name,
int  argc,
const int argv,
const char *  style = "object" 
)

Change any setting on the object (geometry, procedural, volume)

  • changeSetting(const char *name, const char *value)
    Parses the string into arguments and changes the setting If you want to change a setting to a single string value, it is better to call: changeSettings(name, 1, &value);
  • 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).
bool RAY_ProceduralChild::changeSetting ( const char *  name,
int  argc,
const fpreal argv,
const char *  style = "object" 
)

Change any setting on the object (geometry, procedural, volume)

  • changeSetting(const char *name, const char *value)
    Parses the string into arguments and changes the setting If you want to change a setting to a single string value, it is better to call: changeSettings(name, 1, &value);
  • 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).
void RAY_ProceduralChild::debugSettings ( const char *  style = "object") const

Print out the object's settings to stderr.

void RAY_ProceduralChild::declarePackedPrimRenderStateSetting ( const GEO_Primitive )
inline

This function has no implementation in H16.0 and beyond. Please use setPackedQuery();

Definition at line 607 of file RAY_Procedural.h.

void RAY_ProceduralChild::declarePrimitiveAttributeSettings ( const GEO_Primitive prim,
const char *  prefix 
)

Convenience method that declares settings for all attributes associated with a given primitive, including the corresponding vertices, points, and parent detail. This is primarily used for packed primitives. The name of the setting will be the same as the attribute name prefixed with the given prefix.

bool RAY_ProceduralChild::declareSetting ( const char *  name,
const char *  value 
)

It's possible to add new settings to a child object. These settings can be accessed in shaders using the VEX renderstate() function.

It is illegal to:

  • redefine a built-in property
  • change the type of an existing property
  • change the tuple size of an existing property

This is equivalent to the ray_declare command in IFDs.

bool RAY_ProceduralChild::declareSetting ( const char *  name,
int  argc,
const char *const *  argv 
)

It's possible to add new settings to a child object. These settings can be accessed in shaders using the VEX renderstate() function.

It is illegal to:

  • redefine a built-in property
  • change the type of an existing property
  • change the tuple size of an existing property

This is equivalent to the ray_declare command in IFDs.

bool RAY_ProceduralChild::declareSetting ( const char *  name,
int  argc,
const int argv 
)

It's possible to add new settings to a child object. These settings can be accessed in shaders using the VEX renderstate() function.

It is illegal to:

  • redefine a built-in property
  • change the type of an existing property
  • change the tuple size of an existing property

This is equivalent to the ray_declare command in IFDs.

bool RAY_ProceduralChild::declareSetting ( const char *  name,
int  argc,
const fpreal argv 
)

It's possible to add new settings to a child object. These settings can be accessed in shaders using the VEX renderstate() function.

It is illegal to:

  • redefine a built-in property
  • change the type of an existing property
  • change the tuple size of an existing property

This is equivalent to the ray_declare command in IFDs.

bool RAY_ProceduralChild::isValid ( ) const

Test whether the child is valid. This checks to see whether there's a valid geometry, child procedural or a volume attached.

void RAY_ProceduralChild::limitAutoProcedural ( AutoProceduralType  aproc)

Limit the types of procedurals which can be automatically created to handle special primitive types. For example, if setting to AUTOPROCEDURAL_PACK, no special agent primitives will be created (but heightfields will).

SYS_SAFE_BOOL RAY_ProceduralChild::operator bool ( ) const
inline

Bool operator on handle.

Definition at line 444 of file RAY_Procedural.h.

const RAY_Procedural* RAY_ProceduralChild::parent ( ) const
inline

Return parent procedural.

Definition at line 447 of file RAY_Procedural.h.

void RAY_ProceduralChild::processPrimitiveMaterial ( const GEO_Primitive prim)

Convenience method to check for the following attributes on a primitive This method will check for the following attributes:

  • shop_materialpath
  • material_override
  • property_override
  • lightcategories
  • lightmask
  • categories
void RAY_ProceduralChild::processPrimitiveMaterial ( const GEO_Primitive prim,
const RAY_PrimitiveMaterialAttributes attribs 
)

This version takes a set of cached attributes for faster processing.

void RAY_ProceduralChild::setPackedQuery ( RAY_PackedQuery q)

Set the packed query lookup for this procedural. This method takes ownership of the query passed in.

void RAY_ProceduralChild::setPreTransform ( const UT_Matrix4D transform,
fpreal  shutter 
)

Transform the currently open object (geometry, procedural, volume) at the shutter time specified. The transform is a pre-transform that acts on the parent procedural's existing transform. This interface should be used to achieve the expected parenting behavior for procedurals, in which the transform is an object space transform inside the parent space.

bool RAY_ProceduralChild::setShopMaterialPath ( const UT_StringHolder shop_materialpath,
const UT_StringHolder material_override = UT_StringHolder(),
const UT_StringHolder property_map = UT_StringHolder() 
)

Calling setShopMaterialPath() will simulate adding the "shop_materialpath" and optionally the "material_override" and attributes on the geometry. This must be called after the openGeometryObject() and before the corresponding closeObject() calls. The property_map string is used to map the Houdini parameter names in the material_override string to mantra property names. Without this map, properties will not be overridden properly.

void RAY_ProceduralChild::setStylerInfo ( const RAY_StylerInfo styler_info)

Assign new style sheet node to the currently open object. Procedurals often prune the style sheet of entries that no longer apply to the geometry hierarchy.

void RAY_ProceduralChild::setTransform ( const UT_Matrix4D transform,
fpreal  shutter 
)

Transform the currently open object (geometry, procedural, volume) at the shutter time specified. The transform is a post-transform that acts on the parent procedural's existing transform. This method is preferred when you need to change the world transform from within the procedural. In most cases, setPreTransform() is preferred over setTransform().


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