HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
drawTarget.h
Go to the documentation of this file.
1 //
2 // Copyright 2017 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_TARGET_H
25 #define PXR_IMAGING_HD_ST_DRAW_TARGET_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdSt/api.h"
31 #include "pxr/imaging/hd/sprim.h"
32 
33 #include "pxr/usd/sdf/path.h"
35 
36 #include <vector>
37 
39 
40 
41 #define HDST_DRAW_TARGET_TOKENS \
42  (camera) \
43  (collection) \
44  (drawTargetSet) \
45  (enable) \
46  (resolution) \
47  (aovBindings) \
48  (depthPriority)
49 
51 
52 class HdCamera;
53 class HdRenderIndex;
54 using HdStDrawTargetPtrVector = std::vector<class HdStDrawTarget *>;
55 
56 /// \class HdStDrawTarget
57 ///
58 /// Represents an render to texture render pass.
59 ///
60 /// \note This is a temporary API to aid transition to Storm, and is subject
61 /// to major changes.
62 ///
63 class HdStDrawTarget : public HdSprim
64 {
65 public:
66  HDST_API
67  HdStDrawTarget(SdfPath const & id);
68  HDST_API
69  ~HdStDrawTarget() override;
70 
71  /// Dirty bits for the HdStDrawTarget object
72  ///
73  /// When GetUseStormTextureSystem() is true, "Legacy" dirty
74  /// bits are ignored.
75  ///
77  Clean = 0,
78  DirtyDTEnable = 1 << 0,
79  DirtyDTCamera = 1 << 1,
90  };
91 
92  /// Synchronizes state from the delegate to this object.
93  HDST_API
94  void Sync(HdSceneDelegate *sceneDelegate,
95  HdRenderParam *renderParam,
96  HdDirtyBits *dirtyBits) override;
97 
98  /// Returns the minimal set of dirty bits to place in the
99  /// change tracker for use in the first sync of this prim.
100  /// Typically this would be all dirty bits.
101  HDST_API
102  HdDirtyBits GetInitialDirtyBitsMask() const override;
103 
104 
105  // ---------------------------------------------------------------------- //
106  /// \name Draw Target API
107  // ---------------------------------------------------------------------- //
108  bool IsEnabled() const { return _enabled; }
110  {
111  return &_drawTargetRenderPassState;
112  }
113 
114  /// Returns collection of rprims the draw target draws.
115  HDST_API
116  HdRprimCollection const &GetCollection() const { return _collection; }
117 
118  /// returns all HdStDrawTargets in the render index
119  HDST_API
120  static void GetDrawTargets(HdRenderIndex* renderIndex,
121  HdStDrawTargetPtrVector *drawTargets);
122 
123  /// Resolution.
124  ///
125  /// Set during sync.
126  ///
127  const GfVec2i &GetResolution() const {
128  return _resolution;
129  }
130 
131 private:
132  bool _enabled;
133  GfVec2i _resolution;
134  HdRprimCollection _collection;
135 
136  HdStDrawTargetRenderPassState _drawTargetRenderPassState;
137 
138  // No copy
139  HdStDrawTarget() = delete;
140  HdStDrawTarget(const HdStDrawTarget &) = delete;
141  HdStDrawTarget &operator =(const HdStDrawTarget &) = delete;
142 };
143 
144 
146 
147 #endif // PXR_IMAGING_HD_ST_DRAW_TARGET_H
std::vector< class HdStDrawTarget * > HdStDrawTargetPtrVector
Definition: drawTarget.h:54
Definition: vec2i.h:61
HDST_API HdRprimCollection const & GetCollection() const
Returns collection of rprims the draw target draws.
Definition: drawTarget.h:116
uint32_t HdDirtyBits
Definition: types.h:127
const GfVec2i & GetResolution() const
Definition: drawTarget.h:127
bool IsEnabled() const
Returns collection of rprims the draw target draws.
Definition: drawTarget.h:108
TF_DECLARE_PUBLIC_TOKENS(HdStDrawTargetTokens, HDST_API, HDST_DRAW_TARGET_TOKENS)
HDST_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Synchronizes state from the delegate to this object.
HDST_API HdDirtyBits GetInitialDirtyBitsMask() const override
const HdStDrawTargetRenderPassState * GetDrawTargetRenderPassState() const
Returns collection of rprims the draw target draws.
Definition: drawTarget.h:109
Definition: path.h:288
static HDST_API void GetDrawTargets(HdRenderIndex *renderIndex, HdStDrawTargetPtrVector *drawTargets)
returns all HdStDrawTargets in the render index
Definition: sprim.h:52
HDST_API ~HdStDrawTarget() override
#define HDST_DRAW_TARGET_TOKENS
Definition: drawTarget.h:41
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1375
#define HDST_API
Definition: api.h:40
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91