HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sceneDelegate.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_IMAGING_HD_SCENE_DELEGATE_H
8 #define PXR_IMAGING_HD_SCENE_DELEGATE_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
12 #include "pxr/imaging/hd/version.h"
13 
14 #include "pxr/imaging/hd/aov.h"
16 #include "pxr/imaging/hd/enums.h"
19 #include "pxr/imaging/hd/repr.h"
21 
23 
24 #include "pxr/base/vt/array.h"
25 #include "pxr/base/vt/dictionary.h"
26 #include "pxr/base/vt/value.h"
27 #include "pxr/usd/sdf/assetPath.h"
28 #include "pxr/usd/sdf/path.h"
29 
30 #include "pxr/base/gf/vec2i.h"
31 #include "pxr/base/tf/hash.h"
32 
33 #include <memory>
34 #include <vector>
35 
37 
39 
40 /// A shared pointer to a vector of id's.
41 typedef std::shared_ptr<SdfPathVector> HdIdVectorSharedPtr;
42 
43 /// Instancer context: a pair of instancer paths and instance indices.
44 typedef std::vector<std::pair<SdfPath, int>> HdInstancerContext;
45 
46 /// \class HdSyncRequestVector
47 ///
48 /// The SceneDelegate is requested to synchronize prims as the result of
49 /// executing a specific render pass, the following data structure is passed
50 /// back to the delegate to drive synchronization.
51 ///
53  // The Prims to synchronize in this request.
55 
56  // The HdChangeTracker::DirtyBits that are set for each Prim.
57  std::vector<HdDirtyBits> dirtyBits;
58 };
59 
60 /// \struct HdDisplayStyle
61 ///
62 /// Describes how the geometry of a prim should be displayed.
63 ///
65  /// The prim refine level, in the range [0, 8].
66  ///
67  /// The refinement level indicates how many iterations to apply when
68  /// subdividing subdivision surfaces or other refinable primitives.
70 
71  /// Is the prim flat shaded.
73 
74  /// Is the prim displacement shaded.
76 
77  /// Is the prim overlayed on top of other prims.
79 
80  /// Does the prim act "transparent" to allow occluded selection to show
81  /// through?
83 
84  /// Should the prim's points get shaded like surfaces, as opposed to
85  /// constant shaded?
87 
88  /// Is this prim exempt from having its material disabled or overridden,
89  /// for example, when a renderer chooses to ignore all scene materials?
91 
92  /// Creates a default DisplayStyle.
93  /// - refineLevel is 0.
94  /// - flatShading is disabled.
95  /// - displacement is enabled.
96  /// - displayInOverlay is disabled.
97  /// - occludedSelectionShowsThrough is disabled.
98  /// - pointsShading is disabled.
100  : refineLevel(0)
101  , flatShadingEnabled(false)
102  , displacementEnabled(true)
103  , displayInOverlay(false)
105  , pointsShadingEnabled(false)
106  , materialIsFinal(false)
107  { }
108 
109  /// Creates a DisplayStyle.
110  /// \param refineLevel_ the refine level to display.
111  /// Valid range is [0, 8].
112  /// \param flatShading enables flat shading, defaults to false.
113  /// \param displacement enables displacement shading, defaults to true.
114  /// \param displayInOverlay enables display in overlay, defaults to false.
115  /// \param occludedSelectionShowsThrough controls whether the prim lets
116  /// occluded selection show through it, defaults to false.
117  /// \param pointsShadingEnabled controls whether the prim's points
118  /// are shaded as surfaces or constant-shaded, defaults to false.
119  /// \param materialisFinal controls whether the prim's material should be
120  /// exempt from override or disabling, such as when a renderer
121  /// wants to ignore all scene materials.
122  HdDisplayStyle(int refineLevel_,
123  bool flatShading = false,
124  bool displacement = true,
125  bool displayInOverlay_ = false,
126  bool occludedSelectionShowsThrough_ = false,
127  bool pointsShadingEnabled_ = false,
128  bool materialIsFinal_ = false)
129  : refineLevel(std::max(0, refineLevel_))
130  , flatShadingEnabled(flatShading)
131  , displacementEnabled(displacement)
132  , displayInOverlay(displayInOverlay_)
133  , occludedSelectionShowsThrough(occludedSelectionShowsThrough_)
134  , pointsShadingEnabled(pointsShadingEnabled_)
135  , materialIsFinal(materialIsFinal_)
136  {
137  if (refineLevel_ < 0) {
138  TF_CODING_ERROR("negative refine level is not supported");
139  } else if (refineLevel_ > 8) {
140  TF_CODING_ERROR("refine level > 8 is not supported");
141  }
142  }
143 
144  HdDisplayStyle(HdDisplayStyle const& rhs) = default;
145  ~HdDisplayStyle() = default;
146 
147  bool operator==(HdDisplayStyle const& rhs) const {
148  return refineLevel == rhs.refineLevel
156  }
157  bool operator!=(HdDisplayStyle const& rhs) const {
158  return !(*this == rhs);
159  }
160 };
161 
162 /// \struct HdPrimvarDescriptor
163 ///
164 /// Describes a primvar.
166  /// Name of the primvar.
168  /// Interpolation (data-sampling rate) of the primvar.
170  /// Optional "role" indicating a desired interpretation --
171  /// for example, to distinguish color/vector/point/normal.
172  /// See HdPrimvarRoleTokens; default is HdPrimvarRoleTokens->none.
174  /// Optional bool, true if primvar is indexed. This value should be checked
175  /// before calling "GetIndexedPrimvar"
176  bool indexed;
177 
180  , role(HdPrimvarRoleTokens->none)
181  , indexed(false)
182  {}
184  HdInterpolation interp_,
185  TfToken const& role_=HdPrimvarRoleTokens->none,
186  bool indexed_=false)
187  : name(name_), interpolation(interp_), role(role_), indexed(indexed_)
188  { }
189  bool operator==(HdPrimvarDescriptor const& rhs) const {
190  return name == rhs.name && role == rhs.role
191  && interpolation == rhs.interpolation;
192  }
193  bool operator!=(HdPrimvarDescriptor const& rhs) const {
194  return !(*this == rhs);
195  }
196 };
197 
198 typedef std::vector<HdPrimvarDescriptor> HdPrimvarDescriptorVector;
199 
200 /// \struct HdModelDrawMode
201 ///
202 /// Describes optional alternative imaging behavior for prims.
203 ///
204 /// Some scene delegates, like the UsdImagingDelegate, will pre-flatten this
205 /// data, but other scene delegates may wish to use this to pipe the data
206 /// through to a draw mode resolving scene index (see
207 /// UsdImagingDrawModeSceneIndex as an example of such a scene index).
208 ///
209 /// There is currently no plan to add emulation support for this information,
210 /// such as via HdLegacyPrimSceneIndex or HdSceneIndexAdapterSceneDelegate.
211 ///
213  // Alternate imaging mode. Options are origin, bounds, cards, default, and
214  // inherited.
216  // Specifies whether to apply the alternative imaging mode or not.
218  // The color in which to draw the geometry.
220  // The specific geometry to use in cards mode. Options are cross, box, and
221  // fromTexture.
223  // The textures applied to the respective quads in cards mode.
230 
232  : drawMode(HdModelDrawModeTokens->inherited)
233  , applyDrawMode(false)
234  , drawModeColor(GfVec3f(0.18))
235  , cardGeometry(HdModelDrawModeTokens->cross)
236  {}
237 
238  /// DrawModeColor is specified in the rendering color space
240  TfToken const& drawMode_,
241  bool applyDrawMode_=false,
242  GfVec3f drawModeColor_=GfVec3f(0.18),
243  TfToken const& cardGeometry_=HdModelDrawModeTokens->cross,
244  SdfAssetPath cardTextureXPos_=SdfAssetPath(),
245  SdfAssetPath cardTextureYPos_=SdfAssetPath(),
246  SdfAssetPath cardTextureZPos_=SdfAssetPath(),
247  SdfAssetPath cardTextureXNeg_=SdfAssetPath(),
248  SdfAssetPath cardTextureYNeg_=SdfAssetPath(),
249  SdfAssetPath cardTextureZNeg_=SdfAssetPath())
250  : drawMode(drawMode_), applyDrawMode(applyDrawMode_),
251  drawModeColor(drawModeColor_), cardGeometry(cardGeometry_),
252  cardTextureXPos(cardTextureXPos_), cardTextureYPos(cardTextureYPos_),
253  cardTextureZPos(cardTextureZPos_), cardTextureXNeg(cardTextureXNeg_),
254  cardTextureYNeg(cardTextureYNeg_), cardTextureZNeg(cardTextureZNeg_)
255  {}
256 
257  bool operator==(HdModelDrawMode const& rhs) const {
258  return drawMode == rhs.drawMode &&
259  applyDrawMode == rhs.applyDrawMode &&
260  drawModeColor == rhs.drawModeColor &&
261  cardGeometry == rhs.cardGeometry &&
268  }
269  bool operator!=(HdModelDrawMode const& rhs) const {
270  return !(*this == rhs);
271  }
272 };
273 
274 /// \struct HdExtComputationPrimvarDescriptor
275 ///
276 /// Extends HdPrimvarDescriptor to describe a primvar that takes
277 /// data from the output of an ExtComputation.
278 ///
279 /// The structure contains the id of the source ExtComputation in the
280 /// render index, the name of an output from that computation from which
281 /// the primvar will take data along with a valueType which describes
282 /// the type of the expected data.
287 
290  TfToken const& name_,
291  HdInterpolation interp_,
292  TfToken const & role_,
293  SdfPath const & sourceComputationId_,
294  TfToken const & sourceComputationOutputName_,
295  HdTupleType const & valueType_)
296  : HdPrimvarDescriptor(name_, interp_, role_, false)
297  , sourceComputationId(sourceComputationId_)
298  , sourceComputationOutputName(sourceComputationOutputName_)
299  , valueType(valueType_)
300  { }
302  return HdPrimvarDescriptor::operator==(rhs) &&
305  valueType == rhs.valueType;
306  }
308  return !(*this == rhs);
309  }
310 };
311 
312 typedef std::vector<HdExtComputationPrimvarDescriptor>
314 
315 /// \struct HdExtComputationInputDescriptor
316 ///
317 /// Describes an input to an ExtComputation that takes data from
318 /// the output of another ExtComputation.
319 ///
320 /// The structure contains the name of the input and the id of the
321 /// source ExtComputation in the render index, and which output of
322 /// that computation to bind the input to.
327 
330  TfToken const & name_,
331  SdfPath const & sourceComputationId_,
332  TfToken const & sourceComputationOutputName_)
333  : name(name_), sourceComputationId(sourceComputationId_)
334  , sourceComputationOutputName(sourceComputationOutputName_)
335  { }
336 
338  return name == rhs.name &&
341  }
343  return !(*this == rhs);
344  }
345 };
346 
347 typedef std::vector<HdExtComputationInputDescriptor>
349 
350 /// \struct HdExtComputationOutputDescriptor
351 ///
352 /// Describes an output of an ExtComputation.
353 ///
354 /// The structure contains the name of the output along with a valueType
355 /// which describes the type of the computation output data.
359 
362  TfToken const & name_,
363  HdTupleType const & valueType_)
364  : name(name_), valueType(valueType_)
365  { }
366 
368  return name == rhs.name &&
369  valueType == rhs.valueType;
370  }
372  return !(*this == rhs);
373  }
374 };
375 
376 typedef std::vector<HdExtComputationOutputDescriptor>
378 
379 /// \struct HdVolumeFieldDescriptor
380 ///
381 /// Description of a single field related to a volume primitive.
382 ///
387 
390  TfToken const & fieldName_,
391  TfToken const & fieldPrimType_,
392  SdfPath const & fieldId_)
393  : fieldName(fieldName_), fieldPrimType(fieldPrimType_), fieldId(fieldId_)
394  { }
395 };
396 
397 typedef std::vector<HdVolumeFieldDescriptor>
399 
400 /// \class HdSceneDelegate
401 ///
402 /// Adapter class providing data exchange with the client scene graph.
403 ///
405 public:
406  /// Constructor used for nested delegate objects which share a RenderIndex.
407  HD_API
408  HdSceneDelegate(HdRenderIndex *parentIndex,
409  SdfPath const& delegateID);
410 
411  HD_API
412  virtual ~HdSceneDelegate();
413 
414  /// Returns the RenderIndex owned by this delegate.
415  HdRenderIndex& GetRenderIndex() { return *_index; }
416 
417  /// Returns the ID of this delegate, which is used as a prefix for all
418  /// objects it creates in the RenderIndex.
419  ///
420  /// The default value is SdfPath::AbsoluteRootPath().
421  SdfPath const& GetDelegateID() const { return _delegateID; }
422 
423  /// Synchronizes the delegate state for the given request vector.
424  HD_API
425  virtual void Sync(HdSyncRequestVector* request);
426 
427  /// Opportunity for the delegate to clean itself up after
428  /// performing parallel work during sync phase
429  HD_API
430  virtual void PostSyncCleanup();
431 
432  // -----------------------------------------------------------------------//
433  /// \name Options
434  // -----------------------------------------------------------------------//
435 
436  /// Returns true if the named option is enabled by the delegate.
437  HD_API
438  virtual bool IsEnabled(TfToken const& option) const;
439 
440 
441  // -----------------------------------------------------------------------//
442  /// \name Rprim Aspects
443  // -----------------------------------------------------------------------//
444 
445  /// Gets the topological mesh data for a given prim.
446  HD_API
447  virtual HdMeshTopology GetMeshTopology(SdfPath const& id);
448 
449  /// Gets the topological curve data for a given prim.
450  HD_API
452 
453  /// Gets the subdivision surface tags (sharpness, holes, etc).
454  HD_API
455  virtual PxOsdSubdivTags GetSubdivTags(SdfPath const& id);
456 
457 
458  /// Gets the axis aligned bounds of a prim.
459  /// The returned bounds are in the local space of the prim
460  /// (transform is yet to be applied) and should contain the
461  /// bounds of any child prims.
462  ///
463  /// The returned bounds does not include any displacement that
464  /// might occur as the result of running shaders on the prim.
465  HD_API
466  virtual GfRange3d GetExtent(SdfPath const & id);
467 
468  /// Returns the object space transform, including all parent transforms.
469  HD_API
470  virtual GfMatrix4d GetTransform(SdfPath const & id);
471 
472  /// Returns the authored visible state of the prim.
473  HD_API
474  virtual bool GetVisible(SdfPath const & id);
475 
476  /// Returns the doubleSided state for the given prim.
477  HD_API
478  virtual bool GetDoubleSided(SdfPath const & id);
479 
480  /// Returns the cullstyle for the given prim.
481  HD_API
482  virtual HdCullStyle GetCullStyle(SdfPath const &id);
483 
484  /// Returns the shading style for the given prim.
485  HD_API
486  virtual VtValue GetShadingStyle(SdfPath const &id);
487 
488  /// Returns the display style for the given prim.
489  HD_API
490  virtual HdDisplayStyle GetDisplayStyle(SdfPath const& id);
491 
492  /// Returns a named value.
493  HD_API
494  virtual VtValue Get(SdfPath const& id, TfToken const& key);
495 
496  /// Returns a named primvar value. If \a *outIndices is not nullptr and the
497  /// primvar has indices, it will return the unflattened primvar and set
498  /// \a *outIndices to the primvar's associated indices, clearing the array
499  /// if the primvar is not indexed.
500  HD_API
501  virtual VtValue GetIndexedPrimvar(SdfPath const& id,
502  TfToken const& key,
503  VtIntArray *outIndices);
504 
505  /// Returns the authored repr (if any) for the given prim.
506  HD_API
507  virtual HdReprSelector GetReprSelector(SdfPath const &id);
508 
509  /// Returns the render tag that will be used to bucket prims during
510  /// render pass bucketing.
511  HD_API
512  virtual TfToken GetRenderTag(SdfPath const& id);
513 
514  /// Returns the prim categories. For instancer prims, the categories
515  /// returned apply to all its instances.
516  HD_API
517  virtual VtArray<TfToken> GetCategories(SdfPath const& id);
518 
519  /// Returns the categories for each of the instances in the instancer.
520  HD_API
521  virtual std::vector<VtArray<TfToken>>
522  GetInstanceCategories(SdfPath const &instancerId);
523 
524  /// Returns the coordinate system bindings, or a nullptr if none are bound.
525  HD_API
527 
528  /// Returns the model draw mode object for the given prim.
529  HD_API
530  virtual HdModelDrawMode GetModelDrawMode(SdfPath const& id);
531 
532  // -----------------------------------------------------------------------//
533  /// \name Motion samples
534  // -----------------------------------------------------------------------//
535 
536  /// Store up to \a maxSampleCount transform samples in \a *sampleValues.
537  /// Fills the given \a sampleValues and \a sampleTimes arrays with the
538  /// authored samples that contribute to the delegate's current shutter
539  /// interval and their frame-relative times. If a shutter interval boundary
540  /// falls between authored sample times, the bracketing sample(s) are
541  /// included, which will lie outside the shutter interval. It is the
542  /// caller's responsibility to interpolate the bracketing samples to the
543  /// shutter interval if desired.
544  ///
545  /// If the number of contributing sample times is greater than
546  /// maxSampleCount, you might want to call this function again to get all
547  /// the authored data.
548  ///
549  /// Sample times are relative to the scene delegate's current time.
550  /// \see GetTransform()
551  HD_API
552  virtual size_t
553  SampleTransform(SdfPath const & id,
554  size_t maxSampleCount,
555  float *sampleTimes,
556  GfMatrix4d *sampleValues);
557 
558  /// An overload of SampleTransform that takes frame-relative \a startTime
559  /// and \a endTime, rather than relying on the scene delegate's internal
560  /// state to define the shutter interval.
561  HD_API
562  virtual size_t
563  SampleTransform(SdfPath const & id,
564  float startTime,
565  float endTime,
566  size_t maxSampleCount,
567  float *sampleTimes,
568  GfMatrix4d *sampleValues);
569 
570  /// Convenience form of SampleTransform that takes an HdTimeSampleArray.
571  /// This function fills the given HdTimeSampleArray with the contributing
572  /// samples and their times for the delegate's current shutter interval.
573  template <unsigned int CAPACITY>
574  void
575  SampleTransform(SdfPath const & id,
577 
578  /// Convenience form of SampleTransform that takes an explict interval and
579  /// an HdTimeSampleArray. This function fills the given HdTimeSampleArray
580  /// with the contributing samples and their times for the given frame-
581  /// relative shutter interval.
582  template <unsigned int CAPACITY>
583  void
584  SampleTransform(SdfPath const & id,
585  float startTime,
586  float endTime,
588 
589  /// Store up to \a maxSampleCount transform samples in \a *sampleValues.
590  /// Fills the given \a sampleValues and \a sampleTimes arrays with the
591  /// authored samples that contribute to the delegate's current shutter
592  /// interval and their frame-relative times. If a shutter interval boundary
593  /// falls between authored sample times, the bracketing sample(s) are
594  /// included, which will lie outside the shutter interval. It is the
595  /// caller's responsibility to interpolate the bracketing samples to the
596  /// shutter interval if desired.
597  ///
598  /// If the number of contributing sample times is greater than
599  /// maxSampleCount, you might want to call this function again to get all
600  /// the authored data.
601  ///
602  /// Sample times are relative to the scene delegate's current time.
603  /// \see GetInstancerTransform()
604  HD_API
605  virtual size_t
606  SampleInstancerTransform(SdfPath const &instancerId,
607  size_t maxSampleCount,
608  float *sampleTimes,
609  GfMatrix4d *sampleValues);
610 
611  /// An overload of SampleInstancerTransform that takes frame-relative
612  /// \a startTime and \a endTime, rather than relying on the scene delegate's
613  /// internal state to define the shutter interval.
614  HD_API
615  virtual size_t
616  SampleInstancerTransform(SdfPath const &instancerId,
617  float startTime,
618  float endTime,
619  size_t maxSampleCount,
620  float *sampleTimes,
621  GfMatrix4d *sampleValues);
622 
623  /// Convenience form of SampleInstancerTransform that takes an
624  /// HdTimeSampleArray. This function fills the given HdTimeSampleArray with
625  /// the contributing samples and their times for the delegate's current
626  /// shutter interval.
627  template <unsigned int CAPACITY>
628  void
629  SampleInstancerTransform(SdfPath const &instancerId,
631 
632  /// Convenience form of SampleInstancerTransform that takes an explict
633  /// interval and an HdTimeSampleArray. This function fills the given
634  /// HdTimeSampleArray with the contributing samples and their times for the
635  /// given frame-relative shutter interval.
636  template <unsigned int CAPACITY>
637  void
638  SampleInstancerTransform(SdfPath const &instancerId,
639  float startTime, float endTime,
641 
642  /// Store up to \a maxSampleCount primvar samples in \a *samplesValues.
643  /// Fills the given \a sampleValues and \a sampleTimes arrays with the
644  /// authored samples that contribute to the delegate's current shutter
645  /// interval and their frame-relative times. If a shutter interval boundary
646  /// falls between authored sample times, the bracketing sample(s) are
647  /// included, which will lie outside the shutter interval. It is the
648  /// caller's responsibility to interpolate the bracketing samples to the
649  /// shutter interval if desired.
650  ///
651  /// If the number of contributing sample times is greater than
652  /// maxSampleCount, you might want to call this function again to get all
653  /// the authored data.
654  ///
655  /// Sample values that are array-valued will have a size described
656  /// by the HdPrimvarDescriptor as applied to the toplogy.
657  ///
658  /// For example, this means that a mesh that is fracturing over time
659  /// will return samples with the same number of points; the number
660  /// of points will change as the scene delegate is resynchronized
661  /// to represent the scene at a time with different topology.
662  ///
663  /// Sample times are relative to the scene delegate's current time.
664  ///
665  /// \see Get()
666  HD_API
667  virtual size_t
668  SamplePrimvar(SdfPath const& id,
669  TfToken const& key,
670  size_t maxSampleCount,
671  float *sampleTimes,
672  VtValue *sampleValues);
673 
674  /// An overload of SamplePrimvar that takes frame-relative \a startTime and
675  /// \a endTime, rather than relying on the scene delegate's internal state
676  /// to define the shutter interval.
677  HD_API
678  virtual size_t
679  SamplePrimvar(SdfPath const& id,
680  TfToken const& key,
681  float startTime,
682  float endTime,
683  size_t maxSampleCount,
684  float *sampleTimes,
685  VtValue *sampleValues);
686 
687  /// Convenience form of SamplePrimvar that takes an HdTimeSampleArray.
688  /// This function fills the given HdTimeSampleArray with the contributing
689  /// samples and their times for the delegate's current shutter interval.
690  template <unsigned int CAPACITY>
691  void
692  SamplePrimvar(SdfPath const &id,
693  TfToken const& key,
695 
696  /// Convenience form of SamplePrimvar that takes an explict interval and
697  /// an HdTimeSampleArray. This function fills the given HdTimeSampleArray
698  /// with the contributing samples and their times for the given frame-
699  /// relative shutter interval.
700  template <unsigned int CAPACITY>
701  void
702  SamplePrimvar(SdfPath const &id,
703  TfToken const& key,
704  float startTime,
705  float endTime,
707 
708  /// SamplePrimvar() for getting an unflattened primvar and its indices. If
709  /// \a *sampleIndices is not nullptr and the primvar has indices, it will
710  /// return unflattened primvar samples in \a *sampleValues and the primvar's
711  /// sampled indices in \a *sampleIndices, clearing the \a *sampleIndices
712  /// array if the primvar is not indexed.
713  HD_API
714  virtual size_t
715  SampleIndexedPrimvar(SdfPath const& id,
716  TfToken const& key,
717  size_t maxSampleCount,
718  float *sampleTimes,
719  VtValue *sampleValues,
720  VtIntArray *sampleIndices);
721 
722  /// An overload of SampleIndexedPrimvar that takes frame-relative
723  /// \a startTime and \a endTime, rather than relying on the scene delegate's
724  /// internal state to define the shutter interval.
725  HD_API
726  virtual size_t
727  SampleIndexedPrimvar(SdfPath const& id,
728  TfToken const& key,
729  float startTime,
730  float endTime,
731  size_t maxSampleCount,
732  float *sampleTimes,
733  VtValue *sampleValues,
734  VtIntArray *sampleIndices);
735 
736  /// Convenience form of SampleIndexedPrimvar that takes an
737  /// HdIndexedTimeSampleArray. This function fills the given
738  /// HdIndexedTimeSampleArray with the contributing samples and their times
739  /// for the delegate's current shutter interval.
740  template <unsigned int CAPACITY>
741  void
742  SampleIndexedPrimvar(SdfPath const &id,
743  TfToken const& key,
745 
746  /// Convenience form of SampleIndexedPrimvar that takes an explict interval
747  /// and an HdIndexedTimeSampleArray. This function fills the given
748  /// HdIndexedTimeSampleArray with the contributing samples and their times
749  /// for the given frame-relative shutter interval.
750  template <unsigned int CAPACITY>
751  void
752  SampleIndexedPrimvar(SdfPath const &id,
753  TfToken const& key,
754  float startTime,
755  float endTime,
757 
758  // -----------------------------------------------------------------------//
759  /// \name Instancer prototypes
760  // -----------------------------------------------------------------------//
761 
762  /// Gets the extracted indices array of the prototype id used in the
763  /// instancer.
764  ///
765  /// example
766  /// instances: 0, 1, 2, 3, 4, 5
767  /// protoypes: A, B, A, A, B, C
768  ///
769  /// GetInstanceIndices(A) : [0, 2, 3]
770  /// GetInstanceIndices(B) : [1, 4]
771  /// GetInstanceIndices(C) : [5]
772  /// GetInstanceIndices(D) : []
773  ///
774  HD_API
775  virtual VtIntArray GetInstanceIndices(SdfPath const &instancerId,
776  SdfPath const &prototypeId);
777 
778  /// Returns the instancer transform.
779  HD_API
780  virtual GfMatrix4d GetInstancerTransform(SdfPath const &instancerId);
781 
782  /// Returns the parent instancer of the given rprim or instancer.
783  HD_API
784  virtual SdfPath GetInstancerId(SdfPath const& primId);
785 
786  /// Returns a list of prototypes of this instancer. The intent is to let
787  /// renderers cache instance indices by giving them a complete set of prims
788  /// to call GetInstanceIndices(instancer, prototype) on.
789  /// XXX: This is currently unused, but may be used in the future.
790  HD_API
791  virtual SdfPathVector GetInstancerPrototypes(SdfPath const& instancerId);
792 
793  // -----------------------------------------------------------------------//
794  /// \name Path Translation
795  // -----------------------------------------------------------------------//
796 
797  /// Returns the scene address of the prim corresponding to the given
798  /// rprim/instance index. This is designed to give paths in scene namespace,
799  /// rather than hydra namespace, so it always strips the delegate ID.
800  /// \deprecated use GetScenePrimPaths
801  HD_API
802  virtual SdfPath GetScenePrimPath(SdfPath const& rprimId,
803  int instanceIndex,
804  HdInstancerContext *instancerContext = nullptr);
805 
806  /// A vectorized version of GetScenePrimPath that allows the prim adapter
807  /// to amortize expensive calculations across a number of path evaluations
808  /// in a single call. Note that only a single rprimId is supported. This
809  /// allows this call to be forwarded directly to a single prim adapter
810  /// rather than requiring a lot of data shuffling.
811  HD_API
812  virtual SdfPathVector GetScenePrimPaths(SdfPath const& rprimId,
813  std::vector<int> instanceIndices,
814  std::vector<HdInstancerContext> *instancerContexts = nullptr);
815 
816  /// Returns an identifier that can be used to share data between HdPrims
817  /// during a Sync operation. Any number of HdPrims of the same type may
818  /// return the same identifier. In this situation, the render delegate
819  /// can choose to share information between HdPrims rather than fetching
820  /// data for each HdPrim. For the UsdImagingSceneDelegate, this identifier
821  /// will be the path of the GetPrototype prim for the UsdPrim correspnding
822  /// to this HdPrim. Returns an empty SdfPath if this feature is no
823  /// supported or the UsdPrim has no prototype. Render delegates are free
824  /// to ignore this method completely if they aren't interested in the
825  /// additional level of data sharing enabled by this information.
826  HD_API
827  virtual SdfPath GetDataSharingId(SdfPath const& primId);
828 
829  // -----------------------------------------------------------------------//
830  /// \name Material Aspects
831  // -----------------------------------------------------------------------//
832 
833  /// Returns the material ID bound to the rprim \p rprimId.
834  HD_API
835  virtual SdfPath GetMaterialId(SdfPath const &rprimId);
836 
837  // Returns a material resource which contains the information
838  // needed to create a material.
839  HD_API
840  virtual VtValue GetMaterialResource(SdfPath const &materialId);
841 
842  // -----------------------------------------------------------------------//
843  /// \name Renderbuffer Aspects
844  // -----------------------------------------------------------------------//
845 
846  /// Returns the allocation descriptor for a given render buffer prim.
847  HD_API
849 
850  // -----------------------------------------------------------------------//
851  /// \name Light Aspects
852  // -----------------------------------------------------------------------//
853 
854  // Returns a single value for a given light and parameter.
855  HD_API
856  virtual VtValue GetLightParamValue(SdfPath const &id,
857  TfToken const &paramName);
858 
859  // -----------------------------------------------------------------------//
860  /// \name Camera Aspects
861  // -----------------------------------------------------------------------//
862 
863  /// Returns a single value for a given camera and parameter.
864  /// See HdCameraTokens for the list of paramters.
865  HD_API
866  virtual VtValue GetCameraParamValue(SdfPath const& cameraId,
867  TfToken const& paramName);
868 
869  // -----------------------------------------------------------------------//
870  /// \name Volume Aspects
871  // -----------------------------------------------------------------------//
872 
873  // Returns a single value for a given volume and parameter.
874  HD_API
875  virtual VtValue GetVolumeParamValue(SdfPath const &id,
876  TfToken const &paramName);
877 
878  HD_API
880  GetVolumeFieldDescriptors(SdfPath const &volumeId);
881 
882  // -----------------------------------------------------------------------//
883  /// \name ExtComputation Aspects
884  // -----------------------------------------------------------------------//
885 
886  ///
887  /// For the given computation id, returns a list of inputs which
888  /// will be requested from the scene delegate using the Get() method.
889  ///
890  /// See GetExtComputationInputDescriptors and
891  /// GetExtComputationOutpuDescriptors for descriptions of other
892  /// computation inputs and outputs.
893  HD_API
894  virtual TfTokenVector
895  GetExtComputationSceneInputNames(SdfPath const& computationId);
896 
897  ///
898  /// For the given computation id, returns a list of computation
899  /// input descriptors.
900  ///
901  /// See HdExtComputationInputDecriptor
902  HD_API
904  GetExtComputationInputDescriptors(SdfPath const& computationId);
905 
906  /// For the given computation id, returns a list of computation
907  /// output descriptors.
908  ///
909  /// See HdExtComputationOutputDescriptor
910  HD_API
912  GetExtComputationOutputDescriptors(SdfPath const& computationId);
913 
914 
915  /// Returns a list of primvar names that should be bound to
916  /// a generated output from an ExtComputation for the given prim id and
917  /// interpolation mode. Binding information is obtained through
918  /// GetExtComputationPrimvarDesc()
919  /// Returns a structure describing source information for a primvar
920  /// that is bound to an ExtComputation. See HdExtComputationPrimvarDesc
921  /// for the expected information to be returned.
922  HD_API
925  HdInterpolation interpolationMode);
926 
927  /// Returns a single value for a given computation id and input token.
928  /// The token may be a computation input or a computation config parameter.
929  HD_API
930  virtual VtValue GetExtComputationInput(SdfPath const& computationId,
931  TfToken const& input);
932 
933  /// Return up to \a maxSampleCount samples for a given computation id and
934  /// input token.
935  /// The token may be a computation input or a computation config parameter.
936  /// Returns the union of the authored samples and the boundaries
937  /// of the current camera shutter interval. If this number is greater
938  /// than maxSampleCount, you might want to call this function again
939  /// to get all the authored data.
940  HD_API
941  virtual size_t SampleExtComputationInput(SdfPath const& computationId,
942  TfToken const& input,
943  size_t maxSampleCount,
944  float *sampleTimes,
945  VtValue *sampleValues);
946 
947  // An overload of SampleTransform that explicitly takes the startTime
948  // and endTime rather than relying on the scene delegate having state
949  // about what the source of the current shutter interval should be.
950  HD_API
951  virtual size_t SampleExtComputationInput(SdfPath const& computationId,
952  TfToken const& input,
953  float startTime,
954  float endTime,
955  size_t maxSampleCount,
956  float *sampleTimes,
957  VtValue *sampleValues);
958 
959  /// Convenience form of SampleExtComputationInput() that takes an
960  /// HdTimeSampleArray.
961  /// Returns the union of the authored samples and the boundaries
962  /// of the current camera shutter interval.
963  template <unsigned int CAPACITY>
964  void SampleExtComputationInput(SdfPath const& computationId,
965  TfToken const& input,
967 
968  /// Convenience form of SampleExtComputationInput() that takes an
969  /// HdTimeSampleArray.
970  /// Returns the union of the authored samples and the boundaries
971  /// of the current camera shutter interval.
972  template <unsigned int CAPACITY>
973  void SampleExtComputationInput(SdfPath const& computationId,
974  TfToken const& input,
975  float startTime,
976  float endTime,
978 
979  /// Returns the kernel source assigned to the computation at the path id.
980  /// If the string is empty the computation has no GPU kernel and the
981  /// CPU callback should be used.
982  HD_API
983  virtual std::string GetExtComputationKernel(SdfPath const& computationId);
984 
985  /// Requests the scene delegate run the ExtComputation with the given id.
986  /// The context contains the input values that delegate requested through
987  /// GetExtComputationInputNames().
988  ///
989  /// The scene delegate is expected to set each output identified by
990  /// GetExtComputationOutputNames() on the context.
991  ///
992  /// Hydra may invoke the computation on a different thread from
993  /// what HdEngine::Execute() was called on. It may also invoke
994  /// many computations in parallel.
995  HD_API
996  virtual void InvokeExtComputation(SdfPath const& computationId,
997  HdExtComputationContext *context);
998 
999  // -----------------------------------------------------------------------//
1000  /// \name Primitive Variables
1001  // -----------------------------------------------------------------------//
1002 
1003  /// Returns descriptors for all primvars of the given interpolation type.
1004  HD_API
1006  GetPrimvarDescriptors(SdfPath const& id, HdInterpolation interpolation);
1007 
1008  // -----------------------------------------------------------------------//
1009  /// \name Task Aspects
1010  // -----------------------------------------------------------------------//
1011  HD_API
1012  virtual TfTokenVector GetTaskRenderTags(SdfPath const& taskId);
1013 
1014 private:
1015  HdRenderIndex *_index;
1016  SdfPath _delegateID;
1017 
1018  HdSceneDelegate() = delete;
1019  HdSceneDelegate(HdSceneDelegate &) = delete;
1020  HdSceneDelegate &operator=(HdSceneDelegate &) = delete;
1021 };
1022 
1023 template <unsigned int CAPACITY>
1024 void
1027  size_t authoredSamples =
1028  SampleTransform(id, CAPACITY, sa->times.data(), sa->values.data());
1029  if (authoredSamples > CAPACITY) {
1030  sa->Resize(authoredSamples);
1031  size_t authoredSamplesSecondAttempt =
1033  id,
1034  authoredSamples,
1035  sa->times.data(),
1036  sa->values.data());
1037  // Number of samples should be consisntent through multiple
1038  // invokations of the sampling function.
1039  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1040  }
1041  sa->count = authoredSamples;
1042 }
1043 
1044 template <unsigned int CAPACITY>
1045 void
1047  float startTime,
1048  float endTime,
1050  size_t authoredSamples =
1051  SampleTransform(id, startTime, endTime, CAPACITY,
1052  sa->times.data(), sa->values.data());
1053  if (authoredSamples > CAPACITY) {
1054  sa->Resize(authoredSamples);
1055  size_t authoredSamplesSecondAttempt =
1057  id,
1058  startTime,
1059  endTime,
1060  authoredSamples,
1061  sa->times.data(),
1062  sa->values.data());
1063  // Number of samples should be consisntent through multiple
1064  // invokations of the sampling function.
1065  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1066  }
1067  sa->count = authoredSamples;
1068 }
1069 
1070 template <unsigned int CAPACITY>
1071 void
1073  SdfPath const &instancerId,
1075  size_t authoredSamples =
1077  instancerId,
1078  CAPACITY,
1079  sa->times.data(),
1080  sa->values.data());
1081  if (authoredSamples > CAPACITY) {
1082  sa->Resize(authoredSamples);
1083  size_t authoredSamplesSecondAttempt =
1085  instancerId,
1086  authoredSamples,
1087  sa->times.data(),
1088  sa->values.data());
1089  // Number of samples should be consisntent through multiple
1090  // invokations of the sampling function.
1091  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1092  }
1093  sa->count = authoredSamples;
1094 }
1095 
1096 template <unsigned int CAPACITY>
1097 void
1099  SdfPath const &instancerId,
1100  float startTime, float endTime,
1102  size_t authoredSamples =
1104  instancerId,
1105  startTime,
1106  endTime,
1107  CAPACITY,
1108  sa->times.data(),
1109  sa->values.data());
1110  if (authoredSamples > CAPACITY) {
1111  sa->Resize(authoredSamples);
1112  size_t authoredSamplesSecondAttempt =
1114  instancerId,
1115  startTime,
1116  endTime,
1117  authoredSamples,
1118  sa->times.data(),
1119  sa->values.data());
1120  // Number of samples should be consisntent through multiple
1121  // invokations of the sampling function.
1122  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1123  }
1124  sa->count = authoredSamples;
1125 }
1126 
1127 template <unsigned int CAPACITY>
1128 void
1130  TfToken const& key,
1132  size_t authoredSamples =
1133  SamplePrimvar(
1134  id,
1135  key,
1136  CAPACITY,
1137  sa->times.data(),
1138  sa->values.data());
1139  if (authoredSamples > CAPACITY) {
1140  sa->Resize(authoredSamples);
1141  size_t authoredSamplesSecondAttempt =
1142  SamplePrimvar(
1143  id,
1144  key,
1145  authoredSamples,
1146  sa->times.data(),
1147  sa->values.data());
1148  // Number of samples should be consistent through multiple
1149  // invocations of the sampling function.
1150  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1151  }
1152  sa->count = authoredSamples;
1153 }
1154 
1155 template <unsigned int CAPACITY>
1156 void
1158  TfToken const& key,
1159  float startTime,
1160  float endTime,
1162  size_t authoredSamples =
1163  SamplePrimvar(
1164  id,
1165  key,
1166  startTime,
1167  endTime,
1168  CAPACITY,
1169  sa->times.data(),
1170  sa->values.data());
1171  if (authoredSamples > CAPACITY) {
1172  sa->Resize(authoredSamples);
1173  size_t authoredSamplesSecondAttempt =
1174  SamplePrimvar(
1175  id,
1176  key,
1177  startTime,
1178  endTime,
1179  authoredSamples,
1180  sa->times.data(),
1181  sa->values.data());
1182  // Number of samples should be consistent through multiple
1183  // invocations of the sampling function.
1184  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1185  }
1186  sa->count = authoredSamples;
1187 }
1188 
1189 template <unsigned int CAPACITY>
1190 void
1192  TfToken const& key,
1194  size_t authoredSamples =
1196  id,
1197  key,
1198  CAPACITY,
1199  sa->times.data(),
1200  sa->values.data(),
1201  sa->indices.data());
1202  if (authoredSamples > CAPACITY) {
1203  sa->Resize(authoredSamples);
1204  size_t authoredSamplesSecondAttempt =
1206  id,
1207  key,
1208  authoredSamples,
1209  sa->times.data(),
1210  sa->values.data(),
1211  sa->indices.data());
1212  // Number of samples should be consistent through multiple
1213  // invocations of the sampling function.
1214  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1215  }
1216  sa->count = authoredSamples;
1217 }
1218 
1219 template <unsigned int CAPACITY>
1220 void
1222  TfToken const& key,
1223  float startTime,
1224  float endTime,
1226  size_t authoredSamples =
1228  id,
1229  key,
1230  startTime,
1231  endTime,
1232  CAPACITY,
1233  sa->times.data(),
1234  sa->values.data(),
1235  sa->indices.data());
1236  if (authoredSamples > CAPACITY) {
1237  sa->Resize(authoredSamples);
1238  size_t authoredSamplesSecondAttempt =
1240  id,
1241  key,
1242  startTime,
1243  endTime,
1244  authoredSamples,
1245  sa->times.data(),
1246  sa->values.data(),
1247  sa->indices.data());
1248  // Number of samples should be consistent through multiple
1249  // invocations of the sampling function.
1250  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1251  }
1252  sa->count = authoredSamples;
1253 }
1254 
1255 template <unsigned int CAPACITY>
1256 void
1258  SdfPath const& computationId,
1259  TfToken const& input,
1261  size_t authoredSamples = SampleExtComputationInput(
1262  computationId, input, CAPACITY,
1263  sa->times.data(), sa->values.data());
1264 
1265  if (authoredSamples > CAPACITY) {
1266  sa->Resize(authoredSamples);
1267  size_t authoredSamplesSecondAttempt = SampleExtComputationInput(
1268  computationId, input, authoredSamples,
1269  sa->times.data(), sa->values.data());
1270  // Number of samples should be consisntent through multiple
1271  // invokations of the sampling function.
1272  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1273  }
1274  sa->count = authoredSamples;
1275 }
1276 
1277 template <unsigned int CAPACITY>
1278 void
1280  SdfPath const& computationId,
1281  TfToken const& input,
1282  float startTime,
1283  float endTime,
1285  size_t authoredSamples = SampleExtComputationInput(
1286  computationId, input, startTime, endTime, CAPACITY,
1287  sa->times.data(), sa->values.data());
1288 
1289  if (authoredSamples > CAPACITY) {
1290  sa->Resize(authoredSamples);
1291  size_t authoredSamplesSecondAttempt = SampleExtComputationInput(
1292  computationId, input, startTime, endTime, authoredSamples,
1293  sa->times.data(), sa->values.data());
1294  // Number of samples should be consisntent through multiple
1295  // invokations of the sampling function.
1296  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
1297  }
1298  sa->count = authoredSamples;
1299 }
1300 
1302 
1303 #endif //PXR_IMAGING_HD_SCENE_DELEGATE_H
std::shared_ptr< SdfPathVector > HdIdVectorSharedPtr
A shared pointer to a vector of id's.
Definition: sceneDelegate.h:38
SdfAssetPath cardTextureXNeg
HdDisplayStyle(int refineLevel_, bool flatShading=false, bool displacement=true, bool displayInOverlay_=false, bool occludedSelectionShowsThrough_=false, bool pointsShadingEnabled_=false, bool materialIsFinal_=false)
virtual HD_API VtValue GetExtComputationInput(SdfPath const &computationId, TfToken const &input)
virtual HD_API SdfPath GetScenePrimPath(SdfPath const &rprimId, int instanceIndex, HdInstancerContext *instancerContext=nullptr)
bool operator==(HdExtComputationOutputDescriptor const &rhs) const
virtual HD_API size_t SamplePrimvar(SdfPath const &id, TfToken const &key, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues)
TfToken cardGeometry
HdCullStyle
Definition: enums.h:105
virtual HD_API void PostSyncCleanup()
bool operator!=(HdExtComputationInputDescriptor const &rhs) const
SdfAssetPath cardTextureZNeg
virtual HD_API VtValue GetIndexedPrimvar(SdfPath const &id, TfToken const &key, VtIntArray *outIndices)
virtual HD_API void InvokeExtComputation(SdfPath const &computationId, HdExtComputationContext *context)
virtual HD_API SdfPath GetDataSharingId(SdfPath const &primId)
TfSmallVector< float, CAPACITY > times
SdfAssetPath cardTextureXPos
virtual HD_API bool GetVisible(SdfPath const &id)
Returns the authored visible state of the prim.
virtual HD_API SdfPath GetInstancerId(SdfPath const &primId)
Returns the parent instancer of the given rprim or instancer.
bool operator!=(HdPrimvarDescriptor const &rhs) const
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
~HdDisplayStyle()=default
bool operator!=(HdExtComputationPrimvarDescriptor const &rhs) const
std::vector< HdExtComputationInputDescriptor > HdExtComputationInputDescriptorVector
#define TF_CODING_ERROR
virtual HD_API HdVolumeFieldDescriptorVector GetVolumeFieldDescriptors(SdfPath const &volumeId)
virtual HD_API HdExtComputationInputDescriptorVector GetExtComputationInputDescriptors(SdfPath const &computationId)
bool operator!=(HdExtComputationOutputDescriptor const &rhs) const
Definition: vec3f.h:45
virtual HD_API std::string GetExtComputationKernel(SdfPath const &computationId)
#define HD_API
Definition: api.h:23
virtual HD_API bool IsEnabled(TfToken const &option) const
Returns true if the named option is enabled by the delegate.
GfVec3f drawModeColor
virtual HD_API SdfPathVector GetInstancerPrototypes(SdfPath const &instancerId)
HdVolumeFieldDescriptor(TfToken const &fieldName_, TfToken const &fieldPrimType_, SdfPath const &fieldId_)
std::vector< HdExtComputationOutputDescriptor > HdExtComputationOutputDescriptorVector
virtual HD_API size_t SampleIndexedPrimvar(SdfPath const &id, TfToken const &key, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues, VtIntArray *sampleIndices)
virtual HD_API GfMatrix4d GetInstancerTransform(SdfPath const &instancerId)
Returns the instancer transform.
bool operator!=(HdModelDrawMode const &rhs) const
HdExtComputationInputDescriptor(TfToken const &name_, SdfPath const &sourceComputationId_, TfToken const &sourceComputationOutputName_)
HdPrimvarDescriptor(TfToken const &name_, HdInterpolation interp_, TfToken const &role_=HdPrimvarRoleTokens->none, bool indexed_=false)
virtual HD_API HdBasisCurvesTopology GetBasisCurvesTopology(SdfPath const &id)
Gets the topological curve data for a given prim.
bool operator==(HdExtComputationInputDescriptor const &rhs) const
virtual HD_API PxOsdSubdivTags GetSubdivTags(SdfPath const &id)
Gets the subdivision surface tags (sharpness, holes, etc).
virtual HD_API HdIdVectorSharedPtr GetCoordSysBindings(SdfPath const &id)
Returns the coordinate system bindings, or a nullptr if none are bound.
HdExtComputationPrimvarDescriptor(TfToken const &name_, HdInterpolation interp_, TfToken const &role_, SdfPath const &sourceComputationId_, TfToken const &sourceComputationOutputName_, HdTupleType const &valueType_)
std::vector< std::pair< SdfPath, int > > HdInstancerContext
Instancer context: a pair of instancer paths and instance indices.
Definition: sceneDelegate.h:44
bool displayInOverlay
Is the prim overlayed on top of other prims.
Definition: sceneDelegate.h:78
virtual HD_API VtValue GetMaterialResource(SdfPath const &materialId)
Returns the material ID bound to the rprim rprimId.
bool occludedSelectionShowsThrough
Definition: sceneDelegate.h:82
Definition: token.h:70
virtual HD_API HdDisplayStyle GetDisplayStyle(SdfPath const &id)
Returns the display style for the given prim.
virtual HD_API VtArray< TfToken > GetCategories(SdfPath const &id)
HdInterpolation interpolation
Interpolation (data-sampling rate) of the primvar.
std::vector< class SdfPath > SdfPathVector
virtual HD_API VtValue GetLightParamValue(SdfPath const &id, TfToken const &paramName)
bool pointsShadingEnabled
Definition: sceneDelegate.h:86
TfToken name
Name of the primvar.
HdRenderIndex & GetRenderIndex()
Returns the RenderIndex owned by this delegate.
bool operator==(HdDisplayStyle const &rhs) const
SdfAssetPath cardTextureZPos
virtual HD_API HdPrimvarDescriptorVector GetPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolation)
Returns descriptors for all primvars of the given interpolation type.
virtual HD_API GfMatrix4d GetTransform(SdfPath const &id)
Returns the object space transform, including all parent transforms.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
bool displacementEnabled
Is the prim displacement shaded.
Definition: sceneDelegate.h:75
virtual HD_API GfRange3d GetExtent(SdfPath const &id)
std::vector< HdDirtyBits > dirtyBits
Definition: sceneDelegate.h:57
virtual HD_API TfToken GetRenderTag(SdfPath const &id)
GLuint const GLchar * name
Definition: glcorearb.h:786
bool operator==(HdExtComputationPrimvarDescriptor const &rhs) const
Definition: path.h:280
virtual HD_API size_t SampleTransform(SdfPath const &id, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues)
bool operator==(HdModelDrawMode const &rhs) const
std::vector< HdVolumeFieldDescriptor > HdVolumeFieldDescriptorVector
TfSmallVector< TYPE, CAPACITY > values
virtual HD_API SdfPath GetMaterialId(SdfPath const &rprimId)
Returns the material ID bound to the rprim rprimId.
SdfPath const & GetDelegateID() const
virtual HD_API HdModelDrawMode GetModelDrawMode(SdfPath const &id)
Returns the model draw mode object for the given prim.
virtual HD_API void Sync(HdSyncRequestVector *request)
Synchronizes the delegate state for the given request vector.
virtual void Resize(unsigned int newSize)
Resize the internal buffers.
void Resize(unsigned int newSize) override
Resize the internal buffers.
virtual HD_API VtValue Get(SdfPath const &id, TfToken const &key)
Returns a named value.
virtual HD_API VtValue GetCameraParamValue(SdfPath const &cameraId, TfToken const &paramName)
virtual HD_API size_t SampleExtComputationInput(SdfPath const &computationId, TfToken const &input, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues)
bool operator!=(HdDisplayStyle const &rhs) const
bool flatShadingEnabled
Is the prim flat shaded.
Definition: sceneDelegate.h:72
virtual HD_API HdMeshTopology GetMeshTopology(SdfPath const &id)
Gets the topological mesh data for a given prim.
virtual HD_API VtValue GetVolumeParamValue(SdfPath const &id, TfToken const &paramName)
virtual HD_API ~HdSceneDelegate()
HdModelDrawMode(TfToken const &drawMode_, bool applyDrawMode_=false, GfVec3f drawModeColor_=GfVec3f(0.18), TfToken const &cardGeometry_=HdModelDrawModeTokens->cross, SdfAssetPath cardTextureXPos_=SdfAssetPath(), SdfAssetPath cardTextureYPos_=SdfAssetPath(), SdfAssetPath cardTextureZPos_=SdfAssetPath(), SdfAssetPath cardTextureXNeg_=SdfAssetPath(), SdfAssetPath cardTextureYNeg_=SdfAssetPath(), SdfAssetPath cardTextureZNeg_=SdfAssetPath())
DrawModeColor is specified in the rendering color space.
HdExtComputationOutputDescriptor(TfToken const &name_, HdTupleType const &valueType_)
virtual HD_API TfTokenVector GetExtComputationSceneInputNames(SdfPath const &computationId)
HdInterpolation
Definition: enums.h:177
virtual HD_API TfTokenVector GetTaskRenderTags(SdfPath const &taskId)
virtual HD_API HdReprSelector GetReprSelector(SdfPath const &id)
Returns the authored repr (if any) for the given prim.
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
virtual HD_API size_t SampleInstancerTransform(SdfPath const &instancerId, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues)
virtual HD_API std::vector< VtArray< TfToken > > GetInstanceCategories(SdfPath const &instancerId)
Returns the categories for each of the instances in the instancer.
virtual HD_API HdCullStyle GetCullStyle(SdfPath const &id)
Returns the cullstyle for the given prim.
SdfPathVector IDs
Definition: sceneDelegate.h:54
virtual HD_API HdRenderBufferDescriptor GetRenderBufferDescriptor(SdfPath const &id)
Returns the allocation descriptor for a given render buffer prim.
virtual HD_API HdExtComputationPrimvarDescriptorVector GetExtComputationPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolationMode)
virtual HD_API VtValue GetShadingStyle(SdfPath const &id)
Returns the shading style for the given prim.
std::vector< HdPrimvarDescriptor > HdPrimvarDescriptorVector
SdfAssetPath cardTextureYPos
bool operator==(HdPrimvarDescriptor const &rhs) const
virtual HD_API HdExtComputationOutputDescriptorVector GetExtComputationOutputDescriptors(SdfPath const &computationId)
SdfAssetPath cardTextureYNeg
virtual HD_API SdfPathVector GetScenePrimPaths(SdfPath const &rprimId, std::vector< int > instanceIndices, std::vector< HdInstancerContext > *instancerContexts=nullptr)
TfSmallVector< VtIntArray, CAPACITY > indices
SIM_DerVector3 cross(const SIM_DerVector3 &lhs, const SIM_DerVector3 &rhs)
Definition: value.h:89
virtual HD_API VtIntArray GetInstanceIndices(SdfPath const &instancerId, SdfPath const &prototypeId)
virtual HD_API bool GetDoubleSided(SdfPath const &id)
Returns the doubleSided state for the given prim.
std::vector< HdExtComputationPrimvarDescriptor > HdExtComputationPrimvarDescriptorVector
value_type * data()
Definition: smallVector.h:735