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"
37PXR_NAMESPACE_OPEN_SCOPE
57 virtual bool ShouldCullChildren()
const override;
59 virtual bool IsInstancerAdapter()
const override;
71 TfToken const& subprim)
override;
74 HdContainerDataSourceHandle GetImagingSubprimData(
84 UsdImagingPropertyInvalidationType invalidationType)
override;
92 HdDirtyBits* timeVaryingBits,
94 instancerContext = NULL)
const override;
99 HdDirtyBits requestedBits,
101 instancerContext = NULL)
const override;
118 virtual void MarkDirty(
UsdPrim const& prim,
123 virtual void MarkRefineLevelDirty(
UsdPrim const& prim,
127 virtual void MarkReprDirty(
UsdPrim const& prim,
131 virtual void MarkCullStyleDirty(
UsdPrim const& prim,
135 virtual void MarkRenderTagDirty(
UsdPrim const& prim,
139 virtual void MarkTransformDirty(
UsdPrim const& prim,
143 virtual void MarkVisibilityDirty(
UsdPrim const& prim,
147 virtual void MarkLightParamsDirty(
152 virtual void MarkCollectionsDirty(
168 size_t maxNumSamples,
174 SdfPath const& cachePath)
const override;
178 SdfPath const& cachePath)
const override;
183 bool ignoreRootTransform =
false)
const override;
188 size_t maxNumSamples,
196 size_t maxNumSamples,
199 VtIntArray *sampleIndices)
override;
212 TfToken const& instanceInheritablePurpose)
const override;
246 HdExtComputationInputDescriptorVector
247 GetExtComputationInputs(
UsdPrim const& prim,
252 HdExtComputationOutputDescriptorVector
253 GetExtComputationOutputs(
UsdPrim const& prim,
258 HdExtComputationPrimvarDescriptorVector
259 GetExtComputationPrimvars(
262 HdInterpolation interpolation,
266 GetExtComputationInput(
274 GetExtComputationKernel(
280 GetInstanceIndices(
UsdPrim const& instancerPrim,
281 SdfPath const& instancerCachePath,
282 SdfPath const& prototypeCachePath,
289 VtIntArray *outIndices)
const override;
297 SdfPath const &protoInstancerPath,
307 HdInstancerContext *instancerContext)
const override;
309 virtual SdfPathVector GetScenePrimPaths(
311 std::vector<int>
const& instanceIndices,
312 std::vector<HdInstancerContext> *instancerCtxs)
const override;
314 virtual bool PopulateSelection(
318 int const hydraInstanceIndex,
319 VtIntArray
const &parentInstanceIndices,
320 HdSelectionSharedPtr
const &result)
const override;
326 virtual HdVolumeFieldDescriptorVector
327 GetVolumeFieldDescriptors(
UsdPrim const& usdPrim,
SdfPath const &
id,
331 virtual void _RemovePrim(
SdfPath const& cachePath,
336 struct _InstancerData;
342 void _PopulatePrototype(
int protoIndex,
343 _InstancerData& instrData,
350 void _ProcessPrimRemoval(
SdfPath const& cachePath,
352 SdfPathVector* instancersToReload);
355 void _UnloadInstancer(
SdfPath const& instancerPath,
359 void _UpdateInstancerVisibility(
SdfPath const& instancerPath,
360 _InstancerData
const& instrData,
369 _ProtoPrim
const& _GetProtoPrim(
SdfPath const& instancerPath,
370 SdfPath const& cachePath)
const;
377 bool _GetProtoPrimForChild(
380 _ProtoPrim
const** proto,
384 const UsdPrim _GetProtoUsdPrim(_ProtoPrim
const& proto)
const;
392 SdfPathVector
const& protoPathChain,
399 void _ComputeProtoVisibility(
UsdPrim const& protoRoot,
422 _ProtoPrim() : variabilityBits(0), visible(true) {}
428 UsdImagingPrimAdapterSharedPtr adapter;
436 mutable HdDirtyBits variabilityBits;
440 mutable bool visible;
444 typedef std::unordered_map<SdfPath, _ProtoPrim, SdfPath::Hash> _ProtoPrimMap;
449 struct _InstancerData {
451 SdfPath parentInstancerCachePath;
452 _ProtoPrimMap protoPrimMap;
453 SdfPathVector prototypePaths;
456 PathToIndexMap prototypePathIndices;
463 mutable std::mutex mutex;
464 mutable bool variableVisibility;
465 mutable bool visible;
472 typedef std::unordered_map<
SdfPath ,
474 SdfPath::Hash> _InstancerDataMap;
475 _InstancerDataMap _instancerData;
480PXR_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 UsdGeomPointInstancer.
bool GetDoubleSided(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
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.
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.
HdCullStyle GetCullStyle(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the cullstyle of a specific path in the scene graph.
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.
SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for 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 ...
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...
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.
TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
Returns the purpose token for prim.
virtual GfMatrix4d GetRelativeInstancerTransform(SdfPath const &instancerPath, SdfPath const &protoInstancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.
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.
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...
VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the topology object of a specific Usd prim.
virtual void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
virtual SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
Called to populate the RenderIndex for this UsdPrim.
GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
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.
virtual SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
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...
SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
Base class for all PrimAdapters.
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.