Loading...
Searching...
No Matches
drawTarget.h
1//
2// Copyright 2017 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_TARGET_H
8#define PXR_IMAGING_HD_ST_DRAW_TARGET_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hdSt/drawTargetRenderPassState.h"
13#include "pxr/imaging/hd/rprimCollection.h"
14#include "pxr/imaging/hd/sprim.h"
15
16#include "pxr/usd/sdf/path.h"
17#include "pxr/base/gf/vec2i.h"
19
20#include <vector>
21
22PXR_NAMESPACE_OPEN_SCOPE
23
24
25#define HDST_DRAW_TARGET_TOKENS \
26 (camera) \
27 (collection) \
28 (enable) \
29 (resolution) \
30 (aovBindings) \
31 (depthPriority)
32
33TF_DECLARE_PUBLIC_TOKENS(HdStDrawTargetTokens, HDST_API, HDST_DRAW_TARGET_TOKENS);
34
35class HdCamera;
36class HdRenderIndex;
37using HdStDrawTargetPtrVector = std::vector<class HdStDrawTarget *>;
38
46class HdStDrawTarget : public HdSprim
47{
48public:
49 HDST_API
50 HdStDrawTarget(SdfPath const & id);
51 HDST_API
52 ~HdStDrawTarget() override;
53
59 enum DirtyBits : HdDirtyBits {
60 Clean = 0,
61 DirtyDTEnable = 1 << 0,
62 DirtyDTCamera = 1 << 1,
63 DirtyDTResolution = 1 << 2,
64 DirtyDTAovBindings = 1 << 4,
65 DirtyDTDepthPriority = 1 << 6,
66 DirtyDTCollection = 1 << 7,
67 AllDirty = (DirtyDTEnable
68 |DirtyDTCamera
69 |DirtyDTResolution
70 |DirtyDTAovBindings
71 |DirtyDTDepthPriority
72 |DirtyDTCollection)
73 };
74
76 HDST_API
77 void Sync(HdSceneDelegate *sceneDelegate,
78 HdRenderParam *renderParam,
79 HdDirtyBits *dirtyBits) override;
80
84 HDST_API
85 HdDirtyBits GetInitialDirtyBitsMask() const override;
86
87
88 // ---------------------------------------------------------------------- //
90 // ---------------------------------------------------------------------- //
91 bool IsEnabled() const { return _enabled; }
92 const HdStDrawTargetRenderPassState *GetDrawTargetRenderPassState() const
93 {
94 return &_drawTargetRenderPassState;
95 }
96
98 HDST_API
99 HdRprimCollection const &GetCollection() const { return _collection; }
100
102 HDST_API
103 static void GetDrawTargets(HdRenderIndex* renderIndex,
104 HdStDrawTargetPtrVector *drawTargets);
105
110 const GfVec2i &GetResolution() const {
111 return _resolution;
112 }
113
114 void Finalize(HdRenderParam *) override;
115
116private:
117 bool _enabled;
118 GfVec2i _resolution;
119 HdRprimCollection _collection;
120
121 HdStDrawTargetRenderPassState _drawTargetRenderPassState;
122
123 // No copy
124 HdStDrawTarget() = delete;
125 HdStDrawTarget(const HdStDrawTarget &) = delete;
126 HdStDrawTarget &operator =(const HdStDrawTarget &) = delete;
127};
128
129
130PXR_NAMESPACE_CLOSE_SCOPE
131
132#endif // PXR_IMAGING_HD_ST_DRAW_TARGET_H
Basic type for a vector of 2 int components.
Definition: vec2i.h:44
Hydra schema for a camera that pulls the params (see above) during Sync.
Definition: camera.h:92
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:105
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
A named, semantic collection of objects.
Adapter class providing data exchange with the client scene graph.
Sprim (state prim) is a base class of managing state for non-drawable scene entity (e....
Definition: sprim.h:35
Represents an render to texture render pass.
Definition: drawTarget.h:47
HDST_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Synchronizes state from the delegate to this object.
DirtyBits
Dirty bits for the HdStDrawTarget object.
Definition: drawTarget.h:59
HDST_API HdDirtyBits GetInitialDirtyBitsMask() const override
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
static HDST_API void GetDrawTargets(HdRenderIndex *renderIndex, HdStDrawTargetPtrVector *drawTargets)
returns all HdStDrawTargets in the render index
HDST_API HdRprimCollection const & GetCollection() const
Returns collection of rprims the draw target draws.
Definition: drawTarget.h:99
void Finalize(HdRenderParam *) override
Finalizes object resources.
const GfVec2i & GetResolution() const
Resolution.
Definition: drawTarget.h:110
Represents common non-gl context specific render pass state for a draw target.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:92