All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
drawTargetRenderPassState.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 HDST_DRAW_TARGET_RENDER_PASS_STATE_H
25 #define HDST_DRAW_TARGET_RENDER_PASS_STATE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdSt/api.h"
29 #include "pxr/imaging/hd/enums.h"
30 #include "pxr/imaging/hd/rprimCollection.h"
31 #include "pxr/usd/sdf/path.h"
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 
36 class VtValue;
37 
48 public:
49  HDST_API
51  HDST_API
52  ~HdStDrawTargetRenderPassState(); // final no need to be virtual
53 
55  HDST_API
56  void SetNumColorAttachments(size_t numAttachments);
57 
65  HDST_API
66  void SetColorClearValue(size_t attachmentIdx, const VtValue &clearValue);
67 
70  HDST_API
71  void SetDepthClearValue(float clearValue);
72 
75  HDST_API
76  void SetDepthPriority(HdDepthPriority priority);
77 
79  HDST_API
80  void SetCamera(const SdfPath &cameraId);
81 
82  HDST_API
83  void SetRprimCollection(HdRprimCollection const& col);
84 
86  size_t GetNumColorAttachments() const { return _colorClearValues.size(); }
87 
90  const VtValue &GetColorClearValue(size_t attachmentIdx) const
91  {
92  TF_DEV_AXIOM(attachmentIdx < _colorClearValues.size());
93 
94  return _colorClearValues[attachmentIdx];
95  }
96 
98  float GetDepthClearValue() const { return _depthClearValue; }
99 
100 
101  HdDepthPriority GetDepthPriority() const { return _depthPriority; }
102 
103 
105  const SdfPath &GetCamera() const { return _cameraId; }
106 
111  unsigned int GetRprimCollectionVersion() const
112  {
113  return _rprimCollectionVersion;
114  }
115 
118  {
119  return _rprimCollection;
120  }
121 
122 private:
123  std::vector<VtValue> _colorClearValues;
124  float _depthClearValue;
125  HdDepthPriority _depthPriority;
126 
127  SdfPath _cameraId;
128 
129  HdRprimCollection _rprimCollection;
130  unsigned int _rprimCollectionVersion;
131 
132  HdStDrawTargetRenderPassState(const HdStDrawTargetRenderPassState &) = delete;
133  HdStDrawTargetRenderPassState &operator =(const HdStDrawTargetRenderPassState &) = delete;
134 };
135 
136 
137 PXR_NAMESPACE_CLOSE_SCOPE
138 
139 #endif // HDST_DRAW_TARGET_RENDER_PASS_STATE_H
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
Definition: diagnostic.h:227
const VtValue & GetColorClearValue(size_t attachmentIdx) const
Returns the clear color for the specified buffer.
HDST_API void SetColorClearValue(size_t attachmentIdx, const VtValue &clearValue)
Set the clear value for a color buffer that is applied at the beginning of rendering.
float GetDepthClearValue() const
Returns the clear value for the z-buffer.
HDST_API void SetCamera(const SdfPath &cameraId)
Set the path to the camera to use to draw this render path from.
size_t GetNumColorAttachments() const
Returns the number of color buffers attached to the draw target.
const HdRprimCollection & GetRprimCollection() const
Returns the collection associated with this draw target.
HDST_API void SetDepthPriority(HdDepthPriority priority)
Sets the priority of values in the depth buffer.
unsigned int GetRprimCollectionVersion() const
Returns an increasing version number for when the collection object is changed.
HDST_API void SetDepthClearValue(float clearValue)
Set the clear value for the depth buffer.
HDST_API void SetNumColorAttachments(size_t numAttachments)
Set the number of color buffer&#39;s to use.
const SdfPath & GetCamera() const
Returns the path to the camera to render from.
A named, semantic collection of objects.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:182
Represents common non-gl context specific render pass state for a draw target.