7#ifndef PXR_IMAGING_HD_RPRIM_H
8#define PXR_IMAGING_HD_RPRIM_H
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/version.h"
13#include "pxr/imaging/hd/rprimSharedData.h"
14#include "pxr/imaging/hd/repr.h"
15#include "pxr/imaging/hd/sceneDelegate.h"
16#include "pxr/imaging/hd/types.h"
17#include "pxr/usd/sdf/path.h"
24PXR_NAMESPACE_OPEN_SCOPE
30using HdReprSharedPtr = std::shared_ptr<HdRepr>;
83 HdDirtyBits *dirtyBits);
116 HdDirtyBits *dirtyBits,
127 const HdRepr::DrawItemUniquePtrVector &
169 return _authoredReprSelector;
172 TfToken const& GetRenderTag()
const {
183 inline HdPrimvarDescriptorVector
185 HdInterpolation interpolation)
const;
197 VtIntArray *indices)
const;
211 HdDirtyBits *dirtyBits);
247 HdDirtyBits *dirtyBits) = 0;
253 HdReprSharedPtr
const & _GetRepr(
TfToken const &reprToken)
const;
257 HdDirtyBits *dirtyBits);
261 HdDirtyBits *dirtyBits);
272 HdRprimSharedData _sharedData;
282 using _ReprVector = std::vector<std::pair<TfToken, HdReprSharedPtr>>;
285 struct _ReprComparator
287 _ReprComparator(
TfToken const &name) : _name(name) {}
288 bool operator() (
const std::pair<TfToken, HdReprSharedPtr> &e)
const {
289 return _name == e.first;
301 template<
typename DESC_TYPE,
int N=1>
302 struct _ReprDescConfigs
304 using DescArray = std::array<DESC_TYPE, N>;
305 static const int MAX_DESCS = N;
307 DescArray Find(
TfToken const &reprToken)
const {
310 if (it->first == reprToken)
return it->second;
315 void AddOrUpdate(
TfToken const &reprToken, DescArray descs) {
316 for (
auto& config : _configs) {
317 if (config.first == reprToken) {
319 config.second = descs;
323 _configs.push_back(std::make_pair(reprToken, descs));
325 std::vector<std::pair<TfToken, DescArray> > _configs;
346inline HdPrimvarDescriptorVector
348 HdInterpolation interpolation)
const
356 return delegate->
Get(
GetId(), name);
361 VtIntArray *indices)
const
366PXR_NAMESPACE_CLOSE_SCOPE
Basic type: 3-dimensional floating point range.
Tracks changes from the HdSceneDelegate, providing invalidation cues to the render engine.
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Describes one or more authored display representations for an rprim.
The render engine state for a given rprim from the scene graph.
virtual HD_API TfTokenVector const & GetBuiltinPrimvarNames() const =0
Returns the names of built-in primvars, i.e.
HD_API void SetPrimId(int32_t primId)
Set the unique instance id.
SdfPath const & GetMaterialId() const
Returns the path of the material to which this Rprim is bound.
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.
SdfPath const & GetId() const
Returns the identifier of this Rprim.
GfRange3d GetExtent(HdSceneDelegate *delegate) const
Returns the bounds of the rprim in local, untransformed space.
bool IsVisible() const
Is the prim itself visible.
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...
HdPrimvarDescriptorVector GetPrimvarDescriptors(HdSceneDelegate *delegate, HdInterpolation interpolation) const
Primvar Query.
HD_API bool IsDirty(HdChangeTracker &changeTracker) const
Returns true if any dirty flags are set for this rprim.
HD_API void SetMaterialId(SdfPath const &materialId)
Sets a new material binding to be used by this rprim.
virtual HdDirtyBits GetInitialDirtyBitsMask() const =0
Returns the set of dirty bits that should be added to the change tracker for this prim,...
HD_API bool CanSkipDirtyBitPropagationAndSync(HdDirtyBits bits) const
This function gives an Rprim the chance to "early exit" from dirty bit propagation,...
virtual void Sync(HdSceneDelegate *delegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits, TfToken const &reprToken)=0
Pull invalidated scene data and prepare/update the renderable representation.
SdfPath const & GetInstancerId() const
Returns the identifier of the instancer (if any) for this Rprim.
int32_t GetPrimId() const
Return the unique instance id.
virtual void _InitRepr(TfToken const &reprToken, HdDirtyBits *dirtyBits)=0
Initialize the given representation of this Rprim.
HD_API void InitRepr(HdSceneDelegate *delegate, TfToken const &reprToken, HdDirtyBits *dirtyBits)
Initialize the representation of this Rprim by calling _InitRepr.
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...
Adapter class providing data exchange with the client scene graph.
virtual HD_API TfToken GetRenderTag(SdfPath const &id)
Returns the render tag that will be used to bucket prims during render pass bucketing.
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.
virtual HD_API VtValue Get(SdfPath const &id, TfToken const &key)
Returns a named value.
virtual HD_API VtValue GetIndexedPrimvar(SdfPath const &id, TfToken const &key, VtIntArray *outIndices)
Returns a named primvar value.
A path value used to locate objects in layers or scenegraphs.
Token for efficient comparison, assignment, and hashing of known strings.
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...
#define TF_FOR_ALL(iter, c)
Macro for iterating over a container.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
std::vector< TfToken > TfTokenVector
Convenience types.