Loading...
Searching...
No Matches
drawTarget.h
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"
29#include "pxr/imaging/hdSt/drawTargetRenderPassState.h"
30#include "pxr/imaging/hd/rprimCollection.h"
31#include "pxr/imaging/hd/sprim.h"
32
33#include "pxr/usd/sdf/path.h"
34#include "pxr/base/gf/vec2i.h"
36
37#include <vector>
38
39PXR_NAMESPACE_OPEN_SCOPE
40
41
42#define HDST_DRAW_TARGET_TOKENS \
43 (camera) \
44 (collection) \
45 (drawTargetSet) \
46 (enable) \
47 (resolution) \
48 (aovBindings) \
49 (depthPriority)
50
51TF_DECLARE_PUBLIC_TOKENS(HdStDrawTargetTokens, HDST_API, HDST_DRAW_TARGET_TOKENS);
52
53class HdCamera;
54class HdRenderIndex;
55using HdStDrawTargetPtrVector = std::vector<class HdStDrawTarget *>;
56
64class HdStDrawTarget : public HdSprim
65{
66public:
67 HDST_API
68 HdStDrawTarget(SdfPath const & id);
69 HDST_API
70 ~HdStDrawTarget() override;
71
77 enum DirtyBits : HdDirtyBits {
78 Clean = 0,
79 DirtyDTEnable = 1 << 0,
80 DirtyDTCamera = 1 << 1,
81 DirtyDTResolution = 1 << 2,
82 DirtyDTAovBindings = 1 << 4,
83 DirtyDTDepthPriority = 1 << 6,
84 DirtyDTCollection = 1 << 7,
85 AllDirty = (DirtyDTEnable
86 |DirtyDTCamera
87 |DirtyDTResolution
88 |DirtyDTAovBindings
89 |DirtyDTDepthPriority
90 |DirtyDTCollection)
91 };
92
94 HDST_API
95 void Sync(HdSceneDelegate *sceneDelegate,
96 HdRenderParam *renderParam,
97 HdDirtyBits *dirtyBits) override;
98
102 HDST_API
103 HdDirtyBits GetInitialDirtyBitsMask() const override;
104
105
106 // ---------------------------------------------------------------------- //
108 // ---------------------------------------------------------------------- //
109 bool IsEnabled() const { return _enabled; }
110 const HdStDrawTargetRenderPassState *GetDrawTargetRenderPassState() const
111 {
112 return &_drawTargetRenderPassState;
113 }
114
116 HDST_API
117 HdRprimCollection const &GetCollection() const { return _collection; }
118
120 HDST_API
121 static void GetDrawTargets(HdRenderIndex* renderIndex,
122 HdStDrawTargetPtrVector *drawTargets);
123
128 const GfVec2i &GetResolution() const {
129 return _resolution;
130 }
131
132private:
133 bool _enabled;
134 GfVec2i _resolution;
135 HdRprimCollection _collection;
136
137 HdStDrawTargetRenderPassState _drawTargetRenderPassState;
138
139 // No copy
140 HdStDrawTarget() = delete;
141 HdStDrawTarget(const HdStDrawTarget &) = delete;
142 HdStDrawTarget &operator =(const HdStDrawTarget &) = delete;
143};
144
145
146PXR_NAMESPACE_CLOSE_SCOPE
147
148#endif // PXR_IMAGING_HD_ST_DRAW_TARGET_H
Basic type for a vector of 2 int components.
Definition: vec2i.h:61
Hydra schema for a camera that pulls the params (see above) during Sync.
Definition: camera.h:104
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:121
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:52
Represents an render to texture render pass.
Definition: drawTarget.h:65
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:77
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:117
const GfVec2i & GetResolution() const
Resolution.
Definition: drawTarget.h:128
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:290
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:98