HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hd_PrimTypeIndex< PrimType > Class Template Reference

#include <primTypeIndex.h>

Public Member Functions

 Hd_PrimTypeIndex ()
 
 ~Hd_PrimTypeIndex ()
 
void InitPrimTypes (const TfTokenVector &primTypes)
 
void Clear (HdChangeTracker &tracker, HdRenderDelegate *renderDelegate)
 
void InsertPrim (const TfToken &typeId, HdSceneDelegate *sceneDelegate, const SdfPath &primId, HdChangeTracker &tracker, HdRenderDelegate *renderDelegate)
 
void RemovePrim (const TfToken &typeId, const SdfPath &primId, HdChangeTracker &tracker, HdRenderDelegate *renderDelegate)
 
void RemoveSubtree (const SdfPath &root, HdSceneDelegate *sceneDelegate, HdChangeTracker &tracker, HdRenderDelegate *renderDelegate)
 
PrimType * GetPrim (const TfToken &typeId, const SdfPath &primId) const
 
PrimType * GetFallbackPrim (TfToken const &typeId) const
 
void GetPrimSubtree (const TfToken &typeId, const SdfPath &rootPath, SdfPathVector *outPaths)
 
bool CreateFallbackPrims (HdRenderDelegate *renderDelegate)
 
void DestroyFallbackPrims (HdRenderDelegate *renderDelegate)
 
void SyncPrims (HdChangeTracker &tracker, HdRenderParam *renderParam, HdRenderDelegate *renderDelegate)
 
const HdSceneDelegatePtrVectorGetSceneDelegatesForDirtyPrims ()
 

Detailed Description

template<class PrimType>
class Hd_PrimTypeIndex< PrimType >

This class is only used by the render index. It provides functionality to manage and store one class of prim such as a Sprim or Bprim.

Definition at line 50 of file primTypeIndex.h.

Constructor & Destructor Documentation

template<class PrimType>
Hd_PrimTypeIndex< PrimType >::Hd_PrimTypeIndex ( )
template<class PrimType>
Hd_PrimTypeIndex< PrimType >::~Hd_PrimTypeIndex ( )

Member Function Documentation

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::Clear ( HdChangeTracker tracker,
HdRenderDelegate renderDelegate 
)

Removes and frees all prims in this index. The render delegate is responsible for freeing the actual memory allocated to the prim. The prim is also removed from the change tracker.

template<class PrimType>
bool Hd_PrimTypeIndex< PrimType >::CreateFallbackPrims ( HdRenderDelegate renderDelegate)

Uses the provided render delegate to create the fallback prims for use by the index. The prim types created are based on those specified by InitPrimTypes.

If the render delegate fails to create a prim, this function returns false and the index is remain uninitialized and shouldn't be used.

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::DestroyFallbackPrims ( HdRenderDelegate renderDelegate)

Clean-up function for the index. Uses the delegate to deallocate the memory used by the fallback prims. The index is returned to an uninitialized state and shouldn't be used, unless reinitialized.

template<class PrimType>
PrimType* Hd_PrimTypeIndex< PrimType >::GetFallbackPrim ( TfToken const &  typeId) const

Obtain a prim, that implements the schema given by type id, that can be used as a substitute for any prim of that type in the event of an error.

Hydra guarantees that the prim is not null for any type that is supported by the back-end.

template<class PrimType>
PrimType* Hd_PrimTypeIndex< PrimType >::GetPrim ( const TfToken typeId,
const SdfPath primId 
) const

Obtains a modifiable pointer the prim with the given type and id. If no prim with the given id is in the index or the type id is incorrect, then nullptr is returned.

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::GetPrimSubtree ( const TfToken typeId,
const SdfPath rootPath,
SdfPathVector outPaths 
)

Returns a list of Prim Ids in outPaths of prims that type match typeId who are namespace children of rootPath. rootPath does not need to match any prim in the index or it may point to a prim of a different type.

template<class PrimType>
const HdSceneDelegatePtrVector& Hd_PrimTypeIndex< PrimType >::GetSceneDelegatesForDirtyPrims ( )

Returns a vector of unique scene delegates corresponding to the dirty prims that were sync'd in SyncPrims.

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::InitPrimTypes ( const TfTokenVector primTypes)

Initialize this prim index, specifying the typeId tokens that should be supported by this index.

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::InsertPrim ( const TfToken typeId,
HdSceneDelegate sceneDelegate,
const SdfPath primId,
HdChangeTracker tracker,
HdRenderDelegate renderDelegate 
)

Add a new a prim to the render index identified by the globally unique identifier, primId. typeId is the type of the prim to create, which is allocated using the provided render delegate. The Scene delegate provided is associated with the prim and is the one used to pull the data for the prim during sync processing. As well as being inserted into this index, the prim is added to the change tracker, with the initial dirty state provided by the prim itself.

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::RemovePrim ( const TfToken typeId,
const SdfPath primId,
HdChangeTracker tracker,
HdRenderDelegate renderDelegate 
)

Removes the prim identifier by primId. TypeId is the type of that prim. Memory for the prim is deallocated using the render delegate. The prim is also removed from the change tracker.

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::RemoveSubtree ( const SdfPath root,
HdSceneDelegate sceneDelegate,
HdChangeTracker tracker,
HdRenderDelegate renderDelegate 
)

Removes the subtree of prims identifier by root that are owned by the given scene delegate. This function affects all prim types. Memory for the prim is deallocated using the render delegate. The prim is also removed from the change tracker.

template<class PrimType>
void Hd_PrimTypeIndex< PrimType >::SyncPrims ( HdChangeTracker tracker,
HdRenderParam renderParam,
HdRenderDelegate renderDelegate 
)

Main Sync Processing function.

Will call the Sync function on all prims in the index that are marked dirty in the specified change tracker. Also updates an internal list of scene delegates for the dirty prims.


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