HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdRprim Class Referenceabstract

#include <rprim.h>

+ Inheritance diagram for HdRprim:

Classes

struct  _ReprComparator
 
struct  _ReprDescConfigs
 

Public Member Functions

HD_API HdRprim (SdfPath const &id, SdfPath const &instancerId)
 
virtual HD_API ~HdRprim ()
 
Rprim Hydra Engine API : Execute Phase
HD_API const
HdRepr::DrawItemUniquePtrVector
GetDrawItems (TfToken const &reprToken) const
 
Rprim Hydra Engine API : Cleanup
virtual HD_API void Finalize (HdRenderParam *renderParam)
 
Rprim Data API
SdfPath constGetId () const
 
int32_t GetPrimId () const
 Return the unique instance id. More...
 
HD_API void SetPrimId (int32_t primId)
 Set the unique instance id. More...
 
SdfPath constGetInstancerId () const
 
SdfPath constGetMaterialId () const
 
TfToken constGetMaterialTag () const
 
HdReprSelector constGetReprSelector () 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...
 
virtual HD_API TfTokenVector
const
GetBuiltinPrimvarNames () const =0
 
VtValue GetPrimvar (HdSceneDelegate *delegate, const TfToken &name) 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)
 

Rprim Hydra Engine API : Pre-Sync & Sync-Phase

virtual HdDirtyBits GetInitialDirtyBitsMask () const =0
 
HD_API bool CanSkipDirtyBitPropagationAndSync (HdDirtyBits bits) const
 
HD_API HdDirtyBits PropagateRprimDirtyBits (HdDirtyBits bits)
 
HD_API void InitRepr (HdSceneDelegate *delegate, TfToken const &reprToken, HdDirtyBits *dirtyBits)
 
virtual void Sync (HdSceneDelegate *delegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits, TfToken const &reprToken)=0
 
virtual HdDirtyBits _PropagateDirtyBits (HdDirtyBits bits) const =0
 
virtual void _InitRepr (TfToken const &reprToken, HdDirtyBits *dirtyBits)=0
 

Rprim Shared API

typedef std::vector< std::pair
< TfToken, HdReprSharedPtr > > 
_ReprVector
 Sets a new material binding to be used by this rprim. More...
 
HdRprimSharedData _sharedData
 Sets a new material binding to be used by this rprim. More...
 
HdReprSelector _authoredReprSelector
 Sets a new material binding to be used by this rprim. More...
 
_ReprVector _reprs
 Sets a new material binding to be used by this rprim. More...
 
HD_API HdReprSharedPtr const_GetRepr (TfToken const &reprToken) const
 Sets a new material binding to be used by this rprim. More...
 
HD_API void _UpdateVisibility (HdSceneDelegate *sceneDelegate, HdDirtyBits *dirtyBits)
 Sets a new material binding to be used by this rprim. More...
 
HD_API void _SetMaterialId (HdChangeTracker &changeTracker, SdfPath const &materialId)
 Sets a new material binding to be used by this rprim. More...
 
HD_API uint64_t _ComputeSharedPrimvarId (uint64_t baseId, HdBufferSourceSharedPtrVector const &sources, HdComputationSharedPtrVector const &computations) const
 Sets a new material binding to be used by this rprim. More...
 
static HD_API bool _IsEnabledSharedVertexPrimvar ()
 Sets a new material binding to be used by this rprim. More...
 

Detailed Description

The render engine state for a given rprim from the scene graph. All data access (aside from local caches) is delegated to the HdSceneDelegate.

Definition at line 68 of file rprim.h.

Member Typedef Documentation

typedef std::vector<std::pair<TfToken, HdReprSharedPtr> > HdRprim::_ReprVector
protected

Sets a new material binding to be used by this rprim.

Definition at line 311 of file rprim.h.

Constructor & Destructor Documentation

HD_API HdRprim::HdRprim ( SdfPath const id,
SdfPath const instancerId 
)
virtual HD_API HdRprim::~HdRprim ( )
virtual

Member Function Documentation

HD_API uint64_t HdRprim::_ComputeSharedPrimvarId ( uint64_t  baseId,
HdBufferSourceSharedPtrVector const sources,
HdComputationSharedPtrVector const computations 
) const
protected

Sets a new material binding to be used by this rprim.

HD_API HdReprSharedPtr const& HdRprim::_GetRepr ( TfToken const reprToken) const
protected

Sets a new material binding to be used by this rprim.

virtual void HdRprim::_InitRepr ( TfToken const reprToken,
HdDirtyBits dirtyBits 
)
protectedpure virtual

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()

Implemented in HdStBasisCurves, HdStMesh, HdStPoints, and HdStVolume.

static HD_API bool HdRprim::_IsEnabledSharedVertexPrimvar ( )
staticprotected

Sets a new material binding to be used by this rprim.

virtual HdDirtyBits HdRprim::_PropagateDirtyBits ( HdDirtyBits  bits) const
protectedpure virtual

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()

Implemented in HdStBasisCurves, HdStMesh, HdStPoints, and HdStVolume.

HD_API void HdRprim::_SetMaterialId ( HdChangeTracker changeTracker,
SdfPath const materialId 
)
protected

Sets a new material binding to be used by this rprim.

HD_API void HdRprim::_UpdateVisibility ( HdSceneDelegate sceneDelegate,
HdDirtyBits dirtyBits 
)
protected

Sets a new material binding to be used by this rprim.

HD_API bool HdRprim::CanSkipDirtyBitPropagationAndSync ( HdDirtyBits  bits) const

This function gives an Rprim the chance to "early exit" from dirty bit propagation, delegate sync and rprim sync altogether. It is a temporary measure to prevent unnecessary work, like in the case of invisible prims. The dirty bits in the change tracker remain the same. See the implementation for the finer details.

virtual HD_API void HdRprim::Finalize ( HdRenderParam renderParam)
virtual

Finalizes object resources. This function might not delete resources, but it should deal with resource ownership so that the rprim is deletable.

virtual HD_API TfTokenVector const& HdRprim::GetBuiltinPrimvarNames ( ) const
pure virtual

Returns the names of built-in primvars, i.e. primvars that are part of the core geometric schema for this prim.

Implemented in HdMesh, HdBasisCurves, HdPoints, and HdVolume.

HD_API const HdRepr::DrawItemUniquePtrVector& HdRprim::GetDrawItems ( TfToken const reprToken) const

Returns the draw items for the requested repr token, if any. These draw items should be constructed and cached beforehand by Sync(). If no draw items exist, or reprToken cannot be found, nullptr will be returned.

GfRange3d HdRprim::GetExtent ( HdSceneDelegate delegate) const
inline

Returns the bounds of the rprim in local, untransformed space.

Definition at line 368 of file rprim.h.

SdfPath const& HdRprim::GetId ( ) const
inline

Returns the identifier of this Rprim. This is both used in the RenderIndex and the SceneDelegate and acts as the associative key for the Rprim in both contexts.

Definition at line 176 of file rprim.h.

virtual HdDirtyBits HdRprim::GetInitialDirtyBitsMask ( ) const
pure virtual

Returns the set of dirty bits that should be added to the change tracker for this prim, when this prim is inserted.

Implemented in HdStBasisCurves, HdStMesh, HdStPoints, and HdStVolume.

SdfPath const& HdRprim::GetInstancerId ( ) const
inline

Returns the identifier of the instancer (if any) for this Rprim. If this Rprim is not instanced, an empty SdfPath will be returned.

Definition at line 187 of file rprim.h.

HD_API VtMatrix4dArray HdRprim::GetInstancerTransforms ( HdSceneDelegate delegate)

Returns the identifier of this Rprim. This is both used in the RenderIndex and the SceneDelegate and acts as the associative key for the Rprim in both contexts.

SdfPath const& HdRprim::GetMaterialId ( ) const
inline

Returns the path of the material to which this Rprim is bound. The material object itself can be fetched from the RenderIndex using this identifier.

Definition at line 192 of file rprim.h.

TfToken const& HdRprim::GetMaterialTag ( ) const
inline

The MaterialTag allows rprims to be organized into different collections based on properties of the prim's material. E.g. A renderer may wish to organize opaque and translucent prims into different collections so they can be rendered seperately.

Definition at line 198 of file rprim.h.

int32_t HdRprim::GetPrimId ( ) const
inline

Return the unique instance id.

Definition at line 179 of file rprim.h.

VtValue HdRprim::GetPrimvar ( HdSceneDelegate delegate,
const TfToken name 
) const
inline

Returns the identifier of this Rprim. This is both used in the RenderIndex and the SceneDelegate and acts as the associative key for the Rprim in both contexts.

Definition at line 381 of file rprim.h.

HdPrimvarDescriptorVector HdRprim::GetPrimvarDescriptors ( HdSceneDelegate delegate,
HdInterpolation  interpolation 
) const
inline

Primvar Query.

Definition at line 374 of file rprim.h.

TfToken HdRprim::GetRenderTag ( HdSceneDelegate delegate) const
inline

Returns the render tag associated to this rprim.

Definition at line 362 of file rprim.h.

HdReprSelector const& HdRprim::GetReprSelector ( ) const
inline

Returns the identifier of this Rprim. This is both used in the RenderIndex and the SceneDelegate and acts as the associative key for the Rprim in both contexts.

Definition at line 200 of file rprim.h.

HD_API void HdRprim::InitRepr ( HdSceneDelegate delegate,
TfToken const reprToken,
HdDirtyBits dirtyBits 
)

Initialize the representation of this Rprim by calling _InitRepr. This is called prior to dirty bit propagation & sync, the first time the repr is used, or when the authored representation is dirty.

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.

HD_API bool HdRprim::IsDirty ( HdChangeTracker changeTracker) const

Returns true if any dirty flags are set for this rprim.

bool HdRprim::IsVisible ( ) const
inline

Is the prim itself visible.

Definition at line 231 of file rprim.h.

HD_API HdDirtyBits HdRprim::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. It calls into _PropagateDirtyBits, which gives the Rprim an opportunity to specify the additional data needed to process the requested changes.

The return value is the new set of dirty bits.

HD_API void HdRprim::SetPrimId ( int32_t  primId)

Set the unique instance id.

virtual void HdRprim::Sync ( HdSceneDelegate delegate,
HdRenderParam renderParam,
HdDirtyBits dirtyBits,
TfToken const reprToken 
)
pure virtual

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.

Parameters
sceneDelegateThe data source for this geometry item.
renderParamA render delegate object that holds rendering parameters that scene geometry may use.
dirtyBitsA specifier for which scene data has changed.
reprTokenThe representation that needs to be updated. This is useful for backends that support multiple display representations for an rprim. A given representation may choose to pull on a subset of the dirty state.
dirtyBitsOn input specifies which state is dirty and can be pulled from the scene delegate. On output specifies which bits are still dirty and were not cleaned by the sync.

Implemented in HdStBasisCurves, HdStMesh, HdStPoints, and HdStVolume.

HD_API void HdRprim::UpdateReprSelector ( HdSceneDelegate delegate,
HdDirtyBits dirtyBits 
)

Returns the identifier of this Rprim. This is both used in the RenderIndex and the SceneDelegate and acts as the associative key for the Rprim in both contexts.

Member Data Documentation

HdReprSelector HdRprim::_authoredReprSelector
protected

Sets a new material binding to be used by this rprim.

Definition at line 306 of file rprim.h.

_ReprVector HdRprim::_reprs
protected

Sets a new material binding to be used by this rprim.

Definition at line 312 of file rprim.h.

HdRprimSharedData HdRprim::_sharedData
protected

Sets a new material binding to be used by this rprim.

Definition at line 303 of file rprim.h.


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