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"
32 #include "pxr/imaging/hd/task.h"
33 
34 #include "pxr/base/gf/vec2f.h"
35 #include "pxr/base/gf/vec4f.h"
36 #include "pxr/base/gf/vec4d.h"
38 
39 #include <memory>
40 
42 
43 class GlfSimpleLight;
44 class HdRenderIndex;
45 class HdSceneDelegate;
47 
49  std::shared_ptr<class HdStRenderPassShader>;
51  std::shared_ptr<class HdStShaderCode>;
52 
53 using HdRenderPassSharedPtr = std::shared_ptr<class HdRenderPass>;
54 using HdRenderPassSharedPtrVector = std::vector<HdRenderPassSharedPtr>;
55 using HdRenderPassStateSharedPtr = std::shared_ptr<class HdRenderPassState>;
57  std::vector<HdRenderPassStateSharedPtr>;
58 
60 
63  : overrideColor(0.0)
64  , wireframeColor(0.0)
65  , enableLighting(false)
66  , enableIdRender(false)
67  , enableSceneMaterials(true)
68  , alphaThreshold(0.0)
69  , depthBiasEnable(false)
74  , camera()
75  , viewport(0.0)
76  , lightIncludePaths(1, SdfPath::AbsoluteRootPath())
78  {}
79 
80  // RenderPassState
92 
93  // RenderPassState index objects
96 
97  // Lights/Shadows specific parameters
100 };
101 
102 /// \class HdxShadowTask
103 ///
104 /// A task for generating shadow maps.
105 ///
106 class HdxShadowTask : public HdTask {
107 public:
108  HDX_API
109  HdxShadowTask(HdSceneDelegate* delegate, SdfPath const& id);
110 
111  HDX_API
112  virtual ~HdxShadowTask();
113 
114  /// Sync the render pass resources
115  HDX_API
116  virtual void Sync(HdSceneDelegate* delegate,
117  HdTaskContext* ctx,
118  HdDirtyBits* dirtyBits) override;
119 
120  /// Prepare the tasks resources
121  HDX_API
122  virtual void Prepare(HdTaskContext* ctx,
123  HdRenderIndex* renderIndex) override;
124 
125  /// Execute render pass task
126  HDX_API
127  virtual void Execute(HdTaskContext* ctx) override;
128 
129  /// Collect Render Tags used by the task.
130  HDX_API
131  virtual const TfTokenVector &GetRenderTags() const override;
132 
133 
134 private:
135  void _SetHdStRenderPassState(HdxShadowTaskParams const &params,
136  HdStRenderPassState *renderPassState);
137 
138  void _UpdateDirtyParams(HdRenderPassStateSharedPtr &renderPassState,
139  HdxShadowTaskParams const &params);
140 
141  static HdStShaderCodeSharedPtr _overrideShader;
142  static void _CreateOverrideShader();
143 
145  HdRenderPassStateSharedPtrVector _renderPassStates;
146  HdxShadowTaskParams _params;
147  TfTokenVector _renderTags;
148 
149 
150  HdxShadowTask() = delete;
151  HdxShadowTask(const HdxShadowTask &) = delete;
152  HdxShadowTask &operator =(const HdxShadowTask &) = delete;
153 };
154 
155 // VtValue requirements
156 HDX_API
157 std::ostream& operator<<(std::ostream& out, const HdxShadowTaskParams& pv);
158 HDX_API
159 bool operator==(const HdxShadowTaskParams& lhs, const HdxShadowTaskParams& rhs);
160 HDX_API
161 bool operator!=(const HdxShadowTaskParams& lhs, const HdxShadowTaskParams& rhs);
162 
163 
165 
166 #endif //PXR_IMAGING_HDX_SHADOW_TASK_H
TF_DECLARE_WEAK_AND_REF_PTRS(GlfSimpleShadowArray)
std::shared_ptr< class HdRenderPassState > HdRenderPassStateSharedPtr
Definition: engine.h:42
HdCompareFunction
Definition: enums.h:36
HdCullStyle
Definition: enums.h:122
std::shared_ptr< class HdRenderPass > HdRenderPassSharedPtr
Definition: engine.h:41
uint32_t HdDirtyBits
Definition: types.h:127
GfVec4f wireframeColor
Definition: shadowTask.h:82
HdCompareFunction depthFunc
Definition: shadowTask.h:90
Definition: vec4d.h:63
#define HDX_API
Definition: api.h:40
SdfPathVector lightExcludePaths
Definition: shadowTask.h:99
HDX_API std::ostream & operator<<(std::ostream &out, const HdxShadowTaskParams &pv)
GfVec4f overrideColor
Definition: shadowTask.h:81
virtual HDX_API ~HdxShadowTask()
GLclampf f
Definition: glew.h:3499
virtual HDX_API void Execute(HdTaskContext *ctx) override
Execute render pass task.
SdfPathVector lightIncludePaths
Definition: shadowTask.h:98
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:563
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:446
Definition: task.h:54
Definition: path.h:288
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
Definition: path.h:209
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:73
std::shared_ptr< class HdStRenderPassShader > HdStRenderPassShaderSharedPtr
Definition: vec4f.h:63
virtual HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
float depthBiasSlopeFactor
Definition: shadowTask.h:89
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
float depthBiasConstantFactor
Definition: shadowTask.h:88
HdCullStyle cullStyle
Definition: shadowTask.h:91
std::vector< HdRenderPassSharedPtr > HdRenderPassSharedPtrVector
Definition: shadowTask.h:54
const GLfloat * params
Definition: glew.h:1531
virtual HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the tasks resources.
virtual HDX_API const TfTokenVector & GetRenderTags() const override
Collect Render Tags used by the task.
std::shared_ptr< class HdStShaderCode > HdStShaderCodeSharedPtr
Definition: drawItem.h:34
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:549
std::vector< HdRenderPassStateSharedPtr > HdRenderPassStateSharedPtrVector
Definition: shadowTask.h:57