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 SdfPathVector GetScenePrimPaths(
318  SdfPath const& cachePath,
319  std::vector<int> const& instanceIndices,
320  std::vector<HdInstancerContext> *instancerCtxs) const override;
321 
322  virtual bool PopulateSelection(
323  HdSelection::HighlightMode const& highlightMode,
324  SdfPath const &cachePath,
325  UsdPrim const &usdPrim,
326  int const hydraInstanceIndex,
327  VtIntArray const &parentInstanceIndices,
328  HdSelectionSharedPtr const &result) const override;
329 
330  // ---------------------------------------------------------------------- //
332  // ---------------------------------------------------------------------- //
333 
334  virtual HdVolumeFieldDescriptorVector
335  GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
336  UsdTimeCode time) const override;
337 
338 protected:
339  virtual void _RemovePrim(SdfPath const& cachePath,
340  UsdImagingIndexProxy* index) override final;
341 
342 private:
343 
344  SdfPath _Populate(UsdPrim const& prim,
345  UsdImagingIndexProxy* index,
346  UsdImagingInstancerContext const* instancerContext,
347  SdfPath const& parentProxyPath);
348 
349  struct _ProtoPrim;
350  struct _ProtoGroup;
351  struct _InstancerData;
352 
353  bool _IsChildPrim(UsdPrim const& prim,
354  SdfPath const& cachePath) const;
355 
356  // Returns true if the given prim serves as an instancer.
357  bool _PrimIsInstancer(UsdPrim const& prim) const;
358 
359  // Inserts prototype prims for the given \p usdPrim into the \p index.
360  // Any inserted gprims will be inserted under a special path combining
361  // \p instancerPath and \p protoName.
362  SdfPath
363  _InsertProtoPrim(UsdPrimRange::iterator *iter,
364  const TfToken& protoName,
365  SdfPath materialId,
366  TfToken drawMode,
367  TfToken inheritablePurpose,
368  SdfPath instancerPath,
369  UsdImagingPrimAdapterSharedPtr const& primAdapter,
370  UsdImagingPrimAdapterSharedPtr const& instancerAdapter,
371  UsdImagingIndexProxy* index,
372  bool *isLeafInstancer);
373 
374  // For a usd path, collects the instancers to resync.
375  void _ResyncPath(SdfPath const& cachePath,
376  UsdImagingIndexProxy* index,
377  bool reload);
378  // Removes and optionally reloads all instancer data, both locally and
379  // from the render index.
380  void _ResyncInstancer(SdfPath const& instancerPath,
381  UsdImagingIndexProxy* index, bool reload);
382 
383  // Computes per-frame data in the instancer map. This is primarily used
384  // during update to send new instance indices out to Hydra.
385  struct _ComputeInstanceMapFn;
386  VtIntArray _ComputeInstanceMap(UsdPrim const& instancerPrim,
387  _InstancerData const& instrData,
388  UsdTimeCode time) const;
389 
390  // Precomputes the instancer visibility data (as visible, invis, varying
391  // per-node), and returns whether the instance map is variable.
392  // Note: this function assumes the instancer data is already locked by
393  // the caller...
394  struct _ComputeInstanceMapVariabilityFn;
395  bool _ComputeInstanceMapVariability(UsdPrim const& instancerPrim,
396  _InstancerData const& instrData) const;
397 
398  // Gets the associated _ProtoPrim and instancer context for the given
399  // instancer and cache path.
400  _ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
401  SdfPath const& cachePath,
402  UsdImagingInstancerContext* ctx) const;
403 
404  // Gets the associated _ProtoPrim and instancerContext if cachePath is a
405  // child path and returns \c true, otherwise returns \c false.
406  bool _GetProtoPrimForChild(
407  UsdPrim const& usdPrim,
408  SdfPath const& cachePath,
409  _ProtoPrim const** proto,
410  UsdImagingInstancerContext* ctx) const;
411 
412  // Computes the transforms for all instances corresponding to the given
413  // instancer.
414  struct _ComputeInstanceTransformFn;
415  bool _ComputeInstanceTransforms(UsdPrim const& instancer,
416  VtMatrix4dArray* transforms,
417  UsdTimeCode time) const;
418 
419  // Gathers the authored transforms time samples given an instancer.
420  struct _GatherInstanceTransformTimeSamplesFn;
421  bool _GatherInstanceTransformsTimeSamples(UsdPrim const& instancer,
422  GfInterval interval,
423  std::vector<double>* outTimes)
424  const;
425 
426  // Gathers the specified primvar time samples given an instancer.
427  struct _GatherInstancePrimvarTimeSamplesFn;
428  bool _GatherInstancePrimvarTimeSamples(UsdPrim const& instancer,
429  TfToken const& key,
430  GfInterval interval,
431  std::vector<double>* outTimes)
432  const;
433 
434  // Returns true if any of the instances corresponding to the given
435  // instancer has a varying transform.
436  struct _IsInstanceTransformVaryingFn;
437  bool _IsInstanceTransformVarying(UsdPrim const& instancer) const;
438 
439  // Computes the value of a primvar for all instances corresponding to the
440  // given instancer. The templated version runs the templated functor,
441  // and the un-templated version does type dispatch.
442  template<typename T> struct _ComputeInheritedPrimvarFn;
443 
444  template<typename T>
445  bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
446  TfToken const& primvarName,
447  VtValue *result,
448  UsdTimeCode time) const;
449 
450  bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
451  TfToken const& primvarName,
452  SdfValueTypeName const& type,
453  VtValue *result,
454  UsdTimeCode time) const;
455 
456  // Returns true if any of the instances corresponding to the given
457  // instancer has varying inherited primvars.
458  struct _IsInstanceInheritedPrimvarVaryingFn;
459  bool _IsInstanceInheritedPrimvarVarying(UsdPrim const& instancer) const;
460 
461  struct _PopulateInstanceSelectionFn;
462  struct _GetScenePrimPathsFn;
463 
464  // Helper functions for dealing with "actual" instances to be drawn.
465  //
466  // Suppose we have:
467  // /Root
468  // Instance_A (prototype: /__Prototype_1)
469  // Instance_B (prototype: /__Prototype_1)
470  // /__Prototype_1
471  // AnotherInstance_A (prototype: /__Prototype_2)
472  // /__Prototype_2
473  //
474  // /__Prototype_2 has only one associated instance in the Usd scenegraph:
475  // /__Prototype_1/AnotherInstance_A. However, imaging actually needs to draw
476  // two instances of /__Prototype_2, because AnotherInstance_A is a nested
477  // instance beneath /__Prototype_1, and there are two instances of
478  // /__Prototype_1.
479  //
480  // Each instance to be drawn is addressed by the chain of instances
481  // that caused it to be drawn. In the above example, the two instances
482  // of /__Prototype_2 to be drawn are:
483  //
484  // [ /Root/Instance_A, /__Prototype_1/AnotherInstance_A ],
485  // [ /Root/Instance_B, /__Prototype_1/AnotherInstance_A ]
486  //
487  // This "instance context" describes the chain of opinions that
488  // ultimately affect the final drawn instance. For example, the
489  // transform of each instance to draw is the combined transforms
490  // of the prims in each context.
491  template <typename Functor>
492  void _RunForAllInstancesToDraw(UsdPrim const& instancer, Functor* fn) const;
493  template <typename Functor>
494  bool _RunForAllInstancesToDrawImpl(UsdPrim const& instancer,
495  std::vector<UsdPrim>* instanceContext,
496  size_t* instanceIdx,
497  Functor* fn) const;
498 
499  typedef TfHashMap<SdfPath, size_t, SdfPath::Hash> _InstancerDrawCounts;
500  size_t _CountAllInstancesToDraw(UsdPrim const& instancer) const;
501  size_t _CountAllInstancesToDrawImpl(UsdPrim const& instancer,
502  _InstancerDrawCounts* drawCounts) const;
503 
504  // A proto prim represents a single adapter under a prototype root declared
505  // on the instancer.
506  struct _ProtoPrim {
507  _ProtoPrim() {}
508  // Each prim will become a prototype "child" under the instancer. This
509  // path is the path to the prim on the Usd Stage (the path to a single
510  // mesh, for example).
511  SdfPath path;
512  // The prim adapter for the actual prototype prim.
513  UsdImagingPrimAdapterSharedPtr adapter;
514  };
515 
516  // Indexed by prototype cachePath (each prim has one entry)
517  typedef TfHashMap<SdfPath, _ProtoPrim, SdfPath::Hash> _PrimMap;
518 
519  // All data associated with a given instancer prim. PrimMap could
520  // technically be split out to avoid two lookups, however it seems cleaner
521  // to keep everything bundled up under the instancer path.
522  struct _InstancerData {
523  _InstancerData() : numInstancesToDraw(0), refresh(false) { }
524 
525  // The prototype prim path associated with this instancer.
526  SdfPath prototypePath;
527 
528  // The USD material path associated with this instancer.
529  SdfPath materialUsdPath;
530 
531  // The drawmode associated with this instancer.
532  TfToken drawMode;
533 
534  // The purpose value associated with this instance that can be inherited
535  // by proto prims that need to inherit ancestor purpose.
536  TfToken inheritablePurpose;
537 
538  // Inherited primvar
539  struct PrimvarInfo {
540  TfToken name;
541  SdfValueTypeName type;
542  bool operator==(const PrimvarInfo& rhs) const;
543  bool operator<(const PrimvarInfo& rhs) const;
544  };
545  std::vector<PrimvarInfo> inheritedPrimvars;
546 
547  // Paths to Usd instance prims. Note that this is not necessarily
548  // equivalent to all the instances that will be drawn. See below.
549  SdfPathSet instancePaths;
550 
551  // Number of actual instances of this instancer that will be
552  // drawn. See comment on _RunForAllInstancesToDraw.
553  // XXX: This is mutable so that we can precache it in TrackVariability;
554  // it's inappropriate to track it in _Populate since not all instances
555  // will have been populated.
556  mutable size_t numInstancesToDraw;
557 
558  // Cached visibility. This vector contains an entry for each instance
559  // that will be drawn (i.e., visibility.size() == numInstancesToDraw).
560  enum Visibility {
561  Invisible, //< Invisible over all time
562  Visible, //< Visible over all time
563  Varying, //< Visibility varies over time
564  Unknown //< Visibility has not yet been checked
565  };
566  // XXX: This is mutable so that we can precache visibility per-instance
567  // in TrackVariability(). Can we replace this with some kind of usage
568  // of an inherited cache?
569  mutable std::vector<Visibility> visibility;
570 
571  // Map of all rprims for this instancer prim.
572  _PrimMap primMap;
573 
574  // This is a set of reference paths, where this instancer needs
575  // to deferer to another instancer. While refered to here as a child
576  // instancer, the actual relationship is more like a directed graph.
577  SdfPathSet childPointInstancers;
578 
579  // Nested (child) native instances.
580  SdfPathVector nestedInstances;
581 
582  // Parent native instances.
583  SdfPathVector parentInstances;
584 
585  // Flag indicating we've asked the delegate to refresh this instancer
586  // (via TrackVariability/UpdateForTime). We record this so we don't
587  // do it multiple times.
588  mutable bool refresh;
589  };
590 
591  // Map from hydra instancer cache path to the various instancer state we
592  // need to answer adapter queries.
593  // Note: this map is modified in multithreaded code paths and must be
594  // locked.
595  typedef std::unordered_map<SdfPath, _InstancerData, SdfPath::Hash>
596  _InstancerDataMap;
597  _InstancerDataMap _instancerData;
598 
599  // Map from USD instance prim paths to the cache path of the hydra instancer
600  // they are assigned to (which will typically be the path to the first
601  // instance of this instance group we run across).
602  // XXX: consider to move this forwarding map into HdRenderIndex.
603  typedef TfHashMap<SdfPath, SdfPath, SdfPath::Hash>
604  _InstanceToInstancerMap;
605  _InstanceToInstancerMap _instanceToInstancerMap;
606 
607  // Hd and UsdImaging think of instancing in terms of an 'instancer' that
608  // specifies a list of 'prototype' prims that are shared per instance.
609  //
610  // For Usd scenegraph instancing, a prototype prim and its descendents
611  // roughly correspond to the instancer and prototype prims. However,
612  // Hd requires a different instancer and rprims for different combinations
613  // of inherited attributes (material binding, draw mode, etc).
614  // This means we cannot use the Usd prototype prim as the instancer, because
615  // we can't represent this in the case where multiple Usd instances share
616  // the same prototype but have different bindings.
617  //
618  // Instead, we use the first instance of a prototype with a given set of
619  // inherited attributes as our instancer. For example, if /A and /B are
620  // both instances of /__Prototype_1 but /A and /B have different material
621  // bindings authored on them, both /A and /B will be instancers,
622  // with their own set of rprims and instance indices.
623  //
624  // The below is a multimap from prototype path to the cache path of the
625  // hydra instancer. The data for the instancer is located in the
626  // _InstancerDataMap.
627  typedef TfHashMultiMap<SdfPath, SdfPath, SdfPath::Hash>
628  _PrototypeToInstancerMap;
629  _PrototypeToInstancerMap _prototypeToInstancerMap;
630 
631  // Map from instance cache path to their instancer path.
632  // Note: this is for reducing proto prim lookup in _GetProtoPrim method.
633  typedef std::unordered_map<SdfPath, SdfPath, SdfPath::Hash>
634  _ProtoPrimToInstancerMap;
635  _ProtoPrimToInstancerMap _protoPrimToInstancerMap;
636 };
637 
638 
639 PXR_NAMESPACE_CLOSE_SCOPE
640 
641 #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:43
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:67
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:134
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:290
virtual SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
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:166
virtual GfMatrix4d GetRelativeInstancerTransform(SdfPath const &parentInstancerPath, SdfPath const &instancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.