24 #ifndef PXR_IMAGING_HD_RPRIM_H
25 #define PXR_IMAGING_HD_RPRIM_H
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
30 #include "pxr/imaging/hd/changeTracker.h"
31 #include "pxr/imaging/hd/drawItem.h"
32 #include "pxr/imaging/hd/rprimSharedData.h"
33 #include "pxr/imaging/hd/repr.h"
34 #include "pxr/imaging/hd/sceneDelegate.h"
35 #include "pxr/imaging/hd/types.h"
36 #include "pxr/usd/sdf/path.h"
43 PXR_NAMESPACE_OPEN_SCOPE
52 using HdReprSharedPtr = std::shared_ptr<HdRepr>;
54 using HdBufferSourceSharedPtr = std::shared_ptr<HdBufferSource>;
55 using HdBufferSourceSharedPtrVector = std::vector<HdBufferSourceSharedPtr>;
57 using HdBufferSpecVector = std::vector<struct HdBufferSpec>;
58 using HdBufferArrayRangeSharedPtr = std::shared_ptr<HdBufferArrayRange>;
60 using HdComputationSharedPtr = std::shared_ptr<class HdComputation>;
61 using HdComputationSharedPtrVector = std::vector<HdComputationSharedPtr>;
113 HdDirtyBits *dirtyBits);
146 HdDirtyBits *dirtyBits,
157 const HdRepr::DrawItemUniquePtrVector &
209 return _authoredReprSelector;
219 inline HdPrimvarDescriptorVector
221 HdInterpolation interpolation)
const;
233 VtIntArray *indices)
const;
247 HdDirtyBits *dirtyBits);
279 HdDirtyBits *dirtyBits) = 0;
285 HdReprSharedPtr
const & _GetRepr(
TfToken const &reprToken)
const;
289 HdDirtyBits *dirtyBits);
293 HdDirtyBits *dirtyBits);
304 HdRprimSharedData _sharedData;
311 typedef std::vector<std::pair<TfToken, HdReprSharedPtr> >
315 struct _ReprComparator {
316 _ReprComparator(
TfToken const &name) : _name(name) {}
317 bool operator() (
const std::pair<TfToken, HdReprSharedPtr> &e)
const {
318 return _name == e.first;
330 template<
typename DESC_TYPE,
int N=1>
331 struct _ReprDescConfigs {
332 typedef std::array<DESC_TYPE, N> DescArray;
333 static const int MAX_DESCS = N;
335 DescArray Find(
TfToken const &reprToken)
const {
338 if (it->first == reprToken)
return it->second;
343 void AddOrUpdate(
TfToken const &reprToken, DescArray descs) {
344 for (
auto& config : _configs) {
345 if (config.first == reprToken) {
347 config.second = descs;
351 _configs.push_back(std::make_pair(reprToken, descs));
353 std::vector<std::pair<TfToken, DescArray> > _configs;
374 inline HdPrimvarDescriptorVector
376 HdInterpolation interpolation)
const
384 return delegate->
Get(
GetId(), name);
389 VtIntArray *indices)
const
394 PXR_NAMESPACE_CLOSE_SCOPE
396 #endif //PXR_IMAGING_HD_RPRIM_H
virtual HdDirtyBits GetInitialDirtyBitsMask() const =0
Returns the set of dirty bits that should be added to the change tracker for this prim...
int32_t GetPrimId() const
Return the unique instance id.
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Basic type: 3-dimensional floating point range.
Tracks changes from the HdSceneDelegate, providing invalidation cues to the render engine...
virtual HD_API VtValue Get(SdfPath const &id, TfToken const &key)
Returns a named value.
virtual HdDirtyBits _PropagateDirtyBits(HdDirtyBits bits) const =0
This callback from Rprim gives the prim an opportunity to set additional dirty bits based on those al...
virtual void Sync(HdSceneDelegate *delegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits, TfToken const &reprToken)=0
Pull invalidated scene data and prepare/update the renderable representation.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
HdPrimvarDescriptorVector GetPrimvarDescriptors(HdSceneDelegate *delegate, HdInterpolation interpolation) const
Primvar Query.
virtual HD_API TfTokenVector const & GetBuiltinPrimvarNames() const =0
Returns the names of built-in primvars, i.e.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
HD_API void InitRepr(HdSceneDelegate *delegate, TfToken const &reprToken, HdDirtyBits *dirtyBits)
Initialize the representation of this Rprim by calling _InitRepr.
HD_API void SetMaterialId(SdfPath const &materialId)
Sets a new material binding to be used by this rprim.
bool IsVisible() const
Is the prim itself visible.
Token for efficient comparison, assignment, and hashing of known strings.
HD_API void SetMaterialTag(TfToken const &materialTag)
Sets the material tag used by the rprim.
HD_API void SetPrimId(int32_t primId)
Set the unique instance id.
GfRange3d GetExtent(HdSceneDelegate *delegate) const
Returns the bounds of the rprim in local, untransformed space.
The render engine state for a given rprim from the scene graph.
A transient buffer of data that has not yet been committed.
#define TF_FOR_ALL(iter, c)
Macro for iterating over a container.
Adapter class providing data exchange with the client scene graph.
std::vector< TfToken > TfTokenVector
Convenience types.
SdfPath const & GetId() const
Returns the identifier of this Rprim.
A path value used to locate objects in layers or scenegraphs.
TfToken GetRenderTag(HdSceneDelegate *delegate) const
Returns the render tag associated to this rprim.
HD_API bool CanSkipDirtyBitPropagationAndSync(HdDirtyBits bits) const
This function gives an Rprim the chance to "early exit" from dirty bit propagation, delegate sync and rprim sync altogether.
HD_API bool IsDirty(HdChangeTracker &changeTracker) const
Returns true if any dirty flags are set for this rprim.
virtual HD_API VtValue GetIndexedPrimvar(SdfPath const &id, TfToken const &key, VtIntArray *outIndices)
Returns a named primvar value.
virtual HD_API HdPrimvarDescriptorVector GetPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolation)
Returns descriptors for all primvars of the given interpolation type.
virtual HD_API GfRange3d GetExtent(SdfPath const &id)
Gets the axis aligned bounds of a prim.
SdfPath const & GetMaterialId() const
Returns the path of the material to which this Rprim is bound.
virtual void _InitRepr(TfToken const &reprToken, HdDirtyBits *dirtyBits)=0
Initialize the given representation of this Rprim.
TfToken const & GetMaterialTag() const
The MaterialTag allows rprims to be organized into different collections based on properties of the p...
A draw item is a light-weight representation of an HdRprim's resources and material to be used for re...
SdfPath const & GetInstancerId() const
Returns the identifier of the instancer (if any) for this Rprim.
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.
virtual HD_API void Finalize(HdRenderParam *renderParam)
Finalizes object resources.
HD_API const HdRepr::DrawItemUniquePtrVector & GetDrawItems(TfToken const &reprToken) const
Returns the draw items for the requested repr token, if any.
HD_API HdDirtyBits PropagateRprimDirtyBits(HdDirtyBits bits)
This function gives an Rprim the chance to set additional dirty bits based on those set in the change...
Hydra Schema for a material object.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
char const * GetText() const
Return the text that this token represents.