instanceAdapter.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
25 #define PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
26 
28 
29 #include "pxr/pxr.h"
31 
32 #include "pxr/base/tf/hashmap.h"
33 
34 #include <mutex>
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 
92 {
93 public:
95 
97  virtual ~UsdImagingInstanceAdapter();
98 
99  virtual SdfPath Populate(
100  UsdPrim const& prim,
101  UsdImagingIndexProxy* index,
102  UsdImagingInstancerContext const* instancerContext = nullptr) override;
103 
104  virtual bool ShouldCullChildren() const override;
105 
106  virtual bool IsInstancerAdapter() const override;
107 
108  // ---------------------------------------------------------------------- //
110  // ---------------------------------------------------------------------- //
111 
112  virtual void TrackVariability(UsdPrim const& prim,
113  SdfPath const& cachePath,
114  HdDirtyBits* timeVaryingBits,
116  instancerContext = NULL) const override;
117 
118  virtual void UpdateForTime(UsdPrim const& prim,
119  SdfPath const& cachePath,
120  UsdTimeCode time,
121  HdDirtyBits requestedBits,
123  instancerContext = NULL) const override;
124 
125  // ---------------------------------------------------------------------- //
127  // ---------------------------------------------------------------------- //
128 
129  virtual HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
130  SdfPath const& cachePath,
131  TfToken const& propertyName)
132  override;
133 
134  virtual void ProcessPrimResync(SdfPath const& cachePath,
135  UsdImagingIndexProxy* index) override;
136 
137  virtual void ProcessPrimRemoval(SdfPath const& cachePath,
138  UsdImagingIndexProxy* index) override;
139 
140 
141  virtual void MarkDirty(UsdPrim const& prim,
142  SdfPath const& cachePath,
143  HdDirtyBits dirty,
144  UsdImagingIndexProxy* index) override;
145 
146  // As this adapter hijacks the adapter for the child prim
147  // We need to forward these messages on, in case the child
148  // adapter needs them
149  virtual void MarkRefineLevelDirty(UsdPrim const& prim,
150  SdfPath const& cachePath,
151  UsdImagingIndexProxy* index) override;
152 
153  virtual void MarkReprDirty(UsdPrim const& prim,
154  SdfPath const& cachePath,
155  UsdImagingIndexProxy* index) override;
156 
157  virtual void MarkCullStyleDirty(UsdPrim const& prim,
158  SdfPath const& cachePath,
159  UsdImagingIndexProxy* index) override;
160 
161  virtual void MarkRenderTagDirty(UsdPrim const& prim,
162  SdfPath const& cachePath,
163  UsdImagingIndexProxy* index) override;
164 
165  virtual void MarkTransformDirty(UsdPrim const& prim,
166  SdfPath const& cachePath,
167  UsdImagingIndexProxy* index) override;
168 
169  virtual void MarkVisibilityDirty(UsdPrim const& prim,
170  SdfPath const& cachePath,
171  UsdImagingIndexProxy* index) override;
172 
173  // ---------------------------------------------------------------------- //
175  // ---------------------------------------------------------------------- //
176 
177  std::vector<VtArray<TfToken>> GetInstanceCategories(
178  UsdPrim const& prim) override;
179 
180  GfMatrix4d GetInstancerTransform(UsdPrim const& instancerPrim,
181  SdfPath const& instancerPath,
182  UsdTimeCode time) const override;
183 
185  UsdPrim const& usdPrim,
186  SdfPath const& cachePath) const override;
187 
188  SdfPathVector GetInstancerPrototypes(
189  UsdPrim const& usdPrim,
190  SdfPath const& cachePath) const override;
191 
192  size_t SampleInstancerTransform(UsdPrim const& instancerPrim,
193  SdfPath const& instancerPath,
194  UsdTimeCode time,
195  size_t maxSampleCount,
196  float *sampleTimes,
197  GfMatrix4d *sampleValues) override;
198 
199  size_t SampleTransform(UsdPrim const& prim,
200  SdfPath const& cachePath,
201  UsdTimeCode time,
202  size_t maxNumSamples,
203  float *sampleTimes,
204  GfMatrix4d *sampleValues) override;
205 
206  size_t SamplePrimvar(UsdPrim const& usdPrim,
207  SdfPath const& cachePath,
208  TfToken const& key,
209  UsdTimeCode time,
210  size_t maxNumSamples,
211  float *sampleTimes,
212  VtValue *sampleValues,
213  VtIntArray *sampleIndices) override;
214 
216  UsdPrim const& usdPrim,
217  SdfPath const& cachePath,
218  TfToken const& instanceInheritablePurpose) const override;
219 
220  PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
221  SdfPath const& cachePath,
222  UsdTimeCode time) const override;
223 
224  VtValue GetTopology(UsdPrim const& prim,
225  SdfPath const& cachePath,
226  UsdTimeCode time) const override;
227 
228  HdCullStyle GetCullStyle(UsdPrim const& prim,
229  SdfPath const& cachePath,
230  UsdTimeCode time) const override;
231 
232  GfRange3d GetExtent(UsdPrim const& usdPrim,
233  SdfPath const& cachePath,
234  UsdTimeCode time) const override;
235 
236  bool GetVisible(UsdPrim const& usdPrim,
237  SdfPath const& cachePath,
238  UsdTimeCode time) const override;
239 
240  bool GetDoubleSided(UsdPrim const& prim,
241  SdfPath const& cachePath,
242  UsdTimeCode time) const override;
243 
244  GfMatrix4d GetTransform(UsdPrim const& prim,
245  SdfPath const& cachePath,
246  UsdTimeCode time,
247  bool ignoreRootTransform = false) const override;
248 
249  SdfPath GetMaterialId(UsdPrim const& prim,
250  SdfPath const& cachePath,
251  UsdTimeCode time) const override;
252 
253  HdExtComputationInputDescriptorVector
254  GetExtComputationInputs(UsdPrim const& prim,
255  SdfPath const& cachePath,
256  const UsdImagingInstancerContext* instancerContext)
257  const override;
258 
259 
260  HdExtComputationOutputDescriptorVector
261  GetExtComputationOutputs(UsdPrim const& prim,
262  SdfPath const& cachePath,
263  const UsdImagingInstancerContext* instancerContext)
264  const override;
265 
266  HdExtComputationPrimvarDescriptorVector
267  GetExtComputationPrimvars(
268  UsdPrim const& prim,
269  SdfPath const& cachePath,
270  HdInterpolation interpolation,
271  const UsdImagingInstancerContext* instancerContext) const override;
272 
273  VtValue
274  GetExtComputationInput(
275  UsdPrim const& prim,
276  SdfPath const& cachePath,
277  TfToken const& name,
278  UsdTimeCode time,
279  const UsdImagingInstancerContext* instancerContext) const override;
280 
281  std::string
282  GetExtComputationKernel(
283  UsdPrim const& prim,
284  SdfPath const& cachePath,
285  const UsdImagingInstancerContext* instancerContext) const override;
286 
287  VtValue
288  GetInstanceIndices(UsdPrim const& instancerPrim,
289  SdfPath const& instancerCachePath,
290  SdfPath const& prototypeCachePath,
291  UsdTimeCode time) const override;
292 
293  VtValue Get(UsdPrim const& prim,
294  SdfPath const& cachePath,
295  TfToken const& key,
296  UsdTimeCode time,
297  VtIntArray *outIndices) const override;
298 
299  // ---------------------------------------------------------------------- //
301  // ---------------------------------------------------------------------- //
302 
304  SdfPath const &parentInstancerPath,
305  SdfPath const &instancerPath,
306  UsdTimeCode time) const override;
307 
308  // ---------------------------------------------------------------------- //
310  // ---------------------------------------------------------------------- //
311 
312  virtual SdfPath GetScenePrimPath(
313  SdfPath const& cachePath,
314  int instanceIndex,
315  HdInstancerContext *instancerContext) const override;
316 
317  virtual bool PopulateSelection(
318  HdSelection::HighlightMode const& highlightMode,
319  SdfPath const &cachePath,
320  UsdPrim const &usdPrim,
321  int const hydraInstanceIndex,
322  VtIntArray const &parentInstanceIndices,
323  HdSelectionSharedPtr const &result) const override;
324 
325  // ---------------------------------------------------------------------- //
327  // ---------------------------------------------------------------------- //
328 
329  virtual HdVolumeFieldDescriptorVector
330  GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
331  UsdTimeCode time) const override;
332 
333 protected:
334  virtual void _RemovePrim(SdfPath const& cachePath,
335  UsdImagingIndexProxy* index) override final;
336 
337 private:
338 
339  SdfPath _Populate(UsdPrim const& prim,
340  UsdImagingIndexProxy* index,
341  UsdImagingInstancerContext const* instancerContext,
342  SdfPath const& parentProxyPath);
343 
344  struct _ProtoPrim;
345  struct _ProtoGroup;
346  struct _InstancerData;
347 
348  bool _IsChildPrim(UsdPrim const& prim,
349  SdfPath const& cachePath) const;
350 
351  // Returns true if the given prim serves as an instancer.
352  bool _PrimIsInstancer(UsdPrim const& prim) const;
353 
354  // Inserts prototype prims for the given \p usdPrim into the \p index.
355  // Any inserted gprims will be inserted under a special path combining
356  // \p instancerPath and \p protoName.
357  SdfPath
358  _InsertProtoPrim(UsdPrimRange::iterator *iter,
359  const TfToken& protoName,
360  SdfPath materialId,
361  TfToken drawMode,
362  TfToken inheritablePurpose,
363  SdfPath instancerPath,
364  UsdImagingPrimAdapterSharedPtr const& primAdapter,
365  UsdImagingPrimAdapterSharedPtr const& instancerAdapter,
366  UsdImagingIndexProxy* index,
367  bool *isLeafInstancer);
368 
369  // For a usd path, collects the instancers to resync.
370  void _ResyncPath(SdfPath const& cachePath,
371  UsdImagingIndexProxy* index,
372  bool reload);
373  // Removes and optionally reloads all instancer data, both locally and
374  // from the render index.
375  void _ResyncInstancer(SdfPath const& instancerPath,
376  UsdImagingIndexProxy* index, bool reload);
377 
378  // Computes per-frame data in the instancer map. This is primarily used
379  // during update to send new instance indices out to Hydra.
380  struct _ComputeInstanceMapFn;
381  VtIntArray _ComputeInstanceMap(UsdPrim const& instancerPrim,
382  _InstancerData const& instrData,
383  UsdTimeCode time) const;
384 
385  // Precomputes the instancer visibility data (as visible, invis, varying
386  // per-node), and returns whether the instance map is variable.
387  // Note: this function assumes the instancer data is already locked by
388  // the caller...
389  struct _ComputeInstanceMapVariabilityFn;
390  bool _ComputeInstanceMapVariability(UsdPrim const& instancerPrim,
391  _InstancerData const& instrData) const;
392 
393  // Gets the associated _ProtoPrim and instancer context for the given
394  // instancer and cache path.
395  _ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
396  SdfPath const& cachePath,
397  UsdImagingInstancerContext* ctx) const;
398 
399  // Gets the associated _ProtoPrim and instancerContext if cachePath is a
400  // child path and returns \c true, otherwise returns \c false.
401  bool _GetProtoPrimForChild(
402  UsdPrim const& usdPrim,
403  SdfPath const& cachePath,
404  _ProtoPrim const** proto,
405  UsdImagingInstancerContext* ctx) const;
406 
407  // Computes the transforms for all instances corresponding to the given
408  // instancer.
409  struct _ComputeInstanceTransformFn;
410  bool _ComputeInstanceTransforms(UsdPrim const& instancer,
411  VtMatrix4dArray* transforms,
412  UsdTimeCode time) const;
413 
414  // Gathers the authored transforms time samples given an instancer.
415  struct _GatherInstanceTransformTimeSamplesFn;
416  bool _GatherInstanceTransformsTimeSamples(UsdPrim const& instancer,
417  GfInterval interval,
418  std::vector<double>* outTimes)
419  const;
420 
421  // Gathers the specified primvar time samples given an instancer.
422  struct _GatherInstancePrimvarTimeSamplesFn;
423  bool _GatherInstancePrimvarTimeSamples(UsdPrim const& instancer,
424  TfToken const& key,
425  GfInterval interval,
426  std::vector<double>* outTimes)
427  const;
428 
429  // Returns true if any of the instances corresponding to the given
430  // instancer has a varying transform.
431  struct _IsInstanceTransformVaryingFn;
432  bool _IsInstanceTransformVarying(UsdPrim const& instancer) const;
433 
434  // Computes the value of a primvar for all instances corresponding to the
435  // given instancer. The templated version runs the templated functor,
436  // and the un-templated version does type dispatch.
437  template<typename T> struct _ComputeInheritedPrimvarFn;
438 
439  template<typename T>
440  bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
441  TfToken const& primvarName,
442  VtValue *result,
443  UsdTimeCode time) const;
444 
445  bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
446  TfToken const& primvarName,
447  SdfValueTypeName const& type,
448  VtValue *result,
449  UsdTimeCode time) const;
450 
451  // Returns true if any of the instances corresponding to the given
452  // instancer has varying inherited primvars.
453  struct _IsInstanceInheritedPrimvarVaryingFn;
454  bool _IsInstanceInheritedPrimvarVarying(UsdPrim const& instancer) const;
455 
456  struct _PopulateInstanceSelectionFn;
457  struct _GetScenePrimPathFn;
458 
459  // Helper functions for dealing with "actual" instances to be drawn.
460  //
461  // Suppose we have:
462  // /Root
463  // Instance_A (prototype: /__Prototype_1)
464  // Instance_B (prototype: /__Prototype_1)
465  // /__Prototype_1
466  // AnotherInstance_A (prototype: /__Prototype_2)
467  // /__Prototype_2
468  //
469  // /__Prototype_2 has only one associated instance in the Usd scenegraph:
470  // /__Prototype_1/AnotherInstance_A. However, imaging actually needs to draw
471  // two instances of /__Prototype_2, because AnotherInstance_A is a nested
472  // instance beneath /__Prototype_1, and there are two instances of
473  // /__Prototype_1.
474  //
475  // Each instance to be drawn is addressed by the chain of instances
476  // that caused it to be drawn. In the above example, the two instances
477  // of /__Prototype_2 to be drawn are:
478  //
479  // [ /Root/Instance_A, /__Prototype_1/AnotherInstance_A ],
480  // [ /Root/Instance_B, /__Prototype_1/AnotherInstance_A ]
481  //
482  // This "instance context" describes the chain of opinions that
483  // ultimately affect the final drawn instance. For example, the
484  // transform of each instance to draw is the combined transforms
485  // of the prims in each context.
486  template <typename Functor>
487  void _RunForAllInstancesToDraw(UsdPrim const& instancer, Functor* fn) const;
488  template <typename Functor>
489  bool _RunForAllInstancesToDrawImpl(UsdPrim const& instancer,
490  std::vector<UsdPrim>* instanceContext,
491  size_t* instanceIdx,
492  Functor* fn) const;
493 
494  typedef TfHashMap<SdfPath, size_t, SdfPath::Hash> _InstancerDrawCounts;
495  size_t _CountAllInstancesToDraw(UsdPrim const& instancer) const;
496  size_t _CountAllInstancesToDrawImpl(UsdPrim const& instancer,
497  _InstancerDrawCounts* drawCounts) const;
498 
499  // A proto prim represents a single adapter under a prototype root declared
500  // on the instancer.
501  struct _ProtoPrim {
502  _ProtoPrim() {}
503  // Each prim will become a prototype "child" under the instancer. This
504  // path is the path to the prim on the Usd Stage (the path to a single
505  // mesh, for example).
506  SdfPath path;
507  // The prim adapter for the actual prototype prim.
508  UsdImagingPrimAdapterSharedPtr adapter;
509  };
510 
511  // Indexed by prototype cachePath (each prim has one entry)
512  typedef TfHashMap<SdfPath, _ProtoPrim, SdfPath::Hash> _PrimMap;
513 
514  // All data associated with a given instancer prim. PrimMap could
515  // technically be split out to avoid two lookups, however it seems cleaner
516  // to keep everything bundled up under the instancer path.
517  struct _InstancerData {
518  _InstancerData() : numInstancesToDraw(0), refreshVariability(false) { }
519 
520  // The prototype prim path associated with this instancer.
521  SdfPath prototypePath;
522 
523  // The USD material path associated with this instancer.
524  SdfPath materialUsdPath;
525 
526  // The drawmode associated with this instancer.
527  TfToken drawMode;
528 
529  // The purpose value associated with this instance that can be inherited
530  // by proto prims that need to inherit ancestor purpose.
531  TfToken inheritablePurpose;
532 
533  // Inherited primvar
534  struct PrimvarInfo {
535  TfToken name;
536  SdfValueTypeName type;
537  bool operator==(const PrimvarInfo& rhs) const;
538  bool operator<(const PrimvarInfo& rhs) const;
539  };
540  std::vector<PrimvarInfo> inheritedPrimvars;
541 
542  // Paths to Usd instance prims. Note that this is not necessarily
543  // equivalent to all the instances that will be drawn. See below.
544  std::vector<SdfPath> instancePaths;
545 
546  // Number of actual instances of this instancer that will be
547  // drawn. See comment on _RunForAllInstancesToDraw.
548  // XXX: This is mutable so that we can precache it in TrackVariability;
549  // it's inappropriate to track it in _Populate since not all instances
550  // will have been populated.
551  mutable size_t numInstancesToDraw;
552 
553  // Cached visibility. This vector contains an entry for each instance
554  // that will be drawn (i.e., visibility.size() == numInstancesToDraw).
555  enum Visibility {
556  Invisible, //< Invisible over all time
557  Visible, //< Visible over all time
558  Varying, //< Visibility varies over time
559  Unknown //< Visibility has not yet been checked
560  };
561  // XXX: This is mutable so that we can precache visibility per-instance
562  // in TrackVariability(). Can we replace this with some kind of usage
563  // of an inherited cache?
564  mutable std::vector<Visibility> visibility;
565 
566  // Map of all rprims for this instancer prim.
567  _PrimMap primMap;
568 
569  // This is a set of reference paths, where this instancer needs
570  // to deferer to another instancer. While refered to here as a child
571  // instancer, the actual relationship is more like a directed graph.
572  SdfPathSet childPointInstancers;
573 
574  // Nested (child) native instances.
575  SdfPathVector nestedInstances;
576 
577  // Parent native instances.
578  SdfPathVector parentInstances;
579 
580  // Flag indicating we've queued up the delegate to call TrackVariability
581  // on this instancer. We record this so we don't do it multiple times.
582  mutable bool refreshVariability;
583  };
584 
585  // Map from hydra instancer cache path to the various instancer state we
586  // need to answer adapter queries.
587  // Note: this map is modified in multithreaded code paths and must be
588  // locked.
589  typedef std::unordered_map<SdfPath, _InstancerData, SdfPath::Hash>
590  _InstancerDataMap;
591  _InstancerDataMap _instancerData;
592 
593  // Map from USD instance prim paths to the cache path of the hydra instancer
594  // they are assigned to (which will typically be the path to the first
595  // instance of this instance group we run across).
596  // XXX: consider to move this forwarding map into HdRenderIndex.
597  typedef TfHashMap<SdfPath, SdfPath, SdfPath::Hash>
598  _InstanceToInstancerMap;
599  _InstanceToInstancerMap _instanceToInstancerMap;
600 
601  // Hd and UsdImaging think of instancing in terms of an 'instancer' that
602  // specifies a list of 'prototype' prims that are shared per instance.
603  //
604  // For Usd scenegraph instancing, a prototype prim and its descendents
605  // roughly correspond to the instancer and prototype prims. However,
606  // Hd requires a different instancer and rprims for different combinations
607  // of inherited attributes (material binding, draw mode, etc).
608  // This means we cannot use the Usd prototype prim as the instancer, because
609  // we can't represent this in the case where multiple Usd instances share
610  // the same prototype but have different bindings.
611  //
612  // Instead, we use the first instance of a prototype with a given set of
613  // inherited attributes as our instancer. For example, if /A and /B are
614  // both instances of /__Prototype_1 but /A and /B have different material
615  // bindings authored on them, both /A and /B will be instancers,
616  // with their own set of rprims and instance indices.
617  //
618  // The below is a multimap from prototype path to the cache path of the
619  // hydra instancer. The data for the instancer is located in the
620  // _InstancerDataMap.
621  typedef TfHashMultiMap<SdfPath, SdfPath, SdfPath::Hash>
622  _PrototypeToInstancerMap;
623  _PrototypeToInstancerMap _prototypeToInstancerMap;
624 };
625 
626 
627 PXR_NAMESPACE_CLOSE_SCOPE
628 
629 #endif // PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
bool GetVisible(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Returns true if the given prim is visible, taking into account inherited visibility values.
SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for this prim.
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:41
virtual SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
Called to populate the RenderIndex for this UsdPrim.
Basic type: 3-dimensional floating point range.
Definition: range3d.h:64
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...
HdCullStyle GetCullStyle(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the cullstyle of a specific path in the scene graph.
std::vector< VtArray< TfToken > > GetInstanceCategories(UsdPrim const &prim) override
Return an array of the categories used by each instance.
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
Definition: selection.h:55
Represents a value type name, i.e.
Definition: valueTypeName.h:87
This proxy class exposes a subset of the private Delegate API to PrimAdapters.
Definition: indexProxy.h:47
virtual void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
size_t SampleInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
Sample the instancer transform for the given prim.
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...
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
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.
GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
Base class for all PrimAdapters.
Definition: primAdapter.h:65
GfRange3d GetExtent(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads the extent from the given prim.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:132
A basic mathematical interval class.
Definition: interval.h:50
bool GetDoubleSided(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the topology object of a specific Usd prim.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
Returns the purpose token for prim.
Delegate support for instanced prims.
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...
PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this 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.
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.
VT_API bool operator==(VtDictionary const &, VtDictionary const &)
Equality comparison.
Object used by instancer prim adapters to pass along context about the instancer and instance prim to...
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 ...
A forward iterator into a UsdPrimRange.
Definition: primRange.h:140
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.
SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:168
virtual GfMatrix4d GetRelativeInstancerTransform(SdfPath const &parentInstancerPath, SdfPath const &instancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.