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/rprimSharedData.h" 31 #include "pxr/imaging/hd/repr.h" 32 #include "pxr/imaging/hd/sceneDelegate.h" 33 #include "pxr/imaging/hd/types.h" 34 #include "pxr/usd/sdf/path.h" 41 PXR_NAMESPACE_OPEN_SCOPE
47 using HdReprSharedPtr = std::shared_ptr<HdRepr>;
100 HdDirtyBits *dirtyBits);
133 HdDirtyBits *dirtyBits,
144 const HdRepr::DrawItemUniquePtrVector &
186 return _authoredReprSelector;
189 TfToken const& GetRenderTag()
const {
200 inline HdPrimvarDescriptorVector
202 HdInterpolation interpolation)
const;
214 VtIntArray *indices)
const;
228 HdDirtyBits *dirtyBits);
264 HdDirtyBits *dirtyBits) = 0;
270 HdReprSharedPtr
const & _GetRepr(
TfToken const &reprToken)
const;
274 HdDirtyBits *dirtyBits);
278 HdDirtyBits *dirtyBits);
289 HdRprimSharedData _sharedData;
299 using _ReprVector = std::vector<std::pair<TfToken, HdReprSharedPtr>>;
302 struct _ReprComparator
304 _ReprComparator(
TfToken const &name) : _name(name) {}
305 bool operator() (
const std::pair<TfToken, HdReprSharedPtr> &e)
const {
306 return _name == e.first;
318 template<
typename DESC_TYPE,
int N=1>
319 struct _ReprDescConfigs
321 using DescArray = std::array<DESC_TYPE, N>;
322 static const int MAX_DESCS = N;
324 DescArray Find(
TfToken const &reprToken)
const {
327 if (it->first == reprToken)
return it->second;
332 void AddOrUpdate(
TfToken const &reprToken, DescArray descs) {
333 for (
auto& config : _configs) {
334 if (config.first == reprToken) {
336 config.second = descs;
340 _configs.push_back(std::make_pair(reprToken, descs));
342 std::vector<std::pair<TfToken, DescArray> > _configs;
363 inline HdPrimvarDescriptorVector
365 HdInterpolation interpolation)
const 373 return delegate->
Get(
GetId(), name);
378 VtIntArray *indices)
const 383 PXR_NAMESPACE_CLOSE_SCOPE
385 #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,...
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Basic type: 3-dimensional floating point range.
HD_API bool IsDirty(HdChangeTracker &changeTracker) const
Returns true if any dirty flags are set for this rprim.
int32_t GetPrimId() const
Return the unique instance id.
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.
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.
SdfPath const & GetMaterialId() const
Returns the path of the material to which this Rprim is bound.
SdfPath const & GetInstancerId() const
Returns the identifier of the instancer (if any) for this Rprim.
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 SetPrimId(int32_t primId)
Set the unique instance id.
The render engine state for a given rprim from the scene graph.
#define TF_FOR_ALL(iter, c)
Macro for iterating over a container.
Adapter class providing data exchange with the client scene graph.
HD_API bool CanSkipDirtyBitPropagationAndSync(HdDirtyBits bits) const
This function gives an Rprim the chance to "early exit" from dirty bit propagation,...
GfRange3d GetExtent(HdSceneDelegate *delegate) const
Returns the bounds of the rprim in local, untransformed space.
std::vector< TfToken > TfTokenVector
Convenience types.
A path value used to locate objects in layers or scenegraphs.
virtual HD_API VtValue GetIndexedPrimvar(SdfPath const &id, TfToken const &key, VtIntArray *outIndices)
Returns a named primvar value.
SdfPath const & GetId() const
Returns the identifier of this Rprim.
virtual HD_API HdPrimvarDescriptorVector GetPrimvarDescriptors(SdfPath const &id, HdInterpolation interpolation)
Returns descriptors for all primvars of the given interpolation type.
HdPrimvarDescriptorVector GetPrimvarDescriptors(HdSceneDelegate *delegate, HdInterpolation interpolation) const
Primvar Query.
virtual HD_API GfRange3d GetExtent(SdfPath const &id)
Gets the axis aligned bounds of a prim.
virtual void _InitRepr(TfToken const &reprToken, HdDirtyBits *dirtyBits)=0
Initialize the given representation of 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 HdDirtyBits PropagateRprimDirtyBits(HdDirtyBits bits)
This function gives an Rprim the chance to set additional dirty bits based on those set in the change...
HD_API const HdRepr::DrawItemUniquePtrVector & GetDrawItems(TfToken const &reprToken) const
Returns the draw items for the requested repr token, if any.
char const * GetText() const
Return the text that this token represents.
Provides a container which may hold any type, and provides introspection and iteration over array typ...