Loading...
Searching...
No Matches
HdEmbreeInstancer Class Reference

HdEmbree implements instancing by adding prototype geometry to the BVH multiple times within HdEmbreeMesh::Sync(). More...

#include <instancer.h>

+ Inheritance diagram for HdEmbreeInstancer:

Public Member Functions

 HdEmbreeInstancer (HdSceneDelegate *delegate, SdfPath const &id)
 Constructor.
 
 ~HdEmbreeInstancer ()
 Destructor.
 
VtMatrix4dArray ComputeInstanceTransforms (SdfPath const &prototypeId)
 Computes all instance transforms for the provided prototype id, taking into account the scene delegate's instancerTransform and the instance primvars "hydra:instanceTransforms", "hydra:instanceTranslations", "hydra:instanceRotations", and "hydra:instanceScales".
 
void Sync (HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
 Updates cached primvar data from the scene delegate.
 
- Public Member Functions inherited from HdInstancer
HD_API HdInstancer (HdSceneDelegate *delegate, SdfPath const &id)
 Constructor.
 
SdfPath const & GetId () const
 Returns the identifier.
 
SdfPath const & GetParentId () const
 Returns the parent instancer identifier.
 
HdSceneDelegateGetDelegate () const
 
virtual HD_API void Sync (HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits)
 
virtual HD_API void Finalize (HdRenderParam *renderParam)
 
virtual HD_API HdDirtyBits GetInitialDirtyBitsMask () const
 

Additional Inherited Members

- Static Public Member Functions inherited from HdInstancer
static HD_API int GetInstancerNumLevels (HdRenderIndex &index, HdRprim const &rprim)
 
static HD_API TfTokenVector const & GetBuiltinPrimvarNames ()
 
static HD_API void _SyncInstancerAndParents (HdRenderIndex &renderIndex, SdfPath const &instancerId)
 
- Protected Member Functions inherited from HdInstancer
HD_API void _UpdateInstancer (HdSceneDelegate *delegate, HdDirtyBits *dirtyBits)
 

Detailed Description

HdEmbree implements instancing by adding prototype geometry to the BVH multiple times within HdEmbreeMesh::Sync().

The only instance-varying attribute that HdEmbree supports is transform, so the natural accessor to instancer data is ComputeInstanceTransforms(), which returns a list of transforms to apply to the given prototype (one instance per transform).

Nested instancing can be handled by recursion, and by taking the cartesian product of the transform arrays at each nesting level, to create a flattened transform array.

Definition at line 50 of file instancer.h.

Constructor & Destructor Documentation

◆ HdEmbreeInstancer()

HdEmbreeInstancer ( HdSceneDelegate delegate,
SdfPath const &  id 
)

Constructor.

Parameters
delegateThe scene delegate backing this instancer's data.
idThe unique id of this instancer.

◆ ~HdEmbreeInstancer()

Destructor.

Member Function Documentation

◆ ComputeInstanceTransforms()

VtMatrix4dArray ComputeInstanceTransforms ( SdfPath const &  prototypeId)

Computes all instance transforms for the provided prototype id, taking into account the scene delegate's instancerTransform and the instance primvars "hydra:instanceTransforms", "hydra:instanceTranslations", "hydra:instanceRotations", and "hydra:instanceScales".

Computes and flattens nested transforms, if necessary.

Parameters
prototypeIdThe prototype to compute transforms for.
Returns
One transform per instance, to apply when drawing.

◆ Sync()

void Sync ( HdSceneDelegate sceneDelegate,
HdRenderParam renderParam,
HdDirtyBits *  dirtyBits 
)
overridevirtual

Updates cached primvar data from the scene delegate.

Parameters
sceneDelegateThe scene delegate for this prim.
renderParamThe hdEmbree render param.
dirtyBitsThe dirty bits for this instancer.

Reimplemented from HdInstancer.


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