HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shadowTask.h
Go to the documentation of this file.
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_HDX_SHADOW_TASK_H
25 #define PXR_IMAGING_HDX_SHADOW_TASK_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdx/api.h"
30 #include "pxr/imaging/hd/enums.h"
31 #include "pxr/imaging/hd/task.h"
32 
33 #include "pxr/base/gf/vec4f.h"
34 #include "pxr/base/gf/vec4d.h"
36 
37 #include <memory>
38 
40 
41 class GlfSimpleLight;
42 class HdRenderIndex;
43 class HdSceneDelegate;
45 
47  std::shared_ptr<class HdStRenderPassShader>;
49  std::shared_ptr<class HdStShaderCode>;
50 
51 using HdRenderPassSharedPtr = std::shared_ptr<class HdRenderPass>;
52 using HdRenderPassSharedPtrVector = std::vector<HdRenderPassSharedPtr>;
53 using HdStRenderPassStateSharedPtr = std::shared_ptr<class HdStRenderPassState>;
55  std::vector<HdStRenderPassStateSharedPtr>;
56 
58 
60 {
62  : overrideColor(0.0)
63  , wireframeColor(0.0)
64  , enableLighting(false)
65  , enableIdRender(false)
66  , enableSceneMaterials(true)
67  , alphaThreshold(0.0)
68  , depthBiasEnable(false)
73  {}
74 
75  // RenderPassState
87 };
88 
89 /// \class HdxShadowTask
90 ///
91 /// A task for generating shadow maps.
92 ///
93 class HdxShadowTask : public HdTask
94 {
95 public:
96  HDX_API
97  HdxShadowTask(HdSceneDelegate* delegate, SdfPath const& id);
98 
99  HDX_API
100  ~HdxShadowTask() override;
101 
102  /// Sync the render pass resources
103  HDX_API
104  void Sync(HdSceneDelegate* delegate,
105  HdTaskContext* ctx,
106  HdDirtyBits* dirtyBits) override;
107 
108  /// Prepare the tasks resources
109  HDX_API
110  void Prepare(HdTaskContext* ctx,
111  HdRenderIndex* renderIndex) override;
112 
113  /// Execute render pass task
114  HDX_API
115  void Execute(HdTaskContext* ctx) override;
116 
117  /// Collect Render Tags used by the task.
118  HDX_API
119  const TfTokenVector &GetRenderTags() const override;
120 
121 
122 private:
123  void _UpdateDirtyParams(HdStRenderPassStateSharedPtr &renderPassState,
124  HdxShadowTaskParams const &params);
125 
127  HdStRenderPassStateSharedPtrVector _renderPassStates;
128  HdxShadowTaskParams _params;
129  TfTokenVector _renderTags;
130 
131 
132  HdxShadowTask() = delete;
133  HdxShadowTask(const HdxShadowTask &) = delete;
134  HdxShadowTask &operator =(const HdxShadowTask &) = delete;
135 };
136 
137 // VtValue requirements
138 HDX_API
139 std::ostream& operator<<(std::ostream& out, const HdxShadowTaskParams& pv);
140 HDX_API
141 bool operator==(const HdxShadowTaskParams& lhs, const HdxShadowTaskParams& rhs);
142 HDX_API
143 bool operator!=(const HdxShadowTaskParams& lhs, const HdxShadowTaskParams& rhs);
144 
145 
147 
148 #endif //PXR_IMAGING_HDX_SHADOW_TASK_H
std::vector< HdStRenderPassStateSharedPtr > HdStRenderPassStateSharedPtrVector
Definition: shadowTask.h:55
TF_DECLARE_WEAK_AND_REF_PTRS(GlfSimpleShadowArray)
HdCompareFunction
Definition: enums.h:36
std::shared_ptr< class HdStShaderCode > HdStShaderCodeSharedPtr
HdCullStyle
Definition: enums.h:122
std::shared_ptr< class HdRenderPass > HdRenderPassSharedPtr
Definition: engine.h:41
uint32_t HdDirtyBits
Definition: types.h:158
GfVec4f wireframeColor
Definition: shadowTask.h:77
HdCompareFunction depthFunc
Definition: shadowTask.h:85
#define HDX_API
Definition: api.h:40
HDX_API std::ostream & operator<<(std::ostream &out, const HdxShadowTaskParams &pv)
GLenum const GLfloat * params
Definition: glcorearb.h:105
HDX_API ~HdxShadowTask() override
std::shared_ptr< class HdStRenderPassState > HdStRenderPassStateSharedPtr
Definition: commandBuffer.h:45
GfVec4f overrideColor
Definition: shadowTask.h:76
HDX_API const TfTokenVector & GetRenderTags() const override
Collect Render Tags used by the task.
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the tasks resources.
GLfloat f
Definition: glcorearb.h:1926
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Definition: task.h:54
Definition: path.h:291
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:77
std::shared_ptr< class HdStRenderPassShader > HdStRenderPassShaderSharedPtr
Definition: vec4f.h:62
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
float depthBiasSlopeFactor
Definition: shadowTask.h:84
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
float depthBiasConstantFactor
Definition: shadowTask.h:83
HdCullStyle cullStyle
Definition: shadowTask.h:86
std::vector< HdRenderPassSharedPtr > HdRenderPassSharedPtrVector
Definition: shadowTask.h:52
HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
HDX_API void Execute(HdTaskContext *ctx) override
Execute render pass task.
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542