All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdEmbreeMesh Class Referencefinal

An HdEmbree representation of a subdivision surface or poly-mesh object. More...

+ Inheritance diagram for HdEmbreeMesh:

Public Member Functions

 HF_MALLOC_TAG_NEW ("new HdEmbreeMesh")
 
 HdEmbreeMesh (SdfPath const &id)
 HdEmbreeMesh constructor. More...
 
virtual ~HdEmbreeMesh ()=default
 HdEmbreeMesh destructor. More...
 
virtual HdDirtyBits GetInitialDirtyBitsMask () const override
 Inform the scene graph which state needs to be downloaded in the first Sync() call: in this case, topology and points data to build the geometry object in the embree scene graph. More...
 
virtual void Sync (HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits, TfToken const &reprToken) override
 Pull invalidated scene data and prepare/update the renderable representation. More...
 
virtual void Finalize (HdRenderParam *renderParam) override
 Release any resources this class is holding onto: in this case, destroy the geometry object in the embree scene graph. More...
 
- Public Member Functions inherited from HdMesh
bool IsDoubleSided (HdSceneDelegate *delegate) const
 Render State. More...
 
HdCullStyle GetCullStyle (HdSceneDelegate *delegate) const
 
VtValue GetShadingStyle (HdSceneDelegate *delegate) const
 
HdMeshTopology GetMeshTopology (HdSceneDelegate *delegate) const
 Topological accessors via the scene delegate. More...
 
HdDisplayStyle GetDisplayStyle (HdSceneDelegate *delegate) const
 
PxOsdSubdivTags GetSubdivTags (HdSceneDelegate *delegate) const
 
virtual HdMeshTopologySharedPtr GetTopology () const
 Topology getter. More...
 
VtValue GetPoints (HdSceneDelegate *delegate) const
 Primvars Accessors. More...
 
VtValue GetNormals (HdSceneDelegate *delegate) const
 
HD_API TfTokenVector const & GetBuiltinPrimvarNames () const override
 Returns the names of built-in primvars, i.e. More...
 
- Public Member Functions inherited from HdRprim
HD_API HdRprim (SdfPath const &id)
 
HD_API const
HdRepr::DrawItemUniquePtrVector & 
GetDrawItems (TfToken const &reprToken) const
 Returns the draw items for the requested repr token, if any. More...
 
SdfPath const & GetId () const
 Returns the identifier of this Rprim. More...
 
int32_t GetPrimId () const
 Return the unique instance id. More...
 
HD_API void SetPrimId (int32_t primId)
 Set the unique instance id. More...
 
SdfPath const & GetInstancerId () const
 Returns the identifier of the instancer (if any) for this Rprim. More...
 
SdfPath const & GetMaterialId () const
 Returns the path of the material to which this Rprim is bound. More...
 
HD_API void SetMaterialId (SdfPath const &materialId)
 Sets a new material binding to be used by this rprim. More...
 
TfToken const & GetMaterialTag () const
 The MaterialTag allows rprims to be organized into different collections based on properties of the prim's material. More...
 
HD_API void SetMaterialTag (TfToken const &materialTag)
 Sets the material tag used by the rprim. More...
 
HdReprSelector const & GetReprSelector () const
 
TfToken GetRenderTag (HdSceneDelegate *delegate) const
 Returns the render tag associated to this rprim. More...
 
GfRange3d GetExtent (HdSceneDelegate *delegate) const
 Returns the bounds of the rprim in local, untransformed space. More...
 
HdPrimvarDescriptorVector GetPrimvarDescriptors (HdSceneDelegate *delegate, HdInterpolation interpolation) const
 Primvar Query. More...
 
VtValue GetPrimvar (HdSceneDelegate *delegate, const TfToken &name) const
 
VtValue GetIndexedPrimvar (HdSceneDelegate *delegate, const TfToken &name, VtIntArray *indices) const
 
HD_API VtMatrix4dArray GetInstancerTransforms (HdSceneDelegate *delegate)
 
HD_API bool IsDirty (HdChangeTracker &changeTracker) const
 Returns true if any dirty flags are set for this rprim. More...
 
bool IsVisible () const
 Is the prim itself visible. More...
 
HD_API void UpdateReprSelector (HdSceneDelegate *delegate, HdDirtyBits *dirtyBits)
 
HD_API bool CanSkipDirtyBitPropagationAndSync (HdDirtyBits bits) const
 This function gives an Rprim the chance to "early exit" from dirty bit propagation, delegate sync and rprim sync altogether. More...
 
HD_API HdDirtyBits PropagateRprimDirtyBits (HdDirtyBits bits)
 This function gives an Rprim the chance to set additional dirty bits based on those set in the change tracker, before passing the dirty bits to the scene delegate. More...
 
HD_API void InitRepr (HdSceneDelegate *delegate, TfToken const &reprToken, HdDirtyBits *dirtyBits)
 Initialize the representation of this Rprim by calling _InitRepr. More...
 

Protected Member Functions

virtual void _InitRepr (TfToken const &reprToken, HdDirtyBits *dirtyBits) override
 Initialize the given representation of this Rprim. More...
 
virtual HdDirtyBits _PropagateDirtyBits (HdDirtyBits bits) const override
 This callback from Rprim gives the prim an opportunity to set additional dirty bits based on those already set. More...
 
- Protected Member Functions inherited from HdMesh
HD_API HdMesh (SdfPath const &id)
 Constructor. More...
 
- Protected Member Functions inherited from HdRprim
HD_API HdReprSharedPtr const & _GetRepr (TfToken const &reprToken) const
 
HD_API void _UpdateVisibility (HdSceneDelegate *sceneDelegate, HdDirtyBits *dirtyBits)
 
HD_API void _UpdateInstancer (HdSceneDelegate *sceneDelegate, HdDirtyBits *dirtyBits)
 

Additional Inherited Members

- Static Public Member Functions inherited from HdMesh
static HD_API void ConfigureRepr (TfToken const &reprName, HdMeshReprDesc desc1, HdMeshReprDesc desc2=HdMeshReprDesc())
 Configure the geometric style of the mesh for a given representation. More...
 
- Protected Types inherited from HdMesh
typedef _ReprDescConfigs
< HdMeshReprDesc, 2 > 
_MeshReprConfig
 
- Protected Types inherited from HdRprim
typedef std::vector< std::pair
< TfToken, HdReprSharedPtr > > 
_ReprVector
 
- Static Protected Member Functions inherited from HdMesh
static HD_API
_MeshReprConfig::DescArray 
_GetReprDesc (TfToken const &reprName)
 
- Protected Attributes inherited from HdRprim
HdRprimSharedData _sharedData
 
HdReprSelector _authoredReprSelector
 
_ReprVector _reprs
 

Detailed Description

An HdEmbree representation of a subdivision surface or poly-mesh object.

This class is an example of a hydra Rprim, or renderable object, and it gets created on a call to HdRenderIndex::InsertRprim() with a type of HdPrimTypeTokens->mesh.

The prim object's main function is to bridge the scene description and the renderable representation. The Hydra image generation algorithm will call HdRenderIndex::SyncAll() before any drawing; this, in turn, will call Sync() for each mesh with new data.

Sync() is passed a set of dirtyBits, indicating which scene buffers are dirty. It uses these to pull all of the new scene data and constructs updated embree geometry objects. Rebuilding the top-level acceleration datastructures is deferred to the start of HdEmbreeRender::Render().

An rprim's state is lazily populated in Sync(); matching this, Finalize() does the heavy work of releasing state (such as handles into the top-level embree scene), so that object population and existence aren't tied to each other.

Definition at line 65 of file mesh.h.

Constructor & Destructor Documentation

HdEmbreeMesh ( SdfPath const &  id)

HdEmbreeMesh constructor.

Parameters
idThe scene-graph path to this mesh.
virtual ~HdEmbreeMesh ( )
virtualdefault

HdEmbreeMesh destructor.

(Note: Embree resources are released in Finalize()).

Member Function Documentation

virtual void _InitRepr ( TfToken const &  reprToken,
HdDirtyBits *  dirtyBits 
)
overrideprotectedvirtual

Initialize the given representation of this Rprim.

This is called prior to syncing the prim, the first time the repr is used.

reprToken is the name of the representation to initalize.

dirtyBits is an in/out value. It is initialized to the dirty bits from the change tracker. InitRepr can then set additional dirty bits if additional data is required from the scene delegate when this repr is synced. InitRepr occurs before dirty bit propagation.

See HdRprim::InitRepr()

Implements HdRprim.

virtual HdDirtyBits _PropagateDirtyBits ( HdDirtyBits  bits) const
overrideprotectedvirtual

This callback from Rprim gives the prim an opportunity to set additional dirty bits based on those already set.

This is done before the dirty bits are passed to the scene delegate, so can be used to communicate that extra information is needed by the prim to process the changes.

The return value is the new set of dirty bits, which replaces the bits passed in.

See HdRprim::PropagateRprimDirtyBits()

Implements HdRprim.

virtual void Finalize ( HdRenderParam renderParam)
overridevirtual

Release any resources this class is holding onto: in this case, destroy the geometry object in the embree scene graph.

Parameters
renderParamAn HdEmbreeRenderParam object containing top-level embree state.

Reimplemented from HdRprim.

virtual HdDirtyBits GetInitialDirtyBitsMask ( ) const
overridevirtual

Inform the scene graph which state needs to be downloaded in the first Sync() call: in this case, topology and points data to build the geometry object in the embree scene graph.

Returns
The initial dirty state this mesh wants to query.

Implements HdRprim.

virtual void Sync ( HdSceneDelegate sceneDelegate,
HdRenderParam renderParam,
HdDirtyBits *  dirtyBits,
TfToken const &  reprToken 
)
overridevirtual

Pull invalidated scene data and prepare/update the renderable representation.

This function is told which scene data to pull through the dirtyBits parameter. The first time it's called, dirtyBits comes from _GetInitialDirtyBits(), which provides initial dirty state, but after that it's driven by invalidation tracking in the scene delegate.

The contract for this function is that the prim can only pull on scene delegate buffers that are marked dirty. Scene delegates can and do implement just-in-time data schemes that mean that pulling on clean data will be at best incorrect, and at worst a crash.

This function is called in parallel from worker threads, so it needs to be threadsafe; calls into HdSceneDelegate are ok.

Reprs are used by hydra for controlling per-item draw settings like flat/smooth shaded, wireframe, refined, etc.

Parameters
sceneDelegateThe data source for this geometry item.
renderParamAn HdEmbreeRenderParam object containing top-level embree state.
dirtyBitsA specifier for which scene data has changed.
reprTokenA specifier for which representation to draw with.

Implements HdRprim.


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