7#ifndef PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
8#define PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
12#include "pxr/usdImaging/usdImaging/api.h"
13#include "pxr/usdImaging/usdImaging/instanceablePrimAdapter.h"
15#include "pxr/usd/sdf/path.h"
24PXR_NAMESPACE_OPEN_SCOPE
40 bool ShouldCullChildren()
const override;
43 bool IsInstancerAdapter()
const override;
55 TfToken const& subprim)
override;
58 HdContainerDataSourceHandle GetImagingSubprimData(
68 UsdImagingPropertyInvalidationType invalidationType)
override;
77 HdDirtyBits* timeVaryingBits,
79 instancerContext = NULL)
const override;
85 HdDirtyBits requestedBits,
87 instancerContext = NULL)
const override;
108 void MarkDirty(
UsdPrim const& prim,
114 void MarkRefineLevelDirty(
UsdPrim const& prim,
119 void MarkReprDirty(
UsdPrim const& prim,
124 void MarkCullStyleDirty(
UsdPrim const& prim,
129 void MarkRenderTagDirty(
UsdPrim const& prim,
134 void MarkTransformDirty(
UsdPrim const& prim,
139 void MarkVisibilityDirty(
UsdPrim const& prim,
144 void MarkLightParamsDirty(
150 void MarkCollectionsDirty(
168 size_t maxNumSamples,
175 SdfPath const& cachePath)
const override;
180 SdfPath const& cachePath)
const override;
186 bool ignoreRootTransform =
false)
const override;
192 size_t maxNumSamples,
201 size_t maxNumSamples,
204 VtIntArray *sampleIndices)
override;
212 bool IsChildPath(
const SdfPath& path)
const override;
222 TfToken const& instanceInheritablePurpose)
const override;
264 HdExtComputationInputDescriptorVector
265 GetExtComputationInputs(
UsdPrim const& prim,
271 HdExtComputationOutputDescriptorVector
272 GetExtComputationOutputs(
UsdPrim const& prim,
278 HdExtComputationPrimvarDescriptorVector
279 GetExtComputationPrimvars(
282 HdInterpolation interpolation,
287 GetExtComputationInput(
296 GetExtComputationKernel(
303 GetInstanceIndices(
UsdPrim const& instancerPrim,
304 SdfPath const& instancerCachePath,
305 SdfPath const& prototypeCachePath,
313 VtIntArray *outIndices)
const override;
322 SdfPath const &protoInstancerPath,
333 HdInstancerContext *instancerContext)
const override;
336 SdfPathVector GetScenePrimPaths(
338 std::vector<int>
const& instanceIndices,
339 std::vector<HdInstancerContext> *instancerCtxs)
const override;
342 bool PopulateSelection(
346 int const hydraInstanceIndex,
347 VtIntArray
const &parentInstanceIndices,
348 HdSelectionSharedPtr
const &result)
const override;
355 HdVolumeFieldDescriptorVector
356 GetVolumeFieldDescriptors(
UsdPrim const& usdPrim,
SdfPath const &
id,
380 void _RemovePrim(
SdfPath const& cachePath,
385 struct _InstancerData;
391 void _PopulatePrototype(
int protoIndex,
392 _InstancerData& instrData,
399 void _ProcessPrimRemoval(
SdfPath const& cachePath,
401 SdfPathVector* instancersToReload);
404 void _UnloadInstancer(
SdfPath const& instancerPath,
408 void _UpdateInstancerVisibility(
SdfPath const& instancerPath,
409 _InstancerData
const& instrData,
418 _ProtoPrim
const& _GetProtoPrim(
SdfPath const& instancerPath,
419 SdfPath const& cachePath)
const;
426 bool _GetProtoPrimForChild(
429 _ProtoPrim
const** proto,
433 const UsdPrim _GetProtoUsdPrim(_ProtoPrim
const& proto)
const;
441 SdfPathVector
const& protoPathChain,
448 void _ComputeProtoVisibility(
UsdPrim const& protoRoot,
471 _ProtoPrim() : variabilityBits(0), visible(true) {}
477 UsdImagingPrimAdapterSharedPtr adapter;
485 mutable HdDirtyBits variabilityBits;
489 mutable bool visible;
493 typedef std::unordered_map<SdfPath, _ProtoPrim, SdfPath::Hash> _ProtoPrimMap;
498 struct _InstancerData {
500 SdfPath parentInstancerCachePath;
501 _ProtoPrimMap protoPrimMap;
502 SdfPathVector prototypePaths;
505 PathToIndexMap prototypePathIndices;
512 mutable std::mutex mutex;
513 mutable bool variableVisibility;
514 mutable bool visible;
516 mutable std::atomic_bool initialized = std::atomic_bool(
false);
522 typedef std::unordered_map<
SdfPath ,
524 SdfPath::Hash> _InstancerDataMap;
525 mutable _InstancerDataMap _instancerData;
527 inline static std::atomic_int _globalVariantCounter = std::atomic_int(0);
530PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Basic type: 3-dimensional floating point range.
Represents a set of data source locators closed under descendancy.
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
A path value used to locate objects in layers or scenegraphs.
This is a space efficient container that mimics the TfHashMap API that uses a vector for storage when...
Token for efficient comparison, assignment, and hashing of known strings.
This class is used as a context object with global stage information, that gets passed down to dataso...
This proxy class exposes a subset of the private Delegate API to PrimAdapters.
Delegate support for instanced prims.
An abstract adapter class for prims that are instanceable.
Delegate support for UsdGeomPointInstancer.
USDIMAGING_API 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.
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.
USDIMAGING_API SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
USDIMAGING_API 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.
USDIMAGING_API SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
USDIMAGING_API VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the topology object of a specific Usd prim.
USDIMAGING_API 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...
USDIMAGING_API SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
Called to populate the RenderIndex for this UsdPrim.
USDIMAGING_API HdCullStyle GetCullStyle(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the cullstyle of a specific path in the scene graph.
USDIMAGING_API 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.
USDIMAGING_API bool GetDoubleSided(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
USDIMAGING_API GfMatrix4d GetRelativeInstancerTransform(SdfPath const &instancerPath, SdfPath const &protoInstancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.
USDIMAGING_API GfRange3d GetExtent(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads the extent from the given prim.
USDIMAGING_API PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
USDIMAGING_API 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 ...
USDIMAGING_API 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.
USDIMAGING_API GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
USDIMAGING_API 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.
USDIMAGING_API 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...
USDIMAGING_API void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
USDIMAGING_API TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
Returns the purpose token for prim.
USDIMAGING_API SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for this prim.
USDIMAGING_API 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...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Object used by instancer prim adapters to pass along context about the instancer and instance prim to...
std::vector< TfToken > TfTokenVector
Convenience types.