drawItem.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HD_ST_DRAW_ITEM_H
25 #define PXR_IMAGING_HD_ST_DRAW_ITEM_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdSt/api.h"
29 #include "pxr/imaging/hd/drawItem.h"
30 
31 PXR_NAMESPACE_OPEN_SCOPE
32 
33 using HdSt_GeometricShaderSharedPtr =
34  std::shared_ptr<class HdSt_GeometricShader>;
35 using HdSt_MaterialNetworkShaderSharedPtr =
36  std::shared_ptr<class HdSt_MaterialNetworkShader>;
37 
38 class HdStDrawItem : public HdDrawItem
39 {
40 public:
41  HF_MALLOC_TAG_NEW("new HdStDrawItem");
42 
43  HDST_API
44  HdStDrawItem(HdRprimSharedData const *sharedData);
45 
46  HDST_API
47  ~HdStDrawItem() override;
48 
49  void SetGeometricShader(HdSt_GeometricShaderSharedPtr const &shader) {
50  _geometricShader = shader;
51  }
52 
53  HdSt_GeometricShaderSharedPtr const &GetGeometricShader() const {
54  return _geometricShader;
55  }
56 
57  HdSt_MaterialNetworkShaderSharedPtr const &
58  GetMaterialNetworkShader() const {
59  return _materialNetworkShader;
60  }
61 
62  void SetMaterialNetworkShader(
63  HdSt_MaterialNetworkShaderSharedPtr const &shader) {
64  _materialNetworkShader = shader;
65  }
66 
67  bool GetMaterialIsFinal() const {
68  return _materialIsFinal;
69  }
70 
71  void SetMaterialIsFinal(bool isFinal) {
72  _materialIsFinal = isFinal;
73  }
74 
75 protected:
76  size_t _GetBufferArraysHash() const override;
77  size_t _GetElementOffsetsHash() const override;
78 
79 private:
80  HdSt_GeometricShaderSharedPtr _geometricShader;
81  HdSt_MaterialNetworkShaderSharedPtr _materialNetworkShader;
82  bool _materialIsFinal;
83 };
84 
85 
86 PXR_NAMESPACE_CLOSE_SCOPE
87 
88 #endif //PXR_IMAGING_HD_ST_DRAW_ITEM_H
virtual HD_API size_t _GetElementOffsetsHash() const
Allows derived classes to return a hash of the element offsets of the underlying BARs they manage.
virtual HD_API size_t _GetBufferArraysHash() const
Allows derived classes to return a hash of the versions of buffers they manage.
A draw item is a light-weight representation of an HdRprim's resources and material to be used for re...
Definition: drawItem.h:66