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;
67 HdDirtyBits* timeVaryingBits,
69 instancerContext = NULL)
const override;
74 HdDirtyBits requestedBits,
76 instancerContext = NULL)
const override;
93 virtual void MarkDirty(
UsdPrim const& prim,
98 virtual void MarkRefineLevelDirty(
UsdPrim const& prim,
102 virtual void MarkReprDirty(
UsdPrim const& prim,
106 virtual void MarkCullStyleDirty(
UsdPrim const& prim,
110 virtual void MarkRenderTagDirty(
UsdPrim const& prim,
114 virtual void MarkTransformDirty(
UsdPrim const& prim,
118 virtual void MarkVisibilityDirty(
UsdPrim const& prim,
133 size_t maxNumSamples,
139 SdfPath const& cachePath)
const override;
143 SdfPath const& cachePath)
const override;
148 bool ignoreRootTransform =
false)
const override;
153 size_t maxNumSamples,
161 size_t maxNumSamples,
164 VtIntArray *sampleIndices)
override;
177 TfToken const& instanceInheritablePurpose)
const override;
200 HdExtComputationInputDescriptorVector
201 GetExtComputationInputs(
UsdPrim const& prim,
206 HdExtComputationOutputDescriptorVector
207 GetExtComputationOutputs(
UsdPrim const& prim,
212 HdExtComputationPrimvarDescriptorVector
213 GetExtComputationPrimvars(
216 HdInterpolation interpolation,
220 GetExtComputationInput(
228 GetExtComputationKernel(
234 GetInstanceIndices(
UsdPrim const& instancerPrim,
235 SdfPath const& instancerCachePath,
236 SdfPath const& prototypeCachePath,
243 VtIntArray *outIndices)
const override;
251 SdfPath const &protoInstancerPath,
258 virtual SdfPath GetScenePrimPath(
261 HdInstancerContext *instancerContext)
const override;
263 virtual bool PopulateSelection(
267 int const hydraInstanceIndex,
268 VtIntArray
const &parentInstanceIndices,
269 HdSelectionSharedPtr
const &result)
const override;
275 virtual HdVolumeFieldDescriptorVector
276 GetVolumeFieldDescriptors(
UsdPrim const& usdPrim,
SdfPath const &
id,
280 virtual void _RemovePrim(
SdfPath const& cachePath,
285 struct _InstancerData;
291 void _PopulatePrototype(
int protoIndex,
292 _InstancerData& instrData,
299 void _ProcessPrimRemoval(
SdfPath const& cachePath,
301 SdfPathVector* instancersToReload);
304 void _UnloadInstancer(
SdfPath const& instancerPath,
308 void _UpdateInstancerVisibility(
SdfPath const& instancerPath,
309 _InstancerData
const& instrData,
318 _ProtoPrim
const& _GetProtoPrim(
SdfPath const& instancerPath,
319 SdfPath const& cachePath)
const;
326 bool _GetProtoPrimForChild(
329 _ProtoPrim
const** proto,
333 const UsdPrim _GetProtoUsdPrim(_ProtoPrim
const& proto)
const;
341 SdfPathVector
const& protoPathChain,
348 void _ComputeProtoVisibility(
UsdPrim const& protoRoot,
371 _ProtoPrim() : variabilityBits(0), visible(
true) {}
377 UsdImagingPrimAdapterSharedPtr adapter;
385 mutable HdDirtyBits variabilityBits;
389 mutable bool visible;
393 typedef std::unordered_map<SdfPath, _ProtoPrim, SdfPath::Hash> _ProtoPrimMap;
398 struct _InstancerData {
400 SdfPath parentInstancerCachePath;
401 _ProtoPrimMap protoPrimMap;
402 SdfPathVector prototypePaths;
405 PathToIndexMap prototypePathIndices;
412 mutable std::mutex mutex;
413 mutable bool variableVisibility;
414 mutable bool visible;
421 typedef std::unordered_map<
SdfPath ,
423 SdfPath::Hash> _InstancerDataMap;
424 _InstancerDataMap _instancerData;
429 PXR_NAMESPACE_CLOSE_SCOPE
431 #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 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...
Base class for all PrimAdapters.
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 ...
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.