Loading...
Searching...
No Matches
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_ST_DRAW_ITEM_H
8#define PXR_IMAGING_HD_ST_DRAW_ITEM_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12
13#include "pxr/imaging/hd/drawItem.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17
18using HdSt_GeometricShaderSharedPtr =
19 std::shared_ptr<class HdSt_GeometricShader>;
20using HdSt_MaterialNetworkShaderSharedPtr =
21 std::shared_ptr<class HdSt_MaterialNetworkShader>;
22
23class HdStDrawItem : public HdDrawItem
24{
25public:
26 HF_MALLOC_TAG_NEW("new HdStDrawItem");
27
28 HDST_API
29 HdStDrawItem(HdRprimSharedData const *sharedData);
30
31 HDST_API
32 ~HdStDrawItem() override;
33
35 bool HasInstancer() const {
36 TF_VERIFY(_GetSharedData()->instancerLevels != -1);
37 return (_GetSharedData()->instancerLevels > 0);
38 }
39
41 int GetInstancePrimvarNumLevels() const {
42 TF_VERIFY(_GetSharedData()->instancerLevels != -1);
43 return _GetSharedData()->instancerLevels;
44 }
45
57 HdBufferArrayRangeSharedPtr const &
58 GetInstancePrimvarRange(int level) const {
59 return _GetSharedData()->barContainer.Get(
60 _GetDrawingCoord().GetInstancePrimvarIndex(level));
61 }
62
64 HdBufferArrayRangeSharedPtr const &GetInstanceIndexRange() const {
65 return _GetSharedData()->barContainer.Get(
66 _GetDrawingCoord().GetInstanceIndexIndex());
67 }
68
70 HdBufferArrayRangeSharedPtr const &GetConstantPrimvarRange() const {
71 return _GetSharedData()->barContainer.Get(
72 _GetDrawingCoord().GetConstantPrimvarIndex());
73 }
74
76 HdBufferArrayRangeSharedPtr const &GetElementPrimvarRange() const {
77 return _GetSharedData()->barContainer.Get(
78 _GetDrawingCoord().GetElementPrimvarIndex());
79 }
80
82 HdBufferArrayRangeSharedPtr const &GetVertexPrimvarRange() const {
83 return _GetSharedData()->barContainer.Get(
84 _GetDrawingCoord().GetVertexPrimvarIndex());
85 }
86
88 HdBufferArrayRangeSharedPtr const &GetVaryingPrimvarRange() const {
89 return _GetSharedData()->barContainer.Get(
90 _GetDrawingCoord().GetVaryingPrimvarIndex());
91 }
92
94 HdBufferArrayRangeSharedPtr const &GetFaceVaryingPrimvarRange() const {
95 return _GetSharedData()->barContainer.Get(
96 _GetDrawingCoord().GetFaceVaryingPrimvarIndex());
97 }
98
100 HdBufferArrayRangeSharedPtr const &GetTopologyRange() const {
101 return _GetSharedData()->barContainer.Get(
102 _GetDrawingCoord().GetTopologyIndex());
103 }
104
106 HdBufferArrayRangeSharedPtr const &GetTopologyVisibilityRange() const {
107 return _GetSharedData()->barContainer.Get(
108 _GetDrawingCoord().GetTopologyVisibilityIndex());
109 }
110
112 TopologyToPrimvarVector const &GetFvarTopologyToPrimvarVector() const {
113 return _GetSharedData()->fvarTopologyToPrimvarVector;
114 }
115
116 void SetGeometricShader(HdSt_GeometricShaderSharedPtr const &shader) {
117 _geometricShader = shader;
118 }
119
120 HdSt_GeometricShaderSharedPtr const &GetGeometricShader() const {
121 return _geometricShader;
122 }
123
124 HdSt_MaterialNetworkShaderSharedPtr const &
125 GetMaterialNetworkShader() const {
126 return _materialNetworkShader;
127 }
128
129 void SetMaterialNetworkShader(
130 HdSt_MaterialNetworkShaderSharedPtr const &shader) {
131 _materialNetworkShader = shader;
132 }
133
134 bool GetMaterialIsFinal() const {
135 return _materialIsFinal;
136 }
137
138 void SetMaterialIsFinal(bool isFinal) {
139 _materialIsFinal = isFinal;
140 }
141
146 HDST_API
147 bool IntersectsViewVolume(GfMatrix4d const &viewProjMatrix) const;
148
154 HDST_API
155 size_t GetBufferArraysHash() const;
156
161 HDST_API
162 size_t GetElementOffsetsHash() const;
163
164private:
165 HdSt_GeometricShaderSharedPtr _geometricShader;
166 HdSt_MaterialNetworkShaderSharedPtr _materialNetworkShader;
167 bool _materialIsFinal;
168};
169
170
171PXR_NAMESPACE_CLOSE_SCOPE
172
173#endif //PXR_IMAGING_HD_ST_DRAW_ITEM_H
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
A draw item is a light-weight representation of an HdRprim's resources and material to be used for re...
Definition: drawItem.h:48
HdRprimSharedData const * _GetSharedData() const
Returns the shared data.
Definition: drawItem.h:92
HdDrawingCoord const & _GetDrawingCoord() const
Returns the drawingCoord.
Definition: drawItem.h:87
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Definition: diagnostic.h:266