7#ifndef PXR_IMAGING_HD_SCENE_INDEX_ADAPTER_SCENE_DELEGATE_H
8#define PXR_IMAGING_HD_SCENE_INDEX_ADAPTER_SCENE_DELEGATE_H
10#include "pxr/imaging/hd/sceneDelegate.h"
11#include "pxr/imaging/hd/sceneIndex.h"
12#include "pxr/usd/sdf/pathTable.h"
14#include <tbb/concurrent_unordered_map.h>
19PXR_NAMESPACE_OPEN_SCOPE
25HdExtComputationPrimvarDescriptorFromSchema(
27 HdExtComputationPrimvarSchema primvar);
32HdPrimvarDescriptorFromSchema(
34 HdPrimvarSchema primvar);
50 HdSceneIndexBaseRefPtr inputSceneIndex,
91 HdVolumeFieldDescriptorVector GetVolumeFieldDescriptors(
92 SdfPath const &volumeId)
override;
94 TfToken const ¶mName)
override;
101 float *sampleTimes,
GfMatrix4d *sampleValues)
override;
103 float startTime,
float endTime,
104 size_t maxSampleCount,
105 float *sampleTimes,
GfMatrix4d *sampleValues)
override;
108 SdfPath const &instancerId)
override;
110 size_t maxSampleCount,
float *sampleTimes,
113 float startTime,
float endTime,
114 size_t maxSampleCount,
float *sampleTimes,
120 HdPrimvarDescriptorVector
122 SdfPath const &
id, HdInterpolation interpolation)
override;
126 VtIntArray *outIndices)
override;
129 size_t maxSampleCount,
float *sampleTimes,
130 VtValue *sampleValues)
override;
132 float startTime,
float endTime,
133 size_t maxSampleCount,
float *sampleTimes,
134 VtValue *sampleValues)
override;
136 size_t maxNumSamples,
float *times,
VtValue *samples,
137 VtIntArray *sampleIndices)
override;
139 float startTime,
float endTime,
140 size_t maxNumSamples,
float *times,
VtValue *samples,
141 VtIntArray *sampleIndices)
override;
147 SdfPath const &instancerId)
override;
170 TfToken const ¶mName)
override;
176 TfToken const ¶mName)
override;
182 HdExtComputationPrimvarDescriptorVector
184 SdfPath const &
id, HdInterpolation interpolationMode)
override;
188 SdfPath const &computationId)
override;
194 size_t maxSampleCount,
196 VtValue *sampleValues)
override;
202 size_t maxSampleCount,
204 VtValue *sampleValues)
override;
207 SdfPath const &computationId)
override;
209 SdfPath const &computationId)
override;
233 using _InputPrimCacheEntry = std::pair<SdfPath, HdSceneIndexPrim>;
236 tbb::concurrent_unordered_map<std::thread::id, _InputPrimCacheEntry,
237 std::hash<std::thread::id> > _inputPrimCache;
244 VtIntArray *outIndices);
247 const HdContainerDataSourceHandle &primvarsDataSource,
249 VtIntArray *outIndices);
256 float startTime,
float endTime,
257 size_t maxNumSamples,
float *times,
VtValue *samples,
258 VtIntArray *sampleIndices);
260 HdSceneIndexBaseRefPtr _inputSceneIndex;
262 struct _PrimCacheEntry
266 using PrimvarDescriptorsArray =
267 std::array<HdPrimvarDescriptorVector, HdInterpolationCount>;
268 std::shared_ptr<PrimvarDescriptorsArray> primvarDescriptors;
269 using ExtCmpPrimvarDescriptorsArray =
270 std::array<HdExtComputationPrimvarDescriptorVector,
271 HdInterpolationCount>;
272 std::shared_ptr<ExtCmpPrimvarDescriptorsArray> extCmpPrimvarDescriptors;
276 _PrimCacheTable _primCache;
278 std::shared_ptr<_PrimCacheEntry::PrimvarDescriptorsArray>
279 _ComputePrimvarDescriptors(
280 const HdContainerDataSourceHandle &primDataSource);
281 std::shared_ptr<_PrimCacheEntry::ExtCmpPrimvarDescriptorsArray>
282 _ComputeExtCmpPrimvarDescriptors(
283 const HdContainerDataSourceHandle &primDataSource);
285 bool _sceneDelegatesBuilt;
286 std::vector<HdSceneDelegate*> _sceneDelegates;
294 std::unordered_set<SdfPath, SdfPath::Hash> _geomSubsetParents;
298 HdDirtyBits _cachedDirtyBits;
302PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Basic type: 3-dimensional floating point range.
Topology data for basisCurves.
Represents a set of data source locators closed under descendancy.
Interface class that defines the execution environment for the client to run a computation.
Topology data for meshes.
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Describes one or more authored display representations for an rprim.
Adapter class providing data exchange with the client scene graph.
Scene delegate which observes notices from an HdSceneIndex and applies them to an HdRenderIndex.
TfToken GetRenderTag(SdfPath const &id) override
Returns the render tag that will be used to bucket prims during render pass bucketing.
void Sync(HdSyncRequestVector *request) override
Synchronizes the delegate state for the given request vector.
size_t SampleInstancerTransform(SdfPath const &instancerId, float startTime, float endTime, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
An overload of SampleInstancerTransform that takes frame-relative startTime and endTime,...
size_t SampleInstancerTransform(SdfPath const &instancerId, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
Store up to maxSampleCount transform samples in *sampleValues.
HdDisplayStyle GetDisplayStyle(SdfPath const &id) override
Returns the display style for the given prim.
TfTokenVector GetExtComputationSceneInputNames(SdfPath const &computationId) override
For the given computation id, returns a list of inputs which will be requested from the scene delegat...
HdExtComputationPrimvarDescriptorVector GetExtComputationPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolationMode) override
Returns a list of primvar names that should be bound to a generated output from an ExtComputation for...
void PrimsRemoved(const HdSceneIndexBase &sender, const RemovedPrimEntries &entries) override
A notification indicating prims have been removed from the scene.
HdRenderBufferDescriptor GetRenderBufferDescriptor(SdfPath const &id) override
Returns the allocation descriptor for a given render buffer prim.
void PrimsRenamed(const HdSceneIndexBase &sender, const RenamedPrimEntries &entries) override
A notification indicating prims (and their descendants) have been renamed or reparented.
size_t SampleExtComputationInput(SdfPath const &computationId, TfToken const &input, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues) override
Return up to maxSampleCount samples for a given computation id and input token.
HdCullStyle GetCullStyle(SdfPath const &id) override
Returns the cullstyle for the given prim.
HdIdVectorSharedPtr GetCoordSysBindings(SdfPath const &id) override
Returns the coordinate system bindings, or a nullptr if none are bound.
size_t SampleIndexedPrimvar(SdfPath const &id, TfToken const &key, size_t maxNumSamples, float *times, VtValue *samples, VtIntArray *sampleIndices) override
SamplePrimvar() for getting an unflattened primvar and its indices.
void PostSyncCleanup() override
Opportunity for the delegate to clean itself up after performing parallel work during sync phase.
bool GetDoubleSided(SdfPath const &id) override
Returns the doubleSided state for the given prim.
HdPrimvarDescriptorVector GetPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolation) override
Returns descriptors for all primvars of the given interpolation type.
SdfPath GetMaterialId(SdfPath const &id) override
Returns the material ID bound to the rprim rprimId.
HdMeshTopology GetMeshTopology(SdfPath const &id) override
Gets the topological mesh data for a given prim.
GfMatrix4d GetInstancerTransform(SdfPath const &instancerId) override
Returns the instancer transform.
HdExtComputationInputDescriptorVector GetExtComputationInputDescriptors(SdfPath const &computationId) override
For the given computation id, returns a list of computation input descriptors.
HdReprSelector GetReprSelector(SdfPath const &id) override
Returns the authored repr (if any) for the given prim.
HdExtComputationOutputDescriptorVector GetExtComputationOutputDescriptors(SdfPath const &computationId) override
For the given computation id, returns a list of computation output descriptors.
std::string GetExtComputationKernel(SdfPath const &computationId) override
Returns the kernel source assigned to the computation at the path id.
std::vector< VtArray< TfToken > > GetInstanceCategories(SdfPath const &instancerId) override
Returns the categories for each of the instances in the instancer.
void InvokeExtComputation(SdfPath const &computationId, HdExtComputationContext *context) override
Requests the scene delegate run the ExtComputation with the given id.
void PrimsAdded(const HdSceneIndexBase &sender, const AddedPrimEntries &entries) override
A notification indicating prims have been added to the scene.
GfMatrix4d GetTransform(SdfPath const &id) override
Returns the object space transform, including all parent transforms.
HdBasisCurvesTopology GetBasisCurvesTopology(SdfPath const &id) override
Gets the topological curve data for a given prim.
SdfPath GetInstancerId(SdfPath const &primId) override
Returns the parent instancer of the given rprim or instancer.
PxOsdSubdivTags GetSubdivTags(SdfPath const &id) override
Gets the subdivision surface tags (sharpness, holes, etc).
SdfPathVector GetInstancerPrototypes(SdfPath const &instancerId) override
Returns a list of prototypes of this instancer.
size_t SampleTransform(SdfPath const &id, float startTime, float endTime, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
An overload of SampleTransform that takes frame-relative startTime and endTime, rather than relying o...
void PrimsDirtied(const HdSceneIndexBase &sender, const DirtiedPrimEntries &entries) override
A notification indicating prim datasources have been invalidated.
VtIntArray GetInstanceIndices(SdfPath const &instancerId, SdfPath const &prototypeId) override
Gets the extracted indices array of the prototype id used in the instancer.
bool GetVisible(SdfPath const &id) override
Returns the authored visible state of the prim.
VtValue GetCameraParamValue(SdfPath const &cameraId, TfToken const ¶mName) override
Returns a single value for a given camera and parameter.
VtValue GetExtComputationInput(SdfPath const &computationId, TfToken const &input) override
Returns a single value for a given computation id and input token.
size_t SampleTransform(SdfPath const &id, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
Store up to maxSampleCount transform samples in *sampleValues.
size_t SamplePrimvar(SdfPath const &id, TfToken const &key, float startTime, float endTime, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues) override
An overload of SamplePrimvar that takes frame-relative startTime and endTime, rather than relying on ...
VtValue Get(SdfPath const &id, TfToken const &key) override
Returns a named value.
VtValue GetIndexedPrimvar(SdfPath const &id, TfToken const &key, VtIntArray *outIndices) override
Returns a named primvar value.
VtArray< TfToken > GetCategories(SdfPath const &id) override
Returns the prim categories.
size_t SamplePrimvar(SdfPath const &id, TfToken const &key, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues) override
Store up to maxSampleCount primvar samples in *samplesValues.
VtValue GetShadingStyle(SdfPath const &id) override
Returns the shading style for the given prim.
size_t SampleIndexedPrimvar(SdfPath const &id, TfToken const &key, float startTime, float endTime, size_t maxNumSamples, float *times, VtValue *samples, VtIntArray *sampleIndices) override
An overload of SampleIndexedPrimvar that takes frame-relative startTime and endTime,...
GfRange3d GetExtent(SdfPath const &id) override
Gets the axis aligned bounds of a prim.
Abstract interface to scene data.
A path value used to locate objects in layers or scenegraphs.
A mapping from SdfPath to MappedType, somewhat similar to map<SdfPath, MappedType> and TfHashMap<SdfP...
Token for efficient comparison, assignment, and hashing of known strings.
Represents an arbitrary dimensional rectangular container class.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Describes how the geometry of a prim should be displayed.
Extends HdPrimvarDescriptor to describe a primvar that takes data from the output of an ExtComputatio...
Describes the allocation structure of a render buffer bprim.
Small struct representing a 'prim' in the Hydra scene index.
The SceneDelegate is requested to synchronize prims as the result of executing a specific render pass...
std::vector< TfToken > TfTokenVector
Convenience types.