drawItem.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HD_DRAW_ITEM_H
8 #define PXR_IMAGING_HD_DRAW_ITEM_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
12 #include "pxr/imaging/hd/version.h"
13 #include "pxr/imaging/hd/perfLog.h"
14 #include "pxr/imaging/hd/drawingCoord.h"
15 #include "pxr/imaging/hd/rprimSharedData.h"
16 
17 #include "pxr/imaging/hf/perfLog.h"
18 
19 #include "pxr/base/gf/matrix4d.h"
20 #include "pxr/base/gf/bbox3d.h"
21 #include "pxr/base/gf/vec2i.h"
22 
23 PXR_NAMESPACE_OPEN_SCOPE
24 
25 
48 {
49 public:
50  HF_MALLOC_TAG_NEW("new HdDrawItem");
51 
52  HD_API
53  HdDrawItem(HdRprimSharedData const *sharedData);
54 
55  HD_API
56  virtual ~HdDrawItem();
57 
58  SdfPath const &GetRprimID() const { return _sharedData->rprimID; }
59 
60  GfBBox3d const & GetBounds() const { return _sharedData->bounds; }
61 
62  GfRange3d const& GetExtent() const {
63  return _sharedData->bounds.GetRange();
64  }
65 
66  GfMatrix4d const& GetMatrix() const {
67  return _sharedData->bounds.GetMatrix();
68  }
69 
70  HdDrawingCoord *GetDrawingCoord() {
71  return &_drawingCoord;
72  }
73 
75  bool GetVisible() const { return _sharedData->visible; }
76 
77  TfToken const& GetMaterialTag() const {
78  return _materialTag;
79  }
80 
81  void SetMaterialTag(TfToken const &materialTag) {
82  _materialTag = materialTag;
83  }
84 
85 protected:
88  return _drawingCoord;
89  }
90 
92  HdRprimSharedData const *_GetSharedData() const {
93  return _sharedData;
94  }
95 
96 private:
97  // configuration of how to bundle the drawing coordinate for this draw item
98  // out of BARs in sharedData
99  HdDrawingCoord _drawingCoord;
100 
101  // pointer to shared data across reprs, owned by rprim:
102  // bufferArrayRanges, bounds, visibility
103  HdRprimSharedData const *_sharedData;
104 
109  TfToken _materialTag;
110 };
111 
112 
113 PXR_NAMESPACE_CLOSE_SCOPE
114 
115 #endif //PXR_IMAGING_HD_DRAW_ITEM_H
Basic type: 3-dimensional floating point range.
Definition: range3d.h:46
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:80
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:70
A tiny set of integers, which provides an indirection mapping from the conceptual space of an HdRprim...
Definition: drawingCoord.h:66
HdDrawingCoord const & _GetDrawingCoord() const
Returns the drawingCoord.
Definition: drawItem.h:87
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
bool GetVisible() const
Returns the authored visibility, expressed by the delegate.
Definition: drawItem.h:75
A draw item is a light-weight representation of an HdRprim's resources and material to be used for re...
Definition: drawItem.h:47
HdRprimSharedData const * _GetSharedData() const
Returns the shared data.
Definition: drawItem.h:92
Basic type: arbitrarily oriented 3D bounding box.
Definition: bbox3d.h:67