HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
instanceAdapter.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
8 #define PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
9 
10 /// \file usdImaging/instanceAdapter.h
11 
12 #include "pxr/pxr.h"
15 
16 #include "pxr/base/tf/hashmap.h"
17 
18 #include <mutex>
19 
21 
22 
23 /// \class UsdImagingInstanceAdapter
24 ///
25 /// Delegate support for instanced prims.
26 ///
27 /// In addition to prim schemas that support instancing, like the point
28 /// instancer, USD has a built in instancing feature that will allow prims
29 /// composed from the same assets, with compatible attributes, to be
30 /// de-duplicated inside of USD.
31 ///
32 /// When these prims are found during scene load, the prim location is
33 /// marked as an instance (meaning prim.IsInstance() == true), and its
34 /// descendants are added to a new hidden scene root. There can be
35 /// multiple prototype scene roots, and each one can be pointed to by
36 /// many instance prims, and these prototype sub-scenes can themselves
37 /// contain instances.
38 ///
39 /// We handle this by sending all instance prims to the instance adapter. In
40 /// order to preserve USD's native instancing work during rendering, for each
41 /// prototype scene root, we insert one hydra gprim per prototype USD gprim,
42 /// and we insert a hydra instancer that computes all of the places these gprims
43 /// (and any child instancers) are referenced in the scene, adjusting the
44 /// instancing count accordingly.
45 ///
46 /// The instance adapter is responsible for computing and passing down a
47 /// small amount of inheritable data that we allow to vary per-instance:
48 /// for example, transform and visibility state, and inherited constant
49 /// primvars. Otherwise, prototypes have no knowledge of the instance prims
50 /// that refer to them.
51 ///
52 /// Just like the scene root, the root of the prototype tree isn't allowed to
53 /// have attributes or a prim type; those are set on the instance prim instead.
54 /// This means if a gprim is directly instanced, USD won't actually de-duplicate
55 /// it. The instance adapter could theoretically bucket such gprims together,
56 /// but the difficulty of doing so is the same as the difficulty of
57 /// deduplicating arbitrary prims in the scene. Instead, the instance adapter
58 /// refuses to image directly-instanced gprims, and the recommended authoring
59 /// guidelines is to only enable USD instancing on enclosing scopes or xforms.
60 ///
61 /// There's a small set of extremely-special-case prims that are allowed to be
62 /// directly instanced, including cards and support prims that designate e.g.
63 /// skinning buffers. These prim adapters opt-in via CanPopulateUsdInstance,
64 /// and generally require very careful coding and support in the instance
65 /// adapter; but they are useful for restricted schemas where we know how to
66 /// vary the data per-instance or know how to efficiently aggregate instances.
67 ///
68 /// Finally, there's a small (hopefully shrinking) set of inherited attributes
69 /// that we need to respect, but don't know how to vary per-instance; for
70 /// example, material bindings. If two instances point to the same USD proto
71 /// root, but have different material bindings, we currently populate two
72 /// hydra instancers with two sets of hydra prototypes. This cuts into the
73 /// efficiency of instancing, so we try to minimize it.
74 ///
76 {
77 public:
79 
82  UsdPrim const& prim,
84  UsdImagingInstancerContext const* instancerContext = nullptr) override;
85 
87  bool ShouldCullChildren() const override;
88 
90  bool IsInstancerAdapter() const override;
91 
92  // ---------------------------------------------------------------------- //
93  /// \name Parallel Setup and Resolve
94  // ---------------------------------------------------------------------- //
95 
97  void TrackVariability(UsdPrim const& prim,
98  SdfPath const& cachePath,
99  HdDirtyBits* timeVaryingBits,
101  instancerContext = NULL) const override;
102 
104  void UpdateForTime(UsdPrim const& prim,
105  SdfPath const& cachePath,
107  HdDirtyBits requestedBits,
109  instancerContext = NULL) const override;
110 
111  // ---------------------------------------------------------------------- //
112  /// \name Change Processing
113  // ---------------------------------------------------------------------- //
114 
117  SdfPath const& cachePath,
118  TfToken const& propertyName)
119  override;
120 
122  void ProcessPrimResync(SdfPath const& cachePath,
123  UsdImagingIndexProxy* index) override;
124 
126  void ProcessPrimRemoval(SdfPath const& cachePath,
127  UsdImagingIndexProxy* index) override;
128 
129 
131  void MarkDirty(UsdPrim const& prim,
132  SdfPath const& cachePath,
133  HdDirtyBits dirty,
134  UsdImagingIndexProxy* index) override;
135 
136  // As this adapter hijacks the adapter for the child prim
137  // We need to forward these messages on, in case the child
138  // adapter needs them
140  void MarkRefineLevelDirty(UsdPrim const& prim,
141  SdfPath const& cachePath,
142  UsdImagingIndexProxy* index) override;
143 
145  void MarkReprDirty(UsdPrim const& prim,
146  SdfPath const& cachePath,
147  UsdImagingIndexProxy* index) override;
148 
150  void MarkCullStyleDirty(UsdPrim const& prim,
151  SdfPath const& cachePath,
152  UsdImagingIndexProxy* index) override;
153 
155  void MarkRenderTagDirty(UsdPrim const& prim,
156  SdfPath const& cachePath,
157  UsdImagingIndexProxy* index) override;
158 
160  void MarkTransformDirty(UsdPrim const& prim,
161  SdfPath const& cachePath,
162  UsdImagingIndexProxy* index) override;
163 
165  void MarkVisibilityDirty(UsdPrim const& prim,
166  SdfPath const& cachePath,
167  UsdImagingIndexProxy* index) override;
168 
169  // ---------------------------------------------------------------------- //
170  /// \name Instancing
171  // ---------------------------------------------------------------------- //
172 
174  std::vector<VtArray<TfToken>> GetInstanceCategories(
175  UsdPrim const& prim) override;
176 
178  GfMatrix4d GetInstancerTransform(UsdPrim const& instancerPrim,
179  SdfPath const& instancerPath,
180  UsdTimeCode time) const override;
181 
184  UsdPrim const& usdPrim,
185  SdfPath const& cachePath) const override;
186 
189  UsdPrim const& usdPrim,
190  SdfPath const& cachePath) const override;
191 
193  size_t SampleInstancerTransform(UsdPrim const& instancerPrim,
194  SdfPath const& instancerPath,
196  size_t maxSampleCount,
197  float *sampleTimes,
198  GfMatrix4d *sampleValues) override;
199 
201  size_t SampleTransform(UsdPrim const& prim,
202  SdfPath const& cachePath,
203  UsdTimeCode time,
204  size_t maxNumSamples,
205  float *sampleTimes,
206  GfMatrix4d *sampleValues) override;
207 
209  size_t SamplePrimvar(UsdPrim const& usdPrim,
210  SdfPath const& cachePath,
211  TfToken const& key,
213  size_t maxNumSamples,
214  float *sampleTimes,
215  VtValue *sampleValues,
216  VtIntArray *sampleIndices) override;
217 
220  UsdPrim const& usdPrim,
221  SdfPath const& cachePath,
222  TfToken const& instanceInheritablePurpose) const override;
223 
225  PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
226  SdfPath const& cachePath,
227  UsdTimeCode time) const override;
228 
230  VtValue GetTopology(UsdPrim const& prim,
231  SdfPath const& cachePath,
232  UsdTimeCode time) const override;
233 
235  HdCullStyle GetCullStyle(UsdPrim const& prim,
236  SdfPath const& cachePath,
237  UsdTimeCode time) const override;
238 
240  GfRange3d GetExtent(UsdPrim const& usdPrim,
241  SdfPath const& cachePath,
242  UsdTimeCode time) const override;
243 
245  bool IsChildPath(const SdfPath& path) const override;
246 
247  bool GetVisible(UsdPrim const& usdPrim,
248  SdfPath const& cachePath,
249  UsdTimeCode time) const override;
250 
252  bool GetDoubleSided(UsdPrim const& prim,
253  SdfPath const& cachePath,
254  UsdTimeCode time) const override;
255 
257  GfMatrix4d GetTransform(UsdPrim const& prim,
258  SdfPath const& cachePath,
260  bool ignoreRootTransform = false) const override;
261 
263  SdfPath GetMaterialId(UsdPrim const& prim,
264  SdfPath const& cachePath,
265  UsdTimeCode time) const override;
266 
269  const UsdPrim& prim,
270  const SdfPath& cachePath,
271  const TfToken& paramName,
272  UsdTimeCode time) const override;
273 
276  const UsdPrim& prim,
277  const SdfPath& cachePath,
278  UsdTimeCode time) const override;
279 
282  GetExtComputationInputs(UsdPrim const& prim,
283  SdfPath const& cachePath,
284  const UsdImagingInstancerContext* instancerContext)
285  const override;
286 
287 
290  GetExtComputationOutputs(UsdPrim const& prim,
291  SdfPath const& cachePath,
292  const UsdImagingInstancerContext* instancerContext)
293  const override;
294 
298  UsdPrim const& prim,
299  SdfPath const& cachePath,
300  HdInterpolation interpolation,
301  const UsdImagingInstancerContext* instancerContext) const override;
302 
304  VtValue
306  UsdPrim const& prim,
307  SdfPath const& cachePath,
308  TfToken const& name,
310  const UsdImagingInstancerContext* instancerContext) const override;
311 
313  std::string
315  UsdPrim const& prim,
316  SdfPath const& cachePath,
317  const UsdImagingInstancerContext* instancerContext) const override;
318 
320  VtValue
321  GetInstanceIndices(UsdPrim const& instancerPrim,
322  SdfPath const& instancerCachePath,
323  SdfPath const& prototypeCachePath,
324  UsdTimeCode time) const override;
325 
327  VtValue Get(UsdPrim const& prim,
328  SdfPath const& cachePath,
329  TfToken const& key,
331  VtIntArray *outIndices) const override;
332 
333  // ---------------------------------------------------------------------- //
334  /// \name Nested instancing support
335  // ---------------------------------------------------------------------- //
336 
339  SdfPath const &parentInstancerPath,
340  SdfPath const &instancerPath,
341  UsdTimeCode time) const override;
342 
343  // ---------------------------------------------------------------------- //
344  /// \name Picking & selection
345  // ---------------------------------------------------------------------- //
346 
349  SdfPath const& cachePath,
350  int instanceIndex,
351  HdInstancerContext *instancerContext) const override;
352 
355  SdfPath const& cachePath,
356  std::vector<int> const& instanceIndices,
357  std::vector<HdInstancerContext> *instancerCtxs) const override;
358 
361  SdfPath const& cachePath) const override;
362 
364  bool PopulateSelection(
365  HdSelection::HighlightMode const& highlightMode,
366  SdfPath const &cachePath,
367  UsdPrim const &usdPrim,
368  int const hydraInstanceIndex,
369  VtIntArray const &parentInstanceIndices,
370  HdSelectionSharedPtr const &result) const override;
371 
372  // ---------------------------------------------------------------------- //
373  /// \name Volume field information
374  // ---------------------------------------------------------------------- //
375 
378  GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
379  UsdTimeCode time) const override;
380 
381 protected:
383  void _RemovePrim(SdfPath const& cachePath,
384  UsdImagingIndexProxy* index) override final;
385 
386 private:
387 
388  SdfPath _Populate(UsdPrim const& prim,
390  UsdImagingInstancerContext const* instancerContext,
391  SdfPath const& parentProxyPath);
392 
393  struct _ProtoPrim;
394  struct _ProtoGroup;
395  struct _InstancerData;
396 
397  bool _IsChildPrim(UsdPrim const& prim,
398  SdfPath const& cachePath) const;
399 
400  // Returns true if the given prim serves as an instancer.
401  bool _PrimIsInstancer(UsdPrim const& prim) const;
402 
403  // Inserts prototype prims for the usdPrim given by \p iter into the
404  // \p index. Any inserted gprims will be inserted under a special path
405  // combining \p ctx.instancerCachePath and \p ctx.childName.
406  SdfPath
407  _InsertProtoPrim(UsdPrimRange::iterator *iter,
408  const UsdImagingPrimAdapterSharedPtr& primAdapter,
409  const UsdImagingInstancerContext& ctx,
411 
412  // For a usd path, collects the instancers to resync.
413  void _ResyncPath(SdfPath const& cachePath,
415  bool reload);
416  // Removes and optionally reloads all instancer data, both locally and
417  // from the render index.
418  void _ResyncInstancer(SdfPath const& instancerPath,
420 
421  // Computes per-frame data in the instancer map. This is primarily used
422  // during update to send new instance indices out to Hydra.
423  struct _ComputeInstanceMapFn;
424  VtIntArray _ComputeInstanceMap(UsdPrim const& instancerPrim,
425  _InstancerData const& instrData,
426  UsdTimeCode time) const;
427 
428  // Precomputes the instancer visibility data (as visible, invis, varying
429  // per-node), and returns whether the instance map is variable.
430  // Note: this function assumes the instancer data is already locked by
431  // the caller...
432  struct _ComputeInstanceMapVariabilityFn;
433  bool _ComputeInstanceMapVariability(UsdPrim const& instancerPrim,
434  _InstancerData const& instrData) const;
435 
436  // Gets the associated _ProtoPrim and instancer context for the given
437  // instancer and cache path.
438  _ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
439  SdfPath const& cachePath,
440  UsdImagingInstancerContext* ctx) const;
441 
442  // Gets the associated _ProtoPrim and instancerContext if cachePath is a
443  // child path and returns \c true, otherwise returns \c false.
444  bool _GetProtoPrimForChild(
445  UsdPrim const& usdPrim,
446  SdfPath const& cachePath,
447  _ProtoPrim const** proto,
448  UsdImagingInstancerContext* ctx) const;
449 
450  // Computes the transforms for all instances corresponding to the given
451  // instancer.
452  struct _ComputeInstanceTransformFn;
453  bool _ComputeInstanceTransforms(UsdPrim const& instancer,
454  VtMatrix4dArray* transforms,
455  UsdTimeCode time) const;
456 
457  // Gathers the authored transforms time samples given an instancer.
458  struct _GatherInstanceTransformTimeSamplesFn;
459  bool _GatherInstanceTransformsTimeSamples(UsdPrim const& instancer,
460  GfInterval interval,
461  std::vector<double>* outTimes)
462  const;
463 
464  // Gathers the specified primvar time samples given an instancer.
465  struct _GatherInstancePrimvarTimeSamplesFn;
466  bool _GatherInstancePrimvarTimeSamples(UsdPrim const& instancer,
467  TfToken const& key,
468  GfInterval interval,
469  std::vector<double>* outTimes)
470  const;
471 
472  // Returns true if any of the instances corresponding to the given
473  // instancer has a varying transform.
474  struct _IsInstanceTransformVaryingFn;
475  bool _IsInstanceTransformVarying(UsdPrim const& instancer) const;
476 
477  // Computes the value of a primvar for all instances corresponding to the
478  // given instancer. The templated version runs the templated functor,
479  // and the un-templated version does type dispatch.
480  template<typename T> struct _ComputeInheritedPrimvarFn;
481 
482  template<typename T>
483  bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
484  TfToken const& primvarName,
485  VtValue *result,
486  UsdTimeCode time) const;
487 
488  bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
489  TfToken const& primvarName,
490  SdfValueTypeName const& type,
491  VtValue *result,
492  UsdTimeCode time) const;
493 
494  // Returns true if any of the instances corresponding to the given
495  // instancer has varying inherited primvars.
496  struct _IsInstanceInheritedPrimvarVaryingFn;
497  bool _IsInstanceInheritedPrimvarVarying(UsdPrim const& instancer) const;
498 
499  struct _PopulateInstanceSelectionFn;
500  struct _GetScenePrimPathsFn;
501  struct _GetInstanceCategoriesFn;
502 
503  // Helper functions for dealing with "actual" instances to be drawn.
504  //
505  // Suppose we have:
506  // /Root
507  // Instance_A (prototype: /__Prototype_1)
508  // Instance_B (prototype: /__Prototype_1)
509  // /__Prototype_1
510  // AnotherInstance_A (prototype: /__Prototype_2)
511  // /__Prototype_2
512  //
513  // /__Prototype_2 has only one associated instance in the Usd scenegraph:
514  // /__Prototype_1/AnotherInstance_A. However, imaging actually needs to draw
515  // two instances of /__Prototype_2, because AnotherInstance_A is a nested
516  // instance beneath /__Prototype_1, and there are two instances of
517  // /__Prototype_1.
518  //
519  // Each instance to be drawn is addressed by the chain of instances
520  // that caused it to be drawn. In the above example, the two instances
521  // of /__Prototype_2 to be drawn are:
522  //
523  // [ /Root/Instance_A, /__Prototype_1/AnotherInstance_A ],
524  // [ /Root/Instance_B, /__Prototype_1/AnotherInstance_A ]
525  //
526  // This "instance context" describes the chain of opinions that
527  // ultimately affect the final drawn instance. For example, the
528  // transform of each instance to draw is the combined transforms
529  // of the prims in each context.
530  template <typename Functor>
531  void _RunForAllInstancesToDraw(UsdPrim const& instancer, Functor* fn) const;
532  template <typename Functor>
533  bool _RunForAllInstancesToDrawImpl(UsdPrim const& instancer,
534  std::vector<UsdPrim>* instanceContext,
535  size_t* instanceIdx,
536  Functor* fn) const;
537 
539  size_t _CountAllInstancesToDraw(UsdPrim const& instancer) const;
540  size_t _CountAllInstancesToDrawImpl(UsdPrim const& instancer,
541  _InstancerDrawCounts* drawCounts) const;
542 
543  // A proto prim represents a single adapter under a prototype root declared
544  // on the instancer.
545  struct _ProtoPrim {
546  _ProtoPrim() {}
547  // Each prim will become a prototype "child" under the instancer. This
548  // path is the path to the prim on the Usd Stage (the path to a single
549  // mesh, for example).
550  SdfPath path;
551  // The prim adapter for the actual prototype prim.
553  };
554 
555  // Indexed by prototype cachePath (each prim has one entry)
557 
558  // All data associated with a given instancer prim. PrimMap could
559  // technically be split out to avoid two lookups, however it seems cleaner
560  // to keep everything bundled up under the instancer path.
561  struct _InstancerData {
562  _InstancerData() : numInstancesToDraw(0), refresh(false) { }
563 
564  // The prototype prim path associated with this instancer.
565  SdfPath prototypePath;
566 
567  // The USD material path associated with this instancer.
568  SdfPath materialUsdPath;
569 
570  // The drawmode associated with this instancer.
571  TfToken drawMode;
572 
573  // The purpose value associated with this instance that can be inherited
574  // by proto prims that need to inherit ancestor purpose.
575  TfToken inheritablePurpose;
576 
577  // Inherited primvar
578  struct PrimvarInfo {
581  bool operator==(const PrimvarInfo& rhs) const;
582  bool operator<(const PrimvarInfo& rhs) const;
583  };
584  std::vector<PrimvarInfo> inheritedPrimvars;
585 
586  // Paths to Usd instance prims. Note that this is not necessarily
587  // equivalent to all the instances that will be drawn. See below.
588  SdfPathSet instancePaths;
589 
590  // Number of actual instances of this instancer that will be
591  // drawn. See comment on _RunForAllInstancesToDraw.
592  // XXX: This is mutable so that we can precache it in TrackVariability;
593  // it's inappropriate to track it in _Populate since not all instances
594  // will have been populated.
595  mutable size_t numInstancesToDraw;
596 
597  // Cached visibility. This vector contains an entry for each instance
598  // that will be drawn (i.e., visibility.size() == numInstancesToDraw).
599  enum Visibility {
600  Invisible, //< Invisible over all time
601  Visible, //< Visible over all time
602  Varying, //< Visibility varies over time
603  Unknown //< Visibility has not yet been checked
604  };
605  // XXX: This is mutable so that we can precache visibility per-instance
606  // in TrackVariability(). Can we replace this with some kind of usage
607  // of an inherited cache?
608  mutable std::vector<Visibility> visibility;
609 
610  // Map of all rprims for this instancer prim.
611  _PrimMap primMap;
612 
613  // This is a set of reference paths, where this instancer needs
614  // to deferer to another instancer. While refered to here as a child
615  // instancer, the actual relationship is more like a directed graph.
616  SdfPathSet childPointInstancers;
617 
618  // Nested (child) native instances.
619  SdfPathVector nestedInstances;
620 
621  // Parent native instances.
622  SdfPathVector parentInstances;
623 
624  // Flag indicating we've asked the delegate to refresh this instancer
625  // (via TrackVariability/UpdateForTime). We record this so we don't
626  // do it multiple times.
627  mutable bool refresh;
628  };
629 
630  // Map from hydra instancer cache path to the various instancer state we
631  // need to answer adapter queries.
632  // Note: this map is modified in multithreaded code paths and must be
633  // locked.
634  typedef std::unordered_map<SdfPath, _InstancerData, SdfPath::Hash>
635  _InstancerDataMap;
636  _InstancerDataMap _instancerData;
637 
638  // Map from USD instance prim paths to the cache path of the hydra instancer
639  // they are assigned to (which will typically be the path to the first
640  // instance of this instance group we run across).
641  // XXX: consider to move this forwarding map into HdRenderIndex.
643  _InstanceToInstancerMap;
644  _InstanceToInstancerMap _instanceToInstancerMap;
645 
646  // Hd and UsdImaging think of instancing in terms of an 'instancer' that
647  // specifies a list of 'prototype' prims that are shared per instance.
648  //
649  // For Usd scenegraph instancing, a prototype prim and its descendents
650  // roughly correspond to the instancer and prototype prims. However,
651  // Hd requires a different instancer and rprims for different combinations
652  // of inherited attributes (material binding, draw mode, etc).
653  // This means we cannot use the Usd prototype prim as the instancer, because
654  // we can't represent this in the case where multiple Usd instances share
655  // the same prototype but have different bindings.
656  //
657  // Instead, we use the first instance of a prototype with a given set of
658  // inherited attributes as our instancer. For example, if /A and /B are
659  // both instances of /__Prototype_1 but /A and /B have different material
660  // bindings authored on them, both /A and /B will be instancers,
661  // with their own set of rprims and instance indices.
662  //
663  // The below is a multimap from prototype path to the cache path of the
664  // hydra instancer. The data for the instancer is located in the
665  // _InstancerDataMap.
667  _PrototypeToInstancerMap;
668  _PrototypeToInstancerMap _prototypeToInstancerMap;
669 
670  // Map from instance cache path to their instancer path.
671  // Note: this is for reducing proto prim lookup in _GetProtoPrim method.
672  typedef std::unordered_map<SdfPath, SdfPath, SdfPath::Hash>
673  _ProtoPrimToInstancerMap;
674  _ProtoPrimToInstancerMap _protoPrimToInstancerMap;
675 };
676 
678 
679 #endif // PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
bool GetVisible(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
USDIMAGING_API HdDirtyBits ProcessPropertyChange(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &propertyName) override
PXL_API void reload()
Reload the configuration.
HdCullStyle
Definition: enums.h:105
#define USDIMAGING_API
Definition: api.h:23
USDIMAGING_API void UpdateForTime(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, HdDirtyBits requestedBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
USDIMAGING_API void MarkRefineLevelDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
GT_API const UT_StringHolder time
uint32_t HdDirtyBits
Definition: types.h:143
USDIMAGING_API GfRange3d GetExtent(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
Definition: selection.h:39
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDIMAGING_API bool IsChildPath(const SdfPath &path) const override
The root transform provided by the delegate.
std::vector< HdExtComputationInputDescriptor > HdExtComputationInputDescriptorVector
USDIMAGING_API VtValue Get(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, VtIntArray *outIndices) const override
USDIMAGING_API SdfPath GetMaterialId(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
The root transform provided by the delegate.
VaryingRef< T > Varying(T *x)
Definition: varyingref.h:193
USDIMAGING_API VtValue GetLightParamValue(const UsdPrim &prim, const SdfPath &cachePath, const TfToken &paramName, UsdTimeCode time) const override
USDIMAGING_API void MarkVisibilityDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDIMAGING_API 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.
std::vector< HdExtComputationOutputDescriptor > HdExtComputationOutputDescriptorVector
USDIMAGING_API size_t SampleInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
**But if you need a result
Definition: thread.h:622
USDIMAGING_API SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
USDIMAGING_API void ProcessPrimResync(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDIMAGING_API VtValue GetInstanceIndices(UsdPrim const &instancerPrim, SdfPath const &instancerCachePath, SdfPath const &prototypeCachePath, UsdTimeCode time) const override
std::vector< std::pair< SdfPath, int > > HdInstancerContext
Instancer context: a pair of instancer paths and instance indices.
Definition: sceneDelegate.h:44
USDIMAGING_API void TrackVariability(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits *timeVaryingBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
USDIMAGING_API GfMatrix4d GetTransform(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, bool ignoreRootTransform=false) const override
USDIMAGING_API void MarkRenderTagDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
Definition: token.h:70
USDIMAGING_API TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
USDIMAGING_API 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< class SdfPath > SdfPathVector
USDIMAGING_API HdExtComputationPrimvarDescriptorVector GetExtComputationPrimvars(UsdPrim const &prim, SdfPath const &cachePath, HdInterpolation interpolation, const UsdImagingInstancerContext *instancerContext) const override
USDIMAGING_API std::vector< VtArray< TfToken > > GetInstanceCategories(UsdPrim const &prim) override
Return an array of the categories used by each instance.
USDIMAGING_API void MarkReprDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDIMAGING_API VtValue GetExtComputationInput(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &name, UsdTimeCode time, const UsdImagingInstancerContext *instancerContext) const override
Definition: prim.h:116
USDIMAGING_API HdExtComputationInputDescriptorVector GetExtComputationInputs(UsdPrim const &prim, SdfPath const &cachePath, const UsdImagingInstancerContext *instancerContext) const override
USDIMAGING_API bool ShouldCullChildren() const override
USDIMAGING_API void _RemovePrim(SdfPath const &cachePath, UsdImagingIndexProxy *index) overridefinal
Returns whether custom shading of prims is enabled.
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:273
USDIMAGING_API bool GetDoubleSided(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
USDIMAGING_API GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
std::vector< HdVolumeFieldDescriptor > HdVolumeFieldDescriptorVector
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
Definition: path.h:192
USDIMAGING_API void MarkTransformDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDIMAGING_API void MarkDirty(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits dirty, UsdImagingIndexProxy *index) override
USDIMAGING_API PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
bool operator==(const PrimvarInfo &rhs) const
USDIMAGING_API std::string GetExtComputationKernel(UsdPrim const &prim, SdfPath const &cachePath, const UsdImagingInstancerContext *instancerContext) const override
USDIMAGING_API SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDIMAGING_API void MarkCullStyleDirty(UsdPrim const &prim, SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDIMAGING_API SdfPathVector GetScenePrimPaths(SdfPath const &cachePath, std::vector< int > const &instanceIndices, std::vector< HdInstancerContext > *instancerCtxs) const override
GLuint index
Definition: glcorearb.h:786
HdInterpolation
Definition: enums.h:177
USDIMAGING_API bool PopulateSelection(HdSelection::HighlightMode const &highlightMode, SdfPath const &cachePath, UsdPrim const &usdPrim, int const hydraInstanceIndex, VtIntArray const &parentInstanceIndices, HdSelectionSharedPtr const &result) const override
USDIMAGING_API void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
USDIMAGING_API GfMatrix4d GetRelativeInstancerTransform(SdfPath const &parentInstancerPath, SdfPath const &instancerPath, UsdTimeCode time) const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::shared_ptr< UsdImagingPrimAdapter > UsdImagingPrimAdapterSharedPtr
USDIMAGING_API VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
USDIMAGING_API SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
USDIMAGING_API VtValue GetMaterialResource(const UsdPrim &prim, const SdfPath &cachePath, UsdTimeCode time) const override
The root transform provided by the delegate.
USDIMAGING_API HdExtComputationOutputDescriptorVector GetExtComputationOutputs(UsdPrim const &prim, SdfPath const &cachePath, const UsdImagingInstancerContext *instancerContext) const override
USDIMAGING_API SdfPath GetDataSharingId(SdfPath const &cachePath) const override
bool operator<(const PrimvarInfo &rhs) const
USDIMAGING_API SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for this prim.
std::shared_ptr< class HdSelection > HdSelectionSharedPtr
Definition: selection.h:23
USDIMAGING_API bool IsInstancerAdapter() const override
Definition: value.h:146
USDIMAGING_API HdVolumeFieldDescriptorVector GetVolumeFieldDescriptors(UsdPrim const &usdPrim, SdfPath const &id, UsdTimeCode time) const override
USDIMAGING_API size_t SamplePrimvar(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, VtValue *sampleValues, VtIntArray *sampleIndices) override
std::vector< HdExtComputationPrimvarDescriptor > HdExtComputationPrimvarDescriptorVector