24 #ifndef PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
25 #define PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
30 #include "pxr/usdImaging/usdImaging/version.h"
31 #include "pxr/usdImaging/usdImaging/primAdapter.h"
32 #include "pxr/usdImaging/usdImaging/gprimAdapter.h"
36 PXR_NAMESPACE_OPEN_SCOPE
56 virtual bool ShouldCullChildren()
const override;
58 virtual bool IsInstancerAdapter()
const override;
66 HdDirtyBits* timeVaryingBits,
68 instancerContext = NULL)
const override;
73 HdDirtyBits requestedBits,
75 instancerContext = NULL)
const override;
92 virtual void MarkDirty(
UsdPrim const& prim,
97 virtual void MarkRefineLevelDirty(
UsdPrim const& prim,
101 virtual void MarkReprDirty(
UsdPrim const& prim,
105 virtual void MarkCullStyleDirty(
UsdPrim const& prim,
109 virtual void MarkRenderTagDirty(
UsdPrim const& prim,
113 virtual void MarkTransformDirty(
UsdPrim const& prim,
117 virtual void MarkVisibilityDirty(
UsdPrim const& prim,
132 size_t maxNumSamples,
139 bool ignoreRootTransform =
false)
const override;
144 size_t maxNumSamples,
152 size_t maxNumSamples,
154 VtValue *sampleValues)
override;
167 TfToken const& instanceInheritablePurpose)
const override;
190 HdExtComputationInputDescriptorVector
191 GetExtComputationInputs(
UsdPrim const& prim,
196 HdExtComputationOutputDescriptorVector
197 GetExtComputationOutputs(
UsdPrim const& prim,
202 HdExtComputationPrimvarDescriptorVector
203 GetExtComputationPrimvars(
206 HdInterpolation interpolation,
210 GetExtComputationInput(
218 GetExtComputationKernel(
235 SdfPath const &protoInstancerPath,
242 virtual SdfPath GetScenePrimPath(
245 HdInstancerContext *instancerContext)
const override;
247 virtual bool PopulateSelection(
251 int const hydraInstanceIndex,
252 VtIntArray
const &parentInstanceIndices,
253 HdSelectionSharedPtr
const &result)
const override;
259 virtual HdVolumeFieldDescriptorVector
260 GetVolumeFieldDescriptors(
UsdPrim const& usdPrim,
SdfPath const &
id,
264 virtual void _RemovePrim(
SdfPath const& cachePath,
269 struct _InstancerData;
275 void _PopulatePrototype(
int protoIndex,
276 _InstancerData& instrData,
283 void _ProcessPrimRemoval(
SdfPath const& cachePath,
285 SdfPathVector* instancersToReload);
288 void _UnloadInstancer(
SdfPath const& instancerPath,
292 typedef std::unordered_map<SdfPath, VtIntArray, SdfPath::Hash> _InstanceMap;
293 _InstanceMap _ComputeInstanceMap(
SdfPath const& instancerPath,
294 _InstancerData
const& instrData,
298 void _UpdateInstancerVisibility(
SdfPath const& instancerPath,
299 _InstancerData
const& instrData,
308 _ProtoPrim
const& _GetProtoPrim(
SdfPath const& instancerPath,
309 SdfPath const& cachePath)
const;
316 bool _GetProtoPrimForChild(
319 _ProtoPrim
const** proto,
323 const UsdPrim _GetProtoUsdPrim(_ProtoPrim
const& proto)
const;
331 SdfPathVector
const& protoPathChain,
338 void _ComputeProtoVisibility(
UsdPrim const& protoRoot,
361 _ProtoPrim() : variabilityBits(0), visible(
true) {}
367 UsdImagingPrimAdapterSharedPtr adapter;
375 mutable HdDirtyBits variabilityBits;
379 mutable bool visible;
383 typedef std::unordered_map<SdfPath, _ProtoPrim, SdfPath::Hash> _ProtoPrimMap;
388 struct _InstancerData {
390 SdfPath parentInstancerCachePath;
391 _ProtoPrimMap protoPrimMap;
392 SdfPathVector prototypePaths;
398 mutable std::mutex mutex;
399 mutable bool variableVisibility;
400 mutable bool visible;
407 typedef std::unordered_map<
SdfPath ,
409 SdfPath::Hash> _InstancerDataMap;
410 _InstancerDataMap _instancerData;
415 PXR_NAMESPACE_CLOSE_SCOPE
417 #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.
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.
PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
VtValue Get(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time) const override
Gets the value of the parameter named key for the given prim (which has the given cache path) and giv...
GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
size_t SamplePrimvar(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, VtValue *sampleValues) override
Sample the primvar for the given 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...
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.