sceneDelegate.h
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"
32 #include "pxr/imaging/hd/basisCurvesTopology.h"
33 #include "pxr/imaging/hd/enums.h"
34 #include "pxr/imaging/hd/meshTopology.h"
35 #include "pxr/imaging/hd/renderIndex.h"
36 #include "pxr/imaging/hd/repr.h"
37 #include "pxr/imaging/hd/timeSampleArray.h"
38 
40 
41 #include "pxr/base/vt/array.h"
42 #include "pxr/base/vt/dictionary.h"
43 #include "pxr/base/vt/value.h"
44 #include "pxr/usd/sdf/path.h"
45 
46 #include "pxr/base/gf/vec2i.h"
47 #include "pxr/base/tf/hash.h"
48 
49 #include <memory>
50 #include <vector>
51 
52 PXR_NAMESPACE_OPEN_SCOPE
53 
55 
57 typedef std::shared_ptr<SdfPathVector> HdIdVectorSharedPtr;
58 
60 typedef std::vector<std::pair<SdfPath, int>> HdInstancerContext;
61 
69  // The Prims to synchronize in this request.
70  SdfPathVector IDs;
71 
72  // The HdChangeTracker::DirtyBits that are set for each Prim.
73  std::vector<HdDirtyBits> dirtyBits;
74 };
75 
83 
86 
89 
93 
97 
101 
109  : refineLevel(0)
110  , flatShadingEnabled(false)
111  , displacementEnabled(true)
113  , pointsShadingEnabled(false)
114  , materialIsFinal(false)
115  { }
116 
129  HdDisplayStyle(int refineLevel_,
130  bool flatShading = false,
131  bool displacement = true,
132  bool occludedSelectionShowsThrough_ = false,
133  bool pointsShadingEnabled_ = false,
134  bool materialIsFinal_ = false)
135  : refineLevel(std::max(0, refineLevel_))
136  , flatShadingEnabled(flatShading)
137  , displacementEnabled(displacement)
138  , occludedSelectionShowsThrough(occludedSelectionShowsThrough_)
139  , pointsShadingEnabled(pointsShadingEnabled_)
140  , materialIsFinal(materialIsFinal_)
141  {
142  if (refineLevel_ < 0) {
143  TF_CODING_ERROR("negative refine level is not supported");
144  } else if (refineLevel_ > 8) {
145  TF_CODING_ERROR("refine level > 8 is not supported");
146  }
147  }
148 
149  HdDisplayStyle(HdDisplayStyle const& rhs) = default;
150  ~HdDisplayStyle() = default;
151 
152  bool operator==(HdDisplayStyle const& rhs) const {
153  return refineLevel == rhs.refineLevel
160  }
161  bool operator!=(HdDisplayStyle const& rhs) const {
162  return !(*this == rhs);
163  }
164 };
165 
173  HdInterpolation interpolation;
180  bool indexed;
181 
183  : interpolation(HdInterpolationConstant)
184  , role(HdPrimvarRoleTokens->none)
185  , indexed(false)
186  {}
187  HdPrimvarDescriptor(TfToken const& name_,
188  HdInterpolation interp_,
189  TfToken const& role_=HdPrimvarRoleTokens->none,
190  bool indexed_=false)
191  : name(name_), interpolation(interp_), role(role_), indexed(indexed_)
192  { }
193  bool operator==(HdPrimvarDescriptor const& rhs) const {
194  return name == rhs.name && role == rhs.role
195  && interpolation == rhs.interpolation;
196  }
197  bool operator!=(HdPrimvarDescriptor const& rhs) const {
198  return !(*this == rhs);
199  }
200 };
201 
202 typedef std::vector<HdPrimvarDescriptor> HdPrimvarDescriptorVector;
203 
214  SdfPath sourceComputationId;
215  TfToken sourceComputationOutputName;
216  HdTupleType valueType;
217 
220  TfToken const& name_,
221  HdInterpolation interp_,
222  TfToken const & role_,
223  SdfPath const & sourceComputationId_,
224  TfToken const & sourceComputationOutputName_,
225  HdTupleType const & valueType_)
226  : HdPrimvarDescriptor(name_, interp_, role_, false)
227  , sourceComputationId(sourceComputationId_)
228  , sourceComputationOutputName(sourceComputationOutputName_)
229  , valueType(valueType_)
230  { }
231  bool operator==(HdExtComputationPrimvarDescriptor const& rhs) const {
232  return HdPrimvarDescriptor::operator==(rhs) &&
233  sourceComputationId == rhs.sourceComputationId &&
234  sourceComputationOutputName == rhs.sourceComputationOutputName &&
235  valueType == rhs.valueType;
236  }
237  bool operator!=(HdExtComputationPrimvarDescriptor const& rhs) const {
238  return !(*this == rhs);
239  }
240 };
241 
242 typedef std::vector<HdExtComputationPrimvarDescriptor>
243  HdExtComputationPrimvarDescriptorVector;
244 
254  TfToken name;
255  SdfPath sourceComputationId;
256  TfToken sourceComputationOutputName;
257 
260  TfToken const & name_,
261  SdfPath const & sourceComputationId_,
262  TfToken const & sourceComputationOutputName_)
263  : name(name_), sourceComputationId(sourceComputationId_)
264  , sourceComputationOutputName(sourceComputationOutputName_)
265  { }
266 
267  bool operator==(HdExtComputationInputDescriptor const& rhs) const {
268  return name == rhs.name &&
269  sourceComputationId == rhs.sourceComputationId &&
270  sourceComputationOutputName == rhs.sourceComputationOutputName;
271  }
272  bool operator!=(HdExtComputationInputDescriptor const& rhs) const {
273  return !(*this == rhs);
274  }
275 };
276 
277 typedef std::vector<HdExtComputationInputDescriptor>
278  HdExtComputationInputDescriptorVector;
279 
287  TfToken name;
288  HdTupleType valueType;
289 
292  TfToken const & name_,
293  HdTupleType const & valueType_)
294  : name(name_), valueType(valueType_)
295  { }
296 
297  bool operator==(HdExtComputationOutputDescriptor const& rhs) const {
298  return name == rhs.name &&
299  valueType == rhs.valueType;
300  }
301  bool operator!=(HdExtComputationOutputDescriptor const& rhs) const {
302  return !(*this == rhs);
303  }
304 };
305 
306 typedef std::vector<HdExtComputationOutputDescriptor>
307  HdExtComputationOutputDescriptorVector;
308 
314  TfToken fieldName;
315  TfToken fieldPrimType;
316  SdfPath fieldId;
317 
320  TfToken const & fieldName_,
321  TfToken const & fieldPrimType_,
322  SdfPath const & fieldId_)
323  : fieldName(fieldName_), fieldPrimType(fieldPrimType_), fieldId(fieldId_)
324  { }
325 };
326 
327 typedef std::vector<HdVolumeFieldDescriptor>
328  HdVolumeFieldDescriptorVector;
329 
335 public:
337  HD_API
338  HdSceneDelegate(HdRenderIndex *parentIndex,
339  SdfPath const& delegateID);
340 
341  HD_API
342  virtual ~HdSceneDelegate();
343 
345  HdRenderIndex& GetRenderIndex() { return *_index; }
346 
351  SdfPath const& GetDelegateID() const { return _delegateID; }
352 
354  HD_API
355  virtual void Sync(HdSyncRequestVector* request);
356 
359  HD_API
360  virtual void PostSyncCleanup();
361 
362  // -----------------------------------------------------------------------//
364  // -----------------------------------------------------------------------//
365 
367  HD_API
368  virtual bool IsEnabled(TfToken const& option) const;
369 
370 
371  // -----------------------------------------------------------------------//
373  // -----------------------------------------------------------------------//
374 
376  HD_API
377  virtual HdMeshTopology GetMeshTopology(SdfPath const& id);
378 
380  HD_API
382 
384  HD_API
385  virtual PxOsdSubdivTags GetSubdivTags(SdfPath const& id);
386 
387 
395  HD_API
396  virtual GfRange3d GetExtent(SdfPath const & id);
397 
399  HD_API
400  virtual GfMatrix4d GetTransform(SdfPath const & id);
401 
403  HD_API
404  virtual bool GetVisible(SdfPath const & id);
405 
407  HD_API
408  virtual bool GetDoubleSided(SdfPath const & id);
409 
411  HD_API
412  virtual HdCullStyle GetCullStyle(SdfPath const &id);
413 
415  HD_API
416  virtual VtValue GetShadingStyle(SdfPath const &id);
417 
422  HD_API
423  virtual HdDisplayStyle GetDisplayStyle(SdfPath const& id);
424 
426  HD_API
427  virtual VtValue Get(SdfPath const& id, TfToken const& key);
428 
433  HD_API
434  virtual VtValue GetIndexedPrimvar(SdfPath const& id,
435  TfToken const& key,
436  VtIntArray *outIndices);
437 
439  HD_API
440  virtual HdReprSelector GetReprSelector(SdfPath const &id);
441 
444  HD_API
445  virtual TfToken GetRenderTag(SdfPath const& id);
446 
448  HD_API
449  virtual VtArray<TfToken> GetCategories(SdfPath const& id);
450 
452  HD_API
453  virtual std::vector<VtArray<TfToken>>
454  GetInstanceCategories(SdfPath const &instancerId);
455 
457  HD_API
458  virtual HdIdVectorSharedPtr GetCoordSysBindings(SdfPath const& id);
459 
460  // -----------------------------------------------------------------------//
462  // -----------------------------------------------------------------------//
463 
471  HD_API
472  virtual size_t
473  SampleTransform(SdfPath const & id,
474  size_t maxSampleCount,
475  float *sampleTimes,
476  GfMatrix4d *sampleValues);
477 
481  template <unsigned int CAPACITY>
482  void
485  size_t authoredSamples =
486  SampleTransform(id, CAPACITY, sa->times.data(), sa->values.data());
487  if (authoredSamples > CAPACITY) {
488  sa->Resize(authoredSamples);
489  size_t authoredSamplesSecondAttempt =
491  id,
492  authoredSamples,
493  sa->times.data(),
494  sa->values.data());
495  // Number of samples should be consisntent through multiple
496  // invokations of the sampling function.
497  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
498  }
499  sa->count = authoredSamples;
500  }
501 
509  HD_API
510  virtual size_t
511  SampleInstancerTransform(SdfPath const &instancerId,
512  size_t maxSampleCount,
513  float *sampleTimes,
514  GfMatrix4d *sampleValues);
515 
520  template <unsigned int CAPACITY>
521  void
522  SampleInstancerTransform(SdfPath const &instancerId,
524  size_t authoredSamples =
526  instancerId,
527  CAPACITY,
528  sa->times.data(),
529  sa->values.data());
530  if (authoredSamples > CAPACITY) {
531  sa->Resize(authoredSamples);
532  size_t authoredSamplesSecondAttempt =
534  instancerId,
535  authoredSamples,
536  sa->times.data(),
537  sa->values.data());
538  // Number of samples should be consisntent through multiple
539  // invokations of the sampling function.
540  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
541  }
542  sa->count = authoredSamples;
543  }
544 
562  HD_API
563  virtual size_t
564  SamplePrimvar(SdfPath const& id,
565  TfToken const& key,
566  size_t maxSampleCount,
567  float *sampleTimes,
568  VtValue *sampleValues);
569 
573  template <unsigned int CAPACITY>
574  void
575  SamplePrimvar(SdfPath const &id,
576  TfToken const& key,
578 
584  HD_API
585  virtual size_t
586  SampleIndexedPrimvar(SdfPath const& id,
587  TfToken const& key,
588  size_t maxSampleCount,
589  float *sampleTimes,
590  VtValue *sampleValues,
591  VtIntArray *sampleIndices);
592 
596  template <unsigned int CAPACITY>
597  void
598  SampleIndexedPrimvar(SdfPath const &id,
599  TfToken const& key,
601 
602  // -----------------------------------------------------------------------//
604  // -----------------------------------------------------------------------//
605 
618  HD_API
619  virtual VtIntArray GetInstanceIndices(SdfPath const &instancerId,
620  SdfPath const &prototypeId);
621 
623  HD_API
624  virtual GfMatrix4d GetInstancerTransform(SdfPath const &instancerId);
625 
627  HD_API
628  virtual SdfPath GetInstancerId(SdfPath const& primId);
629 
634  HD_API
635  virtual SdfPathVector GetInstancerPrototypes(SdfPath const& instancerId);
636 
637  // -----------------------------------------------------------------------//
639  // -----------------------------------------------------------------------//
640 
645  HD_API
646  virtual SdfPath GetScenePrimPath(SdfPath const& rprimId,
647  int instanceIndex,
648  HdInstancerContext *instancerContext = nullptr);
649 
655  HD_API
656  virtual SdfPathVector GetScenePrimPaths(SdfPath const& rprimId,
657  std::vector<int> instanceIndices,
658  std::vector<HdInstancerContext> *instancerContexts = nullptr);
659 
660  // -----------------------------------------------------------------------//
662  // -----------------------------------------------------------------------//
663 
665  HD_API
666  virtual SdfPath GetMaterialId(SdfPath const &rprimId);
667 
668  // Returns a material resource which contains the information
669  // needed to create a material.
670  HD_API
671  virtual VtValue GetMaterialResource(SdfPath const &materialId);
672 
673  // -----------------------------------------------------------------------//
675  // -----------------------------------------------------------------------//
676 
678  HD_API
680 
681  // -----------------------------------------------------------------------//
683  // -----------------------------------------------------------------------//
684 
685  // Returns a single value for a given light and parameter.
686  HD_API
687  virtual VtValue GetLightParamValue(SdfPath const &id,
688  TfToken const &paramName);
689 
690  // -----------------------------------------------------------------------//
692  // -----------------------------------------------------------------------//
693 
696  HD_API
697  virtual VtValue GetCameraParamValue(SdfPath const& cameraId,
698  TfToken const& paramName);
699 
700  // -----------------------------------------------------------------------//
702  // -----------------------------------------------------------------------//
703 
704  HD_API
705  virtual HdVolumeFieldDescriptorVector
706  GetVolumeFieldDescriptors(SdfPath const &volumeId);
707 
708  // -----------------------------------------------------------------------//
710  // -----------------------------------------------------------------------//
711 
719  HD_API
720  virtual TfTokenVector
721  GetExtComputationSceneInputNames(SdfPath const& computationId);
722 
728  HD_API
729  virtual HdExtComputationInputDescriptorVector
730  GetExtComputationInputDescriptors(SdfPath const& computationId);
731 
736  HD_API
737  virtual HdExtComputationOutputDescriptorVector
738  GetExtComputationOutputDescriptors(SdfPath const& computationId);
739 
740 
748  HD_API
749  virtual HdExtComputationPrimvarDescriptorVector
751  HdInterpolation interpolationMode);
752 
755  HD_API
756  virtual VtValue GetExtComputationInput(SdfPath const& computationId,
757  TfToken const& input);
758 
766  HD_API
767  virtual size_t SampleExtComputationInput(SdfPath const& computationId,
768  TfToken const& input,
769  size_t maxSampleCount,
770  float *sampleTimes,
771  VtValue *sampleValues);
772 
777  template <unsigned int CAPACITY>
778  void SampleExtComputationInput(SdfPath const& computationId,
779  TfToken const& input,
781  size_t authoredSamples = SampleExtComputationInput(
782  computationId, input, CAPACITY,
783  sa->times.data(), sa->values.data());
784 
785  if (authoredSamples > CAPACITY) {
786  sa->Resize(authoredSamples);
787  size_t authoredSamplesSecondAttempt = SampleExtComputationInput(
788  computationId, input, authoredSamples,
789  sa->times.data(), sa->values.data());
790  // Number of samples should be consisntent through multiple
791  // invokations of the sampling function.
792  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
793  }
794  sa->count = authoredSamples;
795  }
796 
800  HD_API
801  virtual std::string GetExtComputationKernel(SdfPath const& computationId);
802 
813  HD_API
814  virtual void InvokeExtComputation(SdfPath const& computationId,
815  HdExtComputationContext *context);
816 
817  // -----------------------------------------------------------------------//
819  // -----------------------------------------------------------------------//
820 
822  HD_API
823  virtual HdPrimvarDescriptorVector
824  GetPrimvarDescriptors(SdfPath const& id, HdInterpolation interpolation);
825 
826  // -----------------------------------------------------------------------//
828  // -----------------------------------------------------------------------//
829  HD_API
830  virtual TfTokenVector GetTaskRenderTags(SdfPath const& taskId);
831 
832 private:
833  HdRenderIndex *_index;
834  SdfPath _delegateID;
835 
836  HdSceneDelegate() = delete;
837  HdSceneDelegate(HdSceneDelegate &) = delete;
838  HdSceneDelegate &operator=(HdSceneDelegate &) = delete;
839 };
840 
841 template <unsigned int CAPACITY>
842 void
844  TfToken const& key,
846  size_t authoredSamples =
848  id,
849  key,
850  CAPACITY,
851  sa->times.data(),
852  sa->values.data());
853  if (authoredSamples > CAPACITY) {
854  sa->Resize(authoredSamples);
855  size_t authoredSamplesSecondAttempt =
857  id,
858  key,
859  authoredSamples,
860  sa->times.data(),
861  sa->values.data());
862  // Number of samples should be consistent through multiple
863  // invocations of the sampling function.
864  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
865  }
866  sa->count = authoredSamples;
867 }
868 
869 template <unsigned int CAPACITY>
870 void
872  TfToken const& key,
874  size_t authoredSamples =
876  id,
877  key,
878  CAPACITY,
879  sa->times.data(),
880  sa->values.data(),
881  sa->indices.data());
882  if (authoredSamples > CAPACITY) {
883  sa->Resize(authoredSamples);
884  size_t authoredSamplesSecondAttempt =
886  id,
887  key,
888  authoredSamples,
889  sa->times.data(),
890  sa->values.data(),
891  sa->indices.data());
892  // Number of samples should be consistent through multiple
893  // invocations of the sampling function.
894  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
895  }
896  sa->count = authoredSamples;
897 }
898 
899 PXR_NAMESPACE_CLOSE_SCOPE
900 
901 #endif //PXR_IMAGING_HD_SCENE_DELEGATE_H
Interface class that defines the execution environment for the client to run a computation.
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:43
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:120
Basic type: 3-dimensional floating point range.
Definition: range3d.h:64
virtual HD_API void InvokeExtComputation(SdfPath const &computationId, HdExtComputationContext *context)
Requests the scene delegate run the ExtComputation with the given id.
virtual HD_API HdBasisCurvesTopology GetBasisCurvesTopology(SdfPath const &id)
Gets the topological curve data for a given prim.
Describes how the geometry of a prim should be displayed.
Definition: sceneDelegate.h:80
value_type * data()
Direct access to the underlying array.
Definition: smallVector.h:768
virtual HD_API VtValue GetShadingStyle(SdfPath const &id)
Returns the shading style for the given prim.
Describes an input to an ExtComputation that takes data from the output of another ExtComputation.
virtual HD_API VtValue Get(SdfPath const &id, TfToken const &key)
Returns a named value.
virtual HD_API TfTokenVector GetExtComputationSceneInputNames(SdfPath const &computationId)
For the given computation id, returns a list of inputs which will be requested from the scene delegat...
HdTupleType represents zero, one, or more values of the same HdType.
Definition: types.h:358
virtual HD_API SdfPath GetMaterialId(SdfPath const &rprimId)
Returns the material ID bound to the rprim rprimId.
virtual HD_API std::vector< VtArray< TfToken > > GetInstanceCategories(SdfPath const &instancerId)
Returns the categories for all instances in the instancer.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
Definition: diagnostic.h:85
Describes the allocation structure of a render buffer bprim.
Definition: aov.h:84
bool materialIsFinal
Is this prim exempt from having its material disabled or overridden, for example, when a renderer cho...
bool flatShadingEnabled
Is the prim flat shaded.
Definition: sceneDelegate.h:85
Describes a primvar.
virtual HD_API GfMatrix4d GetInstancerTransform(SdfPath const &instancerId)
Returns the instancer transform.
void SampleExtComputationInput(SdfPath const &computationId, TfToken const &input, HdTimeSampleArray< VtValue, CAPACITY > *sa)
Convenience form of SampleExtComputationInput() that takes an HdTimeSampleArray.
TfToken name
Name of the primvar.
virtual HD_API bool GetDoubleSided(SdfPath const &id)
Returns the doubleSided state for the given prim.
virtual HD_API void PostSyncCleanup()
Opportunity for the delegate to clean itself up after performing parallel work during sync phase.
virtual HD_API VtValue GetCameraParamValue(SdfPath const &cameraId, TfToken const &paramName)
Returns a single value for a given camera and parameter.
virtual HD_API GfMatrix4d GetTransform(SdfPath const &id)
Returns the object space transform, including all parent transforms.
virtual HD_API HdExtComputationOutputDescriptorVector GetExtComputationOutputDescriptors(SdfPath const &computationId)
For the given computation id, returns a list of computation output descriptors.
virtual HD_API HdIdVectorSharedPtr GetCoordSysBindings(SdfPath const &id)
Returns the coordinate system bindings, or a nullptr if none are bound.
SdfPath const & GetDelegateID() const
Returns the ID of this delegate, which is used as a prefix for all objects it creates in the RenderIn...
virtual HD_API size_t SampleExtComputationInput(SdfPath const &computationId, TfToken const &input, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues)
Return up to maxSampleCount samples for a given computation id and input token.
virtual HD_API HdRenderBufferDescriptor GetRenderBufferDescriptor(SdfPath const &id)
Returns the allocation descriptor for a given render buffer prim.
void SampleInstancerTransform(SdfPath const &instancerId, HdTimeSampleArray< GfMatrix4d, CAPACITY > *sa)
Convenience form of SampleInstancerTransform() that takes an HdTimeSampleArray.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
virtual HD_API HdExtComputationPrimvarDescriptorVector GetExtComputationPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolationMode)
Returns a list of primvar names that should be bound to a generated output from an ExtComputation for...
Describes an output of an ExtComputation.
HdInterpolation interpolation
Interpolation (data-sampling rate) of the primvar.
Description of a single field related to a volume primitive.
virtual HD_API size_t SampleTransform(SdfPath const &id, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues)
Store up to maxSampleCount transform samples in *sampleValues.
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Definition: diagnostic.h:283
virtual HD_API size_t SamplePrimvar(SdfPath const &id, TfToken const &key, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues)
Store up to maxSampleCount primvar samples in *samplesValues.
virtual HD_API HdCullStyle GetCullStyle(SdfPath const &id)
Returns the cullstyle for the given prim.
Adapter class providing data exchange with the client scene graph.
virtual HD_API SdfPathVector GetInstancerPrototypes(SdfPath const &instancerId)
Returns a list of prototypes of this instancer.
virtual HD_API SdfPathVector GetScenePrimPaths(SdfPath const &rprimId, std::vector< int > instanceIndices, std::vector< HdInstancerContext > *instancerContexts=nullptr)
A vectorized version of GetScenePrimPath that allows the prim adapter to amortize expensive calculati...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
bool occludedSelectionShowsThrough
Does the prim act "transparent" to allow occluded selection to show through?
Definition: sceneDelegate.h:92
void SampleTransform(SdfPath const &id, HdTimeSampleArray< GfMatrix4d, CAPACITY > *sa)
Convenience form of SampleTransform() that takes an HdTimeSampleArray.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
bool indexed
Optional bool, true if primvar is indexed.
virtual HD_API VtValue GetExtComputationInput(SdfPath const &computationId, TfToken const &input)
Returns a single value for a given computation id and input token.
Topology data for basisCurves.
virtual HD_API void Sync(HdSyncRequestVector *request)
Synchronizes the delegate state for the given request vector.
HdDisplayStyle(int refineLevel_, bool flatShading=false, bool displacement=true, bool occludedSelectionShowsThrough_=false, bool pointsShadingEnabled_=false, bool materialIsFinal_=false)
Creates a DisplayStyle.
virtual HD_API bool GetVisible(SdfPath const &id)
Returns the authored visible state of the prim.
virtual HD_API size_t SampleIndexedPrimvar(SdfPath const &id, TfToken const &key, size_t maxSampleCount, float *sampleTimes, VtValue *sampleValues, VtIntArray *sampleIndices)
SamplePrimvar() for getting an unflattened primvar and its indices.
virtual HD_API VtValue GetIndexedPrimvar(SdfPath const &id, TfToken const &key, VtIntArray *outIndices)
Returns a named primvar value.
int refineLevel
The prim refine level, in the range [0, 8].
Definition: sceneDelegate.h:82
HdDisplayStyle()
Creates a default DisplayStyle.
virtual HD_API HdExtComputationInputDescriptorVector GetExtComputationInputDescriptors(SdfPath const &computationId)
For the given computation id, returns a list of computation input descriptors.
virtual HD_API HdPrimvarDescriptorVector GetPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolation)
Returns descriptors for all primvars of the given interpolation type.
virtual HD_API HdMeshTopology GetMeshTopology(SdfPath const &id)
Gets the topological mesh data for a given prim.
virtual HD_API GfRange3d GetExtent(SdfPath const &id)
Gets the axis aligned bounds of a prim.
virtual HD_API HdReprSelector GetReprSelector(SdfPath const &id)
Returns the authored repr (if any) for the given prim.
void Resize(unsigned int newSize) override
Resize the internal buffers.
The SceneDelegate is requested to synchronize prims as the result of executing a specific render pass...
Definition: sceneDelegate.h:68
virtual HD_API PxOsdSubdivTags GetSubdivTags(SdfPath const &id)
Gets the subdivision surface tags (sharpness, holes, etc).
virtual HD_API TfToken GetRenderTag(SdfPath const &id)
Returns the render tag that will be used to bucket prims during render pass bucketing.
Describes one or more authored display representations for an rprim.
Definition: repr.h:48
virtual HD_API bool IsEnabled(TfToken const &option) const
Returns true if the named option is enabled by the delegate.
virtual HD_API VtIntArray GetInstanceIndices(SdfPath const &instancerId, SdfPath const &prototypeId)
Gets the extracted indices array of the prototype id used in the instancer.
virtual HD_API size_t SampleInstancerTransform(SdfPath const &instancerId, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues)
Store up to maxSampleCount transform samples in *sampleValues.
An array of a value sampled over time, in struct-of-arrays layout.
Extends HdPrimvarDescriptor to describe a primvar that takes data from the output of an ExtComputatio...
virtual void Resize(unsigned int newSize)
Resize the internal buffers.
virtual HD_API HdDisplayStyle GetDisplayStyle(SdfPath const &id)
Returns the refinement level for the given prim in the range [0,8].
bool displacementEnabled
Is the prim displacement shaded.
Definition: sceneDelegate.h:88
virtual HD_API std::string GetExtComputationKernel(SdfPath const &computationId)
Returns the kernel source assigned to the computation at the path id.
virtual HD_API SdfPath GetInstancerId(SdfPath const &primId)
Returns the parent instancer of the given rprim or instancer.
TfToken role
Optional "role" indicating a desired interpretation – for example, to distinguish color/vector/point/...
Topology data for meshes.
Definition: meshTopology.h:55
HdRenderIndex & GetRenderIndex()
Returns the RenderIndex owned by this delegate.
bool pointsShadingEnabled
Should the prim's points get shaded like surfaces, as opposed to constant shaded?
Definition: sceneDelegate.h:96
An array of a value and its indices sampled over time, in struct-of-arrays layout.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:166
virtual HD_API SdfPath GetScenePrimPath(SdfPath const &rprimId, int instanceIndex, HdInstancerContext *instancerContext=nullptr)
Returns the scene address of the prim corresponding to the given rprim/instance index.
virtual HD_API VtArray< TfToken > GetCategories(SdfPath const &id)
Returns the prim categories.