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

Adapter class providing data exchange with the client scene graph. More...

+ Inheritance diagram for HdSceneDelegate:

Public Member Functions

HD_API HdSceneDelegate (HdRenderIndex *parentIndex, SdfPath const &delegateID)
 Constructor used for nested delegate objects which share a RenderIndex. More...
 
HdRenderIndexGetRenderIndex ()
 Returns the RenderIndex owned by this delegate. More...
 
SdfPath const & GetDelegateID () const
 Returns the ID of this delegate, which is used as a prefix for all objects it creates in the RenderIndex. More...
 
virtual HD_API void Sync (HdSyncRequestVector *request)
 Synchronizes the delegate state for the given request vector. More...
 
virtual HD_API void PostSyncCleanup ()
 Opportunity for the delegate to clean itself up after performing parrellel work during sync phase. More...
 
Options
virtual HD_API bool IsEnabled (TfToken const &option) const
 Returns true if the named option is enabled by the delegate. More...
 
Rprim Aspects
virtual HD_API HdMeshTopology GetMeshTopology (SdfPath const &id)
 Gets the topological mesh data for a given prim. More...
 
virtual HD_API
HdBasisCurvesTopology 
GetBasisCurvesTopology (SdfPath const &id)
 Gets the topological curve data for a given prim. More...
 
virtual HD_API PxOsdSubdivTags GetSubdivTags (SdfPath const &id)
 Gets the subdivision surface tags (sharpness, holes, etc). More...
 
virtual HD_API GfRange3d GetExtent (SdfPath const &id)
 Gets the axis aligned bounds of a prim. More...
 
virtual HD_API GfMatrix4d GetTransform (SdfPath const &id)
 Returns the object space transform, including all parent transforms. More...
 
virtual HD_API bool GetVisible (SdfPath const &id)
 Returns the authored visible state of the prim. More...
 
virtual HD_API bool GetDoubleSided (SdfPath const &id)
 Returns the doubleSided state for the given prim. More...
 
virtual HD_API HdCullStyle GetCullStyle (SdfPath const &id)
 Returns the cullstyle for the given prim. More...
 
virtual HD_API VtValue GetShadingStyle (SdfPath const &id)
 Returns the shading style for the given prim. More...
 
virtual HD_API HdDisplayStyle GetDisplayStyle (SdfPath const &id)
 Returns the refinement level for the given prim in the range [0,8]. More...
 
virtual HD_API VtValue Get (SdfPath const &id, TfToken const &key)
 Returns a named value. More...
 
virtual HD_API HdReprSelector GetReprSelector (SdfPath const &id)
 Returns the authored repr (if any) for the given prim. More...
 
virtual HD_API TfToken GetRenderTag (SdfPath const &id)
 Returns the render tag that will be used to bucket prims during render pass bucketing. More...
 
virtual HD_API VtArray< TfTokenGetCategories (SdfPath const &id)
 Returns the prim categories. More...
 
virtual HD_API std::vector
< VtArray< TfToken > > 
GetInstanceCategories (SdfPath const &instancerId)
 Returns the categories for all instances in the instancer. More...
 
virtual HD_API HdIdVectorSharedPtr GetCoordSysBindings (SdfPath const &id)
 Returns the coordinate system bindings, or a nullptr if none are bound. More...
 
Motion samples
virtual HD_API size_t SampleTransform (SdfPath const &id, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues)
 Store up to maxSampleCount transform samples in *sampleValues. More...
 
template<unsigned int CAPACITY>
void SampleTransform (SdfPath const &id, HdTimeSampleArray< GfMatrix4d, CAPACITY > *sa)
 Convenience form of SampleTransform() that takes an HdTimeSampleArray. More...
 
virtual HD_API size_t SampleInstancerTransform (SdfPath const &instancerId, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues)
 Store up to maxSampleCount transform samples in *sampleValues. More...
 
template<unsigned int CAPACITY>
void SampleInstancerTransform (SdfPath const &instancerId, HdTimeSampleArray< GfMatrix4d, CAPACITY > *sa)
 Convenience form of SampleInstancerTransform() that takes an HdTimeSampleArray. More...
 
virtual HD_API size_t SamplePrimvar (SdfPath const &id, TfToken const &key, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues)
 Store up to maxSampleCount primvar samples in *samplesValues. More...
 
template<unsigned int CAPACITY>
void SamplePrimvar (SdfPath const &id, TfToken const &key, HdTimeSampleArray< VtValue, CAPACITY > *sa)
 Convenience form of SamplePrimvar() that takes an HdTimeSampleArray. More...
 
Instancer prototypes
virtual HD_API VtIntArray GetInstanceIndices (SdfPath const &instancerId, SdfPath const &prototypeId)
 Gets the extracted indices array of the prototype id used in the instancer. More...
 
virtual HD_API GfMatrix4d GetInstancerTransform (SdfPath const &instancerId)
 Returns the instancer transform. More...
 
virtual HD_API SdfPath GetPathForInstanceIndex (const SdfPath &protoRprimId, int protoIndex, int *instancerIndex, SdfPath *masterCachePath=NULL, SdfPathVector *instanceContext=NULL)
 Resolves a protoRprimId and protoIndex back to original instancer path by backtracking nested instancer hierarchy. More...
 
Material Aspects
virtual HD_API SdfPath GetMaterialId (SdfPath const &rprimId)
 Returns the material ID bound to the rprim rprimId. More...
 
virtual HD_API std::string GetSurfaceShaderSource (SdfPath const &materialId)
 Returns the surface shader source code for the given material ID. More...
 
virtual HD_API std::string GetDisplacementShaderSource (SdfPath const &materialId)
 Returns the displacement shader source code for the given material ID. More...
 
virtual HD_API VtValue GetMaterialParamValue (SdfPath const &materialId, TfToken const &paramName)
 Returns a single value for the given material and named parameter. More...
 
virtual HD_API
HdMaterialParamVector 
GetMaterialParams (SdfPath const &materialId)
 Returns the material params for the given material ID. More...
 
virtual HD_API VtValue GetMaterialResource (SdfPath const &materialId)
 
virtual HD_API VtDictionary GetMaterialMetadata (SdfPath const &materialId)
 
Texture Aspects
virtual HD_API
HdTextureResource::ID 
GetTextureResourceID (SdfPath const &textureId)
 Returns the texture resource ID for a given texture ID. More...
 
virtual HD_API
HdTextureResourceSharedPtr 
GetTextureResource (SdfPath const &textureId)
 Returns the texture resource for a given texture ID. More...
 
Renderbuffer Aspects
virtual HD_API
HdRenderBufferDescriptor 
GetRenderBufferDescriptor (SdfPath const &id)
 Returns the allocation descriptor for a given render buffer prim. More...
 
Light Aspects
virtual HD_API VtValue GetLightParamValue (SdfPath const &id, TfToken const &paramName)
 
Camera Aspects
virtual HD_API VtValue GetCameraParamValue (SdfPath const &cameraId, TfToken const &paramName)
 Returns a single value for a given camera and parameter. More...
 
Volume Aspects
virtual HD_API
HdVolumeFieldDescriptorVector 
GetVolumeFieldDescriptors (SdfPath const &volumeId)
 
ExtComputation Aspects
virtual HD_API TfTokenVector GetExtComputationSceneInputNames (SdfPath const &computationId)
 For the given computation id, returns a list of inputs which will be requested from the scene delegate using the Get() method. More...
 
virtual HD_API
HdExtComputationInputDescriptorVector 
GetExtComputationInputDescriptors (SdfPath const &computationId)
 For the given computation id, returns a list of computation input descriptors. More...
 
virtual HD_API
HdExtComputationOutputDescriptorVector 
GetExtComputationOutputDescriptors (SdfPath const &computationId)
 For the given computation id, returns a list of computation output descriptors. More...
 
virtual HD_API
HdExtComputationPrimvarDescriptorVector 
GetExtComputationPrimvarDescriptors (SdfPath const &id, HdInterpolation interpolationMode)
 Returns a list of primvar names that should be bound to a generated output from an ExtComputation for the given prim id and interpolation mode. More...
 
virtual HD_API VtValue GetExtComputationInput (SdfPath const &computationId, TfToken const &input)
 Returns a single value for a given computation id and input token. More...
 
virtual HD_API std::string GetExtComputationKernel (SdfPath const &computationId)
 Returns the kernel source assigned to the computation at the path id. More...
 
virtual HD_API void InvokeExtComputation (SdfPath const &computationId, HdExtComputationContext *context)
 Requests the scene delegate run the ExtComputation with the given id. More...
 
Primitive Variables
virtual HD_API
HdPrimvarDescriptorVector 
GetPrimvarDescriptors (SdfPath const &id, HdInterpolation interpolation)
 Returns descriptors for all primvars of the given interpolation type. More...
 

Task Aspects

virtual HD_API TfTokenVector GetTaskRenderTags (SdfPath const &taskId)
 

Detailed Description

Adapter class providing data exchange with the client scene graph.

Definition at line 291 of file sceneDelegate.h.

Constructor & Destructor Documentation

HD_API HdSceneDelegate ( HdRenderIndex parentIndex,
SdfPath const &  delegateID 
)

Constructor used for nested delegate objects which share a RenderIndex.

Member Function Documentation

virtual HD_API VtValue Get ( SdfPath const &  id,
TfToken const &  key 
)
virtual

Returns a named value.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API HdBasisCurvesTopology GetBasisCurvesTopology ( SdfPath const &  id)
virtual

Gets the topological curve data for a given prim.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API VtValue GetCameraParamValue ( SdfPath const &  cameraId,
TfToken const &  paramName 
)
virtual

Returns a single value for a given camera and parameter.

See HdCameraTokens for the list of paramters.

Reimplemented in UsdImagingDelegate, and HdUnitTestDelegate.

virtual HD_API VtArray<TfToken> GetCategories ( SdfPath const &  id)
virtual

Returns the prim categories.

Reimplemented in UsdImagingDelegate.

virtual HD_API HdIdVectorSharedPtr GetCoordSysBindings ( SdfPath const &  id)
virtual

Returns the coordinate system bindings, or a nullptr if none are bound.

Reimplemented in UsdImagingDelegate.

virtual HD_API HdCullStyle GetCullStyle ( SdfPath const &  id)
virtual

Returns the cullstyle for the given prim.

Reimplemented in UsdImagingDelegate.

SdfPath const& GetDelegateID ( ) const
inline

Returns the ID of this delegate, which is used as a prefix for all objects it creates in the RenderIndex.

The default value is SdfPath::AbsoluteRootPath().

Definition at line 308 of file sceneDelegate.h.

virtual HD_API std::string GetDisplacementShaderSource ( SdfPath const &  materialId)
virtual

Returns the displacement shader source code for the given material ID.

Reimplemented in UsdImagingDelegate, and HdUnitTestDelegate.

virtual HD_API HdDisplayStyle GetDisplayStyle ( SdfPath const &  id)
virtual

Returns the refinement level for the given prim in the range [0,8].

The refinement level indicates how many iterations to apply when subdividing subdivision surfaces or other refinable primitives.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API bool GetDoubleSided ( SdfPath const &  id)
virtual

Returns the doubleSided state for the given prim.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API VtValue GetExtComputationInput ( SdfPath const &  computationId,
TfToken const &  input 
)
virtual

Returns a single value for a given computation id and input token.

The token may be a computation input or a computation config parameter.

Reimplemented in UsdImagingDelegate.

virtual HD_API HdExtComputationInputDescriptorVector GetExtComputationInputDescriptors ( SdfPath const &  computationId)
virtual

For the given computation id, returns a list of computation input descriptors.

See HdExtComputationInputDecriptor

Reimplemented in UsdImagingDelegate.

virtual HD_API std::string GetExtComputationKernel ( SdfPath const &  computationId)
virtual

Returns the kernel source assigned to the computation at the path id.

If the string is empty the computation has no GPU kernel and the CPU callback should be used.

Reimplemented in UsdImagingDelegate.

virtual HD_API HdExtComputationOutputDescriptorVector GetExtComputationOutputDescriptors ( SdfPath const &  computationId)
virtual

For the given computation id, returns a list of computation output descriptors.

See HdExtComputationOutputDescriptor

Reimplemented in UsdImagingDelegate.

virtual HD_API HdExtComputationPrimvarDescriptorVector GetExtComputationPrimvarDescriptors ( SdfPath const &  id,
HdInterpolation  interpolationMode 
)
virtual

Returns a list of primvar names that should be bound to a generated output from an ExtComputation for the given prim id and interpolation mode.

Binding information is obtained through GetExtComputationPrimvarDesc() Returns a structure describing source information for a primvar that is bound to an ExtComputation. See HdExtComputationPrimvarDesc for the expected information to be returned.

Reimplemented in UsdImagingDelegate.

virtual HD_API TfTokenVector GetExtComputationSceneInputNames ( SdfPath const &  computationId)
virtual

For the given computation id, returns a list of inputs which will be requested from the scene delegate using the Get() method.

See GetExtComputationInputDescriptors and GetExtComputationOutpuDescriptors for descriptions of other computation inputs and outputs.

Reimplemented in UsdImagingDelegate.

virtual HD_API GfRange3d GetExtent ( SdfPath const &  id)
virtual

Gets the axis aligned bounds of a prim.

The returned bounds are in the local space of the prim (transform is yet to be applied) and should contain the bounds of any child prims.

The returned bounds does not include any displacement that might occur as the result of running shaders on the prim.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API std::vector<VtArray<TfToken> > GetInstanceCategories ( SdfPath const &  instancerId)
virtual

Returns the categories for all instances in the instancer.

Reimplemented in UsdImagingDelegate.

virtual HD_API VtIntArray GetInstanceIndices ( SdfPath const &  instancerId,
SdfPath const &  prototypeId 
)
virtual

Gets the extracted indices array of the prototype id used in the instancer.

example instances: 0, 1, 2, 3, 4, 5 protoypes: A, B, A, A, B, C

GetInstanceIndices(A) : [0, 2, 3] GetInstanceIndices(B) : [1, 4] GetInstanceIndices(C) : [5] GetInstanceIndices(D) : []

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API GfMatrix4d GetInstancerTransform ( SdfPath const &  instancerId)
virtual

Returns the instancer transform.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API SdfPath GetMaterialId ( SdfPath const &  rprimId)
virtual

Returns the material ID bound to the rprim rprimId.

Reimplemented in UsdImagingDelegate, and HdUnitTestDelegate.

virtual HD_API HdMaterialParamVector GetMaterialParams ( SdfPath const &  materialId)
virtual

Returns the material params for the given material ID.

Reimplemented in UsdImagingDelegate, and HdUnitTestDelegate.

virtual HD_API VtValue GetMaterialParamValue ( SdfPath const &  materialId,
TfToken const &  paramName 
)
virtual

Returns a single value for the given material and named parameter.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API HdMeshTopology GetMeshTopology ( SdfPath const &  id)
virtual

Gets the topological mesh data for a given prim.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API SdfPath GetPathForInstanceIndex ( const SdfPath protoRprimId,
int  protoIndex,
int *  instancerIndex,
SdfPath masterCachePath = NULL,
SdfPathVector *  instanceContext = NULL 
)
virtual

Resolves a protoRprimId and protoIndex back to original instancer path by backtracking nested instancer hierarchy.

It will be an empty path if the given protoRprimId is not instanced.

(Note: see usdImaging/delegate.h for details specific to USD instancing)

If the instancer instances heterogeneously, the instance index of the prototype rprim doesn't match the instance index in the instancer.

For example, if we have:

instancer {
    prototypes = [ A, B, A, B, B ]
}

...then the indices would be:

   protoIndex          instancerIndex
A: [0, 1]              [0, 2]
B: [0, 1, 2]           [1, 3, 5]

To track this mapping, the instancerIndex is returned which corresponds to the given protoIndex.

Also, note if there are nested instancers, the returned path will be the top-level instancer, and the instancerIndex will be for that top-level instancer. This can lead to situations where, contrary to the previous scenario, the instancerIndex has fewer possible values than the protoIndex:

For example, if we have:

instancerBottom {
    prototypes = [ A, A, B ]
}
instancerTop {
    prototypes = [ instancerBottom, instancerBottom ]
}

...then the indices might be:

   protoIndex          instancerIndex  (for instancerTop)
A: [0, 1, 2, 3]        [0, 0, 1, 1]
B: [0, 1]              [0, 1]

because instancerIndex are indices for instancerTop, which only has two possible indices.

If masterCachePath is not NULL, then it may be set to the cache path corresponding instance master prim, if there is one. Otherwise, it will be set to null.

If instanceContext is not NULL, it is populated with the list of instance roots that must be traversed to get to the rprim. If this list is non-empty, the last prim is always the forwarded rprim.

Reimplemented in UsdImagingDelegate.

virtual HD_API HdPrimvarDescriptorVector GetPrimvarDescriptors ( SdfPath const &  id,
HdInterpolation  interpolation 
)
virtual

Returns descriptors for all primvars of the given interpolation type.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API HdRenderBufferDescriptor GetRenderBufferDescriptor ( SdfPath const &  id)
virtual

Returns the allocation descriptor for a given render buffer prim.

Reimplemented in HdUnitTestDelegate.

HdRenderIndex& GetRenderIndex ( )
inline

Returns the RenderIndex owned by this delegate.

Definition at line 302 of file sceneDelegate.h.

virtual HD_API TfToken GetRenderTag ( SdfPath const &  id)
virtual

Returns the render tag that will be used to bucket prims during render pass bucketing.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API HdReprSelector GetReprSelector ( SdfPath const &  id)
virtual

Returns the authored repr (if any) for the given prim.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API VtValue GetShadingStyle ( SdfPath const &  id)
virtual

Returns the shading style for the given prim.

virtual HD_API PxOsdSubdivTags GetSubdivTags ( SdfPath const &  id)
virtual

Gets the subdivision surface tags (sharpness, holes, etc).

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API std::string GetSurfaceShaderSource ( SdfPath const &  materialId)
virtual

Returns the surface shader source code for the given material ID.

Reimplemented in UsdImagingDelegate, and HdUnitTestDelegate.

virtual HD_API HdTextureResourceSharedPtr GetTextureResource ( SdfPath const &  textureId)
virtual

Returns the texture resource for a given texture ID.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API HdTextureResource::ID GetTextureResourceID ( SdfPath const &  textureId)
virtual

Returns the texture resource ID for a given texture ID.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API GfMatrix4d GetTransform ( SdfPath const &  id)
virtual

Returns the object space transform, including all parent transforms.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API bool GetVisible ( SdfPath const &  id)
virtual

Returns the authored visible state of the prim.

Reimplemented in HdUnitTestDelegate, and UsdImagingDelegate.

virtual HD_API void InvokeExtComputation ( SdfPath const &  computationId,
HdExtComputationContext context 
)
virtual

Requests the scene delegate run the ExtComputation with the given id.

The context contains the input values that delegate requested through GetExtComputationInputNames().

The scene delegate is expected to set each output identified by GetExtComputationOutputNames() on the context.

Hydra may invoke the computation on a different thread from what HdEngine::Execute() was called on. It may also invoke many computations in parallel.

Reimplemented in UsdImagingDelegate.

virtual HD_API bool IsEnabled ( TfToken const &  option) const
virtual

Returns true if the named option is enabled by the delegate.

virtual HD_API void PostSyncCleanup ( )
virtual

Opportunity for the delegate to clean itself up after performing parrellel work during sync phase.

Reimplemented in UsdImagingDelegate.

virtual HD_API size_t SampleInstancerTransform ( SdfPath const &  instancerId,
size_t  maxSampleCount,
float *  sampleTimes,
GfMatrix4d sampleValues 
)
virtual

Store up to maxSampleCount transform samples in *sampleValues.

Returns the union of the authored samples and the boundaries of the current camera shutter interval. If this number is greater than maxSampleCount, you might want to call this function again to get all the authored data. Sample times are relative to the scene delegate's current time.

See Also
GetInstancerTransform()

Reimplemented in UsdImagingDelegate.

void SampleInstancerTransform ( SdfPath const &  instancerId,
HdTimeSampleArray< GfMatrix4d, CAPACITY > *  sa 
)
inline

Convenience form of SampleInstancerTransform() that takes an HdTimeSampleArray.

This function returns the union of the authored samples and the boundaries of the current camera shutter interval.

Definition at line 470 of file sceneDelegate.h.

virtual HD_API size_t SamplePrimvar ( SdfPath const &  id,
TfToken const &  key,
size_t  maxSampleCount,
float *  sampleTimes,
VtValue sampleValues 
)
virtual

Store up to maxSampleCount primvar samples in *samplesValues.

Returns the union of the authored samples and the boundaries of the current camera shutter interval. If this number is greater than maxSampleCount, you might want to call this function again to get all the authored data.

Sample values that are array-valued will have a size described by the HdPrimvarDescriptor as applied to the toplogy.

For example, this means that a mesh that is fracturing over time will return samples with the same number of points; the number of points will change as the scene delegate is resynchronzied to represent the scene at a time with different topology.

Sample times are relative to the scene delegate's current time.

See Also
Get()

Reimplemented in UsdImagingDelegate.

void SamplePrimvar ( SdfPath const &  id,
TfToken const &  key,
HdTimeSampleArray< VtValue, CAPACITY > *  sa 
)
inline

Convenience form of SamplePrimvar() that takes an HdTimeSampleArray.

This function returns the union of the authored samples and the boundaries of the current camera shutter interval.

Definition at line 523 of file sceneDelegate.h.

virtual HD_API size_t SampleTransform ( SdfPath const &  id,
size_t  maxSampleCount,
float *  sampleTimes,
GfMatrix4d sampleValues 
)
virtual

Store up to maxSampleCount transform samples in *sampleValues.

Returns the union of the authored samples and the boundaries of the current camera shutter interval. If this number is greater than maxSampleCount, you might want to call this function again to get all the authored data. Sample times are relative to the scene delegate's current time.

See Also
GetTransform()

Reimplemented in UsdImagingDelegate.

void SampleTransform ( SdfPath const &  id,
HdTimeSampleArray< GfMatrix4d, CAPACITY > *  sa 
)
inline

Convenience form of SampleTransform() that takes an HdTimeSampleArray.

This function returns the union of the authored transform samples and the boundaries of the current camera shutter interval.

Definition at line 431 of file sceneDelegate.h.

virtual HD_API void Sync ( HdSyncRequestVector request)
virtual

Synchronizes the delegate state for the given request vector.

Reimplemented in UsdImagingDelegate.


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