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/assetPath.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 
53 PXR_NAMESPACE_OPEN_SCOPE
54 
56 
58 typedef std::shared_ptr<SdfPathVector> HdIdVectorSharedPtr;
59 
61 typedef std::vector<std::pair<SdfPath, int>> HdInstancerContext;
62 
70  // The Prims to synchronize in this request.
71  SdfPathVector IDs;
72 
73  // The HdChangeTracker::DirtyBits that are set for each Prim.
74  std::vector<HdDirtyBits> dirtyBits;
75 };
76 
84 
87 
90 
94 
98 
102 
110  : refineLevel(0)
111  , flatShadingEnabled(false)
112  , displacementEnabled(true)
114  , pointsShadingEnabled(false)
115  , materialIsFinal(false)
116  { }
117 
130  HdDisplayStyle(int refineLevel_,
131  bool flatShading = false,
132  bool displacement = true,
133  bool occludedSelectionShowsThrough_ = false,
134  bool pointsShadingEnabled_ = false,
135  bool materialIsFinal_ = false)
136  : refineLevel(std::max(0, refineLevel_))
137  , flatShadingEnabled(flatShading)
138  , displacementEnabled(displacement)
139  , occludedSelectionShowsThrough(occludedSelectionShowsThrough_)
140  , pointsShadingEnabled(pointsShadingEnabled_)
141  , materialIsFinal(materialIsFinal_)
142  {
143  if (refineLevel_ < 0) {
144  TF_CODING_ERROR("negative refine level is not supported");
145  } else if (refineLevel_ > 8) {
146  TF_CODING_ERROR("refine level > 8 is not supported");
147  }
148  }
149 
150  HdDisplayStyle(HdDisplayStyle const& rhs) = default;
151  ~HdDisplayStyle() = default;
152 
153  bool operator==(HdDisplayStyle const& rhs) const {
154  return refineLevel == rhs.refineLevel
161  }
162  bool operator!=(HdDisplayStyle const& rhs) const {
163  return !(*this == rhs);
164  }
165 };
166 
174  HdInterpolation interpolation;
181  bool indexed;
182 
184  : interpolation(HdInterpolationConstant)
185  , role(HdPrimvarRoleTokens->none)
186  , indexed(false)
187  {}
188  HdPrimvarDescriptor(TfToken const& name_,
189  HdInterpolation interp_,
190  TfToken const& role_=HdPrimvarRoleTokens->none,
191  bool indexed_=false)
192  : name(name_), interpolation(interp_), role(role_), indexed(indexed_)
193  { }
194  bool operator==(HdPrimvarDescriptor const& rhs) const {
195  return name == rhs.name && role == rhs.role
196  && interpolation == rhs.interpolation;
197  }
198  bool operator!=(HdPrimvarDescriptor const& rhs) const {
199  return !(*this == rhs);
200  }
201 };
202 
203 typedef std::vector<HdPrimvarDescriptor> HdPrimvarDescriptorVector;
204 
218  // Alternate imaging mode. Options are origin, bounds, cards, default, and
219  // inherited.
220  TfToken drawMode;
221  // Specifies whether to apply the alternative imaging mode or not.
222  bool applyDrawMode;
223  // The color in which to draw the geometry.
224  GfVec3f drawModeColor;
225  // The specific geometry to use in cards mode. Options are cross, box, and
226  // fromTexture.
227  TfToken cardGeometry;
228  // The textures applied to the respective quads in cards mode.
229  SdfAssetPath cardTextureXPos;
230  SdfAssetPath cardTextureYPos;
231  SdfAssetPath cardTextureZPos;
232  SdfAssetPath cardTextureXNeg;
233  SdfAssetPath cardTextureYNeg;
234  SdfAssetPath cardTextureZNeg;
235 
237  : drawMode(HdModelDrawModeTokens->inherited)
238  , applyDrawMode(false)
239  , drawModeColor(GfVec3f(0.18))
240  , cardGeometry(HdModelDrawModeTokens->cross)
241  {}
242 
244  TfToken const& drawMode_,
245  bool applyDrawMode_=false,
246  GfVec3f drawModeColor_=GfVec3f(0.18),
247  TfToken const& cardGeometry_=HdModelDrawModeTokens->cross,
248  SdfAssetPath cardTextureXPos_=SdfAssetPath(),
249  SdfAssetPath cardTextureYPos_=SdfAssetPath(),
250  SdfAssetPath cardTextureZPos_=SdfAssetPath(),
251  SdfAssetPath cardTextureXNeg_=SdfAssetPath(),
252  SdfAssetPath cardTextureYNeg_=SdfAssetPath(),
253  SdfAssetPath cardTextureZNeg_=SdfAssetPath())
254  : drawMode(drawMode_), applyDrawMode(applyDrawMode_),
255  drawModeColor(drawModeColor_), cardGeometry(cardGeometry_),
256  cardTextureXPos(cardTextureXPos_), cardTextureYPos(cardTextureYPos_),
257  cardTextureZPos(cardTextureZPos_), cardTextureXNeg(cardTextureXNeg_),
258  cardTextureYNeg(cardTextureYNeg_), cardTextureZNeg(cardTextureZNeg_)
259  {}
260 
261  bool operator==(HdModelDrawMode const& rhs) const {
262  return drawMode == rhs.drawMode &&
263  applyDrawMode == rhs.applyDrawMode &&
264  drawModeColor == rhs.drawModeColor &&
265  cardGeometry == rhs.cardGeometry &&
266  cardTextureXPos == rhs.cardTextureXPos &&
267  cardTextureYPos == rhs.cardTextureYPos &&
268  cardTextureZPos == rhs.cardTextureZPos &&
269  cardTextureXNeg == rhs.cardTextureXNeg &&
270  cardTextureYNeg == rhs.cardTextureYNeg &&
271  cardTextureZNeg == rhs.cardTextureZNeg;
272  }
273  bool operator!=(HdModelDrawMode const& rhs) const {
274  return !(*this == rhs);
275  }
276 };
277 
288  SdfPath sourceComputationId;
289  TfToken sourceComputationOutputName;
290  HdTupleType valueType;
291 
294  TfToken const& name_,
295  HdInterpolation interp_,
296  TfToken const & role_,
297  SdfPath const & sourceComputationId_,
298  TfToken const & sourceComputationOutputName_,
299  HdTupleType const & valueType_)
300  : HdPrimvarDescriptor(name_, interp_, role_, false)
301  , sourceComputationId(sourceComputationId_)
302  , sourceComputationOutputName(sourceComputationOutputName_)
303  , valueType(valueType_)
304  { }
305  bool operator==(HdExtComputationPrimvarDescriptor const& rhs) const {
306  return HdPrimvarDescriptor::operator==(rhs) &&
307  sourceComputationId == rhs.sourceComputationId &&
308  sourceComputationOutputName == rhs.sourceComputationOutputName &&
309  valueType == rhs.valueType;
310  }
311  bool operator!=(HdExtComputationPrimvarDescriptor const& rhs) const {
312  return !(*this == rhs);
313  }
314 };
315 
316 typedef std::vector<HdExtComputationPrimvarDescriptor>
317  HdExtComputationPrimvarDescriptorVector;
318 
328  TfToken name;
329  SdfPath sourceComputationId;
330  TfToken sourceComputationOutputName;
331 
334  TfToken const & name_,
335  SdfPath const & sourceComputationId_,
336  TfToken const & sourceComputationOutputName_)
337  : name(name_), sourceComputationId(sourceComputationId_)
338  , sourceComputationOutputName(sourceComputationOutputName_)
339  { }
340 
341  bool operator==(HdExtComputationInputDescriptor const& rhs) const {
342  return name == rhs.name &&
343  sourceComputationId == rhs.sourceComputationId &&
344  sourceComputationOutputName == rhs.sourceComputationOutputName;
345  }
346  bool operator!=(HdExtComputationInputDescriptor const& rhs) const {
347  return !(*this == rhs);
348  }
349 };
350 
351 typedef std::vector<HdExtComputationInputDescriptor>
352  HdExtComputationInputDescriptorVector;
353 
361  TfToken name;
362  HdTupleType valueType;
363 
366  TfToken const & name_,
367  HdTupleType const & valueType_)
368  : name(name_), valueType(valueType_)
369  { }
370 
371  bool operator==(HdExtComputationOutputDescriptor const& rhs) const {
372  return name == rhs.name &&
373  valueType == rhs.valueType;
374  }
375  bool operator!=(HdExtComputationOutputDescriptor const& rhs) const {
376  return !(*this == rhs);
377  }
378 };
379 
380 typedef std::vector<HdExtComputationOutputDescriptor>
381  HdExtComputationOutputDescriptorVector;
382 
388  TfToken fieldName;
389  TfToken fieldPrimType;
390  SdfPath fieldId;
391 
394  TfToken const & fieldName_,
395  TfToken const & fieldPrimType_,
396  SdfPath const & fieldId_)
397  : fieldName(fieldName_), fieldPrimType(fieldPrimType_), fieldId(fieldId_)
398  { }
399 };
400 
401 typedef std::vector<HdVolumeFieldDescriptor>
402  HdVolumeFieldDescriptorVector;
403 
409 public:
411  HD_API
412  HdSceneDelegate(HdRenderIndex *parentIndex,
413  SdfPath const& delegateID);
414 
415  HD_API
416  virtual ~HdSceneDelegate();
417 
419  HdRenderIndex& GetRenderIndex() { return *_index; }
420 
425  SdfPath const& GetDelegateID() const { return _delegateID; }
426 
428  HD_API
429  virtual void Sync(HdSyncRequestVector* request);
430 
433  HD_API
434  virtual void PostSyncCleanup();
435 
436  // -----------------------------------------------------------------------//
438  // -----------------------------------------------------------------------//
439 
441  HD_API
442  virtual bool IsEnabled(TfToken const& option) const;
443 
444 
445  // -----------------------------------------------------------------------//
447  // -----------------------------------------------------------------------//
448 
450  HD_API
451  virtual HdMeshTopology GetMeshTopology(SdfPath const& id);
452 
454  HD_API
456 
458  HD_API
459  virtual PxOsdSubdivTags GetSubdivTags(SdfPath const& id);
460 
461 
469  HD_API
470  virtual GfRange3d GetExtent(SdfPath const & id);
471 
473  HD_API
474  virtual GfMatrix4d GetTransform(SdfPath const & id);
475 
477  HD_API
478  virtual bool GetVisible(SdfPath const & id);
479 
481  HD_API
482  virtual bool GetDoubleSided(SdfPath const & id);
483 
485  HD_API
486  virtual HdCullStyle GetCullStyle(SdfPath const &id);
487 
489  HD_API
490  virtual VtValue GetShadingStyle(SdfPath const &id);
491 
496  HD_API
497  virtual HdDisplayStyle GetDisplayStyle(SdfPath const& id);
498 
500  HD_API
501  virtual VtValue Get(SdfPath const& id, TfToken const& key);
502 
507  HD_API
508  virtual VtValue GetIndexedPrimvar(SdfPath const& id,
509  TfToken const& key,
510  VtIntArray *outIndices);
511 
513  HD_API
514  virtual HdReprSelector GetReprSelector(SdfPath const &id);
515 
518  HD_API
519  virtual TfToken GetRenderTag(SdfPath const& id);
520 
522  HD_API
523  virtual VtArray<TfToken> GetCategories(SdfPath const& id);
524 
526  HD_API
527  virtual std::vector<VtArray<TfToken>>
528  GetInstanceCategories(SdfPath const &instancerId);
529 
531  HD_API
532  virtual HdIdVectorSharedPtr GetCoordSysBindings(SdfPath const& id);
533 
535  HD_API
536  virtual HdModelDrawMode GetModelDrawMode(SdfPath const& id);
537 
538  // -----------------------------------------------------------------------//
540  // -----------------------------------------------------------------------//
541 
549  HD_API
550  virtual size_t
551  SampleTransform(SdfPath const & id,
552  size_t maxSampleCount,
553  float *sampleTimes,
554  GfMatrix4d *sampleValues);
555 
559  template <unsigned int CAPACITY>
560  void
563  size_t authoredSamples =
564  SampleTransform(id, CAPACITY, sa->times.data(), sa->values.data());
565  if (authoredSamples > CAPACITY) {
566  sa->Resize(authoredSamples);
567  size_t authoredSamplesSecondAttempt =
569  id,
570  authoredSamples,
571  sa->times.data(),
572  sa->values.data());
573  // Number of samples should be consisntent through multiple
574  // invokations of the sampling function.
575  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
576  }
577  sa->count = authoredSamples;
578  }
579 
587  HD_API
588  virtual size_t
589  SampleInstancerTransform(SdfPath const &instancerId,
590  size_t maxSampleCount,
591  float *sampleTimes,
592  GfMatrix4d *sampleValues);
593 
598  template <unsigned int CAPACITY>
599  void
600  SampleInstancerTransform(SdfPath const &instancerId,
602  size_t authoredSamples =
604  instancerId,
605  CAPACITY,
606  sa->times.data(),
607  sa->values.data());
608  if (authoredSamples > CAPACITY) {
609  sa->Resize(authoredSamples);
610  size_t authoredSamplesSecondAttempt =
612  instancerId,
613  authoredSamples,
614  sa->times.data(),
615  sa->values.data());
616  // Number of samples should be consisntent through multiple
617  // invokations of the sampling function.
618  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
619  }
620  sa->count = authoredSamples;
621  }
622 
640  HD_API
641  virtual size_t
642  SamplePrimvar(SdfPath const& id,
643  TfToken const& key,
644  size_t maxSampleCount,
645  float *sampleTimes,
646  VtValue *sampleValues);
647 
651  template <unsigned int CAPACITY>
652  void
653  SamplePrimvar(SdfPath const &id,
654  TfToken const& key,
656 
662  HD_API
663  virtual size_t
664  SampleIndexedPrimvar(SdfPath const& id,
665  TfToken const& key,
666  size_t maxSampleCount,
667  float *sampleTimes,
668  VtValue *sampleValues,
669  VtIntArray *sampleIndices);
670 
674  template <unsigned int CAPACITY>
675  void
676  SampleIndexedPrimvar(SdfPath const &id,
677  TfToken const& key,
679 
680  // -----------------------------------------------------------------------//
682  // -----------------------------------------------------------------------//
683 
696  HD_API
697  virtual VtIntArray GetInstanceIndices(SdfPath const &instancerId,
698  SdfPath const &prototypeId);
699 
701  HD_API
702  virtual GfMatrix4d GetInstancerTransform(SdfPath const &instancerId);
703 
705  HD_API
706  virtual SdfPath GetInstancerId(SdfPath const& primId);
707 
712  HD_API
713  virtual SdfPathVector GetInstancerPrototypes(SdfPath const& instancerId);
714 
715  // -----------------------------------------------------------------------//
717  // -----------------------------------------------------------------------//
718 
723  HD_API
724  virtual SdfPath GetScenePrimPath(SdfPath const& rprimId,
725  int instanceIndex,
726  HdInstancerContext *instancerContext = nullptr);
727 
733  HD_API
734  virtual SdfPathVector GetScenePrimPaths(SdfPath const& rprimId,
735  std::vector<int> instanceIndices,
736  std::vector<HdInstancerContext> *instancerContexts = nullptr);
737 
738  // -----------------------------------------------------------------------//
740  // -----------------------------------------------------------------------//
741 
743  HD_API
744  virtual SdfPath GetMaterialId(SdfPath const &rprimId);
745 
746  // Returns a material resource which contains the information
747  // needed to create a material.
748  HD_API
749  virtual VtValue GetMaterialResource(SdfPath const &materialId);
750 
751  // -----------------------------------------------------------------------//
753  // -----------------------------------------------------------------------//
754 
756  HD_API
758 
759  // -----------------------------------------------------------------------//
761  // -----------------------------------------------------------------------//
762 
763  // Returns a single value for a given light and parameter.
764  HD_API
765  virtual VtValue GetLightParamValue(SdfPath const &id,
766  TfToken const &paramName);
767 
768  // -----------------------------------------------------------------------//
770  // -----------------------------------------------------------------------//
771 
774  HD_API
775  virtual VtValue GetCameraParamValue(SdfPath const& cameraId,
776  TfToken const& paramName);
777 
778  // -----------------------------------------------------------------------//
780  // -----------------------------------------------------------------------//
781 
782  HD_API
783  virtual HdVolumeFieldDescriptorVector
784  GetVolumeFieldDescriptors(SdfPath const &volumeId);
785 
786  // -----------------------------------------------------------------------//
788  // -----------------------------------------------------------------------//
789 
797  HD_API
798  virtual TfTokenVector
799  GetExtComputationSceneInputNames(SdfPath const& computationId);
800 
806  HD_API
807  virtual HdExtComputationInputDescriptorVector
808  GetExtComputationInputDescriptors(SdfPath const& computationId);
809 
814  HD_API
815  virtual HdExtComputationOutputDescriptorVector
816  GetExtComputationOutputDescriptors(SdfPath const& computationId);
817 
818 
826  HD_API
827  virtual HdExtComputationPrimvarDescriptorVector
829  HdInterpolation interpolationMode);
830 
833  HD_API
834  virtual VtValue GetExtComputationInput(SdfPath const& computationId,
835  TfToken const& input);
836 
844  HD_API
845  virtual size_t SampleExtComputationInput(SdfPath const& computationId,
846  TfToken const& input,
847  size_t maxSampleCount,
848  float *sampleTimes,
849  VtValue *sampleValues);
850 
855  template <unsigned int CAPACITY>
856  void SampleExtComputationInput(SdfPath const& computationId,
857  TfToken const& input,
859  size_t authoredSamples = SampleExtComputationInput(
860  computationId, input, CAPACITY,
861  sa->times.data(), sa->values.data());
862 
863  if (authoredSamples > CAPACITY) {
864  sa->Resize(authoredSamples);
865  size_t authoredSamplesSecondAttempt = SampleExtComputationInput(
866  computationId, input, authoredSamples,
867  sa->times.data(), sa->values.data());
868  // Number of samples should be consisntent through multiple
869  // invokations of the sampling function.
870  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
871  }
872  sa->count = authoredSamples;
873  }
874 
878  HD_API
879  virtual std::string GetExtComputationKernel(SdfPath const& computationId);
880 
891  HD_API
892  virtual void InvokeExtComputation(SdfPath const& computationId,
893  HdExtComputationContext *context);
894 
895  // -----------------------------------------------------------------------//
897  // -----------------------------------------------------------------------//
898 
900  HD_API
901  virtual HdPrimvarDescriptorVector
902  GetPrimvarDescriptors(SdfPath const& id, HdInterpolation interpolation);
903 
904  // -----------------------------------------------------------------------//
906  // -----------------------------------------------------------------------//
907  HD_API
908  virtual TfTokenVector GetTaskRenderTags(SdfPath const& taskId);
909 
910 private:
911  HdRenderIndex *_index;
912  SdfPath _delegateID;
913 
914  HdSceneDelegate() = delete;
915  HdSceneDelegate(HdSceneDelegate &) = delete;
916  HdSceneDelegate &operator=(HdSceneDelegate &) = delete;
917 };
918 
919 template <unsigned int CAPACITY>
920 void
922  TfToken const& key,
924  size_t authoredSamples =
926  id,
927  key,
928  CAPACITY,
929  sa->times.data(),
930  sa->values.data());
931  if (authoredSamples > CAPACITY) {
932  sa->Resize(authoredSamples);
933  size_t authoredSamplesSecondAttempt =
935  id,
936  key,
937  authoredSamples,
938  sa->times.data(),
939  sa->values.data());
940  // Number of samples should be consistent through multiple
941  // invocations of the sampling function.
942  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
943  }
944  sa->count = authoredSamples;
945 }
946 
947 template <unsigned int CAPACITY>
948 void
950  TfToken const& key,
952  size_t authoredSamples =
954  id,
955  key,
956  CAPACITY,
957  sa->times.data(),
958  sa->values.data(),
959  sa->indices.data());
960  if (authoredSamples > CAPACITY) {
961  sa->Resize(authoredSamples);
962  size_t authoredSamplesSecondAttempt =
964  id,
965  key,
966  authoredSamples,
967  sa->times.data(),
968  sa->values.data(),
969  sa->indices.data());
970  // Number of samples should be consistent through multiple
971  // invocations of the sampling function.
972  TF_VERIFY(authoredSamples == authoredSamplesSecondAttempt);
973  }
974  sa->count = authoredSamples;
975 }
976 
977 PXR_NAMESPACE_CLOSE_SCOPE
978 
979 #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:63
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:81
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
Basic type for a vector of 3 float components.
Definition: vec3f.h:62
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:86
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 HdModelDrawMode GetModelDrawMode(SdfPath const &id)
Returns the model draw mode object for the given prim.
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.
Describes optional alternative imaging behavior for prims.
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:87
#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:93
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:83
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.
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
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:69
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:89
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:97
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.