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 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_IMAGING_HD_SCENE_DELEGATE_H
25 #define PXR_IMAGING_HD_SCENE_DELEGATE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
30 
31 #include "pxr/imaging/hd/aov.h"
33 #include "pxr/imaging/hd/enums.h"
36 #include "pxr/imaging/hd/repr.h"
39 
41 
42 #include "pxr/base/vt/array.h"
43 #include "pxr/base/vt/dictionary.h"
44 #include "pxr/base/vt/value.h"
45 #include "pxr/usd/sdf/path.h"
46 
47 #include "pxr/base/gf/vec2i.h"
48 #include "pxr/base/tf/hash.h"
49 
50 #include <memory>
51 #include <vector>
52 
54 
56 
57 /// A shared pointer to a vector of id's.
58 typedef std::shared_ptr<SdfPathVector> HdIdVectorSharedPtr;
59 
60 /// Instancer context: a pair of instancer paths and instance indices.
61 typedef std::vector<std::pair<SdfPath, int>> HdInstancerContext;
62 
63 /// \class HdSyncRequestVector
64 ///
65 /// The SceneDelegate is requested to synchronize prims as the result of
66 /// executing a specific render pass, the following data structure is passed
67 /// back to the delegate to drive synchronization.
68 ///
70  // The Prims to synchronize in this request.
72 
73  // The HdChangeTracker::DirtyBits that are set for each Prim.
74  std::vector<HdDirtyBits> dirtyBits;
75 };
76 
77 /// \struct HdDisplayStyle
78 ///
79 /// Describes how the geometry of a prim should be displayed.
80 ///
82  /// The prim refine level, in the range [0, 8].
84 
85  /// Is the prim flat shaded.
87 
88  /// Is the prim displacement shaded.
90 
91  /// Creates a default DisplayStyle.
92  /// - refineLevel is 0.
93  /// - flatShading is disabled.
94  /// - displacement is enabled.
96  : refineLevel(0)
97  , flatShadingEnabled(false)
98  , displacementEnabled(true)
99  { }
100 
101  /// Creates a DisplayStyle.
102  /// \param refineLevel_ the refine level to display.
103  /// Valid range is [0, 8].
104  /// \param flatShading enables flat shading, defaults to false.
105  /// \param displacement enables displacement shading, defaults to false.
106  HdDisplayStyle(int refineLevel_,
107  bool flatShading = false,
108  bool displacement = true)
109  : refineLevel(std::max(0, refineLevel_))
110  , flatShadingEnabled(flatShading)
111  , displacementEnabled(displacement)
112  {
113  if (refineLevel_ < 0) {
114  TF_CODING_ERROR("negative refine level is not supported");
115  } else if (refineLevel_ > 8) {
116  TF_CODING_ERROR("refine level > 8 is not supported");
117  }
118  }
119 
120  HdDisplayStyle(HdDisplayStyle const& rhs) = default;
121  ~HdDisplayStyle() = default;
122 
123  bool operator==(HdDisplayStyle const& rhs) const {
124  return refineLevel == rhs.refineLevel
127  }
128  bool operator!=(HdDisplayStyle const& rhs) const {
129  return !(*this == rhs);
130  }
131 };
132 
133 /// \struct HdPrimvarDescriptor
134 ///
135 /// Describes a primvar.
137  /// Name of the primvar.
139  /// Interpolation (data-sampling rate) of the primvar.
141  /// Optional "role" indicating a desired interpretation --
142  /// for example, to distinguish color/vector/point/normal.
143  /// See HdPrimvarRoleTokens; default is HdPrimvarRoleTokens->none.
145 
148  HdInterpolation interp_,
149  TfToken const& role_=HdPrimvarRoleTokens->none)
150  : name(name_), interpolation(interp_), role(role_)
151  { }
152  bool operator==(HdPrimvarDescriptor const& rhs) const {
153  return name == rhs.name && role == rhs.role
154  && interpolation == rhs.interpolation;
155  }
156  bool operator!=(HdPrimvarDescriptor const& rhs) const {
157  return !(*this == rhs);
158  }
159 };
160 
161 typedef std::vector<HdPrimvarDescriptor> HdPrimvarDescriptorVector;
162 
163 /// \struct HdExtComputationPrimvarDescriptor
164 ///
165 /// Extends HdPrimvarDescriptor to describe a primvar that takes
166 /// data from the output of an ExtComputation.
167 ///
168 /// The structure contains the id of the source ExtComputation in the
169 /// render index, the name of an output from that computation from which
170 /// the primvar will take data along with a valueType which describes
171 /// the type of the expected data.
176 
179  TfToken const& name_,
180  HdInterpolation interp_,
181  TfToken const & role_,
182  SdfPath const & sourceComputationId_,
183  TfToken const & sourceComputationOutputName_,
184  HdTupleType const & valueType_)
185  : HdPrimvarDescriptor(name_, interp_, role_)
186  , sourceComputationId(sourceComputationId_)
187  , sourceComputationOutputName(sourceComputationOutputName_)
188  , valueType(valueType_)
189  { }
191  return HdPrimvarDescriptor::operator==(rhs) &&
194  valueType == rhs.valueType;
195  }
197  return !(*this == rhs);
198  }
199 };
200 
201 typedef std::vector<HdExtComputationPrimvarDescriptor>
203 
204 /// \struct HdExtComputationInputDescriptor
205 ///
206 /// Describes an input to an ExtComputation that takes data from
207 /// the output of another ExtComputation.
208 ///
209 /// The structure contains the name of the input and the id of the
210 /// source ExtComputation in the render index, and which output of
211 /// that computation to bind the input to.
216 
219  TfToken const & name_,
220  SdfPath const & sourceComputationId_,
221  TfToken const & sourceComputationOutputName_)
222  : name(name_), sourceComputationId(sourceComputationId_)
223  , sourceComputationOutputName(sourceComputationOutputName_)
224  { }
225 
227  return name == rhs.name &&
230  }
232  return !(*this == rhs);
233  }
234 };
235 
236 typedef std::vector<HdExtComputationInputDescriptor>
238 
239 /// \struct HdExtComputationOutputDescriptor
240 ///
241 /// Describes an output of an ExtComputation.
242 ///
243 /// The structure contains the name of the output along with a valueType
244 /// which describes the type of the computation output data.
248 
251  TfToken const & name_,
252  HdTupleType const & valueType_)
253  : name(name_), valueType(valueType_)
254  { }
255 
257  return name == rhs.name &&
258  valueType == rhs.valueType;
259  }
261  return !(*this == rhs);
262  }
263 };
264 
265 typedef std::vector<HdExtComputationOutputDescriptor>
267 
268 /// \struct HdVolumeFieldDescriptor
269 ///
270 /// Description of a single field related to a volume primitive.
271 ///
276 
279  TfToken const & fieldName_,
280  TfToken const & fieldPrimType_,
281  SdfPath const & fieldId_)
282  : fieldName(fieldName_), fieldPrimType(fieldPrimType_), fieldId(fieldId_)
283  { }
284 };
285 
286 typedef std::vector<HdVolumeFieldDescriptor>
288 
289 /// \class HdSceneDelegate
290 ///
291 /// Adapter class providing data exchange with the client scene graph.
292 ///
294 public:
295  /// Constructor used for nested delegate objects which share a RenderIndex.
296  HD_API
297  HdSceneDelegate(HdRenderIndex *parentIndex,
298  SdfPath const& delegateID);
299 
300  HD_API
301  virtual ~HdSceneDelegate();
302 
303  /// Returns the RenderIndex owned by this delegate.
304  HdRenderIndex& GetRenderIndex() { return *_index; }
305 
306  /// Returns the ID of this delegate, which is used as a prefix for all
307  /// objects it creates in the RenderIndex.
308  ///
309  /// The default value is SdfPath::AbsoluteRootPath().
310  SdfPath const& GetDelegateID() const { return _delegateID; }
311 
312  /// Synchronizes the delegate state for the given request vector.
313  HD_API
314  virtual void Sync(HdSyncRequestVector* request);
315 
316  /// Opportunity for the delegate to clean itself up after
317  /// performing parrellel work during sync phase
318  HD_API
319  virtual void PostSyncCleanup();
320 
321  // -----------------------------------------------------------------------//
322  /// \name Options
323  // -----------------------------------------------------------------------//
324 
325  /// Returns true if the named option is enabled by the delegate.
326  HD_API
327  virtual bool IsEnabled(TfToken const& option) const;
328 
329 
330  // -----------------------------------------------------------------------//
331  /// \name Rprim Aspects
332  // -----------------------------------------------------------------------//
333 
334  /// Gets the topological mesh data for a given prim.
335  HD_API
336  virtual HdMeshTopology GetMeshTopology(SdfPath const& id);
337 
338  /// Gets the topological curve data for a given prim.
339  HD_API
341 
342  /// Gets the subdivision surface tags (sharpness, holes, etc).
343  HD_API
344  virtual PxOsdSubdivTags GetSubdivTags(SdfPath const& id);
345 
346 
347  /// Gets the axis aligned bounds of a prim.
348  /// The returned bounds are in the local space of the prim
349  /// (transform is yet to be applied) and should contain the
350  /// bounds of any child prims.
351  ///
352  /// The returned bounds does not include any displacement that
353  /// might occur as the result of running shaders on the prim.
354  HD_API
355  virtual GfRange3d GetExtent(SdfPath const & id);
356 
357  /// Returns the object space transform, including all parent transforms.
358  HD_API
359  virtual GfMatrix4d GetTransform(SdfPath const & id);
360 
361  /// Returns the authored visible state of the prim.
362  HD_API
363  virtual bool GetVisible(SdfPath const & id);
364 
365  /// Returns the doubleSided state for the given prim.
366  HD_API
367  virtual bool GetDoubleSided(SdfPath const & id);
368 
369  /// Returns the cullstyle for the given prim.
370  HD_API
371  virtual HdCullStyle GetCullStyle(SdfPath const &id);
372 
373  /// Returns the shading style for the given prim.
374  HD_API
375  virtual VtValue GetShadingStyle(SdfPath const &id);
376 
377  /// Returns the refinement level for the given prim in the range [0,8].
378  ///
379  /// The refinement level indicates how many iterations to apply when
380  /// subdividing subdivision surfaces or other refinable primitives.
381  HD_API
382  virtual HdDisplayStyle GetDisplayStyle(SdfPath const& id);
383 
384  /// Returns a named value.
385  HD_API
386  virtual VtValue Get(SdfPath const& id, TfToken const& key);
387 
388  /// Returns the authored repr (if any) for the given prim.
389  HD_API
390  virtual HdReprSelector GetReprSelector(SdfPath const &id);
391 
392  /// Returns the render tag that will be used to bucket prims during
393  /// render pass bucketing.
394  HD_API
395  virtual TfToken GetRenderTag(SdfPath const& id);
396 
397  /// Returns the prim categories.
398  HD_API
399  virtual VtArray<TfToken> GetCategories(SdfPath const& id);
400 
401  /// Returns the categories for all instances in the instancer.
402  HD_API
403  virtual std::vector<VtArray<TfToken>>
404  GetInstanceCategories(SdfPath const &instancerId);
405 
406  /// Returns the coordinate system bindings, or a nullptr if none are bound.
407  HD_API
409 
410  // -----------------------------------------------------------------------//
411  /// \name Motion samples
412  // -----------------------------------------------------------------------//
413 
414  /// Store up to \a maxSampleCount transform samples in \a *sampleValues.
415  /// Returns the union of the authored samples and the boundaries
416  /// of the current camera shutter interval. If this number is greater
417  /// than maxSampleCount, you might want to call this function again
418  /// to get all the authored data.
419  /// Sample times are relative to the scene delegate's current time.
420  /// \see GetTransform()
421  HD_API
422  virtual size_t
423  SampleTransform(SdfPath const & id,
424  size_t maxSampleCount,
425  float *sampleTimes,
426  GfMatrix4d *sampleValues);
427 
428  /// Convenience form of SampleTransform() that takes an HdTimeSampleArray.
429  /// This function returns the union of the authored transform samples
430  /// and the boundaries of the current camera shutter interval.
431  template <unsigned int CAPACITY>
432  void
435  size_t authoredSamples =
436  SampleTransform(id, CAPACITY, sa->times.data(), sa->values.data());
437  if (authoredSamples > CAPACITY) {
438  sa->Resize(authoredSamples);
439  size_t authoredSamplesSecondAttempt =
441  id,
442  authoredSamples,
443  sa->times.data(),
444  sa->values.data());
445  // Number of samples should be consisntent through multiple
446  // invokations of the sampling function.
447  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
448  }
449  sa->count = authoredSamples;
450  }
451 
452  /// Store up to \a maxSampleCount transform samples in \a *sampleValues.
453  /// Returns the union of the authored samples and the boundaries
454  /// of the current camera shutter interval. If this number is greater
455  /// than maxSampleCount, you might want to call this function again
456  /// to get all the authored data.
457  /// Sample times are relative to the scene delegate's current time.
458  /// \see GetInstancerTransform()
459  HD_API
460  virtual size_t
461  SampleInstancerTransform(SdfPath const &instancerId,
462  size_t maxSampleCount,
463  float *sampleTimes,
464  GfMatrix4d *sampleValues);
465 
466  /// Convenience form of SampleInstancerTransform()
467  /// that takes an HdTimeSampleArray.
468  /// This function returns the union of the authored samples
469  /// and the boundaries of the current camera shutter interval.
470  template <unsigned int CAPACITY>
471  void
472  SampleInstancerTransform(SdfPath const &instancerId,
474  size_t authoredSamples =
476  instancerId,
477  CAPACITY,
478  sa->times.data(),
479  sa->values.data());
480  if (authoredSamples > CAPACITY) {
481  sa->Resize(authoredSamples);
482  size_t authoredSamplesSecondAttempt =
484  instancerId,
485  authoredSamples,
486  sa->times.data(),
487  sa->values.data());
488  // Number of samples should be consisntent through multiple
489  // invokations of the sampling function.
490  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
491  }
492  sa->count = authoredSamples;
493  }
494 
495  /// Store up to \a maxSampleCount primvar samples in \a *samplesValues.
496  /// Returns the union of the authored samples and the boundaries
497  /// of the current camera shutter interval. If this number is greater
498  /// than maxSampleCount, you might want to call this function again
499  /// to get all the authored data.
500  ///
501  /// Sample values that are array-valued will have a size described
502  /// by the HdPrimvarDescriptor as applied to the toplogy.
503  ///
504  /// For example, this means that a mesh that is fracturing over time
505  /// will return samples with the same number of points; the number
506  /// of points will change as the scene delegate is resynchronzied
507  /// to represent the scene at a time with different topology.
508  ///
509  /// Sample times are relative to the scene delegate's current time.
510  ///
511  /// \see Get()
512  HD_API
513  virtual size_t
514  SamplePrimvar(SdfPath const& id,
515  TfToken const& key,
516  size_t maxSampleCount,
517  float *sampleTimes,
518  VtValue *sampleValues);
519 
520  /// Convenience form of SamplePrimvar() that takes an HdTimeSampleArray.
521  /// This function returns the union of the authored samples
522  /// and the boundaries of the current camera shutter interval.
523  template <unsigned int CAPACITY>
524  void
525  SamplePrimvar(SdfPath const &id,
526  TfToken const& key,
528  size_t authoredSamples =
530  id,
531  key,
532  CAPACITY,
533  sa->times.data(),
534  sa->values.data());
535  if (authoredSamples > CAPACITY) {
536  sa->Resize(authoredSamples);
537  size_t authoredSamplesSecondAttempt =
539  id,
540  key,
541  authoredSamples,
542  sa->times.data(),
543  sa->values.data());
544  // Number of samples should be consisntent through multiple
545  // invokations of the sampling function.
546  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
547  }
548  sa->count = authoredSamples;
549  }
550 
551  // -----------------------------------------------------------------------//
552  /// \name Instancer prototypes
553  // -----------------------------------------------------------------------//
554 
555  /// Gets the extracted indices array of the prototype id used in the
556  /// instancer.
557  ///
558  /// example
559  /// instances: 0, 1, 2, 3, 4, 5
560  /// protoypes: A, B, A, A, B, C
561  ///
562  /// GetInstanceIndices(A) : [0, 2, 3]
563  /// GetInstanceIndices(B) : [1, 4]
564  /// GetInstanceIndices(C) : [5]
565  /// GetInstanceIndices(D) : []
566  ///
567  HD_API
568  virtual VtIntArray GetInstanceIndices(SdfPath const &instancerId,
569  SdfPath const &prototypeId);
570 
571  /// Returns the instancer transform.
572  HD_API
573  virtual GfMatrix4d GetInstancerTransform(SdfPath const &instancerId);
574 
575  // -----------------------------------------------------------------------//
576  /// \name Path Translation
577  // -----------------------------------------------------------------------//
578 
579  /// Returns the scene address of the prim corresponding to the given
580  /// rprim/instance index. This is designed to give paths in scene namespace,
581  /// rather than hydra namespace, so it always strips the delegate ID.
582  HD_API
583  virtual SdfPath GetScenePrimPath(SdfPath const& rprimId,
584  int instanceIndex,
585  HdInstancerContext *instancerContext = nullptr);
586 
587  // -----------------------------------------------------------------------//
588  /// \name Material Aspects
589  // -----------------------------------------------------------------------//
590 
591  /// Returns the material ID bound to the rprim \p rprimId.
592  HD_API
593  virtual SdfPath GetMaterialId(SdfPath const &rprimId);
594 
595  // Returns a material resource which contains the information
596  // needed to create a material.
597  HD_API
598  virtual VtValue GetMaterialResource(SdfPath const &materialId);
599 
600  // -----------------------------------------------------------------------//
601  /// \name Texture Aspects
602  // -----------------------------------------------------------------------//
603 
604  /// Returns the texture resource ID for a given texture ID.
605  HD_API
606  virtual HdTextureResource::ID GetTextureResourceID(SdfPath const& textureId);
607 
608  /// Returns the texture resource for a given texture ID.
609  HD_API
610  virtual HdTextureResourceSharedPtr GetTextureResource(SdfPath const& textureId);
611 
612  // -----------------------------------------------------------------------//
613  /// \name Renderbuffer Aspects
614  // -----------------------------------------------------------------------//
615 
616  /// Returns the allocation descriptor for a given render buffer prim.
617  HD_API
619 
620  // -----------------------------------------------------------------------//
621  /// \name Light Aspects
622  // -----------------------------------------------------------------------//
623 
624  // Returns a single value for a given light and parameter.
625  HD_API
626  virtual VtValue GetLightParamValue(SdfPath const &id,
627  TfToken const &paramName);
628 
629  // -----------------------------------------------------------------------//
630  /// \name Camera Aspects
631  // -----------------------------------------------------------------------//
632 
633  /// Returns a single value for a given camera and parameter.
634  /// See HdCameraTokens for the list of paramters.
635  HD_API
636  virtual VtValue GetCameraParamValue(SdfPath const& cameraId,
637  TfToken const& paramName);
638 
639  // -----------------------------------------------------------------------//
640  /// \name Volume Aspects
641  // -----------------------------------------------------------------------//
642 
643  HD_API
645  GetVolumeFieldDescriptors(SdfPath const &volumeId);
646 
647  // -----------------------------------------------------------------------//
648  /// \name ExtComputation Aspects
649  // -----------------------------------------------------------------------//
650 
651  ///
652  /// For the given computation id, returns a list of inputs which
653  /// will be requested from the scene delegate using the Get() method.
654  ///
655  /// See GetExtComputationInputDescriptors and
656  /// GetExtComputationOutpuDescriptors for descriptions of other
657  /// computation inputs and outputs.
658  HD_API
659  virtual TfTokenVector
660  GetExtComputationSceneInputNames(SdfPath const& computationId);
661 
662  ///
663  /// For the given computation id, returns a list of computation
664  /// input descriptors.
665  ///
666  /// See HdExtComputationInputDecriptor
667  HD_API
669  GetExtComputationInputDescriptors(SdfPath const& computationId);
670 
671  /// For the given computation id, returns a list of computation
672  /// output descriptors.
673  ///
674  /// See HdExtComputationOutputDescriptor
675  HD_API
677  GetExtComputationOutputDescriptors(SdfPath const& computationId);
678 
679 
680  /// Returns a list of primvar names that should be bound to
681  /// a generated output from an ExtComputation for the given prim id and
682  /// interpolation mode. Binding information is obtained through
683  /// GetExtComputationPrimvarDesc()
684  /// Returns a structure describing source information for a primvar
685  /// that is bound to an ExtComputation. See HdExtComputationPrimvarDesc
686  /// for the expected information to be returned.
687  HD_API
690  HdInterpolation interpolationMode);
691 
692  /// Returns a single value for a given computation id and input token.
693  /// The token may be a computation input or a computation config parameter.
694  HD_API
695  virtual VtValue GetExtComputationInput(SdfPath const& computationId,
696  TfToken const& input);
697 
698  /// Returns the kernel source assigned to the computation at the path id.
699  /// If the string is empty the computation has no GPU kernel and the
700  /// CPU callback should be used.
701  HD_API
702  virtual std::string GetExtComputationKernel(SdfPath const& computationId);
703 
704  /// Requests the scene delegate run the ExtComputation with the given id.
705  /// The context contains the input values that delegate requested through
706  /// GetExtComputationInputNames().
707  ///
708  /// The scene delegate is expected to set each output identified by
709  /// GetExtComputationOutputNames() on the context.
710  ///
711  /// Hydra may invoke the computation on a different thread from
712  /// what HdEngine::Execute() was called on. It may also invoke
713  /// many computations in parallel.
714  HD_API
715  virtual void InvokeExtComputation(SdfPath const& computationId,
717 
718  // -----------------------------------------------------------------------//
719  /// \name Primitive Variables
720  // -----------------------------------------------------------------------//
721 
722  /// Returns descriptors for all primvars of the given interpolation type.
723  HD_API
725  GetPrimvarDescriptors(SdfPath const& id, HdInterpolation interpolation);
726 
727  // -----------------------------------------------------------------------//
728  /// \name Task Aspects
729  // -----------------------------------------------------------------------//
730  HD_API
731  virtual TfTokenVector GetTaskRenderTags(SdfPath const& taskId);
732 
733 private:
734  HdRenderIndex *_index;
735  SdfPath _delegateID;
736 
737  HdSceneDelegate() = delete;
738  HdSceneDelegate(HdSceneDelegate &) = delete;
739  HdSceneDelegate &operator=(HdSceneDelegate &) = delete;
740 };
741 
742 
744 
745 #endif //PXR_IMAGING_HD_SCENE_DELEGATE_H
std::shared_ptr< SdfPathVector > HdIdVectorSharedPtr
A shared pointer to a vector of id's.
Definition: sceneDelegate.h:55
void SampleInstancerTransform(SdfPath const &instancerId, HdTimeSampleArray< GfMatrix4d, CAPACITY > *sa)
virtual HD_API VtValue GetExtComputationInput(SdfPath const &computationId, TfToken const &input)
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
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)
GLenum GLenum GLenum input
Definition: glew.h:13879
HdCullStyle
Definition: enums.h:122
std::shared_ptr< class HdTextureResource > HdTextureResourceSharedPtr
virtual HD_API void PostSyncCleanup()
GLuint const GLchar * name
Definition: glew.h:1814
bool operator!=(HdExtComputationInputDescriptor const &rhs) const
virtual HD_API void InvokeExtComputation(SdfPath const &computationId, HdExtComputationContext *context)
TfSmallVector< float, CAPACITY > times
virtual HD_API bool GetVisible(SdfPath const &id)
Returns the authored visible state of the prim.
bool operator!=(HdPrimvarDescriptor const &rhs) const
~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)
GLuint GLenum option
Definition: glew.h:3288
bool operator!=(HdExtComputationOutputDescriptor const &rhs) const
virtual HD_API std::string GetExtComputationKernel(SdfPath const &computationId)
#define HD_API
Definition: api.h:40
virtual HD_API bool IsEnabled(TfToken const &option) const
Returns true if the named option is enabled by the delegate.
HdVolumeFieldDescriptor(TfToken const &fieldName_, TfToken const &fieldPrimType_, SdfPath const &fieldId_)
int refineLevel
The prim refine level, in the range [0, 8].
Definition: sceneDelegate.h:83
std::vector< HdExtComputationOutputDescriptor > HdExtComputationOutputDescriptorVector
virtual HD_API GfMatrix4d GetInstancerTransform(SdfPath const &instancerId)
Returns the instancer transform.
HdExtComputationInputDescriptor(TfToken const &name_, SdfPath const &sourceComputationId_, TfToken const &sourceComputationOutputName_)
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:61
virtual HD_API VtValue GetMaterialResource(SdfPath const &materialId)
Returns the material ID bound to the rprim rprimId.
Definition: token.h:87
virtual HD_API HdDisplayStyle GetDisplayStyle(SdfPath const &id)
virtual HD_API VtArray< TfToken > GetCategories(SdfPath const &id)
Returns the prim categories.
HdInterpolation interpolation
Interpolation (data-sampling rate) of the primvar.
void SamplePrimvar(SdfPath const &id, TfToken const &key, HdTimeSampleArray< VtValue, CAPACITY > *sa)
void Resize(unsigned int newSize)
Resize the internal buffers.
virtual HD_API VtValue GetLightParamValue(SdfPath const &id, TfToken const &paramName)
virtual HD_API HdTextureResourceSharedPtr GetTextureResource(SdfPath const &textureId)
Returns the texture resource for a given texture ID.
TfToken name
Name of the primvar.
HdRenderIndex & GetRenderIndex()
Returns the RenderIndex owned by this delegate.
bool operator==(HdDisplayStyle const &rhs) const
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:446
bool displacementEnabled
Is the prim displacement shaded.
Definition: sceneDelegate.h:89
virtual HD_API GfRange3d GetExtent(SdfPath const &id)
std::vector< HdDirtyBits > dirtyBits
Definition: sceneDelegate.h:74
virtual HD_API TfToken GetRenderTag(SdfPath const &id)
HdPrimvarDescriptor(TfToken const &name_, HdInterpolation interp_, TfToken const &role_=HdPrimvarRoleTokens->none)
bool operator==(HdExtComputationPrimvarDescriptor const &rhs) const
Definition: path.h:288
virtual HD_API size_t SampleTransform(SdfPath const &id, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues)
std::vector< HdVolumeFieldDescriptor > HdVolumeFieldDescriptorVector
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
Definition: path.h:209
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
GLsizei const GLchar *const * string
Definition: glew.h:1844
virtual HD_API void Sync(HdSyncRequestVector *request)
Synchronizes the delegate state for the given request vector.
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)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
bool operator!=(HdDisplayStyle const &rhs) const
bool flatShadingEnabled
Is the prim flat shaded.
Definition: sceneDelegate.h:86
HdDisplayStyle(int refineLevel_, bool flatShading=false, bool displacement=true)
virtual HD_API HdMeshTopology GetMeshTopology(SdfPath const &id)
Gets the topological mesh data for a given prim.
virtual HD_API ~HdSceneDelegate()
virtual HD_API HdTextureResource::ID GetTextureResourceID(SdfPath const &textureId)
Returns the texture resource ID for a given texture ID.
HdExtComputationOutputDescriptor(TfToken const &name_, HdTupleType const &valueType_)
virtual HD_API TfTokenVector GetExtComputationSceneInputNames(SdfPath const &computationId)
HdInterpolation
Definition: enums.h:194
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.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:83
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 all instances in the instancer.
virtual HD_API HdCullStyle GetCullStyle(SdfPath const &id)
Returns the cullstyle for the given prim.
SdfPathVector IDs
Definition: sceneDelegate.h:71
void SampleTransform(SdfPath const &id, HdTimeSampleArray< GfMatrix4d, CAPACITY > *sa)
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
bool operator==(HdPrimvarDescriptor const &rhs) const
virtual HD_API HdExtComputationOutputDescriptorVector GetExtComputationOutputDescriptors(SdfPath const &computationId)
Definition: value.h:174
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:768