24 #ifndef PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H 25 #define PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H 31 #include "pxr/usdImaging/usdImaging/version.h" 37 PXR_NAMESPACE_OPEN_SCOPE
57 virtual bool ShouldCullChildren()
const override;
59 virtual bool IsInstancerAdapter()
const override;
71 TfToken const& subprim)
override;
74 HdContainerDataSourceHandle GetImagingSubprimData(
91 HdDirtyBits* timeVaryingBits,
93 instancerContext = NULL)
const override;
98 HdDirtyBits requestedBits,
100 instancerContext = NULL)
const override;
117 virtual void MarkDirty(
UsdPrim const& prim,
122 virtual void MarkRefineLevelDirty(
UsdPrim const& prim,
126 virtual void MarkReprDirty(
UsdPrim const& prim,
130 virtual void MarkCullStyleDirty(
UsdPrim const& prim,
134 virtual void MarkRenderTagDirty(
UsdPrim const& prim,
138 virtual void MarkTransformDirty(
UsdPrim const& prim,
142 virtual void MarkVisibilityDirty(
UsdPrim const& prim,
157 size_t maxNumSamples,
163 SdfPath const& cachePath)
const override;
167 SdfPath const& cachePath)
const override;
172 bool ignoreRootTransform =
false)
const override;
177 size_t maxNumSamples,
185 size_t maxNumSamples,
188 VtIntArray *sampleIndices)
override;
201 TfToken const& instanceInheritablePurpose)
const override;
224 HdExtComputationInputDescriptorVector
225 GetExtComputationInputs(
UsdPrim const& prim,
230 HdExtComputationOutputDescriptorVector
231 GetExtComputationOutputs(
UsdPrim const& prim,
236 HdExtComputationPrimvarDescriptorVector
237 GetExtComputationPrimvars(
240 HdInterpolation interpolation,
244 GetExtComputationInput(
252 GetExtComputationKernel(
258 GetInstanceIndices(
UsdPrim const& instancerPrim,
259 SdfPath const& instancerCachePath,
260 SdfPath const& prototypeCachePath,
267 VtIntArray *outIndices)
const override;
275 SdfPath const &protoInstancerPath,
285 HdInstancerContext *instancerContext)
const override;
287 virtual SdfPathVector GetScenePrimPaths(
289 std::vector<int>
const& instanceIndices,
290 std::vector<HdInstancerContext> *instancerCtxs)
const override;
292 virtual bool PopulateSelection(
296 int const hydraInstanceIndex,
297 VtIntArray
const &parentInstanceIndices,
298 HdSelectionSharedPtr
const &result)
const override;
304 virtual HdVolumeFieldDescriptorVector
305 GetVolumeFieldDescriptors(
UsdPrim const& usdPrim,
SdfPath const &
id,
309 virtual void _RemovePrim(
SdfPath const& cachePath,
314 struct _InstancerData;
320 void _PopulatePrototype(
int protoIndex,
321 _InstancerData& instrData,
328 void _ProcessPrimRemoval(
SdfPath const& cachePath,
330 SdfPathVector* instancersToReload);
333 void _UnloadInstancer(
SdfPath const& instancerPath,
337 void _UpdateInstancerVisibility(
SdfPath const& instancerPath,
338 _InstancerData
const& instrData,
347 _ProtoPrim
const& _GetProtoPrim(
SdfPath const& instancerPath,
348 SdfPath const& cachePath)
const;
355 bool _GetProtoPrimForChild(
358 _ProtoPrim
const** proto,
362 const UsdPrim _GetProtoUsdPrim(_ProtoPrim
const& proto)
const;
370 SdfPathVector
const& protoPathChain,
377 void _ComputeProtoVisibility(
UsdPrim const& protoRoot,
400 _ProtoPrim() : variabilityBits(0), visible(
true) {}
406 UsdImagingPrimAdapterSharedPtr adapter;
414 mutable HdDirtyBits variabilityBits;
418 mutable bool visible;
422 typedef std::unordered_map<SdfPath, _ProtoPrim, SdfPath::Hash> _ProtoPrimMap;
427 struct _InstancerData {
429 SdfPath parentInstancerCachePath;
430 _ProtoPrimMap protoPrimMap;
431 SdfPathVector prototypePaths;
434 PathToIndexMap prototypePathIndices;
441 mutable std::mutex mutex;
442 mutable bool variableVisibility;
443 mutable bool visible;
450 typedef std::unordered_map<
SdfPath ,
452 SdfPath::Hash> _InstancerDataMap;
453 _InstancerDataMap _instancerData;
458 PXR_NAMESPACE_CLOSE_SCOPE
460 #endif // PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
Basic type: 3-dimensional floating point range.
GfMatrix4d GetTransform(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, bool ignoreRootTransform=false) const override
Fetches the transform for the given prim at the given time from a pre-computed cache of prim transfor...
size_t SampleInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, GfMatrix4d *sampleValues) override
Sample the instancer transform for the given prim.
size_t SampleTransform(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, GfMatrix4d *sampleValues) override
Samples the transform for the given prim.
Delegate support for UsdGeomPointInstancer.
VtValue Get(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, VtIntArray *outIndices) const override
Gets the value of the parameter named key for the given prim (which has the given cache path) and giv...
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
This proxy class exposes a subset of the private Delegate API to PrimAdapters.
virtual void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
bool GetDoubleSided(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
Token for efficient comparison, assignment, and hashing of known strings.
virtual GfMatrix4d GetRelativeInstancerTransform(SdfPath const &instancerPath, SdfPath const &protoInstancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.
virtual SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
virtual void TrackVariability(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits *timeVaryingBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
For the given prim, variability is detected and stored in timeVaryingBits.
Stores a 4x4 matrix of double elements.
virtual SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
Called to populate the RenderIndex for this UsdPrim.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
This class is used as a context object with global stage information, that gets passed down to dataso...
Base class for all PrimAdapters.
Represents a set of data source locators closed under descendancy.
bool GetVisible(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Returns true if the given prim is visible, taking into account inherited visibility values.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
std::vector< TfToken > TfTokenVector
Convenience types.
A path value used to locate objects in layers or scenegraphs.
GfRange3d GetExtent(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads the extent from the given prim.
size_t SamplePrimvar(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, VtValue *sampleValues, VtIntArray *sampleIndices) override
Sample the primvar for the given prim.
PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for this prim.
Object used by instancer prim adapters to pass along context about the instancer and instance prim to...
VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the topology object of a specific Usd prim.
virtual void ProcessPrimResync(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
When a PrimResync event occurs, the prim may have been deleted entirely, adapter plug-ins should over...
SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
virtual HdDirtyBits ProcessPropertyChange(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &propertyName) override
Returns a bit mask of attributes to be updated, or HdChangeTracker::AllDirty if the entire prim must ...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
virtual void UpdateForTime(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, HdDirtyBits requestedBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
Populates the cache for the given prim, time and requestedBits.
HdCullStyle GetCullStyle(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the cullstyle of a specific path in the scene graph.
TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
Returns the purpose token for prim.